// -----------------------------------------------------------
// slide2.c - OUR FIRST GAME: Definitely not an Impostor
//   big block letters with the gold wash running across them;
//   each text block gets a shifted wash phase, so the glow
//   rolls through the three lines diagonally
// -----------------------------------------------------------
#include "defs.h"
#include "common.h"
#include "slides.h"

void s2_init(void)
{
	clear_screen();
	print_text( 1, 13, VCOL_WHITE,   "our first game");
	draw_big(    4,  0, VCOL_YELLOW, "definitely");
	draw_big(   10,  8, VCOL_YELLOW, "not an");
	draw_big(   16,  4, VCOL_YELLOW, "impostor");
	print_text(23, 10, VCOL_LT_GREY, "introduced on tic-80");
}

void s2_update(void)
{
	while (vic.raster != RAS_BOTTOM)
		;

	framectr++;
	if (!(framectr & 1))                 // wash moves one column every 2nd frame
		washphase++;

	// gold wash across all 15 big-letter rows (4-8, 10-14, 16-20);
	// each block is 5 wash steps behind the one above -> diagonal
	for (char x = 0; x < 40; x++)
	{
		char i = (x + washphase) & 15;
		char c = washtbl[i];
		COLRAM[ 4 * 40 + x] = c;
		COLRAM[ 5 * 40 + x] = c;
		COLRAM[ 6 * 40 + x] = c;
		COLRAM[ 7 * 40 + x] = c;
		COLRAM[ 8 * 40 + x] = c;
		i = (i + 5) & 15;
		c = washtbl[i];
		COLRAM[10 * 40 + x] = c;
		COLRAM[11 * 40 + x] = c;
		COLRAM[12 * 40 + x] = c;
		COLRAM[13 * 40 + x] = c;
		COLRAM[14 * 40 + x] = c;
		i = (i + 5) & 15;
		c = washtbl[i];
		COLRAM[16 * 40 + x] = c;
		COLRAM[17 * 40 + x] = c;
		COLRAM[18 * 40 + x] = c;
		COLRAM[19 * 40 + x] = c;
		COLRAM[20 * 40 + x] = c;
	}
}
