| 358 | } |
| 359 | |
| 360 | int Game_Screen::ShowBattleAnimation(int animation_id, int target_id, bool global, int start_frame) { |
| 361 | const lcf::rpg::Animation* anim = lcf::ReaderUtil::GetElement(lcf::Data::animations, animation_id); |
| 362 | if (!anim) { |
| 363 | Output::Warning("ShowBattleAnimation: Invalid battle animation ID {}", animation_id); |
| 364 | return 0; |
| 365 | } |
| 366 | |
| 367 | auto* chara = Game_Character::GetCharacter(target_id, target_id); |
| 368 | if (!chara) { |
| 369 | Output::Warning("ShowBattleAnimation: Invalid target event ID {}", target_id); |
| 370 | CancelBattleAnimation(); |
| 371 | return 0; |
| 372 | } |
| 373 | |
| 374 | data.battleanim_id = animation_id; |
| 375 | data.battleanim_target = target_id; |
| 376 | data.battleanim_global = global; |
| 377 | data.battleanim_active = true; |
| 378 | data.battleanim_frame = start_frame; |
| 379 | |
| 380 | animation.reset(new BattleAnimationMap(*anim, *chara, global)); |
| 381 | |
| 382 | if (start_frame) { |
| 383 | animation->SetFrame(start_frame); |
| 384 | } |
| 385 | |
| 386 | return animation->GetFrames(); |
| 387 | } |
| 388 | |
| 389 | void Game_Screen::UpdateBattleAnimation() { |
| 390 | if (animation) { |