Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
schombert committed Jul 21, 2024
1 parent 69710b1 commit 2f2a321
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 167 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ if(WIN32)
if(OPTIMIZE_MODE STREQUAL "On")
message(STATUS "Optimizing with PGO data")
target_compile_options(AliceCommon INTERFACE
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata)
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata)
target_link_options(AliceCommon INTERFACE /OPT:REF /OPT:ICF /LTCG -fprofile-instr-use=code.profdata)
elseif(PROFILE_MODE STREQUAL "On")
message(STATUS "Compiling for PGO instrumentation")
target_compile_options(AliceCommon INTERFACE
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate)
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate)
target_link_options(AliceCommon INTERFACE /DEBUG:FULL /OPT:REF /OPT:ICF /LTCG -fprofile-instr-generate)
else()
target_compile_options(AliceCommon INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion ParserGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(WIN32)

target_compile_options(ParserGenerator PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389
-Wno-missing-prototypes -Wno-unsafe-buffer-usage
-Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-switch-default
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od /RTC1>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>)
target_link_options(ParserGenerator PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion dependencies/DataContainerGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(DCONGENERATOR PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /wd4388 /wd4389 -Wno-unused-parameter -Wno-sign-compare -Wno-newline-eof -Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-shadow-uncaptured-local -Wno-unreachable-code-break
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /wd4388 /wd4389 -Wno-switch-default -Wno-unused-parameter -Wno-sign-compare -Wno-newline-eof -Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-shadow-uncaptured-local -Wno-unreachable-code-break
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>)
target_link_options(DCONGENERATOR PRIVATE
Expand Down
16 changes: 10 additions & 6 deletions src/gamestate/game_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void switch_scene(sys::state& state, scene_id ui_scene) {

switch(ui_scene) {
case scene_id::in_game_state_selector:
state.current_scene = state_wargoal_selector;
state.current_scene = state_wargoal_selector();

state.stored_map_mode = state.map_state.active_map_mode;
map_mode::set_map_mode(state, map_mode::mode::state_select);
Expand All @@ -43,31 +43,35 @@ void switch_scene(sys::state& state, scene_id ui_scene) {
map_mode::set_map_mode(state, state.stored_map_mode);
}

state.current_scene = basic_game;
state.current_scene = basic_game();

return;

case scene_id::in_game_military:
state.current_scene = battleplan_editor;
state.current_scene = battleplan_editor();

return;

case scene_id::end_screen:
state.current_scene = end_screen;
state.current_scene = end_screen();

return;

case scene_id::pick_nation:
state.current_scene = nation_picker;
state.current_scene = nation_picker();

return;

case scene_id::in_game_military_selector:
state.current_scene = battleplan_editor_add_army;
state.current_scene = battleplan_editor_add_army();

return;
case scene_id::count: // this should never happen
assert(false);
return;
}


}

void do_nothing_province_target(sys::state& state,
Expand Down
243 changes: 127 additions & 116 deletions src/gamestate/game_scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,146 +175,157 @@ struct scene_properties {
};


inline scene_properties nation_picker{
.id = scene_id::pick_nation,

.get_root = root_pick_nation,

.starting_scene = true,
.enforced_pause = true,
.overwrite_map_tooltip = true,
.is_lobby = true,
.game_in_progress = false,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = select_player_nation_from_selected_province,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = nation_picker_hotkeys,
.console_log = console_log_pick_nation,
.open_chat = open_chat_before_game,
.update_highlight_texture = highlight_player_nation,
};

inline scene_properties basic_game{
.id = scene_id::in_game_basic,

.get_root = root_game_basic,

.accept_events = true,

.rbutton_selected_units = selected_units_control,
.rbutton_province = open_diplomacy,
.allow_drag_selection = true,
.on_drag_start = start_dragging,
.drag_selection = select_units,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = in_game_hotkeys,
.console_log = console_log_other,
inline scene_properties nation_picker() {
return scene_properties{
.id = scene_id::pick_nation,

.get_root = root_pick_nation,

.starting_scene = true,
.enforced_pause = true,
.overwrite_map_tooltip = true,
.is_lobby = true,
.game_in_progress = false,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = select_player_nation_from_selected_province,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = nation_picker_hotkeys,
.console_log = console_log_pick_nation,
.open_chat = open_chat_before_game,
.update_highlight_texture = highlight_player_nation,
};
}

.render_ui = render_ui_ingame,
inline scene_properties basic_game() {
return scene_properties{
.id = scene_id::in_game_basic,

.recalculate_mouse_probe = recalculate_mouse_probe_basic,
.recalculate_tooltip_probe = recalculate_tooltip_probe_basic,
.get_root = root_game_basic,

.clean_up = clean_up_basic_game_scene,
.on_game_state_update = update_basic_game_scene,
.on_game_state_update_update_ui = update_ui_state_basic,
};
.accept_events = true,

inline scene_properties battleplan_editor{
.id = scene_id::in_game_military,
.rbutton_selected_units = selected_units_control,
.rbutton_province = open_diplomacy,
.allow_drag_selection = true,
.on_drag_start = start_dragging,
.drag_selection = select_units,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = in_game_hotkeys,
.console_log = console_log_other,

.get_root = root_game_battleplanner,
.render_ui = render_ui_ingame,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = military_screen_hotkeys,
.console_log = console_log_other,
.recalculate_mouse_probe = recalculate_mouse_probe_basic,
.recalculate_tooltip_probe = recalculate_tooltip_probe_basic,

.render_ui = render_ui_military,
.clean_up = clean_up_basic_game_scene,
.on_game_state_update = update_basic_game_scene,
.on_game_state_update_update_ui = update_ui_state_basic,
};
}

.recalculate_mouse_probe = recalculate_mouse_probe_military,
inline scene_properties battleplan_editor() { return scene_properties{
.id = scene_id::in_game_military,

.on_game_state_update = update_military_game_scene,
.update_highlight_texture = highlight_defensive_positions
};
.get_root = root_game_battleplanner,

inline scene_properties battleplan_editor_add_army{
.id = scene_id::in_game_military_selector,
.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = military_screen_hotkeys,
.console_log = console_log_other,

.get_root = root_game_battleplanner_add_army,
.render_ui = render_ui_military,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = true,
.on_drag_start = start_dragging,
.drag_selection = select_units,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = military_screen_hotkeys,
.console_log = console_log_other,
.recalculate_mouse_probe = recalculate_mouse_probe_military,

.render_ui = render_ui_selection_screen,
.on_game_state_update = update_military_game_scene,
.update_highlight_texture = highlight_defensive_positions
};
}

.recalculate_mouse_probe = recalculate_mouse_probe_units_and_details,
.recalculate_tooltip_probe = recalculate_tooltip_probe_units_and_details,
inline scene_properties battleplan_editor_add_army() {
return scene_properties{
.id = scene_id::in_game_military_selector,

.on_game_state_update = update_add_units_game_scene,
.on_game_state_update_update_ui = update_ui_unit_details,
.update_highlight_texture = highlight_defensive_positions
};
.get_root = root_game_battleplanner_add_army,

inline scene_properties state_wargoal_selector{
.id = scene_id::in_game_state_selector,
.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = true,
.on_drag_start = start_dragging,
.drag_selection = select_units,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = military_screen_hotkeys,
.console_log = console_log_other,

.get_root = root_game_wargoal_state_selection,
.render_ui = render_ui_selection_screen,

.borders = borders_granularity::state,
.recalculate_mouse_probe = recalculate_mouse_probe_units_and_details,
.recalculate_tooltip_probe = recalculate_tooltip_probe_units_and_details,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = select_wargoal_state_from_selected_province,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = state_selector_hotkeys,
.console_log = console_log_other
};
.on_game_state_update = update_add_units_game_scene,
.on_game_state_update_update_ui = update_ui_unit_details,
.update_highlight_texture = highlight_defensive_positions
};
}

inline scene_properties end_screen{
.id = scene_id::end_screen,
inline scene_properties state_wargoal_selector() {
return scene_properties{
.id = scene_id::in_game_state_selector,

.get_root = root_end_screen,
.get_root = root_game_wargoal_state_selection,

.final_scene = true,
.enforced_pause = true,
.based_on_map = false,
.game_in_progress = false,
.borders = borders_granularity::state,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_identity,
.handle_hotkeys = do_nothing_hotkeys,
.console_log = console_log_other,
.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = select_wargoal_state_from_selected_province,
.keycode_mapping = replace_keycodes_map_movement,
.handle_hotkeys = state_selector_hotkeys,
.console_log = console_log_other
};
}

.render_map = do_nothing,
.on_game_state_update = do_nothing,
};
inline scene_properties end_screen() {
return scene_properties{
.id = scene_id::end_screen,

.get_root = root_end_screen,

.final_scene = true,
.enforced_pause = true,
.based_on_map = false,
.game_in_progress = false,

.rbutton_selected_units = do_nothing_province_target,
.rbutton_province = do_nothing_province_target,
.allow_drag_selection = false,
.on_drag_start = do_nothing_screen,
.drag_selection = do_nothing_screen,
.lbutton_up = do_nothing,
.keycode_mapping = replace_keycodes_identity,
.handle_hotkeys = do_nothing_hotkeys,
.console_log = console_log_other,

.render_map = do_nothing,
.on_game_state_update = do_nothing,
};
}


}
Loading

0 comments on commit 2f2a321

Please sign in to comment.