mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
resolve stutter
This commit is contained in:
parent
083fd43ea3
commit
cbb0b7d2a0
|
@ -175,7 +175,7 @@ pub(crate) fn customise_screen(
|
||||||
|
|
||||||
agb.sfx.frame();
|
agb.sfx.frame();
|
||||||
|
|
||||||
let mut upgrades = crate::level_generation::generate_upgrades(level);
|
let mut upgrades = crate::level_generation::generate_upgrades(level, &mut || agb.sfx.frame());
|
||||||
let mut _upgrade_objects = create_upgrade_objects(&agb.obj, &upgrades);
|
let mut _upgrade_objects = create_upgrade_objects(&agb.obj, &upgrades);
|
||||||
|
|
||||||
let mut input = agb::input::ButtonController::new();
|
let mut input = agb::input::ButtonController::new();
|
||||||
|
|
|
@ -37,7 +37,7 @@ fn generate_cooldown(current_level: u32) -> u32 {
|
||||||
rng::gen().rem_euclid((5 * 60 - current_level as i32 * 10).max(1)) as u32 + 2 * 60
|
rng::gen().rem_euclid((5 * 60 - current_level as i32 * 10).max(1)) as u32 + 2 * 60
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_upgrades(level: u32) -> Vec<Face> {
|
pub fn generate_upgrades(level: u32, call: &mut dyn FnMut()) -> Vec<Face> {
|
||||||
let mut upgrade_values = HashMap::new();
|
let mut upgrade_values = HashMap::new();
|
||||||
|
|
||||||
upgrade_values.insert(Face::Shoot, 5);
|
upgrade_values.insert(Face::Shoot, 5);
|
||||||
|
@ -73,6 +73,8 @@ pub fn generate_upgrades(level: u32) -> Vec<Face> {
|
||||||
let mut attempts = 0;
|
let mut attempts = 0;
|
||||||
|
|
||||||
while upgrades.len() != 3 {
|
while upgrades.len() != 3 {
|
||||||
|
call();
|
||||||
|
|
||||||
attempts += 1;
|
attempts += 1;
|
||||||
let next = potential_upgrades[rng::gen() as usize % potential_upgrades.len()];
|
let next = potential_upgrades[rng::gen() as usize % potential_upgrades.len()];
|
||||||
let number_of_malfunctions = upgrades
|
let number_of_malfunctions = upgrades
|
||||||
|
|
Loading…
Reference in a new issue