tfv: more making the worldmap display generic

This commit is contained in:
Vince Weaver 2018-06-18 12:48:41 -04:00
parent ba13283425
commit f7092abe2c
3 changed files with 138 additions and 31 deletions

View File

@ -53,7 +53,14 @@ struct location_type {
#define LAND_RIGHT_BEACH 0x10
#define LAND_NORTHSHORE 0x20
#define LAND_SOUTHSHORE 0x40
#define LAND_LIGHTNING 0x80
#define SCATTER_NONE 0x00
#define SCATTER_SNOWYPINE 0x01
#define SCATTER_PINE 0x02
#define SCATTER_PALM 0x04
#define SCATTER_CACTUS 0x08
#define SCATTER_SPOOL 0x10
struct map_info_type {
char *name;
@ -63,6 +70,8 @@ struct map_info_type {
int ground_color;
int n_exit,s_exit,e_exit,w_exit;
int miny;
int scatter;
int scatter_x,scatter_y,scatter_cutoff;
unsigned char *background_image;
};

View File

@ -17,56 +17,69 @@
struct map_info_type map_info[16] = {
{ // NORTH_BEACH
{ // 0: NORTH_BEACH
.name="North Beach",
.n_exit=NOEXIT,
.s_exit=PINE_BEACH,
.e_exit=ARCTIC_WOODS,
.w_exit=NOEXIT,
.miny=4,
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_LEFT_BEACH|LAND_NORTHSHORE,
.scatter=SCATTER_NONE,
.background_image=NULL,
},
{ // ARCTIC_WOODS
{ // 1: ARCTIC_WOODS
.name="Arctic Woods",
.n_exit=NOEXIT,
.s_exit=LANDING_SITE,
.e_exit=ARCTIC_MOUNTAINS,
.w_exit=NORTH_BEACH,
.miny=4,
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_GRASSLAND|LAND_NORTHSHORE,
.scatter=SCATTER_SNOWYPINE,
.scatter_x=10, .scatter_y=22, .scatter_cutoff=22,
.background_image=NULL,
},
{ // ARCTIC_MOUNTAINS
{ // 2: ARCTIC_MOUNTAINS
.name="Arctic Mountains",
.n_exit=NOEXIT,
.s_exit=NORTH_MOUNTAIN,
.e_exit=HARFORD_COUNTY,
.w_exit=ARCTIC_WOODS,
.miny=4,
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_MOUNTAIN|LAND_NORTHSHORE,
.scatter=SCATTER_NONE,
.background_image=NULL,
},
{ // HARFORD_COUNTY
{ // 3: HARFORD_COUNTY
.name="Harford County",
.n_exit=NOEXIT,
.s_exit=NORTH_FOREST,
.e_exit=NOEXIT,
.w_exit=ARCTIC_MOUNTAINS,
.miny=4,
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_LIGHTNING,
.scatter=SCATTER_NONE,
.background_image=harfco_rle,
},
{ // PINE_BEACH
{ // 4: PINE_BEACH
.name="Pine Beach",
.n_exit=NORTH_BEACH,
.s_exit=PALM_BEACH,
.e_exit=LANDING_SITE,
.w_exit=NOEXIT,
.miny=4,
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.scatter=SCATTER_PINE,
.scatter_x=25, .scatter_y=16, .scatter_cutoff=15,
.land_type=LAND_LEFT_BEACH,
.background_image=NULL,
},
{ // LANDING_SITE
{ // 5: LANDING_SITE
.name="Landing Site",
.num_locations=1,
// .locations
@ -76,10 +89,11 @@ struct map_info_type map_info[16] = {
.e_exit=NORTH_MOUNTAIN,
.w_exit=PINE_BEACH,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_GRASSLAND,
.background_image=landing_rle,
},
{
{ // 6: NORTH_MOUNTAIN
.name="North Mountain",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=ARCTIC_MOUNTAINS,
@ -87,10 +101,11 @@ struct map_info_type map_info[16] = {
.e_exit=NORTH_FOREST,
.w_exit=LANDING_SITE,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_MOUNTAIN,
.background_image=NULL,
},
{
{ // 7: NORTH_FOREST
.name="North Forest",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=HARFORD_COUNTY,
@ -98,10 +113,11 @@ struct map_info_type map_info[16] = {
.e_exit=NOEXIT,
.w_exit=NORTH_MOUNTAIN,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_FOREST|LAND_RIGHT_BEACH,
.background_image=NULL,
},
{
{ // 8: PALM_BEACH
.name="Palm Beach",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=PINE_BEACH,
@ -109,10 +125,12 @@ struct map_info_type map_info[16] = {
.e_exit=GRASSLAND,
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_PALM,
.scatter_x=10, .scatter_y=20, .scatter_cutoff=22,
.land_type=LAND_LEFT_BEACH,
.background_image=NULL,
},
{
{ // 9: GRASSLAND
.name="Grassland",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=LANDING_SITE,
@ -120,10 +138,11 @@ struct map_info_type map_info[16] = {
.e_exit=MORIA,
.w_exit=PALM_BEACH,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_GRASSLAND,
.background_image=NULL,
},
{
{ // 10: MORIA
.name="Khazad-dum",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=NORTH_MOUNTAIN,
@ -131,10 +150,11 @@ struct map_info_type map_info[16] = {
.e_exit=SOUTH_FOREST,
.w_exit=GRASSLAND,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_MOUNTAIN,
.background_image=NULL,
},
{
{ // 11: SOUTH_FOREST
.name="South Forest",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=NORTH_FOREST,
@ -142,10 +162,11 @@ struct map_info_type map_info[16] = {
.e_exit=NOEXIT,
.w_exit=MORIA,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_FOREST|LAND_RIGHT_BEACH,
.background_image=NULL,
},
{
{ // 12: SOUTH_BEACH
.name="South Beach",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=PALM_BEACH,
@ -153,10 +174,12 @@ struct map_info_type map_info[16] = {
.e_exit=CACTUS_RANCH,
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_PALM,
.scatter_x=20, .scatter_y=20, .scatter_cutoff=22,
.land_type=LAND_LEFT_BEACH|LAND_SOUTHSHORE,
.background_image=NULL,
},
{
{ // 13: CACTUS_RANCH
.name="Cactus Ranch",
.ground_color=(COLOR_ORANGE|(COLOR_ORANGE<<4)),
.n_exit=GRASSLAND,
@ -164,10 +187,12 @@ struct map_info_type map_info[16] = {
.e_exit=COLLEGE_PARK,
.w_exit=SOUTH_BEACH,
.miny=4,
.scatter=SCATTER_CACTUS,
.scatter_x=25, .scatter_y=16, .scatter_cutoff=15,
.land_type=LAND_GRASSLAND|LAND_SOUTHSHORE,
.background_image=NULL,
},
{
{ // 14: COLLEGE_PARK
.name="College Park",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=MORIA,
@ -175,9 +200,10 @@ struct map_info_type map_info[16] = {
.e_exit=OCEAN_CITY,
.w_exit=CACTUS_RANCH,
.miny=4,
.scatter=SCATTER_NONE,
.background_image=collegep_rle,
},
{
{ // 15: OCEAN_CITY
.name="Ocean City",
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
.n_exit=SOUTH_FOREST,
@ -185,6 +211,7 @@ struct map_info_type map_info[16] = {
.e_exit=NOEXIT,
.w_exit=COLLEGE_PARK,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_RIGHT_BEACH|LAND_SOUTHSHORE,
.background_image=NULL,
},

View File

@ -268,16 +268,51 @@ int world_map(void) {
gr_copy_to_current(0xc00);
/* Draw Background Ground Scatter */
if ((map_info[map_location].scatter) &&
(tfv_y>=map_info[map_location].scatter_cutoff)) {
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_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);
}
if (map_info[map_location].scatter&SCATTER_CACTUS) {
grsim_put_sprite(cactus,
map_info[map_location].scatter_x,
map_info[map_location].scatter_y);
}
}
#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
/* Draw Background Trees */
if ((map_location==7) || (map_location==11)) {
if (map_info[map_location].land_type&LAND_FOREST) {
for(i=10;i<tfv_y+8;i+=2) {
limit=22+(i/4);
color_equals(COLOR_DARKGREEN);
@ -307,13 +342,51 @@ int world_map(void) {
}
/* Draw Below Ground Scatter */
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_info[map_location].scatter) &&
(tfv_y<map_info[map_location].scatter_cutoff)) {
if ((map_location==7) || (map_location==11)) {
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);
}
if (map_info[map_location].scatter&SCATTER_CACTUS) {
grsim_put_sprite(cactus,
map_info[map_location].scatter_x,
map_info[map_location].scatter_y);
}
}
#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) {
/* Draw Below Forest */
for(i=tfv_y+8;i<36;i+=2) {
@ -335,12 +408,10 @@ int world_map(void) {
color_equals(COLOR_BROWN);
hlin_double_continue(1);
}
}
}
if (map_location==3) {
if (map_info[map_location].land_type&LAND_LIGHTNING) {
if ((steps&0xf)==0) {
grsim_put_sprite(lightning,25,4);
/* Hurt hit points if in range? */