From 8bfa30e16a25cad9d984acff7a2fc717331a639b Mon Sep 17 00:00:00 2001 From: walter253 <130906143+walt253@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:08:35 +0100 Subject: [PATCH] Fixed custom creature animations on partial configs (#3670) --- src/config_creature.c | 11 +++++++++ src/config_creature.h | 1 + src/config_crtrmodel.c | 8 ------ src/dungeon_stats.c | 56 +++++++++++++++++++++--------------------- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/config_creature.c b/src/config_creature.c index aa80c0aace..9811a0fac4 100644 --- a/src/config_creature.c +++ b/src/config_creature.c @@ -375,6 +375,17 @@ void check_and_auto_fix_stats(void) SYNCDBG(9,"Finished"); } +void init_creature_model_graphics(void) +{ + for (int i = 0; i < CREATURE_TYPES_MAX; i++) + { + for (int k = 0; k < CREATURE_GRAPHICS_INSTANCES; k++) + { + game.conf.crtr_conf.creature_graphics[i][k] = -1; + } + } +} + TbBool is_creature_model_wildcard(ThingModel crmodel) { if((crmodel == CREATURE_ANY) || (crmodel == CREATURE_NOT_A_DIGGER) || (crmodel == CREATURE_DIGGER)) diff --git a/src/config_creature.h b/src/config_creature.h index cf0cafc576..66fd3f4bb6 100644 --- a/src/config_creature.h +++ b/src/config_creature.h @@ -278,6 +278,7 @@ struct CreatureStats *creature_stats_get(ThingModel crstat_idx); struct CreatureStats *creature_stats_get_from_thing(const struct Thing *thing); TbBool creature_stats_invalid(const struct CreatureStats *crstat); void check_and_auto_fix_stats(void); +void init_creature_model_graphics(void); const char *creature_code_name(ThingModel crmodel); long creature_model_id(const char * name); const char *creature_own_name(const struct Thing *creatng); diff --git a/src/config_crtrmodel.c b/src/config_crtrmodel.c index 9624f6e26b..63d3b89f6c 100644 --- a/src/config_crtrmodel.c +++ b/src/config_crtrmodel.c @@ -2201,14 +2201,6 @@ TbBool parse_creaturemodel_sprites_blocks(long crtr_model,char *buf,long len,con { int n; // Block name and parameter word store variables - // If the file can't be partial, then initialize block data - if ((flags & CnfLd_AcceptPartial) == 0) - { - for (n = 0; n < CREATURE_GRAPHICS_INSTANCES; n++) - { - set_creature_model_graphics(crtr_model, n, -1); - } - } // Find the block char block_buf[COMMAND_WORD_LEN]; sprintf(block_buf, "sprites"); diff --git a/src/dungeon_stats.c b/src/dungeon_stats.c index 134f2d266b..eba6306086 100644 --- a/src/dungeon_stats.c +++ b/src/dungeon_stats.c @@ -44,60 +44,60 @@ TbBool load_stats_files(void) SYNCDBG(8, "Starting"); TbBool result = true; clear_research_for_all_players(); + init_creature_model_graphics(); if (!load_creaturetypes_config(keeper_creaturetp_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_terrain_config(keeper_terrain_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_objects_config(keeper_objects_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_trapdoor_config(keeper_trapdoor_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_effects_config(keeper_effects_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_lenses_config(keeper_lenses_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_magic_config(keeper_magic_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_creaturestates_config(creature_states_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_playerstate_config(keeper_playerstates_file,CnfLd_ListOnly)) - result = false; + result = false; if (!load_terrain_config(keeper_terrain_file,CnfLd_Standard)) - result = false; + result = false; if (!load_objects_config(keeper_objects_file,CnfLd_Standard)) - result = false; + result = false; if (!load_trapdoor_config(keeper_trapdoor_file,CnfLd_Standard)) - result = false; + result = false; if (!load_effects_config(keeper_effects_file,CnfLd_Standard)) - result = false; + result = false; if (!load_lenses_config(keeper_lenses_file,CnfLd_Standard)) - result = false; + result = false; if (!load_magic_config(keeper_magic_file,CnfLd_Standard)) - result = false; + result = false; if (!load_creaturetypes_config(keeper_creaturetp_file,CnfLd_Standard)) - result = false; + result = false; if (!load_creaturestates_config(creature_states_file,CnfLd_Standard)) - result = false; - // note that rules file requires definitions of magic and creature types + result = false; + // Note that rules file requires definitions of magic and creature types. if (!load_rules_config(keeper_rules_file,CnfLd_Standard)) - result = false; + result = false; if (!load_slabset_config(keeper_slabset_file,CnfLd_Standard)) - result = false; + result = false; if (!load_textureanim_config(keeper_textureanim_file,CnfLd_Standard)) - result = false; + result = false; if (!load_powerhands_config(keeper_powerhands_file,CnfLd_Standard)) - result = false; + result = false; if (!load_spritecolors_config(keeper_spritecolors_file,CnfLd_Standard)) - result = false; + result = false; if (!load_cubes_config(CnfLd_Standard)) - result = false; + result = false; if (!load_playerstate_config(keeper_playerstates_file,CnfLd_Standard)) - result = false; - + result = false; for (int i = 1; i < game.conf.crtr_conf.model_count; i++) { - if (!load_creaturemodel_config(i,0)) - result = false; + if (!load_creaturemodel_config(i,0)) + result = false; } SYNCDBG(3,"Finished"); return result;