diff --git a/examples/mods/aim1_community_fix/my_mod.cpp b/examples/mods/aim1_community_fix/my_mod.cpp index d8dcabf..eb41774 100644 --- a/examples/mods/aim1_community_fix/my_mod.cpp +++ b/examples/mods/aim1_community_fix/my_mod.cpp @@ -255,6 +255,9 @@ int main(int argc, char *argv[]) { mod.copy_weapon_from_aim2("GUN_GRAVITON"); after = mod.add_map_good("location1.mmo", "B_L1_BASE1", after, mmo_storage2::map_good("GUN_GRAVITON")); + // + mod.replace("under.scr", "_ADDSENSOR(T_L4_BASE_2)", "_ADDSENSOR(T_L4_BASE_2 )\n_MARK(T_L4_BASE_2)"); + // does not work, crashes. Maybe different item size // or maybe too many goods /*for (auto after = "EQP_POLYMER_ARMOR_S1"s; auto &&[n, _] : db["Оборудование"]) { diff --git a/src/aim1_mod_maker/aim1_mod_maker.h b/src/aim1_mod_maker/aim1_mod_maker.h index 71287f7..29c9815 100644 --- a/src/aim1_mod_maker/aim1_mod_maker.h +++ b/src/aim1_mod_maker/aim1_mod_maker.h @@ -601,16 +601,21 @@ struct mod_maker { quest().copy_from_aim2("INFORMATION", object); auto &db_ = this->db(); auto &gun = db_["Оружие"][object]; - auto copy_if_not = [&](auto &&table, auto &&field) { - if (!db_[table].contains(gun[field])) { - db_.copy_from_aim2(table, gun[field]); - } - }; - copy_explosion_from_aim2(gun["EXPLO"]); - copy_from_aim2(gun["FXMODEL"]); - copy_from_aim2(gun["FXMODEL2"]); - copy_sound_from_aim2(gun["IDSOUND"]); - copy_sound_from_aim2(gun["IDSOUNDEND"], true); + if (gun.contains("EXPLO")) { + copy_explosion_from_aim2(gun["EXPLO"]); + } + if (gun.contains("FXMODEL")) { + copy_from_aim2(gun["FXMODEL"]); + } + if (gun.contains("FXMODEL2")) { + copy_from_aim2(gun["FXMODEL2"]); + } + if (gun.contains("IDSOUND")) { + copy_sound_from_aim2(gun["IDSOUND"]); + } + if (gun.contains("IDSOUNDEND")) { + copy_sound_from_aim2(gun["IDSOUNDEND"], true); + } if (gun.contains("MISSILE") && !gun["MISSILE"].empty()) { copy_missile_from_aim2(gun["MISSILE"]); } diff --git a/src/common/mmo2.h b/src/common/mmo2.h index 879e696..b5174a9 100644 --- a/src/common/mmo2.h +++ b/src/common/mmo2.h @@ -67,9 +67,11 @@ struct mmo_storage2 { // mech_groups { sections.mech_groups.offset = s.p - f.p; - uint32_t n_mechs = s; + uint32_t n_mech_groups = s; + // two ints + // and ten more ints? s.skip(0x30); - while (n_mechs--) { + while (n_mech_groups--) { mech_group o = s; switch (o.type) { @@ -94,7 +96,7 @@ struct mmo_storage2 { while (o.n_mechs--) { struct mech { - char name[0x20]; + char cfg_name[0x20]; }; mech m = s; }