From fdc5e79b4a02852e1f163032aeb985306f8daf08 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 16 Jul 2017 23:31:24 -0400 Subject: [PATCH] tfv: update a bit, generate beach tiles --- gr-sim/Makefile | 4 +- gr-sim/gr-sim.c | 65 ++++++++++++++++++++------- gr-sim/gr-sim.h | 4 ++ gr-sim/tfv.c | 115 +++++++++++++++++++++++++++++++++++++++--------- 4 files changed, 151 insertions(+), 37 deletions(-) diff --git a/gr-sim/Makefile b/gr-sim/Makefile index 082e5bfc..e67ebd35 100644 --- a/gr-sim/Makefile +++ b/gr-sim/Makefile @@ -31,7 +31,7 @@ text.o: text.c tfv: tfv.o gr-sim.o $(CC) $(LFLAGS) $(SDL_LIBS) -o tfv tfv.o gr-sim.o -tfv.o: tfv.c backgrounds.h tfv_sprites.h +tfv.o: tfv.c gr-sim.h backgrounds.h tfv_sprites.h $(CC) $(CFLAGS) -c tfv.c @@ -51,7 +51,7 @@ sparkle.o: sparkle.c $(CC) $(CFLAGS) -c sparkle.c -gr-sim.o: gr-sim.c apple2_font.h +gr-sim.o: gr-sim.c gr-sim.h apple2_font.h $(CC) $(CFLAGS) $(SDL_INCLUDE) -c gr-sim.c clean: diff --git a/gr-sim/gr-sim.c b/gr-sim/gr-sim.c index f98c1ae0..17f7dddd 100644 --- a/gr-sim/gr-sim.c +++ b/gr-sim/gr-sim.c @@ -1144,28 +1144,63 @@ void basic_normal(void) { return; } +static unsigned short hlin_addr; +static unsigned short hlin_hi; -int hlin(int page, int x1, int x2, int at) { +int hlin_continue(int width) { - unsigned short addr; - int i,hi; + int i; - addr=gr_addr_lookup[at/2]; - hi=at&1; - - addr+=(page*4)<<8; - - for(i=x1;i8) yy-=2; + tfv_y-=2; odd=!odd; } if ((ch=='s') || (ch==APPLE_DOWN)) { - if (yy<27) yy+=2; + tfv_y+=2; odd=!odd; } if ((ch=='a') || (ch==APPLE_LEFT)) { @@ -631,8 +685,7 @@ static int world_map(void) { } else { odd=!odd; - xx--; - if (xx<0) xx=0; + tfv_x--; } } if ((ch=='d') || (ch==APPLE_RIGHT)) { @@ -642,11 +695,33 @@ static int world_map(void) { } else { odd=!odd; - xx++; - if (xx>35) xx=35; + tfv_x++; } } + if (tfv_x>36) { + map_x++; + tfv_x=0; + refresh=1; + } + if (tfv_x<0) { + map_x--; + tfv_x=35; + refresh=1; + } + + if (tfv_y<4) { + map_y--; + tfv_y=28; + refresh=1; + } + + if (tfv_y>28) { + map_y++; + tfv_y=4; + refresh=1; + } + if (ch=='h') print_help(); if (ch=='b') do_battle(); if (ch=='i') print_info(); @@ -656,19 +731,19 @@ static int world_map(void) { } if (refresh) { - grsim_unrle(landing_rle,0x800); + load_map_bg(); refresh=0; } gr_copy(0x800,0x400); if (direction==-1) { - if (odd) grsim_put_sprite(tfv_walk_left,xx,yy); - else grsim_put_sprite(tfv_stand_left,xx,yy); + if (odd) grsim_put_sprite(tfv_walk_left,tfv_x,tfv_y); + else grsim_put_sprite(tfv_stand_left,tfv_x,tfv_y); } if (direction==1) { - if (odd) grsim_put_sprite(tfv_walk_right,xx,yy); - else grsim_put_sprite(tfv_stand_right,xx,yy); + if (odd) grsim_put_sprite(tfv_walk_right,tfv_x,tfv_y); + else grsim_put_sprite(tfv_stand_right,tfv_x,tfv_y); } grsim_update();