/* ---------------------------------------------------------------------------- * Draws a resource. */ void resource::draw_mob(bitmap_effect_manager* effect_manager) { sprite* s_ptr = anim.get_cur_sprite(); if(!s_ptr) return; point draw_pos = get_sprite_center(s_ptr); point draw_size = get_sprite_dimensions(s_ptr); bitmap_effect_manager effects; add_sector_brightness_bitmap_effect(&effects); if(fsm.cur_state->id == RESOURCE_STATE_BEING_DELIVERED) { add_delivery_bitmap_effect( &effects, script_timer.get_ratio_left(), carrying_color_move ); } draw_bitmap_with_effects( s_ptr->bitmap, draw_pos, draw_size, angle + s_ptr->angle, &effects ); }
/* ---------------------------------------------------------------------------- * Draws a treasure. */ void treasure::draw() { sprite* s_ptr = anim.get_cur_sprite(); if(!s_ptr) return; float draw_x, draw_y; float draw_w, draw_h, scale; get_sprite_center(this, s_ptr, &draw_x, &draw_y); get_sprite_dimensions(this, s_ptr, &draw_w, &draw_h, &scale); float radius = type->radius * scale; bool being_delivered = false; ALLEGRO_COLOR extra_color; if(fsm.cur_state->id == TREASURE_STATE_BEING_DELIVERED) { //If it's being delivered, do some changes to the scale and coloring. being_delivered = true; if(script_timer.get_ratio_left() >= 0.5) { //First half of the sucking in process = interpolated coloring. extra_color = interpolate_color( script_timer.get_ratio_left(), 0.5, 1.0, carrying_color_move, al_map_rgb(0, 0, 0) ); } else { //Second half of the sucking in process = interpolated scaling. extra_color = carrying_color_move; radius *= (script_timer.get_ratio_left() * 2.0); } } draw_sprite( s_ptr->bitmap, draw_x, draw_y, radius * 2.0, -1, angle, map_gray(get_sprite_brightness(this)) ); if(being_delivered) { int old_op, old_src, old_dst, old_aop, old_asrc, old_adst; al_get_separate_blender( &old_op, &old_src, &old_dst, &old_aop, &old_asrc, &old_adst ); al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); draw_sprite( s_ptr->bitmap, draw_x, draw_y, radius * 2.0, -1, angle, extra_color ); al_set_separate_blender( old_op, old_src, old_dst, old_aop, old_asrc, old_adst ); } }
/* ---------------------------------------------------------------------------- * Draws a Pikmin, including its leaf/bud/flower, idle glow, etc. */ void pikmin::draw_mob(bitmap_effect_manager* effect_manager) { sprite* s_ptr = anim.get_cur_sprite(); if(!s_ptr) return; point draw_pos = get_sprite_center(s_ptr); point draw_size = get_sprite_dimensions(s_ptr); bool is_idle = fsm.cur_state->id == PIKMIN_STATE_IDLING || fsm.cur_state->id == PIKMIN_STATE_IDLING_H || fsm.cur_state->id == PIKMIN_STATE_SPROUT; bitmap_effect_manager effects; add_sector_brightness_bitmap_effect(&effects); add_status_bitmap_effects(&effects); if(is_idle) { bitmap_effect idle_effect; bitmap_effect_props idle_effect_props; idle_effect_props.glow_color = al_map_rgb(255, 255, 255); idle_effect.add_keyframe(0, idle_effect_props); effects.add_effect(idle_effect); } draw_bitmap_with_effects( s_ptr->bitmap, draw_pos, draw_size, angle + s_ptr->angle, &effects ); if(s_ptr->top_visible) { point top_pos; top_pos = rotate_point(s_ptr->top_pos, angle); draw_bitmap_with_effects( pik_type->bmp_top[maturity], pos + top_pos, s_ptr->top_size, angle + s_ptr->top_angle, &effects ); } if(is_idle) { draw_bitmap( bmp_idle_glow, pos, point(standard_pikmin_radius * 8, standard_pikmin_radius * 8), area_time_passed * IDLE_GLOW_SPIN_SPEED, type->main_color ); } float status_bmp_scale; ALLEGRO_BITMAP* status_bmp = get_status_bitmap(&status_bmp_scale); if(status_bmp) { draw_bitmap( status_bmp, pos, point(type->radius * 2 * status_bmp_scale, -1) ); } }