Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objs #93

Merged
merged 7 commits into from
Jul 29, 2024
Merged

Objs #93

merged 7 commits into from
Jul 29, 2024

Conversation

joajfreitas
Copy link
Collaborator

@joajfreitas joajfreitas commented Jul 27, 2024

fixes #67

fpt/src/ppu.rs Outdated
@@ -78,6 +83,10 @@ impl Ppu {
fn oam_scan(&mut self) {
if self.dots_this_frame % 456 == (80 - 1) {
self.tilemap = self.bus.with_vram(VRamContents::load);
let oam = self.bus.copy_range(map::OAM);
self.sprites = (0..40)
.map(|sprite_index| Sprite::load(&oam[sprite_index * 4..(sprite_index * 4 + 4)]))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the magic numbers here? the * 4 and + 4.
the ppu already has lots of magic numbers I introduced that I dislike 😅

fpt/src/ppu.rs Outdated
let mut pixel = tile.get_pixel(yy % 8, xx % 8);

for sprite in self.sprites.iter() {
let sprite_x: i32 = sprite.x as i32 - 8;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove the repeated as i32 casts somehow?

@joajfreitas joajfreitas merged commit 9f487bb into main Jul 29, 2024
1 check passed
@joajfreitas joajfreitas deleted the objs branch July 29, 2024 19:33
@joajfreitas joajfreitas self-assigned this Aug 22, 2024
@joajfreitas joajfreitas added the enhancement New feature or request label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement OBJs
2 participants