| 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 Big Armor Text HUD Component |
| 16 |
// |
| 17 |
|
| 18 |
#include "base.h" |
| 19 |
|
| 20 |
#include "big_armor_text.h" |
| 21 |
|
| 22 |
typedef struct { |
| 23 |
dsda_patch_component_t component; |
| 24 |
} local_component_t; |
| 25 |
|
| 26 |
static local_component_t* local; |
| 27 |
|
| 28 |
static int patch_delta_x; |
| 29 |
|
| 30 |
static void dsda_DrawComponent(void) { |
| 31 |
player_t* player; |
| 32 |
int cm; |
| 33 |
int armor; |
| 34 |
|
| 35 |
player = &players[displayplayer]; |
| 36 |
|
| 37 |
if (hexen) { |
| 38 |
armor = dsda_HexenArmor(player); |
| 39 |
cm = dsda_TextCR(dsda_tc_stbar_armor_zero); |
| 40 |
} |
| 41 |
else { |
| 42 |
armor = player->armorpoints[ARMOR_ARMOR]; |
| 43 |
if (armor <= 0) |
| 44 |
cm = dsda_TextCR(dsda_tc_stbar_armor_zero); |
| 45 |
else if (player->armortype < 2) |
| 46 |
cm = dsda_TextCR(dsda_tc_stbar_armor_one); |
| 47 |
else |
| 48 |
cm = dsda_TextCR(dsda_tc_stbar_armor_two); |
| 49 |
} |
| 50 |
|
| 51 |
dsda_DrawBigNumber(local->component.x, local->component.y, patch_delta_x, 0, |
| 52 |
cm, local->component.vpt, 3, armor); |
| 53 |
} |
| 54 |
|
| 55 |
void dsda_InitBigArmorTextHC(int x_offset, int y_offset, int vpt, int* args, int arg_count, void** data) { |
| 56 |
*data = Z_Calloc(1, sizeof(local_component_t)); |
| 57 |
local = *data; |
| 58 |
|
| 59 |
if (heretic) |
| 60 |
patch_delta_x = 10; |
| 61 |
else if (hexen) |
| 62 |
patch_delta_x = 10; |
| 63 |
else |
| 64 |
patch_delta_x = 14; |
| 65 |
|
| 66 |
dsda_InitPatchHC(&local->component, x_offset, y_offset, vpt); |
| 67 |
} |
| 68 |
|
| 69 |
void dsda_UpdateBigArmorTextHC(void* data) { |
| 70 |
local = data; |
| 71 |
} |
| 72 |
|
| 73 |
void dsda_DrawBigArmorTextHC(void* data) { |
| 74 |
local = data; |
| 75 |
|
| 76 |
dsda_DrawComponent(); |
| 77 |
} |