tfv: add entrypoint support

is a lot harder to get stuck in scenery now
This commit is contained in:
Vince Weaver 2018-06-22 14:16:50 -04:00
parent a8635e7f1f
commit dd7d0ec8af
5 changed files with 94 additions and 18 deletions

View File

@ -52,6 +52,7 @@
struct location_type {
char *name;
int x0,x1,y0,y1;
int enter_x,enter_y;
int type;
int destination;
};
@ -73,6 +74,18 @@ struct location_type {
#define SCATTER_CACTUS 0x08
#define SCATTER_SPOOL 0x10
#define ENTRY_NORMAL 0x00
#define ENTRY_EXPLICIT 0x01
#define ENTRY_CENTER 0x02
#define ENTRY_R_OR_L 0x04
#define ENTRY_MINX 0x08
#define ENTRY_MAXX 0x10
#define ENTRY_MINY 0x20
#define ENTRY_MAXY 0x40
struct map_info_type {
char *name;
int land_type;
@ -83,6 +96,7 @@ struct map_info_type {
int miny;
int scatter;
int scatter_x,scatter_y,scatter_cutoff;
int entry_type,entry_x,entry_y;
unsigned char *background_image;
};

View File

@ -27,6 +27,7 @@ struct map_info_type map_info[33] = {
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_LEFT_BEACH|LAND_NORTHSHORE,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[ARCTIC_WOODS]={ // 1: ARCTIC_WOODS
@ -40,6 +41,7 @@ struct map_info_type map_info[33] = {
.land_type=LAND_GRASSLAND|LAND_NORTHSHORE,
.scatter=SCATTER_SNOWYPINE,
.scatter_x=10, .scatter_y=22, .scatter_cutoff=22,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[ARCTIC_MOUNTAINS]={ // 2: ARCTIC_MOUNTAINS
@ -52,6 +54,7 @@ struct map_info_type map_info[33] = {
.ground_color=(COLOR_WHITE|(COLOR_WHITE<<4)),
.land_type=LAND_MOUNTAIN|LAND_NORTHSHORE,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[HARFORD_COUNTY]={ // 3: HARFORD_COUNTY
@ -64,6 +67,7 @@ struct map_info_type map_info[33] = {
.ground_color=(COLOR_LIGHTBLUE|(COLOR_LIGHTBLUE<<4)),
.land_type=LAND_LIGHTNING,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=harfco_rle,
.num_locations=1,
.location[0] = {
@ -84,6 +88,7 @@ struct map_info_type map_info[33] = {
.scatter=SCATTER_PINE,
.scatter_x=25, .scatter_y=16, .scatter_cutoff=15,
.land_type=LAND_LEFT_BEACH,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[LANDING_SITE]={ // 5: LANDING_SITE
@ -98,6 +103,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_GRASSLAND,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=landing_rle,
},
[NORTH_MOUNTAIN]={ // 6: NORTH_MOUNTAIN
@ -110,6 +116,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_MOUNTAIN,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[NORTH_FOREST]={ // 7: NORTH_FOREST
@ -122,6 +129,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_FOREST|LAND_RIGHT_BEACH,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[PALM_BEACH]={ // 8: PALM_BEACH
@ -135,6 +143,7 @@ struct map_info_type map_info[33] = {
.scatter=SCATTER_PALM,
.scatter_x=10, .scatter_y=20, .scatter_cutoff=22,
.land_type=LAND_LEFT_BEACH,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[GRASSLAND]={ // 9: GRASSLAND
@ -147,6 +156,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_GRASSLAND,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[MORIA]={ // 10: MORIA
@ -159,6 +169,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_MOUNTAIN,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[SOUTH_FOREST]={ // 11: SOUTH_FOREST
@ -171,6 +182,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_FOREST|LAND_RIGHT_BEACH,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[SOUTH_BEACH]={ // 12: SOUTH_BEACH
@ -184,6 +196,7 @@ struct map_info_type map_info[33] = {
.scatter=SCATTER_PALM,
.scatter_x=20, .scatter_y=20, .scatter_cutoff=22,
.land_type=LAND_LEFT_BEACH|LAND_SOUTHSHORE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[CACTUS_RANCH]={ // 13: CACTUS_RANCH
@ -197,6 +210,7 @@ struct map_info_type map_info[33] = {
.scatter=SCATTER_CACTUS,
.scatter_x=25, .scatter_y=16, .scatter_cutoff=15,
.land_type=LAND_GRASSLAND|LAND_SOUTHSHORE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[COLLEGE_PARK]={ // 14: COLLEGE_PARK
@ -208,6 +222,7 @@ struct map_info_type map_info[33] = {
.w_exit=CACTUS_RANCH,
.miny=2,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_MAXY, .entry_x=0, .entry_y=6,
.background_image=collegep_rle,
.num_locations=2,
.location[0] = {
@ -233,6 +248,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_RIGHT_BEACH|LAND_SOUTHSHORE,
.entry_type=ENTRY_NORMAL, .entry_x=0, .entry_y=0,
.background_image=NULL,
},
[U_OF_MD]={ // 16: U of MD
@ -245,6 +261,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_BORING,
.entry_type=ENTRY_R_OR_L, .entry_x=0, .entry_y=0,
.background_image=umcp_rle,
.num_locations=4,
.location[0] = {
@ -286,19 +303,21 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_BORING,
.entry_type=ENTRY_EXPLICIT, .entry_x=4, .entry_y=14,
.background_image=waterfall_rle,
},
[TALBOT_HALL]={ // 18: Talbot Hall
.name="Talbot Hall",
.ground_color=(COLOR_BLACK|(COLOR_BLACK<<4)),
.n_exit=NOEXIT,
.s_exit=NOEXIT,
.e_exit=U_OF_MD,
.w_exit=U_OF_MD,
.s_exit=U_OF_MD,
.e_exit=NOEXIT,
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_SPOOL,
.scatter_x=16, .scatter_y=22, .scatter_cutoff=22,
.land_type=LAND_BORING,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=talbot_rle,
.num_locations=5,
.location[0] = {
@ -325,14 +344,14 @@ struct map_info_type map_info[33] = {
.location[3] = {
.name="Mathemagician",
.x0 = 28, .x1 = 34,
.y0 = 20, .y1 = 26,
.y0 = 20, .y1 = 28,
//.destination = TALBOT_HALL,
.type=LOCATION_CONVERSATION,
},
.location[4] = {
.name="Darth Tater",
.x0 = 28, .x1 = 36,
.y0 = 26, .y1 = 38,
.y0 = 30, .y1 = 38,
//.destination = TALBOT_HALL,
.type=LOCATION_CONVERSATION,
},
@ -341,12 +360,13 @@ struct map_info_type map_info[33] = {
.name="Dining Hall",
.ground_color=(COLOR_BLACK|(COLOR_BLACK<<4)),
.n_exit=NOEXIT,
.s_exit=NOEXIT,
.e_exit=U_OF_MD,
.w_exit=U_OF_MD,
.s_exit=U_OF_MD,
.e_exit=NOEXIT,
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_BORING,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=dining_rle,
.num_locations=5,
.location[0] = {
@ -384,23 +404,24 @@ struct map_info_type map_info[33] = {
.name="Metro Station",
.ground_color=(COLOR_BLACK|(COLOR_BLACK<<4)),
.n_exit=NOEXIT,
.s_exit=NOEXIT,
.e_exit=U_OF_MD,
.w_exit=U_OF_MD,
.s_exit=U_OF_MD,
.e_exit=NOEXIT,
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_BORING,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=metro_rle,
.num_locations=4,
.location[0] = {
.name="Station Master",
.x0 = 12, .x1 = 18,
.x0 = 10, .x1 = 16,
.y0 = 26, .y1 = 35,
.type=LOCATION_CONVERSATION,
},
.location[1] = {
.name="Large Bird",
.x0 = 29, .x1 = 33,
.x0 = 26, .x1 = 33,
.y0 = 16, .y1 = 20,
.type=LOCATION_CONVERSATION,
},
@ -427,6 +448,7 @@ struct map_info_type map_info[33] = {
.miny=4,
.scatter=SCATTER_NONE,
.land_type=LAND_BORING,
.entry_type=ENTRY_EXPLICIT, .entry_x=4, .entry_y=14,
.background_image=fountain_rle,
.num_locations=1,
.location[0] = {
@ -445,6 +467,7 @@ struct map_info_type map_info[33] = {
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=belair_rle,
.num_locations=4,
.location[0] = {
@ -462,7 +485,7 @@ struct map_info_type map_info[33] = {
.location[2] = {
.name="Harford Mall",
.x0 = 25, .x1 = 32,
.y0 = 22, .y1 = 30,
.y0 = 22, .y1 = 28,
.type=LOCATION_CONVERSATION,
},
.location[3] = {
@ -481,6 +504,7 @@ struct map_info_type map_info[33] = {
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=jc_rle,
.num_locations=3,
.location[0] = {
@ -514,6 +538,7 @@ struct map_info_type map_info[33] = {
.w_exit=JOHN_CARROLL,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=jc_hallway_rle,
.num_locations=3,
.location[0] = {
@ -547,6 +572,7 @@ struct map_info_type map_info[33] = {
.w_exit=JOHN_CARROLL,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=jc_hallway_rle,
.num_locations=3,
.location[0] = {
@ -580,8 +606,9 @@ struct map_info_type map_info[33] = {
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=video_hr_rle,
.num_locations=3,
.num_locations=4,
.location[0] = {
.name="Gus",
.x0 = 10, .x1 = 16,
@ -602,8 +629,8 @@ struct map_info_type map_info[33] = {
},
.location[3] = {
.name="Sister Scarynun",
.x0 = 22, .x1 = 28,
.y0 = 21, .y1 = 34,
.x0 = 26, .x1 = 32,
.y0 = 30, .y1 = 39,
.type=LOCATION_CONVERSATION,
},
},
@ -616,8 +643,9 @@ struct map_info_type map_info[33] = {
.w_exit=NOEXIT,
.miny=4,
.scatter=SCATTER_NONE,
.entry_type=ENTRY_CENTER, .entry_x=0, .entry_y=0,
.background_image=math_office_rle,
.num_locations=3,
.num_locations=4,
.location[0] = {
.name="Rachael YRBK",
.x0 = 0, .x1 = 8,

View File

@ -145,6 +145,7 @@ int world_map(void) {
direction=1;
int odd=0;
int refresh=1;
int entry=0;
int on_bird=0;
while(1) {
@ -194,6 +195,7 @@ int world_map(void) {
if (special_destination!=NOEXIT) {
map_location=special_destination;
}
entry=1;
refresh=1;
}
@ -208,6 +210,34 @@ int world_map(void) {
refresh=1;
}
/* Handle entry to a new area */
if (entry) {
printf("Entering!\n");
if (map_info[map_location].entry_type&ENTRY_R_OR_L) {
if (tfv_x<20) newx=10;
else newx=30;
newy=26;
}
if (map_info[map_location].entry_type&ENTRY_EXPLICIT) {
newx=map_info[map_location].entry_x;
newy=map_info[map_location].entry_y;
}
if (map_info[map_location].entry_type&ENTRY_CENTER) {
newx=19;
newy=26;
}
if (map_info[map_location].entry_type&ENTRY_MAXY) {
if (newy>map_info[map_location].entry_y) {
newy=map_info[map_location].entry_y;
}
}
entry=0;
//moved=1;
printf("Newx=%d,Newy=%d\n",newx,newy);
tfv_x=newx; tfv_y=newy;
}
/* Collision detection + Movement */
if (moved) {
@ -219,6 +249,7 @@ int world_map(void) {
map_location=map_info[map_location].e_exit;
tfv_x=1;
refresh=1;
entry=1;
}
}
else if (newx<=0) {
@ -226,6 +257,7 @@ int world_map(void) {
map_location=map_info[map_location].w_exit;
tfv_x=35;
refresh=1;
entry=1;
}
}
else if (newy<map_info[map_location].miny) {
@ -233,6 +265,7 @@ int world_map(void) {
map_location=map_info[map_location].n_exit;
tfv_y=26;
refresh=1;
entry=1;
}
}
else if (newy>=28) {
@ -240,6 +273,7 @@ int world_map(void) {
map_location=map_info[map_location].s_exit;
tfv_y=4;
refresh=1;
entry=1;
}
}
else if ((scrn_page(newx+1,newy+11,8)==

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B