|
|
|
|
@@ -52,7 +52,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
scenario.num_towns, sizeof(short), sizeof(WORD));
|
|
|
|
|
give_error("The scenario tried to put you into a town that doesn't exist.",text,0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now adjust town number as necessary.
|
|
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
|
@@ -62,13 +62,13 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
{
|
|
|
|
|
former_town = town_number;
|
|
|
|
|
town_number += PSD[scenario.flag_to_add_to_town[i][0]][scenario.flag_to_add_to_town[i][1]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now update horses & boats
|
|
|
|
|
for (i = 0; i < 30; i++)
|
|
|
|
|
for (i = 0; i < 30; i++)
|
|
|
|
|
if ((party.horses[i].exists == TRUE) && (party.horses[i].which_town == former_town))
|
|
|
|
|
party.horses[i].which_town = town_number;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 30; i++)
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 30; i++)
|
|
|
|
|
if ((party.boats[i].exists == TRUE) && (party.boats[i].which_town == former_town))
|
|
|
|
|
party.boats[i].which_town = town_number;
|
|
|
|
|
}
|
|
|
|
|
@@ -78,7 +78,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
give_error("The scenario tried to put you into a town that doesn't exist.","2",0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overall_mode = MODE_TOWN;
|
|
|
|
|
|
|
|
|
|
load_town(town_number,0,0,NULL);
|
|
|
|
|
@@ -98,25 +98,25 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
c_town.explored[i][j] = 0;
|
|
|
|
|
if (town_maps.town_maps[c_town.town_num][i / 8][j] & (char)(s_pow(2,i % 8)))
|
|
|
|
|
make_explored(i,j);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* if (t_d.terrain[i][j] == 0) current_ground = 0;
|
|
|
|
|
else if (t_d.terrain[i][j] == 2) current_ground = 2;*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((scenario.ter_types[t_d.terrain[i][j]].special >= 16) &&
|
|
|
|
|
(scenario.ter_types[t_d.terrain[i][j]].special <= 19))
|
|
|
|
|
belt_present = TRUE;
|
|
|
|
|
belt_present = TRUE;
|
|
|
|
|
}
|
|
|
|
|
c_town.hostile = 0;
|
|
|
|
|
c_town.monst.which_town = town_number;
|
|
|
|
|
c_town.monst.friendly = 0;
|
|
|
|
|
|
|
|
|
|
at_which_save_slot = party.at_which_save_slot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
if (town_number == party.creature_save[i].which_town) {
|
|
|
|
|
c_town.monst = party.creature_save[i];
|
|
|
|
|
monsters_loaded = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < T_M; j++) {
|
|
|
|
|
if (loc_off_act_area(c_town.monst.dudes[j].m_loc) == TRUE)
|
|
|
|
|
c_town.monst.dudes[j].active = 0;
|
|
|
|
|
@@ -124,7 +124,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
c_town.monst.dudes[j].active = 1;
|
|
|
|
|
c_town.monst.dudes[j].m_loc = t_d.creatures[j].start_loc;
|
|
|
|
|
c_town.monst.dudes[j].m_d.health = c_town.monst.dudes[j].m_d.m_health;
|
|
|
|
|
c_town.monst.dudes[j].m_d.mp = c_town.monst.dudes[j].m_d.max_mp;
|
|
|
|
|
c_town.monst.dudes[j].m_d.mp = c_town.monst.dudes[j].m_d.max_mp;
|
|
|
|
|
c_town.monst.dudes[j].m_d.morale = c_town.monst.dudes[j].m_d.m_morale;
|
|
|
|
|
for (k = 0; k < 15; k++)
|
|
|
|
|
c_town.monst.dudes[j].m_d.status[k] = 0;
|
|
|
|
|
@@ -132,7 +132,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
c_town.monst.dudes[j].active = 0;
|
|
|
|
|
monst_target[j] = 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now, travelling NPCs might have arrived. Go through and put them in.
|
|
|
|
|
// These should have protected status (i.e. spec1 >= 200, spec1 <= 204)
|
|
|
|
|
for (j = 0; j < T_M; j++) {
|
|
|
|
|
@@ -149,7 +149,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
c_town.monst.dudes[j].m_d.health = c_town.monst.dudes[j].m_d.m_health;
|
|
|
|
|
}
|
|
|
|
|
break ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now, appearing/disappearing monsters might have arrived/disappeared.
|
|
|
|
|
case 1:
|
|
|
|
|
if (day_reached(c_town.monst.dudes[j].monst_start.monster_time, c_town.monst.dudes[j].monst_start.time_code) == TRUE)
|
|
|
|
|
@@ -184,9 +184,9 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < town_size[town_type]; j++)
|
|
|
|
|
for (k = 0; k < town_size[town_type]; k++) { // now load in saved setup,
|
|
|
|
|
for (k = 0; k < town_size[town_type]; k++) { // now load in saved setup,
|
|
|
|
|
// except that barrels and crates restore to orig locs
|
|
|
|
|
temp = setup_save.setup[i][j][k] & 231;
|
|
|
|
|
|
|
|
|
|
@@ -274,11 +274,11 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
// where they cannot be
|
|
|
|
|
for (i = 0; i < T_M; i++) {
|
|
|
|
|
if (c_town.monst.dudes[i].active > 0)
|
|
|
|
|
if (((c_town.monst.dudes[i].m_d.x_width > 1) || (c_town.monst.dudes[i].m_d.y_width > 1)) &&
|
|
|
|
|
if (((c_town.monst.dudes[i].m_d.x_width > 1) || (c_town.monst.dudes[i].m_d.y_width > 1)) &&
|
|
|
|
|
(monst_can_be_there(c_town.monst.dudes[i].m_loc,i) == FALSE))
|
|
|
|
|
c_town.monst.dudes[i].active = 0;
|
|
|
|
|
c_town.monst.dudes[i].active = 0;
|
|
|
|
|
}
|
|
|
|
|
// Thrash town?
|
|
|
|
|
// Trash town?
|
|
|
|
|
if (party.m_killed[c_town.town_num] > c_town.town.max_num_monst) {
|
|
|
|
|
town_toast = TRUE;
|
|
|
|
|
add_string_to_buf("Area has been cleaned out.");
|
|
|
|
|
@@ -287,7 +287,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
if (day_reached(c_town.town.town_chop_time,c_town.town.town_chop_key) == TRUE){
|
|
|
|
|
//add_string_to_buf("Area has been abandoned.");
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if ((c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].active < 10) &&
|
|
|
|
|
if ((c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].active < 10) &&
|
|
|
|
|
(c_town.monst.dudes[i].attitude % 2 == 1))
|
|
|
|
|
c_town.monst.dudes[i].active += 10;
|
|
|
|
|
town_toast = TRUE;
|
|
|
|
|
@@ -297,7 +297,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if (c_town.monst.dudes[i].active >= 10)
|
|
|
|
|
c_town.monst.dudes[i].active -= 10;
|
|
|
|
|
else c_town.monst.dudes[i].active = 0;
|
|
|
|
|
else c_town.monst.dudes[i].active = 0;
|
|
|
|
|
}
|
|
|
|
|
if ((short) town_toast > 0)
|
|
|
|
|
special_queue[0].queued_special = c_town.town.spec_on_entry_if_dead;
|
|
|
|
|
@@ -307,13 +307,13 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
if ((c_town.monst.dudes[i].m_d.spec_skill == 12) &&
|
|
|
|
|
(c_town.monst.dudes[i].number != t_d.creatures[i].number))
|
|
|
|
|
c_town.monst.dudes[i].active = 0;
|
|
|
|
|
|
|
|
|
|
quickfire = FALSE;
|
|
|
|
|
crate = FALSE;
|
|
|
|
|
barrel = FALSE;
|
|
|
|
|
web = FALSE;
|
|
|
|
|
fire_barrier = FALSE;
|
|
|
|
|
force_barrier = FALSE;
|
|
|
|
|
|
|
|
|
|
quickfire = false;
|
|
|
|
|
crate = false;
|
|
|
|
|
barrel = false;
|
|
|
|
|
web = false;
|
|
|
|
|
fire_barrier = false;
|
|
|
|
|
force_barrier = false;
|
|
|
|
|
// Set up field booleans, correct for doors
|
|
|
|
|
for (j = 0; j < town_size[town_type]; j++)
|
|
|
|
|
for (k = 0; k < town_size[town_type]; k++) {
|
|
|
|
|
@@ -328,23 +328,23 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
if (is_force_barrier(j,k) == TRUE) force_barrier = TRUE;
|
|
|
|
|
if (is_quickfire(j,k) == TRUE) quickfire = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set up items, maybe place items already there
|
|
|
|
|
for (i = 0; i < NUM_TOWN_ITEMS; i++)
|
|
|
|
|
t_i.items[i] = return_dummy_item();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
|
if (scenario.store_item_towns[j] == town_number) {
|
|
|
|
|
for (i = 0; i < NUM_TOWN_ITEMS; i++)
|
|
|
|
|
t_i.items[i] = stored_items[j].items[i];
|
|
|
|
|
}
|
|
|
|
|
t_i.items[i] = stored_items[j].items[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 64; i++)
|
|
|
|
|
if ((c_town.town.preset_items[i].item_code >= 0)
|
|
|
|
|
if ((c_town.town.preset_items[i].item_code >= 0)
|
|
|
|
|
&& (((party.item_taken[c_town.town_num][i / 8] & s_pow(2,i % 8)) == 0) ||
|
|
|
|
|
(c_town.town.preset_items[i].always_there == TRUE))) {
|
|
|
|
|
for (j = 0; j < NUM_TOWN_ITEMS; j++)
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < NUM_TOWN_ITEMS; j++)
|
|
|
|
|
|
|
|
|
|
// place the preset item, if party hasn't gotten it already
|
|
|
|
|
if (t_i.items[j].variety == 0) {
|
|
|
|
|
t_i.items[j] = get_stored_item(c_town.town.preset_items[i].item_code);
|
|
|
|
|
@@ -359,34 +359,34 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (c_town.town.preset_items[i].property == TRUE)
|
|
|
|
|
t_i.items[j].item_properties = t_i.items[j].item_properties | 2;
|
|
|
|
|
if (town_toast == TRUE)
|
|
|
|
|
if (town_toast == TRUE)
|
|
|
|
|
t_i.items[j].item_properties = t_i.items[j].item_properties & 253;
|
|
|
|
|
if (c_town.town.preset_items[i].contained == TRUE)
|
|
|
|
|
t_i.items[j].item_properties = t_i.items[j].item_properties | 8;
|
|
|
|
|
t_i.items[j].is_special = i + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
j = NUM_TOWN_ITEMS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if (loc_off_act_area(c_town.monst.dudes[i].m_loc) == TRUE)
|
|
|
|
|
c_town.monst.dudes[i].active = 0;
|
|
|
|
|
for (i = 0; i < NUM_TOWN_ITEMS; i++)
|
|
|
|
|
if (loc_off_act_area(t_i.items[i].item_loc) == TRUE)
|
|
|
|
|
t_i.items[i].variety = 0;
|
|
|
|
|
|
|
|
|
|
t_i.items[i].variety = 0;
|
|
|
|
|
|
|
|
|
|
// Clean out unwanted monsters
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if (sd_legit(c_town.monst.dudes[i].monst_start.spec1,c_town.monst.dudes[i].monst_start.spec2) == TRUE) {
|
|
|
|
|
if (party.stuff_done[c_town.monst.dudes[i].monst_start.spec1][c_town.monst.dudes[i].monst_start.spec2] > 0)
|
|
|
|
|
c_town.monst.dudes[i].active = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
erase_specials();
|
|
|
|
|
make_town_trim(0);
|
|
|
|
|
|
|
|
|
|
@@ -400,20 +400,20 @@ void start_town_mode(short which_town, short entry_dir)
|
|
|
|
|
party.horses[party.in_horse].which_town = which_town;
|
|
|
|
|
party.horses[party.in_horse].horse_loc = c_town.p_loc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// End flying
|
|
|
|
|
if (party.stuff_done[305][1] > 0)
|
|
|
|
|
{
|
|
|
|
|
party.stuff_done[305][1] = 0;
|
|
|
|
|
party.stuff_done[305][1] = 0;
|
|
|
|
|
add_string_to_buf("You land, and enter. ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// No hostile monsters present.
|
|
|
|
|
party.stuff_done[305][9] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_string_to_buf("Now entering:");
|
|
|
|
|
sprintf ((char *) message, " %-30.30s ",data_store->town_strs[0]);
|
|
|
|
|
add_string_to_buf((char *) message);
|
|
|
|
|
add_string_to_buf((char *) message);
|
|
|
|
|
|
|
|
|
|
// clear entry space, and check exploration
|
|
|
|
|
misc_i[c_town.p_loc.x][c_town.p_loc.y] = misc_i[c_town.p_loc.x][c_town.p_loc.y] & 3;
|
|
|
|
|
@@ -461,7 +461,7 @@ location end_town_mode(short switching_level,location destination) // returns n
|
|
|
|
|
Boolean data_saved = FALSE,combat_end = FALSE;
|
|
|
|
|
|
|
|
|
|
if (is_combat()) combat_end = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (overall_mode == 1) {
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
if (party.creature_save[i].which_town == c_town.town_num) {
|
|
|
|
|
@@ -477,22 +477,22 @@ location end_town_mode(short switching_level,location destination) // returns n
|
|
|
|
|
for (k = 0; k < town_size[town_type]; k++)
|
|
|
|
|
setup_save.setup[party.at_which_save_slot][j][k] = misc_i[j][k];
|
|
|
|
|
party.at_which_save_slot = (party.at_which_save_slot == 3) ? 0 : party.at_which_save_slot + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Store items, if necessary
|
|
|
|
|
// Store items, if necessary
|
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
|
if (scenario.store_item_towns[j] == c_town.town_num) {
|
|
|
|
|
for (i = 0; i < NUM_TOWN_ITEMS; i++)
|
|
|
|
|
if ((t_i.items[i].variety != 0) && (t_i.items[i].is_special == 0) &&
|
|
|
|
|
((t_i.items[i].item_loc.x >= scenario.store_item_rects[j].left) &&
|
|
|
|
|
(t_i.items[i].item_loc.x <= scenario.store_item_rects[j].right) &&
|
|
|
|
|
(t_i.items[i].item_loc.x <= scenario.store_item_rects[j].right) &&
|
|
|
|
|
(t_i.items[i].item_loc.y >= scenario.store_item_rects[j].top) &&
|
|
|
|
|
(t_i.items[i].item_loc.y <= scenario.store_item_rects[j].bottom)) ) {
|
|
|
|
|
stored_items[j].items[i] = t_i.items[i];
|
|
|
|
|
}
|
|
|
|
|
else stored_items[j].items[i].variety = 0;
|
|
|
|
|
else stored_items[j].items[i].variety = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clean up special data, just in case
|
|
|
|
|
for (i = 0; i < T_M; i++) {
|
|
|
|
|
c_town.monst.dudes[i].monst_start.spec1 = 0;
|
|
|
|
|
@@ -507,45 +507,45 @@ location end_town_mode(short switching_level,location destination) // returns n
|
|
|
|
|
(char) (s_pow(2,i % 8));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to_return = party.p_loc;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 30; i++)
|
|
|
|
|
if ((party.party_event_timers[i] > 0) && (party.global_or_town[i] == 1))
|
|
|
|
|
party.party_event_timers[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check for exit specials, if leaving town
|
|
|
|
|
if (switching_level == 0) {
|
|
|
|
|
to_return = party.p_loc;
|
|
|
|
|
|
|
|
|
|
if (is_town()) {
|
|
|
|
|
if (destination.x <= c_town.town.in_town_rect.left) {
|
|
|
|
|
if (c_town.town.exit_locs[1].x > 0)
|
|
|
|
|
if (c_town.town.exit_locs[1].x > 0)
|
|
|
|
|
to_return = c_town.town.exit_locs[1].toGlobal();
|
|
|
|
|
else to_return.x--;
|
|
|
|
|
party.p_loc = to_return; party.p_loc.x++;
|
|
|
|
|
special_queue[1].queued_special = c_town.town.exit_specs[1];
|
|
|
|
|
}
|
|
|
|
|
else if (destination.x >= c_town.town.in_town_rect.right) {
|
|
|
|
|
if (c_town.town.exit_locs[3].x > 0)
|
|
|
|
|
if (c_town.town.exit_locs[3].x > 0)
|
|
|
|
|
to_return = c_town.town.exit_locs[3].toGlobal();
|
|
|
|
|
else to_return.x++;
|
|
|
|
|
party.p_loc = to_return; party.p_loc.x--;
|
|
|
|
|
special_queue[1].queued_special = c_town.town.exit_specs[3];
|
|
|
|
|
}
|
|
|
|
|
else if (destination.y <= c_town.town.in_town_rect.top) {
|
|
|
|
|
if (c_town.town.exit_locs[0].x > 0)
|
|
|
|
|
if (c_town.town.exit_locs[0].x > 0)
|
|
|
|
|
to_return = c_town.town.exit_locs[0].toGlobal();
|
|
|
|
|
else to_return.y--;
|
|
|
|
|
party.p_loc = to_return; party.p_loc.y++;
|
|
|
|
|
special_queue[1].queued_special = c_town.town.exit_specs[0];
|
|
|
|
|
}
|
|
|
|
|
else if (destination.y >= c_town.town.in_town_rect.bottom) {
|
|
|
|
|
if (c_town.town.exit_locs[2].x > 0)
|
|
|
|
|
if (c_town.town.exit_locs[2].x > 0)
|
|
|
|
|
to_return = c_town.town.exit_locs[2].toGlobal();
|
|
|
|
|
else to_return.y++;
|
|
|
|
|
else to_return.y++;
|
|
|
|
|
party.p_loc = to_return; party.p_loc.y--;
|
|
|
|
|
special_queue[1].queued_special = c_town.town.exit_specs[2];
|
|
|
|
|
}
|
|
|
|
|
@@ -566,15 +566,15 @@ location end_town_mode(short switching_level,location destination) // returns n
|
|
|
|
|
for (j = 0; j < 15; j++)
|
|
|
|
|
if ((j != 2) && (j != 7) && (j != 9))
|
|
|
|
|
adven[i].status[j] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_explored(to_return);
|
|
|
|
|
redraw_screen(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (combat_end == FALSE) clear_map();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c_town.town_num = -1; //no longer in a town
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return to_return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -626,7 +626,7 @@ void start_town_combat(short direction)
|
|
|
|
|
short end_town_combat()
|
|
|
|
|
{
|
|
|
|
|
short num_tries = 0,r1,i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r1 = get_ran(1,0,5);
|
|
|
|
|
while ((adven[r1].isAlive() == false) && (num_tries++ < 1000))
|
|
|
|
|
r1 = get_ran(1,0,5);
|
|
|
|
|
@@ -635,7 +635,7 @@ short end_town_combat()
|
|
|
|
|
current_pc = store_current_pc;
|
|
|
|
|
if (adven[current_pc].isAlive() == false)
|
|
|
|
|
current_pc = first_active_pc();
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
|
pc_parry[i] = 0;
|
|
|
|
|
return pc_dir[r1];
|
|
|
|
|
}
|
|
|
|
|
@@ -647,7 +647,7 @@ void place_party(short direction)
|
|
|
|
|
location pos_locs[14];
|
|
|
|
|
location check_loc;
|
|
|
|
|
short x_adj,y_adj,how_many_ok = 1,where_in_a = 0,i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 14; i++) {
|
|
|
|
|
check_loc = c_town.p_loc;
|
|
|
|
|
if (direction % 4 < 2)
|
|
|
|
|
@@ -663,8 +663,8 @@ void place_party(short direction)
|
|
|
|
|
if (direction % 2 == 0)
|
|
|
|
|
y_adj = ((direction > 1) && (direction < 6)) ? y_adj : -1 * y_adj;
|
|
|
|
|
else y_adj = ((direction == 3) || (direction == 1)) ? -1 * y_adj : y_adj;
|
|
|
|
|
|
|
|
|
|
check_loc.y -= y_adj;
|
|
|
|
|
|
|
|
|
|
check_loc.y -= y_adj;
|
|
|
|
|
pos_locs[i] = check_loc;
|
|
|
|
|
if ((loc_off_act_area(check_loc) == FALSE) &&
|
|
|
|
|
(is_blocked(check_loc) == FALSE) && (is_special(check_loc) == FALSE) && (get_obscurity(check_loc.x,check_loc.y) == 0)
|
|
|
|
|
@@ -691,7 +691,7 @@ void place_party(short direction)
|
|
|
|
|
where_in_a++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -700,9 +700,9 @@ void place_party(short direction)
|
|
|
|
|
void create_town_combat_terrain()
|
|
|
|
|
{
|
|
|
|
|
location where;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (where.x = 0; where.x < town_size[town_type]; where.x++)
|
|
|
|
|
for (where.y = 0; where.y < town_size[town_type]; where.y++)
|
|
|
|
|
for (where.y = 0; where.y < town_size[town_type]; where.y++)
|
|
|
|
|
combat_terrain[where.x][where.y] = t_d.terrain[where.x][where.y];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -717,7 +717,7 @@ short general_types[260] = {1,1,0,0,0,1,1,1,1,1,
|
|
|
|
|
1,1,1,1,1,1,1,1,2,2,
|
|
|
|
|
2,2,2,2,2,2,2,2,2,2,
|
|
|
|
|
2,2,2,2,2,2,2,2,2,2,
|
|
|
|
|
2,2,2,2,2,2,0,0,0,0,
|
|
|
|
|
2,2,2,2,2,2,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,// 50
|
|
|
|
|
0,3,3,3,3,3,3,5,5,5,
|
|
|
|
|
6,6,7,7,1,1,8,9,10,11,
|
|
|
|
|
@@ -739,11 +739,11 @@ short general_types[260] = {1,1,0,0,0,1,1,1,1,1,
|
|
|
|
|
1,1,1,1,1,1,1,1,1,1,
|
|
|
|
|
1,1,1,1,1,1,1,1,1,1,
|
|
|
|
|
1,1,1,1,1,1,1,1,1,1};// 250
|
|
|
|
|
short ter_base[17] = {2,0,36,50,71, 0,0,0,0,2, 2,2,2,0, 0,2,36};
|
|
|
|
|
short ter_base[17] = {2,0,36,50,71, 0,0,0,0,2, 2,2,2,0, 0,2,36};
|
|
|
|
|
//short ground_type[14] = {2,0,36,50,71, 0,0,0,0,2, 2,2,2,0};
|
|
|
|
|
|
|
|
|
|
location special_ter_locs[15] =
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
location(11,10),location(11,14),location(10,20),location(11,26),location(9,30),
|
|
|
|
|
location(15,19),location(23,19),location(19,29),location(20,11),location(28,16),
|
|
|
|
|
location(28,24),location(27,19),location(27,29),location(15,28),location(19,19)
|
|
|
|
|
@@ -753,19 +753,19 @@ unsigned char mntn_pillar[4][4] = {{37,29,27,36},{29,33,34,27},{31,32,35,25},{36
|
|
|
|
|
unsigned char surf_lake[4][4] = {{56,55,54,3},{57,50,61,54},{58,51,59,53},{3,4,58,52}};
|
|
|
|
|
unsigned char cave_lake[4][4] = {{93,96,71,71},{96,71,71,71},{71,71,71,96},{71,71,71,96}};
|
|
|
|
|
location stuff_ul;
|
|
|
|
|
short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
{1,50,93,25,94,5,98,10,95,1},
|
|
|
|
|
{37,20,0,0,0,0,0,0,0,0},
|
|
|
|
|
{64,3,63,1,0,0,0,0,0,0},
|
|
|
|
|
{74,1,0,0,0,0,0,0,0,0},
|
|
|
|
|
{84,700,97,30,98,20,92,4,95,1},
|
|
|
|
|
{93,280,91,300,92,270,95,7,98,10},
|
|
|
|
|
{1,800,93,600,94,10,92,10,95,4},
|
|
|
|
|
{1,700,96,200,95,100,92,10,112,5},
|
|
|
|
|
{3,600,87,90,110,20,114,6,113,2},
|
|
|
|
|
{3,200,4,400,111,250,0,0,0,0},
|
|
|
|
|
{3,200,4,300,112,50,113,60,114,100},
|
|
|
|
|
{3,100,4,250,115,120,114,30,112,2},
|
|
|
|
|
short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
{1,50,93,25,94,5,98,10,95,1},
|
|
|
|
|
{37,20,0,0,0,0,0,0,0,0},
|
|
|
|
|
{64,3,63,1,0,0,0,0,0,0},
|
|
|
|
|
{74,1,0,0,0,0,0,0,0,0},
|
|
|
|
|
{84,700,97,30,98,20,92,4,95,1},
|
|
|
|
|
{93,280,91,300,92,270,95,7,98,10},
|
|
|
|
|
{1,800,93,600,94,10,92,10,95,4},
|
|
|
|
|
{1,700,96,200,95,100,92,10,112,5},
|
|
|
|
|
{3,600,87,90,110,20,114,6,113,2},
|
|
|
|
|
{3,200,4,400,111,250,0,0,0,0},
|
|
|
|
|
{3,200,4,300,112,50,113,60,114,100},
|
|
|
|
|
{3,100,4,250,115,120,114,30,112,2},
|
|
|
|
|
{1,25,84,15,98,300,97,280,0,0},
|
|
|
|
|
{1,50,93,25,94,5,98,10,95,1},
|
|
|
|
|
{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
@@ -778,7 +778,7 @@ short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
else if (ter_type > 260)
|
|
|
|
|
ter_type = 1;
|
|
|
|
|
else ter_type = general_types[ter_type];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 48; i++)
|
|
|
|
|
for (j = 0; j < 48; j++) {
|
|
|
|
|
c_town.explored[i][j] = 0;
|
|
|
|
|
@@ -789,27 +789,27 @@ short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
else t_d.terrain[i][j] = ter_base[ter_type];
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < 48; i++)
|
|
|
|
|
for (j = 0; j < 48; j++)
|
|
|
|
|
for (j = 0; j < 48; j++)
|
|
|
|
|
for (k = 0; k < 5; k++)
|
|
|
|
|
if ((t_d.terrain[i][j] != 90) && (get_ran(1,1,1000) < terrain_odds[ter_type][k * 2 + 1]))
|
|
|
|
|
t_d.terrain[i][j] = terrain_odds[ter_type][k * 2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t_d.terrain[0][0] = ter_base[ter_type];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ter_type == 3) {
|
|
|
|
|
t_d.terrain[0][0] = 83;
|
|
|
|
|
for (i = 15; i < 26; i++)
|
|
|
|
|
for (j = 9; j < 35; j++)
|
|
|
|
|
t_d.terrain[i][j] = 83;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ter_type == 4){
|
|
|
|
|
t_d.terrain[0][0] = 82;
|
|
|
|
|
for (i = 15; i < 26; i++)
|
|
|
|
|
for (j = 9; j < 35; j++)
|
|
|
|
|
t_d.terrain[i][j] = 82;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ter_type == 14 || ter_type == 15 || ter_type == 16) {
|
|
|
|
|
t_d.terrain[0][0] = 82;
|
|
|
|
|
for (i = 19; i < 23; i++)
|
|
|
|
|
@@ -870,16 +870,16 @@ short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
case 3:
|
|
|
|
|
t_d.terrain[32][j] = 15;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((t_d.terrain[17][8] == 6) && (t_d.terrain[8][20] == 9))
|
|
|
|
|
t_d.terrain[8][8] = 21;
|
|
|
|
|
if ((t_d.terrain[32][20] == 15) && (t_d.terrain[17][35] == 12))
|
|
|
|
|
t_d.terrain[32][35] = 19;
|
|
|
|
|
t_d.terrain[32][35] = 19;
|
|
|
|
|
if ((t_d.terrain[17][8] == 6) && (t_d.terrain[32][20] == 15))
|
|
|
|
|
t_d.terrain[32][8] = 32;
|
|
|
|
|
if ((t_d.terrain[8][20] == 9) && (t_d.terrain[17][35] == 12))
|
|
|
|
|
t_d.terrain[8][35] = 20;
|
|
|
|
|
t_d.terrain[8][35] = 20;
|
|
|
|
|
}
|
|
|
|
|
if (ter_base[ter_type] == 36) {
|
|
|
|
|
for (i = 0; i < num_walls; i++) {
|
|
|
|
|
@@ -898,22 +898,22 @@ short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
case 3:
|
|
|
|
|
t_d.terrain[32][j] = 30;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((t_d.terrain[17][8] == 6) && (t_d.terrain[8][20] == 9))
|
|
|
|
|
t_d.terrain[8][8] = 35;
|
|
|
|
|
if ((t_d.terrain[32][20] == 15) && (t_d.terrain[17][35] == 12))
|
|
|
|
|
t_d.terrain[32][35] = 33;
|
|
|
|
|
t_d.terrain[32][35] = 33;
|
|
|
|
|
if ((t_d.terrain[17][8] == 6) && (t_d.terrain[32][20] == 15))
|
|
|
|
|
t_d.terrain[32][8] = 32;
|
|
|
|
|
if ((t_d.terrain[8][20] == 9) && (t_d.terrain[17][35] == 12))
|
|
|
|
|
t_d.terrain[8][35] = 34;
|
|
|
|
|
t_d.terrain[8][35] = 34;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 48; i++)
|
|
|
|
|
for (j = 0; j < 48; j++)
|
|
|
|
|
for (j = 0; j < 48; j++)
|
|
|
|
|
combat_terrain[i][j] = t_d.terrain[i][j];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
make_town_trim(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -921,7 +921,7 @@ short terrain_odds[17][10] = {{3,80,4,40,115,20,114,10,112,1},
|
|
|
|
|
/*void elim_monst(unsigned char which,short spec_a,short spec_b)
|
|
|
|
|
{
|
|
|
|
|
short i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (party.stuff_done[spec_a][spec_b] > 0) {
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if (c_town.monst.dudes[i].number == which) {
|
|
|
|
|
@@ -960,13 +960,13 @@ void erase_specials()
|
|
|
|
|
short k,sd1,sd2;
|
|
|
|
|
|
|
|
|
|
special_node_type sn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((is_combat()) && (which_combat_type == 0))
|
|
|
|
|
return;
|
|
|
|
|
if ((is_town() == FALSE) && (is_combat() == FALSE))
|
|
|
|
|
return;
|
|
|
|
|
for (k = 0; k < 50; k++) {
|
|
|
|
|
//GK if (c_town.town.spec_id[k] >= 0)
|
|
|
|
|
//GK if (c_town.town.spec_id[k] >= 0)
|
|
|
|
|
{
|
|
|
|
|
sn = c_town.town.specials[c_town.town.spec_id[k]];
|
|
|
|
|
sd1 = sn.sd1; sd2 = sn.sd2;
|
|
|
|
|
@@ -979,7 +979,7 @@ void erase_specials()
|
|
|
|
|
print_nums(where.x,where.y,k);
|
|
|
|
|
c_town.town.special_locs[k].x = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (where.x != 100) {
|
|
|
|
|
switch (scenario.ter_types[t_d.terrain[where.x][where.y]].picture) {
|
|
|
|
|
case 207: t_d.terrain[where.x][where.y] = 0; break;
|
|
|
|
|
@@ -992,7 +992,7 @@ void erase_specials()
|
|
|
|
|
take_special(where.x,where.y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1005,7 +1005,7 @@ void erase_out_specials()
|
|
|
|
|
special_node_type sn;
|
|
|
|
|
short sd1,sd2;
|
|
|
|
|
shortloc where;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (k = 0; k < 2; k++)
|
|
|
|
|
{
|
|
|
|
|
for (l = 0; l < 2; l++)
|
|
|
|
|
@@ -1020,12 +1020,12 @@ void erase_out_specials()
|
|
|
|
|
{
|
|
|
|
|
if (party.can_find_town[outdoors[k][l].exit_dests[m]] == 0)
|
|
|
|
|
{
|
|
|
|
|
out[48 * k + outdoors[k][l].exit_locs[m].x][48 * l + outdoors[k][l].exit_locs[m].y] =
|
|
|
|
|
out[48 * k + outdoors[k][l].exit_locs[m].x][48 * l + outdoors[k][l].exit_locs[m].y] =
|
|
|
|
|
scenario.ter_types[outdoors[k][l].terrain[outdoors[k][l].exit_locs[m].x][outdoors[k][l].exit_locs[m].y]].flag1;
|
|
|
|
|
}
|
|
|
|
|
else if (party.can_find_town[outdoors[k][l].exit_dests[m]] > 0)
|
|
|
|
|
{
|
|
|
|
|
out[48 * k + outdoors[k][l].exit_locs[m].x][48 * l + outdoors[k][l].exit_locs[m].y] =
|
|
|
|
|
out[48 * k + outdoors[k][l].exit_locs[m].x][48 * l + outdoors[k][l].exit_locs[m].y] =
|
|
|
|
|
outdoors[k][l].terrain[outdoors[k][l].exit_locs[m].x][outdoors[k][l].exit_locs[m].y];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1033,11 +1033,11 @@ void erase_out_specials()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
|
if (quadrant_legal(i,j) == TRUE) {
|
|
|
|
|
for (k = 0; k < 18; k++)
|
|
|
|
|
for (k = 0; k < 18; k++)
|
|
|
|
|
//GK if (outdoors[i][j].special_id[k] >= 0)
|
|
|
|
|
{
|
|
|
|
|
out_num = scenario.out_width * (party.outdoor_corner.y + j) + party.outdoor_corner.x + i;
|
|
|
|
|
@@ -1055,7 +1055,7 @@ void erase_out_specials()
|
|
|
|
|
//GK outdoors[i][j].special_id[k] = -1;
|
|
|
|
|
outdoors[i][j].special_id[k] = 0xFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (scenario.ter_types[outdoors[i][j].terrain[where.x][where.y]].picture) {
|
|
|
|
|
case 207: out[48 * i + where.x][48 * j + where.y] = 0; break;
|
|
|
|
|
case 208: out[48 * i + where.x][48 * j + where.y] = 170; break;
|
|
|
|
|
@@ -1067,7 +1067,7 @@ void erase_out_specials()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1132,19 +1132,19 @@ void draw_map_rect (HWND the_dialog, short ul_x, short ul_y, short lr_x, short l
|
|
|
|
|
old_bmp = (HBITMAP) SelectObject(hdc, map_gworld);
|
|
|
|
|
old_brush = (HBRUSH) SelectObject(hdc,map_brush[0]);
|
|
|
|
|
old_pen = (HPEN) SelectObject(hdc,GetStockObject(NULL_PEN));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_out()) { // for outside map, adjust for where in outdoors is being mapped
|
|
|
|
|
|
|
|
|
|
if (is_out()) { // for outside map, adjust for where in outdoors is being mapped
|
|
|
|
|
if (party.i_w_c.x == 1)
|
|
|
|
|
map_adj.x += 48;
|
|
|
|
|
if (party.i_w_c.y == 1)
|
|
|
|
|
map_adj.y += 48;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now, if shopping or talking, just don't touch anything.
|
|
|
|
|
if ((overall_mode == 21) || (overall_mode == 20))
|
|
|
|
|
redraw_rect.right = -1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((is_out()) ||
|
|
|
|
|
((is_combat()) && (which_combat_type == 0)) ||
|
|
|
|
|
((overall_mode == 20) && (store_pre_talk_mode == 0)) ||
|
|
|
|
|
@@ -1153,7 +1153,7 @@ void draw_map_rect (HWND the_dialog, short ul_x, short ul_y, short lr_x, short l
|
|
|
|
|
else out_mode = FALSE;
|
|
|
|
|
|
|
|
|
|
area_to_put_on_map_rect = redraw_rect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (where.x= ul_x; where.x <= lr_x; where.x++)
|
|
|
|
|
for (where.y= ul_y; where.y <= lr_y; where.y++){
|
|
|
|
|
draw_rect = orig_draw_rect;
|
|
|
|
|
@@ -1162,15 +1162,15 @@ void draw_map_rect (HWND the_dialog, short ul_x, short ul_y, short lr_x, short l
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
what_ter = out[where.x + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else what_ter = t_d.terrain[where.x][where.y];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ter_temp_from = orig_draw_rect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
expl = out_e[where.x + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else expl = is_explored(where.x,where.y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (expl != 0) {
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] | (unsigned char)(s_pow(2,where.x % 8));
|
|
|
|
|
pic = scenario.ter_types[what_ter].picture;
|
|
|
|
|
if (pic >= 1000) {
|
|
|
|
|
@@ -1204,14 +1204,14 @@ void draw_map_rect (HWND the_dialog, short ul_x, short ul_y, short lr_x, short l
|
|
|
|
|
if ((pic < 400) && (where.x < area_to_put_on_map_rect.right - 1)) {
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
what_ter2 = out[(where.x + 1)+ 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else what_ter2 = t_d.terrain[where.x + 1][where.y];
|
|
|
|
|
else what_ter2 = t_d.terrain[where.x + 1][where.y];
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
expl2 = out_e[(where.x + 1) + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else expl2 = is_explored(where.x + 1,where.y);
|
|
|
|
|
else expl2 = is_explored(where.x + 1,where.y);
|
|
|
|
|
pic2 = scenario.ter_types[what_ter2].picture;
|
|
|
|
|
if (pic2 < 400 && (map_pats[pic] == map_pats[pic2]) && (expl2 != 0)) {
|
|
|
|
|
draw_rect.right += 6;
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] =
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] =
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] | (unsigned char)(s_pow(2,(where.x + 1)% 8));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1229,10 +1229,10 @@ void draw_map_rect (HWND the_dialog, short ul_x, short ul_y, short lr_x, short l
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectObject(hdc,old_brush);
|
|
|
|
|
SelectObject(hdc,old_pen);
|
|
|
|
|
SelectObject(hdc,old_bmp);
|
|
|
|
|
@@ -1360,7 +1360,7 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
((overall_mode == 20) && (store_pre_talk_mode == 0)) ||
|
|
|
|
|
((overall_mode == 21) && (store_pre_shop_mode == 0)) ||
|
|
|
|
|
(((is_town()) || (is_combat())) && (town_type != 2))) {
|
|
|
|
|
area_to_draw_from = view_rect;
|
|
|
|
|
area_to_draw_from = view_rect;
|
|
|
|
|
area_to_draw_from.left *= 6;
|
|
|
|
|
area_to_draw_from.right *= 6;
|
|
|
|
|
area_to_draw_from.top *= 6;
|
|
|
|
|
@@ -1371,7 +1371,7 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
OffsetRect(&area_to_draw_from,-1 * area_to_draw_from.left,-1 * area_to_draw_from.top);
|
|
|
|
|
small_adj = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_combat())
|
|
|
|
|
draw_pcs = FALSE;
|
|
|
|
|
|
|
|
|
|
@@ -1387,7 +1387,7 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
old_bmp = (HBITMAP) SelectObject(hdc, map_gworld);
|
|
|
|
|
old_brush = (HBRUSH) SelectObject(hdc,map_brush[0]);
|
|
|
|
|
old_pen = (HPEN) SelectObject(hdc,GetStockObject(NULL_PEN));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (the_item == 11) {
|
|
|
|
|
SelectObject(hdc,GetStockObject(WHITE_BRUSH));
|
|
|
|
|
Rectangle(hdc, map_world_rect.left,map_world_rect.top,map_world_rect.right,map_world_rect.bottom);
|
|
|
|
|
@@ -1398,12 +1398,12 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
SetDlgItemText(the_dialog,3,"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_out()) { // for outside map, adjust for where in outdoors is being mapped
|
|
|
|
|
if (is_out()) { // for outside map, adjust for where in outdoors is being mapped
|
|
|
|
|
if (party.i_w_c.x == 1)
|
|
|
|
|
map_adj.x += 48;
|
|
|
|
|
if (party.i_w_c.y == 1)
|
|
|
|
|
map_adj.y += 48;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now, if doing just partial restore, crop redraw_rect to save time.
|
|
|
|
|
if (the_item == 5) {
|
|
|
|
|
@@ -1418,12 +1418,12 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
redraw_rect.right = min(view_rect.right,kludge.x + 5);
|
|
|
|
|
redraw_rect.top = max(0,kludge.y - 4);
|
|
|
|
|
redraw_rect.bottom = min(view_rect.bottom,kludge.y + 5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now, if shopping or talking, just don't touch anything.
|
|
|
|
|
if ((overall_mode == 21) || (overall_mode == 20))
|
|
|
|
|
redraw_rect.right = -1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((is_out()) ||
|
|
|
|
|
((is_combat()) && (which_combat_type == 0)) ||
|
|
|
|
|
((overall_mode == 20) && (store_pre_talk_mode == 0)) ||
|
|
|
|
|
@@ -1433,8 +1433,8 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
|
|
|
|
|
area_to_put_on_map_rect = redraw_rect;
|
|
|
|
|
if (the_item == 10) {
|
|
|
|
|
area_to_put_on_map_rect.top = area_to_put_on_map_rect.left = 0;
|
|
|
|
|
area_to_put_on_map_rect.right = area_to_put_on_map_rect.bottom = total_size;
|
|
|
|
|
area_to_put_on_map_rect.top = area_to_put_on_map_rect.left = 0;
|
|
|
|
|
area_to_put_on_map_rect.right = area_to_put_on_map_rect.bottom = total_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (where.x= area_to_put_on_map_rect.left; where.x < area_to_put_on_map_rect.right; where.x++)
|
|
|
|
|
@@ -1447,15 +1447,15 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
what_ter = out[where.x + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else what_ter = t_d.terrain[where.x][where.y];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ter_temp_from = orig_draw_rect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
expl = out_e[where.x + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else expl = is_explored(where.x,where.y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (expl != 0) {
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] | (unsigned char)(s_pow(2,where.x % 8));
|
|
|
|
|
pic = scenario.ter_types[what_ter].picture;
|
|
|
|
|
if (pic >= 1000) {
|
|
|
|
|
@@ -1488,14 +1488,14 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
if ((pic < 400) && (where.x < area_to_put_on_map_rect.right - 1)) {// Try a little optimization
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
what_ter2 = out[(where.x + 1)+ 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else what_ter2 = t_d.terrain[where.x + 1][where.y];
|
|
|
|
|
else what_ter2 = t_d.terrain[where.x + 1][where.y];
|
|
|
|
|
if (out_mode == TRUE)
|
|
|
|
|
expl2 = out_e[(where.x + 1) + 48 * party.i_w_c.x][where.y + 48 * party.i_w_c.y];
|
|
|
|
|
else expl2 = is_explored(where.x + 1,where.y);
|
|
|
|
|
else expl2 = is_explored(where.x + 1,where.y);
|
|
|
|
|
pic2 = scenario.ter_types[what_ter2].picture;
|
|
|
|
|
if (pic2 < 400 && (map_pats[pic] == map_pats[pic2]) && (expl2 != 0)) {
|
|
|
|
|
draw_rect.right += 6;
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] =
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] =
|
|
|
|
|
map_graphic_placed[(where.x + 1)/ 8][where.y] | (unsigned char)(s_pow(2,(where.x + 1)% 8));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1516,7 +1516,7 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectObject(hdc,old_brush);
|
|
|
|
|
SelectObject(hdc,old_pen);
|
|
|
|
|
SelectObject(hdc,old_bmp);
|
|
|
|
|
@@ -1541,11 +1541,11 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
// Now place PCs and monsters
|
|
|
|
|
if ((draw_pcs == TRUE) && (modeless_exists[5] == TRUE)) {
|
|
|
|
|
if ((is_town()) && (party.stuff_done[305][2] > 0))
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
for (i = 0; i < T_M; i++)
|
|
|
|
|
if (c_town.monst.dudes[i].active > 0) {
|
|
|
|
|
where = c_town.monst.dudes[i].m_loc;
|
|
|
|
|
if ((is_explored(where.x,where.y)) &&
|
|
|
|
|
((where.x >= view_rect.left) && (where.x <= view_rect.right)
|
|
|
|
|
if ((is_explored(where.x,where.y)) &&
|
|
|
|
|
((where.x >= view_rect.left) && (where.x <= view_rect.right)
|
|
|
|
|
&& (where.y >= view_rect.top) && (where.x <= view_rect.bottom))){
|
|
|
|
|
|
|
|
|
|
draw_rect.left = area_to_draw_on.left + 6 * (where.x - view_rect.left);
|
|
|
|
|
@@ -1553,7 +1553,7 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
draw_rect.right = draw_rect.left + 6;
|
|
|
|
|
draw_rect.bottom = draw_rect.top + 6;
|
|
|
|
|
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] =
|
|
|
|
|
map_graphic_placed[where.x / 8][where.y] & ~((unsigned char)(s_pow(2,where.x % 8)));
|
|
|
|
|
SelectObject(hdc2,hpen[0]);
|
|
|
|
|
SelectObject(hdc2,hbrush[0]);
|
|
|
|
|
@@ -1583,9 +1583,9 @@ if (modeless_exists[5] == TRUE){
|
|
|
|
|
SelectObject(hdc2,hbrush[3]);
|
|
|
|
|
Ellipse(hdc2, draw_rect.left,draw_rect.top,draw_rect.right,draw_rect.bottom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now exit gracefully
|
|
|
|
|
|
|
|
|
|
if (modeless_exists[5] == TRUE) {
|
|
|
|
|
@@ -1647,14 +1647,14 @@ void display_map()
|
|
|
|
|
{
|
|
|
|
|
if ( modeless_exists[5] == TRUE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modeless_exists[5] = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modeless_dialogs[5] = CreateDialog(store_hInstance,
|
|
|
|
|
MAKEINTRESOURCE(1046),mainPtr,(DLGPROC) map_dialog_proc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Boolean quadrant_legal(short i, short j)
|
|
|
|
|
Boolean quadrant_legal(short i, short j)
|
|
|
|
|
{
|
|
|
|
|
if (party.outdoor_corner.x + i >= scenario.out_width) return FALSE;
|
|
|
|
|
if (party.outdoor_corner.y + j >= scenario.out_height) return FALSE;
|
|
|
|
|
|