/* SPDX-License-Identifier: GPL-3.0-or-later */ /* Copyright (C) 2021 KikooDX */ #include "conf.h" #include "filepaths.h" #include "level.h" #include "particles.h" #include "player.h" #include "zxcolors.h" #include extern struct Level level; extern bopti_image_t bimg_burst; void player_draw(struct Player player) { /* set animation position */ struct Particle anim = player.anim; anim.x = player.x; anim.y = player.y; anim.x -= (anim.frame_width - PLAYER_WIDTH) / 2; anim.y -= (anim.texture->height - PLAYER_HEIGHT) / 2; /* draw animation */ particle_draw(anim); /* draw burst */ if (player.air_state == AirRising && player.jumps_left < AIR_JUMPS) dimage(player.x, player.y + PLAYER_HEIGHT, &bimg_burst); /* print level name * this shouldn't be in player code */ dprint_opt(DWIDTH - 4, DHEIGHT, ZX_WHITE, C_NONE, DTEXT_RIGHT, DTEXT_BOTTOM, "%s", level_names[level.id]); }