tfv: hookup random encounters

This commit is contained in:
Vince Weaver 2018-07-15 20:19:56 -04:00
parent 146ce14376
commit b631991726
2 changed files with 28 additions and 8 deletions

View File

@ -1,8 +1,15 @@
Known bugs:
+ When moving to new screen can get stuck or else wrap at weird offset
+ Weird glitch at top of screen when printing damage during battle
+ No sound/music on Linux version
+ Game starts with all items
+ It is not possible to trigger the final battle
+ Cannot save game
Soon:
+ Battle Sequence
--> Die if HP hits 0. On ground sprite
--> Fix weird glitch on damage printing
--> Sound effects
--> enemy uses magic
--> Enemy more likely to spawn on appropriate territory

View File

@ -17,7 +17,7 @@
#include "tfv_mapinfo.h"
static int random_encounters=1;
unsigned char map_location=LANDING_SITE;
@ -139,6 +139,13 @@ int world_map(void) {
int i,tree_limit;
int newx=0,newy=0,moved;
int special_destination=NOEXIT,destination_type=LOCATION_PLACE;
int next_encounter=20;
int odd=0;
int refresh=1;
int entry=0;
int on_bird=0;
int conversation_started=0;
int conversation_person=0;
/************************************************/
/* Landed */
@ -149,12 +156,7 @@ int world_map(void) {
color_equals(COLOR_BLACK);
direction=1;
int odd=0;
int refresh=1;
int entry=0;
int on_bird=0;
int conversation_started=0;
int conversation_person=0;
while(1) {
moved=0;
@ -191,6 +193,9 @@ int world_map(void) {
}
}
if ((ch=='d') || (ch==APPLE_RIGHT)) {
/* Update random seed */
random_8();
if (direction<0) {
direction=1;
odd=0;
@ -241,6 +246,14 @@ int world_map(void) {
refresh=1;
}
if (moved) {
if (random_encounters) next_encounter--;
if (next_encounter==0) {
do_battle(map_info[map_location].ground_color);
refresh=1;
next_encounter=20+(random_8()%32);
}
}
/* debugging routines */
if (ch=='b') {