MCPcopy Create free account
hub / github.com/EasyRPG/Player / ShowBattleAnimation

Method ShowBattleAnimation

src/game_screen.cpp:360–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360int 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
389void Game_Screen::UpdateBattleAnimation() {
390 if (animation) {

Callers

nothing calls this directly

Calls 3

SetFrameMethod · 0.80
resetMethod · 0.45
GetFramesMethod · 0.45

Tested by

no test coverage detected