... | ... |
@@ -84,21 +84,14 @@ ppu_redraw(Ppu *p, Uint32 *screen) |
84 | 84 |
{ |
85 | 85 |
Uint16 x, y; |
86 | 86 |
for(y = 0; y < p->height; ++y) |
87 |
- for(x = 0; x < p->width; ++x) |
|
88 |
- screen[x + y * p->width] = p->palette[ppu_read(p, x, y)]; |
|
87 |
+ for(x = 0; x < p->width; ++x) { |
|
88 |
+ Uint32 row = (x + y * p->width); |
|
89 |
+ Uint8 color = p->fg[row] ? p->fg[row] : p->bg[row]; |
|
90 |
+ screen[x + y * p->width] = p->palette[color]; |
|
91 |
+ } |
|
89 | 92 |
p->reqdraw = 0; |
90 | 93 |
} |
91 | 94 |
|
92 |
-Uint8 |
|
93 |
-ppu_read(Ppu *p, Uint16 x, Uint16 y) |
|
94 |
-{ |
|
95 |
- if(x < p->width && y < p->height) { |
|
96 |
- Uint32 row = (x + y * p->width); |
|
97 |
- return p->fg[row] ? p->fg[row] : p->bg[row]; |
|
98 |
- } |
|
99 |
- return 0x0; |
|
100 |
-} |
|
101 |
- |
|
102 | 95 |
void |
103 | 96 |
ppu_write(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color) |
104 | 97 |
{ |