void actor_draw_shadow(Actor * self) { int f = self->walk_tick >> 2; if (f > 4) { f = 8 - f; } int d = round(self->angle * 8 / (2 * pi) - 2); d &= 7; LandImage * im = self->kind->shadows[d + f * 8]; int w = land_image_width(im); int h = land_image_height(im); land_image_draw_scaled(im, self->x - w / 2, self->y - h / 4 - h / 8, 1, 0.5); if (self->projectile) { land_image_draw(item_types[self->kind->projectile] ->shadows[d] , self->px, self->py - 16); } }
void overview_render(Overview * self) { land_clear(1, 1, 1, 1); float zoom = game->viewport->zoom * pow(2, self->zoom / 10.0); land_reset_transform(); land_translate(self->zoomx, self->zoomy); land_scale(zoom, zoom); #line 115 float w = 960; for (int i = 1; i < 50; i += 1) { int x, z; game_level_number_to_xz(i, & x, & z); float sx, sy; project(game->viewport, (x - 3) * 128, 0, (z - 3) * 128, & sx, & sy); #line 122 int j = i; if (i == game->swap_level) { j = self->selected; } #line 125 else if (i == self->selected) { if (game->swap_level) { j = game->swap_level; sx = self->mx; sy = self->my; } } #line 131 if (self->screenshot [j]) { float iw = land_image_width(self->screenshot [j]); #line 134 land_image_draw_scaled(self->screenshot [j], sx, sy, w / 9 / iw, w / 9 / iw); } if (i == self->selected) { land_premul(1, 0, 0, 0.5); #line 139 float s = w / 18; sy += 5 /* the floor is not centered, so add a slight offset */; #line 142 float xy [8] = {sx, sy - s / 2, sx + s, sy, sx, sy + s / 2, sx - s, sy}; land_filled_polygon(4, xy); } } }
void actor_draw(Actor * self) { int f = self->walk_tick >> 2; if (f > 4) { f = 8 - f; } int d = round(self->angle * 8 / (2 * pi) - 2); d &= 7; LandImage * im = self->kind->images[d + f * 8]; int w = land_image_width(im); int h = land_image_height(im); if (self->dead) { int y = self->anim_tick * h / 120; land_image_draw_partial(im, self->x - w / 2, self->y - h + y, 0, 0, w, h - y); } else { land_image_draw(im, self->x - w / 2, self->y - h); } if (self->selected) { land_color(1, 1, 0, 1); land_rectangle(self->x - w / 2, self->y - h, self->x + w / 2, self->y); } if (self->projectile) { land_image_draw(item_types[self->kind->projectile] ->images[d] , self->px, self->py - 32); } float hp = self->hp / self->max_hp; if (hp > 0.8) { land_color(0, 1, 0, 1); } else if(hp > 0.5) { land_color(1, 1, 0, 1); } else if(hp > 0.2) { land_color(1, 0, 0, 1); } else { land_color(1, 1, 1, 1); } hp *= w; land_filled_rectangle(self->x - w / 2, self->y - h - 5, self->x - w / 2 + hp, self->y - h - 2); }