tfv: split up the tfv definitions

This commit is contained in:
Vince Weaver 2018-07-07 15:18:08 -04:00
parent 55a377965c
commit 3d4d2a1e56
9 changed files with 283 additions and 37 deletions

View File

@ -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 \

View File

@ -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 */

View File

@ -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"

234
gr-sim/tfv/tfv_credits.c Normal file
View File

@ -0,0 +1,234 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#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_x<destination) {
letter_index++;
destination++;
letter_x=39;
}
out[0]=' '; out[1]=0;
print(out);
}
int credits(void) {
int yy,ch;
int i,fd;
grsim_init();
/* Text first */
text();
home();
ram[DISP_PAGE]=0x0;
ram[DRAW_PAGE]=0x0;
vtab(1); htab(1); move_cursor();
print(" * . ");
vtab(2); htab(1); move_cursor();
print(" * . T A L B O T . ");
vtab(3); htab(1); move_cursor();
print(" * F A N T A S Y ");
vtab(4); htab(1); move_cursor();
print(" * S E V E N ");
vtab(5); htab(1); move_cursor();
print(" . . . ");
vtab(6); htab(1); move_cursor();
print(" . ");
/* draw the moon */
vtab(1); htab(4); move_cursor(); print_inverse(" ");
vtab(2); htab(3); move_cursor(); print_inverse(" ");
vtab(3); htab(3); move_cursor(); print_inverse(" ");
vtab(4); htab(4); move_cursor(); print_inverse(" ");
while(1) {
grsim_update();
ch=grsim_input();
if (ch!=0) break;
usleep(100000);
}
/* gr part */
soft_switch(LORES); // LDA SW.LORES
soft_switch(TXTCLR); // LDA TXTCLR
soft_switch(MIXCLR);
color_equals(4);
for(i=28;i<48;i++) {
basic_hlin(0,39,i);
}
while(1) {
grsim_update();
ch=grsim_input();
if (ch!=0) break;
usleep(100000);
}
hgr();
/* Put horizontal lines on screen */
for(yy=64;yy<128;yy++) {
hcolor_equals(1);
hplot(0,yy);
hplot_to(279,yy);
}
fd=open("KATC.BIN",O_RDONLY);
if (fd<0) {
printf("Error opening!\n");
return -1;
}
read(fd,&ram[0x2000],0x2000);
close(fd);
while(1) {
grsim_update();
ch=grsim_input();
if (ch) break;
usleep(100000);
}
set_plaid();
int frame=0;
int tree1_x=28,tree1_y=28;
int tree2_x=37,tree2_y=30;
grsim_put_sprite_page(PAGE0,
bird_rider_stand_right,
17,30);
while(1) {
grsim_update();
color_equals(4);
for(i=28;i<48;i++) {
basic_hlin(0,39,i);
}
grsim_put_sprite_page(PAGE0,
small_tree,
tree1_x,tree1_y);
grsim_put_sprite_page(PAGE0,
big_tree,
tree2_x,tree2_y);
if (frame%8>4) {
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;
}

View File

@ -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);

View File

@ -9,6 +9,7 @@
#include "6502_emulate.h"
#include "tfv_utils.h"
#include "tfv_zp.h"
#include "tfv_definitions.h"
#include "tfv_sprites.h"

View File

@ -5,6 +5,7 @@
#include "tfv_utils.h"
#include "tfv_zp.h"
#include "tfv_defines.h"
#include "tfv_definitions.h"
#include "tfv_items.h"

View File

@ -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"

View File

@ -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);