Skip to content

Commit

Permalink
Fixed custom creature animations on partial configs (dkfans#3670)
Browse files Browse the repository at this point in the history
  • Loading branch information
walt253 authored Nov 15, 2024
1 parent 60e38d5 commit 8bfa30e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 36 deletions.
11 changes: 11 additions & 0 deletions src/config_creature.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions src/config_creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions src/config_crtrmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
56 changes: 28 additions & 28 deletions src/dungeon_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8bfa30e

Please sign in to comment.