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