##script_cf_dplmc_troop_is_female
#
#This exists to make it easy to modify this to work with mods that redefine the troop types.
#See script_dplmc_store_troop_is_female
#
#INPUT: arg1: troop_no
#OUTPUT: none
("cf_dplmc_troop_is_female",
[
(store_script_param_1, ":troop_no"),
(assign, ":is_female", 0),
(ge, ":troop_no", 0),#Undefined behavior when the arguments are invalid.
(try_begin),
(eq, ":troop_no", active_npcs_including_player_begin),
(assign, ":troop_no", "trp_player"),
(try_end),
(troop_get_type, ":is_female", ":troop_no"),
#The following will make it so, for example, tf_undead does not appear to be female.
#Mods where this is relevant will likely want to tweak it, but this will work in at
#least one that I know of that has non-human lords.
(eq, ":is_female", tf_female),
]),
##script_dplmc_store_troop_is_female
#
#This exists to make it easy to modify this to work with mods that redefine the troop types.
#
#If you change this, remember to also change script_cf_dplmc_troop_is_female and
#script_dplmc_store_is_female_troop_1_troop_2
#
#INPUT: arg1: troop_no
#
#OUTPUT:
# reg0: 1 is yes, 0 is no
("dplmc_store_troop_is_female",
[
(store_script_param_1, ":troop_no"),
(try_begin),
(eq, ":troop_no", active_npcs_including_player_begin),
(assign, ":troop_no", "trp_player"),
(try_end),
(troop_get_type, reg0, ":troop_no"),
(try_begin),
(neq, reg0, 0),
(neq, reg0, 1),
(assign, reg0, 0),#e.g. this would apply to tf_undead
(try_end),
]),
("dplmc_store_troop_is_female_reg",
[
(store_script_param_1, ":troop_no"),
(store_script_param_2, ":reg_no"),
(troop_get_type, ":is_female", ":troop_no"),
#The following will make it so, for example, tf_undead does not appear to be female.
#Mods where this is relevant will likely want to tweak it, but this will work in at
#least one that I know of that has non-human lords.
(try_begin),
(neq, ":is_female", 0),
(neq, ":is_female", 1),
(assign, ":is_female", 0),
(try_end),
##Can asign to registers 0,1,2,3, 65, or 4
(try_begin),
(eq, ":reg_no", 4),
(assign, reg4, ":is_female"),
(else_try),
(eq, ":reg_no", 3),
(assign, reg3, ":is_female"),
(else_try),
(eq, ":reg_no", 2),
(assign, reg2, ":is_female"),
(else_try),
(eq, ":reg_no", 1),
(assign, reg1, ":is_female"),
(else_try),
(eq, ":reg_no", 0),
(assign, reg0, ":is_female"),
(else_try),
(eq, ":reg_no", 65),
(assign, reg65, ":is_female"),
(else_try),
##default to reg4
(assign, reg4, ":reg_no"),
(display_message, "@{!} ERROR: called script dplmc-store-troop-is-female-reg with bad argument {reg4}"),
(assign, reg4, ":is_female"),
(try_end),
]),
##script_dplmc_store_is_female_troop_1_troop_2
#
#This exists to make it easy to modify this to work with mods that redefine the troop types.
#See script_dplmc_store_troop_is_female
#
#INPUT:
# arg1: troop_1
# arg2: troop_2
#OUTPUT:
# reg0: 0 for not female, 1 for female
# reg1: 0 for not female, 1 for female
("dplmc_store_is_female_troop_1_troop_2",
[
(store_script_param_1, ":troop_1"),
(store_script_param_2, ":troop_2"),
(troop_get_type, ":is_female_1", ":troop_1"),
(troop_get_type, ":is_female_2", ":troop_2"),
#The following will make it so, for example, tf_undead does not appear to be female.
#Mods where this is relevant will likely want to tweak it, but this will work in at
#least one that I know of that has non-human lords.
(try_begin),
(neq, ":is_female_1", 0),
(neq, ":is_female_1", 1),
(assign, ":is_female_1", 0),
(try_end),
(try_begin),
(neq, ":is_female_2", 0),
(neq, ":is_female_2", 1),
(assign, ":is_female_2", 0),
(try_end),
(assign, reg0, ":is_female_1"),
(assign, reg1, ":is_female_2"),
]),