From 811056832dac494ac8d79f3c77da968a8bd22bb4 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 16 Jan 2025 14:22:23 +0000 Subject: [PATCH] add support to chapter saving --- objects/obj_creation/Create_0.gml | 7 +++++-- scripts/scr_buttons/scr_buttons.gml | 10 +++++----- scripts/scr_chapter_new/scr_chapter_new.gml | 10 ++++++++++ .../scr_creation_draw_slides.gml | 14 ++++++++++---- scripts/scr_save_chapter/scr_save_chapter.gml | 6 ++++++ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index a3983d53a..0a2ba5c44 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -187,14 +187,17 @@ buttons = { { str1 : "Secluded", font : fnt_40k_14b, + tooltip : "Your home system is logistically secluded with no major warp routes", }, { str1 : "Connected", - font : fnt_40k_14b + font : fnt_40k_14b, + tooltip : "Your home system is connected to the larger imperium and system by warp routes", }, { str1 : "Warp Hub", - font : fnt_40k_14b + font : fnt_40k_14b, + tooltip : "Your home system is in a very stable warp area, accessible by several warp lanes", }, ], "Home warp access"), home_planets : new radio_set([ diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index e28dc9bb9..d977b278b 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -235,12 +235,12 @@ function radio_set(options_array, title)constructor{ draw_text(x1, y1, title); var _prev_x = x1; - var prev_y = y1+string_height(title)+10; + var _prev_y = y1+string_height(title)+10; var items_on_row = 0; for (var i=0;ix2 ? prev_x:x2; - y2 = prev_y + _cur_opt.height; + x2 = _prev_x>x2 ? _prev_x:x2; + y2 = _prev_y + _cur_opt.height; if (max_width>0){ if (_prev_x - x1 > max_width){ _prev_x = x1; - prev_y += _cur_opt.height+y_gap; + _prev_y += _cur_opt.height+y_gap; items_on_row = 0; } } diff --git a/scripts/scr_chapter_new/scr_chapter_new.gml b/scripts/scr_chapter_new/scr_chapter_new.gml index cbe44ceab..36e12d6d2 100644 --- a/scripts/scr_chapter_new/scr_chapter_new.gml +++ b/scripts/scr_chapter_new/scr_chapter_new.gml @@ -24,6 +24,11 @@ function ChapterData() constructor { recruiting = "Death"; recruiting_name = global.name_generator.generate_star_name(); homeworld_rule = eHOMEWORLD_RULE.NONE; + home_spawn_loc = 0; + recruit_home_relationship = 0; + home_warp = 0; + home_planets = 0; + flagship_name = global.name_generator.generate_imperial_ship_name(); monastary_name = ""; advantages = array_create(9); @@ -308,6 +313,11 @@ function scr_chapter_new(argument0) { obj_creation.recruiting = chapter_object.recruiting; obj_creation.recruiting_name = chapter_object.recruiting_name; + obj_creation.buttons.home_spawn_loc_options.current_selection = chapter_object.home_spawn_loc ?? 0; + obj_creation.buttons.recruit_home_relationship.current_selection = chapter_object.recruit_home_relationship ?? 0; + obj_creation.buttons.home_warp.current_selection = chapter_object.home_warp ?? 0; + obj_creation.buttons.home_planets.current_selection= chapter_object.home_planets ??0; + obj_creation.aspirant_trial = trial_map(chapter_object.aspirant_trial); obj_creation.adv = chapter_object.advantages; obj_creation.dis = chapter_object.disadvantages; diff --git a/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml b/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml index 7b4f282eb..2234a8f2c 100644 --- a/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml +++ b/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml @@ -1013,22 +1013,28 @@ function draw_chapter_homeworld_select(){ } } else { draw_set_font(fnt_40k_30b); - var s_pawn_radio = buttons.home_spawn_loc_options; + var _spawn_radio = buttons.home_spawn_loc_options; + var _max_width = left_data_slate.width-100; _spawn_radio.x1 = 70; _spawn_radio.y1 = 60; + _spawn_radio.max_width = _max_width; _spawn_radio.draw(); var _warp_lanes_radio = buttons.home_warp; - warp_lanes_radio.update({ + _warp_lanes_radio.update({ x1 : 70, - y1 : spawn_radio.y2, + y1 : _spawn_radio.y2, + max_width : _max_width }); + _warp_lanes_radio.draw(); var _home_planets = buttons.home_planets _home_planets.update({ x1 : 70, y1 : _warp_lanes_radio.y2, - }); + max_width : _max_width + }); + _home_planets.draw(); } } diff --git a/scripts/scr_save_chapter/scr_save_chapter.gml b/scripts/scr_save_chapter/scr_save_chapter.gml index 481200a15..ea7152088 100644 --- a/scripts/scr_save_chapter/scr_save_chapter.gml +++ b/scripts/scr_save_chapter/scr_save_chapter.gml @@ -26,6 +26,11 @@ function scr_save_chapter(chapter_id){ chap.homeworld_rule = homeworld_rule; chap.recruiting = recruiting; chap.recruiting_exists = recruiting_exists; + chap.home_spawn_loc = buttons.home_spawn_loc_options.current_selection; + chap.recruit_home_relationship = buttons.recruit_home_relationship.current_selection; + chap.home_warp = buttons.home_warp.current_selection; + chap.home_planets = buttons.home_planets.current_selection; + chap.advantages = adv; chap.disadvantages = dis; chap.colors = { @@ -79,6 +84,7 @@ function scr_save_chapter(chapter_id){ split_scouts: load_to_ships[1], split_vets: load_to_ships[2], }; + chap.disposition = disposition; if(variable_instance_exists(self.id, "monastery_name")){ chap.monastary_name = monastery_name;