Slight teleporter optimisation, animation speed is full
This commit is contained in:
parent
7df1ed843c
commit
cde439072f
10
src/draw.c
10
src/draw.c
|
@ -27,7 +27,7 @@ extern image_t img_elevator; //elevator texture, 16x16
|
|||
void draw_anim(int x, int y, image_t *image, int step)
|
||||
{
|
||||
dsubimage(x + DRAW_OFFSET_X, y + DRAW_OFFSET_Y, image,
|
||||
((step / 2) % (image->width / 16)) * 16, 0, 16, 16, DIMAGE_NONE);
|
||||
(step % (image->width / 16)) * 16, 0, 16, 16, DIMAGE_NONE);
|
||||
}
|
||||
|
||||
void draw_player(int x, int y)
|
||||
|
@ -89,13 +89,13 @@ int *start_y, int tp_positions[])
|
|||
break;
|
||||
case 't': //teleporter 0
|
||||
draw_anim(x, y, &img_teleporter_0, step);
|
||||
tp_positions[0] = x + 2;
|
||||
tp_positions[1] = y + 2;
|
||||
tp_positions[0] = x;
|
||||
tp_positions[1] = y;
|
||||
break;
|
||||
case 'T': //teleporter 1
|
||||
draw_anim(x, y, &img_teleporter_1, step);
|
||||
tp_positions[2] = x + 2;
|
||||
tp_positions[3] = y + 2;
|
||||
tp_positions[2] = x;
|
||||
tp_positions[3] = y;
|
||||
break;
|
||||
}
|
||||
x += 16;
|
||||
|
|
|
@ -209,8 +209,8 @@ int main(void)
|
|||
{
|
||||
if (!tp_buffer)
|
||||
{
|
||||
player_x = tp_positions[2];
|
||||
player_y = tp_positions[3];
|
||||
player_x = tp_positions[2] + 2;
|
||||
player_y = tp_positions[3] + 2;
|
||||
}
|
||||
tp_buffer = 1;
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ int main(void)
|
|||
{
|
||||
if (!tp_buffer)
|
||||
{
|
||||
player_x = tp_positions[0];
|
||||
player_y = tp_positions[1];
|
||||
player_x = tp_positions[0] + 2;
|
||||
player_y = tp_positions[1] + 2;
|
||||
}
|
||||
tp_buffer = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue