Skip to content

Commit

Permalink
Refactor drawing functions to C99 standard (#169)
Browse files Browse the repository at this point in the history
* Update id_func.c

* Update r_draw.c

* Update am_map.c

* Drawing functions for Heretic

Let's go with drawing functions only for now.

* Drawing functions for Hexen

* Update id_func.c

* Proofreading for Doom

Could also use double consts here.

* Proofreading for Heretic

* Proofreading for Hexen

---------

Co-authored-by: pvictress <julia.nechaevskaya@live.com>
  • Loading branch information
pvictress and JNechaevsky authored Dec 23, 2024
1 parent d763a21 commit 203bcdb
Show file tree
Hide file tree
Showing 6 changed files with 1,250 additions and 2,123 deletions.
15 changes: 7 additions & 8 deletions src/doom/id_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ enum

static byte *ID_WidgetColor (const int i)
{
if (!widget_scheme)
{
return NULL;
}

static byte *player_colors[4];
static int plyr_indices[] = {widget_plyr1, widget_plyr2, widget_plyr3, widget_plyr4};

Expand All @@ -72,11 +77,6 @@ static byte *ID_WidgetColor (const int i)
player_colors[2] = cr[CR_BROWN];
player_colors[3] = cr[CR_RED];

if (!widget_scheme)
{
return NULL;
}

switch (widget_scheme)
{
case 1: // Inter
Expand Down Expand Up @@ -719,17 +719,16 @@ static byte *ID_HealthColor (const int val1, const int val2)

void ID_DrawTargetsHealth (void)
{
char str[16];
const player_t *player = &players[displayplayer];
byte *color;

if (player->targetsheathTics <= 0 || !player->targetsheath)
{
return; // No tics or target is dead, nothing to display.
}

char str[16];
snprintf(str, sizeof(str), "%d/%d", player->targetsheath, player->targetsmaxheath);
color = ID_HealthColor(player->targetsheath, player->targetsmaxheath);
byte *color = ID_HealthColor(player->targetsheath, player->targetsmaxheath);

switch (widget_health)
{
Expand Down
Loading

0 comments on commit 203bcdb

Please sign in to comment.