(screen.c) Removed pixel function
This commit is contained in:
parent
d0db4f9223
commit
b6e6839d25
|
@ -1,5 +1,4 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "../uxn.h"
|
#include "../uxn.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
@ -25,14 +24,6 @@ static Uint8 blending[4][16] = {
|
||||||
{1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1},
|
{1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1},
|
||||||
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}};
|
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}};
|
||||||
|
|
||||||
static void
|
|
||||||
screen_pixel(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color)
|
|
||||||
{
|
|
||||||
if(x >= p->width || y >= p->height)
|
|
||||||
return;
|
|
||||||
layer->pixels[x + y * p->width] = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
screen_fill(UxnScreen *p, Layer *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, Uint8 color)
|
screen_fill(UxnScreen *p, Layer *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, Uint8 color)
|
||||||
{
|
{
|
||||||
|
@ -50,15 +41,14 @@ screen_blit(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8
|
||||||
Uint16 c = sprite[v] | (twobpp ? (sprite[v + 8] << 8) : 0);
|
Uint16 c = sprite[v] | (twobpp ? (sprite[v + 8] << 8) : 0);
|
||||||
for(h = 7; h >= 0; --h, c >>= 1) {
|
for(h = 7; h >= 0; --h, c >>= 1) {
|
||||||
Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
||||||
if(opaque || ch)
|
if(opaque || ch) {
|
||||||
screen_pixel(p,
|
Uint16 xx = x + (flipx ? 7 - h : h);
|
||||||
layer,
|
Uint16 yy = y + (flipy ? 7 - v : v);
|
||||||
x + (flipx ? 7 - h : h),
|
if(xx < p->width && yy < p->height)
|
||||||
y + (flipy ? 7 - v : v),
|
layer->pixels[xx + yy * p->width] = blending[ch][color];
|
||||||
blending[ch][color]);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layer->changed = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -158,29 +148,32 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xf: {
|
case 0xf: {
|
||||||
Layer *layer = (d[0xf] & 0x40) ? &uxn_screen.fg : &uxn_screen.bg;
|
Uint8 i;
|
||||||
|
Uint8 ctrl = d[0xf];
|
||||||
|
Uint8 move = d[0x6];
|
||||||
|
Uint8 length = move >> 4;
|
||||||
|
Uint8 twobpp = !!(ctrl & 0x80);
|
||||||
Uint16 x = PEEK2(d + 0x8);
|
Uint16 x = PEEK2(d + 0x8);
|
||||||
Uint16 y = PEEK2(d + 0xa);
|
Uint16 y = PEEK2(d + 0xa);
|
||||||
Uint16 addr = PEEK2(d + 0xc);
|
Uint16 addr = PEEK2(d + 0xc);
|
||||||
Uint16 dx = (d[0x6] & 0x01) << 3;
|
Uint16 dx = (move & 0x1) << 3;
|
||||||
Uint16 dy = (d[0x6] & 0x02) << 2;
|
Uint16 dy = (move & 0x2) << 2;
|
||||||
Uint8 n = d[0x6] >> 4;
|
Layer *layer = (ctrl & 0x40) ? &uxn_screen.fg : &uxn_screen.bg;
|
||||||
Uint8 twobpp = !!(d[0xf] & 0x80);
|
if(addr > 0x10000 - ((length + 1) << (3 + twobpp)))
|
||||||
Uint8 i;
|
|
||||||
if(addr > 0x10000 - ((n + 1) << (3 + twobpp)))
|
|
||||||
return;
|
return;
|
||||||
for(i = 0; i <= n; i++) {
|
for(i = 0; i <= length; i++) {
|
||||||
if(!(d[0xf] & 0xf)) {
|
if(!(ctrl & 0xf)) {
|
||||||
Uint16 ex = x + dy * i, ey = y + dx * i;
|
Uint16 ex = x + dy * i, ey = y + dx * i;
|
||||||
screen_fill(&uxn_screen, layer, ex, ey, ex + 8, ey + 8, 0);
|
screen_fill(&uxn_screen, layer, ex, ey, ex + 8, ey + 8, 0);
|
||||||
} else {
|
} else {
|
||||||
screen_blit(&uxn_screen, layer, x + dy * i, y + dx * i, &ram[addr], d[0xf] & 0xf, d[0xf] & 0x10, d[0xf] & 0x20, twobpp);
|
screen_blit(&uxn_screen, layer, x + dy * i, y + dx * i, &ram[addr], ctrl & 0xf, ctrl & 0x10, ctrl & 0x20, twobpp);
|
||||||
addr += (d[0x6] & 0x04) << (1 + twobpp);
|
addr += (move & 0x04) << (1 + twobpp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(d[0x6] & 0x1) POKE2(d + 0x8, x + dx); /* auto x+8 */
|
layer->changed = 1;
|
||||||
if(d[0x6] & 0x2) POKE2(d + 0xa, y + dy); /* auto y+8 */
|
if(move & 0x1) POKE2(d + 0x8, x + dx); /* auto x+8 */
|
||||||
if(d[0x6] & 0x4) POKE2(d + 0xc, addr); /* auto addr+length */
|
if(move & 0x2) POKE2(d + 0xa, y + dy); /* auto y+8 */
|
||||||
|
if(move & 0x4) POKE2(d + 0xc, addr); /* auto addr+length */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue