Skip to content

Commit ba7d802

Browse files
authored
feat: Full Livery options for companies (#653)
1 parent 7d8a47f commit ba7d802

File tree

20 files changed

+407
-75
lines changed

20 files changed

+407
-75
lines changed

ChapterMaster.yyp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@
10051005
{"id":{"name":"spr_data_slate_back","path":"sprites/spr_data_slate_back/spr_data_slate_back.yy",},},
10061006
{"id":{"name":"spr_data_slate_border","path":"sprites/spr_data_slate_border/spr_data_slate_border.yy",},},
10071007
{"id":{"name":"spr_data_slate","path":"sprites/spr_data_slate/spr_data_slate.yy",},},
1008+
{"id":{"name":"spr_death_watch_pauldron","path":"sprites/spr_death_watch_pauldron/spr_death_watch_pauldron.yy",},},
10081009
{"id":{"name":"spr_def_fortress","path":"sprites/spr_def_fortress/spr_def_fortress.yy",},},
10091010
{"id":{"name":"spr_def_mine","path":"sprites/spr_def_mine/spr_def_mine.yy",},},
10101011
{"id":{"name":"spr_def_platform","path":"sprites/spr_def_platform/spr_def_platform.yy",},},
@@ -1688,4 +1689,4 @@
16881689
"TextureGroups":[
16891690
{"$GMTextureGroup":"","%Name":"Default","autocrop":true,"border":2,"compressFormat":"bz2","customOptions":"","directory":"","groupParent":null,"isScaled":false,"loadType":"default","mipsToGenerate":0,"name":"Default","resourceType":"GMTextureGroup","resourceVersion":"2.0","targets":-1,},
16901691
],
1691-
}
1692+
}

datafiles/main/chapters/7.JSON

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,19 @@
231231
/** Add extra starting items ["Item Name", Number to add] */
232232
"full_liveries":[
233233
{ "left_pauldron" : [ "icon",{ "icon" : "ultramarines", "colour" : 34, "type" : 2 } ], "right_pauldron" : 34, "is_changed" : 1, "left_leg_lower" : 34, "left_leg_upper" : 34, "left_leg_knee" : 34, "right_leg_lower" : 34, "right_leg_upper" : 34, "right_leg_knee" : 34, "metallic_trim" : 12, "left_chest" : 34, "right_chest" : 34, "left_thorax" : 0, "right_thorax" : 0, "left_hand" : 34, "right_hand" : 34, "left_head" : 34, "right_head" : 34, "left_muzzle" : 34, "right_muzzle" : 34, "eye_lense" : 9, "right_backpack" : 34, "left_backpack" : 34, "weapon_primary" : 9, "weapon_secondary" : 9, "company_marks" : 0, "company_marks_loc" : 0, "left_arm" : 34, "right_arm" : 34, "left_trim" : 12, "right_trim" : 12 },
234+
],
235+
"company_liveries" : [
236+
{},
237+
{},
238+
{},
239+
{},
240+
{},
241+
{},
242+
{},
243+
{},
244+
{},
245+
{},
246+
{},
234247
],
235248
"extra_equipment": [
236249
// [

objects/obj_creation/Create_0.gml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* * obj_creation is used as part of the main menu new game and chapter creation logic
33
* It contains data and logic for setting up custom chapters as well as populating the new game menu with data for pre-existing chapters.
44
*/
@@ -113,6 +113,7 @@ use_chapter_object = false;
113113
livery_picker = new ColourItem(100,230);
114114
livery_picker.scr_unit_draw_data();
115115
full_liveries = "";
116+
company_liveries = "";
116117
complex_livery=false;
117118
complex_selection = "sgt";
118119
complex_depth_selection = 0;
@@ -303,20 +304,73 @@ buttons = {
303304
str1 : "Runic",
304305
font : fnt_40k_14b,
305306
},
306-
], "Chapter Visual Styles")
307+
], "Chapter Visual Styles"),
308+
company_options_toggle : new UnitButtonObject({
309+
tooltip : "toggle between chapter or role settings",
310+
label : "Company Settings",
311+
company_view : false,
312+
}),
313+
company_liveries_choice : new radio_set([
314+
{
315+
str1 : "HQ",
316+
font : fnt_40k_14b
317+
},
318+
{
319+
str1 : "I",
320+
font : fnt_40k_14b,
321+
},
322+
{
323+
str1 : "II",
324+
font : fnt_40k_14b
325+
},
326+
{
327+
str1 : "III",
328+
font : fnt_40k_14b
329+
},
330+
{
331+
str1 : "IV",
332+
font : fnt_40k_14b
333+
},
334+
{
335+
str1 : "V",
336+
font : fnt_40k_14b
337+
},
338+
{
339+
str1 : "VI",
340+
font : fnt_40k_14b
341+
},
342+
{
343+
str1 : "VII",
344+
font : fnt_40k_14b
345+
},
346+
{
347+
str1 : "VIII",
348+
font : fnt_40k_14b
349+
},
350+
{
351+
str1 : "IX",
352+
font : fnt_40k_14b
353+
},
354+
{
355+
str1 : "X",
356+
font : fnt_40k_14b
357+
},
358+
], "Companies"),
307359
}
308360

