mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-08-11 13:25:00 +00:00
tfv: work on having a unified worldmap definition
This commit is contained in:
@@ -62,8 +62,8 @@ 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_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
|
||||
@@ -83,7 +83,7 @@ tfv_textentry.o: tfv_textentry.c
|
||||
tfv_title.o: tfv_title.c ../tfv_utils.h tfv_backgrounds.h
|
||||
$(CC) $(CFLAGS) -c tfv_title.c
|
||||
|
||||
tfv_worldmap.o: tfv_worldmap.c
|
||||
tfv_worldmap.o: tfv_worldmap.c tfv_mapinfo.h
|
||||
$(CC) $(CFLAGS) -c tfv_worldmap.c
|
||||
|
||||
|
||||
@@ -97,12 +97,12 @@ 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_citymap.o tfv_flying.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_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_citymap.o tfv_flying.o \
|
||||
tfv_backgrounds.o tfv_battle.o tfv_flying.o \
|
||||
tfv_info.o tfv_opener.o tfv_sprites.o tfv_textentry.o \
|
||||
tfv_title.o tfv_worldmap.o \
|
||||
$(GR_SIM)
|
||||
|
@@ -20,7 +20,7 @@ unsigned char items1=0xff,items2=0xff;
|
||||
unsigned char steps=0;
|
||||
|
||||
/* location */
|
||||
unsigned char map_x=5;
|
||||
//unsigned char map_x=5;
|
||||
char tfv_x=15,tfv_y=19;
|
||||
unsigned char ground_color;
|
||||
|
||||
|
@@ -1,214 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gr-sim.h"
|
||||
#include "tfv_utils.h"
|
||||
#include "tfv_zp.h"
|
||||
|
||||
#include "tfv_sprites.h"
|
||||
#include "tfv_backgrounds.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
WORLDMAP_LOCATIONS
|
||||
COLLEGE_PARK
|
||||
HARFORD_COUNTY
|
||||
LANDING_SITE
|
||||
|
||||
umcp_rle
|
||||
"TALBOT HALL",X1,Y1,X2,Y2,TALBOT_HALL,
|
||||
"SOUTH CAMPUS DINING",X1,Y1,X2,Y2,SOUTH_CAMPUS,
|
||||
"METRO STATION",X1,Y1,X2,Y2,METRO_STATION,
|
||||
"FOUNTAIN" -- drink from it restore heatlh?
|
||||
|
||||
bel_air_rle
|
||||
"C. MILTON",
|
||||
"JOHN CARROLL",
|
||||
"SHOPPING MALL",
|
||||
"MINIGOLF",
|
||||
|
||||
jc_rle:
|
||||
"VIDEO HOMEROOM"
|
||||
"AP CALCULUS, TEAM I-1"
|
||||
"DEUTSCH"
|
||||
"HOMEROOM"
|
||||
"MATH OFFICE"
|
||||
|
||||
|
||||
dining_rle
|
||||
"OSCAR",
|
||||
"NICOLE",
|
||||
"CINDY",
|
||||
"ELAINE",
|
||||
"CAFETERIA LADY",
|
||||
"PATRIOT ROOM"
|
||||
|
||||
metro_rle:
|
||||
"METRO WORKER",
|
||||
"TINY CAPABARA",
|
||||
"GIANT GUINEA PIG",
|
||||
"LARGE BIRD",
|
||||
|
||||
talbot_rle:
|
||||
"LIZ AND WILL",
|
||||
"PETE",
|
||||
"KENJESU",
|
||||
"MATHEMAGICIAN",
|
||||
"DARTH TATER",
|
||||
|
||||
|
||||
math_office_rle:
|
||||
"CAPTAIN STEVE",
|
||||
"BRIGHID",
|
||||
"RACHAEL YRBK",
|
||||
"MREE",
|
||||
|
||||
video_hr_rle:
|
||||
"GUS",
|
||||
"RAISTLIN",
|
||||
"FORD",
|
||||
"SISTER SCARYNUN",
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* In Town */
|
||||
|
||||
int city_map(void) {
|
||||
|
||||
int ch;
|
||||
int direction=1;
|
||||
int newx=0,newy=0,moved;
|
||||
|
||||
gr();
|
||||
|
||||
color_equals(COLOR_BLACK);
|
||||
|
||||
direction=1;
|
||||
int odd=0;
|
||||
int refresh=1;
|
||||
|
||||
while(1) {
|
||||
moved=0;
|
||||
newx=tfv_x;
|
||||
newy=tfv_y;
|
||||
|
||||
ch=grsim_input();
|
||||
|
||||
if ((ch=='q') || (ch==27)) break;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch=='h') print_help();
|
||||
if (ch=='b') do_battle();
|
||||
if (ch=='i') print_info();
|
||||
if (ch=='m') {
|
||||
show_map();
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
|
||||
/* Collision detection + Movement */
|
||||
if (moved) {
|
||||
odd=!odd;
|
||||
steps++;
|
||||
|
||||
// if (collision(newx,newy+10,ground_color)) {
|
||||
// }
|
||||
// else {
|
||||
tfv_x=newx;
|
||||
tfv_y=newy;
|
||||
// }
|
||||
|
||||
if (tfv_x>36) {
|
||||
map_x++;
|
||||
tfv_x=0;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_x<=0) {
|
||||
map_x--;
|
||||
tfv_x=35;
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
if ((tfv_y<4) && (map_x>=4)) {
|
||||
map_x-=4;
|
||||
tfv_y=28;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_y>=28) {
|
||||
map_x+=4;
|
||||
tfv_y=4;
|
||||
refresh=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
grsim_unrle(umcp_rle,0xc00);
|
||||
refresh=0;
|
||||
}
|
||||
|
||||
gr_copy_to_current(0xc00);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
page_flip();
|
||||
|
||||
if (steps>=60) {
|
||||
steps=0;
|
||||
time_minutes++;
|
||||
if (time_minutes>=60) {
|
||||
time_hours++;
|
||||
time_minutes=0;
|
||||
}
|
||||
}
|
||||
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
67
gr-sim/tfv/tfv_defines.h
Normal file
67
gr-sim/tfv/tfv_defines.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* This is surprisngly similar to how I name cities in Civ4 */
|
||||
|
||||
#define NORTH_BEACH 0
|
||||
#define ARCTIC_WOODS 1
|
||||
#define ARCTIC_MOUNTAINS 2
|
||||
#define HARFORD_COUNTY 3
|
||||
#define PINE_BEACH 4
|
||||
#define LANDING_SITE 5
|
||||
#define NORTH_MOUNTAIN 6
|
||||
#define NORTH_FOREST 7
|
||||
#define PALM_BEACH 8
|
||||
#define GRASSLAND 9
|
||||
#define MORIA 10
|
||||
#define SOUTH_FOREST 11
|
||||
#define SOUTH_BEACH 12
|
||||
#define CACTUS_RANCH 13
|
||||
#define COLLEGE_PARK 14
|
||||
#define OCEAN_CITY 15
|
||||
|
||||
#define U_OF_MD 16
|
||||
#define WATERFALL 17
|
||||
#define TALBOT_HALL 18
|
||||
#define DINING_HALL 19
|
||||
#define METRO_STATION 20
|
||||
#define FOUNTAIN 21
|
||||
|
||||
#define BEL_AIR 22
|
||||
#define C_MILTON 23
|
||||
#define HARFORD_MALL 24
|
||||
#define MINIGOLF 25
|
||||
#define JOHN_CARROLL 26
|
||||
|
||||
#define VIDEO_HOMEROOM 27
|
||||
#define AP_CALCULUS 28
|
||||
#define DEUTSCH 29
|
||||
#define HOMEROOM 30
|
||||
#define MATH_OFFICE 31
|
||||
#define PATRIOT_ROOM 32
|
||||
#define MAIN_OFFICE 33
|
||||
|
||||
#define NOEXIT 255
|
||||
|
||||
struct location_type {
|
||||
char *name;
|
||||
int x0,x1,y0,y1;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct map_info_type {
|
||||
char *name;
|
||||
int num_locations;
|
||||
struct location_type locations[6];
|
||||
int ground_color;
|
||||
int n_exit,s_exit,e_exit,w_exit;
|
||||
int miny;
|
||||
};
|
||||
|
||||
extern struct map_info_type map_info[];
|
||||
|
||||
/* location */
|
||||
extern unsigned char map_location;
|
||||
extern char tfv_x,tfv_y;
|
||||
extern unsigned char ground_color;
|
||||
|
||||
extern char nameo[9];
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "gr-sim.h"
|
||||
#include "tfv_utils.h"
|
||||
#include "tfv_zp.h"
|
||||
#include "tfv_defines.h"
|
||||
|
||||
#include "tfv_backgrounds.h"
|
||||
|
||||
@@ -82,7 +83,10 @@ void show_map(void) {
|
||||
//gr_copy(0x800,0x400);
|
||||
|
||||
color_equals(COLOR_RED);
|
||||
basic_plot(8+((map_x&0x3)*6)+(tfv_x/6),8+(((map_x&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();
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
Map
|
||||
/* Map
|
||||
|
||||
0 1 2 3
|
||||
|
||||
@@ -16,88 +15,164 @@
|
||||
CACTUS PARK
|
||||
*/
|
||||
|
||||
/* This is surprisngly similar to how I name citties in Civ4 */
|
||||
|
||||
#define NORTH_BEACH 0
|
||||
#define ARCTIC_WOODS 1
|
||||
#define ARCTIC_MOUNTAINS 2
|
||||
#define BEL_AIR 3
|
||||
#define PINE_BEACH 4
|
||||
#define LANDING_SITE 5
|
||||
#define NORTH_MOUNTAIN 6
|
||||
#define NORTH_FOREST 7
|
||||
#define PALM_BEACH 8
|
||||
#define GRASSLAND 9
|
||||
#define MORIA 10
|
||||
#define SOUTH_FOREST 11
|
||||
#define SOUTH_BEACH 12
|
||||
#define CACTUS_RANCH 13
|
||||
#define COLLEGE_PARK 14
|
||||
#define OCEAN_CITY 15
|
||||
#define NOEXIT 255
|
||||
|
||||
struct location_type {
|
||||
char *name;
|
||||
int x0,x1,y0,y1;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct map_info_type {
|
||||
char *name;
|
||||
int num_locations;
|
||||
struct location_type locations[6];
|
||||
int floor_color;
|
||||
int n_exit,s_exit,e_exit,w_exit;
|
||||
int miny;
|
||||
} map_info[16] = {
|
||||
{
|
||||
struct map_info_type map_info[16] = {
|
||||
{ // NORTH_BEACH
|
||||
.name="North Beach",
|
||||
.n_exit=NOEXIT;
|
||||
.s_exit=PINE_BEACH;
|
||||
.e_exit=NOEXIT;
|
||||
.w_exit=ARTIC_WOODS:
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=PINE_BEACH,
|
||||
.e_exit=ARCTIC_WOODS,
|
||||
.w_exit=NOEXIT,
|
||||
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
|
||||
},
|
||||
{
|
||||
{ // ARCTIC_WOODS
|
||||
.name="Arctic Woods",
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=LANDING_SITE,
|
||||
.e_exit=ARCTIC_MOUNTAINS,
|
||||
.w_exit=NORTH_BEACH,
|
||||
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
|
||||
},
|
||||
{
|
||||
{ // ARCTIC_MOUNTAINS
|
||||
.name="Arctic Mountains",
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=NORTH_MOUNTAIN,
|
||||
.e_exit=HARFORD_COUNTY,
|
||||
.w_exit=ARCTIC_WOODS,
|
||||
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
|
||||
},
|
||||
{
|
||||
.name="Bel Air",
|
||||
{ // HARFORD_COUNTY
|
||||
.name="Harford County",
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=NORTH_FOREST,
|
||||
.e_exit=NOEXIT,
|
||||
.w_exit=ARCTIC_MOUNTAINS,
|
||||
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
|
||||
},
|
||||
{
|
||||
{ // PINE_BEACH
|
||||
.name="Pine Beach",
|
||||
.n_exit=NORTH_BEACH,
|
||||
.s_exit=PALM_BEACH,
|
||||
.e_exit=LANDING_SITE,
|
||||
.w_exit=NOEXIT,
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
{ // LANDING_SITE
|
||||
.name="Landing Site",
|
||||
.num_locations=1,
|
||||
// .locations
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
.n_exit=ARCTIC_WOODS,
|
||||
.s_exit=GRASSLAND,
|
||||
.e_exit=NORTH_MOUNTAIN,
|
||||
.w_exit=PINE_BEACH,
|
||||
.miny=0,
|
||||
},
|
||||
{
|
||||
.name="North Mountain",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="North Forest",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="Palm Beach",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="Grassland",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="Moria",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="South Forest",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="South Beach",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="Cactus Ranch",
|
||||
.ground_color=(COLOR_ORANGE|(COLOR_ORANGE<<4)),
|
||||
},
|
||||
{
|
||||
.name="College Park",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
{
|
||||
.name="Ocean City",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
||||
WORLDMAP_LOCATIONS
|
||||
COLLEGE_PARK
|
||||
HARFORD_COUNTY
|
||||
LANDING_SITE
|
||||
|
||||
umcp_rle
|
||||
"TALBOT HALL",X1,Y1,X2,Y2,TALBOT_HALL,
|
||||
"SOUTH CAMPUS DINING",X1,Y1,X2,Y2,SOUTH_CAMPUS,
|
||||
"METRO STATION",X1,Y1,X2,Y2,METRO_STATION,
|
||||
"FOUNTAIN" -- drink from it restore heatlh?
|
||||
mermaid. Did ye put bubbles in fountain?
|
||||
|
||||
bel_air_rle
|
||||
"C. MILTON",
|
||||
"JOHN CARROLL",
|
||||
"SHOPPING MALL",
|
||||
"MINIGOLF",
|
||||
|
||||
jc_rle:
|
||||
"VIDEO HOMEROOM"
|
||||
"AP CALCULUS, TEAM I-1"
|
||||
"DEUTSCH"
|
||||
"HOMEROOM"
|
||||
"MATH OFFICE"
|
||||
"PATRIOT ROOM"
|
||||
|
||||
|
||||
dining_rle
|
||||
"OSCAR",
|
||||
"NICOLE",
|
||||
"CINDY",
|
||||
"ELAINE",
|
||||
"CAFETERIA LADY",
|
||||
|
||||
metro_rle:
|
||||
"METRO WORKER",
|
||||
"TINY CAPABARA",
|
||||
"GIANT GUINEA PIG",
|
||||
"LARGE BIRD",
|
||||
|
||||
talbot_rle:
|
||||
"LIZ AND WILL",
|
||||
"PETE",
|
||||
"KENJESU",
|
||||
"MATHEMAGICIAN",
|
||||
"DARTH TATER",
|
||||
|
||||
|
||||
math_office_rle:
|
||||
"CAPTAIN STEVE",
|
||||
"BRIGHID",
|
||||
"RACHAEL YRBK",
|
||||
"MREE",
|
||||
|
||||
video_hr_rle:
|
||||
"GUS",
|
||||
"RAISTLIN",
|
||||
"FORD",
|
||||
"SISTER SCARYNUN",
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "gr-sim.h"
|
||||
#include "tfv_utils.h"
|
||||
#include "tfv_zp.h"
|
||||
#include "tfv_defines.h"
|
||||
|
||||
#include "tfv_sprites.h"
|
||||
#include "tfv_backgrounds.h"
|
||||
|
@@ -6,12 +6,16 @@
|
||||
#include "gr-sim.h"
|
||||
#include "tfv_utils.h"
|
||||
#include "tfv_zp.h"
|
||||
#include "tfv_defines.h"
|
||||
|
||||
#include "tfv_sprites.h"
|
||||
#include "tfv_backgrounds.h"
|
||||
|
||||
#include "tfv_mapinfo.h"
|
||||
|
||||
unsigned char map_location=LANDING_SITE;
|
||||
|
||||
|
||||
/* In Town */
|
||||
|
||||
|
||||
@@ -27,27 +31,6 @@
|
||||
/* Play music, lightning effects? */
|
||||
/* TFV only hit for one damage, susie for 100 */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Map
|
||||
|
||||
0 1 2 3
|
||||
|
||||
0 BEACH ARCTIC ARCTIC BELAIR
|
||||
TREE MOUNATIN
|
||||
|
||||
1 BEACH LANDING GRASS FOREST
|
||||
PINETREE MOUNTAIN
|
||||
|
||||
2 BEACH GRASS GRASS FOREST
|
||||
PALMTREE MOUNTAIN
|
||||
|
||||
3 BEACH DESERT COLLEGE BEACH
|
||||
CACTUS PARK
|
||||
*/
|
||||
|
||||
/* Walk through bushes, beach water */
|
||||
/* Make landing a sprite? Stand behind things? */
|
||||
|
||||
@@ -57,19 +40,19 @@ static int load_map_bg(void) {
|
||||
int i,temp;
|
||||
int start,end;
|
||||
|
||||
ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4));
|
||||
ground_color=map_info[map_location].ground_color;
|
||||
|
||||
if (map_x==3) {
|
||||
if (map_location==HARFORD_COUNTY) {
|
||||
grsim_unrle(harfco_rle,0xc00);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (map_x==5) {
|
||||
if (map_location==LANDING_SITE) {
|
||||
grsim_unrle(landing_rle,0xc00);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (map_x==14) {
|
||||
if (map_location==COLLEGE_PARK) {
|
||||
grsim_unrle(collegep_rle,0xc00);
|
||||
return 0;
|
||||
}
|
||||
@@ -81,12 +64,8 @@ static int load_map_bg(void) {
|
||||
hlin_double(PAGE2,0,39,i);
|
||||
}
|
||||
|
||||
if (map_x<4) ground_color=(COLOR_WHITE|(COLOR_WHITE<<4));
|
||||
else if (map_x==13) ground_color=(COLOR_ORANGE|(COLOR_ORANGE<<4));
|
||||
else ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4));
|
||||
|
||||
/* grassland/sloped left beach */
|
||||
if ((map_x&3)==0) {
|
||||
if ((map_location&3)==0) {
|
||||
for(i=10;i<40;i+=2) {
|
||||
temp=4+(39-i)/8;
|
||||
color_equals(COLOR_DARKBLUE);
|
||||
@@ -101,7 +80,7 @@ static int load_map_bg(void) {
|
||||
}
|
||||
|
||||
/* Grassland */
|
||||
if ((map_x&3)==1) {
|
||||
if ((map_location&3)==1) {
|
||||
for(i=10;i<40;i+=2) {
|
||||
color_equals(ground_color);
|
||||
hlin_double(PAGE2,0,39,i);
|
||||
@@ -109,7 +88,7 @@ static int load_map_bg(void) {
|
||||
}
|
||||
|
||||
/* Mountain */
|
||||
if ((map_x&3)==2) {
|
||||
if ((map_location&3)==2) {
|
||||
for(i=10;i<40;i+=2) {
|
||||
color_equals(ground_color);
|
||||
hlin_double(PAGE2,0,39,i);
|
||||
@@ -117,7 +96,7 @@ static int load_map_bg(void) {
|
||||
}
|
||||
|
||||
/* Right Beach */
|
||||
if ((map_x&3)==3) {
|
||||
if ((map_location&3)==3) {
|
||||
for(i=10;i<40;i+=2) {
|
||||
temp=24+(i/4); /* 26 ... 33 */
|
||||
color_equals(ground_color);
|
||||
@@ -133,28 +112,28 @@ static int load_map_bg(void) {
|
||||
}
|
||||
|
||||
/* Draw north shore */
|
||||
if (map_x<4) {
|
||||
if (map_location<4) {
|
||||
color_equals(COLOR_DARKBLUE);
|
||||
hlin_double(PAGE2,0,39,10);
|
||||
}
|
||||
|
||||
/* Draw south shore */
|
||||
if (map_x>=12) {
|
||||
if (map_location>=12) {
|
||||
start=0; end=39;
|
||||
color_equals(COLOR_DARKBLUE);
|
||||
hlin_double(PAGE2,0,39,38);
|
||||
color_equals(COLOR_LIGHTBLUE);
|
||||
if (map_x==12) start=6;
|
||||
if (map_x==15) end=35;
|
||||
if (map_location==12) start=6;
|
||||
if (map_location==15) end=35;
|
||||
hlin_double(PAGE2,start,end,36);
|
||||
if (map_x==12) start=8;
|
||||
if (map_x==15) end=32;
|
||||
if (map_location==12) start=8;
|
||||
if (map_location==15) end=32;
|
||||
color_equals(COLOR_YELLOW);
|
||||
hlin_double(PAGE2,start,end,34);
|
||||
}
|
||||
|
||||
/* Mountains */
|
||||
if ((map_x&3)==2) {
|
||||
if ((map_location&3)==2) {
|
||||
for(i=0;i<4;i++) {
|
||||
grsim_put_sprite_page(PAGE2,mountain,10+(i%2)*5,(i*8)+2);
|
||||
}
|
||||
@@ -189,7 +168,7 @@ int world_map(void) {
|
||||
direction=1;
|
||||
int odd=0;
|
||||
int refresh=1;
|
||||
int on_bird=1;
|
||||
int on_bird=0;
|
||||
|
||||
while(1) {
|
||||
moved=0;
|
||||
@@ -259,23 +238,23 @@ int world_map(void) {
|
||||
// }
|
||||
|
||||
if (tfv_x>36) {
|
||||
map_x++;
|
||||
map_location++;
|
||||
tfv_x=0;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_x<=0) {
|
||||
map_x--;
|
||||
map_location--;
|
||||
tfv_x=35;
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
if ((tfv_y<4) && (map_x>=4)) {
|
||||
map_x-=4;
|
||||
if ((tfv_y<4) && (map_location>=4)) {
|
||||
map_location-=4;
|
||||
tfv_y=28;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_y>=28) {
|
||||
map_x+=4;
|
||||
map_location+=4;
|
||||
tfv_y=4;
|
||||
refresh=1;
|
||||
}
|
||||
@@ -295,15 +274,15 @@ int world_map(void) {
|
||||
|
||||
/* Draw Background Ground Scatter */
|
||||
|
||||
if (map_x==1) if (tfv_y>=22) grsim_put_sprite(snowy_tree,10,22);
|
||||
if (map_x==4) if (tfv_y>=15) grsim_put_sprite(pine_tree,25,16);
|
||||
if (map_x==8) if (tfv_y>=22) grsim_put_sprite(palm_tree,10,20);
|
||||
if (map_x==12) if (tfv_y>=22) grsim_put_sprite(palm_tree,20,20);
|
||||
if (map_x==13) if (tfv_y>=15) grsim_put_sprite(cactus,25,16);
|
||||
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);
|
||||
|
||||
|
||||
/* Draw Background Trees */
|
||||
if ((map_x==7) || (map_x==11)) {
|
||||
if ((map_location==7) || (map_location==11)) {
|
||||
for(i=10;i<tfv_y+8;i+=2) {
|
||||
limit=22+(i/4);
|
||||
color_equals(COLOR_DARKGREEN);
|
||||
@@ -333,13 +312,13 @@ int world_map(void) {
|
||||
}
|
||||
|
||||
/* Draw Below Ground Scatter */
|
||||
if (map_x==1) if (tfv_y<22) grsim_put_sprite(snowy_tree,10,22);
|
||||
if (map_x==4) if (tfv_y<15) grsim_put_sprite(pine_tree,25,16);
|
||||
if (map_x==8) if (tfv_y<22) grsim_put_sprite(palm_tree,10,20);
|
||||
if (map_x==12) if (tfv_y<22) grsim_put_sprite(palm_tree,20,20);
|
||||
if (map_x==13) if (tfv_y<15) grsim_put_sprite(cactus,25,16);
|
||||
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);
|
||||
|
||||
if ((map_x==7) || (map_x==11)) {
|
||||
if ((map_location==7) || (map_location==11)) {
|
||||
|
||||
/* Draw Below Forest */
|
||||
for(i=tfv_y+8;i<36;i+=2) {
|
||||
@@ -366,7 +345,7 @@ int world_map(void) {
|
||||
|
||||
}
|
||||
|
||||
if (map_x==3) {
|
||||
if (map_location==3) {
|
||||
if ((steps&0xf)==0) {
|
||||
grsim_put_sprite(lightning,25,4);
|
||||
/* Hurt hit points if in range? */
|
||||
@@ -395,3 +374,135 @@ int world_map(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* In Town */
|
||||
|
||||
int city_map(void) {
|
||||
|
||||
int ch;
|
||||
int direction=1;
|
||||
int newx=0,newy=0,moved;
|
||||
|
||||
gr();
|
||||
|
||||
color_equals(COLOR_BLACK);
|
||||
|
||||
direction=1;
|
||||
int odd=0;
|
||||
int refresh=1;
|
||||
|
||||
while(1) {
|
||||
moved=0;
|
||||
newx=tfv_x;
|
||||
newy=tfv_y;
|
||||
|
||||
ch=grsim_input();
|
||||
|
||||
if ((ch=='q') || (ch==27)) break;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch=='h') print_help();
|
||||
if (ch=='b') do_battle();
|
||||
if (ch=='i') print_info();
|
||||
if (ch=='m') {
|
||||
show_map();
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
|
||||
/* Collision detection + Movement */
|
||||
if (moved) {
|
||||
odd=!odd;
|
||||
steps++;
|
||||
|
||||
// if (collision(newx,newy+10,ground_color)) {
|
||||
// }
|
||||
// else {
|
||||
tfv_x=newx;
|
||||
tfv_y=newy;
|
||||
// }
|
||||
|
||||
if (tfv_x>36) {
|
||||
map_location++;
|
||||
tfv_x=0;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_x<=0) {
|
||||
map_location--;
|
||||
tfv_x=35;
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
if ((tfv_y<4) && (map_location>=4)) {
|
||||
map_location-=4;
|
||||
tfv_y=28;
|
||||
refresh=1;
|
||||
}
|
||||
else if (tfv_y>=28) {
|
||||
map_location+=4;
|
||||
tfv_y=4;
|
||||
refresh=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
grsim_unrle(umcp_rle,0xc00);
|
||||
refresh=0;
|
||||
}
|
||||
|
||||
gr_copy_to_current(0xc00);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
page_flip();
|
||||
|
||||
if (steps>=60) {
|
||||
steps=0;
|
||||
time_minutes++;
|
||||
if (time_minutes>=60) {
|
||||
time_hours++;
|
||||
time_minutes=0;
|
||||
}
|
||||
}
|
||||
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -49,12 +49,6 @@ extern unsigned char time_hours,time_minutes;
|
||||
extern unsigned char items1,items2;
|
||||
extern unsigned char steps;
|
||||
|
||||
/* location */
|
||||
extern unsigned char map_x;
|
||||
extern char tfv_x,tfv_y;
|
||||
extern unsigned char ground_color;
|
||||
|
||||
extern char nameo[9];
|
||||
|
||||
struct fixed_type {
|
||||
char i;
|
||||
|
Reference in New Issue
Block a user