Skip to content

Commit

Permalink
compiles and runs
Browse files Browse the repository at this point in the history
  • Loading branch information
OH296 committed Feb 21, 2025
1 parent f9a5016 commit 2242d92
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 98 deletions.
2 changes: 1 addition & 1 deletion objects/obj_mass_equip/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ if (refresh=true) and (obj_controller.settings>0){
have_armour_num+=scr_item_count("Power Armour");
have_armour_num+=scr_item_count("MK4 Maximus");
have_armour_num+=scr_item_count("MK5 Heresy");
have_armour_num+=scr_item_count("MK3 Iron");
have_armour_num+=scr_item_count("MK3 Iron Armour");
}
if (req_armour="Terminator Armour"){
have_armour_num+=scr_item_count("Terminator Armour");
Expand Down
185 changes: 102 additions & 83 deletions scripts/scr_ComplexSet/scr_ComplexSet.gml
Original file line number Diff line number Diff line change
Expand Up @@ -54,89 +54,95 @@ function ComplexSet(unit) constructor{
head : spr_mk7_head_variants,
};

_are_exceptions = false;
exceptions = [];
static check_exception = function(exception_key){
if (_are_exceptions){
var array_position = array_find_value(exceptions,exception_key);
if (array_position>-1){
array_delete(exceptions, array_position, 1);
if (array_length(exceptions)){
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}

static assign_modulars = function(){
var modulars = global.modular_drawing_items;
body_type = "normal";
if (unit.armour() = "Terminator Armour" || unit.armour() = "Tartaros"){
body_type = "terminator";
}
static _mod = {};
static has_key = function(key){
return struct_exists(_mod,key)
}
static _are_exceptions = false;

static check_exception = function(exception_key){
if (_are_exceptions){
var array_position = array_find_value(exceptions,exception_key);
if (array_position>-1){
array_delete(exceptions, array_position, 1);
if (array_length(exceptions)){
return true;
} else {
return false;
}
} else {
return false;
var _mod = {};


try{
for (var i=0; i<array_length(modulars);i++){

_are_exceptions = false;
_mod = modulars[i];
exceptions = [];
if (!array_contains(_mod.body_types, body_type)){
continue
}
} else {
return false;
}
}

for (var i=0; i<array_length(modular_drawing_items);i++){
_mod = modulars[i];
if (!array_contains(_mod.body_types, body_type)){
continue
}
if (has_key("allow_either")){
_are_exceptions = true;
exceptions = _mod.allow_either;
}
if (has_key("role_type")){
if (!unit.IsSpecialist(_mod.role_type)){
if (!check_exception("role_type")){
continue;
if (struct_exists(_mod, "allow_either")){
_are_exceptions = true;
exceptions = _mod.allow_either;
}
if (struct_exists(_mod, "role_type")){
if (!unit.IsSpecialist(_mod.role_type)){
if (!check_exception("role_type")){
continue;
}
}
}
if (struct_exists(_mod, "cultures")){
if (!scr_has_style(_mod.cultures)){
if (!check_exception("cultures")){
continue;
}
}
}
if (struct_exists(_mod, "body_types")){
if (!array_contains(_mod.body_types, body_type)){
if (!check_exception("body_types")){
continue;
}
}
}
if (struct_exists(_mod, "armours")){
if (!array_contains(_mod.armours, unit.armour())){
if (!check_exception("armours")){
continue;
}
}
}
if (struct_exists(_mod, "armours_exclude")){
if (array_contains(_mod.armours_exclude, unit.armour())){
if (!check_exception("armours_exclude")){
continue;
}
}
}
if (!struct_exists(_mod, "assign_by_rank")){
add_to_area(_mod.position, _mod.sprite)
} else {
add_relative_to_status(_mod.position, _mod.sprite, _mod.assign_by_rank);
}
}
if (has_key("cultures")){
if (!scr_has_style(_mod.cultures)){
if (!check_exception("cultures")){
continue;
}
}
}
if (has_key("body_types")){
if (_mod.body_types != body_type){
if (!check_exception("body_types")){
continue;
}
}
}
if (has_key("armours")){
if (!array_contains(_mod.armours, unit.armour())){
if (!check_exception("armours")){
continue;
}
}
}
if (has_key("armours_exclude")){
if (!array_contains(_mod.armours_exclude, unit.armour())){
if (!check_exception("armours_exclude")){
continue;
}
}
}
if (!has_key("assign_by_rank")){
add_to_area(_mod.position, _mod.sprite)
} else {
add_relative_to_status(_mod.position, _mod.sprite, _mod.assign_by_rank);
}
}
} except(_exception){}
}

variation_map = {
backpack : unit.get_body_data("backpack_variation","torso"),
armour : unit.get_body_data("armour_choice","torso"),
chest_variants : unit.get_body_data("chest_variation","torso"),
thorax_variants : unit.get_body_data("thorax_variation","torso"),
Expand All @@ -162,8 +168,11 @@ function ComplexSet(unit) constructor{

static draw_component = function(component_name){
if (struct_exists(self, component_name)){
var choice = variation_map[$component_name]%sprite_get_number(self[$component_name]);
draw_sprite(component_name,choice,x_surface_offset,y_surface_offset);
var _sprite = self[$component_name];
if (sprite_exists(_sprite)){
var choice = variation_map[$component_name]%sprite_get_number(_sprite);
draw_sprite(_sprite,choice ?? 0,x_surface_offset,y_surface_offset);
}
}
}
static draw = function(){
Expand All @@ -172,6 +181,7 @@ function ComplexSet(unit) constructor{
shader_set(full_livery_shader);

_draw_order = [
"backpack",
"armour",
"chest_variants",
"thorax_variants",
Expand All @@ -189,7 +199,7 @@ function ComplexSet(unit) constructor{
"tabbard",
"robe"
];
for (var i=0;i<array_length(draw_order);i++){
for (var i=0;i<array_length(_draw_order);i++){
if (_draw_order[i] == "head"){
draw_head(self, x_surface_offset,y_surface_offset);
} else {
Expand Down Expand Up @@ -244,7 +254,7 @@ function ComplexSet(unit) constructor{
head : spr_mk4_head_variants,
});
break;
case "MK3 Iron":
case "MK3 Iron Armour":
add_group({
armour : spr_mk3_complex,
backpack : spr_mk3_complex_backpack,
Expand All @@ -256,11 +266,11 @@ function ComplexSet(unit) constructor{
mouth_variants: spr_mk3_mouth,
forehead : spr_mk3_forehead_variants
});

break;
case "MK8 Errant":
add_group(mk7_bits);
add_to_area("gorget",spr_mk8_gorget);
break;
case "Terminator Armour":
add_group({
armour : spr_indomitus_complex,
Expand Down Expand Up @@ -289,8 +299,9 @@ function ComplexSet(unit) constructor{

});
break;
case defualt:
add_group(mk7_bits);
case defualt:
add_group(mk7_bits);
break;

}
assign_modulars();
Expand Down Expand Up @@ -406,7 +417,7 @@ function ComplexSet(unit) constructor{
shader_set(full_livery_shader);
}

static draw_head = function(unit, x_surface_offset,y_surface_offset){
static draw_head = function(unit){
var choice;
if (struct_exists(self, "head")){
draw_component("crest");
Expand Down Expand Up @@ -434,7 +445,7 @@ function ComplexSet(unit) constructor{
var _decoration_surface = surface_create(_surface_width, 60);
shader_reset();
surface_set_target(_head_surface);
draw_head(unit, 0, 0);
draw_head(unit);
surface_reset_target();

remove_area("mouth_variants");
Expand Down Expand Up @@ -576,6 +587,7 @@ global.modular_drawing_items = [
armours : ["Terminator Armour", "Tartaros"],
roles : [eROLE.Captain,eROLE.Champion],
position : "crown",
body_types :["terminator"],
},
{
sprite : spr_laurel,
Expand Down Expand Up @@ -645,21 +657,21 @@ global.modular_drawing_items = [
sprite : spr_mk3_mouth_flame_cult,
body_types :["normal"],
position : "mouth_variants",
armours : ["MK3 Iron"],
armours : ["MK3 Iron Armour"],
},
{
cultures : ["Prussian"],
sprite : spr_mk3_mouth_prussian,
body_types :["normal"],
position : "mouth_variants",
armours : ["MK3 Iron"],
armours : ["MK3 Iron Armour"],
},
{
cultures : ["Prussian"],
sprite : spr_mk6_mouth_prussian,
body_types :["normal"],
position : "mouth_variants",
armours : ["MK3 Iron"],
armours : ["MK3 Iron Armour"],
},
{
cultures : ["Prussian"],
Expand Down Expand Up @@ -701,7 +713,14 @@ global.modular_drawing_items = [
body_types :["normal"],
position : "chest_variants",
armours : ["MK6 Corvus"],
},
},
{
cultures : ["Knightly"],
sprite : spr_knightly_robes,
body_types :["normal"],
position : "robe",
assign_by_rank : 4,
},

]
var _vis_set_directory = working_directory + "main\\visual_sets";
Expand Down
15 changes: 1 addition & 14 deletions scripts/scr_draw_unit_image/scr_draw_unit_image.gml
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ function scr_draw_unit_image(_background=false){
specific_armour_sprite=armour_sprite;
armour_bypass=true;
}else{
var _complex_armours = ["MK3 Iron Armour", "MK4 Maximus","Terminator Armour","Tartaros","MK7 Aquila", "Power Armour", "MK8 Errant","Artificer Armour","MK3 Iron Armour", "MK4 Maximus", "MK5 Heresy"];
var _complex_armours = ["MK3 Iron Armour", "MK4 Maximus","Terminator Armour","Tartaros","MK7 Aquila", "Power Armour", "MK8 Errant","Artificer Armour", "MK4 Maximus", "MK5 Heresy", "MK6 Corvus"];
if (array_contains(_complex_armours, armour())){
complex_set = new ComplexSet(self);
complex_livery = true;
Expand Down Expand Up @@ -696,14 +696,6 @@ function scr_draw_unit_image(_background=false){
_backpack_index = 1;
}
}*/
if (complex_livery) && (struct_exists(complex_set, "backpack")){
var choice = get_body_data("backpack_variation","torso")%sprite_get_number(complex_set.backpack);
setup_complex_livery_shader(role(),self);
draw_sprite(complex_set.backpack,choice,x_surface_offset,y_surface_offset);
shader_set(sReplaceColor);
} else {
//draw_sprite(_backpack_sprite, 0, x_surface_offset, y_surface_offset);
}
}else{
if (back_equipment==BackType.Jump){
var color_variant = min(specialist_colours, 2);
Expand Down Expand Up @@ -742,9 +734,7 @@ function scr_draw_unit_image(_background=false){
}
}
}
if(!complex_livery){
draw_unit_arms(x_surface_offset, y_surface_offset, armour_type, specialist_colours, hide_bionics, complex_set);
}
if (armour_type == ArmourType.Normal && (!robes_bypass || !robes_hood_bypass)) {
var robe_offset_x = 0;
var robe_offset_y = 0;
Expand All @@ -762,9 +752,6 @@ function scr_draw_unit_image(_background=false){
if (struct_exists(body[$ "torso"],"robes") && !robes_bypass) {
if (body.torso.robes == 0){
complex_set.add_to_area("robe",spr_marine_robes);
if (scr_has_style("Knightly")){
complex_set.add_relative_to_status("robe", spr_knightly_robes, 4, get_body_data("tabbard_variation","torso"), self);
}
} else if (body.torso.robes == 1) {
if (scr_has_adv("Daemon Binders") && !modest_livery){
var _index = pauldron_trim == 1 ? 0 : 1;
Expand Down

0 comments on commit 2242d92

Please sign in to comment.