Skip to content

Commit

Permalink
*squash the two new Gondor lord troops between the heroes_begin/heroe…
Browse files Browse the repository at this point in the history
…s_end range by taking advantage of the existing dummy troop entry 'markers', and staying savegame-compatible in the process. Fix up some hardcoded loops in the module system by forcing them to use the actual constants, as they should. Fitting more troops in there is going to be even trickier, so think twice.
  • Loading branch information
Swyter committed Mar 26, 2017
1 parent 2299ac1 commit f3bed8d
Show file tree
Hide file tree
Showing 18 changed files with 201 additions and 194 deletions.
8 changes: 4 additions & 4 deletions ModuleSystem/ID/ID_troops.py
Expand Up @@ -527,7 +527,7 @@
trp_npc15 = 526
trp_npc16 = 527
trp_npc17 = 528
trp_kingdom_heroes_including_player_begin = 529
trp_knight_6_2 = 529
trp_gondor_lord = 530
trp_rohan_lord = 531
trp_isengard_lord = 532
Expand Down Expand Up @@ -611,7 +611,7 @@
trp_knight_5_7 = 610
trp_knight_5_11 = 611
trp_knight_5_12 = 612
trp_heroes_end = 613
trp_knight_6_1 = 613
trp_smith_mtirith = 614
trp_smith_pelargir = 615
trp_smith_linhir = 616
Expand Down Expand Up @@ -911,8 +911,8 @@
trp_black_shield_guard = 910
trp_dorwinion_spirit_leader = 911
trp_dorwinion_spirit = 912
trp_knight_6_1 = 913
trp_knight_6_2 = 914
trp_dummy_troop = 913
trp_dummy_troop_b = 914
trp_beorning_shield_bear = 915
trp_last = 916
trp_multiplayer_profile_troop_male = 917
Expand Down
14 changes: 7 additions & 7 deletions ModuleSystem/module_constants.py
Expand Up @@ -1033,19 +1033,19 @@
#secret_signs_begin = "str_secret_sign_1"
#secret_signs_end = countersigns_begin

kingdoms_begin = fac_gondor
kingdoms_begin = fac_gondor
kingdoms_begin_i = fac_gondor
kingdoms_end = fac_kingdoms_end
kingdoms_end_i = fac_kingdoms_end
kingdoms_end = fac_kingdoms_end
kingdoms_end_i = fac_kingdoms_end

kingdom_heroes_begin = trp_gondor_lord
kingdom_heroes_end = trp_heroes_end
kingdom_heroes_begin = trp_knight_6_2 # was: trp_gondor_lord
kingdom_heroes_end = trp_knight_6_1 + 1 # was: trp_heroes_end

heroes_begin = kingdom_heroes_begin
heroes_end = kingdom_heroes_end
heroes_end = kingdom_heroes_end

companions_begin = trp_npc1
companions_end = trp_kingdom_heroes_including_player_begin
companions_end = trp_npc17 + 1

soldiers_begin = trp_farmer
soldiers_end = trp_town_walker_1
Expand Down
12 changes: 8 additions & 4 deletions ModuleSystem/module_scripts.py
Expand Up @@ -13732,11 +13732,13 @@ def set_item_faction():
(try_end),
(assign, ":num_members", 0),
(str_store_string, s10, "@noone"),
(try_for_range_backwards, ":loop_var", "trp_kingdom_heroes_including_player_begin", kingdom_heroes_end),
(try_for_range_backwards, ":loop_var", kingdom_heroes_begin - 1, kingdom_heroes_end),
(assign, ":cur_troop", ":loop_var"),
(try_begin),
(eq, ":loop_var", "trp_kingdom_heroes_including_player_begin"),
(assign, ":cur_troop", "trp_player"),
#swy: this seems to add an additional initial dummy
# entry to the heroes range and replace that by the player. was hardcoded.
(eq, ":loop_var", kingdom_heroes_begin - 1),
(assign, ":cur_troop", "trp_player"),
(assign, ":troop_faction", "$players_kingdom"),
(else_try),
(store_troop_faction, ":troop_faction", ":cur_troop"),
Expand Down Expand Up @@ -19331,7 +19333,9 @@ def set_item_faction():
(faction_get_slot, ":local5", ":comp", slot_fcomp_kia),
(faction_get_slot, ":troop_comp", ":comp", slot_fcomp_troopid),
(eq, ":local5", 1),
(try_for_range, ":npc", "trp_npc1", "trp_heroes_end"),

#swy: both lists are contiguous, that's why this seems to work. was hardcoded
(try_for_range, ":npc", companions_begin, heroes_end),
(eq, ":troop_comp", ":npc"),
(assign, ":local8", ":local0"),
(val_add, ":local8", 5),
Expand Down
33 changes: 18 additions & 15 deletions ModuleSystem/module_troops.py
Expand Up @@ -2055,9 +2055,14 @@ def wp_melee(x):
str_17|agi_13|int_3|cha_3|level(8),wp(95),knows_riding_1|knows_athletics_3|knows_power_draw_2|knows_power_strike_2|knows_ironflesh_3|knows_pathfinding_2,0x00000009f50001c97ac16e65f3ecf7de00000000001cc7080000000000000000],
#NPC system changes end

["kingdom_heroes_including_player_begin","bug","_",tf_hero,0,0,fac_gondor,
[],
lord_attrib,0,0,0],

# <--- swy: heroes_begin --->

