- Added code to check for waterfalls in all 8 cardinal directions
- Fixed bug in which swamp caused a false negative for the wall-rounding code - Made directions into an enum, with an operator++ and two difference arrays (for x and y). - Added case to wall-rounding code to handle a lone pillar of wall - The block_horse flag is cleared when importing a poison or disease terrain, because horses can now not cross status-inflicting terrain at all. - Added the book Finder icon git-svn-id: http://openexile.googlecode.com/svn/trunk@64 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
@@ -2499,6 +2499,91 @@ location get_cur_direction(Point the_point)
|
||||
return store_dir;
|
||||
}
|
||||
|
||||
eDirection find_waterfall(short x, short y, short mode){
|
||||
// If more than one waterfall adjacent, randomly selects
|
||||
bool to_dir[8];
|
||||
for(eDirection i = DIR_N; i < DIR_HERE; i++){
|
||||
if(mode == 0){
|
||||
to_dir[i] = (scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].special == TER_SPEC_WATERFALL);
|
||||
printf("%i\n",scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].flag1);
|
||||
if(scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].flag1 != i) to_dir[i] = false;
|
||||
}else{
|
||||
to_dir[i] = (scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].special == TER_SPEC_WATERFALL);
|
||||
if(scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].flag1 != i) to_dir[i] = false;
|
||||
}
|
||||
}
|
||||
short count = 0;
|
||||
for(int i = 0; i < 8; i++)
|
||||
count += to_dir[i];
|
||||
if(count > 0) count = get_ran(1,1,count);
|
||||
else return DIR_HERE;
|
||||
for(eDirection i = DIR_N; i < DIR_HERE; i++){
|
||||
if(to_dir[i]){
|
||||
count--;
|
||||
if(count == 0) return i;
|
||||
}
|
||||
}
|
||||
return DIR_HERE; // just in case something wonky happens
|
||||
}
|
||||
|
||||
void run_waterfalls(short mode){ // mode 0 - town, 1 - outdoors
|
||||
short x,y;
|
||||
if(mode == 0){
|
||||
x = univ.town.p_loc.x;
|
||||
y = univ.town.p_loc.y;
|
||||
}else{
|
||||
x = univ.party.p_loc.x;
|
||||
y = univ.party.p_loc.y;
|
||||
}
|
||||
eDirection dir;
|
||||
while((dir = find_waterfall(x,y,mode)) != DIR_HERE){
|
||||
add_string_to_buf(" Waterfall! ");
|
||||
if(mode == 0){
|
||||
x += 2 * dir_x_dif[dir];
|
||||
y += 2 * dir_y_dif[dir];
|
||||
univ.town.p_loc.x += 2 * dir_x_dif[dir];
|
||||
univ.town.p_loc.y += 2 * dir_y_dif[dir];
|
||||
update_explored(univ.party.p_loc);
|
||||
}else{
|
||||
x += 2 * dir_x_dif[dir];
|
||||
y += 2 * dir_y_dif[dir];
|
||||
univ.party.p_loc.x += 2 * dir_x_dif[dir];
|
||||
univ.party.loc_in_sec.x += 2 * dir_x_dif[dir];
|
||||
univ.party.p_loc.y += 2 * dir_y_dif[dir];
|
||||
univ.party.loc_in_sec.y += 2 * dir_y_dif[dir];
|
||||
update_explored(univ.party.p_loc);
|
||||
}
|
||||
draw_terrain();
|
||||
print_buf();
|
||||
if ((cave_lore_present() > 0) && (get_ran(1,0,1) == 0))
|
||||
add_string_to_buf(" (No supplies lost.)");
|
||||
else if (univ.party.food > 1800){
|
||||
add_string_to_buf(" (Many supplies lost.)");
|
||||
univ.party.food -= 50;
|
||||
}
|
||||
else {
|
||||
int n = univ.party.food;
|
||||
char s[25];
|
||||
univ.party.food = (univ.party.food * 19) / 20;
|
||||
sprintf(s," (%d supplies lost.)",n - univ.party.food);
|
||||
add_string_to_buf(s);
|
||||
}
|
||||
put_pc_screen();
|
||||
play_sound(28);
|
||||
pause(8);
|
||||
}
|
||||
if(mode == 0){
|
||||
univ.party.boats[univ.party.in_boat].loc = univ.town.p_loc;
|
||||
univ.party.boats[univ.party.in_boat].which_town = univ.town.num;
|
||||
}else{
|
||||
univ.party.boats[univ.party.in_boat].which_town = 200;
|
||||
univ.party.boats[univ.party.in_boat].loc_in_sec = univ.party.loc_in_sec;
|
||||
univ.party.boats[univ.party.in_boat].loc = univ.party.p_loc;
|
||||
univ.party.boats[univ.party.in_boat].sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
univ.party.boats[univ.party.in_boat].sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
}
|
||||
}
|
||||
|
||||
bool outd_move_party(location destination,bool forced)
|
||||
{
|
||||
char create_line[60];
|
||||
@@ -2628,6 +2713,10 @@ bool outd_move_party(location destination,bool forced)
|
||||
ASB("Your horses quite sensibly refuse.");
|
||||
return false;
|
||||
}
|
||||
if (scenario.ter_types[ter].special == TER_SPEC_DANGEROUS) {
|
||||
ASB("Your horses quite sensibly refuse.");
|
||||
return false;
|
||||
}
|
||||
|
||||
give_help(60,0,0);
|
||||
add_string_to_buf("Move: You mount the horses. ");
|
||||
@@ -2668,35 +2757,7 @@ bool outd_move_party(location destination,bool forced)
|
||||
num_out_moves++;
|
||||
|
||||
if (univ.party.in_boat >= 0) { // Waterfall!!!
|
||||
while (scenario.ter_types[univ.out[univ.party.p_loc.x][univ.party.p_loc.y + 1]].special == TER_SPEC_WATERFALL) { // TODO: Implement the 7 other possible directions
|
||||
add_string_to_buf(" Waterfall! ");
|
||||
univ.party.p_loc.y += 2;
|
||||
univ.party.loc_in_sec.y += 2;
|
||||
update_explored(univ.party.p_loc);
|
||||
draw_terrain();
|
||||
print_buf();
|
||||
if ((cave_lore_present() > 0) && (get_ran(1,0,1) == 0))
|
||||
add_string_to_buf(" (No supplies lost.)");
|
||||
else if (univ.party.food > 1800){
|
||||
add_string_to_buf(" (Many supplies lost.)");
|
||||
univ.party.food -= 50;
|
||||
}
|
||||
else {
|
||||
int n = univ.party.food;
|
||||
char s[25];
|
||||
univ.party.food = (univ.party.food * 19) / 20;
|
||||
sprintf(s," (%d supplies lost.)",n - univ.party.food);
|
||||
add_string_to_buf(s);
|
||||
}
|
||||
put_pc_screen();
|
||||
play_sound(28);
|
||||
pause(8);
|
||||
}
|
||||
univ.party.boats[univ.party.in_boat].which_town = 200;
|
||||
univ.party.boats[univ.party.in_boat].loc_in_sec = univ.party.loc_in_sec;
|
||||
univ.party.boats[univ.party.in_boat].loc = univ.party.p_loc;
|
||||
univ.party.boats[univ.party.in_boat].sector.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x;
|
||||
univ.party.boats[univ.party.in_boat].sector.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y;
|
||||
run_waterfalls(1);
|
||||
}
|
||||
if (univ.party.in_horse >= 0) {
|
||||
univ.party.horses[univ.party.in_horse].which_town = 200;
|
||||
@@ -2840,32 +2901,7 @@ bool town_move_party(location destination,short forced)////
|
||||
|
||||
if (univ.party.in_boat >= 0) {
|
||||
// Waterfall!!!
|
||||
while (scenario.ter_types[univ.town->terrain(destination.x,destination.y + 1)].special == TER_SPEC_WATERFALL) { // TODO: Implement the other 7 possible directions
|
||||
add_string_to_buf(" Waterfall! ");
|
||||
destination.y += 2;
|
||||
univ.town.p_loc.y += 2;
|
||||
update_explored(univ.party.p_loc);
|
||||
draw_terrain();
|
||||
print_buf();
|
||||
if ((cave_lore_present() > 0) && (get_ran(1,0,1) == 0))
|
||||
add_string_to_buf(" (No supplies lost.)");
|
||||
else if (univ.party.food > 1800){
|
||||
add_string_to_buf(" (Many supplies lost.)");
|
||||
univ.party.food -= 50;
|
||||
}
|
||||
else {
|
||||
int n = univ.party.food;
|
||||
char s[25];
|
||||
univ.party.food = (univ.party.food * 19) / 20;
|
||||
sprintf(s," (%d supplies lost.)",n - univ.party.food);
|
||||
add_string_to_buf(s);
|
||||
}
|
||||
put_pc_screen();
|
||||
play_sound(28);
|
||||
pause(8);
|
||||
}
|
||||
univ.party.boats[univ.party.in_boat].loc = univ.town.p_loc;
|
||||
univ.party.boats[univ.party.in_boat].which_town = univ.town.num;
|
||||
run_waterfalls(0);
|
||||
}
|
||||
if (univ.party.in_horse >= 0) {
|
||||
univ.party.horses[univ.party.in_horse].loc = univ.town.p_loc;
|
||||
|
@@ -160,14 +160,25 @@ enum eGameMode {
|
||||
#define STATUS_ACID 13
|
||||
|
||||
// Directions!
|
||||
#define DIR_N 0
|
||||
#define DIR_NE 1
|
||||
#define DIR_E 2
|
||||
#define DIR_SE 3
|
||||
#define DIR_S 4
|
||||
#define DIR_SW 5
|
||||
#define DIR_W 6
|
||||
#define DIR_NW 7
|
||||
enum eDirection {
|
||||
DIR_N = 0,
|
||||
DIR_NE = 1,
|
||||
DIR_E = 2,
|
||||
DIR_SE = 3,
|
||||
DIR_S = 4,
|
||||
DIR_SW = 5,
|
||||
DIR_W = 6,
|
||||
DIR_NW = 7,
|
||||
DIR_HERE = 8,
|
||||
};
|
||||
#ifndef DIR_ARRAY_DEF
|
||||
extern signed char dir_x_dif[9];
|
||||
extern signed char dir_y_dif[9];
|
||||
#endif
|
||||
inline eDirection& operator++ (eDirection& me,int){
|
||||
if(me == DIR_HERE) return me = DIR_N;
|
||||
else return me = (eDirection) (1 + (int) me);
|
||||
}
|
||||
|
||||
/* damage type*/
|
||||
/* used as parameter to some functions */
|
||||
|
@@ -2220,6 +2220,13 @@ void place_trim(short q,short r,location where,unsigned short ter_type)
|
||||
draw_trim(q,r,8,to_left);
|
||||
draw_trim(q,r,10,to_left);
|
||||
}
|
||||
|
||||
if (is_ground(to_right) && is_ground(below) && is_ground(to_left) && is_ground(above)) {
|
||||
draw_trim(q,r,8,to_left);
|
||||
draw_trim(q,r,9,to_right);
|
||||
draw_trim(q,r,10,to_left);
|
||||
draw_trim(q,r,11,to_right);
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
|
||||
//#include "item.h"
|
||||
|
||||
#define DIR_ARRAY_DEF
|
||||
#include "boe.global.h"
|
||||
#include "classes.h"
|
||||
|
||||
@@ -60,6 +61,8 @@ long start_time;
|
||||
|
||||
short on_spell_menu[2][62];
|
||||
short on_monst_menu[256];
|
||||
signed char dir_x_dif[9] = {0,1,1,1,0,-1,-1,-1,0};
|
||||
signed char dir_y_dif[9] = {-1,-1,0,1,1,1,0,-1,0};
|
||||
|
||||
// Cursors
|
||||
extern short current_cursor;
|
||||
|
BIN
osx/boeresources.icns
Normal file
BIN
osx/boeresources.icns
Normal file
Binary file not shown.
@@ -250,7 +250,8 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){
|
||||
trans_to_what = old.trans_to_what;
|
||||
fly_over = old.fly_over;
|
||||
boat_over = old.boat_over;
|
||||
block_horse = old.block_horse;
|
||||
if(special == TER_SPEC_DANGEROUS) block_horse = false; // because it's now redundant and unhelpful
|
||||
else block_horse = old.block_horse;
|
||||
light_radius = old.light_radius;
|
||||
step_sound = old.step_sound;
|
||||
shortcut_key = old.shortcut_key;
|
||||
|
Reference in New Issue
Block a user