It'll be great if you add the tiles animation on the editor. Here are the source code of the game, each function is called every two frame (1/30s). They call PisteDraw2_DrawImage_Start() to get the 8-bit buffer of the tiles, and change it. Also there is the PisteDraw2_RotatePalette() that change the global pallete, it rotates the palettes from 224 (start) to 239 (end) and it is called every four frames (1/15s).
//Anim fire
void PK2Kartta::Animoi_Tuli(void){
BYTE *buffer = NULL;
DWORD leveys;
int x,y;
int color;
PisteDraw2_DrawImage_Start(palikat_buffer,*&buffer,(DWORD &)leveys);
for (x=128;x<160;x++)
for (y=448;y<479;y++)
{
color = buffer[x+(y+1)*leveys];
if (color != 255)
{
color %= 32;
color = color - rand()%4;
if (color < 0)
color = 255;
else
{
if (color > 21)
color += 128;
else
color += 64;
}
}
buffer[x+y*leveys] = color;
}
if (ajastin1 < 20)
{
for (x=128;x<160;x++)
buffer[x+479*leveys] = rand()%15+144;
}
else
for (x=128;x<160;x++)
buffer[x+479*leveys] = 255;
PisteDraw2_DrawImage_End(palikat_buffer);
}
//Anim Waterfall
void PK2Kartta::Animoi_Vesiputous(void){
BYTE *buffer = NULL;
DWORD leveys;
int x,y,plus;
int color,color2;
BYTE temp[32*32];
PisteDraw2_DrawImage_Start(palikat_buffer,*&buffer,(DWORD &)leveys);
for (x=32;x<64;x++)
for (y=416;y<448;y++)
temp[x-32+(y-416)*32] = buffer[x+y*leveys];
color2 = (temp[0]/32)*32; // mahdollistaa erivriset vesiputoukset
for (x=32;x<64;x++)
{
plus = rand()%2+2;//...+1
for (y=416;y<448;y++)
{
color = temp[x-32+(y-416)*32];
if (color != 255) // mahdollistaa eri leveyksiset vesiputoukset
{
color %= 32;
if (color > 10)//20
color--;
if (rand()%40 == 1)
color = 11+rand()%11;//15+rand()%8;//9+rand()%5;
if (rand()%160 == 1)
color = 30;
buffer[x + (416+(y+plus)%32)*leveys] = color+color2;
}
else
buffer[x + (416+(y+plus)%32)*leveys] = color;
}
}
PisteDraw2_DrawImage_End(palikat_buffer);
}
//Anim Water Surface
void PK2Kartta::Animoi_Vedenpinta(void){
BYTE *buffer = NULL;
DWORD leveys;
int x,y;
BYTE temp[32];
PisteDraw2_DrawImage_Start(palikat_buffer,*&buffer,(DWORD &)leveys);
for (y=416;y<448;y++)
temp[y-416] = buffer[y*leveys];
for (y=416;y<448;y++)
{
for (x=0;x<31;x++)
{
buffer[x+y*leveys] = buffer[x+1+y*leveys];
}
}
for (y=416;y<448;y++)
buffer[31+y*leveys] = temp[y-416];
PisteDraw2_DrawImage_End(palikat_buffer);
}
//Anim water
void PK2Kartta::Animoi_Vesi(void){
BYTE *buffer_lahde = NULL, *buffer_kohde = NULL;
DWORD leveys_lahde, leveys_kohde;
int x, y, color1, color2,
d1 = vesiaste / 2, d2;
int sini, cosi;
int vx,vy;
int i;
PisteDraw2_DrawImage_Start(palikat_buffer, *&buffer_kohde,(DWORD &)leveys_kohde);
PisteDraw2_DrawImage_Start(palikat_vesi_buffer,*&buffer_lahde,(DWORD &)leveys_lahde);
for (y=0;y<32;y++){
d2 = d1;
for (x=0;x<32;x++){
sini = int((y+d2/2)*11.25)%360;
cosi = int((x+d1/2)*11.25)%360;
sini = (int)kartta_sin_table[sini];
cosi = (int)kartta_cos_table[cosi];
vy = (y+sini/11)%32;
vx = (x+cosi/11)%32;
if (vy < 0){
vy = -vy;
vy = 31-(vy%32);
}
if (vx < 0){
vx= -vx;
vx = 31-(vx%32);
}
color1 = buffer_lahde[64+vx+vy*leveys_lahde];
buffer_lahde[32+x+y*leveys_lahde] = color1;
d2 = 1 + d2 % 360;
}
d1 = 1 + d1 % 360;
}
int vy2;
for (int p=2;p<5;p++){
i = p*32;
for (y=0;y<32;y++){
//d2 = d1;
vy = y*leveys_lahde;
vy2 = (y+416)*leveys_kohde;
for (x=0;x<32;x++){
vx = x+vy;
color1 = buffer_lahde[32+vx];
color2 = buffer_lahde[ i+vx];
buffer_kohde[i+x+vy2] = (color1 + color2*2) / 3;
}
}
}
PisteDraw2_DrawImage_End(palikat_buffer);
PisteDraw2_DrawImage_End(palikat_vesi_buffer);
}
//Anim something
void PK2Kartta::Animoi_Virta_Ylos(void){
BYTE *buffer = NULL;
DWORD leveys;
int x,y;
BYTE temp[32];
PisteDraw2_DrawImage_Start(palikat_buffer,*&buffer,(DWORD &)leveys);
for (x=64;x<96;x++)
temp[x-64] = buffer[x+448*leveys];
for (x=64;x<96;x++)
{
for (y=448;y<479;y++)
{
buffer[x+y*leveys] = buffer[x+(y+1)*leveys];
}
}
for (x=64;x<96;x++)
buffer[x+479*leveys] = temp[x-64];
PisteDraw2_DrawImage_End(palikat_buffer);
}
void PisteDraw2_RotatePalette(BYTE start, BYTE end){
BYTE i;
SDL_Color* game_colors = frameBuffer8->format->palette->colors;
SDL_Color temp_color = game_colors[end];
for (i=end;i>start;i--)
game_colors[i] = game_colors[i-1];
game_colors[start] = temp_color;
}