2017-05-03 14:53:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2017-07-21 02:39:50 +00:00
|
|
|
#include <string.h>
|
2017-05-03 14:53:27 +00:00
|
|
|
|
|
|
|
#include "gr-sim.h"
|
2017-08-13 00:15:34 +00:00
|
|
|
#include "tfv_utils.h"
|
|
|
|
#include "tfv_zp.h"
|
2018-07-07 19:18:08 +00:00
|
|
|
#include "tfv_definitions.h"
|
2017-05-03 14:53:27 +00:00
|
|
|
|
2017-07-08 21:06:43 +00:00
|
|
|
#include "tfv_sprites.h"
|
2017-08-13 00:52:18 +00:00
|
|
|
#include "tfv_backgrounds.h"
|
2017-05-04 18:32:41 +00:00
|
|
|
|
2017-07-17 03:31:24 +00:00
|
|
|
/* stats */
|
2017-08-13 00:15:34 +00:00
|
|
|
unsigned char level=0;
|
2018-06-29 00:44:32 +00:00
|
|
|
unsigned char hp=100,max_hp=100;
|
|
|
|
unsigned char mp=50,max_mp=50;
|
2018-07-03 04:37:15 +00:00
|
|
|
unsigned char limit=1;
|
2017-08-13 00:15:34 +00:00
|
|
|
unsigned char money=0,experience=0;
|
|
|
|
unsigned char time_hours=0,time_minutes=0;
|
|
|
|
unsigned char items1=0xff,items2=0xff;
|
|
|
|
unsigned char steps=0;
|
2017-07-17 03:31:24 +00:00
|
|
|
|
2017-07-22 20:45:53 +00:00
|
|
|
/* location */
|
2018-06-13 04:32:46 +00:00
|
|
|
//unsigned char map_x=5;
|
2018-06-18 19:03:02 +00:00
|
|
|
char tfv_x=15,tfv_y=20; // tfv_y should always be even
|
2017-08-13 00:15:34 +00:00
|
|
|
unsigned char ground_color;
|
2017-07-08 21:06:43 +00:00
|
|
|
|
2017-08-13 19:38:49 +00:00
|
|
|
char nameo[9];
|
2017-07-08 21:06:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
2017-07-20 17:16:37 +00:00
|
|
|
int result;
|
|
|
|
|
2017-07-08 21:06:43 +00:00
|
|
|
grsim_init();
|
|
|
|
|
|
|
|
home();
|
|
|
|
gr();
|
|
|
|
|
2017-08-13 00:35:36 +00:00
|
|
|
/* Clear bottom of zero page */
|
|
|
|
apple_memset(&ram[0],0,16);
|
|
|
|
|
|
|
|
/* clear top page0 */
|
|
|
|
/* clear top page1 */
|
2018-01-08 19:01:19 +00:00
|
|
|
//clear_top(PAGE0);
|
|
|
|
//clear_top(PAGE1);
|
2017-08-13 00:35:36 +00:00
|
|
|
|
|
|
|
/* clear bottom page0 */
|
|
|
|
/* clear bottom page1 */
|
2018-01-08 19:01:19 +00:00
|
|
|
//clear_bottom(PAGE0);
|
|
|
|
//clear_bottom(PAGE1);
|
|
|
|
|
|
|
|
clear_screens();
|
2017-08-13 00:35:36 +00:00
|
|
|
|
2017-07-08 21:06:43 +00:00
|
|
|
/* Do Opening */
|
|
|
|
opening();
|
|
|
|
|
|
|
|
/* Title Screen */
|
2017-07-20 17:16:37 +00:00
|
|
|
title_loop:
|
|
|
|
result=title();
|
2018-07-07 19:18:08 +00:00
|
|
|
if (result==0) goto play_game;
|
|
|
|
if (result==1) credits();
|
|
|
|
goto title_loop;
|
2017-07-08 21:06:43 +00:00
|
|
|
|
2018-07-07 19:18:08 +00:00
|
|
|
|
|
|
|
play_game:
|
2017-07-21 02:39:50 +00:00
|
|
|
nameo[0]=0;
|
|
|
|
|
2017-07-08 21:06:43 +00:00
|
|
|
/* Get Name */
|
|
|
|
name_screen();
|
2017-07-21 02:39:50 +00:00
|
|
|
if (nameo[0]==0) {
|
|
|
|
strcpy(nameo,"DEATER");
|
|
|
|
}
|
2017-07-08 21:06:43 +00:00
|
|
|
|
|
|
|
/* Flying */
|
2017-07-20 18:06:13 +00:00
|
|
|
home();
|
2018-06-24 05:01:44 +00:00
|
|
|
back_to_flying:
|
2017-07-08 21:06:43 +00:00
|
|
|
flying();
|
|
|
|
|
|
|
|
/* World Map */
|
2018-06-24 05:01:44 +00:00
|
|
|
result=world_map();
|
|
|
|
|
|
|
|
if (result!=0) goto back_to_flying;
|
2017-07-08 21:06:43 +00:00
|
|
|
|
2017-07-10 04:39:38 +00:00
|
|
|
/* Game Over, Man */
|
|
|
|
game_over();
|
2017-07-08 21:06:43 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|