From 1073d326d79aa2b1f8b13e573602b2293be36e61 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 25 Jun 2018 15:39:19 -0400 Subject: [PATCH] tfv: break up tfv_info --- gr-sim/tfv/Makefile | 18 +++++--- gr-sim/tfv/tfv_game_over.c | 30 +++++++++++++ gr-sim/tfv/tfv_help.c | 61 +++++++++++++++++++++++++ gr-sim/tfv/tfv_info.c | 92 -------------------------------------- gr-sim/tfv/tfv_items.h | 26 +++++++++++ gr-sim/tfv/tfv_map.c | 42 +++++++++++++++++ 6 files changed, 172 insertions(+), 97 deletions(-) create mode 100644 gr-sim/tfv/tfv_game_over.c create mode 100644 gr-sim/tfv/tfv_help.c create mode 100644 gr-sim/tfv/tfv_items.h create mode 100644 gr-sim/tfv/tfv_map.c diff --git a/gr-sim/tfv/Makefile b/gr-sim/tfv/Makefile index a768aff8..d6291434 100644 --- a/gr-sim/tfv/Makefile +++ b/gr-sim/tfv/Makefile @@ -79,15 +79,21 @@ tfv_backgrounds.o: tfv_backgrounds.c tfv_backgrounds.h tfv_battle.o: tfv_battle.c $(CC) $(CFLAGS) -c tfv_battle.c -#tfv_citymap.o: tfv_citymap.c -# $(CC) $(CFLAGS) -c tfv_citymap.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 +tfv_game_over.o: tfv_game_over.c + $(CC) $(CFLAGS) -c tfv_game_over.c + +tfv_help.o: tfv_help.c + $(CC) $(CFLAGS) -c tfv_help.c + tfv_info.o: tfv_info.c $(CC) $(CFLAGS) -c tfv_info.c +tfv_map.o: tfv_map.c + $(CC) $(CFLAGS) -c tfv_map.c + tfv_opener.o: tfv_opener.c ../tfv_utils.h $(CC) $(CFLAGS) -c tfv_opener.c @@ -115,12 +121,14 @@ 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_info.o tfv_opener.o tfv_sprites.o tfv_textentry.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_info.o tfv_opener.o tfv_sprites.o tfv_textentry.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 \ $(GR_SIM) diff --git a/gr-sim/tfv/tfv_game_over.c b/gr-sim/tfv/tfv_game_over.c new file mode 100644 index 00000000..d5c8275b --- /dev/null +++ b/gr-sim/tfv/tfv_game_over.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include + +#include "gr-sim.h" +#include "tfv_utils.h" +#include "tfv_zp.h" +#include "tfv_defines.h" + +#include "tfv_backgrounds.h" + +void game_over(void) { + + text(); + home(); + + /* Make a box around it? */ + + vtab(12); + htab(15); + move_cursor(); + print("GAME OVER"); + + /* play the GROAN sound? */ + + page_flip(); + + repeat_until_keypressed(); +} diff --git a/gr-sim/tfv/tfv_help.c b/gr-sim/tfv/tfv_help.c new file mode 100644 index 00000000..178245c9 --- /dev/null +++ b/gr-sim/tfv/tfv_help.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +#include "gr-sim.h" +#include "tfv_utils.h" +#include "tfv_zp.h" +#include "tfv_defines.h" + +#include "tfv_backgrounds.h" + + +void print_help(void) { + + clear_top_a(0xa0); + + soft_switch(TXTSET); + +// htab(1); +// vtab(1); +// move_cursor(); + +/* +*************************************** +* HELP * +* * +* ARROWS - MOVE * +* W/A/S/D - MOVE * +* Z/X - SPEED UP / SLOW DOWN * +* SPACE - STOP * +* RETURN - LAND / ENTER / ACTION * +* I - INVENTORY * +* M - MAP * +* ESC - QUIT * +* * +*************************************** +*/ + ram[CV]=1; + ram[CH]=18; + move_and_print("HELP"); + + ram[CV]=3; + ram[CH]=4; move_and_print("ARROWS - MOVE"); + ram[CV]++; move_and_print("W/A/S/D - MOVE"); + ram[CV]++; move_and_print("Z/X - SPEED UP / SLOW DOWN"); + ram[CV]++; move_and_print("SPACE - STOP"); + ram[CV]++; move_and_print("RETURN - LAND / ENTER / ACTION"); + ram[CV]++; move_and_print("I - INVENTORY"); + ram[CV]++; move_and_print("M - MAP"); + ram[CV]++; move_and_print("ESC - QUIT"); + + page_flip(); + + repeat_until_keypressed(); + + soft_switch(TXTCLR); +} + + + diff --git a/gr-sim/tfv/tfv_info.c b/gr-sim/tfv/tfv_info.c index 5e8c53f7..06873609 100644 --- a/gr-sim/tfv/tfv_info.c +++ b/gr-sim/tfv/tfv_info.c @@ -10,98 +10,6 @@ #include "tfv_backgrounds.h" -void game_over(void) { - - text(); - home(); - - /* Make a box around it? */ - - vtab(12); - htab(15); - move_cursor(); - print("GAME OVER"); - - /* play the GROAN sound? */ - - page_flip(); - - repeat_until_keypressed(); -} - -void print_help(void) { - - clear_top_a(0xa0); - - soft_switch(TXTSET); - -// htab(1); -// vtab(1); -// move_cursor(); - -/* -*************************************** -* HELP * -* * -* ARROWS - MOVE * -* W/A/S/D - MOVE * -* Z/X - SPEED UP / SLOW DOWN * -* SPACE - STOP * -* RETURN - LAND / ENTER / ACTION * -* I - INVENTORY * -* M - MAP * -* ESC - QUIT * -* * -*************************************** -*/ - ram[CV]=1; - ram[CH]=18; - move_and_print("HELP"); - - ram[CV]=3; - ram[CH]=4; move_and_print("ARROWS - MOVE"); - ram[CV]++; move_and_print("W/A/S/D - MOVE"); - ram[CV]++; move_and_print("Z/X - SPEED UP / SLOW DOWN"); - ram[CV]++; move_and_print("SPACE - STOP"); - ram[CV]++; move_and_print("RETURN - LAND / ENTER / ACTION"); - ram[CV]++; move_and_print("I - INVENTORY"); - ram[CV]++; move_and_print("M - MAP"); - ram[CV]++; move_and_print("ESC - QUIT"); - - page_flip(); - - repeat_until_keypressed(); - - soft_switch(TXTCLR); -} - -void show_map(void) { - - gr(); - - grsim_unrle(map_rle,((int)ram[DRAW_PAGE]+0x4)<<8); - //gr_copy(0x800,0x400); - - color_equals(COLOR_RED); - - printf("plot(%d,%d)\n", - 8+((map_location&0x3)*6)+(tfv_x/6), - 8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); - - basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); - - - -// basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); - - ram[CH]=20; - ram[CV]=20; move_and_print(map_info[map_location].name); - - page_flip(); - - repeat_until_keypressed(); -} - /* 1 2 3 4 diff --git a/gr-sim/tfv/tfv_items.h b/gr-sim/tfv/tfv_items.h new file mode 100644 index 00000000..2c4084ed --- /dev/null +++ b/gr-sim/tfv/tfv_items.h @@ -0,0 +1,26 @@ +#define ITEM1_CUPCAKE 0x01 // cafeteria lady +#define ITEM1_CARROT 0x02 // capabara +#define ITEM1_SMARTPASS 0x03 // metro worker +#define ITEM1_ELF_RUNES 0x04 // mree +#define ITEM1_LIZBETH_STAR 0x05 // Lizbeth +#define ITEM1_KARTE_SPIEL 0x06 // Frau +#define ITEM1_GLAMDRING 0x07 // Gus +#define ITEM1_VEGEMITE 0x08 // Nicole + +// PARTS +#define ITEM_BLUE_LED 0x01 // bird +#define ITEM_RED_LED 0x02 // +#define ITEM_1K_RESISTOR 0x03 // brown black red, Elaine +#define ITEM_5K_RESISTOR 0x04 // yellow purple red, Tater +#define ITEM_9V_BATTERY 0x05 // Cindy +#define ITEM_AA_BATTERY 0x06 // Oscar +#define ITEM_LINUX_CD 0x07 // john +#define ITEM_ARMY_KNIFE 0x08 // Steve + + // Other possibilities +#define ITEM_CHEX_MIX 0x01 // oscar +#define ITEM_CLASS_RING 0x02 // + +extern char items[2][8][13]; + + diff --git a/gr-sim/tfv/tfv_map.c b/gr-sim/tfv/tfv_map.c new file mode 100644 index 00000000..c2f342a5 --- /dev/null +++ b/gr-sim/tfv/tfv_map.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +#include "gr-sim.h" +#include "tfv_utils.h" +#include "tfv_zp.h" +#include "tfv_defines.h" + +#include "tfv_backgrounds.h" + +void show_map(void) { + + gr(); + + grsim_unrle(map_rle,((int)ram[DRAW_PAGE]+0x4)<<8); + //gr_copy(0x800,0x400); + + color_equals(COLOR_RED); + + printf("plot(%d,%d)\n", + 8+((map_location&0x3)*6)+(tfv_x/6), + 8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); + + basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); + + + +// basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6)); + + ram[CH]=20; + ram[CV]=20; move_and_print(map_info[map_location].name); + + page_flip(); + + repeat_until_keypressed(); +} + + + +