the game does not crash, it's not right but that is in fact a win so we're committing

main
Elijah Voigt 2 weeks ago
parent bd1cb17c36
commit 1c0f5ef623

@ -611,9 +611,6 @@ fn new_cell(
let playback_settings = PlaybackSettings::ONCE.with_volume(volume); let playback_settings = PlaybackSettings::ONCE.with_volume(volume);
info!("using coordinates {:?}", c); info!("using coordinates {:?}", c);
info!("cell_pitch: {:?}", pitch_map.coordinates_cell_pitch(&c));
info!("pitch map {:?}", pitch_map);
info!("cell assets materials: {:#?}", cell_assets.materials);
bsn! { bsn! {
Cell Cell
@ -763,11 +760,11 @@ impl CellPitch {
} }
}; };
let lightness = (self.octave as f32 + 5.0) / 11.0; let chroma = (self.octave as f32 + 5.0) / 11.0;
Color::Oklcha(Oklcha { Color::Oklcha(Oklcha {
hue, hue,
lightness, chroma,
..default() ..default()
}) })
} }
@ -976,20 +973,20 @@ impl PitchMap {
/// Given the currently selected notes and octave range selected in the PitchMap convert the given coordinates to a CellPitch /// Given the currently selected notes and octave range selected in the PitchMap convert the given coordinates to a CellPitch
fn coordinates_cell_pitch(&self, c: &Coordinates) -> CellPitch { fn coordinates_cell_pitch(&self, c: &Coordinates) -> CellPitch {
let note: Note = { let note: Note = {
// Note is the x-axis pattern, repeating every 12 tiles because we support 12 pitches let num_notes: usize = self.notes.len();
let idx = (c.x as usize) % self.notes.len(); let x_coord: usize = c.x.strict_abs() as usize; // TODO: shift first or something
// TODO: pretty sure this doesn't handle negative numbers at all... self.notes.get(x_coord % num_notes).unwrap().clone()
// need to shift by ?? first
self.notes.get(idx).unwrap().clone()
}; };
let octave: isize = { let octave: isize = {
// Octave is the y-axis pattern, repeating every 11 tiles because we support 11 octaves let num_octaves: usize = self.octaves_up + self.octaves_down + 1;
let total_octaves = self.octaves_up as isize + self.octaves_down as isize + 1; let y_coord: usize = c.y.strict_abs() as usize; // TODO: shift first or something
// TODO: pretty sure this doesn't handle negative numbers at all... info!("num_octaves: {:?}", num_octaves);
// need to shift by ?? first info!("y_coord: {:?}", y_coord);
c.y % total_octaves (y_coord % num_octaves) as isize - 5
}; };
CellPitch { note, octave } let cp = CellPitch { note, octave };
info!("Cell Pitch: {:?}", cp);
cp
} }
} }

Loading…
Cancel
Save