Remove the redundant combat_terrain array
This commit is contained in:
@@ -111,7 +111,6 @@ extern bool talk_end_forced;
|
||||
|
||||
|
||||
extern short which_combat_type,num_targets_left;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern location center;
|
||||
extern short current_pc;
|
||||
extern short combat_active_pc,stat_screen_mode;
|
||||
|
@@ -34,7 +34,6 @@ extern bool ghost_mode;
|
||||
extern short which_combat_type;
|
||||
extern short stat_window;
|
||||
extern location center;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern short current_pc;
|
||||
extern short combat_active_pc;
|
||||
extern bool monsters_going,spell_forced;
|
||||
@@ -340,14 +339,14 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr
|
||||
// place PCs
|
||||
univ.party[0].combat_pos = out_start_loc;
|
||||
update_explored(univ.party[0].combat_pos);
|
||||
if (get_blockage(combat_terrain[univ.party[0].combat_pos.x][univ.party[0].combat_pos.y]) > 0)
|
||||
combat_terrain[univ.party[0].combat_pos.x][univ.party[0].combat_pos.y] = combat_terrain[0][0];
|
||||
if(get_blockage(univ.town->terrain(univ.party[0].combat_pos.x,univ.party[0].combat_pos.y)) > 0)
|
||||
univ.town->terrain(univ.party[0].combat_pos.x,univ.party[0].combat_pos.y) = univ.town->terrain(0,0);
|
||||
for (i = 1; i < 6; i++) {
|
||||
univ.party[i].combat_pos = univ.party[0].combat_pos;
|
||||
univ.party[i].combat_pos.x = univ.party[i].combat_pos.x + hor_vert_place[i].x;
|
||||
univ.party[i].combat_pos.y = univ.party[i].combat_pos.y + hor_vert_place[i].y;
|
||||
if (get_blockage(combat_terrain[univ.party[i].combat_pos.x][univ.party[i].combat_pos.y]) > 0)
|
||||
combat_terrain[univ.party[i].combat_pos.x][univ.party[i].combat_pos.y] = combat_terrain[0][0];
|
||||
if(get_blockage(univ.town->terrain(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y)) > 0)
|
||||
univ.town->terrain(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y) = univ.town->terrain(0,0);
|
||||
update_explored(univ.party[i].combat_pos);
|
||||
|
||||
univ.party[i].status[eStatus::POISONED_WEAPON] = 0;
|
||||
@@ -370,7 +369,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr
|
||||
univ.town.monst[i].cur_loc.y -= 4;//max(12,univ.town.monst[i].m_loc.y - 4);
|
||||
num_tries = 0;
|
||||
while (((monst_can_be_there(univ.town.monst[i].cur_loc,i) == false) ||
|
||||
(combat_terrain[univ.town.monst[i].cur_loc.x][univ.town.monst[i].cur_loc.y] == 180) ||
|
||||
univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y) == 180 ||
|
||||
(pc_there(univ.town.monst[i].cur_loc) < 6)) &&
|
||||
(num_tries++ < 50)) {
|
||||
univ.town.monst[i].cur_loc.x = get_ran(1,15,25);
|
||||
@@ -380,8 +379,8 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr
|
||||
else if ((univ.town.monst[i].mu > 0) || (univ.town.monst[i].cl > 0))
|
||||
univ.town.monst[i].cur_loc.y -= 4;//max(12,univ.town.monst[i].m_loc.y - 4);
|
||||
}
|
||||
if (get_blockage(combat_terrain[univ.town.monst[i].cur_loc.x][univ.town.monst[i].cur_loc.y]) > 0)
|
||||
combat_terrain[univ.town.monst[i].cur_loc.x][univ.town.monst[i].cur_loc.y] = combat_terrain[0][0];
|
||||
if(get_blockage(univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y)) > 0)
|
||||
univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y) = univ.town->terrain(0,0);
|
||||
}
|
||||
|
||||
|
||||
@@ -443,7 +442,7 @@ bool pc_combat_move(location destination) ////
|
||||
print_buf();
|
||||
return true;
|
||||
}
|
||||
else if ((combat_terrain[destination.x][destination.y] == 90) && (which_combat_type == 0)) {
|
||||
else if(univ.town->terrain(destination.x,destination.y) == 90 && which_combat_type == 0) {
|
||||
if (get_ran(1,1,10) < 3) {
|
||||
univ.party[current_pc].main_status = eMainStatus::FLED;
|
||||
if (combat_active_pc == current_pc)
|
||||
@@ -490,11 +489,10 @@ bool pc_combat_move(location destination) ////
|
||||
univ.party[current_pc].direction = dir;
|
||||
take_ap(1);
|
||||
check_special_terrain(store_loc,eSpecCtx::COMBAT_MOVE,switch_pc,&spec_num,&check_f);
|
||||
move_sound(combat_terrain[destination.x][destination.y],univ.party[current_pc].ap);
|
||||
move_sound(univ.town->terrain(destination.x,destination.y),univ.party[current_pc].ap);
|
||||
return true;
|
||||
}
|
||||
else if ((forced == true)
|
||||
|| ((impassable(combat_terrain[destination.x][destination.y]) == false) && (pc_there(destination) == 6))) {
|
||||
else if(forced || (!impassable(univ.town->terrain(destination.x,destination.y)) && pc_there(destination) == 6)) {
|
||||
|
||||
// monsters get back-shots
|
||||
for (i = 0; i < univ.town->max_monst(); i++) {
|
||||
@@ -524,7 +522,7 @@ bool pc_combat_move(location destination) ////
|
||||
take_ap(1);
|
||||
sprintf ((char *) create_line, "Moved: %s ",d_string[dir]);
|
||||
add_string_to_buf((char *) create_line);
|
||||
move_sound(combat_terrain[destination.x][destination.y],univ.party[current_pc].ap);
|
||||
move_sound(univ.town->terrain(destination.x,destination.y),univ.party[current_pc].ap);
|
||||
|
||||
}
|
||||
else return false;
|
||||
|
@@ -41,7 +41,6 @@ extern short cur_town_talk_loaded;
|
||||
extern cScenario scenario;
|
||||
extern cUniverse univ;
|
||||
cScenarioList scen_headers;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern bool mac_is_intel;
|
||||
|
||||
bool loaded_yet = false, got_nagged = false,ae_loading = false;
|
||||
|
@@ -35,7 +35,6 @@ extern short current_spell_range;
|
||||
extern bool anim_onscreen,play_sounds,frills_on,startup_loaded,party_in_memory;
|
||||
extern bool flushingInput;
|
||||
extern short anim_step;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern effect_pat_type current_pat;
|
||||
extern location ul;
|
||||
extern location center;
|
||||
@@ -915,7 +914,7 @@ void draw_terrain(short mode)
|
||||
}
|
||||
}
|
||||
else if (is_combat()) {
|
||||
spec_terrain = combat_terrain[where_draw.x][where_draw.y];
|
||||
spec_terrain = univ.town->terrain(where_draw.x,where_draw.y);
|
||||
can_draw = (((is_explored(where_draw.x,where_draw.y)) ||
|
||||
(which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT))
|
||||
&& (party_can_see(where_draw) < 6)) ? 1 : 0;
|
||||
|
@@ -36,7 +36,6 @@ extern cUniverse univ;
|
||||
//extern current_town_type c_town;
|
||||
//extern town_item_list t_i;
|
||||
//extern unsigned char out[96][96],out_e[96][96];
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern effect_pat_type current_pat;
|
||||
//extern unsigned char misc_i[64][64],sfx[64][64];
|
||||
extern sf::RenderWindow mini_map;
|
||||
|
@@ -20,7 +20,6 @@ extern short which_combat_type,current_pc;
|
||||
extern eGameMode overall_mode;
|
||||
//extern big_tr_type t_d;
|
||||
//extern cOutdoors outdoors[2][2];
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
//extern unsigned char out[96][96], out_e[96][96];
|
||||
extern location center;
|
||||
extern unsigned char map_graphic_placed[8][64]; // keeps track of what's been filled on map
|
||||
@@ -240,7 +239,7 @@ ter_num_t coord_to_ter(short x,short y)
|
||||
else if (((overall_mode > MODE_OUTDOORS) && (overall_mode < MODE_COMBAT))|| (overall_mode == MODE_LOOK_TOWN))
|
||||
what_terrain = univ.town->terrain(x,y);
|
||||
else
|
||||
what_terrain = combat_terrain[x][y];\
|
||||
what_terrain = univ.town->terrain(x,y);
|
||||
return what_terrain;
|
||||
}
|
||||
|
||||
@@ -313,7 +312,7 @@ bool is_blocked(location to_check)
|
||||
}
|
||||
|
||||
if ((is_town()) || (is_combat())) {
|
||||
ter = (is_town()) ? univ.town->terrain(to_check.x,to_check.y) : combat_terrain[to_check.x][to_check.y];
|
||||
ter = univ.town->terrain(to_check.x,to_check.y);
|
||||
gr = scenario.ter_types[ter].picture;
|
||||
|
||||
////
|
||||
@@ -692,7 +691,6 @@ void alter_space(short i,short j,ter_num_t ter)
|
||||
}
|
||||
else {
|
||||
univ.town->terrain(i,j) = ter;
|
||||
combat_terrain[i][j] = ter;
|
||||
if(scenario.ter_types[univ.town->terrain(i,j)].special == eTerSpec::CONVEYOR)
|
||||
univ.town.belt_present = true;
|
||||
}
|
||||
|
@@ -116,7 +116,6 @@ location spell_targets[8];
|
||||
/* Combat globals */
|
||||
short which_combat_type;
|
||||
location center;
|
||||
ter_num_t combat_terrain[64][64];
|
||||
short current_pc;
|
||||
short combat_active_pc;
|
||||
effect_pat_type current_pat;
|
||||
|
@@ -22,7 +22,6 @@
|
||||
//extern party_record_type party;
|
||||
extern eGameMode overall_mode;
|
||||
//extern cOutdoors univ.out.outdoors[2][2];
|
||||
extern ter_num_t combat_terrain[64][64];//,out[96][96];
|
||||
extern short which_combat_type;
|
||||
//extern big_tr_type t_d;
|
||||
//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x
|
||||
@@ -750,13 +749,8 @@ bool combat_move_monster(short which,location destination)
|
||||
univ.town.monst[which].cur_loc = destination;
|
||||
monst_inflict_fields(which);
|
||||
|
||||
if (point_onscreen(destination,center) == true) {
|
||||
if (is_combat())
|
||||
move_sound(combat_terrain[destination.x][destination.y],
|
||||
(short) univ.town.monst[which].ap);
|
||||
else move_sound(univ.town->terrain(destination.x,destination.y),
|
||||
(short) univ.town.monst[which].ap);
|
||||
}
|
||||
if(point_onscreen(destination,center))
|
||||
move_sound(univ.town->terrain(destination.x,destination.y), univ.town.monst[which].ap);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -951,14 +945,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
|
||||
unsigned short ter_flag;
|
||||
|
||||
from_loc = univ.town.monst[which_monst].cur_loc;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
ter = univ.town->terrain(where_check.x,where_check.y);
|
||||
break;
|
||||
case 2:
|
||||
ter = combat_terrain[where_check.x][where_check.y];
|
||||
break;
|
||||
}
|
||||
ter = univ.town->terrain(where_check.x,where_check.y);
|
||||
////
|
||||
which_m = &univ.town.monst[which_monst];
|
||||
ter_abil = scenario.ter_types[ter].special;
|
||||
@@ -1084,7 +1071,6 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
|
||||
can_enter = false;
|
||||
if (!(monster_placid(which_monst))) {
|
||||
univ.town->terrain(where_check.x,where_check.y) = scenario.ter_types[ter].flag1.u;
|
||||
combat_terrain[where_check.x][where_check.y] = scenario.ter_types[ter].flag1.u;
|
||||
do_look = true;
|
||||
if (point_onscreen(center,where_check))
|
||||
play_sound(scenario.ter_types[ter].flag2.u);
|
||||
|
@@ -63,7 +63,6 @@ extern short monst_marked_damage[60];
|
||||
//extern current_town_type univ.town;
|
||||
//extern big_tr_type t_d;
|
||||
//extern town_item_list t_i;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
//extern unsigned char misc_i[64][64],sfx[64][64];
|
||||
extern location store_anim_ul;
|
||||
extern char light_area[13][13];
|
||||
|
@@ -36,7 +36,6 @@ extern eGameMode overall_mode;
|
||||
//extern party_record_type party;
|
||||
//extern current_town_type univ.town;
|
||||
//extern unsigned char univ.out[96][96],out_e[96][96],sfx[64][64];
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern short which_combat_type,current_pc,stat_window;
|
||||
//extern cOutdoors univ.out.outdoors[2][2];
|
||||
extern location center;
|
||||
@@ -162,7 +161,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho
|
||||
from_loc = univ.town.p_loc;
|
||||
break;
|
||||
case eSpecCtx::COMBAT_MOVE:
|
||||
ter = combat_terrain[where_check.x][where_check.y];
|
||||
ter = univ.town->terrain(where_check.x,where_check.y);
|
||||
from_loc = univ.party[current_pc].combat_pos;
|
||||
break;
|
||||
default:
|
||||
@@ -3334,7 +3333,6 @@ void set_terrain(location l, ter_num_t terrain_type)
|
||||
{
|
||||
ter_num_t former = univ.town->terrain(l.x,l.y);
|
||||
univ.town->terrain(l.x,l.y) = terrain_type;
|
||||
combat_terrain[l.x][l.y] = terrain_type;
|
||||
if(scenario.ter_types[terrain_type].special == eTerSpec::CONVEYOR)
|
||||
belt_present = true;
|
||||
if(scenario.ter_types[former].light_radius != scenario.ter_types[terrain_type].light_radius)
|
||||
|
@@ -101,7 +101,6 @@ extern std::map<eItemAbil, short> abil_chart;
|
||||
// combat globals
|
||||
extern short item_bottom_button_active[9];
|
||||
extern cUniverse univ;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern short current_pc;
|
||||
extern short shop_identify_cost;
|
||||
extern short store_selling_values[8];
|
||||
@@ -1256,12 +1255,8 @@ short print_terrain(location space)
|
||||
if (overall_mode == MODE_LOOK_OUTDOORS) {
|
||||
which_terrain = univ.out[space.x][space.y];
|
||||
}
|
||||
if (overall_mode == MODE_LOOK_TOWN) {
|
||||
if(overall_mode == MODE_LOOK_TOWN || overall_mode == MODE_LOOK_COMBAT)
|
||||
which_terrain = univ.town->terrain(space.x,space.y);
|
||||
}
|
||||
if (overall_mode == MODE_LOOK_COMBAT) {
|
||||
which_terrain = combat_terrain[space.x][space.y];
|
||||
}
|
||||
std::string msg = get_ter_name(which_terrain);
|
||||
msg = " " + msg;
|
||||
add_string_to_buf(msg);
|
||||
|
@@ -38,7 +38,6 @@ extern eGameMode overall_mode;
|
||||
extern location center;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
//extern cOutdoors univ.out.outdoors[2][2];
|
||||
//extern unsigned char univ.out.misc_i[64][64];
|
||||
extern short store_current_pc,current_ground;
|
||||
@@ -727,8 +726,6 @@ void start_town_combat(short direction)
|
||||
{
|
||||
short i;
|
||||
|
||||
create_town_combat_terrain();
|
||||
|
||||
place_party(direction);
|
||||
if(current_pc == 6)
|
||||
for(i = 0; i < 6; i++)
|
||||
@@ -840,17 +837,6 @@ void place_party(short direction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void create_town_combat_terrain()
|
||||
{
|
||||
location where;
|
||||
|
||||
for (where.x = 0; where.x < univ.town->max_dim(); where.x++)
|
||||
for (where.y = 0; where.y < univ.town->max_dim(); where.y++)
|
||||
combat_terrain[where.x][where.y] = univ.town->terrain(where.x,where.y);
|
||||
}
|
||||
|
||||
void create_out_combat_terrain(short type,short num_walls,short /*spec_code*/)
|
||||
// spec_code is encounter's spec_code
|
||||
{
|
||||
@@ -1070,9 +1056,7 @@ void create_out_combat_terrain(short type,short num_walls,short /*spec_code*/)
|
||||
univ.town->terrain(8,35) = 34;
|
||||
}
|
||||
|
||||
for (i = 0; i < 48; i++)
|
||||
for (j = 0; j < 48; j++)
|
||||
combat_terrain[i][j] = univ.town->terrain(i,j);
|
||||
// TODO: Looks like I haven't yet implemented the generalized arenas
|
||||
|
||||
// make_town_trim(1);
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ bool abil_exists(eItemAbil abil);
|
||||
void start_town_combat(short direction);
|
||||
short end_town_combat();
|
||||
void place_party(short direction);
|
||||
void create_town_combat_terrain();
|
||||
void create_out_combat_terrain(short type,short num_walls,short spec_code);
|
||||
void elim_monst(ter_num_t which,short spec_a,short spec_b);
|
||||
void do_shop(short which,short min,short max,char *store_name);
|
||||
|
@@ -24,7 +24,6 @@ extern eGameMode overall_mode;
|
||||
//extern party_record_type univ.party;
|
||||
//extern current_town_type univ.town;
|
||||
//extern unsigned char out[96][96],out_e[96][96];
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern short current_pc,stat_window;
|
||||
//extern cOutdoors outdoors[2][2];
|
||||
extern location center;
|
||||
|
Reference in New Issue
Block a user