Debian Codegraph @

prboom2/src/dsda/hud_components/mobj_tracker.c

raw
1 //
2 // Copyright(C) 2022 by Ryan Krafnick
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 // DSDA Mobj Tracker HUD Component
16 //
17
18 #include "base.h"
19
20 #include "mobj_tracker.h"
21
22 void dsda_MobjTrackerHC(char* str, size_t max_size, int id, mobj_t* mobj) {
23 int health;
24
25 health = mobj->health;
26
27 if (mobj->thinker.function == P_RemoveThinkerDelayed)
28 health = 0;
29
30 snprintf(
31 str,
32 max_size,
33 "%sm %d: %d",
34 health > 0 ? dsda_TextColor(dsda_tc_exhud_mobj_alive) :
35 dsda_TextColor(dsda_tc_exhud_mobj_dead),
36 id, health
37 );
38 }