aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/Game')
-rw-r--r--game/src/Game/Autoload/SoundManager.gd3
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd177
-rw-r--r--game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc2
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd17
-rw-r--r--game/src/Game/GameSession/Topbar.gd2
-rw-r--r--game/src/Game/Model/XACLoader.gd4
-rw-r--r--game/src/Game/Model/XSMLoader.gd4
-rw-r--r--game/src/Game/MusicConductor/MusicConductor.gd18
10 files changed, 203 insertions, 28 deletions
diff --git a/game/src/Game/Autoload/SoundManager.gd b/game/src/Game/Autoload/SoundManager.gd
index 01562f8..520afb1 100644
--- a/game/src/Game/Autoload/SoundManager.gd
+++ b/game/src/Game/Autoload/SoundManager.gd
@@ -41,7 +41,7 @@ func play_effect_stream(sound : AudioStream, volume : float = 1.0) -> void:
func play_effect(sound : String) -> void:
play(sound, "SFX")
-
+
func play_effect_compat(sfx : String, fallback : AudioStream=null) -> void:
var sound:AudioStreamWAV = SoundSingleton.get_sound_stream(sfx)
var volume:float = SoundSingleton.get_sound_base_volume(sfx)
@@ -53,4 +53,3 @@ func play_effect_compat(sfx : String, fallback : AudioStream=null) -> void:
play_effect_stream(fallback)
else:
push_warning("Failed to find sound %s" % sfx)
-
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
index 021c9f2..45e91d3 100644
--- a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
@@ -203,7 +203,7 @@ func _update_info() -> void:
if _active:
if _gold_label:
- _gold_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal - (_incVal % 7), 1)
+ _gold_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal - (_incVal % 7), 1)
if _total_inc_label:
_total_inc_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(_incVal)
diff --git a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
index eb57387..b55d227 100644
--- a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
@@ -160,7 +160,7 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE
return OK
func _setup_province_list() -> void:
- if not _province_listbox:
+ if not _province_listbox:
_province_listbox = get_gui_listbox_from_nodepath(^"./country_pop/pop_province_list")
if not _province_listbox:
diff --git a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
index 97c3390..ed570da 100644
--- a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
@@ -4,6 +4,23 @@ var _active : bool = false
const _screen : NationManagement.Screen = NationManagement.Screen.TECHNOLOGY
+var _tech_defines : Dictionary = MenuSingleton.get_technology_menu_defines()
+var _tech_folders : PackedStringArray
+var _tech_areas : Array
+var _technologies : Array
+var _folder_tech_counts : PackedInt32Array
+
+var _tech_folder_buttons : Array
+var _tech_folder_progressbars : Array
+var _tech_folder_number_discovered_labels : Array
+var _selected_folder = 0
+
+var _tech_school : GUILabel
+var _tech_school_modifiers : GUIOverlappingElementsBox
+var _current_research_label : GUILabel
+var _current_research_cat_label : GUILabel
+var _current_research_progressbar : GUIProgressBar
+
func _ready() -> void:
GameSingleton.gamestate_updated.connect(_update_info)
@@ -11,6 +28,106 @@ func _ready() -> void:
add_gui_element("country_technology", "country_technology")
+ _tech_school = get_gui_label_from_nodepath(^"./country_technology/administration_type")
+ _tech_school_modifiers = get_gui_overlapping_elements_box_from_nodepath(^"./country_technology/school_bonus_icons")
+ if _tech_school_modifiers:
+ _tech_school_modifiers.set_gui_child_element_name("country_technology", "school_icon_window")
+
+ _current_research_label = get_gui_label_from_nodepath(^"./country_technology/research_progress_name")
+ _current_research_cat_label = get_gui_label_from_nodepath(^"./country_technology/research_progress_category")
+ _current_research_progressbar = get_gui_progress_bar_from_nodepath(^"./country_technology/research_progress")
+
+ _tech_folders = _tech_defines.get("tech_folders")
+ _tech_areas = _tech_defines.get("tech_areas")
+ _technologies = _tech_defines.get("technologies")
+ _folder_tech_counts = _tech_defines.get("folder_tech_count")
+ for i in range(_tech_folders.size()):
+ add_gui_element("country_technology", "folder_window")
+
+ var folder_node = get_node(^"./folder_window")
+ var root_node = get_node(^"./country_technology")
+
+ folder_node.reparent(root_node)
+ folder_node.name = _tech_folders[i] + "_folder"
+
+ var pos = GUINode.get_gui_position("country_technology", "folder_offset")
+ pos.x += folder_node.get_size().x * i
+ folder_node.set_position(pos)
+
+ var icon = GUINode.get_gui_icon_from_node(folder_node.get_node(^"./folder_icon"))
+ if icon:
+ icon.set_icon_index(i+1)
+
+ var title = GUINode.get_gui_label_from_node(folder_node.get_node(^"./folder_category"))
+ if title:
+ title.set_text(tr(_tech_folders[i]))
+
+ var button = GUINode.get_gui_icon_button_from_node(folder_node.get_node(^"./folder_button"))
+ var button_tooltip: String = tr("TECHNOLOGYVIEW_SHOW_FOLDER_TOOLTIP")
+ var button_dict: Dictionary = { "FOLDER" : _tech_folders[i] }
+ if button:
+ if i == 0:
+ button.set_icon_index(2)
+ button.pressed.connect( # change selected technology area
+ func() -> void:
+ _tech_folder_buttons[_selected_folder].set_icon_index(1)
+ for x in range(_tech_areas[_selected_folder].size()):
+ root_node.get_node("./" + _tech_areas[_selected_folder][x]).visible = false
+ _selected_folder = i
+ button.set_icon_index(2)
+ for x in range(_tech_areas[_selected_folder].size()):
+ root_node.get_node("./" + _tech_areas[_selected_folder][x]).visible = true
+ )
+ button.set_tooltip_string_and_substitution_dict(button_tooltip, button_dict)
+ _tech_folder_buttons.push_back(button)
+
+ var progressbar = GUINode.get_gui_progress_bar_from_node(folder_node.get_node(^"./folder_progress"))
+ if progressbar:
+ progressbar.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ _tech_folder_progressbars.push_back(progressbar)
+
+ var discovered = GUINode.get_gui_label_from_node(folder_node.get_node(^"folder_number_discovered"))
+ if discovered:
+ _tech_folder_number_discovered_labels.push_back(discovered)
+
+ # areas
+ var folder_areas : PackedStringArray = _tech_areas[i]
+ for area_index in range(folder_areas.size()):
+ add_gui_element("country_technology", "tech_group")
+
+ var area_node = get_node(^"./tech_group")
+
+ area_node.reparent(root_node)
+ area_node.name = folder_areas[area_index]
+ if i != 0:
+ area_node.set_visible(false)
+
+ pos = GUINode.get_gui_position("country_technology", "tech_group_offset")
+ pos.x += area_node.get_size().x * area_index
+ area_node.set_position(pos)
+
+ var area_title = GUINode.get_gui_label_from_node(area_node.get_node(^"./group_name"))
+ if area_title:
+ area_title.set_text(tr(folder_areas[area_index]))
+
+ # technologies
+ var area_technologies : PackedStringArray = _technologies[i][area_index]
+ for tech_index in range(area_technologies.size()):
+ add_gui_element("country_technology", "tech_window")
+
+ var tech_node = get_node(^"./tech_window")
+
+ tech_node.reparent(area_node)
+ tech_node.name = area_technologies[tech_index]
+
+ pos = GUINode.get_gui_position("country_technology", "tech_offset")
+ pos.y += tech_node.get_size().y * tech_index
+ tech_node.set_position(pos)
+
+ var tech_name = GUINode.get_gui_label_from_node(tech_node.get_node(^"./tech_name"))
+ if tech_name:
+ tech_name.set_text(tr(area_technologies[tech_index]))
+
var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_technology/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
@@ -28,7 +145,65 @@ func _on_update_active_nation_management_screen(active_screen : NationManagement
func _update_info() -> void:
if _active:
- # TODO - update UI state
+ var info : Dictionary = MenuSingleton.get_technology_menu_info()
+
+ if _tech_school:
+ _tech_school.set_text(info.get("tech_school"))
+
+ if _tech_school_modifiers:
+ var mod_values : PackedFloat32Array = info.get("tech_school_mod_values")
+ var mod_icons : PackedInt32Array = info.get("tech_school_mod_icons")
+ var mod_tooltips : PackedStringArray = info.get("tech_school_mod_tt")
+ var mod_count = mod_values.size()
+ _tech_school_modifiers.set_child_count(mod_count)
+ for i in range(mod_count):
+ var main_icon = get_gui_icon_from_nodepath("./country_technology/school_bonus_icons/school_icon_window_{x}/main_icon".format({"x": i}))
+ main_icon.set_icon_index(mod_icons[i])
+ main_icon.mouse_filter = Control.MOUSE_FILTER_PASS
+ main_icon.set_tooltip_string(mod_tooltips[i])
+ var plusminus_icon = get_gui_icon_from_nodepath("./country_technology/school_bonus_icons/school_icon_window_{x}/plusminus_icon".format({"x": i}))
+ plusminus_icon.set_icon_index(2 if mod_values[i] > 0 else 1)
+ plusminus_icon.mouse_filter = Control.MOUSE_FILTER_PASS
+ plusminus_icon.set_tooltip_string(mod_tooltips[i])
+
+ var current_research : String = info.get("current_research_tech")
+ if _current_research_label:
+ if current_research != "":
+ _current_research_label.set_text(tr(current_research))
+ else:
+ _current_research_label.set_text(tr("TECHNOLOGYVIEW_NO_RESEARCH"))
+
+ if _current_research_cat_label:
+ _current_research_cat_label.set_text(info.get("current_research_cat"))
+
+ if _current_research_progressbar:
+ if current_research != "":
+ _current_research_progressbar.set_tooltip_string_and_substitution_dict(tr("TECHNOLOGYVIEW_RESEARCH_TOOLTIP"), {"TECH": tr(current_research), "DATE": MenuSingleton.get_longform_date()})
+ else:
+ _current_research_progressbar.set_tooltip_string(tr("TECHNOLOGYVIEW_NO_RESEARCH_TOOLTIP"))
+
+ var researched_techs : PackedStringArray = info.get("researched_technologies")
+ for ix in range(_technologies.size()):
+ var folder_number_discovered = 0
+ for iy in range(_technologies[ix].size()):
+ for iz in range(_technologies[ix][iy].size()):
+ var tech_identifier = _technologies[ix][iy][iz]
+ var tech = get_gui_icon_button_from_nodepath("./country_technology/{y}/{z}/start_research".format({"y":_tech_areas[ix][iy], "z":tech_identifier}))
+ if tech:
+ if (researched_techs.has(tech_identifier)):
+ tech.set_icon_index(2)
+ folder_number_discovered += 1
+ elif current_research == tech_identifier:
+ tech.set_icon_index(1)
+ else:
+ tech.set_icon_index(4)
+ var label: GUILabel = _tech_folder_number_discovered_labels[ix]
+ if label:
+ label.set_text("{r}/{a}".format({"r":folder_number_discovered,"a":_folder_tech_counts[ix]}))
+ var progbar: GUIProgressBar = _tech_folder_progressbars[ix]
+ if progbar:
+ progbar.value = float(folder_number_discovered) / float(_folder_tech_counts[ix])
+
show()
else:
hide()
diff --git a/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc b/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc
index 1adcd95..acebdc6 100644
--- a/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc
+++ b/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc
@@ -13,7 +13,7 @@ uvec3 vec3_to_uvec3(vec3 v) {
// (u, v) -> (province index bottom byte, province index top byte, terrain index byte)
uvec3 read_uvec3(vec2 uv) {
uv *= province_shape_subdivisions;
- vec2 subdivision_coords = mod(floor(uv), province_shape_subdivisions);
+ vec2 subdivision_coords = mod(floor(uv), province_shape_subdivisions);
float idx = subdivision_coords.x + subdivision_coords.y * province_shape_subdivisions.x;
return vec3_to_uvec3(texture(province_shape_tex, vec3(uv, idx)).rgb);
}
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 66fd463..a9f0ae2 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -240,6 +240,10 @@ func _update_info() -> void:
const _province_info_controller_key : StringName = &"controller"
const _province_info_rgo_name_key : StringName = &"rgo_name"
const _province_info_rgo_icon_key : StringName = &"rgo_icon"
+ const _province_info_rgo_total_employees_key : StringName = &"rgo_total_employees"
+ const _province_info_rgo_employment_percentage_key : StringName = &"rgo_employment_percentage"
+ const _province_info_rgo_output_quantity_yesterday_key : StringName = &"rgo_output_quantity_yesterday"
+ const _province_info_rgo_revenue_yesterday_key : StringName = &"rgo_revenue_yesterday"
const _province_info_crime_name_key : StringName = &"crime_name"
const _province_info_crime_icon_key : StringName = &"crime_icon"
const _province_info_total_population_key : StringName = &"total_population"
@@ -305,22 +309,19 @@ func _update_info() -> void:
_rgo_icon.set_icon_index(_province_info.get(_province_info_rgo_icon_key, -1) + 2)
if _rgo_produced_label:
- # TODO - replace name with amount produced
- _rgo_produced_label.text = _province_info.get(_province_info_rgo_name_key, _province_info_rgo_name_key + _missing_suffix)
+ _rgo_produced_label.text = GUINode.float_to_string_dp(_province_info.get(_province_info_rgo_output_quantity_yesterday_key, 0), 3)
if _rgo_income_label:
- # TODO - add £ sign and replace placeholder with actual value
- _rgo_income_label.text = "%s¤" % GUINode.float_to_string_dp(12.34567, 3)
+ _rgo_income_label.text = "%s¤" % GUINode.float_to_string_dp(_province_info.get(_province_info_rgo_revenue_yesterday_key, 0), 3)
if _rgo_employment_percentage_icon:
- pass
+ _rgo_employment_percentage_icon.set_icon_index(int(_province_info.get(_province_info_rgo_employment_percentage_key, 0) / 10) + 1)
if _rgo_employment_population_label:
- # TODO - replace placeholder with actual value
- _rgo_employment_population_label.text = GUINode.int_to_string_suffixed(_province_info.get(_province_info_total_population_key, 0) / 10)
+ _rgo_employment_population_label.text = GUINode.int_to_string_suffixed(_province_info.get(_province_info_rgo_total_employees_key, 0))
if _rgo_employment_percentage_label:
- pass
+ _rgo_employment_percentage_label.text = "%d%%" % _province_info.get(_province_info_rgo_employment_percentage_key, 0)
if _crime_name_label:
_crime_name_label.text = _province_info.get(_province_info_crime_name_key, "")
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index 2f1fdbf..aecdced 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -570,7 +570,7 @@ func _update_speed_controls() -> void:
var paused : bool = MenuSingleton.is_paused()
var speed : int = MenuSingleton.get_speed()
- # TODO - decide whether to disable these or not
+ # TODO - decide whether to disable these or not
# (they don't appear to get disabled in the base game)
#if _speed_up_button:
# _speed_up_button.disabled = not MenuSingleton.can_increase_speed()
diff --git a/game/src/Game/Model/XACLoader.gd b/game/src/Game/Model/XACLoader.gd
index 6b12cf2..c16d1cd 100644
--- a/game/src/Game/Model/XACLoader.gd
+++ b/game/src/Game/Model/XACLoader.gd
@@ -197,13 +197,13 @@ static func _load_xac_model(source_file : String, is_unit : bool) -> Node3D:
break
skinning_chunk_ind += 1
if skinning_chunk_ind >= len(skinningChunks):
- skinning_chunk_ind = 1
+ skinning_chunk_ind = 1
applyVertexWeights = false
var meshInstance : MeshInstance3D = MeshInstance3D.new()
node.add_child(meshInstance)
meshInstance.owner = node
-
+
#stop the culling of units near the tops of screens
meshInstance.extra_cull_margin = EXTRA_CULL_MARGIN
diff --git a/game/src/Game/Model/XSMLoader.gd b/game/src/Game/Model/XSMLoader.gd
index bc85f9b..e1706ae 100644
--- a/game/src/Game/Model/XSMLoader.gd
+++ b/game/src/Game/Model/XSMLoader.gd
@@ -122,8 +122,8 @@ class MetadataChunk:
var unused : float
var fMaxAcceptableError : float
var fps : int # int32
- var exporterMajorVersion : int # byte
- var exporterMinorVersion : int # byte
+ var exporterMajorVersion : int # byte
+ var exporterMinorVersion : int # byte
var pad : int # 2x byte
var sourceApp : String
var origFileName : String
diff --git a/game/src/Game/MusicConductor/MusicConductor.gd b/game/src/Game/MusicConductor/MusicConductor.gd
index f7e3b2a..ade8fb4 100644
--- a/game/src/Game/MusicConductor/MusicConductor.gd
+++ b/game/src/Game/MusicConductor/MusicConductor.gd
@@ -34,7 +34,7 @@ func get_all_song_names() -> PackedStringArray:
for si : SongInfo in _available_songs:
songNames.append(si.song_name)
return songNames
-
+
func get_all_song_paths() -> PackedStringArray:
var songPaths : PackedStringArray = []
for si : SongInfo in _available_songs:
@@ -103,13 +103,13 @@ func setup_compat_song(file_name) -> void:
var metadata = MusicMetadata.new()
metadata.set_from_stream(stream)
var title = metadata.title
-
+
if title == "":
#use the file name without the extension if there's no metadata
title = file_name.split(".")[0]
song.init_stream(file_name,title,stream)
_available_songs.append(song)
-
+
func add_compat_songs() -> void:
for file_name : String in SoundSingleton.song_list:
setup_compat_song(file_name)
@@ -128,13 +128,13 @@ func add_ootb_music() -> void:
func generate_playlist() -> void:
var song_names = MusicConductor.get_all_song_paths()
var possible_indices = range(len(song_names)-1)
-
+
var title_index = song_names.find(SoundSingleton.title_theme)
possible_indices.remove_at(title_index)
-
+
var actual_playlist_len = min(preferred_playlist_len,len(possible_indices))
-
- #if the playlist size is too large or small, make it the same size as what we
+
+ #if the playlist size is too large or small, make it the same size as what we
#need to support
if len(playlist) != actual_playlist_len:
playlist.resize(actual_playlist_len)
@@ -143,14 +143,14 @@ func generate_playlist() -> void:
#The song we just played can be in the playlist, just not the first one
if last_played != -1:
possible_indices.remove_at(last_played)
-
+
#essentially shuffle-bag randomness, picking from a list of song indices
for i in range(actual_playlist_len):
var ind = randi_range(0,len(possible_indices)-1)
#add back the last song we just played as an option
if i==2:
possible_indices.append(last_played)
-
+
playlist[i] = possible_indices[ind]
possible_indices.remove_at(ind)