mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-10 08:54:51 +00:00
tfv: add support for sub-levels
This commit is contained in:
parent
5059b4a805
commit
1396779bd2
@ -4,5 +4,6 @@ extern unsigned char landing_rle[];
|
||||
extern unsigned char collegep_rle[];
|
||||
extern unsigned char harfco_rle[];
|
||||
extern unsigned char umcp_rle[];
|
||||
|
||||
|
||||
extern unsigned char talbot_rle[];
|
||||
extern unsigned char metro_rle[];
|
||||
extern unsigned char dining_rle[];
|
||||
|
@ -44,8 +44,10 @@ struct location_type {
|
||||
char *name;
|
||||
int x0,x1,y0,y1;
|
||||
int type;
|
||||
int destination;
|
||||
};
|
||||
|
||||
#define LAND_BORING 0x00
|
||||
#define LAND_MOUNTAIN 0x01
|
||||
#define LAND_GRASSLAND 0x02
|
||||
#define LAND_FOREST 0x04
|
||||
@ -66,7 +68,7 @@ struct map_info_type {
|
||||
char *name;
|
||||
int land_type;
|
||||
int num_locations;
|
||||
struct location_type locations[6];
|
||||
struct location_type location[6];
|
||||
int ground_color;
|
||||
int n_exit,s_exit,e_exit,w_exit;
|
||||
int miny;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
|
||||
struct map_info_type map_info[16] = {
|
||||
struct map_info_type map_info[33] = {
|
||||
{ // 0: NORTH_BEACH
|
||||
.name="North Beach",
|
||||
.n_exit=NOEXIT,
|
||||
@ -202,6 +202,19 @@ struct map_info_type map_info[16] = {
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.background_image=collegep_rle,
|
||||
.num_locations=2,
|
||||
.location[0] = {
|
||||
.name="University of M",
|
||||
.x0 = 12, .x1 = 18,
|
||||
.y0 = 0, .y1 = 20,
|
||||
.destination = U_OF_MD,
|
||||
},
|
||||
.location[1] = {
|
||||
.name="Waterfall",
|
||||
.x0 = 27, .x1 = 39,
|
||||
.y0 = 18, .y1 = 33,
|
||||
.destination = WATERFALL,
|
||||
},
|
||||
},
|
||||
{ // 15: OCEAN_CITY
|
||||
.name="Ocean City",
|
||||
@ -215,6 +228,95 @@ struct map_info_type map_info[16] = {
|
||||
.land_type=LAND_RIGHT_BEACH|LAND_SOUTHSHORE,
|
||||
.background_image=NULL,
|
||||
},
|
||||
{ // 16: U of MD
|
||||
.name="University of M",
|
||||
.ground_color=(COLOR_LIGHTGREEN|(COLOR_LIGHTGREEN<<4)),
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=NOEXIT,
|
||||
.e_exit=COLLEGE_PARK,
|
||||
.w_exit=COLLEGE_PARK,
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.land_type=LAND_BORING,
|
||||
.background_image=umcp_rle,
|
||||
.num_locations=4,
|
||||
.location[0] = {
|
||||
.name="Talbot Hall",
|
||||
.x0 = 0, .x1 = 14,
|
||||
.y0 = 18, .y1 = 33,
|
||||
.destination = TALBOT_HALL,
|
||||
},
|
||||
.location[1] = {
|
||||
.name="Dining Hall",
|
||||
.x0 = 19, .x1 = 30,
|
||||
.y0 = 18, .y1 = 26,
|
||||
.destination = DINING_HALL,
|
||||
},
|
||||
.location[2] = {
|
||||
.name="Metro Station",
|
||||
.x0 = 32, .x1 = 39,
|
||||
.y0 = 18, .y1 = 39,
|
||||
.destination = METRO_STATION,
|
||||
},
|
||||
.location[3] = {
|
||||
.name="Fountain",
|
||||
.x0 = 13, .x1 = 29,
|
||||
.y0 = 28, .y1 = 39,
|
||||
.destination = FOUNTAIN,
|
||||
},
|
||||
},
|
||||
{ // 17: Waterfall
|
||||
.name="Waterfall",
|
||||
},
|
||||
{ // 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,
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.land_type=LAND_BORING,
|
||||
.background_image=talbot_rle,
|
||||
},
|
||||
{ // 19: Dining Hall
|
||||
.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,
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.land_type=LAND_BORING,
|
||||
.background_image=dining_rle,
|
||||
},
|
||||
{ // 20: METRO_STATION
|
||||
.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,
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.land_type=LAND_BORING,
|
||||
.background_image=metro_rle,
|
||||
},
|
||||
{ // 21: FOUNTAIN
|
||||
.name="Fountain",
|
||||
.ground_color=(COLOR_BLACK|(COLOR_BLACK<<4)),
|
||||
.n_exit=NOEXIT,
|
||||
.s_exit=NOEXIT,
|
||||
.e_exit=U_OF_MD,
|
||||
.w_exit=U_OF_MD,
|
||||
.miny=4,
|
||||
.scatter=SCATTER_NONE,
|
||||
.land_type=LAND_BORING,
|
||||
//.background_image=metro_rle,
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -132,6 +132,7 @@ int world_map(void) {
|
||||
int direction=1;
|
||||
int i,limit;
|
||||
int newx=0,newy=0,moved;
|
||||
int special_destination=NOEXIT;
|
||||
|
||||
/************************************************/
|
||||
/* Landed */
|
||||
@ -190,7 +191,9 @@ int world_map(void) {
|
||||
}
|
||||
|
||||
if (ch==13) {
|
||||
city_map();
|
||||
if (special_destination) {
|
||||
map_location=special_destination;
|
||||
}
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
@ -427,6 +430,26 @@ int world_map(void) {
|
||||
}
|
||||
}
|
||||
|
||||
special_destination=NOEXIT;
|
||||
for(i=0;i<map_info[map_location].num_locations;i++) {
|
||||
|
||||
if ( (tfv_x>map_info[map_location].location[i].x0) &&
|
||||
(tfv_x<map_info[map_location].location[i].x1) &&
|
||||
(tfv_y>map_info[map_location].location[i].y0) &&
|
||||
(tfv_y<map_info[map_location].location[i].y1)) {
|
||||
|
||||
ram[CH]=20;
|
||||
ram[CV]=20;
|
||||
move_and_print(map_info[map_location].name);
|
||||
|
||||
special_destination=map_info[map_location].location[i].destination;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
page_flip();
|
||||
|
||||
if (steps>=60) {
|
||||
@ -445,133 +468,3 @@ int world_map(void) {
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user