aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_life_bar.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-22 23:42:05 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-22 23:42:05 +0100
commit1e84a8792302f0446e8eb838f478b4a6564d1011 (patch)
tree1968ab8d402596dc710afa4cf70335687e64637b /src/ft_draw_life_bar.c
parentCleaner (diff)
download42-cub3d-1e84a8792302f0446e8eb838f478b4a6564d1011.tar.gz
42-cub3d-1e84a8792302f0446e8eb838f478b4a6564d1011.tar.bz2
42-cub3d-1e84a8792302f0446e8eb838f478b4a6564d1011.tar.xz
42-cub3d-1e84a8792302f0446e8eb838f478b4a6564d1011.tar.zst
42-cub3d-1e84a8792302f0446e8eb838f478b4a6564d1011.zip
I think we good
Diffstat (limited to 'src/ft_draw_life_bar.c')
-rw-r--r--src/ft_draw_life_bar.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c
index c2aa68f..955f20d 100644
--- a/src/ft_draw_life_bar.c
+++ b/src/ft_draw_life_bar.c
@@ -21,17 +21,17 @@ static void
cl->img.ptr[(x + (int16_t)((cl->mlist.map_w * scl) + 10)) * 4 +
(cl->img.sizeline * (y + cl->wlist.y_size - (cl->mlist.map_h * scl)
- - 10))] =
+ + 40))] =
(uint8_t)cl->tnum[id].ptr[cl->tnum[id].tex_x * 4 + 4 *
cl->tnum[id].img_w * cl->tnum[id].tex_y];
cl->img.ptr[(x + (int16_t)((cl->mlist.map_w * scl) + 10)) * 4 +
(cl->img.sizeline * (y + cl->wlist.y_size - (cl->mlist.map_h * scl)
- - 10)) + 1] =
+ + 40)) + 1] =
(uint8_t)cl->tnum[id].ptr[cl->tnum[id].tex_x * 4 + 4 *
cl->tnum[id].img_w * cl->tnum[id].tex_y + 1];
cl->img.ptr[(x + (int16_t)((cl->mlist.map_w * scl) + 10)) * 4 +
(cl->img.sizeline * (y + cl->wlist.y_size - (cl->mlist.map_h * scl)
- - 10)) + 2] =
+ + 40)) + 2] =
(uint8_t)cl->tnum[id].ptr[cl->tnum[id].tex_x * 4 + 4 *
cl->tnum[id].img_w * cl->tnum[id].tex_y + 2];
}
@@ -44,14 +44,14 @@ static void
int16_t x;
int16_t y;
- x_ratio = (int)(((cl->tnum[n - 48].img_w) << 16) / cl->w) + 1;
- y_ratio = (int)(((cl->tnum[n - 48].img_h) << 16) / cl->h) + 1;
+ x_ratio = (int)(((cl->tnum[n - 48].img_w) << 16) / cl->life_num_w) + 1;
+ y_ratio = (int)(((cl->tnum[n - 48].img_h) << 16) / cl->life_num_h) + 1;
y = 0;
- while (y < cl->h)
+ while (y < cl->life_num_h)
{
cl->tnum[n - 48].tex_y = ((y * y_ratio) >> 16);
x = 0;
- while (x < cl->w)
+ while (x < cl->life_num_w)
{
cl->tnum[n - 48].tex_x = ((x * x_ratio) >> 16);
if (cl->tnum[n - 48].ptr[cl->tnum[n - 48].tex_x * 4 + 4 *
@@ -94,7 +94,7 @@ static void
x = ((cl->mlist.map_w * scl) + 20) + (24 * scl) - ((24 * scl) / 4);
y = cl->wlist.y_size - (cl->mlist.map_h * scl) - 10;
- while (y < (int16_t)(cl->wlist.y_size - 10))
+ while (y < (int16_t)(cl->wlist.y_size - 50))
{
x = ((cl->mlist.map_w * scl) + 20) + (24 * scl) - ((24 * scl) / 4);
while (x < (int16_t)((cl->mlist.map_w * scl) + 10 + ((24 * scl))))
@@ -103,10 +103,10 @@ static void
}
y -= cl->wlist.y_size - (cl->mlist.map_h * scl) - 10;
x -= ((cl->mlist.map_w * scl) + 20) + (24 * scl) - ((24 * scl) / 4);
- y = (y == 0) ? (1) : (y);
- x = (x == 0) ? (1) : (x);
- cl->h = y;
- cl->w = x;
+ y = (y <= 0) ? (1) : (y);
+ x = (x <= 0) ? (1) : (x);
+ cl->life_num_h = y;
+ cl->life_num_w = x;
}
void