Browse code

Removed unused hor/ver values

neauoire authored on 01/08/2021 18:38:04
Showing 3 changed files
... ...
@@ -66,9 +66,7 @@ ppu_2bpp(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Ui
66 66
 int
67 67
 ppu_init(Ppu *p, Uint8 hor, Uint8 ver)
68 68
 {
69
-	p->hor = hor;
70
-	p->ver = ver;
71
-	p->width = 8 * p->hor;
72
-	p->height = 8 * p->ver;
69
+	p->width = 8 * hor;
70
+	p->height = 8 * ver;
73 71
 	return 1;
74 72
 }
... ...
@@ -18,7 +18,7 @@ typedef unsigned short Uint16;
18 18
 typedef unsigned int Uint32;
19 19
 
20 20
 typedef struct Ppu {
21
-	Uint16 hor, ver, width, height;
21
+	Uint16 width, height;
22 22
 	Uint8 *pixels;
23 23
 } Ppu;
24 24
 
... ...
@@ -213,8 +213,8 @@ static void
213 213
 domouse(SDL_Event *event)
214 214
 {
215 215
 	Uint8 flag = 0x00;
216
-	Uint16 x = clamp(event->motion.x - PAD, 0, ppu.hor * 8 - 1);
217
-	Uint16 y = clamp(event->motion.y - PAD, 0, ppu.ver * 8 - 1);
216
+	Uint16 x = clamp(event->motion.x - PAD, 0, ppu.width - 1);
217
+	Uint16 y = clamp(event->motion.y - PAD, 0, ppu.height - 1);
218 218
 	mempoke16(devmouse->dat, 0x2, x);
219 219
 	mempoke16(devmouse->dat, 0x4, y);
220 220
 	switch(event->button.button) {
... ...
@@ -500,8 +500,8 @@ main(int argc, char **argv)
500 500
 	portuxn(&u, 0xf, "---", nil_talk);
501 501
 
502 502
 	/* Write screen size to dev/screen */
503
-	mempoke16(devscreen->dat, 2, ppu.hor * 8);
504
-	mempoke16(devscreen->dat, 4, ppu.ver * 8);
503
+	mempoke16(devscreen->dat, 2, ppu.width);
504
+	mempoke16(devscreen->dat, 4, ppu.height);
505 505
 
506 506
 	run(&u);
507 507
 	quit();