From 3d4d2a1e561b97adb4dc02babc9f3d7bdeeabc2f Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 7 Jul 2018 15:18:08 -0400 Subject: [PATCH] tfv: split up the tfv definitions --- gr-sim/tfv/Makefile | 7 +- gr-sim/tfv/tfv.c | 7 +- gr-sim/tfv/tfv_battle.c | 1 + gr-sim/tfv/tfv_credits.c | 234 +++++++++++++++++++++++++++++++++++ gr-sim/tfv/tfv_definitions.h | 34 +++++ gr-sim/tfv/tfv_flying_6502.c | 1 + gr-sim/tfv/tfv_info.c | 1 + gr-sim/tfv/tfv_worldmap.c | 1 + gr-sim/tfv/tfv_zp.h | 34 ----- 9 files changed, 283 insertions(+), 37 deletions(-) create mode 100644 gr-sim/tfv/tfv_credits.c create mode 100644 gr-sim/tfv/tfv_definitions.h diff --git a/gr-sim/tfv/Makefile b/gr-sim/tfv/Makefile index 8bdb069e..cf00552e 100644 --- a/gr-sim/tfv/Makefile +++ b/gr-sim/tfv/Makefile @@ -79,6 +79,9 @@ tfv_backgrounds.o: tfv_backgrounds.c tfv_backgrounds.h tfv_battle.o: tfv_battle.c $(CC) $(CFLAGS) -c tfv_battle.c +tfv_credits.o: tfv_credits.c + $(CC) $(CFLAGS) -c tfv_credits.c + tfv_flying.o: tfv_flying.c tfv_flying_fixed.c tfv_flying_float.c tfv_flying_6502.c $(CC) $(CFLAGS) -c tfv_flying.c @@ -120,13 +123,13 @@ tfv_multiply: tfv_multiply.o tfv.o: tfv.c ../gr-sim.h tfv_backgrounds.h tfv_sprites.h $(CC) $(CFLAGS) -c tfv.c -tfv: tfv.o tfv_backgrounds.o tfv_battle.o tfv_flying.o \ +tfv: tfv.o tfv_backgrounds.o tfv_battle.o tfv_credits.o tfv_flying.o \ tfv_game_over.o tfv_help.o tfv_info.o tfv_map.o \ tfv_opener.o tfv_sprites.o tfv_textentry.o \ tfv_title.o tfv_worldmap.o tfv_mapinfo.h \ $(GR_SIM) $(CC) $(LFLAGS) $(SDL_LIBS) -o tfv tfv.o \ - tfv_backgrounds.o tfv_battle.o tfv_flying.o \ + tfv_backgrounds.o tfv_battle.o tfv_credits.o tfv_flying.o \ tfv_game_over.o tfv_help.o tfv_info.o tfv_map.o \ tfv_opener.o tfv_sprites.o tfv_textentry.o \ tfv_title.o tfv_worldmap.o \ diff --git a/gr-sim/tfv/tfv.c b/gr-sim/tfv/tfv.c index 5c06f87a..7db4cdd3 100644 --- a/gr-sim/tfv/tfv.c +++ b/gr-sim/tfv/tfv.c @@ -6,6 +6,7 @@ #include "gr-sim.h" #include "tfv_utils.h" #include "tfv_zp.h" +#include "tfv_definitions.h" #include "tfv_sprites.h" #include "tfv_backgrounds.h" @@ -58,8 +59,12 @@ int main(int argc, char **argv) { /* Title Screen */ title_loop: result=title(); - if (result!=0) goto title_loop; + if (result==0) goto play_game; + if (result==1) credits(); + goto title_loop; + +play_game: nameo[0]=0; /* Get Name */ diff --git a/gr-sim/tfv/tfv_battle.c b/gr-sim/tfv/tfv_battle.c index 08b23e1d..56d148dc 100644 --- a/gr-sim/tfv/tfv_battle.c +++ b/gr-sim/tfv/tfv_battle.c @@ -8,6 +8,7 @@ #include "gr-sim.h" #include "tfv_utils.h" #include "tfv_zp.h" +#include "tfv_definitions.h" #include "tfv_sprites.h" #include "tfv_backgrounds.h" diff --git a/gr-sim/tfv/tfv_credits.c b/gr-sim/tfv/tfv_credits.c new file mode 100644 index 00000000..4bd7a97d --- /dev/null +++ b/gr-sim/tfv/tfv_credits.c @@ -0,0 +1,234 @@ +#include +#include +#include +#include + +#include "tfv_zp.h" + +#include "tfv_sprites.h" + +#include "gr-sim.h" + +static int letter_index=0,letter_x=39,letter_y=2,destination=16,which_string=0; + + +static char strings[12][32]= { + "T A L B O T", + "F A N T A S Y", + "S E V E N", + "", + "BY", + "VINCE WEAVER", + "", + "MUSIC BY", + "HIROKAZU TANAKA", + "", + "CYCLE COUNTING IS HARD", + "", +}; + +static int destinations[12]={ + 15,14,16,255, + 19,14,255, + 16,12,255, + 9,0, +}; + +static int ys[12]={ + 2,3,4,255, + 2,3,255, + 2,3,255, + 2,0, +}; + +static void letter_slide(void) { + + + char out[BUFSIZ]; + char ch; + + if (destinations[which_string]==0) return; // at end + + ch=strings[which_string][letter_index]; + if (ch==0) { + which_string++; + letter_index=0; + destination=destinations[which_string]; + letter_x=39; + letter_y=ys[which_string]; + return; + } + + vtab(letter_y); + htab(letter_x); + move_cursor(); + out[0]=ch; out[1]=0; + print(out); + + letter_x--; + if (letter_x4) { + grsim_put_sprite_page(PAGE0, + bird_rider_stand_right, + 17,30); + } + else { + grsim_put_sprite_page(PAGE0, + bird_rider_walk_right, + 17,30); + } + + ch=grsim_input(); + + if (ch) break; + + usleep(16000); + frame++; + if (frame>31) frame=0; + + if (frame%4==0) { + tree2_x--; + if (tree2_x<0) tree2_x=37; + } + + if (frame%16==0) { + tree1_x--; + if (tree1_x<0) tree1_x=37; + } + + letter_slide(); + + } + + + + return 0; +} diff --git a/gr-sim/tfv/tfv_definitions.h b/gr-sim/tfv/tfv_definitions.h new file mode 100644 index 00000000..8ee09389 --- /dev/null +++ b/gr-sim/tfv/tfv_definitions.h @@ -0,0 +1,34 @@ +/* stats */ +extern unsigned char level; +extern unsigned char hp,max_hp; +extern unsigned char mp,max_mp; +extern unsigned char limit; +extern unsigned char money,experience; +extern unsigned char time_hours,time_minutes; +extern unsigned char items1,items2; +extern unsigned char steps; + + +struct fixed_type { + char i; + unsigned char f; +}; + +int opening(void); +int title(void); +int flying(void); + +void game_over(void); +void show_map(void); +void print_info(void); +void print_help(void); + +int name_screen(void); + +int do_battle(void); + +int world_map(void); + +int city_map(void); + +int credits(void); diff --git a/gr-sim/tfv/tfv_flying_6502.c b/gr-sim/tfv/tfv_flying_6502.c index 34762a2c..d0ba5425 100644 --- a/gr-sim/tfv/tfv_flying_6502.c +++ b/gr-sim/tfv/tfv_flying_6502.c @@ -9,6 +9,7 @@ #include "6502_emulate.h" #include "tfv_utils.h" #include "tfv_zp.h" +#include "tfv_definitions.h" #include "tfv_sprites.h" diff --git a/gr-sim/tfv/tfv_info.c b/gr-sim/tfv/tfv_info.c index 075bb786..dc941dca 100644 --- a/gr-sim/tfv/tfv_info.c +++ b/gr-sim/tfv/tfv_info.c @@ -5,6 +5,7 @@ #include "tfv_utils.h" #include "tfv_zp.h" #include "tfv_defines.h" +#include "tfv_definitions.h" #include "tfv_items.h" diff --git a/gr-sim/tfv/tfv_worldmap.c b/gr-sim/tfv/tfv_worldmap.c index ec8d5616..00a1aed9 100644 --- a/gr-sim/tfv/tfv_worldmap.c +++ b/gr-sim/tfv/tfv_worldmap.c @@ -7,6 +7,7 @@ #include "tfv_utils.h" #include "tfv_zp.h" #include "tfv_defines.h" +#include "tfv_definitions.h" #include "tfv_sprites.h" #include "tfv_backgrounds.h" diff --git a/gr-sim/tfv/tfv_zp.h b/gr-sim/tfv/tfv_zp.h index b4e4898d..df8d0e31 100644 --- a/gr-sim/tfv/tfv_zp.h +++ b/gr-sim/tfv/tfv_zp.h @@ -39,37 +39,3 @@ #define CSWH 0x37 - -/* stats */ -extern unsigned char level; -extern unsigned char hp,max_hp; -extern unsigned char mp,max_mp; -extern unsigned char limit; -extern unsigned char money,experience; -extern unsigned char time_hours,time_minutes; -extern unsigned char items1,items2; -extern unsigned char steps; - - -struct fixed_type { - char i; - unsigned char f; -}; - -int opening(void); -int title(void); -int flying(void); - -void game_over(void); -void show_map(void); -void print_info(void); -void print_help(void); - -int name_screen(void); - -int do_battle(void); - -int world_map(void); - -int city_map(void); -