## Kham - New Gondor Lord
["knight_6_2","Golasgil","_",tf_hero| tf_gondor| tf_mounted| tfg_shield| tfg_armor| tfg_helm| tfg_horse| tfg_boots,0,0,fac_gondor,
[itm_gondor_lance, itm_pinnath_leader,itm_good_mace,itm_gondor_med_greaves,itm_gondor_hunter,itm_gon_tab_shield_c,itm_mail_mittens,itm_pelargir_helmet_light,],
attr_tier_5,wp_tier_5,gondor_skills_1|knows_trainer_7,0x0000000e800021465e856dd74321355600000000001c58a50000000000000000],

#governors (plural contains how player refers to the guy
["gondor_lord","Steward_Denethor","Steward",tf_hero| tf_mounted| tfg_shield| tfg_armor| tfg_helm| tfg_horse| tfg_boots,0,0,fac_gondor,
[itm_gondor_warhorse,itm_denethor_robe,itm_gondor_light_greaves,itm_mail_mittens,itm_gondor_leader_helm,itm_gondor_citadel_sword,],
Expand Down Expand Up @@ -2345,9 +2350,13 @@ def wp_melee(x):
[itm_saddle_horse,itm_dunland_armor_k,itm_dunland_armor_k,itm_dunland_wolfboots,itm_dunland_wolfboots,itm_evil_gauntlets_a,itm_dun_helm_e,itm_dun_berserker,itm_dun_shield_b,itm_dunland_javelin,],
attr_tier_6,wp_tier_6,knight_skills_1,0x0000000e3b00324305f858f1606bbfff00000000001f7ce80000000000000000],

["heroes_end","bug","_",tf_hero,0,0,fac_neutral,
[],
0,0,0,0x000000000008318101f390c515555594],
## Kham - New Gondor Lord
["knight_6_1","Dervorin","_",tf_hero| tf_gondor| tfg_shield| tfg_armor| tfg_helm| tfg_boots,0,0,fac_gondor,
[itm_lamedon_leader_surcoat_cloak,itm_loss_war_axe,itm_gondor_heavy_greaves,itm_gon_tab_shield_c,itm_mail_mittens,itm_gondorian_light_helm,itm_loss_throwing_axes],
attr_tier_5,wp_tier_5,gondor_skills_1|knows_power_throw_5|knows_shield_9,0x0000000340003004250c85a90f6868f500000000001ed96a0000000000000000],

# <--- swy: heroes_end --->

#Healers
#["morannon_healer","Okstuk_the_healer","_",tf_hero,scn_tld_morannon_castle|entry(5),0,fac_isengard,[itm_leather_gloves,itm_isen_uruk_light_a,itm_leather_boots],str_15|agi_5|int_4|cha_4|level(2),wp(20),knows_common,orc_face1],
#["minas_tirith_healer","Ioreth","_",tf_female|tf_hero,scn_town_1_castle|entry(5),0,fac_gondor,[itm_white_robe,itm_leather_boots],def_attrib|level(2),wp(20),knows_common,0x10500501d14886db69d699],
Expand Down Expand Up @@ -3234,15 +3243,9 @@ def wp_melee(x):
[(itm_dunland_armor_k,imod_poor),(itm_leather_gloves,imod_poor),itm_dunland_wolfboots,(itm_empty_head,imod_poor)],
def_attrib|level(45),wp(255),knows_common|knows_athletics_6|knows_power_strike_6|knows_ironflesh_6,0,0],

## Kham - New Gondor Lords

["knight_6_1","Dervorin","_",tf_hero| tf_gondor| tfg_shield| tfg_armor| tfg_helm| tfg_boots,0,0,fac_gondor,
[itm_lamedon_leader_surcoat_cloak,itm_loss_war_axe,itm_gondor_heavy_greaves,itm_gon_tab_shield_c,itm_mail_mittens,itm_gondorian_light_helm,itm_loss_throwing_axes],
attr_tier_5,wp_tier_5,gondor_skills_1|knows_power_throw_5|knows_shield_9,0x0000000340003004250c85a90f6868f500000000001ed96a0000000000000000],
["knight_6_2","Golasgil","_",tf_hero| tf_gondor| tf_mounted| tfg_shield| tfg_armor| tfg_helm| tfg_horse| tfg_boots,0,0,fac_gondor,
[itm_gondor_lance, itm_pinnath_leader,itm_good_mace,itm_gondor_med_greaves,itm_gondor_hunter,itm_gon_tab_shield_c,itm_mail_mittens,itm_pelargir_helmet_light,],
attr_tier_5,wp_tier_5,gondor_skills_1|knows_trainer_7,0x0000000e800021465e856dd74321355600000000001c58a50000000000000000],

["dummy_troop", "bug","_", tf_hero, 0, 0, fac_gondor, [], lord_attrib,0,0,0],
["dummy_troop_b","bug","_", tf_hero, 0, 0, fac_gondor, [], lord_attrib,0,0,0],

["beorning_shield_bear","Beorning_Shield_Bear","Beorning_Shield_Bears",tfg_gloves| tfg_shield| tfg_armor| tfg_boots,0,0,fac_beorn,
[itm_beorn_chief,itm_beorn_heavy,itm_leather_boots,itm_leather_gloves,itm_beorn_helmet,(itm_beorn_shield_reward,imod_reinforced), (itm_dwarf_sword_a,imod_fine), (itm_good_mace,imod_masterwork)],
attr_tier_6,wp_tier_6,knows_common|knows_athletics_6|knows_power_strike_5|knows_ironflesh_7|knows_shield_7,beorn_face1,beorn_face2],
Expand Down

0 comments on commit f3bed8d

Please sign in to comment.