From 8b3bc82dff3da3030d54f4fee529cd7bff55c6ad Mon Sep 17 00:00:00 2001 From: Loobinex Date: Sat, 16 Nov 2024 10:24:05 +0100 Subject: [PATCH] Renamed death states and used enums for animations --- src/power_hand.c | 2 +- src/spdigger_stack.c | 2 +- src/thing_corpses.c | 18 +++++++++--------- src/thing_corpses.h | 4 ++-- src/thing_creature.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/power_hand.c b/src/power_hand.c index 29bb6f8c60..aca5c7045f 100644 --- a/src/power_hand.c +++ b/src/power_hand.c @@ -1348,7 +1348,7 @@ TbBool place_thing_in_power_hand(struct Thing *thing, PlayerNumber plyr_idx) if (creature_affected_by_spell(thing, SplK_Chicken)) i = convert_td_iso(122); else - i = get_creature_anim(thing, 9); + i = get_creature_anim(thing, CGI_PowerGrab); set_thing_draw(thing, i, 256, -1, -1, 0, ODC_Default); } else if (thing_is_object(thing)) diff --git a/src/spdigger_stack.c b/src/spdigger_stack.c index 18f6cf2eb1..3d851ab7a6 100644 --- a/src/spdigger_stack.c +++ b/src/spdigger_stack.c @@ -1956,7 +1956,7 @@ int add_unclaimed_dead_bodies_to_imp_stack(struct Dungeon *dungeon, int max_task if ( (dungeon->digger_stack_length >= DIGGER_TASK_MAX_COUNT) || (remain_num <= 0) ) { break; } - if (!thing_is_dragged_or_pulled(thing) && (thing->active_state == DCrSt_RigorMortis) + if (!thing_is_dragged_or_pulled(thing) && (thing->active_state == DCrSt_Dead) && (!corpse_laid_to_rest(thing)) && corpse_is_rottable(thing)) { if (thing_revealed(thing, dungeon->owner)) diff --git a/src/thing_corpses.c b/src/thing_corpses.c index 4e6cd40184..ede5cc88d2 100644 --- a/src/thing_corpses.c +++ b/src/thing_corpses.c @@ -98,7 +98,7 @@ TbBool corpse_ready_for_collection(const struct Thing* thing) return false; if (thing_is_dragged_or_pulled(thing)) return false; - if (thing->active_state != DCrSt_RigorMortis) + if (thing->active_state != DCrSt_Dead) return false; return true; } @@ -224,7 +224,7 @@ TngUpdateRet update_dead_creature(struct Thing *thing) long corpse_age; if ((thing->alloc_flags & TAlF_IsDragged) == 0) { - if (thing->active_state == DCrSt_DramaticDying) + if (thing->active_state == DCrSt_Dying) { struct Coord3d pos; pos.x.val = thing->mappos.x.val; @@ -237,8 +237,8 @@ TngUpdateRet update_dead_creature(struct Thing *thing) if (thing->health > 0) thing->health--; if (thing->health <= 0) { - thing->active_state = DCrSt_RigorMortis; - long i = get_creature_anim(thing, 16); + thing->active_state = DCrSt_Dead; + long i = get_creature_anim(thing, CGI_DropDead); set_thing_draw(thing, i, 64, -1, 1, 0, ODC_Default); } } else @@ -466,14 +466,14 @@ struct Thing *create_dead_creature(const struct Coord3d *pos, ThingModel model, unsigned long k; switch (crpscondition) { - case DCrSt_RigorMortis: - thing->active_state = DCrSt_RigorMortis; - k = get_creature_anim(thing, 17); + case DCrSt_Dead: + thing->active_state = DCrSt_Dead; + k = get_creature_anim(thing, CGI_DeadSplat); set_thing_draw(thing, k, 256, game.conf.crtr_conf.sprite_size, 0, 0, ODC_Default); break; default: - thing->active_state = DCrSt_DramaticDying; - k = get_creature_anim(thing, 15); + thing->active_state = DCrSt_Dying; + k = get_creature_anim(thing, CGI_Scream); set_thing_draw(thing, k, 128, game.conf.crtr_conf.sprite_size, 0, 0, ODC_Default); thing->health = 3 * get_lifespan_of_animation(thing->anim_sprite, thing->anim_speed); play_creature_sound(thing, CrSnd_Die, 3, 0); diff --git a/src/thing_corpses.h b/src/thing_corpses.h index 16469f91a6..ddb6586c8b 100644 --- a/src/thing_corpses.h +++ b/src/thing_corpses.h @@ -35,8 +35,8 @@ struct Dungeon; enum DeadCreatureStates { DCrSt_Unused = 0, - DCrSt_DramaticDying, - DCrSt_RigorMortis, + DCrSt_Dying, + DCrSt_Dead, }; #pragma pack() diff --git a/src/thing_creature.c b/src/thing_creature.c index bf5abc237f..76b157e992 100644 --- a/src/thing_creature.c +++ b/src/thing_creature.c @@ -2493,7 +2493,7 @@ struct Thing* thing_death_normal(struct Thing *thing) memaccl.x.val = thing->veloc_base.x.val; memaccl.y.val = thing->veloc_base.y.val; memaccl.z.val = thing->veloc_base.z.val; - struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_DramaticDying); + struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_Dying); if (thing_is_invalid(deadtng)) { ERRORLOG("Cannot create dead thing"); @@ -2533,7 +2533,7 @@ struct Thing* thing_death_flesh_explosion(struct Thing *thing) pos.z.val = thing->mappos.z.val+i; create_effect(&pos, TngEff_Blood4, thing->owner); } - struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_RigorMortis); + struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_Dead); if (thing_is_invalid(deadtng)) { ERRORLOG("Cannot create dead thing"); @@ -2568,7 +2568,7 @@ struct Thing* thing_death_gas_and_flesh_explosion(struct Thing *thing) pos.y.val = thing->mappos.y.val; pos.z.val = thing->mappos.z.val+i; create_effect(&pos, TngEff_Gas3, thing->owner); - struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_RigorMortis); + struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_Dead); if (thing_is_invalid(deadtng)) { ERRORLOG("Cannot create dead thing"); @@ -2595,7 +2595,7 @@ struct Thing* thing_death_smoke_explosion(struct Thing *thing) pos.y.val = thing->mappos.y.val; pos.z.val = thing->mappos.z.val+i; create_effect(&pos, TngEff_HarmlessGas1, thing->owner); - struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_RigorMortis); + struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_Dead); if (thing_is_invalid(deadtng)) { ERRORLOG("Cannot create dead thing"); @@ -2629,7 +2629,7 @@ struct Thing* thing_death_ice_explosion(struct Thing *thing) pos.z.val = thing->mappos.z.val+i; create_effect(&pos, TngEff_DeathIceExplosion, thing->owner); } - struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_RigorMortis); + struct Thing* deadtng = destroy_creature_and_create_corpse(thing, DCrSt_Dead); if (thing_is_invalid(deadtng)) { ERRORLOG("Cannot create dead thing"); @@ -4296,7 +4296,7 @@ struct Thing *create_creature(struct Coord3d *pos, ThingModel model, PlayerNumbe cctrl->shot_shift_x = crstat->shot_shift_x; cctrl->shot_shift_y = crstat->shot_shift_y; cctrl->shot_shift_z = crstat->shot_shift_z; - long i = get_creature_anim(crtng, 0); + long i = get_creature_anim(crtng, CGI_Stand); set_thing_draw(crtng, i, 256, game.conf.crtr_conf.sprite_size, 0, 0, ODC_Default); cctrl->explevel = 1; crtng->health = crstat->health;