Skip to content

Commit

Permalink
Fix vitruvian palette (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristopher38 authored Apr 6, 2023
1 parent 0727f4f commit 7b143b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
39 changes: 26 additions & 13 deletions intro/game-of-life.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ static void BlitFunc(const BitmapT *sourceA, const BitmapT *sourceB,
custom->bltsize = BLTSIZE;
}

static void MakeCopperList(CopListT *cp) {
void MakeCopperList(CopListT *cp) {
short i;
short *color = wireworld_pcb_pal_pixels;
short display_bg = TrackValueGet(&WireworldDisplayBg, frameCount);
short pal_start = display_bg ? 8 : 0;

CopInit(cp);
// initially previous states are empty
Expand Down Expand Up @@ -246,14 +248,28 @@ static void MakeCopperList(CopListT *cp) {
for (i = 1; i <= DISP_HEIGHT; i += 2) {
// vertical pixel doubling
if (wireworld && (i - 1) % 8 == 0) {
CopSetColor(cp, 8, *color++);
CopSetColor(cp, 9, *color++);
CopSetColor(cp, 10, *color);
CopSetColor(cp, 11, *color++);
CopSetColor(cp, 12, *color);
CopSetColor(cp, 13, *color);
CopSetColor(cp, 14, *color);
CopSetColor(cp, 15, *color++);
// if we're displaying background set its colors without any electrons
if (display_bg)
CopSetColor(cp, pal_start, *color++);
// else background should be black

// if we're displaying background set its colors with electrons
// if we're not displaying background set first half of the color palette
CopSetColor(cp, pal_start+1, *color++);
CopSetColor(cp, pal_start+2, *color);
CopSetColor(cp, pal_start+3, *color++);
CopSetColor(cp, pal_start+4, *color);
CopSetColor(cp, pal_start+5, *color);
CopSetColor(cp, pal_start+6, *color);
CopSetColor(cp, pal_start+7, *color++);

// if we're not displaying background set second half of the color palette
if (!display_bg) {
short j;
for (j = pal_start + 8; j < 16; j++)
CopSetColor(cp, j, *color);
color++;
}
}
CopMove16(cp, bpl1mod, -prev_states[0]->bytesPerRow);
CopMove16(cp, bpl2mod, -prev_states[0]->bytesPerRow);
Expand Down Expand Up @@ -345,7 +361,7 @@ static void SharedPreInit(void) {

SetupPlayfield(MODE_LORES, DISP_DEPTH, X(0), Y(0), DISP_WIDTH, DISP_HEIGHT);

cp = NewCopList(1820);
cp = NewCopList(1310);
MakeCopperList(cp);
CopListActivate(cp);

Expand Down Expand Up @@ -388,7 +404,6 @@ static void SharedPostInit(void) {
}

static void InitWireworld(void) {
short i;
const BitmapT *desired_bg;
short display_bg = TrackValueGet(&WireworldDisplayBg, frameCount);
short bg_idx = TrackValueGet(&WireworldBg, frameCount);
Expand All @@ -400,8 +415,6 @@ static void InitWireworld(void) {
cur_electrons = bg_idx ? &pcb_electrons : &vitruvian_electrons;

SharedPreInit();
for (i = 0; i < 16; i++)
CopInsSet16(&palptr[i], palette_vitruvian[i]);
InitSpawnFrames(cur_electrons,
TrackValueGet(&WireworldSpawnMask, frameCount));

Expand Down
6 changes: 0 additions & 6 deletions intro/gol-palette.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
extern TrackT GOLGradientTrans;
extern TrackT GOLLogoType;

// taken from the wireworld palette
static short palette_vitruvian[16] = {
0x000, 0x3bf, 0x9ee, 0x9ee, 0xdff, 0xdff, 0xdff, 0xdff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
};

static short palette_gol[16] = {0};

static short *LoadCompressedPal(short *from, short *to) {
Expand Down

0 comments on commit 7b143b7

Please sign in to comment.