mode7: work on fade

This commit is contained in:
Vince Weaver 2017-12-15 14:04:50 -05:00
parent e60974a9ef
commit 819b618b70
3 changed files with 111 additions and 8 deletions

View File

@ -11,10 +11,10 @@ all: fade fixed_point rainbow sparkle starfield kaleido \
####
fade: fade.o gr-sim.o tfv_backgrounds.o tfv_utils.o
$(CC) $(LFLAGS) $(SDL_LIBS) -o fade fade.o gr-sim.o tfv_backgrounds.o tfv_utils.o
fade: fade.o gr-sim.o tfv_utils.o
$(CC) $(LFLAGS) $(SDL_LIBS) -o fade fade.o gr-sim.o tfv_utils.o
fade.o: fade.c
fade.o: fade.c demo_title.c
$(CC) $(CFLAGS) -c fade.c
####

View File

@ -6,12 +6,28 @@
#include "gr-sim.h"
#include "tfv_utils.h"
#include "tfv_zp.h"
#include "tfv_backgrounds.h"
#include "demo_title.c"
#if 0
static int fade_map[2][16]={
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
{0,1,2,2,4,5,2,5, 8,8,5,3,4,8,4,7},
{0,0,0,5,0,0,5,5, 0,0,0,5,8,5,5,5},
};
#endif
static int fade_map[2][16]={
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
{0,0,0,2,0,0,2,5, 5,8,5,3,4,8,4,7},
{0,0,0,0,0,0,5,0, 0,0,0,0,8,0,0,5},
};
int main(int argc, char **argv) {
int result;
int x,temph,templ,ch;
grsim_init();
gr();
@ -20,15 +36,102 @@ int main(int argc, char **argv) {
clear_bottom(PAGE1);
clear_bottom(PAGE2);
grsim_unrle(title_rle,0xc00);
grsim_unrle(demo_rle,0xc00);
gr_copy_to_current(0xc00);
page_flip();
gr_copy_to_current(0xc00);
page_flip();
repeat_until_keypressed();
while(1) {
repeat_until_keypressed();
return result;
/* Fade step 1 */
for(x=0xc00;x<0x1000;x++) {
temph=ram[x]&0xf0;
templ=ram[x]&0x0f;
templ=fade_map[0][templ];
temph=fade_map[0][temph>>4];
ram[x-0x800]=(temph<<4)|templ;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
/* Fade step 2 */
for(x=0xc00;x<0x1000;x++) {
temph=ram[x]&0xf0;
templ=ram[x]&0x0f;
templ=fade_map[1][templ];
temph=fade_map[1][temph>>4];
ram[x-0x800]=(temph<<4)|templ;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
/* Fade to black */
for(x=0x400;x<0x800;x++) {
ram[x]=0x00;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
/* Unfade step 2 */
for(x=0xc00;x<0x1000;x++) {
temph=ram[x]&0xf0;
templ=ram[x]&0x0f;
templ=fade_map[1][templ];
temph=fade_map[1][temph>>4];
ram[x-0x800]=(temph<<4)|templ;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
/* Unfade step 1 */
for(x=0xc00;x<0x1000;x++) {
temph=ram[x]&0xf0;
templ=ram[x]&0x0f;
templ=fade_map[0][templ];
temph=fade_map[0][temph>>4];
ram[x-0x800]=(temph<<4)|templ;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
/* Total unfade */
for(x=0xc00;x<0x1000;x++) {
temph=ram[x]&0xf0;
templ=ram[x]&0x0f;
ram[x-0x800]=(temph)|templ;
}
grsim_update();
ch=repeat_until_keypressed();
if (ch=='q') break;
}
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB