2017-08-16 18:46:45 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gr-sim.h"
|
|
|
|
#include "tfv_utils.h"
|
|
|
|
#include "tfv_zp.h"
|
2018-06-13 04:32:46 +00:00
|
|
|
#include "tfv_defines.h"
|
2017-08-16 18:46:45 +00:00
|
|
|
|
|
|
|
#include "tfv_sprites.h"
|
|
|
|
#include "tfv_backgrounds.h"
|
|
|
|
|
2018-06-12 04:44:34 +00:00
|
|
|
#include "tfv_mapinfo.h"
|
|
|
|
|
2018-06-13 04:32:46 +00:00
|
|
|
unsigned char map_location=LANDING_SITE;
|
|
|
|
|
2017-08-16 18:46:45 +00:00
|
|
|
/* Puzzle Room */
|
|
|
|
/* Get through office */
|
|
|
|
/* Have to run away? What happens if die? No save game? Code? */
|
|
|
|
|
|
|
|
/* Construct the LED circuit */
|
|
|
|
/* Zaps through cloud */
|
|
|
|
/* Susie joins your party */
|
|
|
|
|
|
|
|
/* Final Battle */
|
|
|
|
/* Play music, lightning effects? */
|
|
|
|
/* TFV only hit for one damage, susie for 100 */
|
|
|
|
|
|
|
|
|
2017-09-13 03:24:44 +00:00
|
|
|
/* Load background to 0xc00 */
|
2017-08-16 18:46:45 +00:00
|
|
|
static int load_map_bg(void) {
|
|
|
|
|
|
|
|
int i,temp;
|
|
|
|
int start,end;
|
|
|
|
|
2018-06-13 04:32:46 +00:00
|
|
|
ground_color=map_info[map_location].ground_color;
|
2017-08-16 18:46:45 +00:00
|
|
|
|
2018-06-15 04:08:15 +00:00
|
|
|
/* Load background image, if applicable */
|
|
|
|
if (map_info[map_location].background_image) {
|
|
|
|
grsim_unrle(map_info[map_location].background_image,0xc00);
|
2017-08-16 18:46:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sky */
|
|
|
|
color_equals(COLOR_MEDIUMBLUE);
|
|
|
|
for(i=0;i<10;i+=2) {
|
2017-09-13 18:32:08 +00:00
|
|
|
hlin_double(PAGE2,0,39,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* grassland/sloped left beach */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_LEFT_BEACH) {
|
2017-11-19 03:52:25 +00:00
|
|
|
for(i=10;i<40;i+=2) {
|
|
|
|
temp=4+(39-i)/8;
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_DARKBLUE);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double(PAGE2,0,temp,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_LIGHTBLUE);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(2);
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_YELLOW);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(2);
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(ground_color);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(35-temp);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Grassland */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_GRASSLAND) {
|
2017-08-16 18:46:45 +00:00
|
|
|
for(i=10;i<40;i+=2) {
|
|
|
|
color_equals(ground_color);
|
2017-09-13 18:32:08 +00:00
|
|
|
hlin_double(PAGE2,0,39,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mountain */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_MOUNTAIN) {
|
2017-08-16 18:46:45 +00:00
|
|
|
for(i=10;i<40;i+=2) {
|
|
|
|
color_equals(ground_color);
|
2017-09-13 18:32:08 +00:00
|
|
|
hlin_double(PAGE2,0,39,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-19 03:52:25 +00:00
|
|
|
/* Right Beach */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_RIGHT_BEACH) {
|
2017-11-19 03:52:25 +00:00
|
|
|
for(i=10;i<40;i+=2) {
|
|
|
|
temp=24+(i/4); /* 26 ... 33 */
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(ground_color);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double(PAGE2,0,temp,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_YELLOW);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(2); /* 28 ... 35 */
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_LIGHTBLUE);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(2); /* 30 ... 37 */
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_DARKBLUE);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double_continue(35-temp);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw north shore */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_NORTHSHORE) {
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_DARKBLUE);
|
2017-09-13 18:32:08 +00:00
|
|
|
hlin_double(PAGE2,0,39,10);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw south shore */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_SOUTHSHORE) {
|
2017-09-13 18:32:08 +00:00
|
|
|
start=0; end=39;
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_DARKBLUE);
|
2017-09-13 18:32:08 +00:00
|
|
|
hlin_double(PAGE2,0,39,38);
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_LIGHTBLUE);
|
2018-06-13 04:32:46 +00:00
|
|
|
if (map_location==12) start=6;
|
|
|
|
if (map_location==15) end=35;
|
2017-09-13 03:24:44 +00:00
|
|
|
hlin_double(PAGE2,start,end,36);
|
2018-06-13 04:32:46 +00:00
|
|
|
if (map_location==12) start=8;
|
|
|
|
if (map_location==15) end=32;
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_YELLOW);
|
2017-09-13 03:24:44 +00:00
|
|
|
hlin_double(PAGE2,start,end,34);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
2017-11-19 03:52:25 +00:00
|
|
|
/* Mountains */
|
2018-06-15 04:08:15 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_MOUNTAIN) {
|
2017-08-16 18:46:45 +00:00
|
|
|
for(i=0;i<4;i++) {
|
2017-09-13 03:24:44 +00:00
|
|
|
grsim_put_sprite_page(PAGE2,mountain,10+(i%2)*5,(i*8)+2);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int world_map(void) {
|
|
|
|
|
|
|
|
int ch;
|
|
|
|
int direction=1;
|
|
|
|
int i,limit;
|
|
|
|
int newx=0,newy=0,moved;
|
2018-06-18 21:02:13 +00:00
|
|
|
int special_destination=NOEXIT;
|
2017-08-16 18:46:45 +00:00
|
|
|
|
|
|
|
/************************************************/
|
|
|
|
/* Landed */
|
|
|
|
/************************************************/
|
|
|
|
|
|
|
|
gr();
|
|
|
|
|
|
|
|
color_equals(COLOR_BLACK);
|
|
|
|
|
|
|
|
direction=1;
|
|
|
|
int odd=0;
|
|
|
|
int refresh=1;
|
2018-06-13 04:32:46 +00:00
|
|
|
int on_bird=0;
|
2017-08-16 18:46:45 +00:00
|
|
|
|
|
|
|
while(1) {
|
|
|
|
moved=0;
|
|
|
|
newx=tfv_x;
|
|
|
|
newy=tfv_y;
|
|
|
|
|
|
|
|
ch=grsim_input();
|
|
|
|
|
|
|
|
if ((ch=='q') || (ch==27)) break;
|
|
|
|
|
2018-06-18 19:03:02 +00:00
|
|
|
if ((ch=='t')) {
|
|
|
|
for(i=0;i<12;i++) printf("scrn(%d,%d)=%d\n",
|
|
|
|
tfv_x+1,tfv_y+i,scrn_page(tfv_x+1,tfv_y+i,8));
|
|
|
|
}
|
|
|
|
|
2017-08-16 18:46:45 +00:00
|
|
|
if ((ch=='w') || (ch==APPLE_UP)) {
|
|
|
|
newy=tfv_y-2;
|
|
|
|
moved=1;
|
|
|
|
}
|
|
|
|
if ((ch=='s') || (ch==APPLE_DOWN)) {
|
|
|
|
newy=tfv_y+2;
|
|
|
|
moved=1;
|
|
|
|
}
|
|
|
|
if ((ch=='a') || (ch==APPLE_LEFT)) {
|
|
|
|
if (direction>0) {
|
|
|
|
direction=-1;
|
|
|
|
odd=0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newx=tfv_x-1;
|
|
|
|
moved=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ch=='d') || (ch==APPLE_RIGHT)) {
|
|
|
|
if (direction<0) {
|
|
|
|
direction=1;
|
|
|
|
odd=0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newx=tfv_x+1;
|
|
|
|
moved=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-14 19:12:38 +00:00
|
|
|
if (ch==13) {
|
2018-06-19 04:08:50 +00:00
|
|
|
if (special_destination!=NOEXIT) {
|
2018-06-18 21:02:13 +00:00
|
|
|
map_location=special_destination;
|
|
|
|
}
|
2017-09-14 19:12:38 +00:00
|
|
|
refresh=1;
|
|
|
|
}
|
|
|
|
|
2017-08-16 18:46:45 +00:00
|
|
|
if (ch=='h') print_help();
|
2017-09-19 04:43:17 +00:00
|
|
|
if (ch=='b') {
|
|
|
|
do_battle();
|
|
|
|
refresh=1;
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
if (ch=='i') print_info();
|
|
|
|
if (ch=='m') {
|
|
|
|
show_map();
|
|
|
|
refresh=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Collision detection + Movement */
|
|
|
|
if (moved) {
|
|
|
|
odd=!odd;
|
|
|
|
steps++;
|
|
|
|
|
2018-06-18 15:58:36 +00:00
|
|
|
if (newx>36) {
|
|
|
|
if (map_info[map_location].e_exit!=NOEXIT) {
|
|
|
|
map_location=map_info[map_location].e_exit;
|
2018-06-18 19:03:02 +00:00
|
|
|
tfv_x=1;
|
2018-06-18 15:58:36 +00:00
|
|
|
refresh=1;
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
2018-06-18 15:58:36 +00:00
|
|
|
else if (newx<=0) {
|
|
|
|
if (map_info[map_location].w_exit!=NOEXIT) {
|
|
|
|
map_location=map_info[map_location].w_exit;
|
|
|
|
tfv_x=35;
|
|
|
|
refresh=1;
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
2018-06-18 15:59:47 +00:00
|
|
|
else if (newy<map_info[map_location].miny) {
|
2018-06-18 15:58:36 +00:00
|
|
|
if (map_info[map_location].n_exit!=NOEXIT) {
|
|
|
|
map_location=map_info[map_location].n_exit;
|
2018-06-18 19:03:02 +00:00
|
|
|
tfv_y=26;
|
2018-06-18 15:58:36 +00:00
|
|
|
refresh=1;
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
2018-06-18 15:58:36 +00:00
|
|
|
else if (newy>=28) {
|
|
|
|
if (map_info[map_location].s_exit!=NOEXIT) {
|
|
|
|
map_location=map_info[map_location].s_exit;
|
|
|
|
tfv_y=4;
|
|
|
|
refresh=1;
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
2018-06-18 19:03:02 +00:00
|
|
|
else if ((scrn_page(newx+1,newy+11,8)==
|
|
|
|
(map_info[map_location].ground_color&
|
|
|
|
0xf)) &&
|
|
|
|
(scrn_page(newx+1,newy+11,8)==
|
|
|
|
(map_info[map_location].ground_color&
|
|
|
|
0xf))) {
|
|
|
|
|
2018-06-18 15:58:36 +00:00
|
|
|
tfv_x=newx;
|
|
|
|
tfv_y=newy;
|
|
|
|
}
|
2018-06-18 19:03:02 +00:00
|
|
|
else {
|
|
|
|
printf("scrn(%d,%d)==%d,scrn(%d,%d)==%d\n",
|
|
|
|
newx+1,newy+11,scrn_page(newx+1,newy+11,8),
|
|
|
|
newx+2,newy+11,scrn_page(newx+2,newy+11,8));
|
|
|
|
// make sad noise
|
|
|
|
}
|
2018-06-18 15:58:36 +00:00
|
|
|
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
2017-09-13 18:32:08 +00:00
|
|
|
if (refresh) {
|
2018-01-08 19:01:19 +00:00
|
|
|
int s;
|
|
|
|
s=ram[DRAW_PAGE];
|
|
|
|
ram[DRAW_PAGE]=PAGE2;
|
|
|
|
clear_bottom();
|
|
|
|
ram[DRAW_PAGE]=s;
|
2017-09-13 18:32:08 +00:00
|
|
|
load_map_bg();
|
|
|
|
refresh=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2017-11-19 03:52:25 +00:00
|
|
|
/* Draw Background Ground Scatter */
|
2018-06-18 16:48:41 +00:00
|
|
|
if ((map_info[map_location].scatter) &&
|
|
|
|
(tfv_y>=map_info[map_location].scatter_cutoff)) {
|
2017-09-13 18:32:08 +00:00
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
if (map_info[map_location].scatter&SCATTER_SNOWYPINE) {
|
|
|
|
grsim_put_sprite(snowy_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (map_info[map_location].scatter&SCATTER_PINE) {
|
|
|
|
grsim_put_sprite(pine_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (map_info[map_location].scatter&SCATTER_PALM) {
|
|
|
|
grsim_put_sprite(palm_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
2017-09-13 18:32:08 +00:00
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
if (map_info[map_location].scatter&SCATTER_CACTUS) {
|
|
|
|
grsim_put_sprite(cactus,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
2018-06-20 19:35:05 +00:00
|
|
|
if (map_info[map_location].scatter&SCATTER_SPOOL) {
|
|
|
|
grsim_put_sprite(spool,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
if (map_location==1) if (tfv_y>=22)
|
|
|
|
grsim_put_sprite(snowy_tree,10,22);
|
|
|
|
if (map_location==4) if (tfv_y>=15)
|
|
|
|
grsim_put_sprite(pine_tree,25,16);
|
|
|
|
if (map_location==8) if (tfv_y>=22)
|
|
|
|
grsim_put_sprite(palm_tree,10,20);
|
|
|
|
if (map_location==12) if (tfv_y>=22)
|
|
|
|
grsim_put_sprite(palm_tree,20,20);
|
|
|
|
if (map_location==13) if (tfv_y>=15)
|
|
|
|
grsim_put_sprite(cactus,25,16);
|
|
|
|
#endif
|
2017-09-13 18:32:08 +00:00
|
|
|
|
|
|
|
/* Draw Background Trees */
|
2018-06-18 16:48:41 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_FOREST) {
|
2017-09-13 18:32:08 +00:00
|
|
|
for(i=10;i<tfv_y+8;i+=2) {
|
|
|
|
limit=22+(i/4);
|
|
|
|
color_equals(COLOR_DARKGREEN);
|
|
|
|
hlin_double(ram[DRAW_PAGE],0,limit,i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-22 03:48:21 +00:00
|
|
|
if (on_bird) {
|
|
|
|
if (direction==-1) {
|
|
|
|
if (odd) grsim_put_sprite(bird_rider_walk_left,tfv_x,tfv_y);
|
|
|
|
else grsim_put_sprite(bird_rider_stand_left,tfv_x,tfv_y);
|
|
|
|
}
|
|
|
|
if (direction==1) {
|
|
|
|
if (odd) grsim_put_sprite(bird_rider_walk_right,tfv_x,tfv_y);
|
|
|
|
else grsim_put_sprite(bird_rider_stand_right,tfv_x,tfv_y);
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
2017-10-22 03:48:21 +00:00
|
|
|
else {
|
|
|
|
if (direction==-1) {
|
|
|
|
if (odd) grsim_put_sprite(tfv_walk_left,tfv_x,tfv_y);
|
|
|
|
else grsim_put_sprite(tfv_stand_left,tfv_x,tfv_y);
|
|
|
|
}
|
|
|
|
if (direction==1) {
|
|
|
|
if (odd) grsim_put_sprite(tfv_walk_right,tfv_x,tfv_y);
|
|
|
|
else grsim_put_sprite(tfv_stand_right,tfv_x,tfv_y);
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
2017-09-13 18:32:08 +00:00
|
|
|
/* Draw Below Ground Scatter */
|
2018-06-18 16:48:41 +00:00
|
|
|
if ((map_info[map_location].scatter) &&
|
|
|
|
(tfv_y<map_info[map_location].scatter_cutoff)) {
|
|
|
|
|
|
|
|
if (map_info[map_location].scatter&SCATTER_SNOWYPINE) {
|
|
|
|
grsim_put_sprite(snowy_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
if (map_info[map_location].scatter&SCATTER_PINE) {
|
|
|
|
grsim_put_sprite(pine_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (map_info[map_location].scatter&SCATTER_PALM) {
|
|
|
|
grsim_put_sprite(palm_tree,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (map_info[map_location].scatter&SCATTER_CACTUS) {
|
|
|
|
grsim_put_sprite(cactus,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
2018-06-20 19:35:05 +00:00
|
|
|
if (map_info[map_location].scatter&SCATTER_SPOOL) {
|
|
|
|
grsim_put_sprite(spool,
|
|
|
|
map_info[map_location].scatter_x,
|
|
|
|
map_info[map_location].scatter_y);
|
|
|
|
}
|
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (map_location==1) if (tfv_y<22)
|
|
|
|
grsim_put_sprite(snowy_tree,10,22);
|
|
|
|
if (map_location==4) if (tfv_y<15)
|
|
|
|
grsim_put_sprite(pine_tree,25,16);
|
|
|
|
if (map_location==8) if (tfv_y<22)
|
|
|
|
grsim_put_sprite(palm_tree,10,20);
|
|
|
|
if (map_location==12) if (tfv_y<22)
|
|
|
|
grsim_put_sprite(palm_tree,20,20);
|
|
|
|
if (map_location==13) if (tfv_y<15)
|
|
|
|
grsim_put_sprite(cactus,25,16);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (map_info[map_location].land_type&LAND_FOREST) {
|
2017-11-19 03:52:25 +00:00
|
|
|
|
2017-09-13 18:32:08 +00:00
|
|
|
/* Draw Below Forest */
|
2017-08-16 18:46:45 +00:00
|
|
|
for(i=tfv_y+8;i<36;i+=2) {
|
|
|
|
limit=22+(i/4);
|
|
|
|
color_equals(COLOR_DARKGREEN);
|
2017-09-13 03:24:44 +00:00
|
|
|
hlin_double(ram[DRAW_PAGE],0,limit,i);
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
|
2017-11-19 03:52:25 +00:00
|
|
|
int f;
|
2017-09-13 18:32:08 +00:00
|
|
|
/* Draw tree trunks */
|
2017-11-19 03:52:25 +00:00
|
|
|
for(f=36;f<40;f+=2) {
|
2017-09-13 18:32:08 +00:00
|
|
|
|
2017-08-16 18:46:45 +00:00
|
|
|
color_equals(COLOR_BROWN);
|
2017-11-19 03:52:25 +00:00
|
|
|
hlin_double(ram[DRAW_PAGE],0,0,f);
|
|
|
|
|
|
|
|
for(i=0;i<13;i++) {
|
|
|
|
color_equals(COLOR_GREY);
|
|
|
|
hlin_double_continue(1);
|
|
|
|
color_equals(COLOR_BROWN);
|
|
|
|
hlin_double_continue(1);
|
|
|
|
}
|
2017-08-16 18:46:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-18 16:48:41 +00:00
|
|
|
if (map_info[map_location].land_type&LAND_LIGHTNING) {
|
2017-08-16 18:46:45 +00:00
|
|
|
if ((steps&0xf)==0) {
|
2017-09-13 03:24:44 +00:00
|
|
|
grsim_put_sprite(lightning,25,4);
|
2017-08-16 18:46:45 +00:00
|
|
|
/* Hurt hit points if in range? */
|
|
|
|
if ((tfv_x>25) && (tfv_x<30) && (tfv_y<12)) {
|
|
|
|
printf("HIT! %d %d\n\n",steps,hp);
|
|
|
|
if (hp>11) {
|
|
|
|
hp=10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-18 21:02:13 +00:00
|
|
|
special_destination=NOEXIT;
|
|
|
|
for(i=0;i<map_info[map_location].num_locations;i++) {
|
2018-06-13 04:32:46 +00:00
|
|
|
|
2018-06-19 04:08:50 +00:00
|
|
|
if ( (tfv_x>=map_info[map_location].location[i].x0) &&
|
|
|
|
(tfv_x<=map_info[map_location].location[i].x1) &&
|
|
|
|
(tfv_y+11>=map_info[map_location].location[i].y0) &&
|
|
|
|
(tfv_y+11<=map_info[map_location].location[i].y1)) {
|
2018-06-13 04:32:46 +00:00
|
|
|
|
2018-06-19 04:08:50 +00:00
|
|
|
ram[CH]=(40-strlen(map_info[map_location].location[i].name))/2;
|
2018-06-18 21:02:13 +00:00
|
|
|
ram[CV]=20;
|
2018-06-19 04:08:50 +00:00
|
|
|
move_and_print(map_info[map_location].location[i].name);
|
2018-06-13 04:32:46 +00:00
|
|
|
|
2018-06-18 21:02:13 +00:00
|
|
|
special_destination=map_info[map_location].location[i].destination;
|
|
|
|
break;
|
2018-06-13 04:32:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
page_flip();
|
|
|
|
|
|
|
|
if (steps>=60) {
|
|
|
|
steps=0;
|
|
|
|
time_minutes++;
|
|
|
|
if (time_minutes>=60) {
|
|
|
|
time_hours++;
|
|
|
|
time_minutes=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
usleep(10000);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2018-06-18 21:02:13 +00:00
|
|
|
|
|
|
|
|