├── .clang-format ├── .github └── FUNDING.yml ├── .gitignore ├── CMakeLists.txt ├── COPYING-MEDIA.txt ├── COPYING.txt ├── LICENSE ├── LICENSE_THEORAPLAY.txt ├── Makefile ├── Makefile-steam ├── Makefile-win ├── README.md ├── achievement_id.h ├── achievement_info.h ├── ai_type.h ├── animation.cpp ├── animation.h ├── animation_id.cpp ├── animation_id.h ├── appconfig-dev.txt ├── appconfig.txt ├── assembled_minion.cpp ├── assembled_minion.h ├── attack.h ├── attack_behaviour.h ├── attack_level.h ├── attack_trigger.h ├── attack_type.h ├── attr_info.h ├── attr_type.h ├── audio_device.cpp ├── audio_device.h ├── automaton_part.h ├── avatar_info.cpp ├── avatar_info.h ├── avatar_menu_option.h ├── battle1.txt ├── battle2.txt ├── battle3.txt ├── battle_allies1.txt ├── battle_allies2.txt ├── bed_type.cpp ├── bed_type.h ├── best_attack.h ├── biome_id.h ├── biome_info.h ├── body.cpp ├── body.h ├── body_material.h ├── body_material_id.h ├── body_part.cpp ├── body_part.h ├── bucket_map.cpp ├── bucket_map.h ├── buff_id.h ├── buff_info.cpp ├── buff_info.h ├── build_info.cpp ├── build_info.h ├── building_id.h ├── building_info.h ├── call_cache.h ├── campaign.cpp ├── campaign.h ├── campaign_builder.cpp ├── campaign_builder.h ├── campaign_info.h ├── campaign_menu_index.cpp ├── campaign_menu_index.h ├── campaign_type.h ├── check_serial.sh ├── clock.cpp ├── clock.h ├── cmake ├── FindOGG.cmake ├── FindOgg.cmake ├── FindSDL2_image.cmake ├── FindTHEORA.cmake ├── FindVorbis.cmake └── FindVorbisFile.cmake ├── collective.cpp ├── collective.h ├── collective_attack.cpp ├── collective_attack.h ├── collective_builder.cpp ├── collective_builder.h ├── collective_config.cpp ├── collective_config.h ├── collective_control.cpp ├── collective_control.h ├── collective_name.h ├── collective_teams.cpp ├── collective_teams.h ├── collective_warning.cpp ├── collective_warning.h ├── color.cpp ├── color.h ├── companion_info.h ├── conquer_condition.h ├── construction_map.cpp ├── construction_map.h ├── container_helpers.h ├── container_range.h ├── content_factory.cpp ├── content_factory.h ├── content_id.cpp ├── content_id.h ├── controller.cpp ├── controller.h ├── corpse_info.h ├── cost_info.cpp ├── cost_info.h ├── creature.cpp ├── creature.h ├── creature_action.cpp ├── creature_action.h ├── creature_attributes.cpp ├── creature_attributes.h ├── creature_debt.cpp ├── creature_debt.h ├── creature_experience_info.cpp ├── creature_experience_info.h ├── creature_factory.cpp ├── creature_factory.h ├── creature_group.cpp ├── creature_group.h ├── creature_id.h ├── creature_inventory.cpp ├── creature_inventory.h ├── creature_list.cpp ├── creature_list.h ├── creature_name.cpp ├── creature_name.h ├── creature_predicate.cpp ├── creature_predicate.h ├── creature_status.cpp ├── creature_status.h ├── creature_view.h ├── custom_item_id.h ├── dancing.cpp ├── dancing.h ├── data_contrib ├── Lato-Bol.ttf ├── SIL_Open_Font_License.txt └── Symbola.ttf ├── data_free ├── controller_neptune.vdf ├── controller_ps4.vdf ├── credits.txt ├── default_keybindings.txt ├── game_config │ ├── achievements.txt │ ├── attributes.txt │ ├── biomes.txt │ ├── body_materials.txt │ ├── buffs.txt │ ├── build_menu.txt │ ├── building_info.txt │ ├── campaign_info.txt │ ├── campaign_villains.txt │ ├── creatures.txt │ ├── dance_positions.txt │ ├── endless_enemies.txt │ ├── enemies.txt │ ├── equipment_groups.txt │ ├── furniture.txt │ ├── furniture_lists.txt │ ├── help.txt │ ├── immigration.txt │ ├── intro_text.txt │ ├── item_lists.txt │ ├── items.txt │ ├── keeper_creatures.txt │ ├── keys.txt │ ├── layout_mapping.txt │ ├── map_layouts │ │ ├── adoxie_temple │ │ │ └── adoxie_1.png │ │ ├── adoxie_vault │ │ │ └── adoxie_1.png │ │ ├── castle1 │ │ │ ├── castle1_1.png │ │ │ └── castle1_2.png │ │ ├── city │ │ │ └── city125_1.png │ │ ├── death │ │ │ └── death_1.png │ │ ├── satan │ │ │ └── satan_1.png │ │ └── wizard_tower │ │ │ └── tower1.png │ ├── names.txt │ ├── promotions.txt │ ├── random_layouts.txt │ ├── resource_info.txt │ ├── resources.txt │ ├── spell_schools.txt │ ├── spells.txt │ ├── storage_ids.txt │ ├── technology.txt │ ├── tile_gas_types.txt │ ├── tiles.txt │ ├── translations │ │ ├── english.txt │ │ └── polish.txt │ ├── workshop_info.txt │ ├── workshops_menu.txt │ ├── world_maps.txt │ └── zlevels.txt ├── glyphs.txt ├── images │ ├── barmid.png │ ├── expand_up.png │ ├── icon.png │ ├── icons.png │ ├── map_font.png │ ├── map_font2.png │ ├── menu_core.png │ ├── menu_core_sm.png │ ├── minimap_bar.png │ ├── minimap_icons.png │ ├── mouse_cursor.png │ ├── mouse_cursor2.png │ ├── special_immigrant.png │ ├── spells.png │ ├── succubi.png │ ├── team_icons.png │ ├── ui │ │ ├── barthin.png │ │ ├── button_bg.png │ │ ├── button_corner.png │ │ ├── button_corner_highlight.png │ │ ├── corner1.png │ │ ├── corner2X.png │ │ ├── corner2X_highlight.png │ │ ├── corner3.png │ │ ├── cornermini.png │ │ ├── cornermini2.png │ │ ├── cornermini2_large.png │ │ ├── down.png │ │ ├── horibar.png │ │ ├── horibarmini.png │ │ ├── horibarmini2.png │ │ ├── horiline.png │ │ ├── horiline2.png │ │ ├── immigrant2bg.png │ │ ├── immigrantbg.png │ │ ├── menu_highlight.png │ │ ├── scrollbar.png │ │ ├── scrollmark.png │ │ ├── ui_highlight.png │ │ ├── up.png │ │ ├── vertbar.png │ │ ├── vertbar2.png │ │ ├── vertbarmini.png │ │ ├── vertbarmini2.png │ │ ├── vertibarmsg1.png │ │ └── vertibarmsg2.png │ └── window_bg.png ├── sokoban_input.txt ├── splash.txt ├── steam_input_manifest.vdf └── ui │ ├── achievements.txt │ ├── alliance_message.txt │ ├── avatar_menu.txt │ ├── battle_summary.txt │ ├── buildings.txt │ ├── buildings1.png │ ├── buildings2.png │ ├── capture1.png │ ├── capture2.png │ ├── capture3.png │ ├── common.txt │ ├── conflicting_items.txt │ ├── controller_hint_real_time.txt │ ├── controller_hint_turn_based.txt │ ├── credits.txt │ ├── damage.txt │ ├── damage1.png │ ├── damage2.png │ ├── damage3.png │ ├── damage3.xcf │ ├── deck_menu.png │ ├── deck_real_time.png │ ├── deck_turn_based.png │ ├── exit_menu.txt │ ├── guard_zones.txt │ ├── guard_zones1.png │ ├── guard_zones2.png │ ├── guard_zones3.png │ ├── highscores.txt │ ├── key_capture.txt │ ├── load_menu.txt │ ├── loading_screen.txt │ ├── logo4small.png │ ├── main_menu.txt │ ├── message_board.txt │ ├── message_history.txt │ ├── mods.txt │ ├── multi_choice.txt │ ├── notfound.txt │ ├── number_menu.txt │ ├── pillage_menu.txt │ ├── present_text.txt │ ├── present_text_below.txt │ ├── prisoners.txt │ ├── prisoners_freed.txt │ ├── settings.txt │ ├── steed.txt │ ├── steeds1.png │ ├── steeds2.png │ ├── steeds3.png │ ├── steeds4.png │ ├── test.png │ ├── travelling.txt │ ├── unlock_message.txt │ ├── yes_or_no.txt │ └── yes_or_no_below.txt ├── debug.cpp ├── debug.h ├── destroy_action.cpp ├── destroy_action.h ├── directory_path.cpp ├── directory_path.h ├── drag_and_drop.cpp ├── drag_and_drop.h ├── draw_line.cpp ├── draw_line.h ├── duel_state.h ├── dummy_view.h ├── dungeon_level.cpp ├── dungeon_level.h ├── effect.cpp ├── effect.h ├── effect_type.h ├── encyclopedia.cpp ├── encyclopedia.h ├── enemy_aggression_level.h ├── enemy_factory.cpp ├── enemy_factory.h ├── enemy_id.h ├── enemy_info.cpp ├── enemy_info.h ├── entity_map.cpp ├── entity_map.h ├── entity_set.cpp ├── entity_set.h ├── enum_variant.h ├── enums.h ├── equipment.cpp ├── equipment.h ├── equipment_slot.h ├── event_generator.cpp ├── event_generator.h ├── event_listener.h ├── exit_info.h ├── extern ├── ProgramOptions.h ├── cereal │ ├── LICENSE │ ├── access.hpp │ ├── archives │ │ ├── adapters.hpp │ │ ├── binary.hpp │ │ ├── json.hpp │ │ ├── portable_binary.hpp │ │ └── xml.hpp │ ├── cereal.hpp │ ├── details │ │ ├── helpers.hpp │ │ ├── polymorphic_impl.hpp │ │ ├── polymorphic_impl_fwd.hpp │ │ ├── static_object.hpp │ │ ├── traits.hpp │ │ └── util.hpp │ ├── external │ │ ├── base64.hpp │ │ ├── rapidjson │ │ │ ├── allocators.h │ │ │ ├── document.h │ │ │ ├── encodedstream.h │ │ │ ├── encodings.h │ │ │ ├── error │ │ │ │ ├── en.h │ │ │ │ └── error.h │ │ │ ├── filereadstream.h │ │ │ ├── filewritestream.h │ │ │ ├── fwd.h │ │ │ ├── internal │ │ │ │ ├── biginteger.h │ │ │ │ ├── diyfp.h │ │ │ │ ├── dtoa.h │ │ │ │ ├── ieee754.h │ │ │ │ ├── itoa.h │ │ │ │ ├── meta.h │ │ │ │ ├── pow10.h │ │ │ │ ├── regex.h │ │ │ │ ├── stack.h │ │ │ │ ├── strfunc.h │ │ │ │ ├── strtod.h │ │ │ │ └── swap.h │ │ │ ├── istreamwrapper.h │ │ │ ├── memorybuffer.h │ │ │ ├── memorystream.h │ │ │ ├── msinttypes │ │ │ │ ├── inttypes.h │ │ │ │ └── stdint.h │ │ │ ├── ostreamwrapper.h │ │ │ ├── pointer.h │ │ │ ├── prettywriter.h │ │ │ ├── rapidjson.h │ │ │ ├── reader.h │ │ │ ├── schema.h │ │ │ ├── stream.h │ │ │ ├── stringbuffer.h │ │ │ └── writer.h │ │ └── rapidxml │ │ │ ├── license.txt │ │ │ ├── manual.html │ │ │ ├── rapidxml.hpp │ │ │ ├── rapidxml_iterators.hpp │ │ │ ├── rapidxml_print.hpp │ │ │ └── rapidxml_utils.hpp │ ├── macros.hpp │ └── types │ │ ├── array.hpp │ │ ├── base_class.hpp │ │ ├── bitset.hpp │ │ ├── boost_variant.hpp │ │ ├── chrono.hpp │ │ ├── common.hpp │ │ ├── complex.hpp │ │ ├── concepts │ │ └── pair_associative_container.hpp │ │ ├── deque.hpp │ │ ├── forward_list.hpp │ │ ├── functional.hpp │ │ ├── list.hpp │ │ ├── map.hpp │ │ ├── memory.hpp │ │ ├── polymorphic.hpp │ │ ├── queue.hpp │ │ ├── set.hpp │ │ ├── stack.hpp │ │ ├── string.hpp │ │ ├── tuple.hpp │ │ ├── unordered_map.hpp │ │ ├── unordered_set.hpp │ │ ├── utility.hpp │ │ ├── valarray.hpp │ │ └── vector.hpp ├── cxxopts.h ├── expected.hpp ├── iomanip.h ├── lodepng.cpp ├── lodepng.h ├── optional.h ├── variant.h ├── variant.hpp └── variant_serialize.h ├── external_enemies.cpp ├── external_enemies.h ├── external_enemies_type.h ├── field_of_view.cpp ├── field_of_view.h ├── file_path.cpp ├── file_path.h ├── file_sharing.cpp ├── file_sharing.h ├── fire.cpp ├── fire.h ├── fix_steamworks.sh ├── font_id.h ├── fontstash.cpp ├── fontstash.h ├── fps_counter.cpp ├── fps_counter.h ├── framebuffer.cpp ├── framebuffer.h ├── furnace.cpp ├── furnace.h ├── furniture.cpp ├── furniture.h ├── furniture_array.cpp ├── furniture_array.h ├── furniture_click.cpp ├── furniture_click.h ├── furniture_dropped_items.cpp ├── furniture_dropped_items.h ├── furniture_entry.cpp ├── furniture_entry.h ├── furniture_factory.cpp ├── furniture_factory.h ├── furniture_layer.h ├── furniture_list.cpp ├── furniture_list.h ├── furniture_list_id.h ├── furniture_on_built.cpp ├── furniture_on_built.h ├── furniture_tick.cpp ├── furniture_tick.h ├── furniture_type.h ├── furniture_usage.cpp ├── furniture_usage.h ├── fx_base.h ├── fx_color.cpp ├── fx_color.h ├── fx_curve.cpp ├── fx_curve.h ├── fx_defs.h ├── fx_draw_buffers.cpp ├── fx_draw_buffers.h ├── fx_emission_source.cpp ├── fx_emission_source.h ├── fx_factory.cpp ├── fx_info.cpp ├── fx_info.h ├── fx_manager.cpp ├── fx_manager.h ├── fx_math.cpp ├── fx_math.h ├── fx_name.h ├── fx_particle_system.cpp ├── fx_particle_system.h ├── fx_rect.h ├── fx_renderer.cpp ├── fx_renderer.h ├── fx_texture_factory.cpp ├── fx_texture_name.h ├── fx_variant_name.h ├── fx_vec.cpp ├── fx_vec.h ├── fx_view_manager.cpp ├── fx_view_manager.h ├── game.cpp ├── game.h ├── game_config.cpp ├── game_config.h ├── game_event.h ├── game_info.cpp ├── game_info.h ├── game_save_type.h ├── game_time.cpp ├── game_time.h ├── gdb_input.txt ├── gen_variant.h ├── gen_variant_serialize.h ├── gen_variant_serialize_pretty.h ├── gen_version.sh ├── gender.cpp ├── gender.h ├── gui_builder.cpp ├── gui_builder.h ├── gui_elem.cpp ├── gui_elem.h ├── gzstream.cpp ├── gzstream.h ├── hashing.h ├── health_type.h ├── highscores.cpp ├── highscores.h ├── immigrant_auto_state.h ├── immigrant_info.cpp ├── immigrant_info.h ├── immigration.cpp ├── immigration.h ├── indexed_vector.h ├── inhabitants_info.cpp ├── inhabitants_info.h ├── input_queue.cpp ├── input_queue.h ├── intrinsic_attack.cpp ├── intrinsic_attack.h ├── inventory.cpp ├── inventory.h ├── ioapi.cpp ├── ioapi.h ├── item.cpp ├── item.h ├── item_ability.h ├── item_action.h ├── item_attributes.cpp ├── item_attributes.h ├── item_class.h ├── item_counts.h ├── item_factory.cpp ├── item_factory.h ├── item_index.cpp ├── item_index.h ├── item_list.cpp ├── item_list.h ├── item_list_id.h ├── item_prefix.cpp ├── item_prefix.h ├── item_type.cpp ├── item_type.h ├── item_types.h ├── item_upgrade_info.cpp ├── item_upgrade_info.h ├── keeper.ico ├── keeper.rc ├── keeper.res ├── keeper32.res ├── keeper_base_info.cpp ├── keeper_base_info.h ├── keeper_creature_info.cpp ├── keeper_creature_info.h ├── key_verifier.cpp ├── key_verifier.h ├── keybinding.h ├── keybinding_info.h ├── keybinding_map.cpp ├── keybinding_map.h ├── known_tiles.cpp ├── known_tiles.h ├── lasting_effect.cpp ├── lasting_effect.h ├── lasting_or_buff.cpp ├── lasting_or_buff.h ├── layout_canvas.h ├── layout_generator.cpp ├── layout_generator.h ├── layout_mapping.h ├── layout_mapping_id.h ├── layout_renderer.cpp ├── layout_renderer.h ├── level.cpp ├── level.h ├── level_builder.cpp ├── level_builder.h ├── level_maker.cpp ├── level_maker.h ├── linux_make.sh ├── mac ├── keeper-Info.plist └── keeper.xcodeproj │ └── project.pbxproj ├── main.cpp ├── main_loop.cpp ├── main_loop.h ├── make_all.sh ├── map_gui.cpp ├── map_gui.h ├── map_layout.cpp ├── map_layout.h ├── map_layout_id.h ├── map_layouts.cpp ├── map_layouts.h ├── map_memory.cpp ├── map_memory.h ├── mem_usage_counter.h ├── message_buffer.h ├── message_generator.cpp ├── message_generator.h ├── minimap_gui.cpp ├── minimap_gui.h ├── minion_activity.cpp ├── minion_activity.h ├── minion_activity_map.cpp ├── minion_activity_map.h ├── minion_controller.cpp ├── minion_controller.h ├── minion_equipment.cpp ├── minion_equipment.h ├── minion_equipment_type.h ├── minion_page_index.cpp ├── minion_page_index.h ├── minion_trait.cpp ├── minion_trait.h ├── miniunz.cpp ├── miniunz.h ├── mod_info.h ├── model.cpp ├── model.h ├── model_builder.cpp ├── model_builder.h ├── monster.cpp ├── monster.h ├── monster_ai.cpp ├── monster_ai.h ├── mouse_button_id.h ├── move_info.cpp ├── move_info.h ├── movement_info.cpp ├── movement_info.h ├── movement_set.cpp ├── movement_set.h ├── movement_type.cpp ├── movement_type.h ├── msg_type.h ├── music.cpp ├── music.h ├── music_type.h ├── my_containers.h ├── name_generator.cpp ├── name_generator.h ├── name_generator_id.h ├── navigation_flags.cpp ├── navigation_flags.h ├── obj-opt ├── .gitignore └── extern │ └── .gitignore ├── obj ├── .gitignore └── extern │ └── .gitignore ├── opengl.cpp ├── opengl.h ├── options.cpp ├── options.h ├── osx_make.sh ├── owner_pointer.h ├── parse_game.cpp ├── parse_game.h ├── perlin_noise.cpp ├── perlin_noise.h ├── phylactery_info.h ├── player.cpp ├── player.h ├── player_control.cpp ├── player_control.h ├── player_info_action.h ├── player_message.cpp ├── player_message.h ├── portals.cpp ├── portals.h ├── position.cpp ├── position.h ├── position_map.cpp ├── position_map.h ├── position_matching.cpp ├── position_matching.h ├── pretty_archive.cpp ├── pretty_archive.h ├── pretty_printing.cpp ├── pretty_printing.h ├── profiler.h ├── progress.cpp ├── progress.h ├── progress_meter.cpp ├── progress_meter.h ├── promotion_info.h ├── random_layout_id.h ├── read_write_array.h ├── renderable.cpp ├── renderable.h ├── renderer.cpp ├── renderer.h ├── resource_counts.cpp ├── resource_counts.h ├── resource_id.h ├── resource_info.h ├── resource_path.hpp ├── resource_path.mm ├── retired_enemy_info.h ├── retired_games.cpp ├── retired_games.h ├── rungdb.bat ├── save_file_info.h ├── saved_game_info.cpp ├── saved_game_info.h ├── scripted_help_info.h ├── scripted_ui.cpp ├── scripted_ui.h ├── scripted_ui_data.h ├── scroll_position.cpp ├── scroll_position.h ├── sdl.h ├── sdl_event_generator.cpp ├── sdl_event_generator.h ├── sdl_keycodes.cpp ├── sdl_keycodes.h ├── sectors.cpp ├── sectors.h ├── sendreport.bat ├── sentences.txt ├── serialization.cpp ├── serialization.h ├── serialize_optional.h ├── server ├── .gitignore ├── db.php ├── game_event.php ├── get_messages.php ├── get_sites.php ├── highscores.php ├── tables_alpha19.sql ├── upload_scores.html ├── upload_scores.php ├── upload_site.html └── upload_site.php ├── settlement_info.h ├── shortest_path.cpp ├── shortest_path.h ├── simple_game.cpp ├── simple_game.h ├── sokoban_input.cpp ├── sokoban_input.h ├── sound.cpp ├── sound.h ├── sound_library.cpp ├── sound_library.h ├── special_attr.h ├── special_trait.cpp ├── special_trait.h ├── spectator.cpp ├── spectator.h ├── spell.cpp ├── spell.h ├── spell_id.h ├── spell_map.cpp ├── spell_map.h ├── spell_school.cpp ├── spell_school.h ├── spell_school_id.h ├── square.cpp ├── square.h ├── square_array.cpp ├── square_array.h ├── square_attrib.h ├── stack_printer.cpp ├── stack_printer.h ├── stair_key.cpp ├── stair_key.h ├── statistics.cpp ├── statistics.h ├── stb_truetype.cpp ├── stb_truetype.h ├── stdafx.h ├── steam_achievements.cpp ├── steam_achievements.h ├── steam_appid.txt ├── steam_base.cpp ├── steam_base.h ├── steam_call_result.cpp ├── steam_call_result.h ├── steam_client.cpp ├── steam_client.h ├── steam_friends.cpp ├── steam_friends.h ├── steam_input.cpp ├── steam_input.h ├── steam_internal.h ├── steam_ugc.cpp ├── steam_ugc.h ├── steam_user.cpp ├── steam_user.h ├── steam_utils.cpp ├── steam_utils.h ├── storage_id.h ├── storage_info.h ├── storage_positions.cpp ├── storage_positions.h ├── sunlight_info.cpp ├── sunlight_info.h ├── t_string.cpp ├── t_string.h ├── target_type.h ├── task.cpp ├── task.h ├── task_callback.h ├── task_map.cpp ├── task_map.h ├── team_member_action.cpp ├── team_member_action.h ├── team_order.cpp ├── team_order.h ├── tech_id.h ├── technology.cpp ├── technology.h ├── territory.cpp ├── territory.h ├── test.cpp ├── test.h ├── test_struct.h ├── text_serialization.h ├── texture.cpp ├── texture.h ├── texture_id.h ├── theoraplay.cpp ├── theoraplay.h ├── theoraplay_cvtrgb.h ├── tile.cpp ├── tile.h ├── tile_gas.cpp ├── tile_gas.h ├── tile_gas_info.h ├── tile_gas_type.h ├── tile_info.h ├── tile_paths.cpp ├── tile_paths.h ├── tile_predicate.cpp ├── tile_predicate.h ├── tileset.cpp ├── tileset.h ├── time_queue.cpp ├── time_queue.h ├── translations.cpp ├── translations.h ├── tribe.cpp ├── tribe.h ├── tribe_alignment.cpp ├── tribe_alignment.h ├── tutorial.cpp ├── tutorial.h ├── tutorial_highlight.h ├── tutorial_state.cpp ├── tutorial_state.h ├── unique_entity.cpp ├── unique_entity.h ├── unknown_locations.cpp ├── unknown_locations.h ├── unlocks.cpp ├── unlocks.h ├── unzip.cpp ├── unzip.h ├── user_input.h ├── util.cpp ├── util.h ├── variant_serialize.cpp ├── video.cpp ├── view.cpp ├── view.h ├── view_id.cpp ├── view_id.h ├── view_index.cpp ├── view_index.h ├── view_layer.h ├── view_object.cpp ├── view_object.h ├── view_object_action.cpp ├── view_object_action.h ├── view_object_modifier.h ├── village_action.h ├── village_behaviour.cpp ├── village_behaviour.h ├── village_control.cpp ├── village_control.h ├── villain_group.h ├── villain_type.cpp ├── villain_type.h ├── visibility_map.cpp ├── visibility_map.h ├── vision.cpp ├── vision.h ├── vision_id.h ├── warlord_controller.cpp ├── warlord_controller.h ├── weapon_info.h ├── win64_make.sh ├── window_view.cpp ├── window_view.h ├── windows_make.sh ├── workshop_array.h ├── workshop_info.h ├── workshop_item.cpp ├── workshop_item.h ├── workshop_type.h ├── workshops.cpp ├── workshops.h ├── world_map_info.h ├── z_level_info.cpp ├── z_level_info.h ├── zlevel.cpp ├── zlevel.h ├── zones.cpp └── zones.h /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: llvm 2 | 3 | IndentWidth: 2 4 | TabWidth: 2 5 | UseTab: Never 6 | ColumnLimit: 120 7 | 8 | #AlignAfterOpenBracket: false 9 | AccessModifierOffset: 0 10 | AlignTrailingComments: false 11 | ReflowComments: false 12 | SortIncludes: false 13 | AllowShortBlocksOnASingleLine: false 14 | AllowShortFunctionsOnASingleLine: false 15 | PointerAlignment: Left 16 | 17 | NamespaceIndentation: Inner 18 | SpaceBeforeParens: ControlStatements 19 | FixNamespaceComments: false 20 | Standard: Cpp11 21 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: miki151 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | extern/steamworks 2 | mods/ 3 | build/ 4 | build_kde/ 5 | html/ 6 | obj-*/ 7 | .cache/ 8 | .vscode/ 9 | .kdev4/ 10 | *.kdev4 11 | /*.png 12 | compile_commands.json 13 | unlocks.txt 14 | keybindings.txt 15 | tmp/ 16 | tmp2/ 17 | find 18 | gameplay.txt 19 | highscores_v1_0.dat 20 | libeasy_profiler.so 21 | parse_game 22 | *.kep 23 | *.aut 24 | *.sit 25 | *.ret 26 | *.swp 27 | *.adv 28 | *.cam 29 | *.war 30 | version.h 31 | data 32 | sound_wav 33 | stdafx.h.* 34 | installid.txt 35 | installId.txt 36 | options_v1_0.txt 37 | sokoban_state.txt 38 | system_info.txt 39 | stacktrace.out 40 | KeeperRL.cflags 41 | KeeperRL.cxxflags 42 | KeeperRL.creator* 43 | KeeperRL.config 44 | KeeperRL.files 45 | KeeperRL.includes 46 | keeper 47 | keeper.exe 48 | steam_api.dll 49 | steam_api64.dll 50 | gen_version 51 | log.gz 52 | libsteam_api.so 53 | worldgen_out.txt 54 | -------------------------------------------------------------------------------- /COPYING-MEDIA.txt: -------------------------------------------------------------------------------- 1 | Every file located in directory 'data' is granted to use only with the official binary distribution of KeeperRL. 2 | 3 | Every file located in directory 'data_free' is granted under the Creative Commons BY-SA licence. See https://creativecommons.org/licenses/by-sa/2.0/ 4 | 5 | The file Lato-Bol.ttf was made by Łukasz Dziedzic (latofonts.com) and is distributed under the SIL Open Font License. 6 | 7 | The file icons.png is a derivative of work by Lorc (http://game-icons.net) 8 | 9 | The file Symbola.ttf is public domain. 10 | 11 | Please contact miki@keeperrl.com for more information. 12 | -------------------------------------------------------------------------------- /LICENSE_THEORAPLAY.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2021 Ryan C. Gordon . 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /achievement_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class AchievementId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /achievement_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "view_id.h" 5 | #include "t_string.h" 6 | 7 | struct AchievementInfo { 8 | TString SERIAL(name); 9 | TString SERIAL(description); 10 | ViewIdList SERIAL(viewId); 11 | SERIALIZE_ALL(viewId, name, description) 12 | }; -------------------------------------------------------------------------------- /ai_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | 6 | RICH_ENUM(AIType, MELEE, RANGED); -------------------------------------------------------------------------------- /animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | class ViewObject; 6 | class Renderer; 7 | class Color; 8 | 9 | class Animation { 10 | public: 11 | void render(Renderer&, Rectangle bounds, Vec2 origin, Vec2 squareSize, milliseconds time, Color); 12 | bool isDone(milliseconds time) const; 13 | void setBegin(milliseconds time); 14 | static PAnimation thrownObject(Vec2 direction, ViewId, bool useSprite); 15 | static PAnimation fromId(AnimationId, Dir orientation); 16 | virtual ~Animation() {} 17 | 18 | protected: 19 | Animation(milliseconds duration); 20 | virtual void renderSpec(Renderer&, Rectangle bounds, Vec2 origin, Vec2 squareSize, double state, Color) = 0; 21 | 22 | private: 23 | optional begin; 24 | milliseconds duration; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /animation_id.cpp: -------------------------------------------------------------------------------- 1 | #include "animation_id.h" 2 | 3 | 4 | const char* getFileName(AnimationId id) { 5 | switch (id) { 6 | case AnimationId::ATTACK: 7 | return "attack.png"; 8 | case AnimationId::DEATH: 9 | return "death.png"; 10 | } 11 | } 12 | 13 | milliseconds getDuration(AnimationId id) { 14 | switch (id) { 15 | case AnimationId::ATTACK: 16 | return milliseconds{300}; 17 | case AnimationId::DEATH: 18 | return milliseconds{800}; 19 | } 20 | } 21 | 22 | int getNumFrames(AnimationId id) { 23 | switch (id) { 24 | case AnimationId::ATTACK: 25 | return 3; 26 | case AnimationId::DEATH: 27 | return 8; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /animation_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(AnimationId, 6 | DEATH, 7 | ATTACK 8 | ); 9 | 10 | extern milliseconds getDuration(AnimationId); 11 | extern const char* getFileName(AnimationId); 12 | extern int getNumFrames(AnimationId); 13 | -------------------------------------------------------------------------------- /appconfig-dev.txt: -------------------------------------------------------------------------------- 1 | "upload_url" "http://keeperrl.com/~retired/37" 2 | "save_version" "8108" 3 | "mod_version" "Alpha37" 4 | "steamworks" "1" 5 | "debug_options" "1" 6 | -------------------------------------------------------------------------------- /appconfig.txt: -------------------------------------------------------------------------------- 1 | "upload_url" "http://keeperrl.com/~retired/37" 2 | "save_version" "8104" 3 | "mod_version" "Alpha37" 4 | "steamworks" "1" 5 | -------------------------------------------------------------------------------- /assembled_minion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "minion_trait.h" 5 | #include "effect.h" 6 | #include "creature_id.h" 7 | 8 | struct AssembledMinion { 9 | void assemble(Collective*, Item*, Position) const; 10 | CreatureId SERIAL(creature); 11 | EnumSet SERIAL(traits); 12 | vector SERIAL(effects); 13 | double SERIAL(scale) = 1.0; 14 | SERIALIZE_ALL(NAMED(creature), NAMED(traits), OPTION(effects), SKIP(scale)) 15 | }; 16 | -------------------------------------------------------------------------------- /attack_behaviour.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "creature_list.h" 4 | #include "resource_id.h" 5 | 6 | EMPTY_STRUCT(KillLeader); 7 | EMPTY_STRUCT(HalloweenKids); 8 | 9 | using StealResource = CollectiveResourceId; 10 | 11 | struct KillMembers { 12 | int SERIAL(count); 13 | COMPARE_ALL(count) 14 | }; 15 | 16 | using CampAndSpawn = CreatureList; 17 | 18 | 19 | #define VARIANT_TYPES_LIST\ 20 | X(KillLeader, 0)\ 21 | X(StealResource, 1)\ 22 | X(HalloweenKids, 2)\ 23 | X(KillMembers, 3)\ 24 | X(CampAndSpawn, 4) 25 | 26 | #define VARIANT_NAME AttackBehaviour 27 | 28 | #include "gen_variant.h" 29 | #include "gen_variant_serialize.h" 30 | inline 31 | #include "gen_variant_serialize_pretty.h" 32 | 33 | #undef VARIANT_TYPES_LIST 34 | #undef VARIANT_NAME 35 | -------------------------------------------------------------------------------- /attack_level.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(AttackLevel, LOW, MIDDLE, HIGH ); 6 | -------------------------------------------------------------------------------- /attack_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | AttackType, 7 | CUT, 8 | STAB, 9 | CRUSH, 10 | BITE, 11 | HIT, 12 | SHOOT, 13 | SPELL 14 | ); 15 | 16 | 17 | -------------------------------------------------------------------------------- /attr_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "view_id.h" 6 | #include "fx_info.h" 7 | #include "effect.h" 8 | #include "t_string.h" 9 | 10 | struct AttrInfo { 11 | TString SERIAL(name); 12 | ViewId SERIAL(viewId); 13 | TString SERIAL(adjective); 14 | int SERIAL(absorptionCap); 15 | int SERIAL(modifierVariation) = 1; 16 | int SERIAL(wishedItemIncrease) = 5; 17 | bool SERIAL(isAttackAttr) = false; 18 | optional SERIAL(meleeFX); 19 | TString SERIAL(help); 20 | optional SERIAL(bodyPartInjury); 21 | optional SERIAL(onAttackedEffect); 22 | SERIALIZE_ALL(NAMED(bodyPartInjury), NAMED(name), NAMED(viewId), NAMED(adjective), NAMED(absorptionCap), OPTION(modifierVariation), OPTION(wishedItemIncrease), OPTION(isAttackAttr), NAMED(meleeFX), NAMED(help), NAMED(onAttackedEffect)) 23 | }; -------------------------------------------------------------------------------- /attr_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class AttrType : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /automaton_part.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "effect.h" 6 | #include "view_id.h" 7 | #include "item_prefix.h" 8 | 9 | struct AutomatonPart { 10 | TString SERIAL(minionGroup); 11 | int SERIAL(layer); 12 | ViewId SERIAL(installedId); 13 | SERIALIZE_ALL(layer, minionGroup, installedId) 14 | }; 15 | -------------------------------------------------------------------------------- /avatar_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "keeper_creature_info.h" 5 | #include "content_factory.h" 6 | #include "villain_group.h" 7 | 8 | struct AvatarInfo { 9 | PCreature playerCreature; 10 | KeeperCreatureInfo creatureInfo; 11 | string avatarId; 12 | TribeAlignment tribeAlignment; 13 | vector villainGroups; 14 | optional chosenBaseName; 15 | }; 16 | 17 | class View; 18 | class GameConfig; 19 | class Options; 20 | class Unlocks; 21 | 22 | extern variant getAvatarInfo(View*, const vector>&, 23 | ContentFactory*, const Unlocks&, Options*); 24 | extern AvatarInfo getQuickGameAvatar(View*, const KeeperCreatureInfo&, CreatureFactory*); 25 | extern TribeId getPlayerTribeId(TribeAlignment); -------------------------------------------------------------------------------- /avatar_menu_option.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(AvatarMenuOption, 6 | TUTORIAL, 7 | CHANGE_MOD, 8 | GO_BACK 9 | ); 10 | -------------------------------------------------------------------------------- /battle1.txt: -------------------------------------------------------------------------------- 1 | 24 5 2 | ######################## 3 | #####################a## 4 | #eeeeeeeeeeeeeeeeeeeea## 5 | #####################a## 6 | ######################## 7 | -------------------------------------------------------------------------------- /battle2.txt: -------------------------------------------------------------------------------- 1 | 21 10 2 | ##################### 3 | #.e.e...........a.a## 4 | #ee............a.a.## 5 | #e.e...........aa..## 6 | #.ee............aa.## 7 | #ee.............a.a## 8 | #e..e..........a.a.## 9 | #.ee.............aa## 10 | #.e.e...........a.a## 11 | ##################### 12 | -------------------------------------------------------------------------------- /battle3.txt: -------------------------------------------------------------------------------- 1 | 21 6 2 | ##################### 3 | #.e.ee........aaa.a## 4 | #ee.ee........aa.aa## 5 | #eee.e.........aaaa## 6 | #eeee.........a.aaa## 7 | ##################### 8 | -------------------------------------------------------------------------------- /battle_allies2.txt: -------------------------------------------------------------------------------- 1 | 1 2 | OGRE M12 ChainArmor,BattleAxe,IronBoots,IronHelm,LeatherGloves 3 | 4 | -------------------------------------------------------------------------------- /bed_type.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "bed_type.h" 3 | #include "t_string.h" 4 | 5 | TStringId getName(BedType type) { 6 | switch (type) { 7 | case BedType::PRISON: return TStringId("PRISON_TILE"); 8 | case BedType::COFFIN: return TStringId("COFFIN"); 9 | case BedType::BED: return TStringId("BED"); 10 | case BedType::CAGE: return TStringId("CAGE"); 11 | case BedType::STABLE: return TStringId("STABLE"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bed_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | BedType, 7 | BED, 8 | COFFIN, 9 | PRISON, 10 | CAGE, 11 | STABLE 12 | ); 13 | 14 | class TStringId; 15 | TStringId getName(BedType); 16 | TStringId getPlural(BedType); 17 | -------------------------------------------------------------------------------- /best_attack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "enums.h" 6 | #include "view_id.h" 7 | 8 | struct BestAttack { 9 | ViewId HASH(viewId); 10 | int HASH(value); 11 | HASH_ALL(viewId, value) 12 | }; 13 | -------------------------------------------------------------------------------- /biome_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class BiomeId : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /body_material.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "item_type.h" 6 | #include "health_type.h" 7 | #include "lasting_or_buff.h" 8 | #include "t_string.h" 9 | 10 | struct BodyMaterial { 11 | TString SERIAL(name); 12 | HashSet SERIAL(intrinsicallyAffected); 13 | HashSet SERIAL(immuneTo); 14 | bool SERIAL(killedByBoulder) = true; 15 | bool SERIAL(canCopulate) = false; 16 | bool SERIAL(hasBrain) = false; 17 | bool SERIAL(flamable) = false; 18 | bool SERIAL(undead) = false; 19 | bool SERIAL(canLoseBodyParts) = true; 20 | bool SERIAL(losingHeadsMeansDeath) = false; 21 | TString SERIAL(deathDescription); 22 | optional SERIAL(healthType); 23 | optional SERIAL(bodyPartItem); 24 | SERIALIZE_ALL(OPTION(losingHeadsMeansDeath), OPTION(canLoseBodyParts), NAMED(name), OPTION(intrinsicallyAffected), OPTION(immuneTo), OPTION(killedByBoulder), OPTION(canCopulate), OPTION(hasBrain), OPTION(flamable), OPTION(undead), NAMED(deathDescription), OPTION(healthType), NAMED(bodyPartItem)) 25 | }; -------------------------------------------------------------------------------- /body_material_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class BodyMaterialId : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /body_part.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "body_part.h" 3 | #include "t_string.h" 4 | 5 | TString getName(BodyPart part) { 6 | switch (part) { 7 | case BodyPart::LEG: return TStringId("LEG_BODY_PART"); 8 | case BodyPart::ARM: return TStringId("ARM_BODY_PART"); 9 | case BodyPart::WING: return TStringId("WING_BODY_PART"); 10 | case BodyPart::HEAD: return TStringId("HEAD_BODY_PART"); 11 | case BodyPart::TORSO: return TStringId("TORSO_BODY_PART"); 12 | case BodyPart::BACK: return TStringId("BACK_BODY_PART"); 13 | } 14 | } 15 | 16 | TString getPluralText(BodyPart part, int num) { 17 | if (num == 1) 18 | return TSentence("A_ARTICLE", getName(part)); 19 | else 20 | return TSentence("BODY_PART_NUMBER", toText(num), makePlural(getName(part))); 21 | } 22 | -------------------------------------------------------------------------------- /body_part.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(BodyPart, 6 | HEAD, 7 | TORSO, 8 | ARM, 9 | WING, 10 | LEG, 11 | BACK 12 | ); 13 | 14 | class TString; 15 | extern TString getName(BodyPart); 16 | extern TString getPluralText(BodyPart, int num); 17 | -------------------------------------------------------------------------------- /bucket_map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "entity_set.h" 5 | #include "indexed_vector.h" 6 | 7 | template 8 | class BucketMap { 9 | public: 10 | BucketMap(Vec2 size, int bucketSize); 11 | 12 | void addElement(Vec2, T*); 13 | void removeElement(Vec2, T*); 14 | void moveElement(Vec2 from, Vec2 to, T*); 15 | int countElementsInBucket(Vec2) const; 16 | 17 | vector getElements(Rectangle area) const; 18 | 19 | SERIALIZATION_DECL(BucketMap) 20 | 21 | private: 22 | int SERIAL(bucketSize); 23 | Table::Id>> SERIAL(buckets); 24 | }; 25 | 26 | class Creature; 27 | class CreatureBucketMap : public BucketMap { 28 | public: 29 | using BucketMap::BucketMap; 30 | }; 31 | -------------------------------------------------------------------------------- /buff_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class BuffId : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /building_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class BuildingId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /campaign_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | 6 | struct CampaignInfo { 7 | Vec2 SERIAL(size); 8 | int SERIAL(maxMainVillains); 9 | int SERIAL(maxLesserVillains); 10 | int SERIAL(maxMinorVillains); 11 | int SERIAL(maxAllies); 12 | int SERIAL(initialRadius); 13 | int SERIAL(mapZoom) = 2; 14 | int SERIAL(minimapZoom) = 2; 15 | SERIALIZE_ALL(NAMED(size), NAMED(maxMainVillains), NAMED(maxLesserVillains), NAMED(maxMinorVillains), NAMED(maxAllies), NAMED(initialRadius), OPTION(mapZoom), OPTION(minimapZoom)) 16 | }; 17 | -------------------------------------------------------------------------------- /campaign_menu_index.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | namespace CampaignMenuElems { 6 | EMPTY_STRUCT(RetiredDungeons); 7 | EMPTY_STRUCT(Settings); 8 | EMPTY_STRUCT(ChangeMode); 9 | EMPTY_STRUCT(Help); 10 | EMPTY_STRUCT(Confirm); 11 | EMPTY_STRUCT(RollMap); 12 | EMPTY_STRUCT(Back); 13 | EMPTY_STRUCT(None); 14 | using CampaignMenuIndexVariant = variant; 15 | } 16 | 17 | struct CampaignMenuIndex : public CampaignMenuElems::CampaignMenuIndexVariant { 18 | using CampaignMenuElems::CampaignMenuIndexVariant::CampaignMenuIndexVariant; 19 | template 20 | void assign(T elem) { 21 | *((CampaignMenuElems::CampaignMenuIndexVariant*)this) = std::move(elem); 22 | } 23 | void left(); 24 | void right(); 25 | void up(); 26 | void down(); 27 | }; -------------------------------------------------------------------------------- /campaign_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(CampaignType, 6 | FREE_PLAY, QUICK_MAP 7 | ); 8 | -------------------------------------------------------------------------------- /clock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "extern/optional.h" 5 | 6 | class Clock { 7 | public: 8 | Clock(bool neverPause = false); 9 | milliseconds getMillis(); 10 | void pause(); 11 | void cont(); 12 | bool isPaused(); 13 | static milliseconds getRealMillis(); 14 | static microseconds getRealMicros(); 15 | static bool isChristmas(); 16 | 17 | private: 18 | steady_clock::time_point getCurrent(); 19 | steady_clock::time_point pausedTime; 20 | optional lastPause; 21 | steady_clock::time_point initTime; 22 | bool neverPause = false; 23 | }; 24 | 25 | class ScopeTimer { 26 | public: 27 | ScopeTimer(const char* msg); 28 | ~ScopeTimer(); 29 | 30 | private: 31 | const char* message; 32 | Clock clock; 33 | }; 34 | 35 | class Intervalometer { 36 | public: 37 | Intervalometer(milliseconds frequency); 38 | int getCount(milliseconds currentTime); 39 | void clear(); 40 | 41 | private: 42 | milliseconds frequency; 43 | optional lastUpdate; 44 | }; 45 | 46 | -------------------------------------------------------------------------------- /cmake/FindOGG.cmake: -------------------------------------------------------------------------------- 1 | # - FindOgg.cmake 2 | # Find the native ogg includes and libraries 3 | # 4 | # OGG_INCLUDE_DIRS - where to find ogg/ogg.h, etc. 5 | # OGG_LIBRARIES - List of libraries when using ogg. 6 | # OGG_FOUND - True if ogg found. 7 | 8 | if(OGG_INCLUDE_DIR AND OGG_LIBRARY) 9 | # Already in cache, be silent 10 | set(OGG_FIND_QUIETLY TRUE) 11 | endif(OGG_INCLUDE_DIR AND OGG_LIBRARY) 12 | 13 | find_path(OGG_INCLUDE_DIR ogg/ogg.h) 14 | 15 | # MSVC built ogg may be named ogg_static. 16 | # The provided project files name the library with the lib prefix. 17 | find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static) 18 | 19 | # Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND 20 | # to TRUE if all listed variables are TRUE. 21 | include(FindPackageHandleStandardArgs) 22 | find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR) 23 | 24 | if(OGG_FOUND) 25 | set(OGG_LIBRARIES ${OGG_LIBRARY}) 26 | set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) 27 | endif(OGG_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindOgg.cmake: -------------------------------------------------------------------------------- 1 | # - FindOgg.cmake 2 | # Find the native ogg includes and libraries 3 | # 4 | # OGG_INCLUDE_DIRS - where to find ogg/ogg.h, etc. 5 | # OGG_LIBRARIES - List of libraries when using ogg. 6 | # OGG_FOUND - True if ogg found. 7 | 8 | if(OGG_INCLUDE_DIR AND OGG_LIBRARY) 9 | # Already in cache, be silent 10 | set(OGG_FIND_QUIETLY TRUE) 11 | endif(OGG_INCLUDE_DIR AND OGG_LIBRARY) 12 | 13 | find_path(OGG_INCLUDE_DIR ogg/ogg.h) 14 | 15 | # MSVC built ogg may be named ogg_static. 16 | # The provided project files name the library with the lib prefix. 17 | find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static) 18 | 19 | # Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND 20 | # to TRUE if all listed variables are TRUE. 21 | include(FindPackageHandleStandardArgs) 22 | find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR) 23 | 24 | if(OGG_FOUND) 25 | set(OGG_LIBRARIES ${OGG_LIBRARY}) 26 | set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) 27 | endif(OGG_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindVorbis.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find vorbis 2 | # Once done this will define 3 | # 4 | # VORBIS_FOUND - system has libvorbis 5 | # VORBIS_INCLUDE_DIRS - the libvorbis include directory 6 | # VORBIS_LIBRARIES - The libvorbis libraries 7 | 8 | find_package(PkgConfig) 9 | if(PKG_CONFIG_FOUND) 10 | pkg_check_modules (VORBIS vorbis) 11 | list(APPEND VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDEDIR}) 12 | endif() 13 | 14 | if(NOT VORBIS_FOUND) 15 | find_path(VORBIS_INCLUDE_DIRS vorbis/vorbisenc.h) 16 | find_library(VORBIS_LIBRARIES vorbis) 17 | endif() 18 | 19 | include(FindPackageHandleStandardArgs) 20 | find_package_handle_standard_args(Vorbis DEFAULT_MSG VORBIS_INCLUDE_DIRS VORBIS_LIBRARIES) 21 | 22 | mark_as_advanced(VORBIS_INCLUDE_DIRS VORBIS_LIBRARIES) 23 | -------------------------------------------------------------------------------- /collective_attack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "view_id.h" 5 | #include "t_string.h" 6 | 7 | class CollectiveAttack { 8 | public: 9 | CollectiveAttack(vector attackTasks, Collective* attacker, const vector&, 10 | optional ransom = none); 11 | CollectiveAttack(vector attackTasks, const TString& name, ViewIdList, const vector&); 12 | 13 | Collective* getAttacker() const; 14 | const TString& getAttackerName() const; 15 | ViewIdList getAttackerViewId() const; 16 | const vector& getCreatures() const; 17 | optional getRansom() const; 18 | bool isOngoing() const; 19 | 20 | bool operator == (const CollectiveAttack&) const; 21 | 22 | SERIALIZATION_DECL(CollectiveAttack) 23 | 24 | private: 25 | optional SERIAL(ransom); 26 | vector SERIAL(creatures); 27 | Collective* SERIAL(attacker) = nullptr; 28 | TString SERIAL(attackerName); 29 | ViewIdList SERIAL(attackerViewId); 30 | vector> SERIAL(attackTasks); 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /collective_name.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "view_id.h" 5 | #include "t_string.h" 6 | 7 | struct CollectiveName { 8 | optional SERIAL(shortened); 9 | TString SERIAL(full); 10 | TString SERIAL(race); 11 | ViewIdList SERIAL(viewId); 12 | optional SERIAL(location); 13 | SERIALIZE_ALL(shortened, full, race, viewId, location) 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /companion_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "attr_type.h" 5 | 6 | struct CompanionInfo { 7 | int SERIAL(count) = 1; 8 | bool SERIAL(spawnAway) = true; 9 | optional SERIAL(statsBase); 10 | double SERIAL(summonFreq); 11 | vector SERIAL(creatures); 12 | bool SERIAL(hostile) = false; 13 | bool SERIAL(getsKillCredit) = false; 14 | SERIALIZE_ALL(OPTION(count), OPTION(spawnAway), OPTION(statsBase), NAMED(summonFreq), NAMED(creatures), OPTION(hostile), OPTION(getsKillCredit)) 15 | }; 16 | -------------------------------------------------------------------------------- /conquer_condition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(ConquerCondition, 6 | KILL_LEADER, 7 | KILL_FIGHTERS_AND_LEADER, 8 | DESTROY_BUILDINGS, 9 | NEVER 10 | ); 11 | -------------------------------------------------------------------------------- /container_helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "debug.h" 5 | #include "my_containers.h" 6 | 7 | template 8 | auto getOnlyElement(const Container& v) { 9 | CHECK(v.size() == 1) << v.size(); 10 | return *v.begin(); 11 | } 12 | 13 | template 14 | void emplaceBack(vector&) {} 15 | 16 | template 17 | void emplaceBack(vector& v, First&& first, Args&&... args) { 18 | v.emplace_back(std::move(std::forward(first))); 19 | emplaceBack(v, std::forward(args)...); 20 | } 21 | 22 | template 23 | vector makeVec(T&& f, Args&&... args) { 24 | vector ret; 25 | ret.reserve(sizeof...(Args) + 1); 26 | ret.push_back(std::forward(f)); 27 | emplaceBack(ret, std::forward(args)...); 28 | return ret; 29 | } 30 | 31 | template 32 | void mergeMap(Map from, Map& to) { 33 | for (auto&& elem : from) 34 | if (!to.count(elem.first)) 35 | to.insert(std::move(elem)); 36 | }; 37 | 38 | -------------------------------------------------------------------------------- /corpse_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "unique_entity.h" 3 | #include "serialization.h" 4 | 5 | class Creature; 6 | 7 | struct CorpseInfo { 8 | UniqueEntity::Id SERIAL(victim); 9 | bool SERIAL(canBeRevived); 10 | bool SERIAL(hasHead); 11 | bool SERIAL(isSkeleton); 12 | SERIALIZE_ALL(victim, canBeRevived, hasHead, isSkeleton); 13 | }; 14 | 15 | 16 | -------------------------------------------------------------------------------- /cost_info.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "cost_info.h" 3 | #include "resource_id.h" 4 | 5 | 6 | CostInfo::CostInfo(CollectiveResourceId i, int v) : id(i), value(v) {} 7 | 8 | SERIALIZATION_CONSTRUCTOR_IMPL(CostInfo); 9 | SERIALIZE_DEF(CostInfo, id, value); 10 | 11 | CostInfo CostInfo::noCost() { 12 | return CostInfo{CollectiveResourceId("GOLD"), 0}; 13 | } 14 | 15 | CostInfo CostInfo::operator - () const { 16 | return CostInfo(id, -value); 17 | } 18 | 19 | CostInfo CostInfo::operator * (int a) const { 20 | return CostInfo(id, a * value); 21 | } 22 | 23 | CostInfo CostInfo::operator / (int a) const { 24 | return CostInfo(id, value / a); 25 | } 26 | 27 | #include "pretty_archive.h" 28 | template void CostInfo::serialize(PrettyInputArchive&, unsigned); 29 | -------------------------------------------------------------------------------- /cost_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "enums.h" 4 | #include "util.h" 5 | #include "resource_id.h" 6 | 7 | class CostInfo { 8 | public: 9 | CostInfo(CollectiveResourceId, int amount); 10 | static CostInfo noCost(); 11 | 12 | CostInfo operator - () const; 13 | CostInfo operator * (int) const; 14 | CostInfo operator / (int) const; 15 | 16 | SERIALIZATION_DECL(CostInfo) 17 | 18 | CollectiveResourceId SERIAL(id) = CollectiveResourceId("GOLD"); 19 | short SERIAL(value) = 0; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /creature_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "t_string.h" 5 | 6 | class Creature; 7 | 8 | class NODISCARD CreatureAction { 9 | public: 10 | typedef function ActionFun; 11 | 12 | CreatureAction(const Creature*, ActionFun); 13 | CreatureAction(ActionFun); 14 | CreatureAction(); 15 | CreatureAction(TString failedReason); 16 | CreatureAction prepend(ActionFun); 17 | CreatureAction append(ActionFun); 18 | CreatureAction prepend(CreatureAction); 19 | CreatureAction append(CreatureAction); 20 | void perform(Creature*); 21 | const optional& getFailedReason() const; 22 | explicit operator bool() const; 23 | 24 | private: 25 | ActionFun action; 26 | optional failedMessage; 27 | const Creature* performer = nullptr; 28 | }; 29 | 30 | 31 | -------------------------------------------------------------------------------- /creature_debt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "unique_entity.h" 5 | #include "entity_map.h" 6 | 7 | class Creature; 8 | 9 | class CreatureDebt { 10 | public: 11 | int getTotal(const Creature*) const; 12 | vector getCreditors(const Creature* creature) const; 13 | int getAmountOwed(const Creature* creditor) const; 14 | void add(const Creature*, int); 15 | 16 | template 17 | void serialize(Archive& ar, const unsigned int version); 18 | 19 | private: 20 | EntityMap SERIAL(debt); 21 | int SERIAL(total); 22 | }; 23 | -------------------------------------------------------------------------------- /creature_experience_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "attr_type.h" 5 | #include "view_id.h" 6 | #include "t_string.h" 7 | 8 | class ContentFactory; 9 | 10 | struct CreatureExperienceInfo { 11 | struct TrainingInfo { 12 | AttrType HASH(attr); 13 | ViewId HASH(viewId); 14 | TString HASH(name); 15 | double HASH(level); 16 | int HASH(limit); 17 | optional HASH(warning); 18 | HASH_ALL(attr, viewId, name, level, limit, warning) 19 | }; 20 | vector HASH(training); 21 | double HASH(combatExperience); 22 | double HASH(teamExperience); 23 | int HASH(combatExperienceCap); 24 | int HASH(requiredLuxury); 25 | int HASH(numAvailableUpgrades); 26 | HASH_ALL(training, combatExperience, teamExperience, combatExperienceCap, numAvailableUpgrades, requiredLuxury) 27 | }; 28 | 29 | extern CreatureExperienceInfo getCreatureExperienceInfo(const ContentFactory*, const Creature*); 30 | extern int getMaxPromotionLevel(double quartersLuxury); 31 | extern int getRequiredLuxury(double combatExp); -------------------------------------------------------------------------------- /creature_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class CreatureId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /creature_inventory.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "creature_inventory.h" 3 | 4 | 5 | SERIALIZE_DEF(CreatureInventoryElem, type, countMin, countMax, chance, prefixChance, alternative) 6 | 7 | #include "pretty_archive.h" 8 | 9 | template <> 10 | void CreatureInventoryElem::serialize(PrettyInputArchive& ar1, const unsigned int) { 11 | ar1(NAMED(type), OPTION(countMin), OPTION(countMax), OPTION(chance), OPTION(prefixChance), NAMED(alternative)); 12 | ar1(endInput()); 13 | if (countMin > countMax) 14 | ar1.error("countMin > countMax (" + toString(countMin) + ", " + toString(countMax) + ")"); 15 | } 16 | -------------------------------------------------------------------------------- /creature_inventory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "item_type.h" 5 | #include "item_types.h" 6 | 7 | struct CreatureInventoryElem { 8 | ItemTypeVariant SERIAL(type); 9 | int SERIAL(countMin) = 1; 10 | int SERIAL(countMax) = 1; 11 | double SERIAL(chance) = 1; 12 | double SERIAL(prefixChance) = 0; 13 | optional SERIAL(alternative); 14 | template 15 | void serialize(Archive& ar1, const unsigned int); 16 | }; 17 | 18 | using CreatureInventory = vector; 19 | -------------------------------------------------------------------------------- /creature_status.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(CreatureStatus, 6 | PRISONER, 7 | CIVILIAN, 8 | LEADER, 9 | FIGHTER 10 | ); 11 | 12 | class Color; 13 | class TStringId; 14 | 15 | extern Color getColor(CreatureStatus); 16 | extern optional getDescription(CreatureStatus); 17 | extern TStringId getName(CreatureStatus); 18 | extern EnumSet getDisplayedOnMinions(); 19 | -------------------------------------------------------------------------------- /custom_item_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class ContentFactory; 6 | 7 | class CustomItemId : public ContentId { 8 | public: 9 | using ContentId::ContentId; 10 | SItemAttributes getAttributes(const ContentFactory*) const; 11 | }; 12 | -------------------------------------------------------------------------------- /data_contrib/Lato-Bol.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_contrib/Lato-Bol.ttf -------------------------------------------------------------------------------- /data_contrib/Symbola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_contrib/Symbola.ttf -------------------------------------------------------------------------------- /data_free/credits.txt: -------------------------------------------------------------------------------- 1 | Design and programming: 2 | Michał Brzozowski 3 | 4 | Music: 5 | Marcin Brzozowski and Krzysztof Łoza 6 | https://soundcloud.com/martindemarco 7 | https://soundcloud.com/christopher-loza 8 | 9 | Graphics: 10 | 16-bit fantasy set by oryxdesignlab.com 11 | ShroomArts, shroomarts.blogspot.com 12 | Artur Reterski, http://artperski.com 13 | 14 | Intro film: 15 | Kamil Kucharski, https://www.behance.net/Kucharsky 16 | 17 | Testing and ideas: 18 | Jakub Jurkowski 19 | 20 | Consultations: 21 | Ted Martens, @ted_martens 22 | DarkGod, @darkgodone 23 | 24 | Extra content: 25 | SoftMonster 26 | RighteousSinner 27 | Archdiggle 28 | 29 | Font: 30 | Lato by Łukasz Dziedzic 31 | latofonts.com 32 | 33 | LodePNG library by Lode Vandevenne 34 | 35 | See license.txt for licence of particular data. 36 | -------------------------------------------------------------------------------- /data_free/game_config/campaign_info.txt: -------------------------------------------------------------------------------- 1 | "default" { 2 | size = {100 65} 3 | mapZoom = 2 4 | minimapZoom = 2 5 | maxMainVillains = 12 6 | maxLesserVillains = 12 7 | maxMinorVillains = 16 8 | maxAllies = 8 9 | initialRadius = 14 10 | } 11 | -------------------------------------------------------------------------------- /data_free/game_config/equipment_groups.txt: -------------------------------------------------------------------------------- 1 | EQUIPMENT_GROUP_ADAMANTINE_EQUIPMENT {"sword" Rgb 148 189 189 255 } 2 | EQUIPMENT_GROUP_ADOXIUM_EQUIPMENT {"adoxium_staff"} 3 | EQUIPMENT_GROUP_ARTIFACT_EQUIPMENT {"cyclops_helm"} 4 | EQUIPMENT_GROUP_BASIC_EQUIPMENT {"club"} 5 | EQUIPMENT_GROUP_CONSUMABLES {"first_aid"} 6 | EQUIPMENT_GROUP_INFERNITE_EQUIPMENT {"infernite_sword"} 7 | EQUIPMENT_GROUP_IRON_EQUIPMENT {"sword"} 8 | EQUIPMENT_GROUP_JEWELLERY {"amulet1"} 9 | EQUIPMENT_GROUP_LIGHT_EMITTING_EQUIPMENT {"hand_torch"} 10 | EQUIPMENT_GROUP_RANGED_WEAPONS {"bow"} 11 | STEEDS_EQUIPMENT_GROUP {"horse"} -------------------------------------------------------------------------------- /data_free/game_config/help.txt: -------------------------------------------------------------------------------- 1 | {"prisoners" {"prisoner"} HELP_TITLE} 2 | {"steed" {"horse"} HELP_TITLE1} 3 | {"buildings" {"castle_wall"} HELP_TITLE2} 4 | {"damage" {"sword"} HELP_TITLE3} 5 | {"travelling"} 6 | {"guard_zones" {"guard_post"} HELP_TITLE4} 7 | -------------------------------------------------------------------------------- /data_free/game_config/intro_text.txt: -------------------------------------------------------------------------------- 1 | GAME_INTRO -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/adoxie_temple/adoxie_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/adoxie_temple/adoxie_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/adoxie_vault/adoxie_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/adoxie_vault/adoxie_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/castle1/castle1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/castle1/castle1_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/castle1/castle1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/castle1/castle1_2.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/city/city125_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/city/city125_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/death/death_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/death/death_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/satan/satan_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/satan/satan_1.png -------------------------------------------------------------------------------- /data_free/game_config/map_layouts/wizard_tower/tower1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/game_config/map_layouts/wizard_tower/tower1.png -------------------------------------------------------------------------------- /data_free/game_config/resource_info.txt: -------------------------------------------------------------------------------- 1 | # Resource definitions 2 | # Make sure to add a new item and set resourceId = "X" in items.txt when adding a new physical resource. 3 | # If there is no item or storageId then this is a non-physical resource. 4 | 5 | # ResourceId name viewId (if visible in UI) tutorialHighlight 6 | 7 | "GOLD" { RESOURCE_INFO_GOLD_NAME { "gold" } } 8 | "WOOD" { RESOURCE_INFO_WOOD_NAME { "wood_plank" } WOOD_RESOURCE } 9 | "STONE" { RESOURCE_INFO_STONE_NAME { "rock" } } 10 | "IRON" { RESOURCE_INFO_IRON_NAME { "iron_rock" } } 11 | "ADA" { RESOURCE_INFO_ADA_NAME { "ada_ore" } } 12 | "ADOXIUM" { RESOURCE_INFO_ADOXIUM_NAME { "adoxium_rock" } } 13 | "INFERNITE" { RESOURCE_INFO_INFERNITE_NAME { "infernite_rock" } } 14 | "CORPSE" { RESOURCE_INFO_CORPSE_NAME { "body_part" } } 15 | "PRISONER_HEAD" { RESOURCE_INFO_PRISONER_HEAD_NAME } 16 | "DEMON_PIETY" { RESOURCE_INFO_DEMON_PIETY_NAME } 17 | -------------------------------------------------------------------------------- /data_free/game_config/storage_ids.txt: -------------------------------------------------------------------------------- 1 | "equipment" 2 | "resources" 3 | "corpses" 4 | "gold" 5 | "potions" 6 | "scrolls" 7 | "jewellery" 8 | "upgrades" 9 | "armor" 10 | "bows" 11 | "weapons" 12 | "automaton_parts" 13 | "books" 14 | -------------------------------------------------------------------------------- /data_free/game_config/tile_gas_types.txt: -------------------------------------------------------------------------------- 1 | "FOG" { 2 | TILE_GAS_TYPES_FOG_NAME 3 | ColorId WHITE 4 | 0.95 5 | 0.0 6 | true 7 | } 8 | 9 | "POISON_GAS" { 10 | TILE_GAS_TYPES_POISON_GAS_NAME 11 | ColorId GREEN 12 | 0.98 13 | 0.1 14 | false 15 | Filter Not LastingEffect POISON_RESISTANT { 16 | CreatureMessage { TILE_GAS_TYPES_POISON_GAS_SECONDPERSON TILE_GAS_TYPES_POISON_GAS_THIRDPERSON} 17 | Bleed 0.02 TILE_GAS_TYPES_POISON_GAS_THIRDPERSON1 18 | } 19 | } 20 | 21 | "BLACK_SMOKE" { 22 | TILE_GAS_TYPES_BLACK_SMOKE_NAME 23 | ColorId BLACK 24 | 0.95 25 | 0.0 26 | false 27 | Filter BodyMaterial FLESH { 28 | Chance 0.2 Lasting PANIC 29 | Lasting 10 DEF_DEBUFF 30 | } 31 | } 32 | 33 | "BLACK_MASS_SMOKE" { 34 | TILE_GAS_TYPES_BLACK_MASS_SMOKE_NAME 35 | ColorId BLACK 36 | 0.95 37 | 0.05 38 | false 39 | Filter BodyMaterial FLESH { 40 | Chance 0.2 Lasting PANIC 41 | Chance 0.1 CreatureMessage {TILE_GAS_TYPES_BLACK_MASS_SMOKE_SECONDPERSON TILE_GAS_TYPES_BLACK_MASS_SMOKE_THIRDPERSON} 42 | #Lasting 10 DEF_DEBUFF 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /data_free/game_config/world_maps.txt: -------------------------------------------------------------------------------- 1 | WORLD_MAPS "world_map" 2 | WORLD_MAPS1 "world_map_test" 3 | -------------------------------------------------------------------------------- /data_free/images/barmid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/barmid.png -------------------------------------------------------------------------------- /data_free/images/expand_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/expand_up.png -------------------------------------------------------------------------------- /data_free/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/icon.png -------------------------------------------------------------------------------- /data_free/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/icons.png -------------------------------------------------------------------------------- /data_free/images/map_font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/map_font.png -------------------------------------------------------------------------------- /data_free/images/map_font2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/map_font2.png -------------------------------------------------------------------------------- /data_free/images/menu_core.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/menu_core.png -------------------------------------------------------------------------------- /data_free/images/menu_core_sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/menu_core_sm.png -------------------------------------------------------------------------------- /data_free/images/minimap_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/minimap_bar.png -------------------------------------------------------------------------------- /data_free/images/minimap_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/minimap_icons.png -------------------------------------------------------------------------------- /data_free/images/mouse_cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/mouse_cursor.png -------------------------------------------------------------------------------- /data_free/images/mouse_cursor2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/mouse_cursor2.png -------------------------------------------------------------------------------- /data_free/images/special_immigrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/special_immigrant.png -------------------------------------------------------------------------------- /data_free/images/spells.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/spells.png -------------------------------------------------------------------------------- /data_free/images/succubi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/succubi.png -------------------------------------------------------------------------------- /data_free/images/team_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/team_icons.png -------------------------------------------------------------------------------- /data_free/images/ui/barthin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/barthin.png -------------------------------------------------------------------------------- /data_free/images/ui/button_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/button_bg.png -------------------------------------------------------------------------------- /data_free/images/ui/button_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/button_corner.png -------------------------------------------------------------------------------- /data_free/images/ui/button_corner_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/button_corner_highlight.png -------------------------------------------------------------------------------- /data_free/images/ui/corner1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/corner1.png -------------------------------------------------------------------------------- /data_free/images/ui/corner2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/corner2X.png -------------------------------------------------------------------------------- /data_free/images/ui/corner2X_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/corner2X_highlight.png -------------------------------------------------------------------------------- /data_free/images/ui/corner3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/corner3.png -------------------------------------------------------------------------------- /data_free/images/ui/cornermini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/cornermini.png -------------------------------------------------------------------------------- /data_free/images/ui/cornermini2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/cornermini2.png -------------------------------------------------------------------------------- /data_free/images/ui/cornermini2_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/cornermini2_large.png -------------------------------------------------------------------------------- /data_free/images/ui/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/down.png -------------------------------------------------------------------------------- /data_free/images/ui/horibar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/horibar.png -------------------------------------------------------------------------------- /data_free/images/ui/horibarmini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/horibarmini.png -------------------------------------------------------------------------------- /data_free/images/ui/horibarmini2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/horibarmini2.png -------------------------------------------------------------------------------- /data_free/images/ui/horiline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/horiline.png -------------------------------------------------------------------------------- /data_free/images/ui/horiline2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/horiline2.png -------------------------------------------------------------------------------- /data_free/images/ui/immigrant2bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/immigrant2bg.png -------------------------------------------------------------------------------- /data_free/images/ui/immigrantbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/immigrantbg.png -------------------------------------------------------------------------------- /data_free/images/ui/menu_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/menu_highlight.png -------------------------------------------------------------------------------- /data_free/images/ui/scrollbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/scrollbar.png -------------------------------------------------------------------------------- /data_free/images/ui/scrollmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/scrollmark.png -------------------------------------------------------------------------------- /data_free/images/ui/ui_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/ui_highlight.png -------------------------------------------------------------------------------- /data_free/images/ui/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/up.png -------------------------------------------------------------------------------- /data_free/images/ui/vertbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertbar.png -------------------------------------------------------------------------------- /data_free/images/ui/vertbar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertbar2.png -------------------------------------------------------------------------------- /data_free/images/ui/vertbarmini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertbarmini.png -------------------------------------------------------------------------------- /data_free/images/ui/vertbarmini2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertbarmini2.png -------------------------------------------------------------------------------- /data_free/images/ui/vertibarmsg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertibarmsg1.png -------------------------------------------------------------------------------- /data_free/images/ui/vertibarmsg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/ui/vertibarmsg2.png -------------------------------------------------------------------------------- /data_free/images/window_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/images/window_bg.png -------------------------------------------------------------------------------- /data_free/splash.txt: -------------------------------------------------------------------------------- 1 | 39 5 2 | 100101111011110111101111011110222202000 3 | 101001000010000100101000010010200202000 4 | 110001111011110111101111011110222202000 5 | 101001000010000100001000010100202002000 6 | 100101111011110100001111010010200202222 7 | -------------------------------------------------------------------------------- /data_free/ui/achievements.txt: -------------------------------------------------------------------------------- 1 | 2 | Window(Width 700 Height 700 { 3 | BlockEvents 4 | ExitButtons() 5 | Scrolling(List(VERTICAL, Horizontal { 6 | Using "view_id" ViewId() 7 | Width 10 {} 8 | { 9 | Using "name" Label(color = ColorId LIGHT_GRAY) 10 | If "unlocked" Using "name" Label(color = ColorId WHITE) 11 | } 12 | })) 13 | }) -------------------------------------------------------------------------------- /data_free/ui/alliance_message.txt: -------------------------------------------------------------------------------- 1 | 2 | { 3 | ExitButtonsWithEnter() 4 | Window(MarginLeft(10, MarginBottom(10, { 5 | Position(LEFT_CENTERED, Margins(6, Using "view_id" ViewId(2))) 6 | Position(MIDDLE, MarginLeft(80, MarginRight(80, 7 | Vertical { 8 | Using "message" Label() 9 | Height 10 {} 10 | Label(TEXT4) 11 | } 12 | ))) 13 | }))) 14 | } 15 | -------------------------------------------------------------------------------- /data_free/ui/battle_summary.txt: -------------------------------------------------------------------------------- 1 | 2 | { 3 | ExitButtons() 4 | FocusKeysVertical() 5 | Window(MarginLeft(10, MarginBottom(10, Width 450 { 6 | Vertical { 7 | #Label("Battle summary") 8 | Using "minions_killed" CreatureList(TEXT63) 9 | Using "minions_captured" CreatureList(TEXT64) 10 | Using "enemies_killed" CreatureList(TEXT65) 11 | Using "enemies_captured" CreatureList(TEXT66) 12 | } 13 | }))) 14 | } 15 | -------------------------------------------------------------------------------- /data_free/ui/buildings.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(700, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Horizontal{ViewId(1, {"castle_wall"}) Width 10 {} Label(TEXT3)} 7 | Height 30 {} 8 | P(TEXT129) 9 | Height 15 {} 10 | P(TEXT130) 11 | Height 15 {} 12 | Position(MIDDLE, Texture("buildings1")) 13 | Height 15 {} 14 | P(TEXT131) 15 | Height 15 {} 16 | P(TEXT132) 17 | Height 15 {} 18 | P(TEXT133) 19 | Height 15 {} 20 | Position(MIDDLE, Texture("buildings2")) 21 | Height 15 {} 22 | P(TEXT134) 23 | Height 15 {} 24 | } 25 | )))) 26 | -------------------------------------------------------------------------------- /data_free/ui/buildings1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/buildings1.png -------------------------------------------------------------------------------- /data_free/ui/buildings2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/buildings2.png -------------------------------------------------------------------------------- /data_free/ui/capture1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/capture1.png -------------------------------------------------------------------------------- /data_free/ui/capture2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/capture2.png -------------------------------------------------------------------------------- /data_free/ui/capture3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/capture3.png -------------------------------------------------------------------------------- /data_free/ui/conflicting_items.txt: -------------------------------------------------------------------------------- 1 | 2 | { 3 | ExitButtons() 4 | FocusKeysVertical() 5 | Window( 6 | Vertical { 7 | Position(MIDDLE, MarginLeft(40, MarginRight(40, 8 | Label(TEXT12 )))) 9 | Height 10 {} 10 | Using "items" List(VERTICAL, 11 | MarginLeft(40, Horizontal{ Using "view_id" ViewId(1) Using "item" Label() })) 12 | Height 35 {} 13 | Position(MIDDLE, Horizontal { 14 | Using "callback" StandardButton(Label(CONFIRM_BUTTON)) 15 | Width 30 {} 16 | Using "EXIT" StandardButton(Label(CANCEL_BUTTON)) 17 | }) 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /data_free/ui/controller_hint_real_time.txt: -------------------------------------------------------------------------------- 1 | 2 | { 3 | BlockEvents 4 | ExitButtonsWithEnter() 5 | Position(BOTTOM_CENTERED, Width 800 MiniWindow({ 6 | Fill(Rgb 0 0 0 200) 7 | Vertical { 8 | Label(TEXT22) 9 | Height 5 {} 10 | Label(TEXT23) 11 | Height 5 {} 12 | Label(TEXT24) 13 | Height 5 {} 14 | Label(TEXT25) 15 | Height 5 {} 16 | Label(TEXT26) 17 | Height 5 {} 18 | Label(TEXT27) 19 | Height 5 {} 20 | Horizontal { 21 | Label(TEXT28) 22 | Label(text = TEXT29 font = SYMBOL_FONT) 23 | Label(TEXT30) 24 | } 25 | Height 5 {} 26 | Horizontal { 27 | Label(TEXT31) 28 | { 29 | Label(text = TEXT32 font = SYMBOL_FONT) 30 | MarginLeft(-4, Label(text = TEXT33 font = SYMBOL_FONT)) 31 | } 32 | Label(TEXT34) 33 | } 34 | Height 5 {} 35 | Position(MIDDLE, Texture("deck_real_time")) 36 | Height 5 {} 37 | Label(size = 14 text = TEXT35) 38 | } 39 | })) 40 | } 41 | -------------------------------------------------------------------------------- /data_free/ui/controller_hint_turn_based.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | ExitButtonsWithEnter() 4 | Position(BOTTOM_CENTERED, Width 800 MiniWindow({ 5 | Fill(Rgb 0 0 0 200) 6 | Vertical { 7 | Label(TEXT36) 8 | Height 5 {} 9 | Label(TEXT37) 10 | Height 5 {} 11 | Label(TEXT38) 12 | Height 5 {} 13 | Label(TEXT39) 14 | Height 5 {} 15 | Label(TEXT40) 16 | Height 5 {} 17 | Position(MIDDLE, Texture("deck_turn_based")) 18 | Height 5 {} 19 | Label(size = 14 text = TEXT35) 20 | } 21 | })) 22 | } 23 | -------------------------------------------------------------------------------- /data_free/ui/damage.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Horizontal{ViewId(1, {"sword"}) Width 10 {} Label(TEXT41)} 7 | Height 30 {} 8 | P(TEXT143) 9 | Height 15 {} 10 | Position(MIDDLE, Texture("damage1")) 11 | Height 15 {} 12 | P(TEXT144) 13 | Height 15 {} 14 | P(TEXT145) 15 | Height 15 {} 16 | P(TEXT146) 17 | Height 15 {} 18 | Position(MIDDLE, Texture("damage2")) 19 | Height 15 {} 20 | P(TEXT147) 21 | Height 15 {} 22 | Position(MIDDLE, Texture("damage3")) 23 | Height 15 {} 24 | P(TEXT148) 25 | Height 15 {} 26 | P(TEXT149) 27 | Height 15 {} 28 | } 29 | )))) 30 | -------------------------------------------------------------------------------- /data_free/ui/damage1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/damage1.png -------------------------------------------------------------------------------- /data_free/ui/damage2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/damage2.png -------------------------------------------------------------------------------- /data_free/ui/damage3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/damage3.png -------------------------------------------------------------------------------- /data_free/ui/damage3.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/damage3.xcf -------------------------------------------------------------------------------- /data_free/ui/deck_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/deck_menu.png -------------------------------------------------------------------------------- /data_free/ui/deck_real_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/deck_real_time.png -------------------------------------------------------------------------------- /data_free/ui/deck_turn_based.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/deck_turn_based.png -------------------------------------------------------------------------------- /data_free/ui/exit_menu.txt: -------------------------------------------------------------------------------- 1 | 2 | Def IconButton(Id, Text) 3 | StandardButton( 4 | Vertical { 5 | ViewId(5, {Id}) 6 | Height 10 {} 7 | Position(MIDDLE, Label(Text)) 8 | Height 10 {} 9 | } 10 | ) 11 | End 12 | 13 | Def IconButtonInactive(Id, Text) 14 | StandardButtonInactive( 15 | Vertical { 16 | ViewId(5, {Id}) 17 | Height 10 {} 18 | Position(MIDDLE, Label(text = Text color = ColorId LIGHT_GRAY)) 19 | Height 10 {} 20 | } 21 | ) 22 | End 23 | 24 | { 25 | ExitButtons() 26 | FocusKeysHorizontal() 27 | Window( 28 | Horizontal { 29 | Using "save" IconButton("portal", TEXT57) 30 | Width 20 {} 31 | Using "options" IconButton("gnome", TEXT58) 32 | Width 20 {} 33 | Using "retire" IconButton("throne", TEXT59) 34 | Using "retire_inactive" IconButtonInactive("throne", TEXT59) 35 | Width 20 {} 36 | Using "abandon" IconButton("grave", TEXT60) 37 | } 38 | ) 39 | } 40 | -------------------------------------------------------------------------------- /data_free/ui/guard_zones.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Horizontal{ViewId(1, {"guard_post"}) Width 10 {} Label(TEXT42)} 7 | Height 30 {} 8 | P(TEXT150) 9 | Height 15 {} 10 | P(TEXT151) 11 | Height 15 {} 12 | Position(MIDDLE, Texture("guard_zones1")) 13 | Height 15 {} 14 | Position(MIDDLE, Texture("guard_zones2")) 15 | Height 15 {} 16 | P(TEXT152) 17 | Height 15 {} 18 | Position(MIDDLE, Texture("guard_zones3")) 19 | Height 15 {} 20 | P(TEXT153) 21 | Height 15 {} 22 | } 23 | )))) 24 | -------------------------------------------------------------------------------- /data_free/ui/guard_zones1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/guard_zones1.png -------------------------------------------------------------------------------- /data_free/ui/guard_zones2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/guard_zones2.png -------------------------------------------------------------------------------- /data_free/ui/guard_zones3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/guard_zones3.png -------------------------------------------------------------------------------- /data_free/ui/highscores.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | ExitButtons() 4 | FocusKeysHorizontal() 5 | Window(Width 700 Height 700 { 6 | Vertical { 7 | Height 30 {} 8 | Height 630 Scrolling(MarginRight(10, Using "list" List(VERTICAL, 9 | Height 30 Horizontal { 10 | Using "text" Label() 11 | Stretch {} 12 | Using "score" Label() 13 | } 14 | ))) 15 | } 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /data_free/ui/key_capture.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents() 3 | Position(SCREEN, Fill(Rgb 0 0 0 150)) 4 | ExitButtons() 5 | MiniWindow(Margins(10, { 6 | Vertical { 7 | Label(TEXT14) 8 | Height 20 {} 9 | Using "text" Label() 10 | } 11 | Using "callback" KeyCatcher 12 | })) 13 | } 14 | -------------------------------------------------------------------------------- /data_free/ui/loading_screen.txt: -------------------------------------------------------------------------------- 1 | 2 | MiniWindow(Margins(5, MinWidth 300 { 3 | Using "barCallback" Margins(-3, DynamicWidth Fill(Rgb 0 150 0 50)) 4 | Position(MIDDLE, Vertical { 5 | Using "text" Label() 6 | Height 10 {} 7 | Using "cancelCallback" { 8 | KeybindingHandler(EXIT_MENU) 9 | Position(MIDDLE, StandardButtonNotFocusable(Horizontal { 10 | Label(CANCEL_BUTTON) 11 | Width 10 {} 12 | RenderKeybinding(EXIT_MENU, true) 13 | })) 14 | } 15 | }) 16 | })) 17 | -------------------------------------------------------------------------------- /data_free/ui/logo4small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/logo4small.png -------------------------------------------------------------------------------- /data_free/ui/message_board.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | ExitButtons() 4 | Window(Width 700 MaxHeight 700 { 5 | Vertical { 6 | Stretch Using "messages" Scrolling(List(VERTICAL, { 7 | Vertical { 8 | Using "text" Paragraph(600) 9 | Height 10 {} 10 | Horizontal { Label(TEXT) Using "author" Label() } 11 | Height 25 {} 12 | } 13 | })) 14 | Position(MIDDLE, Using "write_something" StandardButton(Label(TEXT1))) 15 | } 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /data_free/ui/message_history.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | FocusKeysVertical() 4 | ExitButtonsWithEnter() 5 | Window(Width 700 MaxHeight 700 { 6 | Scrolling(List(VERTICAL, { 7 | Using "NORMAL" Paragraph(600) 8 | Using "HIGH" Paragraph(600, none, 19, ColorId ORANGE) 9 | Using "CRITICAL" Paragraph(600, none, 19, ColorId RED) 10 | })) 11 | }) 12 | } -------------------------------------------------------------------------------- /data_free/ui/multi_choice.txt: -------------------------------------------------------------------------------- 1 | Def ChoiceButton() { 2 | ButtonLayout(BUTTON_BOTTOM, BUTTON_SIDE, BUTTON_CORNER) 3 | Using "callback" Focusable ButtonLayout(BUTTON_BOTTOM_HIGHLIGHT, BUTTON_SIDE_HIGHLIGHT, BUTTON_CORNER_HIGHLIGHT) 4 | Position(MIDDLE, Margins(14, 8, 10, 10, Using "text" Label())) 5 | Using "callback" Button() 6 | } 7 | End 8 | 9 | 10 | { 11 | BlockEvents 12 | FocusKeysVertical() 13 | ExitButtons() 14 | Window(MarginRight(30, MarginLeft(30, MaxHeight 700 { 15 | Vertical { 16 | Position(MIDDLE, Using "title" Label()) 17 | Height 25 {} 18 | Stretch Position(MIDDLE, Using "options" List(VERTICAL, MarginBottom(10, ChoiceButton()))) 19 | } 20 | }))) 21 | } 22 | -------------------------------------------------------------------------------- /data_free/ui/notfound.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | P(TEXT128) 7 | Height 15 {} 8 | } 9 | )))) 10 | -------------------------------------------------------------------------------- /data_free/ui/present_text.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | FocusKeysVertical() 4 | ExitButtonsWithEnter() 5 | Window(Width 700 MaxHeight 700 { 6 | Scrolling(Vertical { 7 | Using "title" Label() 8 | Height 25 {} 9 | Using "text" Paragraph(600) 10 | }) 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /data_free/ui/present_text_below.txt: -------------------------------------------------------------------------------- 1 | { 2 | BlockEvents 3 | FocusKeysVertical() 4 | ExitButtonsWithEnter() 5 | Position(SCREEN, Position(BOTTOM_CENTERED, Window(Width 700 MaxHeight 700 { 6 | Vertical { 7 | Using "title" Label() 8 | Height 25 {} 9 | Using "text" Paragraph(600) 10 | } 11 | }))) 12 | } 13 | -------------------------------------------------------------------------------- /data_free/ui/prisoners.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Horizontal{ViewId(1, {"prisoner"}) Width 10 {} Label(TEXT53)} 7 | Height 30 {} 8 | P(TEXT154) 9 | Height 15 {} 10 | P(TEXT155) 11 | Height 15 {} 12 | Position(MIDDLE, Texture("capture1")) 13 | Height 15 {} 14 | P(TEXT156) 15 | Height 15 {} 16 | P(TEXT157) 17 | Height 15 {} 18 | Position(MIDDLE, Texture("capture2")) 19 | Height 15 {} 20 | P(TEXT158) 21 | Height 15{} 22 | Position(MIDDLE, Texture("capture3")) 23 | } 24 | )))) 25 | -------------------------------------------------------------------------------- /data_free/ui/prisoners_freed.txt: -------------------------------------------------------------------------------- 1 | { 2 | ExitButtons() 3 | FocusKeysVertical() 4 | Window(MarginLeft(10, MarginBottom(10, Width 450 { 5 | CreatureList(TEXT124) 6 | }))) 7 | } 8 | -------------------------------------------------------------------------------- /data_free/ui/steed.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Height 5 {} 7 | Horizontal{ViewId(1, {"horse"}) Width 10 {} Label(TEXT20)} 8 | Height 30 {} 9 | P(TEXT135) 10 | Height 15 {} 11 | P(TEXT136) 12 | Height 15 {} 13 | Position(MIDDLE, Texture("steeds1")) 14 | Height 15 {} 15 | P(TEXT137) 16 | Height 15 {} 17 | Position(MIDDLE, Texture("steeds2")) 18 | Height 15 {} 19 | P(TEXT138) 20 | Position(MIDDLE, Texture("steeds3")) 21 | P(TEXT139) 22 | Height 15 {} 23 | P(TEXT140) 24 | Height 15 {} 25 | Position(MIDDLE, Texture("steeds4")) 26 | } 27 | )))) 28 | -------------------------------------------------------------------------------- /data_free/ui/steeds1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/steeds1.png -------------------------------------------------------------------------------- /data_free/ui/steeds2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/steeds2.png -------------------------------------------------------------------------------- /data_free/ui/steeds3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/steeds3.png -------------------------------------------------------------------------------- /data_free/ui/steeds4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/steeds4.png -------------------------------------------------------------------------------- /data_free/ui/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/data_free/ui/test.png -------------------------------------------------------------------------------- /data_free/ui/travelling.txt: -------------------------------------------------------------------------------- 1 | 2 | Def P(Text) Paragraph(500, Text) End 3 | 4 | MiniWindow(Scrolling(MarginRight(30, MarginLeft(30, 5 | Vertical { 6 | Horizontal{ViewId(1, {"leather_boots"}) Width 10 {} Label(TEXT21)} 7 | Height 30 {} 8 | P(TEXT141) 9 | P(TEXT142) 10 | } 11 | )))) 12 | -------------------------------------------------------------------------------- /data_free/ui/unlock_message.txt: -------------------------------------------------------------------------------- 1 | 2 | { 3 | ExitButtonsWithEnter() 4 | Window(MarginLeft(10, MarginBottom(10, { 5 | Position(LEFT_CENTERED, Margins(6, Using "view_id" ViewId(2))) 6 | Position(MIDDLE, MarginLeft(80, MarginRight(80, Using "message" Label()))) 7 | }))) 8 | } 9 | -------------------------------------------------------------------------------- /data_free/ui/yes_or_no.txt: -------------------------------------------------------------------------------- 1 | 2 | YesOrNo() 3 | -------------------------------------------------------------------------------- /data_free/ui/yes_or_no_below.txt: -------------------------------------------------------------------------------- 1 | 2 | MarginTop(450, YesOrNo()) 3 | -------------------------------------------------------------------------------- /destroy_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | class Sound; 6 | class TStringId; 7 | 8 | class DestroyAction { 9 | public: 10 | enum class Type; 11 | DestroyAction(Type); 12 | TStringId getVerbSecondPerson() const; 13 | TStringId getVerbThirdPerson() const; 14 | TStringId getIsDestroyed() const; 15 | TStringId getTaskDescription() const; 16 | optional getSoundText() const; 17 | optional getSound() const; 18 | Type getType() const; 19 | bool canDestroyFriendly() const; 20 | bool canNavigate(const Creature*) const; 21 | bool destroyAnimation() const; 22 | MinionActivity getMinionActivity() const; 23 | double getDamage(Creature*) const; 24 | 25 | SERIALIZATION_DECL(DestroyAction) 26 | 27 | private: 28 | Type SERIAL(type); 29 | }; 30 | 31 | RICH_ENUM(DestroyAction::Type, 32 | BOULDER, 33 | BASH, 34 | CUT, 35 | DIG, 36 | HOSTILE_DIG, 37 | FILL 38 | ); 39 | -------------------------------------------------------------------------------- /directory_path.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "my_containers.h" 5 | 6 | class FilePath; 7 | 8 | bool isAbsolutePath(const char* path); 9 | string getAbsolute(const char* path); 10 | 11 | class DirectoryPath { 12 | public: 13 | explicit DirectoryPath(string); 14 | 15 | FilePath file(const string&) const; 16 | DirectoryPath subdirectory(const string& s) const; 17 | bool exists() const; 18 | 19 | void createIfDoesntExist() const; 20 | void removeRecursively() const; 21 | vector getFiles() const; 22 | vector getSubDirs() const; 23 | const char* getPath() const; 24 | 25 | static DirectoryPath current(); 26 | optional copyRecursively(DirectoryPath to); 27 | 28 | bool isAbsolute() const; 29 | DirectoryPath absolute() const; 30 | 31 | private: 32 | friend class FilePath; 33 | friend ostream& operator << (ostream& d, const DirectoryPath& path); 34 | string path; 35 | }; 36 | 37 | extern ostream& operator <<(ostream& d, const DirectoryPath& path); 38 | -------------------------------------------------------------------------------- /drag_and_drop.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "drag_and_drop.h" 3 | #include "gui_elem.h" 4 | 5 | void DragContainer::put(DragContent c, SGuiElem g, Vec2 o) { 6 | content = c; 7 | gui = std::move(g); 8 | origin = o; 9 | } 10 | 11 | Vec2 DragContainer::getOrigin() { 12 | CHECK(!!content); 13 | return origin; 14 | } 15 | 16 | optional DragContainer::pop() { 17 | auto c = content; 18 | content = none; 19 | gui.reset(); 20 | return c; 21 | } 22 | 23 | GuiElem* DragContainer::getGui() { 24 | return gui.get(); 25 | } 26 | 27 | const optional& DragContainer::getElement() const { 28 | return content; 29 | } 30 | 31 | bool DragContainer::hasElement() { 32 | return !!content; 33 | } 34 | -------------------------------------------------------------------------------- /drag_and_drop.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "enum_variant.h" 5 | #include "unique_entity.h" 6 | #include "t_string.h" 7 | 8 | using CreatureUniqueId = UniqueEntity::Id; 9 | 10 | #define VARIANT_TYPES_LIST\ 11 | X(CreatureUniqueId, 0)\ 12 | X(TeamId, 1)\ 13 | X(TString, 2) 14 | 15 | #define VARIANT_NAME DragContent 16 | 17 | #include "gen_variant.h" 18 | 19 | #undef VARIANT_TYPES_LIST 20 | #undef VARIANT_NAME 21 | 22 | 23 | class DragContainer { 24 | public: 25 | void put(DragContent content, SGuiElem, Vec2 origin); 26 | optional pop(); 27 | GuiElem* getGui(); 28 | const optional& getElement() const; 29 | bool hasElement(); 30 | Vec2 getOrigin(); 31 | 32 | private: 33 | optional content; 34 | SGuiElem gui; 35 | Vec2 origin; 36 | }; 37 | 38 | -------------------------------------------------------------------------------- /draw_line.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | extern vector drawLine(Vec2 from, Vec2 to); 6 | 7 | class Position; 8 | extern vector drawLine(Position from, Position to); 9 | -------------------------------------------------------------------------------- /duel_state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | enum class DuelState { 6 | INACTIVE, 7 | ACTIVE, 8 | CANCELLED 9 | }; 10 | -------------------------------------------------------------------------------- /dungeon_level.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | struct DungeonLevel { 6 | void onKilledVillain(VillainType); 7 | void onKilledWave(); 8 | int numResearchAvailable() const; 9 | void increaseLevel(); 10 | bool popKeeperUpdate(); 11 | double numPromotionsAvailable() const; 12 | static double getProgress(VillainType type); 13 | static int getNecessaryProgress(int level); 14 | 15 | int SERIAL(level) = 0; 16 | int SERIAL(consumedLevels) = 0; 17 | double SERIAL(consumedPromotions) = 0; 18 | double SERIAL(progress) = 0; 19 | SERIALIZE_ALL(level, consumedLevels, progress, consumedPromotions) 20 | 21 | private: 22 | void addAbsoluteProgress(double amount); 23 | }; 24 | -------------------------------------------------------------------------------- /enemy_aggression_level.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class EnemyAggressionLevel { 4 | NONE, 5 | MODERATE, 6 | EXTREME 7 | }; 8 | -------------------------------------------------------------------------------- /enemy_factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "villain_type.h" 5 | #include "enemy_id.h" 6 | 7 | struct EnemyInfo; 8 | struct BuildingInfo; 9 | 10 | struct ExternalEnemy; 11 | struct SettlementInfo; 12 | class TribeId; 13 | class NameGenerator; 14 | 15 | class EnemyFactory { 16 | public: 17 | EnemyFactory(RandomGen&, NameGenerator*, map enemies, map buildingInfo, 18 | vector); 19 | EnemyFactory(const EnemyFactory&) = delete; 20 | EnemyFactory(EnemyFactory&&) = default; 21 | EnemyInfo get(EnemyId) const; 22 | vector getExternalEnemies() const; 23 | vector getAllIds() const; 24 | 25 | private: 26 | RandomGen& random; 27 | NameGenerator* nameGenerator; 28 | map enemies; 29 | map buildingInfo; 30 | vector externalEnemies; 31 | void updateCreateOnBones(EnemyInfo&) const; 32 | }; 33 | -------------------------------------------------------------------------------- /enemy_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class EnemyId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /equipment_slot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(EquipmentSlot, 6 | WEAPON, 7 | RANGED_WEAPON, 8 | SHIELD, 9 | HELMET, 10 | GLOVES, 11 | BODY_ARMOR, 12 | BOOTS, 13 | AMULET, 14 | RINGS, 15 | PRAYER_BOOK, 16 | DEVOTIONAL_ITEMS 17 | ); 18 | -------------------------------------------------------------------------------- /event_generator.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "event_generator.h" 3 | #include "event_listener.h" 4 | 5 | void EventGenerator::addEvent(const GameEvent& e) { 6 | for (auto& l : listeners) 7 | l.second->onEvent(e); 8 | } 9 | 10 | void EventGenerator::removeListener(EventGenerator::SubscriberId id) { 11 | // Seems to crash when an exception is thrown during game loading and the half-read game needs to be destructed. 12 | //CHECK(listeners.count(id)); 13 | listeners.erase(id); 14 | } 15 | 16 | template 17 | void EventGenerator::serialize(Archive& ar, const unsigned int) { 18 | ar & SUBCLASS(OwnedObject); 19 | ar(listeners); 20 | } 21 | SERIALIZABLE(EventGenerator); 22 | -------------------------------------------------------------------------------- /event_listener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "event_generator.h" 5 | #include "model.h" 6 | 7 | template 8 | class EventListener { 9 | public: 10 | EventListener() {} 11 | 12 | EventListener(const EventListener&) = delete; 13 | EventListener(EventListener&&) = delete; 14 | 15 | void subscribeTo(Model* m) { 16 | CHECK(!generator); 17 | generator = m->eventGenerator.get(); 18 | id = generator->addListener(WeakPointer(static_cast(this))); 19 | } 20 | 21 | void unsubscribe() { 22 | if (generator) { 23 | generator->removeListener(*id); 24 | generator = nullptr; 25 | } 26 | } 27 | 28 | bool isSubscribed() const { 29 | return !!generator; 30 | } 31 | 32 | SERIALIZE_ALL(generator, id) 33 | 34 | ~EventListener() { 35 | unsubscribe(); 36 | } 37 | 38 | private: 39 | WeakPointer SERIAL(generator); 40 | optional SERIAL(id); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /exit_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "util.h" 3 | 4 | struct ExitAndQuit { 5 | }; 6 | 7 | using ExitInfo = variant; 8 | -------------------------------------------------------------------------------- /extern/variant_serialize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "variant.h" 4 | #include 5 | 6 | 7 | namespace cereal { 8 | 9 | //! Saving for boost::variant 10 | template 11 | void CEREAL_SAVE_FUNCTION_NAME(Archive& ar, variant const & v ); 12 | 13 | //! Loading for boost::variant 14 | template 15 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, variant & v ); 16 | } // namespace cereal 17 | -------------------------------------------------------------------------------- /external_enemies_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | enum class ExternalEnemiesType { 6 | FROM_START, 7 | AFTER_WINNING 8 | }; 9 | -------------------------------------------------------------------------------- /file_path.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "directory_path.h" 4 | 5 | class FilePath { 6 | public: 7 | static FilePath fromFullPath(const string& path); 8 | const char* getPath() const; 9 | const char* getFileName() const; 10 | time_t getModificationTime() const; 11 | bool exists() const; 12 | bool hasSuffix(const string&) const; 13 | FilePath withSuffix(const string& suf) const; 14 | FilePath changeSuffix(const string& current, const string& newSuf) const; 15 | optional readContents() const; 16 | void erase() const; 17 | 18 | bool operator==(const FilePath&) const; 19 | 20 | bool isAbsolute() const; 21 | FilePath absolute() const; 22 | 23 | void copyTo(FilePath) const; 24 | 25 | private: 26 | friend class DirectoryPath; 27 | FilePath(const DirectoryPath& d, const string& f); 28 | FilePath(string filename, string fullPath); 29 | 30 | string filename; 31 | string fullPath; 32 | }; 33 | 34 | 35 | extern std::ostream& operator <<(std::ostream& d, const FilePath&); 36 | -------------------------------------------------------------------------------- /fix_steamworks.sh: -------------------------------------------------------------------------------- 1 | STEAM_API_FLAT=extern/steamworks/public/steam/steam_api_flat.h 2 | STEAM_API_COMMON=extern/steamworks/public/steam/steam_api_common.h 3 | ISTEAMUTILS=extern/steamworks/public/steam/isteamutils.h 4 | 5 | sed -i '/typedef int64 lint64;\|typedef uint64 ulint64;/d' $STEAM_API_FLAT 6 | sed -i 's/\(^[a-zA-Z].* const_k_\)/\/\/ \1/g' $STEAM_API_FLAT 7 | 8 | #Version 1.46: 9 | sed -i 's/\(^.*ESteamTVRegionBehavior\)/\/\/ \1/g' $STEAM_API_FLAT 10 | 11 | # #define __cdecl gives unnecessary warnings 12 | if [[ "$OSTYPE" == "msys" ]]; then 13 | sed -i 's/\(^#define __cdecl\)/\/\/ \1/g' $STEAM_API_COMMON 14 | sed -i 's/\(^#define __cdecl\)/\/\/ \1/g' $ISTEAMUTILS 15 | fi 16 | -------------------------------------------------------------------------------- /font_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | FontId, 7 | TEXT_FONT, 8 | TILE_FONT, 9 | SYMBOL_FONT, 10 | MAP_FONT 11 | ); 12 | -------------------------------------------------------------------------------- /fps_counter.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "fps_counter.h" 3 | 4 | FpsCounter::FpsCounter(int n) : numLatencyFrames(n) { 5 | } 6 | 7 | void FpsCounter::addTick() { 8 | auto curTime = clock.getMillis(); 9 | updateLatencies(curTime); 10 | int thisSec = curTime.count() / 1000; 11 | if (thisSec == curSec) 12 | ++curFps; 13 | else { 14 | lastFps = curFps; 15 | curSec = thisSec; 16 | curFps = 0; 17 | } 18 | } 19 | 20 | void FpsCounter::updateLatencies(milliseconds curTime) { 21 | if (lastUpdate) { 22 | auto thisLatency = curTime - *lastUpdate; 23 | latencyQueue.push(thisLatency); 24 | latencies.insert(thisLatency); 25 | if (latencyQueue.size() > numLatencyFrames) { 26 | latencies.erase(latencies.find(latencyQueue.front())); 27 | latencyQueue.pop(); 28 | } 29 | } 30 | lastUpdate = curTime; 31 | } 32 | 33 | int FpsCounter::getFps() { 34 | return lastFps; 35 | } 36 | 37 | int FpsCounter::getMaxLatency() { 38 | return (--latencies.end())->count(); 39 | } 40 | -------------------------------------------------------------------------------- /fps_counter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "clock.h" 5 | 6 | class FpsCounter { 7 | public: 8 | FpsCounter(int numLatencyFrames); 9 | void addTick(); 10 | int getFps(); 11 | int getMaxLatency(); 12 | 13 | private: 14 | int lastFps = 0; 15 | int curSec = -1; 16 | int curFps = 0; 17 | Clock clock; 18 | const int numLatencyFrames; 19 | multiset latencies; 20 | queue latencyQueue; 21 | optional lastUpdate; 22 | void updateLatencies(milliseconds); 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /framebuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Simple framebuffer: allows single texture 4 | class Framebuffer { 5 | public: 6 | Framebuffer(int width, int height); 7 | ~Framebuffer(); 8 | 9 | void operator=(const Framebuffer&) = delete; 10 | Framebuffer(const Framebuffer&) = delete; 11 | 12 | void bind(); 13 | static void unbind(); 14 | 15 | const int width, height; 16 | const unsigned id, texId; 17 | }; 18 | -------------------------------------------------------------------------------- /furnace.cpp: -------------------------------------------------------------------------------- 1 | #include "furnace.h" 2 | #include "item.h" 3 | #include "serialization.h" 4 | 5 | SERIALIZE_DEF(Furnace, queued) 6 | SERIALIZATION_CONSTRUCTOR_IMPL(Furnace) 7 | 8 | const vector& Furnace::getQueued() const { 9 | return queued; 10 | } 11 | 12 | CostInfo Furnace::getRecycledAmount(const Item* item) const { 13 | return item->getCraftingCost() / 2; 14 | } 15 | 16 | optional Furnace::addWork(double workAmount) { 17 | if (!queued.empty()) { 18 | queued[0].state += workAmount / 20.0; 19 | if (queued[0].state >= 1.0) { 20 | auto cost = getRecycledAmount(queued[0].item.get()); 21 | queued.removeIndexPreserveOrder(0); 22 | return cost; 23 | } 24 | } 25 | return none; 26 | } 27 | 28 | void Furnace::queue(PItem item) { 29 | queued.push_back(QueuedItem{std::move(item), 0.0}); 30 | } 31 | 32 | PItem Furnace::unqueue(int index) { 33 | return queued.removeIndexPreserveOrder(index).item; 34 | } 35 | 36 | bool Furnace::isIdle() const { 37 | return queued.empty(); 38 | } -------------------------------------------------------------------------------- /furnace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "cost_info.h" 4 | 5 | class Collective; 6 | class CostInfo; 7 | class ContentFactory; 8 | 9 | class Furnace { 10 | public: 11 | struct QueuedItem { 12 | PItem SERIAL(item); 13 | double SERIAL(state); 14 | SERIALIZE_ALL(item, state) 15 | }; 16 | const vector& getQueued() const; 17 | optional addWork(double workAmount); 18 | void queue(PItem); 19 | PItem unqueue(int index); 20 | bool isIdle() const; 21 | CostInfo getRecycledAmount(const Item*) const; 22 | 23 | SERIALIZATION_DECL(Furnace) 24 | 25 | private: 26 | vector SERIAL(queued); 27 | }; 28 | -------------------------------------------------------------------------------- /furniture_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "read_write_array.h" 4 | #include "furniture_factory.h" 5 | #include "creature_factory.h" 6 | #include "game.h" 7 | #include "furniture.h" 8 | #include "furniture_layer.h" 9 | 10 | 11 | class FurnitureArray { 12 | public: 13 | FurnitureArray(Rectangle bounds); 14 | 15 | typedef ReadWriteArray Array; 16 | 17 | const Array& getBuilt(FurnitureLayer) const; 18 | Array& getBuilt(FurnitureLayer); 19 | 20 | struct Construction { 21 | FurnitureType SERIAL(type); 22 | int SERIAL(time); 23 | SERIALIZE_ALL(type, time) 24 | }; 25 | 26 | optional getConstruction(Vec2, FurnitureLayer) const; 27 | optional getConstruction(Vec2, FurnitureLayer); 28 | void eraseConstruction(Vec2, FurnitureLayer); 29 | void setConstruction(Vec2, FurnitureLayer, Construction); 30 | 31 | SERIALIZATION_DECL(FurnitureArray) 32 | 33 | private: 34 | EnumMap SERIAL(built); 35 | EnumMap> SERIAL(construction); 36 | }; 37 | -------------------------------------------------------------------------------- /furniture_click.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Furniture; 4 | class Position; 5 | 6 | #include "util.h" 7 | 8 | RICH_ENUM( 9 | FurnitureClickType, 10 | LOCK, 11 | KEEPER_BOARD 12 | ); 13 | 14 | class FurnitureClick { 15 | public: 16 | static void handle(FurnitureClickType, Position, const Furniture*); 17 | static ViewObjectAction getClickAction(FurnitureClickType, Position, const Furniture*); 18 | }; 19 | -------------------------------------------------------------------------------- /furniture_dropped_items.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "t_string.h" 5 | 6 | class Position; 7 | class Furniture; 8 | 9 | class FurnitureDroppedItems { 10 | public: 11 | struct Water { 12 | TString SERIAL(verbSingle); 13 | TString SERIAL(verbPlural); 14 | optional SERIAL(unseenMessage); 15 | SERIALIZE_ALL(NAMED(verbSingle), NAMED(verbPlural), NAMED(unseenMessage)) 16 | }; 17 | using DropData = Water; 18 | template 19 | FurnitureDroppedItems(const T& t) : FurnitureDroppedItems(DropData(t)) {} 20 | FurnitureDroppedItems(DropData); 21 | vector handle(Position, const Furniture*, vector) const; 22 | 23 | SERIALIZATION_DECL(FurnitureDroppedItems) 24 | 25 | private: 26 | DropData SERIAL(dropData); 27 | }; 28 | -------------------------------------------------------------------------------- /furniture_entry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "effect.h" 5 | #include "tribe.h" 6 | 7 | class Position; 8 | class Creature; 9 | class Furniture; 10 | 11 | class FurnitureEntry { 12 | public: 13 | using Sokoban = EmptyStruct; 14 | 15 | struct Trap { 16 | Trap(Effect e, bool s = false) : effect(e), invisible(s) {} 17 | SERIALIZATION_CONSTRUCTOR(Trap) 18 | Effect SERIAL(effect); 19 | bool SERIAL(invisible) = false; 20 | SERIALIZE_ALL(NAMED(effect), OPTION(invisible)) 21 | }; 22 | 23 | using Water = EmptyStruct; 24 | using Magma = EmptyStruct; 25 | 26 | MAKE_VARIANT(EntryData, Sokoban, Trap, Water, Magma, Effect); 27 | template 28 | FurnitureEntry(const T& t) : FurnitureEntry(EntryData(t)) {} 29 | FurnitureEntry(EntryData); 30 | void handle(Furniture*, Creature*); 31 | bool isVisibleTo(const Furniture*, const Creature*) const; 32 | 33 | SERIALIZATION_DECL(FurnitureEntry) 34 | 35 | EntryData SERIAL(entryData); 36 | }; 37 | -------------------------------------------------------------------------------- /furniture_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(FurnitureLayer, 6 | GROUND, 7 | FLOOR, 8 | MIDDLE, 9 | CEILING 10 | ); 11 | -------------------------------------------------------------------------------- /furniture_list.cpp: -------------------------------------------------------------------------------- 1 | #include "furniture_list.h" 2 | #include "furniture_factory.h" 3 | 4 | SERIALIZE_DEF(FurnitureList, NAMED(elems), OPTION(unique)) 5 | SERIALIZATION_CONSTRUCTOR_IMPL(FurnitureList) 6 | 7 | FurnitureList::FurnitureList(FurnitureType t) : FurnitureList({{t, 1}}) { 8 | } 9 | 10 | FurnitureList::FurnitureList(vector> elems, vector unique) 11 | : elems(std::move(elems)), unique(std::move(unique)) { 12 | } 13 | 14 | optional FurnitureList::getRandom(RandomGen& random, TribeId tribe) { 15 | if (!unique.empty()) { 16 | FurnitureType f = unique.back(); 17 | unique.pop_back(); 18 | return FurnitureParams{f, tribe}; 19 | } else 20 | if (!elems.empty()) 21 | return FurnitureParams{random.choose(elems), tribe}; 22 | else 23 | return none; 24 | } 25 | 26 | int FurnitureList::numUnique() const { 27 | return unique.size(); 28 | } 29 | 30 | #include "pretty_archive.h" 31 | template 32 | void FurnitureList::serialize(PrettyInputArchive& ar1, unsigned); 33 | -------------------------------------------------------------------------------- /furniture_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "furniture_type.h" 4 | #include "furniture_list_id.h" 5 | 6 | struct FurnitureParams; 7 | class TribeId; 8 | 9 | class FurnitureList { 10 | public: 11 | FurnitureList(FurnitureType); 12 | FurnitureList(vector>, vector unique = {}); 13 | optional getRandom(RandomGen&, TribeId); 14 | int numUnique() const; 15 | 16 | SERIALIZATION_DECL(FurnitureList) 17 | 18 | private: 19 | vector> SERIAL(elems); 20 | vector SERIAL(unique); 21 | }; 22 | -------------------------------------------------------------------------------- /furniture_list_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class FurnitureListId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /furniture_on_built.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "enemy_info.h" 5 | 6 | class Position; 7 | 8 | RICH_ENUM( 9 | FurnitureOnBuilt, 10 | DOWN_STAIRS, 11 | UP_STAIRS, 12 | SET_ON_FIRE, 13 | PORTAL, 14 | SAINT_STATUE 15 | ); 16 | 17 | void handleOnBuilt(Position, Furniture*, FurnitureOnBuilt); 18 | void handleBeforeRemoved(Position, const Furniture*, FurnitureOnBuilt); 19 | optional getStairDirection(FurnitureOnBuilt); 20 | -------------------------------------------------------------------------------- /furniture_tick.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "effect.h" 5 | #include "pretty_archive.h" 6 | 7 | class Position; 8 | class Furniture; 9 | 10 | namespace FurnitureTickTypes { 11 | 12 | struct MeteorShower : EmptyStruct {}; 13 | struct Pit : EmptyStruct {}; 14 | 15 | struct Trap { 16 | int SERIAL(maxDistance); 17 | array SERIAL(effects); // {south, east, north, west} 18 | SERIALIZE_ALL(maxDistance, effects) 19 | }; 20 | 21 | #define VARIANT_TYPES_LIST\ 22 | X(Effect, 0)\ 23 | X(MeteorShower, 1)\ 24 | X(Pit, 2)\ 25 | X(Trap, 4) 26 | 27 | #define VARIANT_NAME FurnitureTickType 28 | 29 | #include "gen_variant.h" 30 | #include "gen_variant_serialize.h" 31 | inline 32 | #include "gen_variant_serialize_pretty.h" 33 | 34 | #undef VARIANT_TYPES_LIST 35 | #undef VARIANT_NAME 36 | 37 | } 38 | 39 | class FurnitureTickType : public FurnitureTickTypes::FurnitureTickType { 40 | public: 41 | using FurnitureTickTypes::FurnitureTickType::FurnitureTickType; 42 | void handle(Position, Furniture*); 43 | }; 44 | -------------------------------------------------------------------------------- /furniture_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class FurnitureType : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /furniture_usage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "effect.h" 5 | #include "t_string.h" 6 | 7 | class Position; 8 | class Furniture; 9 | class Creature; 10 | 11 | RICH_ENUM( 12 | BuiltinUsageId, 13 | KEEPER_BOARD, 14 | TIE_UP, 15 | TRAIN, 16 | ARCHERY_RANGE, 17 | STUDY, 18 | PORTAL, 19 | DEMON_RITUAL, 20 | PRAY 21 | ); 22 | 23 | struct UsageEffect { 24 | TString SERIAL(usageVerb); 25 | Effect SERIAL(effect); 26 | SERIALIZE_ALL(usageVerb, effect) 27 | }; 28 | 29 | MAKE_VARIANT2(FurnitureUsageType, BuiltinUsageId, UsageEffect); 30 | 31 | class FurnitureUsage { 32 | public: 33 | static void handle(FurnitureUsageType, Position, const Furniture*, Creature*); 34 | static bool canHandle(FurnitureUsageType, const Creature*); 35 | static TString getUsageQuestion(FurnitureUsageType, TString furnitureName); 36 | }; 37 | -------------------------------------------------------------------------------- /fx_color.cpp: -------------------------------------------------------------------------------- 1 | #include "fx_color.h" 2 | 3 | #include "renderer.h" 4 | 5 | namespace fx { 6 | 7 | FColor::FColor(Color col) { *this = FColor(col.r, col.g, col.b, col.a) * (1.0f / 255.0f); } 8 | 9 | FColor::operator Color() const { 10 | using u8 = SDL::Uint8; 11 | return {(u8)clamp(r * 255.0f, 0.0f, 255.0f), (u8)clamp(g * 255.0f, 0.0f, 255.0f), (u8)clamp(b * 255.0f, 0.0f, 255.0f), 12 | (u8)clamp(a * 255.0f, 0.0f, 255.0f)}; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /fx_draw_buffers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fx_base.h" 4 | 5 | namespace fx { 6 | 7 | struct DrawBuffers { 8 | struct Element { 9 | int firstVertex; 10 | int numVertices; 11 | TextureName texName; 12 | }; 13 | 14 | void clear(); 15 | // TODO: span would be useful 16 | void add(const DrawParticle*, int count); 17 | bool empty() const { 18 | return elements.empty(); 19 | } 20 | 21 | vector positions; 22 | vector texCoords; 23 | vector colors; 24 | 25 | // TODO: group elements by TextureName 26 | vector elements; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /fx_emission_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fx_base.h" 4 | #include "fx_curve.h" 5 | #include "fx_vec.h" 6 | #include "util.h" 7 | 8 | RICH_ENUM(EmissionSourceType, point, rect, sphere); 9 | 10 | namespace fx { 11 | 12 | class EmissionSource { 13 | public: 14 | using Type = EmissionSourceType; 15 | 16 | EmissionSource() : type(Type::point) {} 17 | EmissionSource(FVec2 pos); 18 | EmissionSource(FRect rect); 19 | EmissionSource(FVec2 pos, float radius); 20 | 21 | Type getType() const { return type; } 22 | FVec2 getPos() const { return pos; } 23 | FRect rect() const; 24 | float sphereRadius() const; 25 | 26 | // TODO(opt): sample multiple points at once 27 | FVec2 sample(RandomGen &) const; 28 | 29 | private: 30 | FVec2 pos, param; 31 | Type type; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /fx_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | #include "color.h" 6 | #include "fx_name.h" 7 | 8 | RICH_ENUM(FXStackId, debuff, buff, generic); 9 | 10 | struct FXInfo { 11 | FXInfo(FXName, Color = Color::WHITE, float strength = 0.0, FXStackId = FXStackId::generic); 12 | 13 | bool empty() const; 14 | 15 | FXInfo& setReversed(); 16 | 17 | SERIALIZATION_CONSTRUCTOR(FXInfo) 18 | FXName SERIAL(name) = FXName(0); 19 | Color SERIAL(color) = Color::WHITE; 20 | float SERIAL(strength) = 0.0f; 21 | FXStackId SERIAL(stackId) = FXStackId::generic; 22 | bool SERIAL(reversed) = false; 23 | SERIALIZE_ALL(NAMED(name), OPTION(color), OPTION(strength), OPTION(stackId), OPTION(reversed)) 24 | }; 25 | 26 | FXInfo getFXInfo(FXVariantName); 27 | 28 | struct FXSpawnInfo { 29 | FXSpawnInfo(FXInfo, Vec2 pos, Vec2 offset = {}); 30 | 31 | Vec2 position; 32 | Vec2 targetOffset; 33 | FXInfo info; 34 | }; 35 | -------------------------------------------------------------------------------- /fx_math.cpp: -------------------------------------------------------------------------------- 1 | #include "fx_math.h" 2 | #include 3 | 4 | #ifdef OSX 5 | void sincosf(float a, float* sin, float* cos) { 6 | __sincosf(a, sin, cos); 7 | } 8 | #endif 9 | 10 | 11 | namespace fx { 12 | 13 | float angleDistance(float a, float b) { 14 | float diff = fabsf(a - b); 15 | return std::min(diff, fconstant::pi * 2.0f - diff); 16 | } 17 | 18 | float blendAngles(float initial, float target, float step) { 19 | if (initial != target) { 20 | float newAng1 = initial + step, newAng2 = initial - step; 21 | if (newAng1 < 0.0f) 22 | newAng1 += fconstant::pi * 2.0f; 23 | if (newAng2 < 0.0f) 24 | newAng2 += fconstant::pi * 2.0f; 25 | float newAngle = angleDistance(newAng1, target) < angleDistance(newAng2, target) ? newAng1 : newAng2; 26 | if (angleDistance(initial, target) < step) 27 | newAngle = target; 28 | return newAngle; 29 | } 30 | 31 | return initial; 32 | } 33 | 34 | float normalizeAngle(float angle) { 35 | angle = fmodf(angle, 2.0f * fconstant::pi); 36 | if (angle < 0.0f) 37 | angle += 2.0f * fconstant::pi; 38 | return angle; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /fx_name.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(FXName, 6 | TEST_SIMPLE, 7 | TEST_MULTI, 8 | WOOD_SPLINTERS, 9 | ROCK_SPLINTERS, 10 | ROCK_CLOUD, 11 | POISON_CLOUD, 12 | DESTROY_FURNITURE, 13 | RIPPLE, 14 | SAND_DUST, 15 | WATER_SPLASH, 16 | MAGMA_FIRE, 17 | FIRE, 18 | FIRE_SPHERE, 19 | CIRCULAR_SPELL, 20 | CIRCULAR_BLAST, 21 | AIR_BLAST, 22 | MAGIC_MISSILE_OLD, 23 | MAGIC_MISSILE, 24 | MAGIC_MISSILE_SPLASH, 25 | FIREBALL, 26 | FIREBALL_SPLASH, 27 | FLAMETHROWER, 28 | SLEEP, 29 | LOVE, 30 | LOVE_LOOPED, 31 | BLIND, 32 | GLITTERING, 33 | MAGIC_FIELD, 34 | LABORATORY, 35 | FORGE, 36 | WORKSHOP, 37 | JEWELLER, 38 | EMBALMENT, 39 | FLYING, 40 | BUFF, 41 | DEBUFF, 42 | TELEPORT_OUT, 43 | TELEPORT_IN, 44 | SPAWN, 45 | ENGINE_STEAM, 46 | LICH, 47 | BALROGS_WHIP, 48 | SMOKE, 49 | MUSIC, 50 | MASS, 51 | AUREOLA 52 | ); 53 | -------------------------------------------------------------------------------- /fx_texture_name.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | namespace fx { 6 | enum class TextureName; 7 | } 8 | 9 | RICH_ENUM(fx::TextureName, 10 | CIRCULAR, 11 | CIRCULAR_STRONG, 12 | FLAKES_BORDERS, 13 | WATER_DROPS, 14 | CLOUDS_SOFT, 15 | CLOUDS_SOFT_BORDERS, 16 | CLOUDS_ADD, 17 | TORUS, 18 | TORUS_BOTTOM, 19 | TORUS_BOTTOM_BLURRED, 20 | TELEPORT, 21 | TELEPORT_BLEND, 22 | BEAMS, 23 | SPARKS, 24 | SPARKS_LIGHT, 25 | MISSILE_CORE, 26 | FLAMES, 27 | FLAMES_BLURRED, 28 | BLAST, 29 | BUBBLES, 30 | FLASH1, 31 | FLASH1_GLOW, 32 | FLASH2, 33 | SPECIAL, 34 | PHYLACTERY_SKULL 35 | ); 36 | -------------------------------------------------------------------------------- /fx_variant_name.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(FXVariantName, 6 | BLIND, 7 | SLEEP, 8 | FLYING, 9 | FIRE_SPHERE, 10 | FIRE, 11 | BUFF_RED, 12 | BUFF_YELLOW, 13 | BUFF_PINK, 14 | BUFF_BLUE, 15 | BUFF_WHITE, 16 | BUFF_ORANGE, 17 | BUFF_GREEN1, 18 | BUFF_GREEN2, 19 | BUFF_SKY_BLUE, 20 | BUFF_BROWN, 21 | BUFF_PURPLE, 22 | BUFF_BLACK, 23 | DEBUFF_BLUE, 24 | DEBUFF_RED, 25 | DEBUFF_GREEN1, 26 | DEBUFF_GREEN2, 27 | DEBUFF_YELLOW, 28 | DEBUFF_PINK, 29 | DEBUFF_ORANGE, 30 | DEBUFF_BROWN, 31 | DEBUFF_BLACK, 32 | DEBUFF_WHITE, 33 | PEACEFULNESS, 34 | WORKSHOP, 35 | LABORATORY, 36 | ENCHANTED_LABORATORY, 37 | FORGE, 38 | JEWELLER, 39 | LAVA_JEWELLER, 40 | EMBALMENT, 41 | LICH 42 | ); 43 | 44 | -------------------------------------------------------------------------------- /fx_vec.cpp: -------------------------------------------------------------------------------- 1 | #include "fx_vec.h" 2 | 3 | namespace fx { 4 | 5 | float vectorToAngle(const FVec2 &normalizedVec) { 6 | float ang = std::acos(normalizedVec.x); 7 | return normalizedVec.y < 0 ? 2.0f * fconstant::pi - ang : ang; 8 | } 9 | 10 | FVec2 angleToVector(float radians) { 11 | auto sc = sincos(radians); 12 | return FVec2(sc.second, sc.first); 13 | } 14 | 15 | FVec2 rotateVector(const FVec2 &vec, float radians) { 16 | auto sc = sincos(radians); 17 | return FVec2(sc.second * vec.x - sc.first * vec.y, sc.second * vec.y + sc.first * vec.x); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /game_save_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | GameSaveType, 7 | KEEPER, 8 | RETIRED_SITE, 9 | RETIRED_CAMPAIGN, 10 | WARLORD, 11 | AUTOSAVE 12 | ); 13 | -------------------------------------------------------------------------------- /gdb_input.txt: -------------------------------------------------------------------------------- 1 | thread apply all bt 2 | quit 3 | -------------------------------------------------------------------------------- /gen_variant_serialize.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | template 5 | void serialize(Archive& ar1, VARIANT_NAME& v) { 6 | ar1(v.index); 7 | switch (v.index) { 8 | #define X(Type, Index)\ 9 | case Index: \ 10 | if (Archive::is_loading::value) \ 11 | new(&v.elem##Index) Type; \ 12 | ar1(v.elem##Index); \ 13 | break; 14 | VARIANT_TYPES_LIST 15 | #undef X 16 | default: FATAL << "Error saving variant"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /gen_variant_serialize_pretty.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | void serialize(PrettyInputArchive& ar1, VARIANT_NAME& v) { 4 | string name; 5 | auto bookmark = ar1.bookmark(); 6 | ar1.readText(name); 7 | #define X(Type, Index)\ 8 | if (name == #Type) { \ 9 | v.index = Index; \ 10 | new(&v.elem##Index) Type;\ 11 | ar1(v.elem##Index); \ 12 | } else 13 | VARIANT_TYPES_LIST 14 | #undef X 15 | #ifdef DEFAULT_ELEM 16 | #define X(Type, Index)\ 17 | if (!strcmp(DEFAULT_ELEM, #Type)) { \ 18 | v.index = Index; \ 19 | new(&v.elem##Index) Type;\ 20 | ar1.seek(bookmark);\ 21 | ar1(v.elem##Index); \ 22 | } else 23 | VARIANT_TYPES_LIST 24 | #undef X 25 | ar1.error("Bad default elem"); 26 | #else 27 | ar1.error(name + " is not part of variant"); 28 | #endif 29 | } 30 | -------------------------------------------------------------------------------- /gen_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VERSION="`git describe --abbrev=4 --dirty --always`" 4 | EPOCH=`git log --format=%ct -1` 5 | [ -n "$EPOCH" ] || EPOCH=$SOURCE_DATE_EPOCH 6 | [ -n "$EPOCH" ] || EPOCH=`date +%s` 7 | DATE_FMT="+%F" 8 | DATE=`date -u -d "@$EPOCH" $DATE_FMT 2>/dev/null || date -u -r "$EPOCH" $DATE_FMT 2>/dev/null || date -u $DATE_FMT` 9 | 10 | echo "#define BUILD_VERSION \"$VERSION\"" > version.h 11 | echo "#define BUILD_DATE \"$DATE\"" >> version.h 12 | -------------------------------------------------------------------------------- /health_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | HealthType, 7 | FLESH, 8 | SPIRIT 9 | ); 10 | -------------------------------------------------------------------------------- /highscores.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "file_path.h" 5 | 6 | class View; 7 | class FileSharing; 8 | class Options; 9 | 10 | class Highscores { 11 | public: 12 | Highscores(const FilePath& localPath); 13 | 14 | struct Score { 15 | bool operator == (const Score&) const; 16 | 17 | SERIALIZE_ALL(gameId, playerName, worldName, gameResult, gameWon, points, turns, campaignType, version) 18 | 19 | string SERIAL(gameId); 20 | string SERIAL(playerName); 21 | string SERIAL(worldName); 22 | string SERIAL(gameResult); 23 | bool SERIAL(gameWon); 24 | int SERIAL(points); 25 | int SERIAL(turns); 26 | CampaignType SERIAL(campaignType); 27 | int SERIAL(version); 28 | }; 29 | 30 | void present(View*, optional lastAdded = none) const; 31 | void add(Score); 32 | 33 | static vector fromFile(const FilePath&); 34 | 35 | private: 36 | static void saveToFile(const vector&, const FilePath&); 37 | 38 | FilePath localPath; 39 | vector localScores; 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /immigrant_auto_state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class ImmigrantAutoState { AUTO_ACCEPT, AUTO_REJECT }; 4 | -------------------------------------------------------------------------------- /inhabitants_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "creature_factory.h" 5 | #include "creature_list.h" 6 | 7 | struct InhabitantsInfo { 8 | struct Unique {}; 9 | CreatureList SERIAL(leader); 10 | CreatureList SERIAL(fighters); 11 | CreatureList SERIAL(civilians); 12 | optional SERIAL(steeds); 13 | template 14 | void serialize(Archive&, unsigned int); 15 | using Generated = vector>>; 16 | Generated generateCreatures(RandomGen&, CreatureFactory*, TribeId, MonsterAIFactory); 17 | }; 18 | -------------------------------------------------------------------------------- /input_queue.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2014 Michal Brzozowski (rusolis@poczta.fm) 2 | 3 | This file is part of KeeperRL. 4 | 5 | KeeperRL is free software; you can redistribute it and/or modify it under the terms of the 6 | GNU General Public License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with this program. 14 | If not, see http://www.gnu.org/licenses/ . */ 15 | 16 | #include "stdafx.h" 17 | #include "input_queue.h" 18 | 19 | void InputQueue::push(UserInput input) { 20 | q.push(input); 21 | } 22 | 23 | bool InputQueue::pop(UserInput& input) { 24 | if (q.empty()) 25 | return false; 26 | input = q.front(); 27 | q.pop(); 28 | return true; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /input_queue.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2014 Michal Brzozowski (rusolis@poczta.fm) 2 | 3 | This file is part of KeeperRL. 4 | 5 | KeeperRL is free software; you can redistribute it and/or modify it under the terms of the 6 | GNU General Public License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with this program. 14 | If not, see http://www.gnu.org/licenses/ . */ 15 | 16 | #pragma once 17 | 18 | #include "user_input.h" 19 | 20 | class InputQueue { 21 | public: 22 | void push(UserInput); 23 | bool pop(UserInput&); 24 | 25 | private: 26 | queue q; 27 | }; 28 | -------------------------------------------------------------------------------- /intrinsic_attack.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "intrinsic_attack.h" 3 | #include "item_type.h" 4 | #include "item.h" 5 | 6 | IntrinsicAttack::IntrinsicAttack(ItemType type, bool isExtraAttack) : itemType(type), isExtraAttack(isExtraAttack) {} 7 | 8 | IntrinsicAttack::IntrinsicAttack(const IntrinsicAttack& o) : itemType(o.itemType), active(o.active), isExtraAttack(o.isExtraAttack) { 9 | } 10 | 11 | IntrinsicAttack& IntrinsicAttack::operator =(const IntrinsicAttack& o) { 12 | itemType = o.itemType; 13 | active = o.active; 14 | isExtraAttack = o.isExtraAttack; 15 | return *this; 16 | } 17 | 18 | void IntrinsicAttack::initializeItem(const ContentFactory* factory) { 19 | if (!item) 20 | item = itemType.get(factory); 21 | } 22 | 23 | SERIALIZATION_CONSTRUCTOR_IMPL(IntrinsicAttack) 24 | 25 | SERIALIZE_DEF(IntrinsicAttack, item, itemType, active, isExtraAttack) 26 | 27 | #include "pretty_archive.h" 28 | template<> 29 | void IntrinsicAttack::serialize(PrettyInputArchive& ar1, unsigned) { 30 | ar1(NAMED(itemType), OPTION(isExtraAttack)); 31 | } 32 | -------------------------------------------------------------------------------- /intrinsic_attack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "body_part.h" 4 | #include "item_type.h" 5 | 6 | class ItemType; 7 | 8 | struct IntrinsicAttack { 9 | IntrinsicAttack(ItemType, bool isExtraAttack = false); 10 | IntrinsicAttack(const IntrinsicAttack&); 11 | IntrinsicAttack& operator = (const IntrinsicAttack&); 12 | IntrinsicAttack(IntrinsicAttack&&) = default; 13 | IntrinsicAttack& operator = (IntrinsicAttack&&) = default; 14 | void initializeItem(const ContentFactory*); 15 | SERIALIZATION_DECL(IntrinsicAttack) 16 | PItem SERIAL(item); 17 | ItemType SERIAL(itemType); 18 | bool SERIAL(active) = true; 19 | bool SERIAL(isExtraAttack) = false; 20 | }; 21 | -------------------------------------------------------------------------------- /item_ability.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "spell.h" 4 | #include "game_time.h" 5 | #include "unique_entity.h" 6 | 7 | struct ItemAbility { 8 | Spell SERIAL(spell); 9 | optional SERIAL(timeout); 10 | // Keep the item id's generic ID as a way to detect that the item was 11 | // retired and we need to reset the timeout. 12 | GenericId SERIAL(itemId); 13 | SERIALIZE_ALL(spell, timeout, itemId) 14 | }; 15 | -------------------------------------------------------------------------------- /item_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | enum class ItemAction { 5 | DROP, 6 | DROP_MULTI, 7 | APPLY, 8 | EQUIP, 9 | UNEQUIP, 10 | THROW, 11 | LOCK, 12 | REPLACE, 13 | REPLACE_STEED, 14 | DROP_STEED, 15 | GIVE, 16 | REMOVE, 17 | CHANGE_NUMBER, 18 | PAY, 19 | NAME, 20 | INTRINSIC_ACTIVATE, 21 | INTRINSIC_DEACTIVATE, 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /item_class.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(ItemClass, 6 | WEAPON, 7 | RANGED_WEAPON, 8 | ARMOR, 9 | FOOD, 10 | CORPSE, 11 | OTHER, 12 | GOLD 13 | ); 14 | -------------------------------------------------------------------------------- /item_counts.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "view_id.h" 4 | #include "util.h" 5 | 6 | using ItemCounts = map; 7 | -------------------------------------------------------------------------------- /item_index.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(ItemIndex, 6 | WEAPON, 7 | MINION_EQUIPMENT, 8 | RANGED_WEAPON, 9 | FOR_SALE, 10 | RUNE 11 | ); 12 | 13 | class TStringId; 14 | extern optional getName(ItemIndex, int count = 1); 15 | extern bool hasIndex(ItemIndex, const Item*); 16 | -------------------------------------------------------------------------------- /item_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "item_type.h" 5 | 6 | class ItemList { 7 | public: 8 | ItemList(const ItemList&); 9 | ItemList(ItemList&&) noexcept; 10 | ItemList& operator = (const ItemList&); 11 | ItemList(vector); 12 | vector getAllItems() const; 13 | 14 | vector random(const ContentFactory*, int difficulty) &; 15 | 16 | SERIALIZATION_DECL(ItemList) 17 | ~ItemList(); 18 | 19 | private: 20 | struct ItemInfo; 21 | ItemList(vector); 22 | ItemList& addItem(ItemInfo); 23 | ItemList& addUniqueItem(ItemType, Range count = Range::singleElem(1)); 24 | ItemList& setRandomPrefixes(double chance); 25 | vector SERIAL(items); 26 | struct MultiItemInfo; 27 | vector SERIAL(multiItems); 28 | vector> SERIAL(unique); 29 | }; 30 | 31 | static_assert(std::is_nothrow_move_constructible::value, "T should be noexcept MoveConstructible"); 32 | -------------------------------------------------------------------------------- /item_list_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class ItemListId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /item_upgrade_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | ItemUpgradeType, 7 | WEAPON, 8 | ARMOR, 9 | BALSAM, 10 | BODY_PART, 11 | RANGED_WEAPON, 12 | AUTOMATONS_UPPER, 13 | AUTOMATONS_LOWER 14 | ); 15 | 16 | class TStringId; 17 | class ItemPrefix; 18 | class ContentFactory; 19 | class TString; 20 | 21 | TStringId getItemTypeName(ItemUpgradeType); 22 | 23 | struct ItemUpgradeInfo { 24 | vector getDescription(const ContentFactory*) const; 25 | ItemUpgradeType SERIAL(type); 26 | HeapAllocated SERIAL(prefix); 27 | optional> SERIAL(diminishModifier); 28 | template 29 | void serialize(Archive& ar1, const unsigned int); 30 | }; 31 | -------------------------------------------------------------------------------- /keeper.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/keeper.ico -------------------------------------------------------------------------------- /keeper.rc: -------------------------------------------------------------------------------- 1 | id ICON keeper.ico -------------------------------------------------------------------------------- /keeper.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/keeper.res -------------------------------------------------------------------------------- /keeper32.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miki151/keeperrl/17ab90f76b7963c76959c73930330a06d96dfc92/keeper32.res -------------------------------------------------------------------------------- /keeper_base_info.cpp: -------------------------------------------------------------------------------- 1 | #include "keeper_base_info.h" 2 | #include "pretty_archive.h" 3 | #include "clock.h" 4 | 5 | void KeeperBaseInfo::serialize(PrettyInputArchive& ar1, unsigned int version) { 6 | if (ar1.eatMaybe("insideMountain")) 7 | insideMountain = true; 8 | if (ar1.eatMaybe("christmasSpecial")) 9 | addTerritory = false; 10 | if (ar1.eatMaybe("dontAddTerritory")) 11 | addTerritory = false; 12 | ar1(size, layout); 13 | } 14 | 15 | bool KeeperBaseInfo::isActive() { 16 | return !christmasSpecial || Clock::isChristmas(); 17 | } -------------------------------------------------------------------------------- /keeper_base_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "tribe.h" 6 | #include "random_layout_id.h" 7 | 8 | struct KeeperBaseInfo { 9 | optional SERIAL(layout); 10 | Vec2 SERIAL(size); 11 | bool SERIAL(insideMountain) = false; 12 | bool SERIAL(addTerritory) = true; 13 | bool SERIAL(christmasSpecial) = false; 14 | 15 | bool isActive(); 16 | 17 | template 18 | void serialize(Archive& ar, unsigned int version) { 19 | ar(size, layout); 20 | if (version >= 1) 21 | ar(insideMountain); 22 | if (version >= 2) 23 | ar(addTerritory, christmasSpecial); 24 | } 25 | 26 | void serialize(PrettyInputArchive&, unsigned int); 27 | }; 28 | 29 | CEREAL_CLASS_VERSION(KeeperBaseInfo, 2) 30 | 31 | -------------------------------------------------------------------------------- /keeper_creature_info.cpp: -------------------------------------------------------------------------------- 1 | #include "keeper_creature_info.h" 2 | #include "special_trait.h" 3 | #include "creature_id.h" 4 | #include "tribe_alignment.h" 5 | #include "lasting_effect.h" 6 | #include "attr_type.h" 7 | 8 | SERIALIZE_DEF(KeeperCreatureInfo, NAMED(creatureId), NAMED(tribeAlignment), NAMED(immigrantGroups), NAMED(technology), NAMED(initialTech), NAMED(buildingGroups), NAMED(workshopGroups), NAMED(description), OPTION(specialTraits), OPTION(noLeader), NAMED(baseNameGen), OPTION(minionTraits), OPTION(maxPopulation), OPTION(immigrantInterval), OPTION(populationString), OPTION(prisoners), OPTION(endlessEnemyGroups), NAMED(unlock), OPTION(credit), OPTION(flags), NAMED(zLevelGroups), NAMED(villainGroups), OPTION(requireQuartersForExp), OPTION(startingBase), NAMED(baseName), OPTION(enemyAggression)); 9 | 10 | KeeperCreatureInfo::KeeperCreatureInfo() { 11 | } 12 | 13 | STRUCT_IMPL(KeeperCreatureInfo) 14 | 15 | #include "pretty_archive.h" 16 | template 17 | void KeeperCreatureInfo::serialize(PrettyInputArchive& ar1, unsigned); 18 | -------------------------------------------------------------------------------- /key_verifier.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "key_verifier.h" 3 | 4 | 5 | vector KeyVerifier::verify() { 6 | vector ret; 7 | for (auto& verifier : verifiers) { 8 | /*for (auto& id : verifier.second.duplicateKeys) 9 | ret.push_back("Duplicate "_s + verifier.first.name() + " key: \"" + id + "\"");*/ 10 | for (auto& id : verifier.second.toVerify) 11 | if (!verifier.second.keys.count(id.name)) 12 | ret.push_back(id.position + ": " + verifier.first.name() + " not found: \""_s + id.name + "\""); 13 | } 14 | return ret; 15 | } 16 | -------------------------------------------------------------------------------- /key_verifier.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "pretty_archive.h" 5 | 6 | class KeyVerifier { 7 | public: 8 | struct KeyInfo { 9 | string name; 10 | string position; 11 | }; 12 | struct Verifier { 13 | vector toVerify; 14 | set keys; 15 | vector duplicateKeys; 16 | }; 17 | 18 | template 19 | void verifyContentId(string pos, string id) { 20 | verifiers[typeid(T)].toVerify.push_back({std::move(id), std::move(pos)}); 21 | } 22 | 23 | template 24 | void addKey(string id) { 25 | auto& v = verifiers[typeid(T)]; 26 | if (v.keys.count(id)) 27 | v.duplicateKeys.push_back(id); 28 | v.keys.insert(std::move(id)); 29 | } 30 | 31 | vector verify(); 32 | 33 | private: 34 | map verifiers; 35 | }; 36 | -------------------------------------------------------------------------------- /keybinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class Keybinding : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /keybinding_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | struct KeybindingInfo { 6 | string SERIAL(name); 7 | SERIALIZE_ALL(name) 8 | }; 9 | 10 | -------------------------------------------------------------------------------- /layout_canvas.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | 6 | using Token = string; 7 | 8 | struct LayoutCanvas { 9 | struct Map { 10 | Table> elems; 11 | }; 12 | LayoutCanvas with(Rectangle area) const { 13 | USER_CHECK(map->elems.getBounds().contains(area)) << "Level generator exceeded map bounds. " << map->elems.getBounds() << " and " << area; 14 | return LayoutCanvas{area, map}; 15 | } 16 | Rectangle area; 17 | Map* map; 18 | }; 19 | -------------------------------------------------------------------------------- /layout_mapping_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class LayoutMappingId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /layout_renderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "file_path.h" 5 | #include "layout_canvas.h" 6 | 7 | class MainLoop; 8 | 9 | void renderAscii(const LayoutCanvas::Map&, istream& file); 10 | void generateMapLayout(const MainLoop&, const string& layoutName, FilePath glyphPath, const string& layoutSize); 11 | -------------------------------------------------------------------------------- /linux_make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | make clean 6 | schroot --chroot steamrt_scout_amd64 -- make OPT=true RELEASE=true GCC=clang++-3.8 -j16 7 | cp keeper ~/steam_content/linux64 8 | 9 | -------------------------------------------------------------------------------- /mac/keeper-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.keeper.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | LSApplicationCategoryType 22 | public.app-category.strategy-games 23 | 24 | 25 | -------------------------------------------------------------------------------- /make_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ "$1" != "" ]; then 6 | if [ "$1" = "linux" ]; then 7 | sh ./linux_make.sh 8 | fi 9 | if [ "$1" = "osx" ]; then 10 | sh ./osx_make.sh 11 | fi 12 | if [ "$1" = "windows" ]; then 13 | sh ./windows_make.sh 14 | sh ./win64_make.sh 15 | fi 16 | else 17 | sh ./windows_make.sh 18 | sh ./win64_make.sh 19 | sh ./osx_make.sh 20 | sh ./linux_make.sh 21 | fi 22 | 23 | rm -Rf ~/sdk/tools/ContentBuilder/content/common/data/ 24 | rm -Rf ~/sdk/tools/ContentBuilder/content/common/data_free/ 25 | cp -R -L data ~/sdk/tools/ContentBuilder/content/common/ 26 | cp -R data_free ~/sdk/tools/ContentBuilder/content/common/ 27 | cd ~/sdk/tools/ContentBuilder/ 28 | ./run_build.sh 29 | 30 | cd content 31 | ./print_versions.sh 32 | 33 | 34 | rm unity.cpp 35 | -------------------------------------------------------------------------------- /map_layout_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class MapLayoutId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /map_layouts.cpp: -------------------------------------------------------------------------------- 1 | #include "map_layouts.h" 2 | 3 | 4 | 5 | Vec2 MapLayouts::getSize(MapLayoutId id) const { 6 | return layouts.at(id)[0].getBounds().getSize(); 7 | } 8 | 9 | MapLayouts::Layout MapLayouts::getRandomLayout(MapLayoutId id, RandomGen& random) const { 10 | return random.choose(layouts.at(id)); 11 | } 12 | 13 | optional MapLayouts::addLayout(MapLayoutId id, MapLayouts::Layout l) { 14 | auto& list = layouts[id]; 15 | if (!list.empty() && list[0].getBounds() != l.getBounds()) 16 | return "Map layouts have differing sizes"_s; 17 | list.push_back(std::move(l)); 18 | return none; 19 | } 20 | 21 | SERIALIZE_DEF(MapLayouts, layouts) 22 | -------------------------------------------------------------------------------- /map_layouts.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "map_layout_id.h" 5 | #include "random_layout_id.h" 6 | 7 | enum class LayoutPiece { 8 | CORRIDOR, 9 | WALL, 10 | DOOR, 11 | FLOOR_INSIDE, 12 | FLOOR_OUTSIDE, 13 | PRETTY_FLOOR, 14 | BRIDGE, 15 | UP_STAIRS, 16 | DOWN_STAIRS, 17 | WATER 18 | }; 19 | 20 | class MapLayouts { 21 | public: 22 | 23 | using Layout = Table>; 24 | 25 | Vec2 getSize(MapLayoutId) const; 26 | Layout getRandomLayout(MapLayoutId, RandomGen&) const; 27 | optional addLayout(MapLayoutId, Layout); 28 | 29 | template 30 | void serialize(Archive& ar, const unsigned int); 31 | 32 | private: 33 | map> SERIAL(layouts); 34 | }; 35 | 36 | static_assert(std::is_nothrow_move_constructible::value, "T should be noexcept MoveConstructible"); 37 | -------------------------------------------------------------------------------- /message_buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "player_message.h" 4 | 5 | class MessageBuffer { 6 | public: 7 | vector SERIAL(current); 8 | vector SERIAL(history); 9 | SERIALIZE_ALL(current, history) 10 | }; 11 | -------------------------------------------------------------------------------- /message_generator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "msg_type.h" 5 | #include "my_containers.h" 6 | #include "owner_pointer.h" 7 | 8 | class PlayerMessage; 9 | class TString; 10 | 11 | class MessageGenerator { 12 | public: 13 | enum Type { SECOND_PERSON, THIRD_PERSON, BOULDER, KRAKEN, NONE }; 14 | MessageGenerator(Type); 15 | void add(const Creature*, MsgType, TString); 16 | void add(const Creature*, MsgType); 17 | void addThirdPerson(const Creature*, PlayerMessage); 18 | void addSecondPerson(const Creature*, PlayerMessage); 19 | TString getEnemyName(const Creature*); 20 | 21 | SERIALIZATION_DECL(MessageGenerator) 22 | 23 | private: 24 | Type SERIAL(type); 25 | }; 26 | -------------------------------------------------------------------------------- /minion_controller.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "owner_pointer.h" 4 | 5 | extern PController getMinionController(Creature*, SMapMemory, PlayerControl*, SMessageBuffer, SVisibilityMap, 6 | SUnknownLocations, STutorial); 7 | -------------------------------------------------------------------------------- /minion_equipment_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | MinionEquipmentType, 7 | ARMOR, 8 | HEALING, 9 | MATERIALIZATION, 10 | COMBAT_ITEM, 11 | TORCH 12 | ); 13 | -------------------------------------------------------------------------------- /minion_page_index.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | namespace MinionPageElems { 6 | struct MinionAction { 7 | int SERIAL(index); 8 | COMPARE_ALL(index) 9 | }; 10 | struct Setting { 11 | int SERIAL(index); 12 | COMPARE_ALL(index) 13 | }; 14 | struct Equipment { 15 | int SERIAL(index); 16 | COMPARE_ALL(index); 17 | }; 18 | EMPTY_STRUCT(None); 19 | using MinionPageIndexVariant = variant; 20 | } 21 | 22 | struct MinionPageIndex : public MinionPageElems::MinionPageIndexVariant { 23 | using MinionPageElems::MinionPageIndexVariant::MinionPageIndexVariant; 24 | template 25 | void assign(T elem) { 26 | *((MinionPageElems::MinionPageIndexVariant*)this) = std::move(elem); 27 | } 28 | bool left(); 29 | bool right(int numActions, int numSettings); 30 | bool up(int numActions, int numSettings); 31 | bool down(int numSettings, int numEquipment); 32 | }; -------------------------------------------------------------------------------- /minion_trait.cpp: -------------------------------------------------------------------------------- 1 | #include "minion_trait.h" 2 | #include "t_string.h" 3 | 4 | optional getImmigrantDescription(MinionTrait trait) { 5 | switch (trait) { 6 | case MinionTrait::DOESNT_TRIGGER: 7 | return TStringId("DOES_NOT_TRIGGER_ENEMIES"); 8 | case MinionTrait::INCREASE_POPULATION: 9 | return TStringId("WILL_BE_REPLACED"); 10 | default: 11 | return none; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /minion_trait.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | MinionTrait, 7 | LEADER, 8 | FIGHTER, 9 | WORKER, 10 | PRISONER, 11 | NO_EQUIPMENT, 12 | NO_LIMIT, 13 | FARM_ANIMAL, 14 | SUMMONED, 15 | NO_AUTO_EQUIPMENT, 16 | DOESNT_TRIGGER, 17 | INCREASE_POPULATION, 18 | AUTOMATON, 19 | NO_LEISURE_ZONE 20 | ); 21 | 22 | class TStringId; 23 | optional getImmigrantDescription(MinionTrait); 24 | -------------------------------------------------------------------------------- /miniunz.h: -------------------------------------------------------------------------------- 1 | 2 | #include "util.h" 3 | 4 | optional unzip(const string& zipfilename, const char* dirname); 5 | -------------------------------------------------------------------------------- /mod_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | struct ModVersionInfo { 6 | SteamId steamId; 7 | int version; 8 | string compatibilityTag; 9 | }; 10 | 11 | struct ModDetails { 12 | string author; 13 | string description; 14 | }; 15 | 16 | struct ModInfo { 17 | string name; 18 | ModDetails details; 19 | ModVersionInfo versionInfo; 20 | int upvotes = 0; 21 | int downvotes = 0; 22 | bool canUpload = false; 23 | bool isSubscribed = false; 24 | bool isActive = false; 25 | bool isLocal = false; 26 | vector actions; 27 | }; 28 | -------------------------------------------------------------------------------- /mouse_button_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(MouseButtonId, LEFT, MIDDLE, RIGHT, WHEEL_UP, WHEEL_DOWN, RELEASED, MOVED); 6 | -------------------------------------------------------------------------------- /move_info.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "move_info.h" 3 | #include "creature.h" 4 | 5 | MoveInfo::MoveInfo(double val, CreatureAction m) : value(m ? val : 0), move(std::move(m)) { 6 | 7 | } 8 | 9 | MoveInfo::MoveInfo(CreatureAction m) : MoveInfo(1.0, std::move(m)) { 10 | } 11 | 12 | MoveInfo::operator bool() const { 13 | return !!move; 14 | } 15 | 16 | MoveInfo MoveInfo::withValue(double v) const { 17 | if (!move) 18 | return *this; 19 | MoveInfo ret(*this); 20 | ret.value = v; 21 | return ret; 22 | } 23 | 24 | MoveInfo MoveInfo::orWait() const { 25 | if (!move) 26 | return MoveInfo(1.0, Creature::wait()); 27 | else 28 | return *this; 29 | } 30 | 31 | void MoveInfo::setValue(double v) { 32 | value = v; 33 | } 34 | 35 | CreatureAction MoveInfo::getMove() const { 36 | return move; 37 | } 38 | 39 | double MoveInfo::getValue() const { 40 | return value; 41 | } 42 | -------------------------------------------------------------------------------- /move_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "creature_action.h" 4 | 5 | struct MoveInfo { 6 | MoveInfo(double val, CreatureAction); 7 | MoveInfo(CreatureAction); 8 | explicit operator bool() const; 9 | 10 | void setValue(double v); 11 | MoveInfo withValue(double v) const; 12 | MoveInfo orWait() const; 13 | 14 | CreatureAction getMove() const; 15 | double getValue() const; 16 | 17 | private: 18 | double value; 19 | CreatureAction move; 20 | }; 21 | 22 | 23 | const MoveInfo NoMove = {0.0, CreatureAction()}; 24 | 25 | -------------------------------------------------------------------------------- /movement_info.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "movement_info.h" 3 | 4 | MovementInfo::MovementInfo(Vec2 dir, LocalTime begin, LocalTime end, int moveCnt, MovementInfo::Type t) 5 | : dirX(dir.x), dirY(dir.y), tBegin(begin.getDouble()), tEnd(end.getDouble()), type(t), moveCounter(moveCnt) {} 6 | 7 | MovementInfo::MovementInfo() { 8 | } 9 | 10 | MovementInfo& MovementInfo::setDirection(Vec2 v) { 11 | dirX = v.x; 12 | dirY = v.y; 13 | return *this; 14 | } 15 | 16 | MovementInfo& MovementInfo::setType(MovementInfo::Type t) { 17 | type = t; 18 | return *this; 19 | } 20 | 21 | MovementInfo& MovementInfo::setMaxLength(TimeInterval i) { 22 | tEnd = min(tEnd, tBegin + i.getDouble()); 23 | return *this; 24 | } 25 | 26 | MovementInfo& MovementInfo::setVictim(UniqueEntity::Id id) { 27 | victim = id.getGenericId(); 28 | return *this; 29 | } 30 | 31 | MovementInfo& MovementInfo::setFX(optional v) { 32 | fx = v; 33 | return *this; 34 | } 35 | 36 | Vec2 MovementInfo::getDir() const { 37 | return Vec2(dirX, dirY); 38 | } 39 | -------------------------------------------------------------------------------- /movement_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "game_time.h" 6 | #include "unique_entity.h" 7 | 8 | struct MovementInfo { 9 | enum Type { MOVE, ATTACK, WORK }; 10 | MovementInfo(Vec2 direction, LocalTime tBegin, LocalTime tEnd, int moveCounter, Type); 11 | MovementInfo(); 12 | MovementInfo& setDirection(Vec2); 13 | MovementInfo& setType(Type); 14 | MovementInfo& setMaxLength(TimeInterval); 15 | MovementInfo& setVictim(UniqueEntity::Id); 16 | MovementInfo& setFX(optional); 17 | Vec2 getDir() const; 18 | std::int8_t dirX = 0; 19 | std::int8_t dirY = 0; 20 | float tBegin; 21 | float tEnd; 22 | Type type = MOVE; 23 | int moveCounter = 0; 24 | GenericId victim = 0; 25 | optional fx; 26 | }; 27 | -------------------------------------------------------------------------------- /movement_set.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class MovementType; 4 | class Tribe; 5 | 6 | #include "util.h" 7 | #include "movement_type.h" 8 | 9 | class MovementSet { 10 | public: 11 | MovementSet(TribeId); 12 | bool canEnter(const MovementType&, bool covered, bool onFire, const optional& forbidden) const; 13 | bool canEnter(const MovementType&) const; 14 | 15 | bool hasTrait(MovementTrait) const; 16 | bool blocksPrisoners() const; 17 | 18 | MovementSet& addTrait(MovementTrait); 19 | MovementSet& removeTrait(MovementTrait); 20 | MovementSet& addForcibleTrait(MovementTrait); 21 | MovementSet& setBlockingEnemies(); 22 | TribeId getTribe() const; 23 | void setTribe(TribeId); 24 | 25 | MovementSet& clearTraits(); 26 | 27 | SERIALIZATION_DECL(MovementSet) 28 | 29 | private: 30 | EnumSet SERIAL(traits); 31 | EnumSet SERIAL(forcibleTraits); 32 | bool SERIAL(blockingEnemies) = false; 33 | bool SERIAL(blockingPrisoners) = false; 34 | bool SERIAL(blockingFarmAnimals) = false; 35 | TribeId SERIAL(tribe); 36 | }; 37 | -------------------------------------------------------------------------------- /msg_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | MsgType, 7 | FEEL, // deprectated 8 | COLLAPSE, 9 | FALL, // deprecated 10 | FALL_ASLEEP, 11 | PANIC, 12 | RAGE, 13 | DIE_OF, 14 | ARE, // bleeding 15 | YOUR, // your head is cut off 16 | WAKE_UP, 17 | DIE, // 18 | TELE_APPEAR, 19 | TELE_DISAPPEAR, 20 | ARE_NO_LONGER, 21 | CAN_SEE_HIDING, 22 | HIT, 23 | TOUCH, 24 | CRAWL, 25 | TRIGGER_TRAP, 26 | DISARM_TRAP, 27 | GET_HIT_NODAMAGE, // body part 28 | HIT_THROWN_ITEM, 29 | HIT_THROWN_ITEM_PLURAL, 30 | MISS_THROWN_ITEM, 31 | MISS_THROWN_ITEM_PLURAL, 32 | ITEM_CRASHES, 33 | ITEM_CRASHES_PLURAL, 34 | STAND_UP, 35 | TURN_INVISIBLE, 36 | TURN_VISIBLE, 37 | ENTER_PORTAL, 38 | HAPPENS_TO, // deprecated 39 | BURN, 40 | DROWN, 41 | SET_UP_TRAP, // deprecated 42 | DECAPITATE, 43 | TURN, // deprecated 44 | BECOME, 45 | KILLED_BY, // deprecated 46 | BREAK_FREE, 47 | MISS_ATTACK, //deprecated 48 | PRAY, // deprecated 49 | SACRIFICE, // deprecated 50 | COPULATE, 51 | CONSUME 52 | ); 53 | 54 | -------------------------------------------------------------------------------- /music_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(MusicType, MAIN, PEACEFUL, BATTLE, NIGHT, ADV_PEACEFUL, ADV_BATTLE, SNOW, DESERT); 6 | -------------------------------------------------------------------------------- /name_generator_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class NameGeneratorId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /navigation_flags.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "navigation_flags.h" 3 | 4 | NavigationFlags::NavigationFlags() : stepOnTile(false), destroy(true), swapPosition(true) {} 5 | 6 | NavigationFlags&NavigationFlags::requireStepOnTile() { 7 | stepOnTile = true; 8 | return *this; 9 | } 10 | 11 | NavigationFlags&NavigationFlags::noDestroying() { 12 | destroy = false; 13 | return *this; 14 | } 15 | 16 | NavigationFlags&NavigationFlags::noSwapPosition() { 17 | swapPosition = false; 18 | return *this; 19 | } 20 | -------------------------------------------------------------------------------- /navigation_flags.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct NavigationFlags { 4 | NavigationFlags(); 5 | NavigationFlags& requireStepOnTile(); 6 | // This makes the creature stop at the obstacle, and not navigate around it 7 | NavigationFlags& noDestroying(); 8 | NavigationFlags& noSwapPosition(); 9 | bool stepOnTile; 10 | bool destroy; 11 | bool swapPosition; 12 | }; 13 | -------------------------------------------------------------------------------- /obj-opt/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /obj-opt/extern/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /obj/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /obj/extern/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /osx_make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | PATH=$PATH:/home/michal/Downloads/osxcross/target/bin 5 | make clean 6 | time make -f Makefile -j32 RELEASE=true OPT=true DEBUG=true STEAMWORKS=true GCC=o64-clang++ OSX=true 7 | ls -l keeper 8 | file keeper 9 | cp keeper ~/steam_content/osx/ 10 | -------------------------------------------------------------------------------- /perlin_noise.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | 6 | struct NoiseInit { 7 | int topLeft; 8 | int topRight; 9 | int bottomRight; 10 | int bottomLeft; 11 | int middle; 12 | }; 13 | 14 | Table genNoiseMap(RandomGen& random, Rectangle area, NoiseInit, double varianceMult); 15 | -------------------------------------------------------------------------------- /phylactery_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "view_object.h" 5 | 6 | struct PhylacteryInfo { 7 | Vec2 lich; 8 | Vec2 phylactery; 9 | optional lichObject; 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /player_info_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class PlayerInfoAction { 4 | CONTROL, 5 | RENAME, 6 | BANISH, 7 | DISASSEMBLE, 8 | CONSUME, 9 | LOCATE, 10 | ASSIGN_EQUIPMENT, 11 | LOCK_POSITION 12 | }; 13 | -------------------------------------------------------------------------------- /portals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | 6 | class Portals { 7 | public: 8 | optional getOtherPortal(Position) const; 9 | optional getPortalIndex(Position) const; 10 | bool registerPortal(Position); 11 | void removePortal(Position); 12 | optional getDistanceToNearest(Position) const; 13 | vector> getMatchedPortals() const; 14 | 15 | SERIALIZATION_DECL(Portals) 16 | 17 | private: 18 | void recalculateDistances(Level*); 19 | vector> SERIAL(matchings); 20 | unordered_map>> SERIAL(distanceToNearest); 21 | }; 22 | -------------------------------------------------------------------------------- /position_map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | 6 | class Level; 7 | 8 | template 9 | class PositionMap { 10 | public: 11 | optional getReferenceMaybe(Position) const; 12 | optional getReferenceMaybe(Position); 13 | optional getValueMaybe(Position) const; 14 | bool contains(Position) const; 15 | T& getOrInit(Position); 16 | T& getOrFail(Position); 17 | const T& getOrFail(Position) const; 18 | void set(Position, const T&); 19 | void erase(Position); 20 | void limitToModel(const Model*); 21 | bool containsLevel(const Level*) const; 22 | 23 | SERIALIZATION_DECL(PositionMap) 24 | 25 | private: 26 | Table >& getTable(Position); 27 | map>> SERIAL(tables); 28 | map> SERIAL(outliers); 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /position_matching.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | #include "position_map.h" 6 | 7 | class PositionMatching : public OwnedObject { 8 | public: 9 | 10 | optional getMatch(Position) const; 11 | void releaseTarget(Position); 12 | void addTarget(Position); 13 | void updateMovement(Position); 14 | 15 | template 16 | void serialize(Archive&, const unsigned); 17 | 18 | private: 19 | void findPath(Position); 20 | bool findPath(Position, PositionSet& visited, bool matchedWithFather); 21 | PositionMap SERIAL(matches); 22 | PositionMap SERIAL(reverseMatches); 23 | PositionSet SERIAL(targets); 24 | void setMatch(Position, Position); 25 | void removeMatch(Position); 26 | }; 27 | -------------------------------------------------------------------------------- /profiler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef EASY_PROFILER 4 | #define BUILD_WITH_EASY_PROFILER 5 | 6 | #include 7 | 8 | 9 | #define PROFILE EASY_FUNCTION(__LINE__) 10 | #define PROFILE_BLOCK(...) EASY_BLOCK(__VA_ARGS__) 11 | 12 | #define ENABLE_PROFILER\ 13 | profiler::startListen() 14 | /* EASY_PROFILER_ENABLE\ 15 | DestructorFunction dumpProfileData([]{profiler::dumpBlocksToFile("test_profile.prof");}) 16 | */ 17 | #else 18 | 19 | #define PROFILE 20 | #define PROFILE_BLOCK(...) 21 | #define ENABLE_PROFILER 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /progress.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "progress.h" 3 | 4 | static atomic interrupted { false }; 5 | 6 | void Progress::interrupt() { 7 | interrupted = true; 8 | } 9 | 10 | void Progress::checkIfInterrupted() { 11 | if (interrupted.exchange(false)) 12 | throw InterruptedException(); 13 | } 14 | -------------------------------------------------------------------------------- /progress.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // A simple mechanism of interrupting another thread's execution 4 | class Progress { 5 | public: 6 | class InterruptedException {}; 7 | static void interrupt(); 8 | static void checkIfInterrupted(); 9 | }; 10 | -------------------------------------------------------------------------------- /progress_meter.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "progress_meter.h" 3 | #include "util.h" 4 | 5 | ProgressMeter::ProgressMeter(float inc) : progress(0), increase(inc) { 6 | } 7 | 8 | double ProgressMeter::getProgress() const { 9 | return max(0.0f, min(1.0f, progress * increase)); 10 | } 11 | 12 | void ProgressMeter::addProgress(int num) { 13 | progress += num; 14 | } 15 | 16 | void ProgressMeter::reset() { 17 | progress = 0; 18 | } 19 | 20 | void ProgressMeter::setProgress(float p) { 21 | increase = 0.0001; 22 | progress = p / increase; 23 | } 24 | -------------------------------------------------------------------------------- /promotion_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "effect.h" 4 | #include "view_id.h" 5 | #include "t_string.h" 6 | 7 | struct PromotionInfo { 8 | Effect SERIAL(applied); 9 | TString SERIAL(name); 10 | ViewId SERIAL(viewId); 11 | SERIALIZE_ALL(name, viewId, applied) 12 | }; -------------------------------------------------------------------------------- /random_layout_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class RandomLayoutId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /renderable.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "util.h" 3 | #include "renderable.h" 4 | #include "view_object.h" 5 | 6 | Renderable::Renderable(const ViewObject& obj) : viewObject(obj) { 7 | } 8 | 9 | Renderable::~Renderable() { 10 | } 11 | 12 | SERIALIZATION_CONSTRUCTOR_IMPL(Renderable); 13 | 14 | const ViewObject& Renderable::getViewObject() const { 15 | return *viewObject.get(); 16 | } 17 | 18 | ViewObject& Renderable::modViewObject() { 19 | return *viewObject.get(); 20 | } 21 | 22 | SERIALIZE_DEF(Renderable, viewObject) 23 | 24 | void Renderable::setViewObject(const ViewObject& obj) { 25 | viewObject = HeapAllocated(obj); 26 | } 27 | -------------------------------------------------------------------------------- /renderable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "serialization.h" 4 | #include "util.h" 5 | 6 | class ViewObject; 7 | 8 | class Renderable { 9 | public: 10 | Renderable(const ViewObject&); 11 | const ViewObject& getViewObject() const; 12 | ViewObject& modViewObject(); 13 | 14 | SERIALIZATION_DECL(Renderable); 15 | 16 | ~Renderable(); 17 | 18 | protected: 19 | void setViewObject(const ViewObject&); 20 | 21 | private: 22 | HeapAllocated SERIAL(viewObject); 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /resource_counts.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "resource_counts.h" 3 | 4 | optional chooseResourceCounts(RandomGen& random, const vector& resources, int depth) { 5 | vector available; 6 | for (auto& l : resources) 7 | if (l.minDepth.value_or(-100) <= depth && l.maxDepth.value_or(1000000) >= depth) 8 | available.push_back(l.counts); 9 | if (available.empty()) 10 | return none; 11 | return random.choose(available); 12 | } 13 | -------------------------------------------------------------------------------- /resource_counts.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "furniture_type.h" 5 | 6 | struct ResourceCounts { 7 | struct Elem { 8 | FurnitureType SERIAL(type); 9 | Range SERIAL(size); 10 | int SERIAL(countStartingPos); 11 | int SERIAL(countFurther); 12 | SERIALIZE_ALL(type, size, countStartingPos, countFurther) 13 | }; 14 | vector SERIAL(elems); 15 | SERIALIZE_ALL(elems) 16 | }; 17 | 18 | struct ResourceDistribution { 19 | ResourceCounts SERIAL(counts); 20 | optional SERIAL(minDepth); 21 | optional SERIAL(maxDepth); 22 | SERIALIZE_ALL(NAMED(counts), NAMED(minDepth), NAMED(maxDepth)) 23 | }; 24 | 25 | optional chooseResourceCounts(RandomGen&, const vector&, int depth); 26 | 27 | -------------------------------------------------------------------------------- /resource_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class CollectiveResourceId : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /resource_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "item_type.h" 5 | #include "view_id.h" 6 | #include "t_string.h" 7 | 8 | struct ResourceInfo { 9 | optional SERIAL(itemId); 10 | vector SERIAL(storage); 11 | TString SERIAL(name); 12 | optional SERIAL(viewId); 13 | optional SERIAL(tutorialHighlight); 14 | SERIALIZE_ALL(SKIP(itemId), SKIP(storage), NAMED(name), NAMED(viewId), NAMED(tutorialHighlight)) 15 | }; 16 | -------------------------------------------------------------------------------- /retired_enemy_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "enemy_id.h" 4 | 5 | struct RetiredEnemyInfo { 6 | EnemyId SERIAL(enemyId); 7 | VillainType SERIAL(villainType); 8 | SERIALIZE_ALL(enemyId, villainType) 9 | }; 10 | -------------------------------------------------------------------------------- /retired_games.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "saved_game_info.h" 5 | #include "save_file_info.h" 6 | 7 | class RetiredGames { 8 | public: 9 | void addLocal(const SavedGameInfo&, const SaveFileInfo&, bool active); 10 | void addOnline(const SavedGameInfo&, const SaveFileInfo&, int numTotal, int numWon, bool subscribed, 11 | string author, bool isFriend); 12 | 13 | void sort(); 14 | 15 | struct RetiredGame { 16 | SavedGameInfo gameInfo; 17 | SaveFileInfo fileInfo; 18 | int numTotal; 19 | int numWon; 20 | bool active; 21 | bool subscribed; 22 | string author; 23 | bool isFriend; 24 | }; 25 | 26 | const vector& getAllGames() const; 27 | vector getActiveGames() const; 28 | 29 | int getNumActive() const; 30 | int getNumLocal() const; 31 | 32 | void setActive(int num, bool); 33 | bool isActive(int num) const; 34 | void erase(int num); 35 | 36 | private: 37 | vector games; 38 | int numLocal = 0; 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /rungdb.bat: -------------------------------------------------------------------------------- 1 | 2 | @echo Sorry, KeeperRL crashed :( 3 | @echo. 4 | @echo Gathering crash information and sending crash home a report. 5 | @echo. 6 | @echo It may take a few minutes. Please don't close this window. 7 | 8 | @echo off 9 | 10 | 11 | gdb.exe --data-directory gdb -batch -p %1 -x gdb_input.txt >> stacktrace.out 12 | sendreport.bat -------------------------------------------------------------------------------- /save_file_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | struct SaveFileInfo { 6 | string SERIAL(filename); 7 | time_t date; 8 | bool SERIAL(download); 9 | optional SERIAL(steamId); 10 | template 11 | void serialize(Archive& ar, const unsigned int) { 12 | ar(filename, download, steamId); 13 | } 14 | string getGameId() const { 15 | return filename.substr(0, filename.size() - 4); 16 | } 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /saved_game_info.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "saved_game_info.h" 3 | #include "text_serialization.h" 4 | #include "parse_game.h" 5 | #include "creature.h" 6 | 7 | #ifndef PARSE_GAME 8 | SavedGameInfo::MinionInfo SavedGameInfo::MinionInfo::get(const ContentFactory* factory, const Creature* c) { 9 | MinionInfo ret; 10 | ret.level = (int)c->getBestAttack(factory).value; 11 | ret.viewId = c->getViewIdWithWeapon(); 12 | return ret; 13 | } 14 | #endif 15 | 16 | ViewIdList SavedGameInfo::getViewId() const { 17 | return minions[0].viewId; 18 | } 19 | 20 | OldSavedGameInfo getOldInfo(const SavedGameInfo& info) { 21 | CHECK(!info.retiredEnemyInfo); 22 | return OldSavedGameInfo{info.minions, 0, info.name, info.progressCount, info.spriteMods}; 23 | } 24 | 25 | SavedGameInfo fromOldInfo(const OldSavedGameInfo& info) { 26 | return SavedGameInfo{info.minions, none, info.name, info.progressCount, info.spriteMods}; 27 | } 28 | -------------------------------------------------------------------------------- /scripted_help_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "view_id.h" 5 | #include "t_string.h" 6 | 7 | struct ScriptedHelpInfo { 8 | string SERIAL(scriptedId); 9 | optional SERIAL(viewId); 10 | optional SERIAL(title); 11 | SERIALIZE_ALL(NAMED(scriptedId), NAMED(viewId), NAMED(title)) 12 | }; -------------------------------------------------------------------------------- /scroll_position.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include 6 | 7 | class ScrollPosition { 8 | public: 9 | ScrollPosition(); 10 | explicit ScrollPosition(double pos); 11 | void set(double, milliseconds); 12 | void setRelative(double, milliseconds); 13 | void setRatio(double, milliseconds); 14 | void reset(double); 15 | void setBounds(double min, double max, int yBegin); 16 | void add(double, milliseconds); 17 | double get(milliseconds, double min, double max, int yBegin); 18 | double get(milliseconds); 19 | double getRatio(milliseconds); 20 | bool isScrolling(milliseconds); 21 | void reset(); 22 | 23 | private: 24 | double start = 0; 25 | double target = 0; 26 | milliseconds targetTime = milliseconds{0}; 27 | struct KnownBounds { 28 | double min; 29 | double max; 30 | int yBegin; 31 | }; 32 | optional knownBounds; 33 | }; 34 | -------------------------------------------------------------------------------- /sdl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef WINDOWS 4 | #ifndef _WINDOWS_ 5 | #define _WINDOWS_ 6 | #define APIENTRY __attribute__((__stdcall__)) 7 | #define WINGDIAPI __attribute__((dllimport)) 8 | #endif 9 | #else 10 | #define GL_GLEXT_PROTOTYPES 1 11 | #endif 12 | 13 | #include "stdafx.h" 14 | 15 | namespace SDL { 16 | #include 17 | #include 18 | #include 19 | #include 20 | } 21 | 22 | #undef TECHNOLOGY 23 | #undef TRANSPARENT 24 | 25 | using SDL::Uint8; 26 | 27 | typedef SDL::SDL_Event Event; 28 | typedef SDL::SDL_EventType EventType; 29 | -------------------------------------------------------------------------------- /sdl_event_generator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "sdl.h" 4 | #include "util.h" 5 | 6 | class RandomGen; 7 | 8 | class SdlEventGenerator { 9 | public: 10 | static SDL::SDL_Event getRandom(RandomGen&, Vec2 screenSize); 11 | }; 12 | -------------------------------------------------------------------------------- /sdl_keycodes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "util.h" 3 | #include "sdl.h" 4 | 5 | const char* getString(SDL::SDL_Keycode key); 6 | optional keycodeFromString(const char* key); 7 | -------------------------------------------------------------------------------- /sendreport.bat: -------------------------------------------------------------------------------- 1 | if exist installId.txt ( 2 | @type installId.txt >> report.txt 3 | ) 4 | echo. >> report.txt 5 | if exist system_info.txt ( 6 | @type system_info.txt >> report.txt 7 | ) else ( 8 | echo. >> report.txt 9 | ) 10 | @type stacktrace.out >> report.txt 11 | curl.exe --progress-bar -F "userfile=@report.txt" blkrs.com/~michal/upload_stacktrace.php 12 | @del report.txt 13 | @del stacktrace.out 14 | -------------------------------------------------------------------------------- /server/.gitignore: -------------------------------------------------------------------------------- 1 | db_conf.php 2 | -------------------------------------------------------------------------------- /server/db.php: -------------------------------------------------------------------------------- 1 | connect_error) { 14 | die("Connection failed: " . $conn->connect_error); 15 | } 16 | return $conn; 17 | } 18 | 19 | function executeSql($sql, $conn) { 20 | if ($sql->execute() != TRUE) { 21 | echo "Error: " . $conn->error; 22 | return false; 23 | } 24 | $sql->close(); 25 | return true; 26 | } 27 | 28 | 29 | ?> 30 | -------------------------------------------------------------------------------- /server/get_messages.php: -------------------------------------------------------------------------------- 1 | query($sql); 15 | 16 | if ($result->num_rows > 0) { 17 | while($row = $result->fetch_assoc()) { 18 | echo rawurlencode($row["text"]) . ","; 19 | echo rawurlencode($row["author"]) . "\n"; 20 | } 21 | } 22 | 23 | $conn->close(); 24 | -------------------------------------------------------------------------------- /server/get_sites.php: -------------------------------------------------------------------------------- 1 | query($sql); 16 | 17 | if ($result->num_rows > 0) { 18 | while($row = $result->fetch_assoc()) { 19 | # echo $row["display_name"] . ","; 20 | echo $row["filename"] . ","; 21 | echo $row["time"] . ","; 22 | echo $row["won_games"] . ","; 23 | echo $row["total_games"] . ","; 24 | echo $row["save_info"] . ","; 25 | echo $row["version"] . "\n"; 26 | } 27 | } 28 | 29 | $conn->close(); 30 | -------------------------------------------------------------------------------- /server/highscores.php: -------------------------------------------------------------------------------- 1 | real_escape_string($_GET["version"]); 8 | 9 | $sql = "select * from highscores where version = " . $version; 10 | 11 | header("Content-Type:text/plain"); 12 | 13 | $result = $dbConn->query($sql); 14 | if ($result->num_rows > 0) { 15 | while($row = $result->fetch_assoc()) { 16 | echo $row["game_id"] . ","; 17 | echo $row["player_name"] . ","; 18 | echo $row["world_name"] . ","; 19 | echo $row["game_result"] . ","; 20 | echo $row["game_won"] . ","; 21 | echo $row["points"] . ","; 22 | echo $row["turns"] . ","; 23 | echo $row["game_type"] . ","; 24 | echo $row["player_role"] . ","; 25 | echo $row["version"] ."\n"; 26 | } 27 | } 28 | $dbConn->close(); 29 | -------------------------------------------------------------------------------- /server/upload_scores.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | Select image to upload: 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /server/upload_site.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | Select file to upload: 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /simple_game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "creature.h" 5 | #include "technology.h" 6 | #include "resource_id.h" 7 | #include "keeper_creature_info.h" 8 | #include "immigrant_info.h" 9 | #include "dungeon_level.h" 10 | #include "z_level_info.h" 11 | 12 | class MainLoop; 13 | 14 | class SimpleGame { 15 | public: 16 | SimpleGame(ContentFactory*, MainLoop*); 17 | void update(); 18 | 19 | int zLevel = 0; 20 | Technology technology; 21 | vector minions; 22 | HashMap resources; 23 | vector immigrants; 24 | vector zLevels; 25 | DungeonLevel dungeonLevel; 26 | int maxPopulation = 10; 27 | ContentFactory* factory; 28 | MainLoop* mainLoop; 29 | private: 30 | using SimpleAction = function; 31 | vector> getActions(); 32 | bool meetsRequirements(const ImmigrantInfo&); 33 | void addImmigrant(); 34 | void increaseZLevel(); 35 | void research(); 36 | void addResourcesForLevel(int level); 37 | bool fightEnemy(EnemyId); 38 | }; 39 | -------------------------------------------------------------------------------- /sokoban_input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "file_path.h" 5 | 6 | class SokobanInput { 7 | public: 8 | SokobanInput(const FilePath& levels, const FilePath& state); 9 | 10 | Table getNext(); 11 | static optional > readTable(ifstream&); 12 | 13 | private: 14 | FilePath levelsPath; 15 | FilePath statePath; 16 | }; 17 | -------------------------------------------------------------------------------- /sound.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "sound.h" 3 | #include "position.h" 4 | 5 | Sound::Sound(SoundId i) : id(i) { 6 | } 7 | 8 | SERIALIZE_DEF(Sound, NAMED(id), OPTION(volume), OPTION(pitch)) 9 | SERIALIZATION_CONSTRUCTOR_IMPL(Sound) 10 | 11 | Sound& Sound::setPosition(const Position& p) { 12 | position = p; 13 | return *this; 14 | } 15 | 16 | Sound& Sound::setPitch(double v) { 17 | pitch = v; 18 | return *this; 19 | } 20 | 21 | Sound& Sound::setVolume(double v) { 22 | volume = v; 23 | return *this; 24 | } 25 | 26 | SoundId Sound::getId() const { 27 | return id; 28 | } 29 | 30 | Sound& Sound::setId(SoundId i) { 31 | id = i; 32 | return *this; 33 | } 34 | 35 | const optional& Sound::getPosition() const { 36 | return position; 37 | } 38 | 39 | double Sound::getPitch() const { 40 | return pitch; 41 | } 42 | 43 | double Sound::getVolume() const { 44 | return volume; 45 | } 46 | 47 | #include "pretty_archive.h" 48 | template void Sound::serialize(PrettyInputArchive&, unsigned); 49 | -------------------------------------------------------------------------------- /sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | 6 | class Sound { 7 | public: 8 | Sound(SoundId); 9 | Sound& setPosition(const Position&); 10 | Sound& setPitch(double); 11 | Sound& setVolume(double); 12 | const optional& getPosition() const; 13 | SoundId getId() const; 14 | Sound& setId(SoundId); 15 | double getPitch() const; 16 | double getVolume() const; 17 | 18 | SERIALIZATION_DECL(Sound) 19 | 20 | private: 21 | SoundId SERIAL(id); 22 | optional position; 23 | double SERIAL(pitch) = 1.0; 24 | double SERIAL(volume) = 1.0; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /sound_library.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "sound.h" 5 | 6 | class Options; 7 | class AudioDevice; 8 | class SoundBuffer; 9 | class DirectoryPath; 10 | 11 | class SoundLibrary { 12 | public: 13 | SoundLibrary(AudioDevice&, const DirectoryPath&); 14 | SoundLibrary(); 15 | milliseconds playSound(const Sound&); 16 | void setVolume(int); // between 1..100 17 | 18 | private: 19 | void addSounds(SoundId, const DirectoryPath&); 20 | HashMap> sounds; 21 | double volume; 22 | AudioDevice* audioDevice = nullptr; 23 | }; 24 | -------------------------------------------------------------------------------- /special_attr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "creature_predicate.h" 5 | #include "attr_type.h" 6 | 7 | struct SpecialAttr { 8 | AttrType SERIAL(attr); 9 | int SERIAL(value); 10 | CreaturePredicate SERIAL(predicate); 11 | SERIALIZE_ALL(attr, value, predicate) 12 | }; 13 | -------------------------------------------------------------------------------- /spectator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "creature_view.h" 4 | #include "event_listener.h" 5 | 6 | class View; 7 | 8 | class Spectator : public OwnedObject, public CreatureView, public EventListener { 9 | public: 10 | Spectator(Level*, View*); 11 | void onEvent(const GameEvent&); 12 | virtual const MapMemory& getMemory() const override; 13 | virtual void getViewIndex(Vec2 pos, ViewIndex&) const override; 14 | virtual void refreshGameInfo(GameInfo&) const override; 15 | virtual Vec2 getScrollCoord() const override; 16 | virtual Level* getCreatureViewLevel() const override; 17 | virtual double getAnimationTime() const override; 18 | virtual vector getVisibleEnemies() const override; 19 | virtual CenterType getCenterType() const override; 20 | virtual const vector& getUnknownLocations(const Level*) const override; 21 | 22 | private: 23 | Level* level = nullptr; 24 | View* view = nullptr; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /spell_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class SpellId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /spell_school.cpp: -------------------------------------------------------------------------------- 1 | #include "spell_school.h" 2 | #include "pretty_archive.h" 3 | 4 | SERIALIZE_DEF(SpellSchool, expType, spells, name) 5 | SERIALIZATION_CONSTRUCTOR_IMPL(SpellSchool) 6 | 7 | void SpellSchool::serialize(PrettyInputArchive& ar1, const unsigned int) { \ 8 | auto bookmark = ar1.bookmark(); 9 | auto s1 = ar1.eat(); 10 | auto s2 = ar1.eat(); 11 | ar1.seek(bookmark); 12 | if (s2[0] == '{') 13 | ar1(expType, spells); 14 | else 15 | ar1(name, expType, spells); 16 | } 17 | -------------------------------------------------------------------------------- /spell_school.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "spell.h" 5 | #include "attr_type.h" 6 | 7 | struct SpellSchool { 8 | AttrType SERIAL(expType); 9 | optional SERIAL(name); 10 | vector> SERIAL(spells); 11 | SERIALIZATION_DECL(SpellSchool) 12 | void serialize(PrettyInputArchive& ar1, const unsigned int); 13 | }; 14 | -------------------------------------------------------------------------------- /spell_school_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class SpellSchoolId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /square_array.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "creature.h" 3 | 4 | -------------------------------------------------------------------------------- /square_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "square.h" 5 | 6 | 7 | class SquareArray { 8 | public: 9 | SquareArray(Rectangle bounds) : modified(bounds), readOnly(make_unique()) {} 10 | 11 | Table SERIAL(modified); 12 | PSquare SERIAL(readOnly); 13 | int SERIAL(numModified) = 0; 14 | 15 | SERIALIZE_ALL(modified, readOnly, numModified) 16 | SERIALIZATION_CONSTRUCTOR(SquareArray) 17 | 18 | const Rectangle& getBounds() const { 19 | return modified.getBounds(); 20 | } 21 | 22 | Square* getWritable(Vec2 pos) { 23 | if (!modified[pos]) { 24 | modified[pos] = make_unique(); 25 | ++numModified; 26 | } 27 | return modified[pos].get(); 28 | } 29 | 30 | const Square* getReadonly(Vec2 pos) const { 31 | if (modified[pos]) 32 | return modified[pos].get(); 33 | else 34 | return readOnly.get(); 35 | } 36 | 37 | int getNumGenerated() const { 38 | return numModified; 39 | } 40 | 41 | int getNumTotal() const { 42 | return numModified; 43 | } 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /square_attrib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(SquareAttrib, 6 | NO_DIG, 7 | NO_CREATURES, 8 | MOUNTAIN, 9 | HILL, 10 | LOWLAND, 11 | CONNECT_ROAD, 12 | CONNECT_CORRIDOR, 13 | CONNECTOR, 14 | LAKE, 15 | RIVER, 16 | ROAD_CUT_THRU, 17 | NO_ROAD, 18 | ROOM, 19 | ROOM_WALL, 20 | EMPTY_ROOM, 21 | FLOOR_OUTSIDE, 22 | BUILDINGS_CENTER, 23 | CASTLE_CORNER, 24 | FORREST, 25 | SOKOBAN_ENTRY, 26 | SOKOBAN_PRIZE, 27 | NO_RESOURCES 28 | ); 29 | -------------------------------------------------------------------------------- /stack_printer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void initializeMiniDump(); 4 | void attachConsole(); 5 | void setConsoleColor(int); 6 | void dpiAwareness(); -------------------------------------------------------------------------------- /stair_key.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "stair_key.h" 3 | 4 | StairKey StairKey::getNew() { 5 | return Random.getLL(); 6 | } 7 | 8 | StairKey StairKey::keeperSpawn() { 9 | return StairKey(1); 10 | } 11 | 12 | StairKey StairKey::transferLanding() { 13 | return StairKey(2); 14 | } 15 | 16 | bool StairKey::operator == (const StairKey& o) const { 17 | return key == o.key; 18 | } 19 | 20 | bool StairKey::operator != (const StairKey& o) const { 21 | return key != o.key; 22 | } 23 | 24 | long long StairKey::getInternalKey() const { 25 | return key; 26 | } 27 | 28 | int StairKey::getHash() const { 29 | return key; 30 | } 31 | 32 | StairKey::StairKey(long long k) : key(k) { 33 | } 34 | 35 | SERIALIZE_DEF(StairKey, key) 36 | SERIALIZATION_CONSTRUCTOR_IMPL(StairKey); 37 | -------------------------------------------------------------------------------- /stair_key.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | class StairKey { 6 | public: 7 | static StairKey getNew(); 8 | static StairKey keeperSpawn(); 9 | static StairKey transferLanding(); 10 | 11 | bool operator == (const StairKey&) const; 12 | bool operator != (const StairKey&) const; 13 | 14 | SERIALIZATION_DECL(StairKey) 15 | 16 | long long getInternalKey() const; 17 | int getHash() const; 18 | 19 | private: 20 | StairKey(long long key); 21 | long long SERIAL(key); 22 | }; 23 | 24 | namespace std { 25 | 26 | template <> struct hash { 27 | size_t operator()(const StairKey& obj) const { 28 | return hash()(obj.getInternalKey()); 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /stb_truetype.cpp: -------------------------------------------------------------------------------- 1 | #define STB_TRUETYPE_IMPLEMENTATION 2 | 3 | #define STBTT_malloc(x,u) malloc(x) 4 | #define STBTT_free(x,u) free(x) 5 | #define STBTT_assert(...) do {} while(0) 6 | 7 | #include "stb_truetype.h" 8 | -------------------------------------------------------------------------------- /steam_achievements.cpp: -------------------------------------------------------------------------------- 1 | #include "steam_achievements.h" 2 | #include "achievement_id.h" 3 | 4 | #include "extern/steamworks/public/steam/isteamuserstats.h" 5 | #include "extern/steamworks/public/steam/isteamuser.h" 6 | 7 | SteamAchievements::SteamAchievements() { 8 | if (auto stats = SteamUserStats()) 9 | if (auto user = SteamUser()) 10 | if (user->BLoggedOn()) { 11 | stats->RequestCurrentStats(); 12 | } 13 | } 14 | 15 | void SteamAchievements::achieve(AchievementId id) { 16 | if (auto stats = SteamUserStats()) { 17 | stats->SetAchievement(id.data()); 18 | stats->StoreStats(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /steam_achievements.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | 5 | class AchievementId; 6 | 7 | struct SteamAchievements { 8 | SteamAchievements(); 9 | void achieve(AchievementId); 10 | }; -------------------------------------------------------------------------------- /steam_appid.txt: -------------------------------------------------------------------------------- 1 | 329970 2 | -------------------------------------------------------------------------------- /steam_client.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "steam_base.h" 4 | 5 | namespace steam { 6 | 7 | class Client { 8 | public: 9 | Client(); 10 | Client(const Client&) = delete; 11 | void operator=(const Client&) = delete; 12 | ~Client(); 13 | 14 | static bool isAvailable(); 15 | static Client& instance(); 16 | 17 | Friends& friends(); 18 | User& user(); 19 | Utils& utils(); 20 | UGC& ugc(); 21 | 22 | // TODO: mark callback-based functions? 23 | optional numberOfCurrentPlayers(); 24 | 25 | string info(); 26 | 27 | private: 28 | struct Impl; 29 | struct Ifaces; 30 | unique_ptr impl; 31 | unique_ptr ifaces; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /steam_friends.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "steam_base.h" 4 | 5 | RICH_ENUM(SteamAvatarSize, small, medium, large); 6 | 7 | struct ISteamFriends; 8 | 9 | namespace steam { 10 | using AvatarSize = SteamAvatarSize; 11 | 12 | class Friends { 13 | STEAM_IFACE_DECL(Friends, ISteamFriends) 14 | 15 | static constexpr unsigned flag_all = 0xffff; 16 | 17 | int count(unsigned flags = flag_all) const; 18 | vector ids(unsigned flags = flag_all) const; 19 | 20 | void requestUserInfo(UserId, bool nameOnly); 21 | optional retrieveUserName(UserId); 22 | optional retrieveUserAvatar(UserId, AvatarSize); 23 | 24 | string name() const; 25 | 26 | private: 27 | struct Impl; 28 | HeapAllocated impl; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /steam_internal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "steamworks/public/steam/steam_api_common.h" 6 | #include "steamworks/public/steam/steam_api.h" 7 | #include "steamworks/public/steam/steam_api_flat.h" 8 | 9 | #include 10 | 11 | namespace steam { 12 | std::string errorText(EResult); 13 | } 14 | -------------------------------------------------------------------------------- /steam_user.cpp: -------------------------------------------------------------------------------- 1 | #include "steam_internal.h" 2 | #include "steam_user.h" 3 | #include "steamworks/public/steam/isteamuser.h" 4 | 5 | #define FUNC(name, ...) SteamAPI_ISteamUser_##name 6 | 7 | namespace steam { 8 | 9 | User::User(ISteamUser* ptr) : ptr(ptr) { 10 | } 11 | User::~User() = default; 12 | 13 | UserId User::id() const { 14 | return UserId(FUNC(GetSteamID)(ptr)); 15 | } 16 | 17 | bool User::isLoggedOn() const { 18 | return FUNC(BLoggedOn)(ptr); 19 | } 20 | } 21 | #undef FUNC 22 | -------------------------------------------------------------------------------- /steam_user.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "steam_base.h" 4 | 5 | struct ISteamUser; 6 | 7 | namespace steam { 8 | class User { 9 | STEAM_IFACE_DECL(User, ISteamUser) 10 | 11 | UserId id() const; 12 | bool isLoggedOn() const; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /steam_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "steam_internal.h" 3 | #include "steam_utils.h" 4 | #include "steamworks/public/steam/isteamutils.h" 5 | 6 | #define FUNC(name, ...) SteamAPI_ISteamUtils_##name 7 | 8 | namespace steam { 9 | 10 | Utils::Utils(ISteamUtils* ptr) : ptr(ptr) { 11 | } 12 | Utils::~Utils() = default; 13 | 14 | pair Utils::imageSize(int image_id) const { 15 | uint32_t w = 0, h = 0; 16 | if (!FUNC(GetImageSize)(ptr, image_id, &w, &h)) 17 | CHECK(false); 18 | return std::make_pair(int(w), int(h)); 19 | } 20 | 21 | vector Utils::imageData(int image_id) const { 22 | auto size = imageSize(image_id); 23 | vector out(size.first * size.second * 4); 24 | if (!FUNC(GetImageRGBA)(ptr, image_id, out.data(), out.size())) 25 | CHECK(false); 26 | return out; 27 | } 28 | unsigned Utils::appId() const { 29 | return FUNC(GetAppID)(ptr); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /steam_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "steam_base.h" 4 | 5 | struct ISteamUtils; 6 | 7 | namespace steam { 8 | 9 | class Utils { 10 | STEAM_IFACE_DECL(Utils, ISteamUtils); 11 | friend struct CallResultBase; 12 | 13 | // TODO: return expected ? 14 | pair imageSize(int image_id) const; 15 | vector imageData(int image_id) const; 16 | 17 | unsigned appId() const; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /storage_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "content_id.h" 5 | 6 | class StorageId : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /storage_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "storage_id.h" 5 | 6 | struct StorageInfo { 7 | StorageId SERIAL(storage); 8 | Collective* SERIAL(collective) = nullptr; 9 | SERIALIZE_ALL(storage, collective); 10 | }; 11 | -------------------------------------------------------------------------------- /storage_positions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | 6 | class StoragePositions { 7 | public: 8 | 9 | using MapType = HashMap; 10 | 11 | void add(Position); 12 | void remove(Position); 13 | bool empty() const; 14 | bool contains(Position) const; 15 | vector asVector() const; 16 | 17 | template 18 | void serialize(Archive&, unsigned int); 19 | 20 | struct Iter { 21 | MapType::const_iterator iter; 22 | 23 | const Position& operator* () const; 24 | bool operator != (const Iter& other) const; 25 | const Iter& operator++ (); 26 | }; 27 | 28 | Iter begin() const; 29 | Iter end() const; 30 | 31 | private: 32 | MapType SERIAL(positions); 33 | }; 34 | 35 | 36 | -------------------------------------------------------------------------------- /sunlight_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(SunlightState, 6 | DAY, 7 | NIGHT 8 | ); 9 | 10 | #include "game_time.h" 11 | 12 | class TStringId; 13 | 14 | class SunlightInfo { 15 | public: 16 | TStringId getText() const; 17 | static TStringId getText(SunlightState); 18 | void update(GlobalTime currentTime); 19 | SunlightState getState() const; 20 | double getLightAmount() const; 21 | TimeInterval getTimeRemaining() const; 22 | TimeInterval getTimeSinceDawn() const; 23 | 24 | private: 25 | double lightAmount; 26 | TimeInterval timeRemaining; 27 | SunlightState state; 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /target_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class TargetType { 4 | TRAJECTORY, 5 | POSITION, 6 | SHOW_ALL 7 | }; 8 | -------------------------------------------------------------------------------- /task_callback.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "entity_set.h" 5 | #include "position.h" 6 | #include "furniture_type.h" 7 | 8 | class TaskCallback : public OwnedObject { 9 | public: 10 | virtual void onConstructed(Position, FurnitureType) {} 11 | virtual void onDestructed(Position, FurnitureType, const DestroyAction&) {} 12 | virtual bool isConstructionReachable(Position) { return true; } 13 | virtual void onAppliedSquare(Creature*, pair) {} 14 | virtual void onCopulated(Creature* who, Creature* with) {} 15 | // Remove after A30 16 | virtual bool containsCreature(Creature*) { return false; } 17 | 18 | template 19 | void serialize(Archive& ar, const unsigned int) { 20 | ar & SUBCLASS(OwnedObject); 21 | } 22 | 23 | virtual ~TaskCallback() {} 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /team_member_action.cpp: -------------------------------------------------------------------------------- 1 | #include "team_member_action.h" 2 | #include "view_object_action.h" 3 | 4 | ViewObjectAction getText(TeamMemberAction action) { 5 | switch (action) { 6 | case TeamMemberAction::CHANGE_LEADER: 7 | return ViewObjectAction::SWITCH_LEADER; 8 | case TeamMemberAction::REMOVE_MEMBER: 9 | return ViewObjectAction::REMOVE_FROM_TEAM; 10 | case TeamMemberAction::MOVE_NOW: 11 | return ViewObjectAction::MOVE_NOW; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /team_member_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "enums.h" 4 | 5 | enum class TeamMemberAction { 6 | CHANGE_LEADER, 7 | REMOVE_MEMBER, 8 | MOVE_NOW 9 | }; 10 | 11 | ViewObjectAction getText(TeamMemberAction); 12 | -------------------------------------------------------------------------------- /team_order.cpp: -------------------------------------------------------------------------------- 1 | #include "team_order.h" 2 | #include "keybinding.h" 3 | #include "t_string.h" 4 | 5 | TStringId getName(TeamOrder order) { 6 | switch (order) { 7 | case TeamOrder::FLEE: 8 | return TStringId("DONT_CHASE_TEAM_ORDER"); 9 | case TeamOrder::STAND_GROUND: 10 | return TStringId("STOP_TEAM_ORDER"); 11 | } 12 | } 13 | 14 | TStringId getDescription(TeamOrder order) { 15 | switch (order) { 16 | case TeamOrder::FLEE: 17 | return TStringId("DONT_CHASE_TEAM_ORDER_DESCRIPTION"); 18 | case TeamOrder::STAND_GROUND: 19 | return TStringId("STOP_TEAM_ORDER_DESCRIPTION"); 20 | } 21 | } 22 | 23 | Keybinding getKeybinding(TeamOrder order) { 24 | switch (order) { 25 | case TeamOrder::FLEE: 26 | return Keybinding("IGNORE_ENEMIES"); 27 | case TeamOrder::STAND_GROUND: 28 | return Keybinding("STAND_GROUND"); 29 | } 30 | } 31 | 32 | bool conflict(TeamOrder o1, TeamOrder o2) { 33 | return o1 != o2; 34 | } 35 | -------------------------------------------------------------------------------- /team_order.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(TeamOrder, 6 | STAND_GROUND, 7 | FLEE 8 | ); 9 | 10 | class TStringId; 11 | extern TStringId getName(TeamOrder); 12 | extern TStringId getDescription(TeamOrder); 13 | extern Keybinding getKeybinding(TeamOrder); 14 | extern bool conflict(TeamOrder, TeamOrder); 15 | -------------------------------------------------------------------------------- /tech_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "content_id.h" 4 | 5 | class TechId : public ContentId { 6 | public: 7 | using ContentId::ContentId; 8 | }; 9 | -------------------------------------------------------------------------------- /test.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2014 Michal Brzozowski (rusolis@poczta.fm) 2 | 3 | This file is part of KeeperRL. 4 | 5 | KeeperRL is free software; you can redistribute it and/or modify it under the terms of the 6 | GNU General Public License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with this program. 14 | If not, see http://www.gnu.org/licenses/ . */ 15 | 16 | #pragma once 17 | 18 | void testAll(); 19 | 20 | -------------------------------------------------------------------------------- /texture_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(TextureId, 6 | SCROLLBAR, 7 | SCROLL_BUTTON, 8 | BACKGROUND_PATTERN, 9 | HORI_LINE, 10 | VERT_BAR, 11 | HORI_BAR, 12 | HORI_BAR_MINI, 13 | VERT_BAR_MINI, 14 | CORNER_MINI, 15 | HORI_BAR_MINI2, 16 | VERT_BAR_MINI2, 17 | CORNER_MINI2, 18 | CORNER_MINI2_LARGE, 19 | CORNER_3, 20 | BUTTON_BG, 21 | BUTTON_CORNER, 22 | BUTTON_SIDE, 23 | BUTTON_BOTTOM, 24 | BUTTON_CORNER_HIGHLIGHT, 25 | BUTTON_SIDE_HIGHLIGHT, 26 | BUTTON_BOTTOM_HIGHLIGHT, 27 | IMMIGRANT_BG, 28 | IMMIGRANT2_BG, 29 | SCROLL_UP, 30 | SCROLL_DOWN, 31 | WINDOW_CORNER, 32 | WINDOW_CORNER_EXIT, 33 | WINDOW_CORNER_EXIT_HIGHLIGHT, 34 | WINDOW_VERT_BAR, 35 | UI_HIGHLIGHT, 36 | MAIN_MENU_HIGHLIGHT, 37 | MENU_ITEM, 38 | MENU_CORE, 39 | MINIMAP_BAR 40 | ); 41 | -------------------------------------------------------------------------------- /tile_gas_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | #include "color.h" 6 | #include "effect.h" 7 | #include "t_string.h" 8 | 9 | struct TileGasInfo { 10 | TString SERIAL(name); 11 | Color SERIAL(color); 12 | double SERIAL(decrease); 13 | double SERIAL(spread); 14 | bool SERIAL(blocksVision) = false; 15 | optional SERIAL(effect); 16 | SERIALIZE_ALL(NAMED(name), NAMED(color), NAMED(decrease), NAMED(spread), OPTION(blocksVision), NAMED(effect)) 17 | }; -------------------------------------------------------------------------------- /tile_gas_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class TileGasType : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /tile_paths.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "tile_paths.h" 3 | #include "game_config.h" 4 | 5 | TilePaths::TilePaths(vector d, vector mods) : definitions(std::move(d)), mainMods(std::move(mods)) {} 6 | 7 | void TilePaths::merge(TilePaths other) { 8 | auto contains = [&] (auto viewId) { 9 | for (auto& tile : definitions) 10 | if (tile.viewId == viewId) 11 | return true; 12 | return false; 13 | }; 14 | for (auto& tile : other.definitions) 15 | if (!contains(tile.viewId)) 16 | definitions.push_back(tile); 17 | for (auto& mod : concat(other.mainMods, other.mergedMods)) 18 | if (!mainMods.contains(mod) && !mergedMods.contains(mod)) 19 | mergedMods.push_back(mod); 20 | } 21 | -------------------------------------------------------------------------------- /tile_paths.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "tile_info.h" 5 | 6 | class GameConfig; 7 | 8 | struct TilePaths { 9 | TilePaths(vector, vector mainMods); 10 | void merge(TilePaths); 11 | SERIALIZATION_CONSTRUCTOR(TilePaths) 12 | vector SERIAL(definitions); 13 | vector SERIAL(mainMods); 14 | vector SERIAL(mergedMods); 15 | SERIALIZE_ALL(definitions, mainMods, mergedMods) 16 | }; 17 | -------------------------------------------------------------------------------- /tribe_alignment.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "tribe_alignment.h" 3 | 4 | const char* getName(TribeAlignment alignment) { 5 | switch (alignment) { 6 | case TribeAlignment::EVIL: 7 | return "evil"; 8 | case TribeAlignment::LAWFUL: 9 | return "less evil"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tribe_alignment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(TribeAlignment, 6 | LAWFUL, 7 | EVIL 8 | ); 9 | 10 | extern const char* getName(TribeAlignment); 11 | -------------------------------------------------------------------------------- /tutorial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | class TutorialInfo; 6 | class Game; 7 | class GameConfig; 8 | class ContentFactory; 9 | 10 | class Tutorial { 11 | public: 12 | Tutorial(); 13 | void refreshInfo(const Game*, optional&) const; 14 | void continueTutorial(const Game*); 15 | void goBack(); 16 | EnumSet getHighlights(const Game*) const; 17 | bool blockAutoEquipment() const; 18 | 19 | static void createTutorial(Game&, const ContentFactory* factory); 20 | 21 | template 22 | void serialize(Archive& ar, const unsigned int); 23 | 24 | using State = TutorialState; 25 | State getState() const; 26 | 27 | private: 28 | string getMessage() const; 29 | bool canContinue(const Game*) const; 30 | 31 | State SERIAL(state); 32 | vector getHighlightedSquaresHigh(const Game*) const; 33 | vector getHighlightedSquaresLow(const Game*) const; 34 | void onNewState(const Game*); 35 | Vec2 SERIAL(entrance); 36 | }; 37 | -------------------------------------------------------------------------------- /tutorial_highlight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(TutorialHighlight, 6 | DIG_OR_CUT_TREES, 7 | RESOURCE_STORAGE, 8 | EQUIPMENT_STORAGE, 9 | WOOD_RESOURCE, 10 | ACCEPT_IMMIGRANT, 11 | BUILD_DOOR, 12 | TRAINING_ROOM, 13 | BUILD_BED, 14 | BUILD_LIBRARY, 15 | BUILD_TORCH, 16 | BUILD_FLOOR, 17 | BUILD_WORKSHOP, 18 | REMOVE_CONSTRUCTION, 19 | SCHEDULE_CLUB, 20 | EQUIPMENT_SLOT_WEAPON, 21 | NEW_TEAM, 22 | CONTROL_TEAM, 23 | LEAVE_CONTROL, 24 | FULL_CONTROL, 25 | MINIMAP_BUTTONS, 26 | RESEARCH, 27 | HELP_TAB 28 | ); 29 | 30 | -------------------------------------------------------------------------------- /tutorial_state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(TutorialState, 6 | WELCOME, 7 | INTRO, 8 | INTRO2, 9 | CUT_TREES, 10 | BUILD_STORAGE, 11 | CONTROLS1, 12 | CONTROLS2, 13 | GET_200_WOOD, 14 | DIG_ROOM, 15 | BUILD_DOOR, 16 | BUILD_LIBRARY, 17 | DIG_2_ROOMS, 18 | ACCEPT_IMMIGRANT, 19 | TORCHES, 20 | FLOORS, 21 | BUILD_WORKSHOP, 22 | SCHEDULE_WORKSHOP_ITEMS, 23 | ORDER_CRAFTING, 24 | EQUIP_WEAPON, 25 | ACCEPT_MORE_IMMIGRANTS, 26 | EQUIP_ALL_FIGHTERS, 27 | CREATE_TEAM, 28 | CONTROL_TEAM, 29 | CONTROL_MODE_MOVEMENT, 30 | FULL_CONTROL, 31 | DISCOVER_VILLAGE, 32 | KILL_VILLAGE, 33 | LOOT_VILLAGE, 34 | LEAVE_CONTROL, 35 | SUMMARY1, 36 | RESEARCH, 37 | HELP_TAB, 38 | MINIMAP_BUTTONS, 39 | SUMMARY2, 40 | FINISHED 41 | ); 42 | 43 | class TString; 44 | TString getMessage(TutorialState, bool controller); 45 | -------------------------------------------------------------------------------- /unknown_locations.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "unknown_locations.h" 3 | #include "level.h" 4 | 5 | 6 | void UnknownLocations::update(const vector& positions) { 7 | allLocations.clear(); 8 | locationsByLevel.clear(); 9 | for (auto pos : positions) { 10 | locationsByLevel[pos.getLevel()->getUniqueId()].push_back(pos.getCoord()); 11 | allLocations.insert(pos); 12 | } 13 | } 14 | 15 | bool UnknownLocations::contains(Position pos) const { 16 | return allLocations.count(pos); 17 | } 18 | 19 | const vector& UnknownLocations::getOnLevel(const Level* level) const { 20 | if (auto v = getReferenceMaybe(locationsByLevel, level->getUniqueId())) 21 | return *v; 22 | else { 23 | static vector empty; 24 | return empty; 25 | } 26 | } 27 | 28 | SERIALIZE_DEF(UnknownLocations, locationsByLevel, allLocations) 29 | -------------------------------------------------------------------------------- /unknown_locations.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position.h" 5 | 6 | class UnknownLocations { 7 | public: 8 | 9 | void update(const vector&); 10 | bool contains(Position) const; 11 | const vector& getOnLevel(const Level*) const; 12 | 13 | template 14 | void serialize(Archive&, const unsigned); 15 | 16 | private: 17 | 18 | map> SERIAL(locationsByLevel); 19 | PositionSet SERIAL(allLocations); 20 | }; 21 | -------------------------------------------------------------------------------- /unlocks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "file_path.h" 6 | #include "achievement_id.h" 7 | 8 | class Options; 9 | 10 | class Unlocks { 11 | public: 12 | Unlocks(Options*, FilePath); 13 | static Unlocks allUnlocked(); 14 | bool isUnlocked(UnlockId) const; 15 | void unlock(UnlockId); 16 | void achieve(AchievementId); 17 | bool isAchieved(AchievementId) const; 18 | 19 | private: 20 | Unlocks(); 21 | Options* options = nullptr; 22 | optional path; 23 | }; -------------------------------------------------------------------------------- /view_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "color.h" 5 | #include "content_id.h" 6 | 7 | class ViewId : public ContentId { 8 | public: 9 | explicit ViewId(InternalId); 10 | explicit ViewId(const char*, Color color = Color::WHITE); 11 | bool operator == (const ViewId&) const; 12 | bool operator != (const ViewId&) const; 13 | bool operator < (const ViewId&) const; 14 | int getHash() const; 15 | const Color& getColor() const; 16 | ViewId withColor(Color) const; 17 | SERIALIZATION_DECL(ViewId) 18 | 19 | private: 20 | Color color = Color::WHITE; 21 | }; 22 | 23 | using ViewIdList = vector; 24 | 25 | std::ostream& operator <<(std::ostream&, ViewId); 26 | -------------------------------------------------------------------------------- /view_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(ViewLayer, 6 | FLOOR_BACKGROUND, 7 | FLOOR, 8 | ITEM, 9 | TORCH1, 10 | CREATURE, 11 | STEED, 12 | TORCH2 13 | ); 14 | 15 | -------------------------------------------------------------------------------- /view_object_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM2(std::uint8_t, 6 | ViewObjectAction, 7 | LOCK_DOOR, 8 | UNLOCK_DOOR, 9 | WRITE_ON_BOARD, 10 | SWAP_POSITION, 11 | PUSH, 12 | ATTACK, 13 | PET, 14 | MOUNT, 15 | DISMOUNT, 16 | SKIP_TURN, 17 | CHAT, 18 | ORDER_CAPTURE, 19 | CANCEL_CAPTURE_ORDER, 20 | ADD_TO_TEAM, 21 | SWITCH_LEADER, 22 | REMOVE_FROM_TEAM, 23 | MOVE_NOW 24 | ); 25 | 26 | class TStringId; 27 | TStringId getText(ViewObjectAction); 28 | -------------------------------------------------------------------------------- /view_object_modifier.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM( 6 | ViewObjectModifier, 7 | PLAYER, 8 | HIDDEN, 9 | INVISIBLE, 10 | ILLUSION, 11 | PLANNED, 12 | STUNNED, 13 | LOCKED, 14 | TEAM_LEADER_HIGHLIGHT, 15 | TEAM_HIGHLIGHT, 16 | DRAW_MORALE, 17 | ROAD, 18 | NO_UP_MOVEMENT, 19 | REMEMBER, 20 | SPIRIT_DAMAGE, 21 | HOSTILE, 22 | AURA, 23 | INSUFFICIENT_LIGHT, 24 | CREATURE, 25 | FLYING, 26 | FURNITURE_CRACKS, 27 | HEALTH_BAR, 28 | CAPTURE_BAR, 29 | PLAYER_BLINK, 30 | FROZEN, 31 | BLOODY, 32 | UNPAID, 33 | TURNED_OFF, 34 | IMMOBILE, 35 | FLIPX, 36 | RIDER, 37 | DANGEROUS 38 | ); 39 | -------------------------------------------------------------------------------- /village_action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | enum class VillageAction { TRADE, PILLAGE }; 5 | 6 | -------------------------------------------------------------------------------- /villain_group.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class VillainGroup : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | -------------------------------------------------------------------------------- /villain_type.cpp: -------------------------------------------------------------------------------- 1 | #include "villain_type.h" 2 | #include "t_string.h" 3 | 4 | TStringId getName(VillainType type) { 5 | switch (type) { 6 | case VillainType::MAIN: return TStringId("VILLAIN_TYPE_MAIN"); 7 | case VillainType::LESSER: return TStringId("VILLAIN_TYPE_LESSER"); 8 | case VillainType::MINOR: return TStringId("VILLAIN_TYPE_MINOR"); 9 | case VillainType::RETIRED: return TStringId("VILLAIN_TYPE_RETIRED"); 10 | case VillainType::ALLY: return TStringId("VILLAIN_TYPE_ALLY"); 11 | case VillainType::NONE: return TStringId("VILLAIN_TYPE_OTHER"); 12 | case VillainType::PLAYER: return TStringId("VILLAIN_TYPE_PLAYER"); 13 | } 14 | } 15 | 16 | bool blocksInfluence(VillainType type) { 17 | switch (type) { 18 | case VillainType::MAIN: 19 | case VillainType::LESSER: 20 | return true; 21 | default: 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /villain_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(VillainType, 6 | MAIN, 7 | LESSER, 8 | MINOR, 9 | ALLY, 10 | PLAYER, 11 | NONE, 12 | RETIRED 13 | ); 14 | 15 | class TStringId; 16 | 17 | extern TStringId getName(VillainType); 18 | extern bool blocksInfluence(VillainType); -------------------------------------------------------------------------------- /visibility_map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "position_map.h" 5 | #include "unique_entity.h" 6 | #include "entity_map.h" 7 | 8 | class Creature; 9 | class Level; 10 | 11 | class VisibilityMap { 12 | public: 13 | void update(const Creature*, const vector& visibleTiles); 14 | void remove(const Creature*); 15 | void updateEyeball(Position); 16 | void removeEyeball(Position); 17 | void onVisibilityChanged(Position); 18 | bool isVisible(Position) const; 19 | 20 | template 21 | void serialize(Archive& ar, const unsigned int version); 22 | 23 | private: 24 | EntityMap> SERIAL(lastUpdates); 25 | PositionMap> SERIAL(eyeballs); 26 | PositionMap SERIAL(visibilityCount); 27 | void addPositions(const vector&); 28 | void removePositions(const vector&); 29 | }; 30 | 31 | 32 | -------------------------------------------------------------------------------- /vision.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "vision.h" 3 | #include "creature_attributes.h" 4 | #include "creature.h" 5 | 6 | SERIALIZE_DEF(Vision, id, nightVision) 7 | 8 | VisionId Vision::getId() const { 9 | return id; 10 | } 11 | 12 | constexpr int darkViewRadius = 5; 13 | 14 | bool Vision::canSeeAt(double light, double distance) const { 15 | return nightVision || light >= getDarknessVisionThreshold() || distance <= darkViewRadius; 16 | } 17 | 18 | void Vision::update(const Creature* c, GlobalTime time) { 19 | PROFILE; 20 | nightVision = c->isAffected(LastingEffect::NIGHT_VISION, time); 21 | if (c->isAffected(LastingEffect::ARCHER_VISION, time)) 22 | id = VisionId::ARCHER; 23 | else if (c->isAffected(LastingEffect::ELF_VISION, time) || c->isAffected(LastingEffect::FLYING, time)) 24 | id = VisionId::ELF; 25 | else 26 | id = VisionId::NORMAL; 27 | } 28 | 29 | double Vision::getDarknessVisionThreshold() { 30 | return 0.8; 31 | } 32 | -------------------------------------------------------------------------------- /vision_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | RICH_ENUM(VisionId, 6 | ELF, 7 | NORMAL, 8 | ARCHER 9 | ); 10 | -------------------------------------------------------------------------------- /warlord_controller.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "owner_pointer.h" 5 | 6 | extern PController getWarlordController(shared_ptr> team, shared_ptr> teamOrders); 7 | -------------------------------------------------------------------------------- /weapon_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "attack_type.h" 5 | #include "attr_type.h" 6 | #include "effect.h" 7 | #include "msg_type.h" 8 | #include "item_prefix.h" 9 | 10 | RICH_ENUM(AttackMsg, 11 | SWING, 12 | THRUST, 13 | WAVE, 14 | KICK, 15 | BITE, 16 | TOUCH, 17 | CLAW, 18 | SPELL, 19 | PUNCH 20 | ); 21 | 22 | struct WeaponInfo { 23 | bool SERIAL(twoHanded) = false; 24 | AttackType SERIAL(attackType) = AttackType::HIT; 25 | AttrType SERIAL(meleeAttackAttr) = AttrType("DAMAGE"); 26 | vector SERIAL(victimEffect); 27 | vector SERIAL(attackerEffect); 28 | AttackMsg SERIAL(attackMsg) = AttackMsg::SWING; 29 | bool SERIAL(itselfMessage) = false; 30 | SERIALIZE_ALL(OPTION(twoHanded), OPTION(attackType), OPTION(meleeAttackAttr), OPTION(victimEffect), OPTION(attackerEffect), OPTION(attackMsg), OPTION(itselfMessage)) 31 | }; 32 | -------------------------------------------------------------------------------- /win64_make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | make clean 6 | time make -f Makefile-win -j10 AMD64=true UNITY=true RELEASE=true OPT=true DEBUG=true STEAMWORKS=true PREFIX=~/Downloads/mxe/usr/bin/x86_64-w64-mingw32.shared- 7 | ls -l keeper.exe 8 | file keeper.exe 9 | mv keeper.exe ~/steam_content/windows/ 10 | 11 | -------------------------------------------------------------------------------- /windows_make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | make clean 6 | time make -f Makefile-win -j12 UNITY=true RELEASE=true OPT=true DEBUG=true STEAMWORKS=true PREFIX=~/Downloads/mxe/usr/bin/i686-w64-mingw32.shared.dw2- 7 | ls -l keeper.exe 8 | file keeper.exe 9 | mv keeper.exe ~/steam_content/win32/ 10 | 11 | -------------------------------------------------------------------------------- /workshop_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "workshop_item.h" 4 | #include "workshop_type.h" 5 | 6 | using WorkshopArray = map>; 7 | -------------------------------------------------------------------------------- /workshop_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "furniture_type.h" 4 | #include "attr_type.h" 5 | #include "item_prefix.h" 6 | #include "resource_id.h" 7 | #include "t_string.h" 8 | 9 | struct WorkshopInfo { 10 | FurnitureType SERIAL(furniture); 11 | TString SERIAL(name); 12 | TString SERIAL(verb) = TStringId("PRODUCES_VERB"); 13 | AttrType SERIAL(attr); 14 | HashMap SERIAL(minAttr); 15 | int getMinAttrFor(CollectiveResourceId id) const { 16 | return getValueMaybe(minAttr, id).value_or(1); 17 | } 18 | optional SERIAL(prefix); 19 | bool SERIAL(hideFromTech) = false; 20 | SERIALIZE_ALL(NAMED(furniture), NAMED(name), OPTION(verb), NAMED(attr), OPTION(minAttr), OPTION(prefix), OPTION(hideFromTech)) 21 | }; 22 | -------------------------------------------------------------------------------- /workshop_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "content_id.h" 5 | 6 | class WorkshopType : public ContentId { 7 | public: 8 | using ContentId::ContentId; 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /world_map_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "random_layout_id.h" 5 | #include "t_string.h" 6 | 7 | struct WorldMapInfo { 8 | TString SERIAL(name); 9 | RandomLayoutId SERIAL(layout); 10 | SERIALIZE_ALL(name, layout) 11 | }; -------------------------------------------------------------------------------- /z_level_info.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "z_level_info.h" 3 | 4 | 5 | optional chooseZLevel(RandomGen& random, const vector& levels, int depth) { 6 | vector available; 7 | vector weights; 8 | for (auto& l : levels) 9 | if (l.minDepth.value_or(-100) <= depth && l.maxDepth.value_or(1000000) >= depth) { 10 | if (l.guarantee) 11 | return l.type; 12 | available.push_back(l.type); 13 | weights.push_back(l.weight); 14 | } 15 | if (available.empty()) 16 | return none; 17 | return random.choose(available, weights); 18 | } 19 | -------------------------------------------------------------------------------- /zlevel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "util.h" 5 | #include "enemy_info.h" 6 | 7 | struct LevelMakerResult { 8 | PLevelMaker maker; 9 | vector enemies; 10 | }; 11 | 12 | LevelMakerResult getLevelMaker(RandomGen& random, ContentFactory* contentFactory, const vector& zLevelGroups, 13 | int depth, TribeId tribe, Vec2 size, EnemyAggressionLevel); 14 | 15 | LevelMakerResult getUpLevel(RandomGen& random, ContentFactory* contentFactory, int depth, Position, bool withEnemy); 16 | extern int getZLevelCombatExp(int depth); --------------------------------------------------------------------------------