Added some typedefs for clarity, and also added a cAttack class.

git-svn-id: http://openexile.googlecode.com/svn/trunk@77 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-28 23:48:10 +00:00
parent 1af17438f3
commit eeaa9ca599
55 changed files with 289 additions and 272 deletions

View File

@@ -63,7 +63,7 @@ extern cTown* town;
//extern big_tr_type t_d;
//extern short town_type; // 0 - big 1 - ave 2 - small
extern short /*max_dim[3],*/mode_count,to_create;
extern unsigned short template_terrain[64][64];
extern ter_num_t template_terrain[64][64];
extern cItemRec item_list[400];
extern cScenario scenario;
extern ControlHandle right_sbar;
@@ -107,7 +107,7 @@ cSpeech::cNode null_talk_node = {0,0,{120,120,120,120},{120,120,120,120},{0,0,0,
rectangle working_rect;
location last_space_hit;
bool erasing_mode;
unsigned short current_ground = 0;
ter_num_t current_ground = 0;
short special_to_paste = -1;
@@ -1252,7 +1252,7 @@ void flash_rect(Rect to_flash) {
void swap_terrain() {
short a,b,c,i,j;
unsigned short ter;
ter_num_t ter;
change_ter(&a,&b,&c);
if (a < 0) return;
@@ -1270,7 +1270,7 @@ void swap_terrain() {
}
void set_new_terrain(unsigned short selected_terrain) {
void set_new_terrain(ter_num_t selected_terrain) {
current_terrain_type = selected_terrain;
redraw_selected_ter();
// if (selected_terrain < 2)
@@ -1549,7 +1549,7 @@ void set_up_lights() {
bool is_wall(short i,short j) {
unsigned short ter;
ter_num_t ter;
bool answer = false;
short pic;
@@ -1578,7 +1578,7 @@ bool is_wall(short i,short j) {
}
bool is_correctable_wall(short i,short j) {
unsigned short ter,walls[13] = {5,6,8,9,11,12,
ter_num_t ter,walls[13] = {5,6,8,9,11,12,
14,15,17,18,19,20,21};
bool answer = false;
short k;
@@ -1598,7 +1598,7 @@ bool is_correctable_wall(short i,short j) {
bool is_mountain(short i,short j) {
bool answer = false;
short pic;
unsigned short ter;
ter_num_t ter;
ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j];
pic = scenario.ter_types[ter].picture;
@@ -1620,7 +1620,7 @@ bool is_mountain(short i,short j) {
bool is_hill(short i,short j) {
bool answer = false;
short pic;
unsigned short ter;
ter_num_t ter;
ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j];
pic = scenario.ter_types[ter].picture;
@@ -1650,7 +1650,7 @@ bool is_hill_or_mountain(short i,short j) {
bool is_erasable_water(short i,short j) {
bool answer = false;
short pic;
unsigned short ter;
ter_num_t ter;
ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j];
pic = scenario.ter_types[ter].picture;
@@ -1667,7 +1667,7 @@ bool is_erasable_water(short i,short j) {
bool is_water(short i,short j) {
bool answer = false;
short pic;
unsigned short ter;
ter_num_t ter;
ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j];
pic = scenario.ter_types[ter].picture;
@@ -1684,7 +1684,7 @@ bool is_water(short i,short j) {
bool is_correctable_water(short i,short j) {
bool answer = false;
short pic;
unsigned short ter;
ter_num_t ter;
ter = (editing_town == true) ? town->terrain(i,j) : current_terrain.terrain[i][j];
pic = scenario.ter_types[ter].picture;
@@ -1699,11 +1699,11 @@ bool is_correctable_water(short i,short j) {
return answer;
}
void shy_change_circle_terrain(location center,short radius,unsigned short terrain_type,short probability) {
void shy_change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability) {
// prob is 0 - 20, 0 no, 20 always
location l;
short i,j;
unsigned short ter;
ter_num_t ter;
for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++)
for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) {
@@ -1716,7 +1716,7 @@ void shy_change_circle_terrain(location center,short radius,unsigned short terra
}
}
void change_circle_terrain(location center,short radius,unsigned short terrain_type,short probability) {
void change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability) {
// prob is 0 - 20, 0 no, 20 always
location l;
short i,j;
@@ -1730,7 +1730,7 @@ void change_circle_terrain(location center,short radius,unsigned short terrain_t
}
}
void change_rect_terrain(rectangle r,unsigned short terrain_type,short probability,bool hollow) {
void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bool hollow) {
// prob is 0 - 20, 0 no, 20 always
location l;
short i,j;
@@ -1769,7 +1769,7 @@ void change_val (unsigned char *val,short a,short b) {
void frill_up_terrain() {
short i,j;
unsigned short terrain_type;
ter_num_t terrain_type;
for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++)
for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) {
@@ -1792,7 +1792,7 @@ void frill_up_terrain() {
void unfrill_terrain() {
short i,j;
unsigned short terrain_type;
ter_num_t terrain_type;
for (i = 0; i < ((editing_town == true) ? town->max_dim() : 48); i++)
for (j = 0; j < ((editing_town == true) ? town->max_dim() : 48); j++) {
@@ -1812,7 +1812,7 @@ void unfrill_terrain() {
draw_terrain();
}
unsigned short find_object_part(unsigned char num, unsigned char x, unsigned char y, unsigned short fallback){
ter_num_t find_object_part(unsigned char num, unsigned char x, unsigned char y, ter_num_t fallback){
for(int i = 0; i < 256; i++){
if(scenario.ter_types[i].obj_num == num &&
scenario.ter_types[i].obj_pos.x == x &&
@@ -1822,7 +1822,7 @@ unsigned short find_object_part(unsigned char num, unsigned char x, unsigned cha
return fallback;
}
unsigned short get_ground_from_ter(unsigned short ter){
ter_num_t get_ground_from_ter(ter_num_t ter){
unsigned char ground = scenario.ter_types[ter].ground_type;
for(int i = 0; i < 256; i++)
if(scenario.ter_types[i].ground_type == ground)
@@ -1830,8 +1830,8 @@ unsigned short get_ground_from_ter(unsigned short ter){
return 0;
}
bool terrain_matches(unsigned char x, unsigned char y, unsigned short ter){
unsigned short ter2;
bool terrain_matches(unsigned char x, unsigned char y, ter_num_t ter){
ter_num_t ter2;
if(editing_town) ter2 = town->terrain(x,y); else ter2 = current_terrain.terrain[x][y];
if(ter2 == ter) return true;
if(scenario.ter_types[ter2].ground_type != scenario.ter_types[ter].ground_type)
@@ -1853,9 +1853,9 @@ bool terrain_matches(unsigned char x, unsigned char y, unsigned short ter){
}
void set_terrain(location l,unsigned short terrain_type) {
void set_terrain(location l,ter_num_t terrain_type) {
short i,j,which_sign = -1;
unsigned short ter;
ter_num_t ter;
location l2;
i = l.x;
@@ -2014,7 +2014,7 @@ void set_terrain(location l,unsigned short terrain_type) {
}
bool fix_rubble(location l) {
unsigned short terrain_type;
ter_num_t terrain_type;
if ((l.x < 0) || (l.y > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1))
return false;
@@ -2039,8 +2039,8 @@ bool fix_rubble(location l) {
}
bool fix_cave(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1))
@@ -2135,8 +2135,8 @@ bool fix_cave(location l) {
bool fix_mountain(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1))
@@ -2230,8 +2230,8 @@ bool fix_mountain(location l) {
}
bool fix_hill(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1))
@@ -2329,8 +2329,8 @@ bool fix_hill(location l) {
}
bool fix_water(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > town->max_dim() - 1) || (l.y < 0) || (l.y > town->max_dim() - 1))
@@ -2427,7 +2427,7 @@ bool fix_water(location l) {
// begin out
bool out_fix_rubble(location l) {
unsigned short terrain_type;
ter_num_t terrain_type;
if ((l.x < 0) || (l.y > 47) || (l.y < 0) || (l.y > 47))
return false;
@@ -2452,8 +2452,8 @@ bool out_fix_rubble(location l) {
}
bool out_fix_cave(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > 47) || (l.y < 0) || (l.y > 47))
@@ -2548,8 +2548,8 @@ bool out_fix_cave(location l) {
bool out_fix_mountain(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > 47) || (l.y < 0) || (l.y > 47))
@@ -2643,8 +2643,8 @@ bool out_fix_mountain(location l) {
}
bool out_fix_hill(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > 47) || (l.y < 0) || (l.y > 47))
@@ -2742,8 +2742,8 @@ bool out_fix_hill(location l) {
}
bool out_fix_water(location l) {
unsigned short ter_to_fix;
unsigned short store_ter;
ter_num_t ter_to_fix;
ter_num_t store_ter;
short i,j;
if ((l.x < 0) || (l.y > 47) || (l.y < 0) || (l.y > 47))
@@ -3066,7 +3066,7 @@ void set_special(location spot_hit) {
void town_entry(location spot_hit) {
short x,y;
unsigned short ter;
ter_num_t ter;
ter = current_terrain.terrain[spot_hit.x][spot_hit.y];
if (scenario.ter_types[ter].special != TER_SPEC_TOWN_ENTRANCE) {
@@ -3569,7 +3569,7 @@ bool is_lava(short x,short y) {
}
short get_obscurity(short x,short y) {
unsigned short what_terrain;
ter_num_t what_terrain;
short store;
what_terrain = coord_to_ter(x,y);
@@ -3582,8 +3582,8 @@ short get_obscurity(short x,short y) {
return 0;
}
unsigned short coord_to_ter(short x,short y) {
unsigned short what_terrain;
ter_num_t coord_to_ter(short x,short y) {
ter_num_t what_terrain;
if (editing_town == true)
what_terrain = town->terrain(x,y);

View File

@@ -3,7 +3,7 @@ void init_screen_locs();
bool handle_action(Point the_point,EventRecord event);
void flash_rect(Rect to_flash);
void swap_terrain();
void set_new_terrain(unsigned short selected_terrain);
void set_new_terrain(ter_num_t selected_terrain);
void handle_keystroke(char chr,char chr2,EventRecord event);
void get_wandering_monst();
void get_town_info();
@@ -20,15 +20,15 @@ bool is_hill(short i,short j);
bool is_hill_or_mountain(short i,short j);
bool is_water(short i,short j);
bool is_correctable_water(short i,short j);
void shy_change_circle_terrain(location center,short radius,unsigned short terrain_type,short probability);
void change_circle_terrain(location center,short radius,unsigned short terrain_type,short probability);
void change_rect_terrain(rectangle r,unsigned short terrain_type,short probability,bool hollow);
void shy_change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability);
void change_circle_terrain(location center,short radius,ter_num_t terrain_type,short probability);
void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bool hollow);
void swap_val(unsigned char *val,short a,short b);
void change_val_4 (unsigned char *val,short a,short b,short c,short d);
void change_val (unsigned char *val,short a,short b);
void frill_up_terrain();
void unfrill_terrain();
void set_terrain(location l,unsigned short terrain_type);
void set_terrain(location l,ter_num_t terrain_type);
bool fix_rubble(location l);
bool fix_cave(location l);
bool fix_mountain(location l);
@@ -41,7 +41,7 @@ bool out_fix_hill(location l);
bool out_fix_water(location l);
void adjust_space(location l);
bool is_lava(short x,short y);
unsigned short coord_to_ter(short x,short y);
ter_num_t coord_to_ter(short x,short y);
short get_obscurity(short x,short y);
short can_see(location p1,location p2,short mode);
bool place_item(location spot_hit,short which_item,short property,short always,short odds);
@@ -67,5 +67,5 @@ void set_special(location spot_hit);
bool save_check(short which_dlog);
void update_item_menu();
unsigned short get_ground_from_ter(unsigned short ter);
bool terrain_matches(unsigned char x, unsigned char y, unsigned short ter);
ter_num_t get_ground_from_ter(ter_num_t ter);
bool terrain_matches(unsigned char x, unsigned char y, ter_num_t ter);

View File

@@ -21,7 +21,7 @@ extern cTown* town;
//extern short town_type; // 0 - big 1 - ave 2 - small
extern short max_dim[3];
extern short mode_count,to_create;
extern unsigned short template_terrain[64][64];
extern ter_num_t template_terrain[64][64];
cItemRec item_list[400];
extern cScenario scenario;
extern cSpecial null_spec_node;
@@ -649,7 +649,7 @@ short ter_traits[256] = {
0,0,16,17,18,19
};
cMonster return_monster_template(unsigned short store) {
cMonster return_monster_template(m_num_t store) {
cMonster monst;
short m_num,i;
@@ -668,11 +668,11 @@ cMonster return_monster_template(unsigned short store) {
monst.a[1] = m_a2[m_num];
monst.a[2] = m_a3[m_num];
if (monst.a[0] > 0)
monst.a[0] += 100;
monst.a[0] = monst.a[0] + 100;
if (monst.a[1] > 0)
monst.a[1] += 100;
monst.a[1] = monst.a[1] + 100;
if (monst.a[2] > 0)
monst.a[2] += 100;
monst.a[2] = monst.a[2] + 100;
monst.a1_type = m_a1t[m_num];
monst.a23_type = m_a23t[m_num];
monst.m_type = (eMonsterType) m_type[m_num];

View File

@@ -1,4 +1,4 @@
cMonster return_monster_template(unsigned short store);
cMonster return_monster_template(m_num_t store);
//item_record_type convert_item (short_item_record_type s_item) ;
void init_scenario();
short edit_ter_type(short which_ter);

View File

@@ -27,7 +27,7 @@ extern location cur_out;
//extern piles_of_stuff_dumping_type *data_store;
//extern cSpeech talking;
extern cOutdoors current_terrain;
extern unsigned short borders[4][50];
extern ter_num_t borders[4][50];
extern bool change_made;
extern GWorldPtr spec_scen_g;
extern bool mac_is_intel;

View File

@@ -52,7 +52,7 @@ extern Rect left_button[NLS];
extern Rect right_buttons[NRSONPAGE];
extern Rect right_scrollbar_rect;
extern Rect right_area_rect;
extern unsigned short borders[4][50];
extern ter_num_t borders[4][50];
extern ControlHandle right_sbar;
extern bool left_buttons_active,right_buttons_active;
@@ -216,7 +216,7 @@ void init_dialogs(){
//return tmp;
}
short get_small_icon(unsigned short ter){
short get_small_icon(ter_num_t ter){
short icon;
switch(scenario.ter_types[ter].special){
case TER_SPEC_NONE:
@@ -1059,7 +1059,7 @@ void redraw_selected_ter() {
// draw_one_terrain_spot(18,8,(unsigned char) current_terrain_type);
}
void draw_one_terrain_spot (short i,short j,unsigned short terrain_to_draw) {
void draw_one_terrain_spot (short i,short j,ter_num_t terrain_to_draw) {
location where_draw;
Rect source_rect;
short picture_wanted;
@@ -1094,7 +1094,7 @@ void draw_one_terrain_spot (short i,short j,unsigned short terrain_to_draw) {
Draw_Some_Item(source_gworld, source_rect, ter_draw_gworld, where_draw, 0, 0);
}
void draw_one_tiny_terrain_spot (short i,short j,unsigned short terrain_to_draw) {
void draw_one_tiny_terrain_spot (short i,short j,ter_num_t terrain_to_draw) {
location where_draw;
Rect source_rect,dest_rect = {0,0,4,4},from_rect = {0,0,4,4};
@@ -1547,7 +1547,7 @@ void take_quickfire(short i,short j) {
bool container_there(location l) {
unsigned short ter;
ter_num_t ter;
if (editing_town == false)
return false;

View File

@@ -16,8 +16,8 @@ Rect get_item_template_rect (short type_wanted);
void draw_items();
void force_tiny_redraw();
void redraw_selected_ter();
void draw_one_terrain_spot (short i,short j,unsigned short terrain_to_draw);
void draw_one_tiny_terrain_spot (short i,short j,unsigned short terrain_to_draw);
void draw_one_terrain_spot (short i,short j,ter_num_t terrain_to_draw);
void draw_one_tiny_terrain_spot (short i,short j,ter_num_t terrain_to_draw);
void Draw_Some_Item ( GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,location target,
char masked,short main_win);
//void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,Rect targ_rect,char masked,short main_win);

View File

@@ -15,7 +15,7 @@ extern cTown* town;
//extern big_tr_type t_d;
extern short town_type; // 0 - big 1 - ave 2 - small
extern short /*max_dim[3],*/mode_count,to_create;
extern unsigned short template_terrain[64][64];
extern ter_num_t template_terrain[64][64];
extern cItemRec item_list[400];
extern cScenario scenario;
extern cSpecial null_spec_node;

View File

@@ -41,8 +41,8 @@ cOutdoors current_terrain;
//short user_given_password = -1;
short pixel_depth,old_depth = 8;
unsigned short border1 = 90, border2 = 90; // kludgy thing ... leave right here, before borders
unsigned short borders[4][50];
ter_num_t border1 = 90, border2 = 90; // kludgy thing ... leave right here, before borders
ter_num_t borders[4][50];
bool change_made = false;

View File

@@ -19,14 +19,14 @@ extern cTown* town;
//extern big_tr_type t_d;
//extern short town_type; // 0 - big 1 - ave 2 - small
extern short /*max_dim[3],*/mode_count,to_create,cur_town;
extern unsigned short template_terrain[64][64];
extern ter_num_t template_terrain[64][64];
extern cItemRec item_list[400];
extern cScenario scenario;
extern cSpecial null_spec_node;
extern cSpeech::cNode null_talk_node;
//extern piles_of_stuff_dumping_type *data_store;
extern cOutdoors current_terrain;
extern unsigned short borders[4][50];
extern ter_num_t borders[4][50];
extern location cur_out;
//extern cSpeech talking;