309361
with (buttons){
310362
home_spawn_loc_options.current_selection = 1;
311363
home_planets.current_selection = 1;
312364
home_warp.current_selection = 1;
313365
recruit_home_relationship.current_selection = 1;
366+
company_liveries_choice.current_selection = 1;
314367
}
315368

316369
text_bars = {
317-
battle_cry : new TextBarArea(920,118, 540),
370+
battle_cry : new TextBarArea(920,118, 450),
318371
admiral : new TextBarArea(890,685, 580,true),
319372
}
373+
320374
scrollbar_engaged=0;
321375

322376
text_selected="none";

objects/obj_creation/Step_0.gml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ if (array_length(col)>0){
234234
color_to_weapon = "";
235235
}
236236
}
237+
if (company_liveries == ""){
238+
livery_picker.scr_unit_draw_data(-1);
239+
company_liveries = array_create(11,variable_clone(livery_picker.map_colour));
240+
}
241+
237242
if (full_liveries == ""){
238243
var struct_cols = {
239244
main_color :main_color,

objects/obj_garbage_collector/Step_0.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ if (gc_timer > 0) {
22
gc_timer -= 1;
33
// show_debug_message($"obj_garbage_collector: gc_timer = {gc_timer}");
44
} else {
5-
gc_timer = 50; // Default is every frame, so de-facto 1;
5+
gc_timer = 25; // Default is every frame, so de-facto 1;
66
gc_collect();
77

88
wait_and_execute(0, function(){

objects/obj_ini/Create_0.gml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ serialize = function(){
147147
y,
148148
custom_advisors,
149149
full_liveries: full_liveries,
150+
company_liveries : company_liveries,
150151
complex_livery_data: complex_livery_data,
151152
squad_types: squad_types,
152153
artifact_struct: artifact_struct_trimmed,
@@ -170,7 +171,7 @@ serialize = function(){
170171
}
171172

172173
deserialize = function(save_data){
173-
var exclusions = ["complex_livery_data", "full_liveries", "squad_types", "marine_structs", "squad_structs"]; // skip automatic setting of certain vars, handle explicitly later
174+
var exclusions = ["complex_livery_data", "full_liveries","company_liveries", "squad_types", "marine_structs", "squad_structs"]; // skip automatic setting of certain vars, handle explicitly later
174175

175176
// Automatic var setting
176177
var all_names = struct_get_names(save_data);
@@ -199,6 +200,15 @@ deserialize = function(save_data){
199200
variable_struct_set(obj_ini, "full_liveries", array_create(21,variable_clone(livery_picker.map_colour)));
200201
}
201202

203+
livery_picker.scr_unit_draw_data(-1);
204+
if(struct_exists(save_data, "company_liveries")){
205+
variable_struct_set(obj_ini, "company_liveries", save_data.company_liveries)
206+
} else {
207+
variable_struct_set(obj_ini, "company_liveries", array_create(11,variable_clone(livery_picker.map_colour)));
208+
}
209+
210+
livery_picker.scr_unit_draw_data();
211+
202212
if(struct_exists(save_data, "complex_livery_data")){
203213
variable_struct_set(obj_ini, "complex_livery_data", save_data.complex_livery_data);
204214
}

scripts/scr_ComplexSet/scr_ComplexSet.gml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,15 @@ function ComplexSet(unit) constructor{
288288
continue;
289289
}
290290
}
291-
}
291+
}
292+
if (struct_exists(_mod, "chapter")){
293+
var chap_name = instance_exists(obj_creation) ?obj_creation.chapter_name : global.chapter_name;
294+
if (chap_name!=_mod.chapter){
295+
if (!check_exception("chapter")){
296+
continue;
297+
}
298+
}
299+
}
292300
var _overides = "none";
293301
if (struct_exists(_mod, "overides")){
294302
_overides = _mod.overides;

scripts/scr_buttons/scr_buttons.gml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ function radio_set(options_array, title)constructor{
437437
y_gap = 5;
438438
x1 = 0;
439439
y1 = 0;
440+
changed = false;
440441
max_width = 0;
441442
max_height = 0;
442443
for (var i=0;i<array_length(options_array);i++){
@@ -448,7 +449,8 @@ function radio_set(options_array, title)constructor{
448449
static update = item_data_updater;
449450
static draw = function(){
450451
draw_text(x1, y1, title);
451-
452+
changed = false;
453+
var _start_current_selection = current_selection;
452454
var _prev_x = x1;
453455
var _prev_y = y1+string_height(title)+10;
454456
var items_on_row = 0;
@@ -477,6 +479,9 @@ function radio_set(options_array, title)constructor{
477479
}
478480
}
479481
}
482+
if (_start_current_selection != current_selection){
483+
changed = true;
484+
}
480485
}
481486
}
482487

scripts/scr_chapter_new/scr_chapter_new.gml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function ChapterData() constructor {
3737
discipline = "librarius"; // todo convert to enum
3838

3939
full_liveries = "";
40+
company_liveries = "";
4041
complex_livery_data = complex_livery_default();
4142

4243

@@ -193,6 +194,8 @@ function scr_chapter_new(argument0) {
193194

194195
full_liveries = ""; // until chapter objects are in full use kicks off livery propogation
195196

197+
company_liveries = "";
198+
196199
// argument0 = chapter
197200
obj_creation.use_chapter_object = false; // for the new json testing
198201
var chapter_id = eCHAPTERS.UNKNOWN;
@@ -325,6 +328,7 @@ function scr_chapter_new(argument0) {
325328

326329
obj_creation.buttons.culture_styles.set(chapter_object.culture_styles);
327330
obj_creation.full_liveries = chapter_object.full_liveries;
331+
obj_creation.company_liveries = chapter_object.company_liveries;
328332
obj_creation.complex_livery_data = chapter_object.complex_livery_data;
329333
if (obj_creation.full_liveries!=""){
330334
obj_creation.livery_picker.map_colour = full_liveries[0];
@@ -380,9 +384,25 @@ function scr_chapter_new(argument0) {
380384
lens_color:lens_color,
381385
weapon_color:weapon_color
382386
}
387+
livery_picker = new ColourItem(100,230);
388+
if (company_liveries == ""){
389+
livery_picker.scr_unit_draw_data(-1);
390+
company_liveries = array_create(11,variable_clone(livery_picker.map_colour));
391+
} else {
392+
livery_picker.scr_unit_draw_data(-1);
393+
var _all_maps = struct_get_names(livery_picker.map_colour);
394+
for (var i=0;i<array_length(company_liveries);i++){
395+
var _comp_data = company_liveries[i];
396+
for (var s=0;s<array_length(_all_maps);s++){
397+
var _name = _all_maps[s];
398+
if !(struct_exists(_comp_data,_name )){
399+
_comp_data[$ _name] = livery_picker.map_colour[$ _name];
400+
}
401+
}
402+
}
403+
}
404+
livery_picker.scr_unit_draw_data();
383405
if (full_liveries==""){
384-
385-
livery_picker = new ColourItem(100,230);
386406
livery_picker.scr_unit_draw_data();
387407
livery_picker.set_default_armour(struct_cols,col_special);
388408
full_liveries = array_create(21,variable_clone(livery_picker.map_colour));

scripts/scr_chapter_random/scr_chapter_random.gml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ function scr_chapter_random(argument0) {
390390
weapon_color:weapon_color
391391
}
392392
obj_creation.livery_picker = new ColourItem(100,230);
393+
394+
obj_creation.livery_picker.scr_unit_draw_data(-1);
395+
obj_creation.company_liveries = array_create(11,variable_clone(obj_creation.livery_picker.map_colour));
396+
393397
obj_creation.livery_picker.scr_unit_draw_data();
394398
obj_creation.livery_picker.set_default_armour(struct_cols,col_special);
395399
obj_creation.full_liveries = array_create(21,variable_clone(obj_creation.livery_picker.map_colour));

0 commit comments

Comments
 (0)