Skip to content

Commit 6c4f525

Browse files
committed
fixed broken pregame cutscene
1 parent 3556c7b commit 6c4f525

File tree

2 files changed

+47
-16
lines changed

2 files changed

+47
-16
lines changed

src/cutscene.rs

+47-12
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ fn play_cutscene(
407407
bulls: Query<Entity, With<bull::Bull>>,
408408
// mut ingame_ui_textbox: ResMut<ingame_ui::TextBox>,
409409
mut audio: GameAudio,
410+
text_container: Query<&Children, With<CutsceneTextContainerMarker>>,
410411
) {
411412
let mut camera = camera.single_mut();
412413
// println!("{:?} {:?}", camera.translation, camera.rotation.to_axis_angle());
@@ -619,10 +620,44 @@ fn play_cutscene(
619620
game_script::GameScript::PreLevelOneCutscene => {
620621
match cutscene_state.cutscene_index {
621622
0 => {
623+
cutscene_state.target_camera_translation = Some(Vec3::new(6.8157444, 30.6143255, -2.526128));
624+
cutscene_state.target_camera_rotation = None;
625+
camera.translation = Vec3::new(0.0, 0.0, 0.0);
626+
camera.rotation = Quat::from_axis_angle(Vec3::new(-0.051877804, 0.9947759, 0.08791898), 2.080009);
627+
628+
cutscene_state.input_cooldown = 0.5;
629+
cutscene_state.waiting_on_input = false;
630+
cutscene_state.cutscene_index += 1;
631+
// clear out existing text
632+
for children in text_container.iter() {
633+
for entity in children.iter() {
634+
commands.get_or_spawn(*entity).despawn_recursive();
635+
}
636+
}
637+
},
638+
1 => {
622639
cutscene_state.target_camera_translation = None;
623640
cutscene_state.target_camera_rotation = None;
624641
camera.translation = Vec3::new(6.8157444, 30.6143255, -2.526128);
625642
camera.rotation = Quat::from_axis_angle(Vec3::new(-0.051877804, 0.9947759, 0.08791898), 2.080009);
643+
644+
for entity in &players {
645+
println!("setting player animation");
646+
let mut animation = animations.get_mut(entity).unwrap();
647+
animation.play(game_assets.matador_run.clone_weak()).repeat();
648+
animation.set_speed(4.0);
649+
}
650+
651+
for entity in &bulls {
652+
println!("setting bull animation");
653+
let mut animation = animations.get_mut(entity).unwrap();
654+
animation.play(game_assets.bull_run.clone_weak()).repeat();
655+
animation.set_speed(3.0);
656+
animation.resume();
657+
}
658+
659+
cutscene_state.target_camera_translation = Some(Vec3::new(6.8157444, 2.0143255, -2.526128));
660+
626661
audio.stop_bgm();
627662
audio.play_bgm(&game_assets.pregame_bgm);
628663

@@ -633,7 +668,7 @@ fn play_cutscene(
633668
speaking: DisplayCharacter::Pa,
634669
});
635670
},
636-
1 => {
671+
2 => {
637672
for entity in &players {
638673
println!("setting player animation");
639674
let mut animation = animations.get_mut(entity).unwrap();
@@ -658,23 +693,23 @@ fn play_cutscene(
658693
speaking: DisplayCharacter::Pa,
659694
});
660695
},
661-
2 => {
696+
3 => {
662697
textbox.queued_text = Some(TextBoxText {
663698
text: "PA: And then... you wreck the place.".to_string(),
664699
speed: text_speed,
665700
auto: false,
666701
speaking: DisplayCharacter::Pa,
667702
});
668703
},
669-
3 => {
704+
4 => {
670705
textbox.queued_text = Some(TextBoxText {
671706
text: "PA: Just destroy all their antiques.".to_string(),
672707
speed: text_speed,
673708
auto: false,
674709
speaking: DisplayCharacter::Pa,
675710
});
676711
},
677-
4 => {
712+
5 => {
678713
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle,
679714
CutsceneTexture::MatTalk);
680715
textbox.queued_text = Some(TextBoxText {
@@ -684,31 +719,31 @@ fn play_cutscene(
684719
speaking: DisplayCharacter::Mat,
685720
});
686721
},
687-
5 => {
722+
6 => {
688723
textbox.queued_text = Some(TextBoxText {
689724
text: "PA: That's the beauty, kid! You're not doing it, your bull is!".to_string(),
690725
speed: text_speed,
691726
auto: false,
692727
speaking: DisplayCharacter::Pa,
693728
});
694729
},
695-
6 => {
730+
7 => {
696731
textbox.queued_text = Some(TextBoxText {
697732
text: "PA: It's 100% legal!".to_string(),
698733
speed: text_speed,
699734
auto: false,
700735
speaking: DisplayCharacter::Pa,
701736
});
702737
},
703-
7 => {
738+
8 => {
704739
textbox.queued_text = Some(TextBoxText {
705740
text: "PA: Anymore questions?".to_string(),
706741
speed: text_speed,
707742
auto: false,
708743
speaking: DisplayCharacter::Pa,
709744
});
710745
},
711-
8 => {
746+
9 => {
712747
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle,
713748
CutsceneTexture::MatTalk);
714749
textbox.queued_text = Some(TextBoxText {
@@ -718,7 +753,7 @@ fn play_cutscene(
718753
speaking: DisplayCharacter::Mat,
719754
});
720755
},
721-
9 => {
756+
10 => {
722757
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle);
723758
textbox.queued_text = Some(TextBoxText {
724759
text: "PA: I gave you that earpiece, remember?".to_string(),
@@ -727,7 +762,7 @@ fn play_cutscene(
727762
speaking: DisplayCharacter::Pa,
728763
});
729764
},
730-
10 => {
765+
11 => {
731766
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle,
732767
CutsceneTexture::MatTalk);
733768
textbox.queued_text = Some(TextBoxText {
@@ -737,7 +772,7 @@ fn play_cutscene(
737772
speaking: DisplayCharacter::Mat,
738773
});
739774
},
740-
11 => {
775+
12 => {
741776
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle);
742777
textbox.queued_text = Some(TextBoxText {
743778
text: "PA: Nevermind that! You're almost at the first shop.".to_string(),
@@ -746,7 +781,7 @@ fn play_cutscene(
746781
speaking: DisplayCharacter::Pa,
747782
});
748783
},
749-
12 => {
784+
13 => {
750785
cutscene_texture_state.mat = vec!(CutsceneTexture::MatIdle);
751786
textbox.queued_text = Some(TextBoxText {
752787
text: "PA: Remember, the best offensive is to be offensive!".to_string(),

src/game_camera.rs

-4
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ pub fn spawn_camera<T: Component + Clone>(
224224

225225
t
226226
},
227-
camera: Camera {
228-
priority: 0,
229-
..default()
230-
},
231227
// projection: OrthographicProjection {
232228
// scale: 10.0,
233229
// scaling_mode: ScalingMode::FixedVertical(1.0),

0 commit comments

Comments
 (0)