/** * Create a new head animation object */ anim_instance* HudGaugeTalkingHead::createAnim(int anim_start_frame, anim* anim_data) { anim_play_struct aps; anim_play_init(&aps, anim_data, position[0] + Anim_offsets[0] + fl2i(HUD_offset_x), position[1] + Anim_offsets[1] + fl2i(HUD_offset_y), base_w, base_h); aps.start_at = anim_start_frame; // aps.color = &HUD_color_defaults[HUD_color_alpha]; aps.color = &HUD_config.clr[HUD_TALKING_HEAD]; // I'd much rather use gr_init_color and retrieve the colors from this object but no, aps.color just happens to be a pointer. // So, just give it the address from the player's HUD configuration. You win, aps.color. I'll take care of you next time. (Swifty) return anim_play(&aps); }
void fish_generate() { fish *f; int idx; if(!Fish_inited){ return; } // bogus anims if((Fish_left_anim == NULL) || (Fish_right_anim == NULL)){ return; } // find a free fish f = NULL; for(idx=0; idx<MAX_FISH; idx++){ if(!Fish[idx].swimming){ f = &Fish[idx]; } } // no fish left if(f == NULL){ return; } // left or right f->left = frand_range(0.0f, 1.0f) < 0.5f ? 0 : 1; // start location if(f->left){ f->x = gr_screen.max_w_unscaled_zoomed + frand_range(0.0f, 50.0f); } else { f->x = frand_range(0.0f, -50.0f) - FISH_ANIM_WIDTH; } f->y = frand_range(-40.0f, (float)gr_screen.max_h_unscaled_zoomed + 40.0f); // speed if(f->left){ f->x_speed = frand_range(-1.0f, -15.0f); } else { f->x_speed = frand_range(1.0f, 15.0f); } f->y_speed = frand_range(0.0f, 1.0f) < 0.5f ? frand_range(1.0f, 4.0f) : frand_range(-1.0f, -4.0f); // all fish start out offscreen f->onscreen = 0; // he's swimming f->swimming = 1; // anim instance anim_play_struct aps; if(f->left){ anim_play_init(&aps, Fish_left_anim, (int)f->x, (int)f->y); f->a = anim_play(&aps); // doh. cancel him if(f->a == NULL){ f->swimming = 0; } else { f->a->screen_id = GS_STATE_MAIN_MENU; f->a->looped = 1; f->a->framerate_independent = 1; } } else { anim_play_init(&aps, Fish_right_anim, (int)f->x, (int)f->y); f->a = anim_play(&aps); // doh. cancel him if(f->a == NULL){ f->swimming = 0; } else { f->a->screen_id = GS_STATE_MAIN_MENU; f->a->looped = 1; f->a->framerate_independent = 1; } } }