mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-26 11:30:12 +00:00
tfv: allow entering city map
This commit is contained in:
parent
777dd60d66
commit
e70e694af8
@ -87,6 +87,9 @@ 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_flying.o: tfv_flying.c
|
||||
$(CC) $(CFLAGS) -c tfv_flying.c
|
||||
|
||||
@ -117,8 +120,8 @@ tfv_worldmap.o: tfv_worldmap.c
|
||||
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_flying.o tfv_info.o tfv_multiply.o tfv_opener.o tfv_sprites.o tfv_textentry.o tfv_title.o tfv_utils.o tfv_worldmap.o gr-sim.o
|
||||
$(CC) $(LFLAGS) $(SDL_LIBS) -o tfv tfv.o tfv_backgrounds.o tfv_battle.o tfv_flying.o tfv_info.o tfv_multiply.o tfv_opener.o tfv_sprites.o tfv_textentry.o tfv_title.o tfv_utils.o tfv_worldmap.o gr-sim.o
|
||||
tfv: tfv.o tfv_backgrounds.o tfv_battle.o tfv_citymap.o tfv_flying.o tfv_info.o tfv_multiply.o tfv_opener.o tfv_sprites.o tfv_textentry.o tfv_title.o tfv_utils.o tfv_worldmap.o gr-sim.o
|
||||
$(CC) $(LFLAGS) $(SDL_LIBS) -o tfv tfv.o tfv_backgrounds.o tfv_battle.o tfv_citymap.o tfv_flying.o tfv_info.o tfv_multiply.o tfv_opener.o tfv_sprites.o tfv_textentry.o tfv_title.o tfv_utils.o tfv_worldmap.o gr-sim.o
|
||||
|
||||
###
|
||||
|
||||
|
@ -3,6 +3,6 @@ extern unsigned char map_rle[];
|
||||
extern unsigned char landing_rle[];
|
||||
extern unsigned char collegep_rle[];
|
||||
extern unsigned char harfco_rle[];
|
||||
|
||||
extern unsigned char umcp_rle[];
|
||||
|
||||
|
||||
|
142
gr-sim/tfv_citymap.c
Normal file
142
gr-sim/tfv_citymap.c
Normal file
@ -0,0 +1,142 @@
|
||||
#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"
|
||||
|
||||
/* 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;
|
||||
}
|
@ -226,6 +226,11 @@ int world_map(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ch==13) {
|
||||
city_map();
|
||||
refresh=1;
|
||||
}
|
||||
|
||||
if (ch=='h') print_help();
|
||||
if (ch=='b') do_battle();
|
||||
if (ch=='i') print_info();
|
||||
|
@ -80,3 +80,6 @@ int name_screen(void);
|
||||
int do_battle(void);
|
||||
|
||||
int world_map(void);
|
||||
|
||||
int city_map(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user