diff --git a/osx/Blades of Exile Char Editor/pc.action.cpp b/osx/Blades of Exile Char Editor/pc.action.cpp index 94eddd41..d64b988a 100644 --- a/osx/Blades of Exile Char Editor/pc.action.cpp +++ b/osx/Blades of Exile Char Editor/pc.action.cpp @@ -250,7 +250,7 @@ void put_pc_graphics() else cd_set_led(991,i,0); } - cd_set_item_text(991,69,ADVEN[which_pc_displayed].name); + cd_set_item_text(991,69,ADVEN[which_pc_displayed].name.c_str()); } void display_pc_event_filter (short item_hit) { @@ -411,7 +411,7 @@ void do_xp_draw() pc_num = store_train_pc; - sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name); + sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name.c_str()); cd_set_item_text (1010, 51,get_text); diff --git a/osx/Blades of Exile Char Editor/pc.editors.cpp b/osx/Blades of Exile Char Editor/pc.editors.cpp index a0d0acfe..530e7c17 100644 --- a/osx/Blades of Exile Char Editor/pc.editors.cpp +++ b/osx/Blades of Exile Char Editor/pc.editors.cpp @@ -211,7 +211,7 @@ short char_select_pc(short active_only,short free_inv_only,char *title) cd_activate_item(1018, 3 + i, 0); } if (ADVEN[i].main_status != 0) { - csit(1018,9 + i,ADVEN[i].name); + csit(1018,9 + i,ADVEN[i].name.c_str()); } else cd_activate_item(1018, 9 + i, 0); } diff --git a/osx/Blades of Exile Char Editor/pc.graphics.cpp b/osx/Blades of Exile Char Editor/pc.graphics.cpp index 1fa0fe7e..e4701552 100644 --- a/osx/Blades of Exile Char Editor/pc.graphics.cpp +++ b/osx/Blades of Exile Char Editor/pc.graphics.cpp @@ -551,13 +551,13 @@ void display_party(short mode,short clear_first) //frame_dlog_rect(GetWindowPort(mainPtr),pc_area_buttons[i][1],0); // draw name TextSize(9); - if( (strlen(ADVEN[i].name)) >= 10) { + if( (ADVEN[i].name.length()) >= 10) { TextFace(0); - sprintf((char *) to_draw, "%-s ", (char *) ADVEN[i].name); + sprintf((char *) to_draw, "%-s ", (char *) ADVEN[i].name.c_str()); TextSize(6); } else { - sprintf((char *) to_draw, "%-s ", (char *) ADVEN[i].name); + sprintf((char *) to_draw, "%-s ", (char *) ADVEN[i].name.c_str()); } ForeColor(whiteColor); @@ -566,8 +566,8 @@ void display_party(short mode,short clear_first) TextSize(10); if (i == current_active_pc){ - sprintf((char *) to_draw, "%-.18s ", (char *) ADVEN[i].name); - if( (strlen(ADVEN[i].name)) > 12) + sprintf((char *) to_draw, "%-.18s ", (char *) ADVEN[i].name.c_str()); + if( (ADVEN[i].name.length()) > 12) TextSize(8); ForeColor(blackColor); win_draw_string(GetWindowPort(mainPtr),name_rect,to_draw,1,10,true); diff --git a/osx/Scenario Editor/scen.actions.cpp b/osx/Scenario Editor/scen.actions.cpp index f806cd6c..3243a109 100644 --- a/osx/Scenario Editor/scen.actions.cpp +++ b/osx/Scenario Editor/scen.actions.cpp @@ -26,7 +26,7 @@ short current_block_edited = 0; short current_terrain_type = 0; short safety = 0; location spot_hit,last_spot_hit(-1,-1); -cTown::cCreature null_monst = {0,0,loc(),0,0,0,0,0,0}; +//cTown::cCreature null_monst = {0,0,loc(),0,0,0,0,0,0}; //creature_start_type store_monst = {0,0,{0,0},0,0,0,0,0,0}; bool sign_error_received = false; short copied_spec = -1; @@ -99,7 +99,7 @@ short town_buttons[6][10] = { {50,51,52,53,54,55,56,57,-1,-1}, }; -cTown::cCreature last_placed_monst = {0,0,loc(),0,0,0,0,0,0,0}; +cCreature last_placed_monst; cSpecial null_spec_node;// = {0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; cSpeech::cNode null_talk_node = {0,0,{120,120,120,120},{120,120,120,120},{0,0,0,0}}; @@ -116,12 +116,12 @@ bool monst_on_space(location loc,short m_num); short can_see(location p1,location p2,short mode); void init_current_terrain() { - short i,j; - location d_loc(0,0); - Rect d_rect = {0,0,0,0}; - cTown::cWandering d_wan = {0,0,0,0}; - cTown::cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0}; - //city_ter_rect_type dummy_ter_rect = {{0,0,0,0},0,0}; +// short i,j; +// location d_loc(0,0); +// Rect d_rect = {0,0,0,0}; +// cTown::cWandering d_wan = {0,0,0,0}; +// cTown::cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0}; +// //city_ter_rect_type dummy_ter_rect = {{0,0,0,0},0,0}; } void init_screen_locs() { @@ -631,7 +631,7 @@ bool handle_action(Point the_point,EventRecord event) { town->creatures(i).number = mode_count; town->creatures(i).start_attitude = scenario.scen_monsters[mode_count].default_attitude; - town->creatures(i).mobile = 1; + town->creatures(i).mobility = 1; town->creatures(i).time_flag = 0; town->creatures(i).extra1 = 0; town->creatures(i).extra2 = 0; @@ -3255,7 +3255,7 @@ void start_monster_editing(short just_redo_text) { SetControlMaximum(right_sbar,255 - NRSONPAGE); } for (i = 1; i < 256; i++) { - sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_monsters[i].m_name); + sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_monsters[i].m_name.c_str()); set_rb(i - 1,2000 + i,(char *) str,0); } if (draw_full == true) @@ -3283,7 +3283,7 @@ void start_item_editing(short just_redo_text) { SetControlMaximum(right_sbar,400 - NRSONPAGE); } for (i = 0; i < 400; i++) { - sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_items[i].full_name); + sprintf((char *) str,"%d - %s",i,(char *) scenario.scen_items[i].full_name.c_str()); set_rb(i,3000 + i,(char *) str,0); } if (draw_full == true) diff --git a/osx/Scenario Editor/scen.core.cpp b/osx/Scenario Editor/scen.core.cpp index 80d9b5c8..292a7eb0 100644 --- a/osx/Scenario Editor/scen.core.cpp +++ b/osx/Scenario Editor/scen.core.cpp @@ -851,10 +851,10 @@ void init_scenario() { scenario.scen_monsters[i] = return_monster_template(i); get_str(temp_str,2,i); if ((i > 187) || (i == 0)) - sprintf((char *)scenario.scen_monsters[i].m_name, "Unused"); - else sprintf((char *)scenario.scen_monsters[i].m_name, "%s", temp_str); + scenario.scen_monsters[i].m_name = "Unused"; + else scenario.scen_monsters[i].m_name = (char*)temp_str; if (i == 0) - sprintf((char *)scenario.scen_monsters[i].m_name, "Empty"); + scenario.scen_monsters[i].m_name = "Empty"; } for (i = 0; i < 30; i++) { scenario.boats[i] = null_boat; @@ -1096,7 +1096,7 @@ void put_monst_info_in_dlog() { csp(814,34,store_monst.picture_num % 1000,type_g); } cdsin(814,33,store_which_monst); - CDST(814,2,(char*)scenario.scen_monsters[store_which_monst].m_name); + CDST(814,2,(char*)scenario.scen_monsters[store_which_monst].m_name.c_str()); CDSN(814,3,store_monst.picture_num); sprintf((char *) str,"Width = %d",store_monst.x_width); csit(814,40,(char *) str); @@ -1134,7 +1134,7 @@ bool save_monst_info() { CDGT(814,2,(char *) str); str[19] = 0; - sprintf((char*)scenario.scen_monsters[store_which_monst].m_name,"%s",str); + scenario.scen_monsters[store_which_monst].m_name = (char*)str; //CDGT(814,2,data_store->scen_item_list.monst_names[store_which_monst]); store_monst.picture_num = CDGN(814,3); if (cre(store_monst.picture_num,0,5000,"Monster pic must be from 0 to 5000.","",814) > 0) return false; @@ -1463,8 +1463,8 @@ void put_item_info_in_dlog() { Str255 str; cdsin(818,52,store_which_item); - CDST(818,2,store_item.full_name); - CDST(818,3,store_item.name); + CDST(818,2,store_item.full_name.c_str()); + CDST(818,3,store_item.name.c_str()); if (store_item.graphic_num >= 1000) // was 150 csp(818,49,store_item.graphic_num % 1000,PICT_CUSTOM + PICT_ITEM); else csp(818,49,/*1800 + */store_item.graphic_num,PICT_ITEM); @@ -1489,10 +1489,10 @@ bool save_item_info() { CDGT(818,2,(char *) str); str[24] = 0; - sprintf(store_item.full_name,"%s",str); + store_item.full_name = (char*)str; CDGT(818,3,(char *) str); str[14] = 0; - sprintf(store_item.name,"%s",str); + store_item.name = (char*)str; store_item.graphic_num = CDGN(818,4); store_item.variety = (eItemType) cd_get_led_range(818,18,45); @@ -1629,7 +1629,7 @@ void put_item_abils_in_dlog() { short i; cdsin(824,16,store_which_item); - csit(824,32,store_item2.full_name); + csit(824,32,store_item2.full_name.c_str()); csit(824,34,item_types[store_item2.variety]); get_str(str,23,store_item2.ability + 1); csit(824,19,(char *) str); diff --git a/osx/Scenario Editor/scen.townout.cpp b/osx/Scenario Editor/scen.townout.cpp index 9e667e9b..c1009973 100644 --- a/osx/Scenario Editor/scen.townout.cpp +++ b/osx/Scenario Editor/scen.townout.cpp @@ -30,7 +30,7 @@ extern unsigned char borders[4][50]; extern location cur_out; //extern cSpeech talking; -cTown::cCreature store_placed_monst,store_placed_monst2; +cCreature store_placed_monst,store_placed_monst2; short store_which_placed_monst; cTown::cItem store_placed_item; short store_which_placed_item,store_which_sign; @@ -111,9 +111,9 @@ void put_placed_monst_in_dlog() { short i; cdsin(837,24,store_which_placed_monst); - csit(837,7,(char*)scenario.scen_monsters[store_placed_monst.number].m_name); + csit(837,7,(char*)scenario.scen_monsters[store_placed_monst.number].m_name.c_str()); cd_set_led_range(837,14,17,store_placed_monst.start_attitude); - cd_set_led_range(837,18,19,store_placed_monst.mobile); + cd_set_led_range(837,18,19,store_placed_monst.mobility); CDSN(837,2,store_placed_monst.personality); CDSN(837,3,store_placed_monst.facial_pic); if ((store_placed_monst.facial_pic < 1)) @@ -127,7 +127,7 @@ bool get_placed_monst_in_dlog() { short i; store_placed_monst.start_attitude = cd_get_led_range(837,14,17); - store_placed_monst.mobile = cd_get_led_range(837,18,19); + store_placed_monst.mobility = cd_get_led_range(837,18,19); store_placed_monst.personality = CDGN(837,2); store_placed_monst.facial_pic = CDGN(837,3); // later @@ -138,7 +138,7 @@ bool get_placed_monst_in_dlog() { void edit_placed_monst_event_filter (short item_hit) { Str255 str; short i; - cTown::cCreature store_m; + cCreature store_m; switch (item_hit) { case 20: @@ -210,7 +210,7 @@ void put_placed_monst_adv_in_dlog() { short i; cdsin(838,20,store_which_placed_monst); - csit(838,9,(char*)scenario.scen_monsters[store_placed_monst2.number].m_name); + csit(838,9,(char*)scenario.scen_monsters[store_placed_monst2.number].m_name.c_str()); for (i = 22; i < 30; i++) cd_set_led(838,i,0); if (store_placed_monst2.time_flag < 3) @@ -273,7 +273,7 @@ void edit_placed_monst_adv_event_filter (short item_hit) { } } -cTown::cCreature edit_placed_monst_adv(cTown::cCreature monst_record) { +cCreature edit_placed_monst_adv(cCreature monst_record) { short item_hit,i,store_dialog_answer; Str255 temp_str; @@ -308,7 +308,7 @@ void put_placed_item_in_dlog() { cdsin(836,17,store_which_placed_item); sprintf((char *) str,"X = %d, Y = %d",store_placed_item.loc.x,store_placed_item.loc.y); csit(836,22,(char *) str); - csit(836,15,scenario.scen_items[store_placed_item.code].full_name); + csit(836,15,scenario.scen_items[store_placed_item.code].full_name.c_str()); CDSN(836,2,store_placed_item.ability); if (store_placed_item.always_there == true) cd_set_led(836,12,1); @@ -351,7 +351,7 @@ bool get_placed_item_in_dlog() { void edit_placed_item_event_filter (short item_hit) { Str255 str; short i; - cTown::cCreature store_m; + cCreature store_m; switch (item_hit) { case 3: @@ -730,14 +730,14 @@ void put_out_wand_in_dlog() { if (store_out_wand.monst[i] == 0) csit(852, i + 7, "Empty"); else { - strcpy((char*)str,(char*)scenario.scen_monsters[store_out_wand.monst[i]].m_name); + strcpy((char*)str,(char*)scenario.scen_monsters[store_out_wand.monst[i]].m_name.c_str()); csit(852,i + 7,(char *) str); } for (i = 0; i < 3; i++) if (store_out_wand.friendly[i] == 0) csit(852, i + 7 + 7, "Empty"); else { - strcpy((char*)str,(char*)scenario.scen_monsters[store_out_wand.friendly[i]].m_name); + strcpy((char*)str,(char*)scenario.scen_monsters[store_out_wand.friendly[i]].m_name.c_str()); csit(852,i + 7 + 7,(char *) str); } if (store_out_wand.cant_flee % 10 == 1) @@ -787,7 +787,7 @@ bool get_out_wand_in_dlog() { void edit_out_wand_event_filter (short item_hit) { Str255 str; short i,spec; - cTown::cCreature store_m; + cCreature store_m; switch (item_hit) { case 17: diff --git a/osx/Scenario Editor/scen.townout.h b/osx/Scenario Editor/scen.townout.h index 63df3694..18504807 100644 --- a/osx/Scenario Editor/scen.townout.h +++ b/osx/Scenario Editor/scen.townout.h @@ -4,7 +4,7 @@ void edit_placed_monst(short which_m); void edit_placed_monst_event_filter (short item_hit); bool get_placed_monst_in_dlog(); void put_placed_monst_in_dlog(); -cTown::cCreature edit_placed_monst_adv(cTown::cCreature monst_record); +cCreature edit_placed_monst_adv(cCreature monst_record); void edit_placed_monst_adv_event_filter (short item_hit); bool get_placed_monst_adv_in_dlog(); void put_placed_monst_adv_in_dlog(); diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index b8d7612f..0cefa796 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -86,7 +86,7 @@ short store_shop_type; short debug_ok = 0; short store_selling_values[8] = {0,0,0,0,0,0,0,0}; -extern short cen_x, cen_y, stat_window,give_delays,pc_moves[6]; +extern short cen_x, cen_y, stat_window,give_delays;//,pc_moves[6]; extern eGameMode overall_mode; extern Point to_create; extern bool in_startup_mode,All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going; @@ -136,7 +136,7 @@ extern bool fry_startup; char *dir_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"}; char get_new_terrain(); -cTown::cCreature save_monster_type; +cCreature save_monster_type; short wand_loc_count = 0; short monst_place_count = 0; // 1 - standard place 2 - place last @@ -908,11 +908,11 @@ bool handle_action(EventRecord event) add_string_to_buf(" Creature is hostile. "); } else if ((univ.town.monst.dudes[i].summoned > 0)//// - || (univ.town.monst.dudes[i].monst_start.personality < 0)) + || (univ.town.monst.dudes[i].personality < 0)) add_string_to_buf("Talk: No response. "); else { - start_talk_mode(i,univ.town.monst.dudes[i].monst_start.personality,univ.town.monst.dudes[i].number, - univ.town.monst.dudes[i].monst_start.facial_pic); + start_talk_mode(i,univ.town.monst.dudes[i].personality,univ.town.monst.dudes[i].number, + univ.town.monst.dudes[i].facial_pic); did_something = false; need_redraw = false; break; @@ -1327,7 +1327,7 @@ bool handle_action(EventRecord event) if (need_redraw == true) { draw_terrain(); - if ((combat_active_pc == 6) || (pc_moves[combat_active_pc] > 0)) + if ((combat_active_pc == 6) || (ADVEN[combat_active_pc].ap > 0)) need_redraw = false; } //pause(2); @@ -1774,7 +1774,7 @@ bool handle_keystroke(char chr,char chr2,EventRecord event) univ.town.monst.dudes[i].active = 0; if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) - && (dist(univ.town.monst.dudes[i].m_loc,univ.town.p_loc) <= 10) ) + && (dist(univ.town.monst.dudes[i].cur_loc,univ.town.p_loc) <= 10) ) damage_monst(i, 7,1000,0, DAMAGE_UNBLOCKABLE,0); } // kill_monst(&c_town.monst.dudes[i],6); diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index f5624069..0ed3ea8d 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -44,7 +44,7 @@ extern short store_spell_target,pc_casting,current_spell_range; extern effect_pat_type current_pat; //extern short town_size[3]; extern short town_type; -extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short num_targets_left; extern location spell_targets[8]; extern bool web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; @@ -53,7 +53,7 @@ extern bool fast_bang; //extern unsigned char misc_i[64][64],sfx[64][64]; extern short store_current_pc; extern short refer_mage[62],refer_priest[62]; -extern location monster_targs[60]; +//extern location monster_targs[60]; extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x extern short spell_caster, missile_firer,current_monst_tactic; @@ -273,7 +273,7 @@ effect_pat_type field[8] = {{{{0,0,0,0,1,1,0,0,0}, {0,0,0,0,0,0,0,1,1}, {0,0,0,0,0,0,0,0,1}}}}; -short last_attacked[6],pc_dir[6],pc_parry[6],pc_moves[6]; +short last_attacked[6],pc_dir[6],pc_parry[6];//,pc_moves[6]; bool center_on_monst; @@ -353,35 +353,35 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,unsigned char in_which_ // place monsters, w. friendly monsts landing near PCs for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { - monst_target[i] = 6; + univ.town.monst.dudes[i].target = 6; - univ.town.monst.dudes[i].m_loc.x = get_ran(1,15,25); - univ.town.monst.dudes[i].m_loc.y = get_ran(1,14,18); + univ.town.monst.dudes[i].cur_loc.x = get_ran(1,15,25); + univ.town.monst.dudes[i].cur_loc.y = get_ran(1,14,18); if (univ.town.monst.dudes[i].attitude == 2) - univ.town.monst.dudes[i].m_loc.y += 9; + univ.town.monst.dudes[i].cur_loc.y += 9; else if ((univ.town.monst.dudes[i].m_d.mu > 0) || (univ.town.monst.dudes[i].m_d.cl > 0)) - univ.town.monst.dudes[i].m_loc.y = univ.town.monst.dudes[i].m_loc.y - 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); + univ.town.monst.dudes[i].cur_loc.y -= 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); num_tries = 0; - while (((monst_can_be_there(univ.town.monst.dudes[i].m_loc,i) == false) || - (combat_terrain[univ.town.monst.dudes[i].m_loc.x][univ.town.monst.dudes[i].m_loc.y] == 180) || - (pc_there(univ.town.monst.dudes[i].m_loc) < 6)) && + while (((monst_can_be_there(univ.town.monst.dudes[i].cur_loc,i) == false) || + (combat_terrain[univ.town.monst.dudes[i].cur_loc.x][univ.town.monst.dudes[i].cur_loc.y] == 180) || + (pc_there(univ.town.monst.dudes[i].cur_loc) < 6)) && (num_tries++ < 50)) { - univ.town.monst.dudes[i].m_loc.x = get_ran(1,15,25); - univ.town.monst.dudes[i].m_loc.y = get_ran(1,14,18); + univ.town.monst.dudes[i].cur_loc.x = get_ran(1,15,25); + univ.town.monst.dudes[i].cur_loc.y = get_ran(1,14,18); if (univ.town.monst.dudes[i].attitude == 2) - univ.town.monst.dudes[i].m_loc.y += 9; + univ.town.monst.dudes[i].cur_loc.y += 9; else if ((univ.town.monst.dudes[i].m_d.mu > 0) || (univ.town.monst.dudes[i].m_d.cl > 0)) - univ.town.monst.dudes[i].m_loc.y = univ.town.monst.dudes[i].m_loc.y - 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); + univ.town.monst.dudes[i].cur_loc.y -= 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); } - if (get_blockage(combat_terrain[univ.town.monst.dudes[i].m_loc.x][univ.town.monst.dudes[i].m_loc.y]) > 0) - combat_terrain[univ.town.monst.dudes[i].m_loc.x][univ.town.monst.dudes[i].m_loc.y] = combat_terrain[0][0]; + if (get_blockage(combat_terrain[univ.town.monst.dudes[i].cur_loc.x][univ.town.monst.dudes[i].cur_loc.y]) > 0) + combat_terrain[univ.town.monst.dudes[i].cur_loc.x][univ.town.monst.dudes[i].cur_loc.y] = combat_terrain[0][0]; } combat_active_pc = 6; spell_caster = 6; missile_firer = 6; for (i = 0; i < univ.town->max_monst(); i++) - monst_target[i] = 6; + univ.town.monst.dudes[i].target = 6; for (i = 0; i < 6; i++) { pc_parry[i] = 0; @@ -438,7 +438,7 @@ bool pc_combat_move(location destination) //// if (combat_active_pc == current_pc) combat_active_pc = 6; sprintf ((char *) create_line, "Moved: Fled. "); - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; } else { take_ap(1); @@ -459,12 +459,12 @@ bool pc_combat_move(location destination) //// } } else if ((switch_pc = pc_there(destination)) < 6) { - if (pc_moves[switch_pc] == 0) { + if (ADVEN[switch_pc].ap == 0) { add_string_to_buf("Move: Can't switch places."); add_string_to_buf(" (other PC has no APs) "); return false; } - else pc_moves[switch_pc]--; + else ADVEN[switch_pc].ap--; add_string_to_buf("Move: Switch places."); store_loc = pc_pos[current_pc]; pc_pos[current_pc] = destination; @@ -472,7 +472,7 @@ bool pc_combat_move(location destination) //// ADVEN[current_pc].direction = dir; take_ap(1); check_special_terrain(store_loc,2,switch_pc,&spec_num,&check_f); - move_sound(combat_terrain[destination.x][destination.y],pc_moves[current_pc]); + move_sound(combat_terrain[destination.x][destination.y],ADVEN[current_pc].ap); return true; } else if ((forced == true) @@ -480,7 +480,7 @@ bool pc_combat_move(location destination) //// // monsters get back-shots for (i = 0; i < univ.town->max_monst(); i++) { - monst_loc = univ.town.monst.dudes[i].m_loc; + monst_loc = univ.town.monst.dudes[i].cur_loc; monst_exist = univ.town.monst.dudes[i].active; s1 = current_pc; @@ -506,7 +506,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],pc_moves[current_pc]); + move_sound(combat_terrain[destination.x][destination.y],ADVEN[current_pc].ap); } else return false; @@ -523,21 +523,21 @@ bool pc_combat_move(location destination) //// void char_parry() { - pc_parry[current_pc] = (pc_moves[current_pc] / 4) * + pc_parry[current_pc] = (ADVEN[current_pc].ap / 4) * (2 + stat_adj(current_pc,1) + ADVEN[current_pc].skills[8]); - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; } void char_stand_ready() { pc_parry[current_pc] = 100; - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; } void pc_attack(short who_att,short target)//// { short r1,r2,what_skill1 = 1, what_skill2 = 1, weap1 = 24, weap2 = 24,i,store_hp,skill_item; - cPopulation::cCreature *which_m; + cCreature *which_m; short hit_adj, dam_adj, spec_dam = 0,poison_amt; // slice out bad attacks @@ -585,7 +585,7 @@ void pc_attack(short who_att,short target)//// if (weap1 == 24) { - sprintf ((char *) create_line, "%s punches. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); + sprintf ((char *) create_line, "%s punches. ",(char *) ADVEN[who_att].name.c_str());//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); r1 = get_ran(1,1,100) + hit_adj - 20; @@ -597,7 +597,7 @@ void pc_attack(short who_att,short target)//// } else { draw_terrain(2); - sprintf ((char *) create_line, "%s misses. ",(char *) ADVEN[who_att].name); + sprintf ((char *) create_line, "%s misses. ",(char *) ADVEN[who_att].name.c_str()); add_string_to_buf((char *) create_line); play_sound(2); } @@ -611,7 +611,7 @@ void pc_attack(short who_att,short target)//// if (what_skill1 == 2) what_skill1 = 3; - sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); + sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name.c_str());//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); r1 = get_ran(1,1,100) - 5 + hit_adj @@ -679,7 +679,7 @@ void pc_attack(short who_att,short target)//// } else { draw_terrain(2); - sprintf ((char *) create_line, " %s misses. ",(char *) ADVEN[who_att].name); + sprintf ((char *) create_line, " %s misses. ",(char *) ADVEN[who_att].name.c_str()); add_string_to_buf((char *) create_line); if (what_skill1 == 5) play_sound(19); @@ -694,7 +694,7 @@ void pc_attack(short who_att,short target)//// what_skill2 = 3; - sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name);//,hit_adj, dam_adj); + sprintf ((char *) create_line, "%s swings. ",(char *) ADVEN[who_att].name.c_str());//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); r1 = get_ran(1,1,100) + hit_adj - 5 * ADVEN[who_att].items[weap2].bonus; @@ -740,7 +740,7 @@ void pc_attack(short who_att,short target)//// } else { draw_terrain(2); - sprintf ((char *) create_line, "%s misses. ",(char *) ADVEN[who_att].name); + sprintf ((char *) create_line, "%s misses. ",(char *) ADVEN[who_att].name.c_str()); add_string_to_buf((char *) create_line); if (what_skill2 == 5) play_sound(19); @@ -760,7 +760,7 @@ void pc_attack(short who_att,short target)//// } -short calc_spec_dam(short abil,short abil_str,cPopulation::cCreature *monst) //// +short calc_spec_dam(short abil,short abil_str,cCreature *monst) //// { short store = 0; @@ -877,7 +877,7 @@ void place_target(location target) void do_combat_cast(location target)//// { short adjust,r1,r2,targ_num,s_num,level,bonus = 1,i,item,store_sound = 0; - cPopulation::cCreature *cur_monst; + cCreature *cur_monst; bool freebie = false,ap_taken = false,cost_taken = false; short num_targets = 1,store_m_type = 2; short spray_type_array[15] = {1,1,1,4,4,5,5,5,6,6,7,7,8,8,9}; @@ -1301,7 +1301,7 @@ void do_combat_cast(location target)//// else { r1 = get_ran((spell_being_cast == 103) ? 2 : 6, 1, 14); - hit_space(cur_monst->m_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); + hit_space(cur_monst->cur_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); } break; @@ -1319,7 +1319,7 @@ void do_combat_cast(location target)//// //if (PSD[4][0] == 3) // anama // r1 += 25; //play_sound(53); - hit_space(cur_monst->m_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); + hit_space(cur_monst->cur_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); } break; } @@ -1445,7 +1445,7 @@ void load_missile() //// void fire_missile(location target) { short r1, r2, skill, dam, dam_bonus, hit_bonus, range, targ_monst, spec_dam = 0,poison_amt = 0; short skill_item,m_type = 0; - cPopulation::cCreature *cur_monst; + cCreature *cur_monst; bool exploding = false; missile_firer = current_pc; @@ -1497,7 +1497,7 @@ void fire_missile(location target) { r1 = get_ran(1,1,100) - 5 * hit_bonus - 10; r1 += 5 * (ADVEN[missile_firer].status[6] / 3); r2 = get_ran(1,1,dam) + dam_bonus; - sprintf ((char *) create_line, "%s fires.",(char *) ADVEN[missile_firer].name); // debug + sprintf ((char *) create_line, "%s fires.",(char *) ADVEN[missile_firer].name.c_str()); // debug add_string_to_buf((char *) create_line); if (overall_mode == MODE_THROWING) { @@ -1607,7 +1607,7 @@ bool combat_next_step() if ((combat_active_pc == 6) && (current_pc != store_pc)) { sprintf((char *)create_line, "Active: %s (#%d, %d ap.) ", - ADVEN[current_pc].name,current_pc + 1,pc_moves[current_pc]); + ADVEN[current_pc].name,current_pc + 1,ADVEN[current_pc].ap); add_string_to_buf((char *)create_line); print_buf(); } @@ -1629,22 +1629,22 @@ bool pick_next_pc() // If current pc isn't active, fry its moves if ((combat_active_pc < 6) && (combat_active_pc != current_pc)) - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; // Find next PC with moves - while ((pc_moves[current_pc] <= 0) && (current_pc < 6)) { + while ((ADVEN[current_pc].ap <= 0) && (current_pc < 6)) { current_pc++; if ((combat_active_pc < 6) && (combat_active_pc != current_pc)) - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; } // If run out of PC's, return to start and try again if (current_pc == 6) { current_pc = 0; - while ((pc_moves[current_pc] <= 0) && (current_pc < 6)) { + while ((ADVEN[current_pc].ap <= 0) && (current_pc < 6)) { current_pc++; if ((combat_active_pc < 6) && (combat_active_pc != current_pc)) - pc_moves[current_pc] = 0; + ADVEN[current_pc].ap = 0; } if (current_pc == 6) { store = true; @@ -1746,7 +1746,7 @@ void do_monster_turn() bool redraw_not_yet_done = true; location targ_space,move_targ,l; short i,j,k,num_monst, target,r1,move_target; - cPopulation::cCreature *cur_monst; + cCreature *cur_monst; bool pc_adj[6]; short abil_range[40] = {0,6,8,8,10, 10,10,8,6,8, 6,0,0,0,6, 0,0,0,0,4, 10,0,0,6,0, 0,0,0,0,0, 0,0,8,6,9, 0,0,0,0,0}; @@ -1767,12 +1767,12 @@ void do_monster_turn() if ((cur_monst->active == 1) && (cur_monst->attitude % 2 == 1) && (overall_mode == MODE_COMBAT)) { r1 = get_ran(1,1,100); // Check if see PCs first r1 += (PSD[SDF_PARTY_STEALTHY] > 0) ? 45 : 0; - r1 += can_see(cur_monst->m_loc,closest_pc_loc(cur_monst->m_loc),0) * 10; + r1 += can_see(cur_monst->cur_loc,closest_pc_loc(cur_monst->cur_loc),0) * 10; if (r1 < 50) cur_monst->active = 2; for (j = 0; j < univ.town->max_monst(); j++) - if (monst_near(j,cur_monst->m_loc,5,1) == true) { + if (monst_near(j,cur_monst->cur_loc,5,1) == true) { cur_monst->active = 2; } } @@ -1782,8 +1782,8 @@ void do_monster_turn() for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active > 0) && (univ.town.monst.dudes[j].attitude % 2 != 1) && - (dist(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc) <= 6) && - (can_see(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc,0) < 5)) + (dist(cur_monst->cur_loc,univ.town.monst.dudes[j].cur_loc) <= 6) && + (can_see(cur_monst->cur_loc,univ.town.monst.dudes[j].cur_loc,0) < 5)) cur_monst->active = 2; } @@ -1792,10 +1792,10 @@ void do_monster_turn() if ((cur_monst->active == 1) && (cur_monst->attitude == 2)) { for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active > 0) && (univ.town.monst.dudes[j].attitude % 2 == 1) && - (dist(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc) <= 6) - && (can_see(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc,0) < 5)) { + (dist(cur_monst->cur_loc,univ.town.monst.dudes[j].cur_loc) <= 6) + && (can_see(cur_monst->cur_loc,univ.town.monst.dudes[j].cur_loc,0) < 5)) { cur_monst->active = 2; - cur_monst->mobile = true; + cur_monst->mobility = 1; } } // End of seeing if monsters see others @@ -1865,22 +1865,23 @@ void do_monster_turn() if (target < 6) targ_space = pc_pos[target]; else if (target != 6) - targ_space = univ.town.monst.dudes[target - 100].m_loc; - monst_target[i] = target; + targ_space = univ.town.monst.dudes[target - 100].cur_loc; + univ.town.monst.dudes[i].target = target; } else { - if (monst_target[i] < 6) + if (univ.town.monst.dudes[i].target < 6) targ_space = univ.town.p_loc; - else if (monst_target[i] != 6) - targ_space = univ.town.monst.dudes[monst_target[i] - 100].m_loc; + else if (univ.town.monst.dudes[i].target != 6) + targ_space = univ.town.monst.dudes[univ.town.monst.dudes[i].target - 100].cur_loc; } // sprintf((char *)create_line," %d targets %d.",i,target); // add_string_to_buf((char *) create_line); - if ((monst_target[i] < 0) || ((monst_target[i] > 5) && (monst_target[i] < 100))) - monst_target[i] = 6; - target = monst_target[i]; + if ((univ.town.monst.dudes[i].target < 0) || ((univ.town.monst.dudes[i].target > 5) && + (univ.town.monst.dudes[i].target < 100))) + univ.town.monst.dudes[i].target = 6; + target = univ.town.monst.dudes[i].target; // Now if in town and monster about to attack, do a redraw, so we see monster // in right place @@ -1897,7 +1898,7 @@ void do_monster_turn() && ((target != 6) || (cur_monst->attitude % 2 == 1)) && (party_can_see_monst(i) == true) ) { center_on_monst = true; - center = cur_monst->m_loc; + center = cur_monst->cur_loc; draw_terrain(0); pause((PSD[SDF_GAME_SPEED] == 3) ? 9 : PSD[SDF_GAME_SPEED]); } @@ -1912,22 +1913,22 @@ void do_monster_turn() // running to a nice position. current_monst_tactic = 0; if ((target != 6) && (cur_monst->m_d.ap > 1) && (futzing == 0)) { - l = closest_pc_loc(cur_monst->m_loc); + l = closest_pc_loc(cur_monst->cur_loc); if (((cur_monst->m_d.mu > 0) || (cur_monst->m_d.cl > 0)) && - (dist(cur_monst->m_loc,l) < 5) && (monst_adjacent(l,i) == false)) + (dist(cur_monst->cur_loc,l) < 5) && (monst_adjacent(l,i) == false)) current_monst_tactic = 1; // this means flee if ( (((cur_monst->m_d.spec_skill > 0) && (cur_monst->m_d.spec_skill < 4)) || (cur_monst->m_d.spec_skill == 20)) && // Archer? - (dist(cur_monst->m_loc,targ_space) < 6) && + (dist(cur_monst->cur_loc,targ_space) < 6) && (monst_adjacent(targ_space,i) == false)) current_monst_tactic = 1; // this means flee } // flee - if ((monst_target[i] != 6) && (((cur_monst->m_d.morale <= 0) + if ((univ.town.monst.dudes[i].target != 6) && (((cur_monst->m_d.morale <= 0) && (cur_monst->m_d.spec_skill != 13) && (cur_monst->m_d.m_type != 8)) || (current_monst_tactic == 1))) { if (cur_monst->m_d.morale < 0) @@ -1937,8 +1938,8 @@ void do_monster_turn() r1 = get_ran(1,1,6); if (r1 == 3) cur_monst->m_d.morale++; - if ((ADVEN[monst_target[i]].main_status == 1) && (cur_monst->mobile == true)) { - acted_yet = flee_party (i,cur_monst->m_loc,targ_space); + if ((ADVEN[univ.town.monst.dudes[i].target].main_status == 1) && (cur_monst->mobility == 1)) { + acted_yet = flee_party (i,cur_monst->cur_loc,targ_space); if (acted_yet == true) take_m_ap(1,cur_monst); } } @@ -1954,7 +1955,7 @@ void do_monster_turn() && (get_ran(1,1,8) < 4) && (acted_yet == false)) { //print_nums(cur_monst->m_d.breath,cur_monst->m_d.breath_type,dist(cur_monst->m_loc,targ_space) ); if ((target != 6) - && (dist(cur_monst->m_loc,targ_space) <= 8)) { + && (dist(cur_monst->cur_loc,targ_space) <= 8)) { acted_yet = monst_breathe(cur_monst,targ_space,cur_monst->m_d.breath_type); had_monst = true; acted_yet = true; @@ -1966,7 +1967,7 @@ void do_monster_turn() && (acted_yet == false)) { if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->number >= 160) || (cur_monst->m_d.level > 9)) - && (dist(cur_monst->m_loc,targ_space) <= 10)) { + && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_mage(cur_monst,target); had_monst = true; acted_yet = true; @@ -1976,7 +1977,7 @@ void do_monster_turn() // Priest spell if ((cur_monst->m_d.cl > 0) && (get_ran(1,1,8) < 7) && (acted_yet == false)) { if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->m_d.level > 9)) - && (dist(cur_monst->m_loc,targ_space) <= 10)) { + && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_priest(cur_monst,target); had_monst = true; acted_yet = true; @@ -1992,10 +1993,10 @@ void do_monster_turn() ((cur_monst->m_d.spec_skill > 7) && (cur_monst->m_d.spec_skill != 20) && (cur_monst->m_d.spec_skill != 33))) // missile range - && (dist(cur_monst->m_loc,targ_space) <= abil_range[cur_monst->m_d.spec_skill])) { + && (dist(cur_monst->cur_loc,targ_space) <= abil_range[cur_monst->m_d.spec_skill])) { print_monst_name(cur_monst->number); monst_fire_missile(i/*,cur_monst->m_d.skill*/,cur_monst->m_d.status[1], - cur_monst->m_d.spec_skill,cur_monst->m_loc,target); + cur_monst->m_d.spec_skill,cur_monst->cur_loc,target); // Vapors don't count as action if ((cur_monst->m_d.spec_skill == 11) || (cur_monst->m_d.spec_skill == 7) || @@ -2011,19 +2012,19 @@ void do_monster_turn() } // Special attacks // Attack pc - if ((monst_target[i] < 6) && (ADVEN[monst_target[i]].main_status == 1) + if ((univ.town.monst.dudes[i].target < 6) && (ADVEN[univ.town.monst.dudes[i].target].main_status == 1) && (monst_adjacent(targ_space,i) == true) && (cur_monst->attitude % 2 == 1) && (acted_yet == false)) { - monster_attack_pc(i,monst_target[i]); + monster_attack_pc(i,univ.town.monst.dudes[i].target); take_m_ap(4,cur_monst); acted_yet = true; had_monst = true; } // Attack monst - if ((monst_target[i] >= 100) && (univ.town.monst.dudes[monst_target[i] - 100].active > 0) + if ((univ.town.monst.dudes[i].target >= 100) && (univ.town.monst.dudes[univ.town.monst.dudes[i].target - 100].active > 0) && (monst_adjacent(targ_space,i) == true) && (cur_monst->attitude > 0) && (acted_yet == false)) { - monster_attack_monster(i,monst_target[i] - 100); + monster_attack_monster(i,univ.town.monst.dudes[i].target - 100); take_m_ap(4,cur_monst); acted_yet = true; had_monst = true; @@ -2038,14 +2039,14 @@ void do_monster_turn() } if (overall_mode == MODE_COMBAT) { - if ((acted_yet == false) && (cur_monst->mobile == true)) { // move monst - move_target = (monst_target[i] != 6) ? monst_target[i] : closest_pc(cur_monst->m_loc); + if ((acted_yet == false) && (cur_monst->mobility == 1)) { // move monst + move_target = (univ.town.monst.dudes[i].target != 6) ? univ.town.monst.dudes[i].target : closest_pc(cur_monst->cur_loc); if (monst_hate_spot(i,&move_targ) == true) // First, maybe move out of dangerous space - seek_party (i,cur_monst->m_loc,move_targ); + seek_party (i,cur_monst->cur_loc,move_targ); else { // spot is OK, so go nuts if ((cur_monst->attitude % 2 == 1) && (move_target < 6)) // Monsters seeking party do so if (ADVEN[move_target].main_status == 1) { - seek_party (i,cur_monst->m_loc,pc_pos[move_target]); + seek_party (i,cur_monst->cur_loc,pc_pos[move_target]); for (k = 0; k < 6; k++) if ((pc_parry[k] > 99) && (monst_adjacent(pc_pos[k],i) == true) && (cur_monst->active > 0)) { @@ -2056,7 +2057,7 @@ void do_monster_turn() if (move_target >= 100) // Monsters seeking monsters do so if (univ.town.monst.dudes[move_target - 100].active > 0) { - seek_party (i,cur_monst->m_loc,univ.town.monst.dudes[move_target - 100].m_loc); + seek_party (i,cur_monst->cur_loc,univ.town.monst.dudes[move_target - 100].cur_loc); for (k = 0; k < 6; k++) if ((pc_parry[k] > 99) && (monst_adjacent(pc_pos[k],i) == true) && (cur_monst->active > 0) && (cur_monst->attitude % 2 == 1)) { @@ -2072,7 +2073,7 @@ void do_monster_turn() } take_m_ap(1,cur_monst); } - if ((acted_yet == false) && (cur_monst->mobile == false)) { // drain action points + if ((acted_yet == false) && (cur_monst->mobility == 0)) { // drain action points take_m_ap(1,cur_monst); futzing++; } @@ -2095,32 +2096,32 @@ void do_monster_turn() } // Place fields for monsters that create them. Only done when monst sees foe - if ((target != 6) && (can_see(cur_monst->m_loc,targ_space,0) < 5)) { //// + if ((target != 6) && (can_see(cur_monst->cur_loc,targ_space,0) < 5)) { //// if ((cur_monst->m_d.radiate_1 == 1) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,5,false,7); + place_spell_pattern(square,cur_monst->cur_loc,5,false,7); if ((cur_monst->m_d.radiate_1 == 2) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,8,false,7); + place_spell_pattern(square,cur_monst->cur_loc,8,false,7); if ((cur_monst->m_d.radiate_1 == 3) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,4,false,7); + place_spell_pattern(square,cur_monst->cur_loc,4,false,7); if ((cur_monst->m_d.radiate_1 == 4) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,6,false,7); + place_spell_pattern(square,cur_monst->cur_loc,6,false,7); if ((cur_monst->m_d.radiate_1 == 5) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,12,false,7); + place_spell_pattern(square,cur_monst->cur_loc,12,false,7); if ((cur_monst->m_d.radiate_1 == 6) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) - place_spell_pattern(square,cur_monst->m_loc,7,false,7); + place_spell_pattern(square,cur_monst->cur_loc,7,false,7); if ((cur_monst->m_d.radiate_1 == 10) && (get_ran(1,1,100) < 5)){ if (summon_monster(cur_monst->m_d.radiate_2, - cur_monst->m_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } if ((cur_monst->m_d.radiate_1 == 11) && (get_ran(1,1,100) < 20)){ if (summon_monster(cur_monst->m_d.radiate_2, - cur_monst->m_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } if ((cur_monst->m_d.radiate_1 == 12) && (get_ran(1,1,100) < 50)){ if (summon_monster(cur_monst->m_d.radiate_2, - cur_monst->m_loc,130,cur_monst->attitude) == true) + cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } } @@ -2129,7 +2130,7 @@ void do_monster_turn() // Redraw monster after it goes if ((cur_monst->attitude > 0) && (cur_monst->active > 0) && (cur_monst->m_d.ap == 0) && (is_combat()) && (cur_monst->m_d.picture_num > 0) && (party_can_see_monst(i) == true)) { - center = cur_monst->m_loc; + center = cur_monst->cur_loc; draw_terrain(0); } @@ -2225,7 +2226,7 @@ void do_monster_turn() void monster_attack_pc(short who_att,short target) { - cPopulation::cCreature *attacker; + cCreature *attacker; short r1,r2,i,store_hp,sound_type = 0; eDamageType dam_type = DAMAGE_WEAPON; @@ -2240,7 +2241,7 @@ void monster_attack_pc(short who_att,short target) if ((is_combat()) && ((center_on_monst == true) || (monsters_going == false))) { if (attacker->m_d.spec_skill != 11) - frame_space(attacker->m_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); + frame_space(attacker->cur_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); frame_space(pc_pos[target],1,1,1); } @@ -2416,7 +2417,7 @@ void monster_attack_pc(short who_att,short target) void monster_attack_monster(short who_att,short attackee) { - cPopulation::cCreature *attacker,*target; + cCreature *attacker,*target; short r1,r2,i,store_hp,sound_type = 0; eDamageType dam_type = DAMAGE_WEAPON; @@ -2427,8 +2428,8 @@ void monster_attack_monster(short who_att,short attackee) if ((is_combat()) && ((center_on_monst == true) || (monsters_going == false))) { if (attacker->m_d.spec_skill != 11) - frame_space(attacker->m_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); - frame_space(target->m_loc,1,1,1); + frame_space(attacker->cur_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); + frame_space(target->cur_loc,1,1,1); } @@ -2544,7 +2545,7 @@ void monster_attack_monster(short who_att,short attackee) void monst_fire_missile(short m_num,short bless,short level,location source,short target) //short target; // 100 + - monster is target { - cPopulation::cCreature *m_target; + cCreature *m_target; short r1,r2,dam[40] = {0,1,2,3,4, 6,8,7,0,0, 0,0,0,0,0, 0,0,0,0,0, 8,0,0,0,0, 0,0,0,0,0, 0,0,0,0,6, 0,0,0,0,0},i,j; location targ_space; @@ -2552,7 +2553,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if (target == 6) return; if (target >= 100) { - targ_space = univ.town.monst.dudes[target - 100].m_loc; + targ_space = univ.town.monst.dudes[target - 100].cur_loc; if (univ.town.monst.dudes[target - 100].active == 0) return; } @@ -2581,7 +2582,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor else if (level == 14) { // vapors //play_sound(44); if (target < 100) { // on PC - sprintf ((char *) create_line, " Breathes on %s. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Breathes on %s. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); } else { // on monst @@ -2594,7 +2595,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor else if (level == 19) { // webs //play_sound(14); if (target < 100) { // on PC - sprintf ((char *) create_line, " Throws web at %s. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Throws web at %s. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); } else { // on monst @@ -2607,7 +2608,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor else if (level == 23) { // paral play_sound(51); if (target < 100) { // on PC - sprintf ((char *) create_line, " Fires ray at %s. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Fires ray at %s. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); sleep_pc(target,100,12,0); } @@ -2623,17 +2624,17 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor //play_sound(43); run_a_missile(source,targ_space,14,0,43,0,0,100); if (target < 100) { // on PC - sprintf ((char *) create_line, " Gazes at %s. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Gazes at %s. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); r1 = get_ran(1,0,20) + ADVEN[target].level / 4 + ADVEN[target].status[1]; if (pc_has_abil_equip(target,49) < 24) r1 = 20; if (r1 > 14) { - sprintf ((char *) create_line, " %s resists. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " %s resists. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); } else { - sprintf ((char *) create_line, " %s is turned to stone. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " %s is turned to stone. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); kill_pc(target,MAIN_STATUS_STONE); } @@ -2665,7 +2666,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor } run_a_missile(source,targ_space,8,0,43,0,0,100); - sprintf ((char *) create_line, " Drains %s. ",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Drains %s. ",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); ADVEN[target].cur_sp = ADVEN[target].cur_sp / 2; } @@ -2683,7 +2684,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor r1 = get_ran(7,1,6); start_missile_anim(); if (target < 100) { // pc - sprintf ((char *) create_line, " Hits %s with heat ray.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Hits %s with heat ray.",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); damage_pc(target,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); } @@ -2700,7 +2701,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor 0,0,100); //play_sound(64); if (target < 100) { // pc - sprintf ((char *) create_line, " Spits acid on %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Spits acid on %s.",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); acid_pc(target,6); } @@ -2714,23 +2715,23 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor switch (level) { case 1: case 2: case 20: run_a_missile(source,targ_space,3,1,12,0,0,100); - sprintf ((char *) create_line, " Shoots at %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Shoots at %s.",(char *) ADVEN[target].name.c_str()); break; case 3: run_a_missile(source,targ_space,5,1,14,0,0,100); - sprintf ((char *) create_line, " Throws spear at %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Throws spear at %s.",(char *) ADVEN[target].name.c_str()); break; case 7: run_a_missile(source,targ_space,7,1,14,0,0,100); - sprintf ((char *) create_line, " Throws razordisk at %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Throws razordisk at %s.",(char *) ADVEN[target].name.c_str()); break; case 34: run_a_missile(source,targ_space,5,1,14,0,0,100); - sprintf ((char *) create_line, " Fires spines at %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Fires spines at %s.",(char *) ADVEN[target].name.c_str()); break; default: run_a_missile(source,targ_space,12,1,14,0,0,100); - sprintf ((char *) create_line, " Throws rock at %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Throws rock at %s.",(char *) ADVEN[target].name.c_str()); break; } @@ -2759,7 +2760,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor } } else { - sprintf ((char *) create_line, " Misses %s.",(char *) ADVEN[target].name); + sprintf ((char *) create_line, " Misses %s.",(char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) create_line); } @@ -2788,7 +2789,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor break; } r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * m_target->m_d.status[1] - - 5 * (can_see(source, m_target->m_loc,0)); + - 5 * (can_see(source, m_target->cur_loc,0)); r2 = get_ran(dam[level],1,7) + min(10,bless); if (r1 <= hit_chance[dam[level] * 2]) { @@ -2803,7 +2804,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor } -bool monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_type)//// +bool monst_breathe(cCreature *caster,location targ_space,short dam_type)//// //dam_type; // 0 - fire 1 - cold 2 - magic { short level,missile_t[4] = {13,6,8,8}; @@ -2812,10 +2813,10 @@ bool monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_ draw_terrain(2); if ((is_combat()) && (center_on_monst == true)) { - frame_space(caster->m_loc,0,caster->m_d.x_width,caster->m_d.y_width); + frame_space(caster->cur_loc,0,caster->m_d.x_width,caster->m_d.y_width); } //if (dam_type < 2) - l = caster->m_loc; + l = caster->cur_loc; if ((caster->m_d.direction < 4) && (caster->m_d.x_width > 1)) l.x++; @@ -2841,12 +2842,12 @@ bool monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_ return true; } -bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// +bool monst_cast_mage(cCreature *caster,short targ)//// { short r1,j,spell,i,level,target_levels,friend_levels_near,x; bool acted = false; location target,vict_loc,ashes_loc,l; - cPopulation::cCreature *affected; + cCreature *affected; short caster_array[7][18] = {{1,1,1,2,2, 2,1,3,4,4, 1,1,1,2,2, 2,3,4}, {5,5,5,6,7, 8,9,10,11,11, 2,2,2,5,7, 10,10,5}, {5,5,2,9,11, 12,12,12,14,13, 13,12,12,2,2, 2,2,2}, @@ -2863,7 +2864,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// {18,26,19,27}}; - if (univ.town.is_antimagic(caster->m_loc.x,caster->m_loc.y)) { + if (univ.town.is_antimagic(caster->cur_loc.x,caster->cur_loc.y)) { return false; } // is target dead? @@ -2874,8 +2875,8 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// level = max(1,caster->m_d.mu - caster->m_d.status[9]) - 1; - target = find_fireball_loc(caster->m_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); - friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->m_loc,3) : -1 * count_levels(caster->m_loc,3); + target = find_fireball_loc(caster->cur_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); + friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->cur_loc,3) : -1 * count_levels(caster->cur_loc,3); if ((caster->m_d.health * 4 < caster->m_d.m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; @@ -2913,7 +2914,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// vict_loc = target = univ.town.p_loc; } if (targ >= 100) - vict_loc = univ.town.monst.dudes[targ - 100].m_loc; + vict_loc = univ.town.monst.dudes[targ - 100].cur_loc; if ((targ == 6) && (univ.town.is_antimagic(target.x,target.y))) return false; @@ -2924,22 +2925,22 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// if (is_town()) if ((targ < 6) && (univ.town.is_antimagic(univ.town.p_loc.x,univ.town.p_loc.y))) return false; - if ((targ >= 100) && (univ.town.is_antimagic(univ.town.monst.dudes[targ - 100].m_loc.x, - univ.town.monst.dudes[targ - 100].m_loc.y))) + if ((targ >= 100) && (univ.town.is_antimagic(univ.town.monst.dudes[targ - 100].cur_loc.x, + univ.town.monst.dudes[targ - 100].cur_loc.y))) return false; // How about shockwave? Good idea? if ((spell == 27) && (caster->attitude % 2 != 1)) spell = 26; - if ((spell == 27) && (caster->attitude % 2 == 1) && (count_levels(caster->m_loc,10) < 45)) + if ((spell == 27) && (caster->attitude % 2 == 1) && (count_levels(caster->cur_loc,10) < 45)) spell = 26; // sprintf((char *)create_line,"m att %d trg %d trg2 x%dy%d spl %d mp %d tl:%d ",caster->attitude,targ, // (short)target.x,(short)target.y,spell,caster->m_d.mp,target_levels); // add_string_to_buf((char *) create_line); - l = caster->m_loc; + l = caster->cur_loc; if ((caster->m_d.direction < 4) && (caster->m_d.x_width > 1)) l.x++; @@ -3003,7 +3004,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// //Delay(12,&dummy); // gives sound time to end play_sound(25); play_sound(-61); - summon_monster(r1,caster->m_loc, + summon_monster(r1,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); break; case 11: // conflagration @@ -3042,7 +3043,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// x = get_ran(4,1,4); for (i = 0; i < j; i++){ play_sound(-61); - if (summon_monster(r1,caster->m_loc, + if (summon_monster(r1,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude) == false) { add_string_to_buf(" Summon failed."); i = j;} } @@ -3068,21 +3069,21 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// play_sound(25); if (caster->attitude % 2 == 1) for (i = 0; i < 6; i++) - if (pc_near(i,caster->m_loc,8)) + if (pc_near(i,caster->cur_loc,8)) slow_pc(i,2 + caster->m_d.level / 4); for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude % 2 != 1)) || ((univ.town.monst.dudes[i].attitude % 2 != 1) && (caster->attitude % 2 == 1)) || ((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude != univ.town.monst.dudes[i].attitude))) - && (dist(caster->m_loc,univ.town.monst.dudes[i].m_loc) <= 7)) + && (dist(caster->cur_loc,univ.town.monst.dudes[i].cur_loc) <= 7)) slow_monst(&univ.town.monst.dudes[i],2 + caster->m_d.level / 4); } break; case 18: // major haste play_sound(25); for (i = 0; i < univ.town->max_monst(); i++) - if ((monst_near(i,caster->m_loc,8,0)) && + if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; affected->m_d.status[3] += 3; @@ -3123,13 +3124,13 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// play_sound(25); play_sound(-61); FlushAndPause(12); // gives sound time to end - summon_monster(85,caster->m_loc, + summon_monster(85,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); break; case 25: // major bless play_sound(25); for (i = 0; i < univ.town->max_monst(); i++) - if ((monst_near(i,caster->m_loc,8,0)) && + if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; affected->m_d.health += get_ran(2,1,10); @@ -3143,7 +3144,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// play_sound(4); break; case 27: // shockwave - do_shockwave(caster->m_loc); + do_shockwave(caster->cur_loc); break; } } @@ -3158,12 +3159,12 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// return acted; } -bool monst_cast_priest(cPopulation::cCreature *caster,short targ) +bool monst_cast_priest(cCreature *caster,short targ) { short r1,r2,spell,i,x,level,target_levels,friend_levels_near; bool acted = false; location target,vict_loc,l; - cPopulation::cCreature *affected; + cCreature *affected; short caster_array[7][10] = {{1,1,1,1,3,3,3,4,4,4}, {5,5,6,6,7,7,8,8,8,9}, {9,6,6,8,11,12,12,5,5,12}, @@ -3185,13 +3186,13 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) return false; if ((targ >= 100) && (univ.town.monst.dudes[targ - 100].active == 0)) return false; - if (univ.town.is_antimagic(caster->m_loc.x,caster->m_loc.y)) { + if (univ.town.is_antimagic(caster->cur_loc.x,caster->cur_loc.y)) { return false; } level = max(1,caster->m_d.cl - caster->m_d.status[9]) - 1; - target = find_fireball_loc(caster->m_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); - friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->m_loc,3) : -1 * count_levels(caster->m_loc,3); + target = find_fireball_loc(caster->cur_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); + friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->cur_loc,3) : -1 * count_levels(caster->cur_loc,3); if ((caster->m_d.health * 4 < caster->m_d.m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; @@ -3220,13 +3221,13 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) if (targ < 6) vict_loc = (is_town()) ? univ.town.p_loc : pc_pos[targ]; if (targ >= 100) - vict_loc = univ.town.monst.dudes[targ - 100].m_loc; + vict_loc = univ.town.monst.dudes[targ - 100].cur_loc; if ((targ == 6) && (univ.town.is_antimagic(target.x,target.y))) return false; if ((targ < 6) && (univ.town.is_antimagic(pc_pos[targ].x,pc_pos[targ].y))) return false; - if ((targ >= 100) && (univ.town.is_antimagic(univ.town.monst.dudes[targ - 100].m_loc.x, - univ.town.monst.dudes[targ - 100].m_loc.y))) + if ((targ >= 100) && (univ.town.is_antimagic(univ.town.monst.dudes[targ - 100].cur_loc.x, + univ.town.monst.dudes[targ - 100].cur_loc.y))) return false; @@ -3239,7 +3240,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) ((spell == 17) || (spell == 20))) spell--; - l = caster->m_loc; + l = caster->cur_loc; if ((caster->m_d.direction < 4) && (caster->m_d.x_width > 1)) l.x++; @@ -3282,7 +3283,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) play_sound(-61); x = get_ran(3,1,4); - summon_monster(((spell == 8) ? 125 : 122),caster->m_loc, + summon_monster(((spell == 8) ? 125 : 122),caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); break; case 9: // disease @@ -3320,7 +3321,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) play_sound(-61); r2 = get_ran(1,0,7); x = get_ran(3,1,4); - summon_monster((r2 == 1) ? 100 : 99,caster->m_loc, + summon_monster((r2 == 1) ? 100 : 99,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); } break; @@ -3332,11 +3333,11 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) play_sound(24); x = get_ran(3,1,4) + 1; play_sound(-61); - summon_monster(126,caster->m_loc, + summon_monster(126,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude); for (i = 0; i < 4; i++) { play_sound(-61); - if (summon_monster(125,caster->m_loc, + if (summon_monster(125,caster->cur_loc, ((caster->attitude % 2 != 1) ? 0 : 100) + x,caster->attitude) == false) i = 4; } @@ -3348,7 +3349,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) r2 = get_ran(1,0,2); if (caster->attitude % 2 == 1) for (i = 0; i < 6; i++) - if (pc_near(i,caster->m_loc,8)) { + if (pc_near(i,caster->cur_loc,8)) { if (spell == 13) curse_pc(i,2 + r1); if (spell == 23) @@ -3359,7 +3360,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) (((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude % 2 != 1)) || ((univ.town.monst.dudes[i].attitude % 2 != 1) && (caster->attitude % 2 == 1)) || ((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude != univ.town.monst.dudes[i].attitude))) - && (dist(caster->m_loc,univ.town.monst.dudes[i].m_loc) <= 7)) { + && (dist(caster->cur_loc,univ.town.monst.dudes[i].cur_loc) <= 7)) { if (spell == 13) curse_monst(&univ.town.monst.dudes[i],2 + r1); if (spell == 23) @@ -3382,7 +3383,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) play_sound(24); r1 = get_ran(2,1,4); r2 = get_ran(3,1,6); for (i = 0; i < univ.town->max_monst(); i++) - if ((monst_near(i,caster->m_loc,8,0)) && + if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; if (spell == 16) @@ -3546,7 +3547,7 @@ location where; bool monst_near(short m_num,location where,short radius,short active) //short active; // 0 - any monst 1 - monster need be active { - if ((univ.town.monst.dudes[m_num].active != 0) && (vdist(univ.town.monst.dudes[m_num].m_loc,where) <= radius) + if ((univ.town.monst.dudes[m_num].active != 0) && (vdist(univ.town.monst.dudes[m_num].cur_loc,where) <= radius) && ((active == 0) || (univ.town.monst.dudes[m_num].active == 2)) ) return true; else return false; @@ -3570,7 +3571,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre location spot_hit; location s_loc; rectangle active; - cPopulation::cCreature *which_m; + cCreature *which_m; bool monster_hit = false; @@ -3669,7 +3670,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre // Damage to monsters for (k = 0; k < univ.town->max_monst(); k++) - if ((univ.town.monst.dudes[k].active > 0) && (dist(center,univ.town.monst.dudes[k].m_loc) <= 5)) { + if ((univ.town.monst.dudes[k].active > 0) && (dist(center,univ.town.monst.dudes[k].cur_loc) <= 5)) { monster_hit = false; // First actually make barriers, then draw them, then inflict damaging effects. for (i = minmax(0,univ.town->max_dim() - 1,center.x - 4); i <= minmax(0,univ.town->max_dim() - 1,center.x + 4); i++) @@ -3765,10 +3766,10 @@ void do_shockwave(location target) && (ADVEN[i].main_status == 1)) damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), DAMAGE_UNBLOCKABLE,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) - && (dist(target,univ.town.monst.dudes[i].m_loc) < 11) - && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) - damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst.dudes[i].m_loc) / 2 , 1, 6), 0, DAMAGE_UNBLOCKABLE,0); + if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].cur_loc) > 0) + && (dist(target,univ.town.monst.dudes[i].cur_loc) < 11) + && (can_see(target,univ.town.monst.dudes[i].cur_loc,0) < 5)) + damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst.dudes[i].cur_loc) / 2 , 1, 6), 0, DAMAGE_UNBLOCKABLE,0); do_explosion_anim(5,0); end_missile_anim(); handle_marked_damage(); @@ -3784,9 +3785,9 @@ void radius_damage(location target,short radius, short dam, eDamageType type)/// && (ADVEN[i].main_status == 1)) damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) - && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) - && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) + if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].cur_loc) > 0) + && (dist(target,univ.town.monst.dudes[i].cur_loc) <= radius) + && (can_see(target,univ.town.monst.dudes[i].cur_loc,0) < 5)) damage_monst(i, current_pc, dam, 0, type,0); return; } @@ -3797,9 +3798,9 @@ void radius_damage(location target,short radius, short dam, eDamageType type)/// && (ADVEN[i].main_status == 1)) damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) - && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) - && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) + if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].cur_loc) > 0) + && (dist(target,univ.town.monst.dudes[i].cur_loc) <= radius) + && (can_see(target,univ.town.monst.dudes[i].cur_loc,0) < 5)) damage_monst(i, current_pc, dam, 0, type,0); do_explosion_anim(5,0); end_missile_anim(); @@ -3941,7 +3942,7 @@ void handle_disease() break; case 9: case 10: sprintf ((char *) create_line, " %s unaffected. ", - (char *) ADVEN[i].name); + (char *) ADVEN[i].name.c_str()); add_string_to_buf((char *) create_line); break; } @@ -4048,7 +4049,7 @@ bool combat_cast_mage_spell() { short spell_num,target,i,store_sp,bonus = 1,r1,store_sound = 0,store_m_type = 0,num_opp = 0; char c_line[60]; - cPopulation::cCreature *which_m; + cCreature *which_m; cMonster get_monst; if (univ.town.is_antimagic(pc_pos[current_pc].x,pc_pos[current_pc].y)) { @@ -4127,20 +4128,20 @@ bool combat_cast_mage_spell() switch (spell_num) { case 14: sprintf ((char *) c_line, " %s receives venom. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); poison_weapon(target,3 + bonus,1); store_m_type = 11; break; case 3: sprintf ((char *) c_line, " %s stronger. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); ADVEN[target].status[1] = ADVEN[target].status[1] + 3; store_m_type = 8; break; case 29: sprintf ((char *) c_line, " %s resistant. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); ADVEN[target].status[5] = ADVEN[target].status[5] + 5 + bonus; store_m_type = 15; break; @@ -4150,7 +4151,7 @@ bool combat_cast_mage_spell() ADVEN[target].status[3] = min(8, ADVEN[target].status[3] + i); sprintf ((char *) c_line, " %s hasted. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); store_m_type = 8; break; } @@ -4200,8 +4201,8 @@ bool combat_cast_mage_spell() add_string_to_buf((char *) c_line); for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) - && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= mage_range[spell_num]) - && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc,0) < 5)) { + && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].cur_loc) <= mage_range[spell_num]) + && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].cur_loc,0) < 5)) { which_m = &univ.town.monst.dudes[i]; switch (spell_num) { case 47: @@ -4221,7 +4222,7 @@ bool combat_cast_mage_spell() break; } num_opp++; - add_missile(univ.town.monst.dudes[i].m_loc,store_m_type,0, + add_missile(univ.town.monst.dudes[i].cur_loc,store_m_type,0, 14 * (which_m->m_d.x_width - 1),18 * (which_m->m_d.y_width - 1)); } @@ -4251,7 +4252,7 @@ bool combat_cast_priest_spell() { short spell_num,target,i,store_sp,bonus,store_sound = 0,store_m_type = 0,num_opp = 0; char c_line[60]; - cPopulation::cCreature *which_m; + cCreature *which_m; effect_pat_type protect_pat = {{{0,4,4,4,4,4,4,4,0}, {4,8,8,8,8,8,8,8,4}, {4,8,9,9,9,9,9,8,4}, @@ -4311,7 +4312,7 @@ bool combat_cast_priest_spell() ADVEN[target].status[1] += (spell_num == 0) ? 2 : max(2,(ADVEN[current_pc].level * 3) / 4 + 1 + bonus); sprintf ((char *) c_line, " %s blessed. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); add_string_to_buf((char *) c_line); add_missile(pc_pos[target],8,0,0,0); } @@ -4332,7 +4333,7 @@ bool combat_cast_priest_spell() case 58: ADVEN[current_pc].cur_sp -= s_cost[1][spell_num]; sprintf ((char *) c_line, " %s is an avatar! ", - (char *) ADVEN[current_pc].name); + (char *) ADVEN[current_pc].name.c_str()); add_string_to_buf((char *) c_line); heal_pc(current_pc,200); cure_pc(current_pc,8); @@ -4351,7 +4352,7 @@ bool combat_cast_priest_spell() store_sound = 24; for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) &&(univ.town.monst.dudes[i].attitude % 2 == 1) && - (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= priest_range[spell_num])) { + (dist(pc_pos[current_pc],univ.town.monst.dudes[i].cur_loc) <= priest_range[spell_num])) { which_m = &univ.town.monst.dudes[i]; switch (spell_num) { case 31: @@ -4368,7 +4369,7 @@ bool combat_cast_priest_spell() break; } num_opp++; - add_missile(univ.town.monst.dudes[i].m_loc,store_m_type,0, + add_missile(univ.town.monst.dudes[i].cur_loc,store_m_type,0, 14 * (which_m->m_d.x_width - 1),18 * (which_m->m_d.y_width - 1)); } } @@ -4738,7 +4739,7 @@ void sleep_cloud_space(short m,short n) } -void take_m_ap(short num,cPopulation::cCreature *monst) +void take_m_ap(short num,cCreature *monst) { monst->m_d.ap = max(0,monst->m_d.ap - num); } @@ -4746,10 +4747,10 @@ void take_m_ap(short num,cPopulation::cCreature *monst) void add_new_action(short pc_num) { if (pc_num < 6) - pc_moves[pc_num]++; + ADVEN[pc_num].ap++; } -short get_monst_sound(cPopulation::cCreature *attacker,short which_att) { +short get_monst_sound(cCreature *attacker,short which_att) { short type,strength; type = (which_att == 0) ? attacker->m_d.a1_type : attacker->m_d.a23_type; diff --git a/osx/boe.combat.h b/osx/boe.combat.h index 20bb8835..3f3265cf 100644 --- a/osx/boe.combat.h +++ b/osx/boe.combat.h @@ -3,7 +3,7 @@ bool pc_combat_move(location destination); void char_parry(); void char_stand_ready(); void pc_attack(short who_att,short target); -short calc_spec_dam(short abil,short abil_str,cPopulation::cCreature *monst); +short calc_spec_dam(short abil,short abil_str,cCreature *monst); void place_target(location target); void do_combat_cast(location target); void handle_marked_damage(); @@ -16,9 +16,9 @@ void do_monster_turn(); void monster_attack_pc(short who_att,short target); void monster_attack_monster(short who_att,short attackee); void monst_fire_missile(short m_num,short bless,short level,location source,short target); -bool monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_type); -bool monst_cast_mage(cPopulation::cCreature *caster,short targ); -bool monst_cast_priest(cPopulation::cCreature *caster,short targ); +bool monst_breathe(cCreature *caster,location targ_space,short dam_type); +bool monst_cast_mage(cCreature *caster,short targ); +bool monst_cast_priest(cCreature *caster,short targ); void damage_target(short target,short dam,eDamageType type); location find_fireball_loc(location where,short radius,short mode,short *m); location closest_pc_loc(location where); @@ -49,6 +49,6 @@ void process_fields(); void scloud_space(short m,short n); void web_space(short m,short n); void sleep_cloud_space(short m,short n); -void take_m_ap(short num,cPopulation::cCreature *monst); +void take_m_ap(short num,cCreature *monst); void add_new_action(short pc_num); -short get_monst_sound(cPopulation::cCreature *attacker,short which_att); +short get_monst_sound(cCreature *attacker,short which_att); diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index eebc9c9a..7355bb74 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -842,8 +842,8 @@ void handle_talk_event(Point p) strnum1 = -1; return; case 12: //healer - start_shop_mode(3,univ.town.monst.dudes[store_m_num].monst_start.extra1, - univ.town.monst.dudes[store_m_num].monst_start.extra2,a,(char *)place_string1); + start_shop_mode(3,univ.town.monst.dudes[store_m_num].extra1, + univ.town.monst.dudes[store_m_num].extra2,a,(char *)place_string1); strnum1 = -1; return; break; @@ -998,7 +998,7 @@ void handle_talk_event(Point p) break; case 26: univ.town.monst.dudes[store_m_num].attitude = 1; - univ.town.monst.dudes[store_m_num].mobile = 1; + univ.town.monst.dudes[store_m_num].mobility = 1; talk_end_forced = true; break; case 27: @@ -1008,8 +1008,8 @@ void handle_talk_event(Point p) case 28: univ.town.monst.dudes[store_m_num].active = 0; // Special killing effects - if (sd_legit(univ.town.monst.dudes[store_m_num].monst_start.spec1,univ.town.monst.dudes[store_m_num].monst_start.spec2) == true) - PSD[univ.town.monst.dudes[store_m_num].monst_start.spec1][univ.town.monst.dudes[store_m_num].monst_start.spec2] = 1; + if (sd_legit(univ.town.monst.dudes[store_m_num].spec1,univ.town.monst.dudes[store_m_num].spec2) == true) + PSD[univ.town.monst.dudes[store_m_num].spec1][univ.town.monst.dudes[store_m_num].spec2] = 1; talk_end_forced = true; break; case 29: // town special @@ -1610,7 +1610,7 @@ void put_party_stats() for (i = 0; i < 6; i++) { if (ADVEN[i].main_status > 0) { - cd_set_item_text(989,5 + 5 * i,ADVEN[i].name); + cd_set_item_text(989,5 + 5 * i,ADVEN[i].name.c_str()); cd_activate_item(989,7 + 5 * i,1); cd_activate_item(989,8 + 5 * i,1); cd_set_flag(989,6 + 5 * i,96); diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index 828a9fa7..811599ac 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -58,7 +58,7 @@ extern bool sleep_field; //extern unsigned char template_terrain[64][64]; //extern tiny_tr_type anim_t_d; extern bool modeless_exists[18]; -extern location monster_targs[60]; +//extern location monster_targs[60]; extern DialogPtr modeless_dialogs[18] ; extern short which_combat_type; extern char terrain_blocked[256]; @@ -223,8 +223,8 @@ void finish_load_party(){ univ.town.cur_talk_loaded = univ.town.num; for (int i = 0; i < univ.town->max_monst(); i++){ - monster_targs[i].x = 0; - monster_targs[i].y = 0; + univ.town.monst.dudes[i].targ_loc.x = 0; + univ.town.monst.dudes[i].targ_loc.y = 0; } town_type = scenario.town_size[univ.town.num]; @@ -1047,9 +1047,9 @@ void start_data_dump() for (i = 0; i < univ.town->max_monst(); i++) { sprintf((char *)get_text," Monster %d Status %d Loc %d %d Number %d Att %d Tf %d\r", - (short) i,(short) univ.town.monst.dudes[i].active,(short) univ.town.monst.dudes[i].m_loc.x, - (short) univ.town.monst.dudes[i].m_loc.y,(short) univ.town.monst.dudes[i].number, - (short) univ.town.monst.dudes[i].attitude,(short) univ.town.monst.dudes[i].monst_start.time_flag); + (short) i,(short) univ.town.monst.dudes[i].active,(short) univ.town.monst.dudes[i].cur_loc.x, + (short) univ.town.monst.dudes[i].cur_loc.y,(short) univ.town.monst.dudes[i].number, + (short) univ.town.monst.dudes[i].attitude,(short) univ.town.monst.dudes[i].time_flag); len = (long) (strlen((char *)get_text)); FSWrite(data_dump_file_id, &len, (char *) get_text); } diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 405243c7..ac1ba046 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -51,7 +51,7 @@ extern bool monsters_going,boom_anim_active,cartoon_happening,skip_boom_delay; extern PicHandle spell_pict; extern short current_ground; extern short terrain_pic[256]; -extern short pc_moves[6]; +//extern short pc_moves[6]; extern short num_targets_left; extern location spell_targets[8]; extern short display_mode; @@ -408,6 +408,7 @@ void plop_fancy_startup() init_startup(); + int delay = 220; if(show_startup_splash){ //init_anim(0); pict_to_draw = GetPicture(3000); @@ -447,16 +448,16 @@ void plop_fancy_startup() // NSetPalette(mainPtr,old_palette,pmAllUpdates); // ActivatePalette(mainPtr); - QDFlushPortBuffer(GetWindowPort(mainPtr), wholeRegion); - if (fry_startup == false) { - - play_sound(-22); - EventRecord event; - WaitNextEvent(mDownMask + keyDownMask + mUpMask,&event,220,NULL); - } - - DisposeRgn(wholeRegion); + } else delay = 60; + QDFlushPortBuffer(GetWindowPort(mainPtr), wholeRegion); + if (fry_startup == false) { + + play_sound(-22); + EventRecord event; + WaitNextEvent(mDownMask + keyDownMask + mUpMask,&event,delay,NULL); } + + DisposeRgn(wholeRegion); } void fancy_startup_delay() @@ -619,7 +620,7 @@ void draw_startup_stats() TextSize(14); OffsetRect(&pc_rect,35,0); char_win_draw_string(mainPtr,pc_rect, - ADVEN[i].name,0,18,true); + (char*)ADVEN[i].name.c_str(),0,18,true); OffsetRect(&to_rect,pc_rect.left + 8,pc_rect.top + 8); } @@ -1129,7 +1130,7 @@ void draw_text_bar(short mode) //short num_rect[3] = {12,10,4}; // Why? Just... why? short i; location loc; - char combat_string[100]; + string combat_string; loc = (is_out()) ? global_to_local(univ.party.p_loc) : univ.town.p_loc; @@ -1170,17 +1171,18 @@ void draw_text_bar(short mode) } if ((is_combat()) && (current_pc < 6) && (monsters_going == false)) { - sprintf((char *) combat_string,"%s (ap: %d)", - ADVEN[current_pc].name,pc_moves[current_pc]); - put_text_bar((char *) combat_string); + ostringstream sout; + sout << ADVEN[current_pc].name << " (ap: " << ADVEN[current_pc].ap << ')'; + combat_string = sout.str(); + put_text_bar((char *) combat_string.c_str()); remember_tiny_text = 500; } if ((is_combat()) && (monsters_going == true)) // Print bar for 1st monster with >0 ap - // that is monster that is going for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].m_d.ap > 0)) { - print_monster_going((char *) combat_string,univ.town.monst.dudes[i].number,univ.town.monst.dudes[i].m_d.ap); - put_text_bar((char *) combat_string); + combat_string = print_monster_going(univ.town.monst.dudes[i].number,univ.town.monst.dudes[i].m_d.ap); + put_text_bar((char *) combat_string.c_str()); remember_tiny_text = 500; i = 400; } @@ -1795,8 +1797,8 @@ void draw_terrain(short mode) if (current_working_monster >= 100) { for (i = 0; i < univ.town.monst.dudes[current_working_monster - 100].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[current_working_monster - 100].m_d.y_width; j++) { - ok_space[i + 2 * j].x = univ.town.monst.dudes[current_working_monster - 100].m_loc.x + i; - ok_space[i + 2 * j].y = univ.town.monst.dudes[current_working_monster - 100].m_loc.y + j; + ok_space[i + 2 * j].x = univ.town.monst.dudes[current_working_monster - 100].cur_loc.x + i; + ok_space[i + 2 * j].y = univ.town.monst.dudes[current_working_monster - 100].cur_loc.y + j; ok_space[i + 2 * j].x = ok_space[i + 2 * j].x - center.x + 4; ok_space[i + 2 * j].y = ok_space[i + 2 * j].y - center.y + 4; } diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index a7809ba6..b7720fca 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -40,7 +40,7 @@ extern bool sleep_field; //extern unsigned char misc_i[64][64],sfx[64][64]; extern short on_monst_menu[256]; extern DialogPtr modeless_dialogs[18]; -extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x //extern piles_of_stuff_dumping_type *data_store; @@ -56,7 +56,7 @@ extern location pc_pos[6],center; extern short which_combat_type,pc_dir[6],current_pc; extern bool monsters_going,anim_onscreen; -extern short pc_moves[6]; +//extern short pc_moves[6]; extern short num_targets_left; extern location spell_targets[8]; extern short display_mode; @@ -294,10 +294,10 @@ void draw_monsters() //// if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) if (party_can_see_monst(i)) { check_if_monst_seen(univ.town.monst.dudes[i].number); - where_draw.x = univ.town.monst.dudes[i].m_loc.x - center.x + 4; - where_draw.y = univ.town.monst.dudes[i].m_loc.y - center.y + 4; + where_draw.x = univ.town.monst.dudes[i].cur_loc.x - center.x + 4; + where_draw.y = univ.town.monst.dudes[i].cur_loc.y - center.y + 4; get_monst_dims(univ.town.monst.dudes[i].number,&width,&height); - if (point_onscreen(center,univ.town.monst.dudes[i].m_loc) == true) + if (point_onscreen(center,univ.town.monst.dudes[i].cur_loc) == true) play_see_monster_str(univ.town.monst.dudes[i].number); for (k = 0; k < width * height; k++) { @@ -314,13 +314,13 @@ void draw_monsters() //// if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); - ter = univ.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); + ter = univ.town->terrain(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y); // in bed? if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].picture == 143) && ((univ.town.monst.dudes[i].m_d.m_type < 7) && (univ.town.monst.dudes[i].m_d.m_type != 1) && (univ.town.monst.dudes[i].m_d.m_type != 2)) - && ((univ.town.monst.dudes[i].active == 1) || (monst_target[i] == 6)) && + && ((univ.town.monst.dudes[i].active == 1) || (univ.town.monst.dudes[i].target == 6)) && (width == 1) && (height == 1)) //// draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10230,0); else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); @@ -330,11 +330,11 @@ void draw_monsters() //// if (is_combat()) { for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) - if (((point_onscreen(center,univ.town.monst.dudes[i].m_loc) == true) && (cartoon_happening == true)) + if (((point_onscreen(center,univ.town.monst.dudes[i].cur_loc) == true) && (cartoon_happening == true)) || (party_can_see_monst(i) == true)) { check_if_monst_seen(univ.town.monst.dudes[i].number); - where_draw.x = univ.town.monst.dudes[i].m_loc.x - center.x + 4; - where_draw.y = univ.town.monst.dudes[i].m_loc.y - center.y + 4; + where_draw.x = univ.town.monst.dudes[i].cur_loc.x - center.x + 4; + where_draw.y = univ.town.monst.dudes[i].cur_loc.y - center.y + 4; get_monst_dims(univ.town.monst.dudes[i].number,&width,&height); for (k = 0; k < width * height; k++) { @@ -352,12 +352,12 @@ void draw_monsters() //// source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) ,k); - ter = univ.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); + ter = univ.town->terrain(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y); if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].picture == 143) && ((univ.town.monst.dudes[i].m_d.m_type < 7) && (univ.town.monst.dudes[i].m_d.m_type != 1) && (univ.town.monst.dudes[i].m_d.m_type != 2)) - && ((univ.town.monst.dudes[i].active == 1) || (monst_target[i] == 6)) && + && ((univ.town.monst.dudes[i].active == 1) || (univ.town.monst.dudes[i].target == 6)) && (width == 1) && (height == 1)) draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10230,0); //// else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 4957dbd0..310ac436 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -26,7 +26,7 @@ short mage_spell_pos = 0,priest_spell_pos = 0,skill_pos = 0; cPlayer *store_pc; -cPopulation::cCreature *store_m; +cCreature *store_m; short store_trait_mode,store_item_pc,store_pc_num; cItemRec store_i; @@ -74,7 +74,7 @@ extern short store_str_label_1,store_str_label_2,store_str_label_1b,store_str_la // Misc dialog vars short store_display_mode,store_displayed_item,position,num_entries,store_help_mode; unsigned short cur_entry; -cPopulation::cCreature hold_m; +cCreature hold_m; void put_spell_info() { @@ -228,7 +228,7 @@ void put_pc_graphics() else cd_set_led(991,i,0); } - cd_set_item_text(991,69,ADVEN[which_pc_displayed].name); + cd_set_item_text(991,69,ADVEN[which_pc_displayed].name.c_str()); } void display_pc_event_filter (short item_hit) @@ -326,11 +326,11 @@ void put_item_info(short pc,short item)//// if (!s_i.is_ident()) { - cd_set_item_text(998,3, s_i.name); + cd_set_item_text(998,3, s_i.name.c_str()); return; } - cd_set_item_text(998,3, s_i.full_name); + cd_set_item_text(998,3, s_i.full_name.c_str()); i = s_i.item_weight(); cd_set_item_num(998,20,i); @@ -473,7 +473,7 @@ void display_pc_item(short pc_num,short item,cItemRec si,short parent) void put_monst_info()//// { - char store_text[256]; + string store_text; Str255 str; short abil,i; @@ -498,8 +498,8 @@ void put_monst_info()//// cd_set_pict(999,4,(store_m->m_d.picture_num % 1000), type_g); } - get_m_name((char *) store_text,store_m->number); - cd_set_item_text(999,5,store_text); + store_text = get_m_name(store_m->number); + cd_set_item_text(999,5,store_text.c_str()); // Clear fields for (i = 6; i < 20; i++) { cd_set_item_text(999,i,""); @@ -513,10 +513,11 @@ void put_monst_info()//// for (i = 0; i < 3; i++) if (store_m->m_d.a[i] > 0) { - sprintf((char *) store_text," %dd%d ", - store_m->m_d.a[i] / 100 + 1, store_m->m_d.a[i] % 100); + ostringstream sout(store_text); + sout << store_m->m_d.a[i] / 100 + 1 << 'd' << store_m->m_d.a[i] % 100; + store_text = sout.str(); - cd_set_item_text(999,13 + i,store_text); + cd_set_item_text(999,13 + i,store_text.c_str()); } cd_set_item_num(999,6,store_m->m_d.level); cd_set_item_num(999,7,store_m->m_d.health); @@ -577,7 +578,7 @@ void display_monst_event_filter (short item_hit) } } -void display_monst(short array_pos,cPopulation::cCreature *which_m,short mode) +void display_monst(short array_pos,cCreature *which_m,short mode) //creature_data_type *which_m; // if NULL, show full roster //short mode; // if 1, full roster, else use monster from storwhich_me_m { @@ -824,7 +825,7 @@ void display_pc_info() } store = total_encumberance(pc); cdsin(1019,62,store); - csit(1019,9,ADVEN[pc].name); + csit(1019,9,ADVEN[pc].name.c_str()); cdsin(1019,11,ADVEN[pc].level); cdsin(1019,13,ADVEN[pc].experience); cdsin(1019,71,ADVEN[pc].skill_pts); diff --git a/osx/boe.infodlg.h b/osx/boe.infodlg.h index 92bbeafc..97af44f3 100644 --- a/osx/boe.infodlg.h +++ b/osx/boe.infodlg.h @@ -12,7 +12,7 @@ void display_pc_item_event_filter (short item_hit); void display_pc_item(short pc_num,short item,cItemRec si,short parent); void put_monst_info(); void display_monst_event_filter (short item_hit); -void display_monst(short array_pos,cPopulation::cCreature *which_m,short mode); +void display_monst(short array_pos,cCreature *which_m,short mode); void display_help_event_filter (short item_hit); void display_help(short mode,short parent); void display_alchemy_event_filter (short item_hit); diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index 2e1d82dc..b3ad5f94 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -489,14 +489,14 @@ void enchant_weapon(short pc_num,short item_hit,short enchant_type,short new_val ADVEN[pc_num].items[item_hit].charges = 8; break; default: - strcpy(store_name,ADVEN[pc_num].items[item_hit].full_name); + strcpy(store_name,ADVEN[pc_num].items[item_hit].full_name.c_str()); break; } if (ADVEN[pc_num].items[item_hit].value > 15000) ADVEN[pc_num].items[item_hit].value = 15000; if (ADVEN[pc_num].items[item_hit].value < 0) ADVEN[pc_num].items[item_hit].value = 15000; - strcpy(ADVEN[pc_num].items[item_hit].full_name,store_name); + ADVEN[pc_num].items[item_hit].full_name = store_name; } void equip_item(short pc_num,short item_num) @@ -780,7 +780,7 @@ short get_item(location place,short pc_num,bool check_container) for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude == 1) - && (can_see(place,univ.town.monst.dudes[i].m_loc,0) < 5)) + && (can_see(place,univ.town.monst.dudes[i].cur_loc,0) < 5)) mass_get = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) @@ -800,7 +800,7 @@ short get_item(location place,short pc_num,bool check_container) if (display_item(place,pc_num,mass_get,check_container) > 0) { // if true, there was a theft for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 != 1) - && (can_see(place,univ.town.monst.dudes[i].m_loc,0) < 5)) { + && (can_see(place,univ.town.monst.dudes[i].cur_loc,0) < 5)) { make_town_hostile(); i = univ.town->max_monst(); add_string_to_buf("Your crime was seen!"); @@ -833,7 +833,7 @@ void make_town_hostile() if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].summoned == 0)){ univ.town.monst.dudes[i].attitude = 1; num = univ.town.monst.dudes[i].number; - univ.town.monst.dudes[i].mobile = true; + univ.town.monst.dudes[i].mobility = 1; if (scenario.scen_monsters[num].spec_skill == 37) { univ.town.monst.dudes[i].active = 2; @@ -902,7 +902,7 @@ void put_item_graphics() if (item_array[i + first_item_shown] != 200) { // display an item in window item = univ.town.items[item_array[i + first_item_shown]]; sprintf ((char *) message, "%s", - (item.is_ident()) ? (char *) item.full_name : (char *) item.name); + (item.is_ident() ? item.full_name : item.name).c_str()); csit(987,21 + i * 4,(char *) message); if (item.graphic_num >= 1000) // was 150 csp(987,20 + i * 4,/*3000 + 2000 + */item.graphic_num - 1000,PICT_CUSTOM + PICT_ITEM); @@ -1183,7 +1183,7 @@ short char_select_pc(short active_only,short free_inv_only,char *title) cd_activate_item(1018, 3 + i, 0); } if (ADVEN[i].main_status != 0) { - csit(1018,9 + i,ADVEN[i].name); + csit(1018,9 + i,ADVEN[i].name.c_str()); } else cd_activate_item(1018, 9 + i, 0); } diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 79748526..106afb45 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -425,10 +425,10 @@ bool monst_on_space(location loc,short m_num) if (univ.town.monst.dudes[m_num].active == 0) return false; - if ((loc.x - univ.town.monst.dudes[m_num].m_loc.x >= 0) && - (loc.x - univ.town.monst.dudes[m_num].m_loc.x <= univ.town.monst.dudes[m_num].m_d.x_width - 1) && - (loc.y - univ.town.monst.dudes[m_num].m_loc.y >= 0) && - (loc.y - univ.town.monst.dudes[m_num].m_loc.y <= univ.town.monst.dudes[m_num].m_d.y_width - 1)) + if ((loc.x - univ.town.monst.dudes[m_num].cur_loc.x >= 0) && + (loc.x - univ.town.monst.dudes[m_num].cur_loc.x <= univ.town.monst.dudes[m_num].m_d.x_width - 1) && + (loc.y - univ.town.monst.dudes[m_num].cur_loc.y >= 0) && + (loc.y - univ.town.monst.dudes[m_num].cur_loc.y <= univ.town.monst.dudes[m_num].m_d.y_width - 1)) return true; return false; @@ -448,18 +448,18 @@ bool monst_can_be_there(location loc,short m_num) location destination; // First clear monst away so it doesn't block itself - univ.town.monst.dudes[m_num].m_loc.x += 100; + univ.town.monst.dudes[m_num].cur_loc.x += 100; for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { destination.x = loc.x + i; destination.y = loc.y + j; if ((is_blocked(destination) == true) || (loc_off_act_area(destination) == true)) { - univ.town.monst.dudes[m_num].m_loc.x -= 100; + univ.town.monst.dudes[m_num].cur_loc.x -= 100; return false; } } - univ.town.monst.dudes[m_num].m_loc.x -= 100; + univ.town.monst.dudes[m_num].cur_loc.x -= 100; return true; } @@ -470,8 +470,8 @@ bool monst_adjacent(location loc,short m_num) for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = univ.town.monst.dudes[m_num].m_loc.x + i; - destination.y = univ.town.monst.dudes[m_num].m_loc.y + j; + destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; + destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (adjacent(destination,loc) == true) return true; } @@ -485,8 +485,8 @@ bool monst_can_see(short m_num,location l) for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = univ.town.monst.dudes[m_num].m_loc.x + i; - destination.y = univ.town.monst.dudes[m_num].m_loc.y + j; + destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; + destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (can_see(destination,l,0) < 5) return true; } @@ -500,8 +500,8 @@ bool party_can_see_monst(short m_num) for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = univ.town.monst.dudes[m_num].m_loc.x + i; - destination.y = univ.town.monst.dudes[m_num].m_loc.y + j; + destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; + destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (party_can_see(destination) < 6) return true; } @@ -515,8 +515,8 @@ bool can_see_monst(location l,short m_num) for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = univ.town.monst.dudes[m_num].m_loc.x + i; - destination.y = univ.town.monst.dudes[m_num].m_loc.y + j; + destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; + destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (can_see(l,destination,0) < 5) return true; } diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index ecb8d03e..723ae802 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -82,7 +82,7 @@ bool belt_present = false; //setup_save_type setup_save; //unsigned char misc_i[64][64],sfx[64][64]; ////unsigned char template_terrain[64][64]; -location monster_targs[60]; // TODO: Integrate this into the town cCreature type +//location monster_targs[60]; // TODO: Integrate this into the town cCreature type //outdoor_strs_type outdoor_text[2][2]; /* Display globals */ @@ -129,7 +129,7 @@ location pc_pos[6]; short current_pc; short combat_active_pc; effect_pat_type current_pat; -short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +//short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x // TODO: Integrate this ^ into the town cCreature type short spell_caster, missile_firer,current_monst_tactic; short store_current_pc = 0; diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index ce5f92d9..c31b0609 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -25,11 +25,11 @@ extern unsigned char combat_terrain[64][64];//,out[96][96]; extern short which_combat_type; //extern pc_record_type ADVEN[6]; //extern big_tr_type t_d; -extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short spell_caster, missile_firer,current_monst_tactic; extern short hit_chance[21]; //extern unsigned char univ.out.misc_i[64][64]; -extern location monster_targs[60]; +//extern location monster_targs[60]; extern location pc_pos[6],center; extern short boom_gr[8],futzing; @@ -41,7 +41,7 @@ extern cUniverse univ; short charm_odds[20] = {90,90,85,80,78, 75,73,60,40,30, 20,10,4,1,0, 0,0,0,0,0}; -cTown::cCreature null_start_type = {0,0,loc(80,80),1,0,0,0,0,0,0,0, 0,-1,-1,-1}; +//cCreature null_start_type; = {0,0,loc(80,80),1,0,0,0,0,0,0,0, 0,-1,-1,-1}; //// cMonster return_monster_template(unsigned char store) @@ -238,7 +238,7 @@ location get_monst_head(short m_num) { location l; - l = univ.town.monst.dudes[m_num].m_loc; + l = univ.town.monst.dudes[m_num].cur_loc; if ((univ.town.monst.dudes[m_num].m_d.direction < 4) && (univ.town.monst.dudes[m_num].m_d.x_width > 1)) l.x++; @@ -285,14 +285,15 @@ void set_up_monst(short mode,unsigned char m_num) for (which = 0; which < univ.town->max_monst(); which++) if (univ.town.monst.dudes[which].active == 0) { + univ.town.monst.dudes[which] = cCreature(); univ.town.monst.dudes[which].active = 2; univ.town.monst.dudes[which].summoned = 0; univ.town.monst.dudes[which].attitude = mode + 1; univ.town.monst.dudes[which].number = m_num; univ.town.monst.dudes[which].m_d = return_monster_template(m_num); - univ.town.monst.dudes[which].mobile = true; - univ.town.monst.dudes[which].monst_start = null_start_type; - which = univ.town->max_monst(); + univ.town.monst.dudes[which].mobility = 1; + //univ.town.monst.dudes[which].monst_start = null_start_type; + break; } } @@ -313,33 +314,33 @@ void do_monsters() target = monst_pick_target(i); // will return 0 if target party target = switch_target_to_adjacent(i,target); if (target == 0) { - if (dist(univ.town.monst.dudes[i].m_loc,univ.town.p_loc) > 8) + if (dist(univ.town.monst.dudes[i].cur_loc,univ.town.p_loc) > 8) target = 6; else target = select_active_pc(); } if ((univ.town.monst.dudes[i].attitude % 2 != 1) && (target < 6)) target = 6; } - monst_target[i] = target; + univ.town.monst.dudes[i].target = target; // sprintf((char *)debug," t: %d targets %d.",i,monst_target[i]); // add_string_to_buf((char *) debug); if ((univ.town.monst.dudes[i].active == 2) || ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].attitude % 2 != 1))) { acted_yet = false; - if (((univ.town.monst.dudes[i].attitude == 0) || (monst_target[i] == 6)) && (univ.town.hostile == 0)) { - if (univ.town.monst.dudes[i].mobile == true) { // OK, it doesn't see the party or + if (((univ.town.monst.dudes[i].attitude == 0) || (univ.town.monst.dudes[i].target == 6)) && (univ.town.hostile == 0)) { + if (univ.town.monst.dudes[i].mobility == 1) { // OK, it doesn't see the party or // isn't nasty, and the town isn't totally hostile. if ((univ.town.monst.dudes[i].attitude % 2 != 1) || (get_ran(1,0,1) == 0)) { acted_yet = rand_move(i); } - else acted_yet = seek_party(i,univ.town.monst.dudes[i].m_loc,univ.town.p_loc); + else acted_yet = seek_party(i,univ.town.monst.dudes[i].cur_loc,univ.town.p_loc); } } if ((univ.town.monst.dudes[i].attitude > 0) || (univ.town.hostile == 1)) { - if ((univ.town.monst.dudes[i].mobile == true) && (monst_target[i] != 6)) { - l1 = univ.town.monst.dudes[i].m_loc; - l2 = (monst_target[i] <= 6) ? univ.town.p_loc : univ.town.monst.dudes[target - 100].m_loc; + if ((univ.town.monst.dudes[i].mobility == 1) && (univ.town.monst.dudes[i].target != 6)) { + l1 = univ.town.monst.dudes[i].cur_loc; + l2 = (univ.town.monst.dudes[i].target <= 6) ? univ.town.p_loc : univ.town.monst.dudes[target - 100].cur_loc; if ((univ.town.monst.dudes[i].m_d.morale < 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 13) && (univ.town.monst.dudes[i].m_d.m_type != 8)) { @@ -359,10 +360,10 @@ void do_monsters() // Make hostile monsters active if ((univ.town.monst.dudes[i].active == 1) && (univ.town.monst.dudes[i].attitude % 2 == 1) - && (dist(univ.town.monst.dudes[i].m_loc,univ.town.p_loc) <= 8)) { + && (dist(univ.town.monst.dudes[i].cur_loc,univ.town.p_loc) <= 8)) { r1 = get_ran(1,1,100); r1 += (PSD[SDF_PARTY_STEALTHY] > 0) ? 46 : 0; - r1 += can_see(univ.town.monst.dudes[i].m_loc,univ.town.p_loc,0) * 10; + r1 += can_see(univ.town.monst.dudes[i].cur_loc,univ.town.p_loc,0) * 10; if (r1 < 50) { univ.town.monst.dudes[i].active = 2; add_string_to_buf("Monster saw you!"); @@ -375,7 +376,7 @@ void do_monsters() } for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active == 2) - && ((dist(univ.town.monst.dudes[i].m_loc,univ.town.monst.dudes[j].m_loc) <= 5) == true)) + && ((dist(univ.town.monst.dudes[i].cur_loc,univ.town.monst.dudes[j].cur_loc) <= 5) == true)) univ.town.monst.dudes[i].active = 2; } @@ -400,7 +401,7 @@ bool monst_hate_spot(short which_m,location *good_loc) { location prospect,loc; - loc = univ.town.monst.dudes[which_m].m_loc; + loc = univ.town.monst.dudes[which_m].cur_loc; if (univ.town.is_fire_barr(loc.x,loc.y) || univ.town.is_force_barr(loc.x,loc.y) || univ.town.is_quickfire(loc.x,loc.y) || univ.town.is_blade_wall(loc.x,loc.y) // hate regular fields || (univ.town.is_ice_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 2) @@ -428,23 +429,23 @@ bool monst_hate_spot(short which_m,location *good_loc) short monst_pick_target(short which_m) { - cPopulation::cCreature *cur_monst; + cCreature *cur_monst; short targ_pc,targ_m; cur_monst = &univ.town.monst.dudes[which_m]; // First, any chance target is screwed? - if (monst_target[which_m] >= 100) { + if (univ.town.monst.dudes[which_m].target >= 100) { if (((cur_monst->attitude % 2 == 1) && - (univ.town.monst.dudes[monst_target[which_m] - 100].attitude == cur_monst->attitude)) || - ((cur_monst->attitude % 2 == 0) && (univ.town.monst.dudes[monst_target[which_m] - 100].attitude % 2 == 0))) - monst_target[which_m] = 6; - else if (univ.town.monst.dudes[monst_target[which_m] - 100].active == 0) - monst_target[which_m] = 6; + (univ.town.monst.dudes[univ.town.monst.dudes[which_m].target - 100].attitude == cur_monst->attitude)) || + ((cur_monst->attitude % 2 == 0) && (univ.town.monst.dudes[univ.town.monst.dudes[which_m].target - 100].attitude % 2 == 0))) + univ.town.monst.dudes[which_m].target = 6; + else if (univ.town.monst.dudes[univ.town.monst.dudes[which_m].target - 100].active == 0) + univ.town.monst.dudes[which_m].target = 6; } - if (monst_target[which_m] < 6) - if ((ADVEN[monst_target[which_m]].main_status != 1) || (get_ran(1,0,3) == 1)) - monst_target[which_m] = 6; + if (univ.town.monst.dudes[which_m].target < 6) + if ((ADVEN[univ.town.monst.dudes[which_m].target].main_status != 1) || (get_ran(1,0,3) == 1)) + univ.town.monst.dudes[which_m].target = 6; if ((is_combat()) && (cur_monst->attitude % 2 == 1)) { if (spell_caster < 6) @@ -455,10 +456,10 @@ short monst_pick_target(short which_m) if ((get_ran(1,1,5) < 3) && (monst_can_see(which_m,pc_pos[missile_firer]) == true) && (ADVEN[missile_firer].main_status == 1)) return missile_firer; - if (monst_target[which_m] < 6) - if ((monst_can_see(which_m,pc_pos[monst_target[which_m]]) == true) - && (ADVEN[monst_target[which_m]].main_status == 1)) - return monst_target[which_m]; + if (univ.town.monst.dudes[which_m].target < 6) + if ((monst_can_see(which_m,pc_pos[univ.town.monst.dudes[which_m].target]) == true) + && (ADVEN[univ.town.monst.dudes[which_m].target].main_status == 1)) + return univ.town.monst.dudes[which_m].target; } // if (monst_target[which_m] >= 100) { @@ -484,24 +485,24 @@ short monst_pick_target(short which_m) } if ((targ_m == 6) && (cur_monst->attitude % 2 == 1)) return 0; - if (dist(cur_monst->m_loc,univ.town.monst.dudes[targ_m - 100].m_loc) < - dist(cur_monst->m_loc,univ.town.p_loc)) + if (dist(cur_monst->cur_loc,univ.town.monst.dudes[targ_m - 100].cur_loc) < + dist(cur_monst->cur_loc,univ.town.p_loc)) return targ_m; else return 0; } // Otherwise we're in combat - if ((dist(cur_monst->m_loc,univ.town.monst.dudes[targ_m - 100].m_loc) == - dist(cur_monst->m_loc,pc_pos[targ_pc])) && (get_ran(1,0,6) < 3)) + if ((dist(cur_monst->cur_loc,univ.town.monst.dudes[targ_m - 100].cur_loc) == + dist(cur_monst->cur_loc,pc_pos[targ_pc])) && (get_ran(1,0,6) < 3)) return targ_m; else return targ_pc; - if (dist(cur_monst->m_loc,univ.town.monst.dudes[targ_m - 100].m_loc) < - dist(cur_monst->m_loc,pc_pos[targ_pc])) + if (dist(cur_monst->cur_loc,univ.town.monst.dudes[targ_m - 100].cur_loc) < + dist(cur_monst->cur_loc,pc_pos[targ_pc])) return targ_m; else return targ_pc; } -short monst_pick_target_monst(cPopulation::cCreature *which_m) +short monst_pick_target_monst(cCreature *which_m) { short min_dist = 1000,i,cur_targ = 6; @@ -510,10 +511,10 @@ short monst_pick_target_monst(cPopulation::cCreature *which_m) (((which_m->attitude % 2 == 1) && (univ.town.monst.dudes[i].attitude % 2 == 0)) || ((which_m->attitude % 2 == 0) && (univ.town.monst.dudes[i].attitude % 2 == 1)) || ((which_m->attitude % 2 == 1) && (univ.town.monst.dudes[i].attitude != which_m->attitude))) && // they hate each other - ((dist(which_m->m_loc,univ.town.monst.dudes[i].m_loc) < min_dist) || - ((dist(which_m->m_loc,univ.town.monst.dudes[i].m_loc) == min_dist) && (get_ran(1,0,7) < 4))) && - (monst_can_see(i,univ.town.monst.dudes[i].m_loc) == true) ) { - min_dist = dist(which_m->m_loc,univ.town.monst.dudes[i].m_loc); + ((dist(which_m->cur_loc,univ.town.monst.dudes[i].cur_loc) < min_dist) || + ((dist(which_m->cur_loc,univ.town.monst.dudes[i].cur_loc) == min_dist) && (get_ran(1,0,7) < 4))) && + (monst_can_see(i,univ.town.monst.dudes[i].cur_loc) == true) ) { + min_dist = dist(which_m->cur_loc,univ.town.monst.dudes[i].cur_loc); cur_targ = i + 100; } @@ -521,7 +522,7 @@ short monst_pick_target_monst(cPopulation::cCreature *which_m) return cur_targ; } -short monst_pick_target_pc(short m_num,cPopulation::cCreature *which_m)//// +short monst_pick_target_pc(short m_num,cCreature *which_m)//// { short num_tries = 0,r1,store_targ = 6; @@ -543,7 +544,7 @@ short monst_pick_target_pc(short m_num,cPopulation::cCreature *which_m)//// // Then, see if target can be replaced with someone nice and close r1 = get_ran(1,0,5); while ((num_tries < 6) && ((ADVEN[r1].main_status != 1) || - (dist(which_m->m_loc,pc_pos[r1]) > 4) || + (dist(which_m->cur_loc,pc_pos[r1]) > 4) || (monst_can_see(m_num,pc_pos[r1]) == false))) { r1 = get_ran(1,0,5); num_tries++; @@ -586,9 +587,9 @@ short closest_monst(location where,short mode) for (i = 0; i < univ.town->max_monst(); i++) if ((((univ.town.monst.dudes[i].attitude % 2 == 1) && (mode == 1)) || ((univ.town.monst.dudes[i].attitude % 2 == 0) && (mode == 2))) - && (dist(where,univ.town.monst.dudes[i].m_loc) < how_close)) { + && (dist(where,univ.town.monst.dudes[i].cur_loc) < how_close)) { store = i; - how_close = dist(where,univ.town.monst.dudes[i].m_loc); + how_close = dist(where,univ.town.monst.dudes[i].cur_loc); } return store; } @@ -598,18 +599,18 @@ short switch_target_to_adjacent(short which_m,short orig_target) location monst_loc; short i,num_adj = 0; - monst_loc = univ.town.monst.dudes[which_m].m_loc; + monst_loc = univ.town.monst.dudes[which_m].cur_loc; // First, take care of friendly monsters. if (univ.town.monst.dudes[which_m].attitude % 2 == 0) { if (orig_target >= 100) if ((univ.town.monst.dudes[orig_target - 100].active > 0) && - (monst_adjacent(univ.town.monst.dudes[orig_target - 100].m_loc,which_m) == true)) + (monst_adjacent(univ.town.monst.dudes[orig_target - 100].cur_loc,which_m) == true)) return orig_target; for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) && - (monst_adjacent(univ.town.monst.dudes[i].m_loc,which_m) == true)) + (monst_adjacent(univ.town.monst.dudes[i].cur_loc,which_m) == true)) return i + 100; return orig_target; } @@ -626,7 +627,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) return orig_target; if (orig_target >= 100) if ((univ.town.monst.dudes[orig_target - 100].active > 0) && - (monst_adjacent(univ.town.monst.dudes[orig_target - 100].m_loc,which_m) == true)) + (monst_adjacent(univ.town.monst.dudes[orig_target - 100].cur_loc,which_m) == true)) return orig_target; // Anyone unarmored? Heh heh heh... @@ -640,7 +641,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 0) && - (monst_adjacent(univ.town.monst.dudes[i].m_loc,which_m) == true) && + (monst_adjacent(univ.town.monst.dudes[i].cur_loc,which_m) == true) && (get_ran(1,0,2) < 2)) return i + 100; @@ -676,41 +677,41 @@ bool rand_move(char i) return outdoor_move_monster(i,store_loc); } - if (monster_targs[i] == univ.town.monst.dudes[i].m_loc) - monster_targs[i].x = 0; + if (univ.town.monst.dudes[i].targ_loc == univ.town.monst.dudes[i].cur_loc) + univ.town.monst.dudes[i].targ_loc.x = 0; // FIrst, try to move to monst_targs. If it don't work, then we'll shift. - if (monster_targs[i].x > 0) - acted_yet = seek_party(i,univ.town.monst.dudes[i].m_loc,monster_targs[i]); + if (univ.town.monst.dudes[i].targ_loc.x > 0) + acted_yet = seek_party(i,univ.town.monst.dudes[i].cur_loc,univ.town.monst.dudes[i].targ_loc); if (acted_yet == false) { - monster_targs[i].x = 0; + univ.town.monst.dudes[i].targ_loc.x = 0; for (j = 0; j < 3; j++) { - store_loc = univ.town.monst.dudes[i].m_loc; + store_loc = univ.town.monst.dudes[i].cur_loc; store_loc.x += get_ran(1,0,24) - 12; store_loc.y += get_ran(1,0,24) - 12; - if ((loc_off_act_area(store_loc) == false) && (can_see(univ.town.monst.dudes[i].m_loc,store_loc,0) < 5)) { - monster_targs[i] = store_loc; j = 3; + if ((loc_off_act_area(store_loc) == false) && (can_see(univ.town.monst.dudes[i].cur_loc,store_loc,0) < 5)) { + univ.town.monst.dudes[i].targ_loc = store_loc; j = 3; } } - if (monster_targs[i].x == 0) { + if (univ.town.monst.dudes[i].targ_loc.x == 0) { // maybe pick a wand loc, else juist pick a loc j = get_ran(1,0,3); store_loc = univ.town->wandering_locs[j]; if ((loc_off_act_area(store_loc) == false) && (get_ran(1,0,1) == 1)) - monster_targs[i] = store_loc; + univ.town.monst.dudes[i].targ_loc = store_loc; else { - store_loc = univ.town.monst.dudes[i].m_loc; + store_loc = univ.town.monst.dudes[i].cur_loc; store_loc.x += get_ran(1,0,20) - 10; store_loc.y += get_ran(1,0,20) - 10; if (loc_off_act_area(store_loc) == false) - monster_targs[i] = store_loc; + univ.town.monst.dudes[i].targ_loc = store_loc; } } - if (monster_targs[i].x > 0) - acted_yet = seek_party(i,univ.town.monst.dudes[i].m_loc,monster_targs[i]); + if (univ.town.monst.dudes[i].targ_loc.x > 0) + acted_yet = seek_party(i,univ.town.monst.dudes[i].cur_loc,univ.town.monst.dudes[i].targ_loc); } return acted_yet; @@ -804,8 +805,8 @@ bool combat_move_monster(short which,location destination) return false; else { univ.town.monst.dudes[which].m_d.direction = - set_direction(univ.town.monst.dudes[which].m_loc, destination); - univ.town.monst.dudes[which].m_loc = destination; + set_direction(univ.town.monst.dudes[which].cur_loc, destination); + univ.town.monst.dudes[which].cur_loc = destination; monst_inflict_fields(which); if (point_onscreen(destination,center) == true) { @@ -893,8 +894,8 @@ bool town_move_monster(short num,location dest) if (monst_can_be_there(dest,num) == true) { univ.town.monst.dudes[num].m_d.direction = - set_direction(univ.town.monst.dudes[num].m_loc, dest); - univ.town.monst.dudes[num].m_loc = dest; + set_direction(univ.town.monst.dudes[num].cur_loc, dest); + univ.town.monst.dudes[num].cur_loc = dest; monst_inflict_fields(num); return true; } @@ -915,7 +916,7 @@ void monst_inflict_fields(short which_monst) { short i,j,r1,k; location where_check; - cPopulation::cCreature *which_m; + cCreature *which_m; if (univ.town.monst.dudes[which_monst].active == 0) return; @@ -924,8 +925,8 @@ void monst_inflict_fields(short which_monst) for (i = 0; i < univ.town.monst.dudes[which_monst].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[which_monst].m_d.y_width; j++) if (univ.town.monst.dudes[which_monst].active > 0) { - where_check.x = univ.town.monst.dudes[which_monst].m_loc.x + i; - where_check.y = univ.town.monst.dudes[which_monst].m_loc.y + j; + where_check.x = univ.town.monst.dudes[which_monst].cur_loc.x + i; + where_check.y = univ.town.monst.dudes[which_monst].cur_loc.y + j; if (univ.town.is_quickfire(where_check.x,where_check.y)) { r1 = get_ran(2,1,8); damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); @@ -973,8 +974,8 @@ void monst_inflict_fields(short which_monst) if (univ.town.monst.dudes[which_monst].active > 0) for (i = 0; i < univ.town.monst.dudes[which_monst].m_d.x_width; i++) for (j = 0; j < univ.town.monst.dudes[which_monst].m_d.y_width; j++) { - where_check.x = univ.town.monst.dudes[which_monst].m_loc.x + i; - where_check.y = univ.town.monst.dudes[which_monst].m_loc.y + j; + where_check.x = univ.town.monst.dudes[which_monst].cur_loc.x + i; + where_check.y = univ.town.monst.dudes[which_monst].cur_loc.y + j; if ((univ.town.is_crate(where_check.x,where_check.y)) || (univ.town.is_barrel(where_check.x,where_check.y)) ) for (k = 0; k < NUM_TOWN_ITEMS; k++) @@ -1001,10 +1002,10 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon bool can_enter = true,mage = false; location from_loc,to_loc; bool do_look = false; // If becomes true, terrain changed, so need to update what party sees - cPopulation::cCreature *which_m; + cCreature *which_m; short ter_abil; - from_loc = univ.town.monst.dudes[which_monst].m_loc; + from_loc = univ.town.monst.dudes[which_monst].cur_loc; switch (mode) { case 1: ter = univ.town->terrain(where_check.x,where_check.y); @@ -1180,13 +1181,13 @@ void forced_place_monster(unsigned char which,location where) } do r1 = get_ran(1,0,59); - while ((univ.town.monst.dudes[r1].monst_start.spec1 != 0) || (univ.town.monst.dudes[r1].monst_start.spec2 != 0)); + while ((univ.town.monst.dudes[r1].spec1 != 0) || (univ.town.monst.dudes[r1].spec2 != 0)); if (free_spot == false) univ.town.monst.dudes[r1].active = 0; place_monster(which,where); } -void magic_adjust(cPopulation::cCreature *which_m,short *how_much) +void magic_adjust(cCreature *which_m,short *how_much) { if (which_m->m_d.spec_skill == 26) { *how_much = 0; @@ -1198,7 +1199,7 @@ void magic_adjust(cPopulation::cCreature *which_m,short *how_much) *how_much = 0; } -void poison_monst(cPopulation::cCreature *which_m,short how_much) +void poison_monst(cCreature *which_m,short how_much) { if (which_m->m_d.immunities & 64) how_much = how_much / 2; @@ -1210,7 +1211,7 @@ void poison_monst(cPopulation::cCreature *which_m,short how_much) monst_spell_note(which_m->number,(how_much == 0) ? 10 : 4); } -void acid_monst(cPopulation::cCreature *which_m,short how_much) +void acid_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[13] = minmax(-8,8, which_m->m_d.status[13] + how_much); @@ -1218,35 +1219,35 @@ void acid_monst(cPopulation::cCreature *which_m,short how_much) } -void slow_monst(cPopulation::cCreature *which_m,short how_much) +void slow_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[3] = minmax(-8,8, which_m->m_d.status[3] - how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 2); } -void curse_monst(cPopulation::cCreature *which_m,short how_much) +void curse_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[1] = minmax(-8,8, which_m->m_d.status[1] - how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 5); } -void web_monst(cPopulation::cCreature *which_m,short how_much) +void web_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[6] = minmax(-8,8, which_m->m_d.status[6] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 19); } -void scare_monst(cPopulation::cCreature *which_m,short how_much) +void scare_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.morale = which_m->m_d.morale - how_much; monst_spell_note(which_m->number,(how_much == 0) ? 10 : 1); } -void disease_monst(cPopulation::cCreature *which_m,short how_much) +void disease_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[7] = minmax(-8,8, which_m->m_d.status[7] + how_much); @@ -1254,7 +1255,7 @@ void disease_monst(cPopulation::cCreature *which_m,short how_much) } -void dumbfound_monst(cPopulation::cCreature *which_m,short how_much) +void dumbfound_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); which_m->m_d.status[9] = minmax(-8,8, which_m->m_d.status[9] + how_much); @@ -1262,7 +1263,7 @@ void dumbfound_monst(cPopulation::cCreature *which_m,short how_much) } -void charm_monst(cPopulation::cCreature *which_m,short penalty,short which_status,short amount) +void charm_monst(cCreature *which_m,short penalty,short which_status,short amount) // Also used for sleep and paralyze, which_statys is 0 means charm { short r1; @@ -1303,7 +1304,7 @@ void charm_monst(cPopulation::cCreature *which_m,short penalty,short which_statu //one_sound(53); } } -void record_monst(cPopulation::cCreature *which_m) +void record_monst(cCreature *which_m) { short r1; char str[60]; @@ -1341,22 +1342,23 @@ short place_monster(unsigned char which,location where) short i = 0; while ((i < univ.town->max_monst()) && ((univ.town.monst.dudes[i].active != 0) || - (univ.town.monst.dudes[i].monst_start.spec_enc_code > 0))) { + (univ.town.monst.dudes[i].spec_enc_code > 0))) { i++; } if (i < univ.town->max_monst()) { + univ.town.monst.dudes[i] = cCreature(); univ.town.monst.dudes[i].m_d = return_monster_template((unsigned char) which); univ.town.monst.dudes[i].attitude = scenario.scen_monsters[which].default_attitude; if (univ.town.monst.dudes[i].attitude % 2 == 0) univ.town.monst.dudes[i].attitude = 1; - univ.town.monst.dudes[i].mobile = true; + univ.town.monst.dudes[i].mobility = 1; univ.town.monst.dudes[i].active = 2; univ.town.monst.dudes[i].number = which; - univ.town.monst.dudes[i].m_loc = where; + univ.town.monst.dudes[i].cur_loc = where; univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].monst_start = null_start_type; - monst_target[i] = 6; + //univ.town.monst.dudes[i].monst_start = null_start_type; + univ.town.monst.dudes[i].target = 6; if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { add_monst_graphic(which,1); @@ -1432,21 +1434,21 @@ void activate_monsters(short code,short attitude) if (code == 0) return; for (i = 0; i < univ.town->max_monst(); i++) - if (univ.town.monst.dudes[i].monst_start.spec_enc_code == code) + if (univ.town.monst.dudes[i].spec_enc_code == code) { - univ.town.monst.dudes[i].monst_start.spec_enc_code = 0; + univ.town.monst.dudes[i].spec_enc_code = 0; univ.town.monst.dudes[i].active = 2; which = univ.town.monst.dudes[i].number; univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].m_loc = univ.town->creatures(i).start_loc; + univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; univ.town.monst.dudes[i].m_d = return_monster_template(univ.town.monst.dudes[i].number); - monst_target[i] = 6; + univ.town.monst.dudes[i].target = 6; add_monst_graphic(univ.town.monst.dudes[i].number,1); - univ.town.set_crate(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y,false); - univ.town.set_barrel(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y,false); + univ.town.set_crate(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y,false); + univ.town.set_barrel(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y,false); } } diff --git a/osx/boe.monster.h b/osx/boe.monster.h index 4ed2ff2e..bf573974 100644 --- a/osx/boe.monster.h +++ b/osx/boe.monster.h @@ -14,8 +14,8 @@ void set_up_monst(short mode,unsigned char m_num); void do_monsters(); bool monst_hate_spot(short which_m,location *good_loc); short monst_pick_target(short which_m); -short monst_pick_target_monst(cPopulation::cCreature *which_m); -short monst_pick_target_pc(short m_num,cPopulation::cCreature *which_m); +short monst_pick_target_monst(cCreature *which_m); +short monst_pick_target_pc(short m_num,cCreature *which_m); short select_active_pc(); short closest_pc(location where); short closest_monst(location where,short mode); @@ -34,17 +34,17 @@ bool monster_placid(short m_num); void monst_inflict_fields(short which_monst); bool monst_check_special_terrain(location where_check,short mode,short which_monst); void forced_place_monster(unsigned char which,location where); -void magic_adjust(cPopulation::cCreature *which_m,short *how_much); -void poison_monst(cPopulation::cCreature *which_m,short how_much); -void acid_monst(cPopulation::cCreature *which_m,short how_much); -void slow_monst(cPopulation::cCreature *which_m,short how_much); -void curse_monst(cPopulation::cCreature *which_m,short how_much); -void web_monst(cPopulation::cCreature *which_m,short how_much); -void scare_monst(cPopulation::cCreature *which_m,short how_much); -void disease_monst(cPopulation::cCreature *which_m,short how_much); -void dumbfound_monst(cPopulation::cCreature *which_m,short how_much); -void charm_monst(cPopulation::cCreature *which_m,short penalty,short which_status,short amount); -void record_monst(cPopulation::cCreature *which_m); +void magic_adjust(cCreature *which_m,short *how_much); +void poison_monst(cCreature *which_m,short how_much); +void acid_monst(cCreature *which_m,short how_much); +void slow_monst(cCreature *which_m,short how_much); +void curse_monst(cCreature *which_m,short how_much); +void web_monst(cCreature *which_m,short how_much); +void scare_monst(cCreature *which_m,short how_much); +void disease_monst(cCreature *which_m,short how_much); +void dumbfound_monst(cCreature *which_m,short how_much); +void charm_monst(cCreature *which_m,short penalty,short which_status,short amount); +void record_monst(cCreature *which_m); short place_monster(unsigned char which,location where); bool summon_monster(unsigned char which,location where,short duration,short given_attitude); void activate_monsters(short code,short attitude); diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index 63fb0ce0..5a5b51fe 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -875,13 +875,13 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew base_item = get_stored_item(what_chosen); base_item.item_properties = base_item.item_properties | 1; draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); - strcpy(cur_name,base_item.full_name); + strcpy(cur_name,base_item.full_name.c_str()); get_item_interesting_string(base_item,cur_info_str); break; case 5: base_item = store_alchemy(what_chosen - 500); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],53,PICT_ITEM, false,1);//// all graphic nums - strcpy(cur_name,base_item.full_name); + strcpy(cur_name,base_item.full_name.c_str()); sprintf(cur_info_str,""); break; case 6: @@ -900,13 +900,13 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew base_item = store_mage_spells(what_chosen - 800 - 30); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); - strcpy(cur_name,base_item.full_name); + strcpy(cur_name,base_item.full_name.c_str()); sprintf(cur_info_str,""); break; case 9: base_item = store_priest_spells(what_chosen - 900 - 30); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); - strcpy(cur_name,base_item.full_name); + strcpy(cur_name,base_item.full_name.c_str()); sprintf(cur_info_str,""); break; default: @@ -915,7 +915,7 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew base_item = univ.party.magic_store_items[what_magic_shop][what_magic_shop_item]; base_item.item_properties = base_item.item_properties | 1; draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); - strcpy(cur_name,base_item.full_name); + strcpy(cur_name,base_item.full_name.c_str()); get_item_interesting_string(base_item,cur_info_str); break; } @@ -989,14 +989,14 @@ cItemRec store_mage_spells(short which_s) 5000,3000,3500,4000,4000,4500,7000,5000 }; - Str255 str; + char str[255]; if (which_s != minmax(0,31,which_s)) which_s = 0; spell.item_level = which_s + 30; spell.value = cost[which_s]; - get_str(str,38,which_s + 1); - strcpy((char *)spell.full_name,(char *)str); + get_str((unsigned char*)str,38,which_s + 1); + spell.full_name = str; return spell; } @@ -1010,14 +1010,14 @@ cItemRec store_priest_spells(short which_s) 500,500,600,800, 1000,900,400,600, 2500,2000,4500,4500,3000,3000,2000,2000 }; - Str255 str; + char str[255]; if (which_s != minmax(0,31,which_s)) which_s = 0; spell.item_level = which_s + 30; spell.value = cost[which_s]; - get_str(str,38,which_s + 50); - strcpy((char *)spell.full_name,(char *)str); + get_str((unsigned char*)str,38,which_s + 50); + spell.full_name = str; return spell; } cItemRec store_alchemy(short which_s) @@ -1029,14 +1029,14 @@ cItemRec store_alchemy(short which_s) 300, 500,600,750,700, 1000,10000,5000,7000,12000 }; - Str255 str; + char str[255]; if (which_s != minmax(0,19,which_s)) which_s = 0; spell.item_level = which_s; spell.value = val[which_s]; - get_str(str,38,which_s + 100); - strcpy((char *)spell.full_name,(char *)str); + get_str((unsigned char*)str,38,which_s + 100); + spell.full_name = str; return spell; } diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 11b309d9..f5ba2ebb 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -128,7 +128,7 @@ extern short pc_last_cast[2][6]; extern effect_pat_type null_pat,single,t,square,rad2,rad3; extern effect_pat_type current_pat; extern short current_spell_range; -extern short hit_chance[21],pc_parry[6],pc_moves[6],combat_active_pc; +extern short hit_chance[21],pc_parry[6],combat_active_pc;//,pc_moves[6]; extern short boom_gr[8]; extern unsigned char beasts[5]; extern unsigned char m1[20]; @@ -669,7 +669,7 @@ void curse_pc(short which_pc,short how_much) return; if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[1] = max(ADVEN[which_pc].status[1] - how_much,-8); - sprintf ((char *) c_line, " %s cursed.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s cursed.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } put_pc_screen(); @@ -690,13 +690,13 @@ void dumbfound_pc(short which_pc,short how_much) if (r1 < ADVEN[which_pc].level) how_much -= 2; if (how_much <= 0) { - sprintf ((char *) c_line, " %s saved.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s saved.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); return; } if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[9] = min(ADVEN[which_pc].status[9] + how_much,8); - sprintf ((char *) c_line, " %s dumbfounded.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s dumbfounded.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } one_sound(67); @@ -714,7 +714,7 @@ void disease_pc(short which_pc,short how_much) if (r1 < ADVEN[which_pc].level * 2) how_much -= 2; if (how_much <= 0) { - sprintf ((char *) c_line, " %s saved.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s saved.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); return; } @@ -728,7 +728,7 @@ void disease_pc(short which_pc,short how_much) how_much++; if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[7] = min(ADVEN[which_pc].status[7] + how_much,8); - sprintf ((char *) c_line, " %s diseased.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s diseased.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } one_sound(66); @@ -758,20 +758,20 @@ void sleep_pc(short which_pc,short how_much,short what_type,short adjust) if ((what_type == 11) && ((ADVEN[which_pc].traits[7] > 0) || (ADVEN[which_pc].status[11] < 0))) how_much = -1; if (how_much <= 0) { - sprintf ((char *) c_line, " %s resisted.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s resisted.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); return; } if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[what_type] = how_much; if (what_type == 11) - sprintf ((char *) c_line, " %s falls asleep.",(char *) ADVEN[which_pc].name); - else sprintf ((char *) c_line, " %s paralyzed.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s falls asleep.",(char *) ADVEN[which_pc].name.c_str()); + else sprintf ((char *) c_line, " %s paralyzed.",(char *) ADVEN[which_pc].name.c_str()); if (what_type == 11) play_sound(96); else play_sound(90); add_string_to_buf((char *) c_line); - pc_moves[which_pc] = 0; + ADVEN[which_pc].ap = 0; } put_pc_screen(); if (what_type == 11) @@ -789,8 +789,8 @@ void slow_pc(short which_pc,short how_much)//// ADVEN[which_pc].status[3] = minmax(-8,8,ADVEN[which_pc].status[3] - how_much); if (how_much < 0) - sprintf ((char *) c_line, " %s hasted.",(char *) ADVEN[which_pc].name); - else sprintf ((char *) c_line, " %s slowed.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s hasted.",(char *) ADVEN[which_pc].name.c_str()); + else sprintf ((char *) c_line, " %s slowed.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } put_pc_screen(); @@ -804,7 +804,7 @@ void web_pc(short which_pc,short how_much) return; if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[6] = min(ADVEN[which_pc].status[6] + how_much,8); - sprintf ((char *) c_line, " %s webbed.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s webbed.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); one_sound(17); } @@ -817,13 +817,13 @@ void acid_pc(short which_pc,short how_much) if (ADVEN[which_pc].main_status != 1) return; if (pc_has_abil_equip(which_pc,36) < 24) { - sprintf ((char *) c_line, " %s resists acid.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s resists acid.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); return; } if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].status[13] += how_much; - sprintf ((char *) c_line, " %s covered with acid!",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s covered with acid!",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); one_sound(42); } @@ -935,7 +935,7 @@ void award_xp(short pc_num,short amt) while (ADVEN[pc_num].experience >= (ADVEN[pc_num].level * (ADVEN[pc_num].get_tnl()))) { play_sound(7); ADVEN[pc_num].level++; - sprintf ((char *) c_line, " %s is level %d! ",(char *) ADVEN[pc_num].name,ADVEN[pc_num].level); + sprintf ((char *) c_line, " %s is level %d! ",(char *) ADVEN[pc_num].name.c_str(),ADVEN[pc_num].level); add_string_to_buf((char *) c_line); ADVEN[pc_num].skill_pts += (ADVEN[pc_num].level < 20) ? 5 : 4; add_hp = (ADVEN[pc_num].level < 26) ? get_ran(1,2,6) + skill_bonus[ADVEN[pc_num].skills[0]] @@ -957,7 +957,7 @@ void drain_pc(short which_pc,short how_much) { if (ADVEN[which_pc].main_status == 1) { ADVEN[which_pc].experience = max(ADVEN[which_pc].experience - how_much,0); - sprintf ((char *) c_line, " %s drained.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s drained.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } } @@ -1010,10 +1010,10 @@ void do_xp_draw() pc_num = store_train_pc; if (mode == 0) { if (ADVEN[pc_num].main_status == 1) - sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name); + sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name.c_str()); else sprintf((char *) get_text, "New PC"); } - else sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name); + else sprintf((char *) get_text, "%s",(char *) ADVEN[pc_num].name.c_str()); cd_set_item_text (1010, 51,get_text); @@ -1756,14 +1756,14 @@ void do_priest_spell(short pc_num,short spell_num) //// case 1: case 20: case 39: r1 = get_ran(2 + 2 * (spell_num / 6), 1, 4); sprintf ((char *) c_line, " %s healed %d. ", - (char *) ADVEN[target].name,r1); + (char *) ADVEN[target].name.c_str(),r1); heal_pc(target,r1); one_sound(52); break; case 2: case 11: sprintf ((char *) c_line, " %s cured. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); r1 = ((spell_num == 2) ? 1 : 3) + get_ran(1,0,2) + stat_adj(pc_num,2) / 2; cure_pc(target,r1); break; @@ -1771,41 +1771,41 @@ void do_priest_spell(short pc_num,short spell_num) //// case 19: // awaken if (ADVEN[target].status[11] <= 0) { sprintf ((char *) c_line, " %s is already awake! " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); break; } sprintf ((char *) c_line, " %s wakes up. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); ADVEN[target].status[11] = 0; break; case 24: // cure paralysis if (ADVEN[target].status[12] <= 0) { sprintf ((char *) c_line, " %s isn't paralyzed! " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); break; } sprintf ((char *) c_line, " %s can move now. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); ADVEN[target].status[12] = 0; break; case 27: sprintf ((char *) c_line, " %s recovers. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); r1 = 2 + get_ran(1,0,2) + stat_adj(pc_num,2) / 2; ADVEN[target].status[7] = max(0,ADVEN[target].status[7] - r1); break; case 28: sprintf ((char *) c_line, " %s restored. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); r1 = 1 + get_ran(1,0,2) + stat_adj(pc_num,2) / 2; ADVEN[target].status[9] = max(0,ADVEN[target].status[9] - r1); break; case 36: sprintf ((char *) c_line, " %s cleansed. " - ,(char *) ADVEN[target].name); + ,(char *) ADVEN[target].name.c_str()); ADVEN[target].status[7] = 0; ADVEN[target].status[6] = 0; break; @@ -1827,13 +1827,13 @@ void do_priest_spell(short pc_num,short spell_num) //// ADVEN[pc_num].cur_sp -= spell_cost[1][spell_num]; if (spell_num == 35) { // martyr's shield sprintf ((char *) c_line, " %s shielded. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); r1 = max(1,get_ran((ADVEN[pc_num].level + 5) / 5,1,3) + adj); ADVEN[target].status[10] += r1; } if (spell_num == 5) { // sanctuary sprintf ((char *) c_line, " %s hidden. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); r1 = max(0,get_ran(0,1,3) + ADVEN[pc_num].level / 4 + adj); ADVEN[target].status[8] += r1; } @@ -1851,15 +1851,15 @@ void do_priest_spell(short pc_num,short spell_num) //// targ_damaged = ADVEN[target].max_health - ADVEN[target].cur_health; } add_string_to_buf(" You absorb damage."); - sprintf ((char *) c_line, " %s healed %d. ", (char *) ADVEN[target].name, + sprintf ((char *) c_line, " %s healed %d. ", (char *) ADVEN[target].name.c_str(), ADVEN[target].cur_health - store_victim_health); add_string_to_buf ((char *) c_line); - sprintf ((char *) c_line, " %s takes %d. ", (char *) ADVEN[pc_num].name, + sprintf ((char *) c_line, " %s takes %d. ", (char *) ADVEN[pc_num].name.c_str(), store_caster_health - ADVEN[pc_num].cur_health); } if (spell_num == 47) { sprintf ((char *) c_line, " %s healed. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); heal_pc(target,250); ADVEN[target].status[2] = 0; one_sound(-53); one_sound(52); @@ -1868,7 +1868,7 @@ void do_priest_spell(short pc_num,short spell_num) //// if (ADVEN[target].main_status == MAIN_STATUS_STONE) { ADVEN[target].main_status = MAIN_STATUS_ALIVE; sprintf ((char *) c_line, " %s destoned. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); play_sound(53); } else sprintf ((char *) c_line," Wasn't stoned. "); @@ -1896,7 +1896,7 @@ void do_priest_spell(short pc_num,short spell_num) //// if (ADVEN[target].main_status == 2) if (get_ran(1,1,ADVEN[pc_num].level / 2) == 1) { sprintf ((char *) c_line, " %s now dust. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); play_sound(5); ADVEN[target].main_status = MAIN_STATUS_DUST; } @@ -1907,7 +1907,7 @@ void do_priest_spell(short pc_num,short spell_num) //// ADVEN[target].skills[i] -= (ADVEN[target].skills[i] > 1) ? 1 : 0; ADVEN[target].cur_health = 1; sprintf ((char *) c_line, " %s raised. ", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); play_sound(52); } else sprintf ((char *) c_line," Didn't work. "); @@ -1921,7 +1921,7 @@ void do_priest_spell(short pc_num,short spell_num) //// ADVEN[target].skills[i] -= (ADVEN[target].skills[i] > 1) ? 1 : 0; ADVEN[target].cur_health = 1; sprintf ((char *) c_line, " %s raised.", - (char *) ADVEN[target].name); + (char *) ADVEN[target].name.c_str()); play_sound(52); } else sprintf ((char *) c_line," Was OK. "); @@ -2150,7 +2150,7 @@ void crumble_wall(location where) } -void do_mindduel(short pc_num,cPopulation::cCreature *monst) +void do_mindduel(short pc_num,cCreature *monst) { short i = 0,adjust,r1,r2,balance = 0; @@ -2370,7 +2370,7 @@ void draw_spell_pc_info() for (i = 0; i < 6; i++) { if (ADVEN[i].main_status != 0) { - cd_set_item_text(1098,18 + i,ADVEN[i].name); + cd_set_item_text(1098,18 + i,ADVEN[i].name.c_str()); //if (pc_casting == i) // cd_text_frame(1098,24 + store_spell_target,11); // else cd_text_frame(1098,24 + store_spell_target,1); @@ -2907,7 +2907,7 @@ void do_alchemy() //// store_i.ability = (eItemAbil) potion_abils[which_p]; if (which_p == 8) store_i.magic_use_type = 2; - strcpy(store_i.full_name,alch_names_short[which_p]); + store_i.full_name = alch_names_short[which_p]; if (ADVEN[pc_num].skills[12] - difficulty[which_p] >= 5) store_i.charges++; if (ADVEN[pc_num].skills[12] - difficulty[which_p] >= 11) @@ -3056,7 +3056,7 @@ void pc_name_event_filter (short item_hit) csit(1051,6,"Must begin with a letter."); } else { - sprintf((char *) ADVEN[store_train_pc].name,"%.18s",(char *) get_text); + ADVEN[store_train_pc].name = string(get_text,get_text+18); // ???: Truncate to 18 characters... but is it necessary? toast_dialog(); } @@ -3093,7 +3093,7 @@ unsigned char pick_trapped_monst() // ignore parent in Mac version { short item_hit,i; - Str255 sp; + string sp; cMonster get_monst; make_cursor_sword(); @@ -3105,8 +3105,8 @@ unsigned char pick_trapped_monst() cd_activate_item(988, 2 + 3 * i, 0); } else { - get_m_name((char *) sp,(unsigned char)(univ.party.imprisoned_monst[i])); - csit(988,3 + 3 * i,(char *) sp); + sp = get_m_name(univ.party.imprisoned_monst[i]); + csit(988,3 + 3 * i, sp.c_str()); get_monst = return_monster_template((unsigned char)(univ.party.imprisoned_monst[i])); cdsin(988,4 + 3 * i,get_monst.level); } @@ -3148,7 +3148,7 @@ void poison_pc(short which_pc,short how_much) if (how_much > 0) { ADVEN[which_pc].status[2] = min(ADVEN[which_pc].status[2] + how_much,8); sprintf ((char *) c_line, " %s poisoned.", - (char *) ADVEN[which_pc].name); + (char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); one_sound(17); give_help(33,0,0); @@ -3364,7 +3364,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eMonsterTyp if (ADVEN[which_pc].status[11] > 0) ADVEN[which_pc].status[11]--; - sprintf ((char *) c_line, " %s takes %d. ",(char *) ADVEN[which_pc].name, how_much); + sprintf ((char *) c_line, " %s takes %d. ",(char *) ADVEN[which_pc].name.c_str(), how_much); if (do_print == true) add_string_to_buf((char *) c_line); if (damage_type != 10) { @@ -3387,12 +3387,12 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eMonsterTyp ADVEN[which_pc].cur_health = 0; else // Check if PC can die if (how_much > 25) { - sprintf ((char *) c_line, " %s is obliterated. ",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s is obliterated. ",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); kill_pc(which_pc, MAIN_STATUS_DUST); } else { - sprintf ((char *) c_line, " %s is killed.",(char *) ADVEN[which_pc].name); + sprintf ((char *) c_line, " %s is killed.",(char *) ADVEN[which_pc].name.c_str()); add_string_to_buf((char *) c_line); kill_pc(which_pc,MAIN_STATUS_DEAD); } @@ -3444,7 +3444,7 @@ void kill_pc(short which_pc,eMainStatus type) if ((type == MAIN_STATUS_DEAD) || (type == MAIN_STATUS_DUST)) play_sound(21); ADVEN[which_pc].main_status = type; - pc_moves[which_pc] = 0; + ADVEN[which_pc].ap = 0; } else { add_string_to_buf(" Life saved! "); @@ -3463,33 +3463,33 @@ void set_pc_moves() for (i = 0; i < 6; i++) if (ADVEN[i].main_status != 1) - pc_moves[i] = 0; + ADVEN[i].ap = 0; else { - pc_moves[i] = (ADVEN[i].traits[10] == true) ? 3 : 4; + ADVEN[i].ap = (ADVEN[i].traits[10] == true) ? 3 : 4; r = get_encumberance(i); - pc_moves[i] = minmax(1,8,pc_moves[i] - (r / 3)); + ADVEN[i].ap = minmax(1,8,ADVEN[i].ap - (r / 3)); if ((i_level = get_prot_level(i,55)) > 0) - pc_moves[i] += i_level / 7 + 1; + ADVEN[i].ap += i_level / 7 + 1; if ((i_level = get_prot_level(i,56)) > 0) - pc_moves[i] -= i_level / 5; + ADVEN[i].ap -= i_level / 5; if ((ADVEN[i].status[3] < 0) && (univ.party.age % 2 == 1)) // slowed? - pc_moves[i] = 0; + ADVEN[i].ap = 0; else { // do webs - pc_moves[i] = max(0,pc_moves[i] - ADVEN[i].status[6] / 2); - if (pc_moves[i] == 0) { + ADVEN[i].ap = max(0,ADVEN[i].ap - ADVEN[i].status[6] / 2); + if (ADVEN[i].ap == 0) { sprintf((char *) c_line,"%s must clean webs.",ADVEN[i].name); add_string_to_buf((char *) c_line); ADVEN[i].status[6] = max(0,ADVEN[i].status[6] - 3); } } if (ADVEN[i].status[3] > 7) - pc_moves[i] = pc_moves[i] * 3; + ADVEN[i].ap = ADVEN[i].ap * 3; else if (ADVEN[i].status[3] > 0) - pc_moves[i] = pc_moves[i] * 2; + ADVEN[i].ap = ADVEN[i].ap * 2; if ((ADVEN[i].status[11] > 0) || (ADVEN[i].status[12] > 0)) - pc_moves[i] = 0; + ADVEN[i].ap = 0; } @@ -3497,7 +3497,7 @@ void set_pc_moves() void take_ap(short num) { - pc_moves[current_pc] = max(0,pc_moves[current_pc] - num); + ADVEN[current_pc].ap = max(0,ADVEN[current_pc].ap - num); } short cave_lore_present() diff --git a/osx/boe.party.h b/osx/boe.party.h index 56ba0cef..21d2a214 100644 --- a/osx/boe.party.h +++ b/osx/boe.party.h @@ -35,7 +35,7 @@ void do_priest_spell(short pc_num,short spell_num); void cast_town_spell(location where); void sanctify_space(location where); void crumble_wall(location where); -void do_mindduel(short pc_num,cPopulation::cCreature *monst); +void do_mindduel(short pc_num,cCreature *monst); void dispel_fields(short i,short j,short mode); bool pc_can_cast_spell(short pc_num,short type,short spell_num); void pick_spell_event_filter (short item_hit); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index fcb5e278..5b52fc3c 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -506,7 +506,7 @@ void use_item(short pc,short item) short abil,level,i,j,item_use_code,str,type,which_stat,r1; char to_draw[60]; location user_loc; -cPopulation::cCreature *which_m; +cCreature *which_m; effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, @@ -850,8 +850,8 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, ASB("It throbs, and emits odd rays."); for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) - && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= 8) - && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc,0) < 5)) { + && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].cur_loc) <= 8) + && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].cur_loc,0) < 5)) { which_m = &univ.town.monst.dudes[i]; charm_monst(which_m,0,0,8); } @@ -1163,7 +1163,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s //+10 = no_print // 100s digit - damage sound for boom space { - cPopulation::cCreature *victim; + cCreature *victim; short r1,which_spot; location where_put; @@ -1250,7 +1250,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if (how_much < 0) how_much = 0; monst_marked_damage[which_m] += how_much; - add_explosion(victim->m_loc,how_much,0,(dam_type > 2) ? 2 : 0,14 * (victim->m_d.x_width - 1),18 * (victim->m_d.y_width - 1)); + add_explosion(victim->cur_loc,how_much,0,(dam_type > 2) ? 2 : 0,14 * (victim->m_d.x_width - 1),18 * (victim->m_d.y_width - 1)); if (how_much == 0) return false; else return true; @@ -1277,11 +1277,25 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s // splitting monsters if ((victim->m_d.spec_skill == 12) && (victim->m_d.health > 0)){ - where_put = find_clear_spot(victim->m_loc,1); + where_put = find_clear_spot(victim->cur_loc,1); if (where_put.x > 0) if ((which_spot = place_monster(victim->number,where_put)) < 90) { univ.town.monst.dudes[which_spot].m_d.health = victim->m_d.health; - univ.town.monst.dudes[which_spot].monst_start = victim->monst_start; + univ.town.monst.dudes[which_spot].number = victim->number; + univ.town.monst.dudes[which_spot].start_attitude = victim->start_attitude; + univ.town.monst.dudes[which_spot].start_loc = victim->start_loc; + univ.town.monst.dudes[which_spot].mobility = victim->mobility; + univ.town.monst.dudes[which_spot].time_flag = victim->time_flag; + univ.town.monst.dudes[which_spot].extra1 = victim->extra1; + univ.town.monst.dudes[which_spot].extra2 = victim->extra2; + univ.town.monst.dudes[which_spot].spec1 = victim->spec1; + univ.town.monst.dudes[which_spot].spec2 = victim->spec2; + univ.town.monst.dudes[which_spot].spec_enc_code = victim->spec_enc_code; + univ.town.monst.dudes[which_spot].time_code = victim->time_code; + univ.town.monst.dudes[which_spot].monster_time = victim->monster_time; + univ.town.monst.dudes[which_spot].personality = victim->personality; + univ.town.monst.dudes[which_spot].special_on_kill = victim->special_on_kill; + univ.town.monst.dudes[which_spot].facial_pic = victim->facial_pic; monst_spell_note(victim->number,27); } } @@ -1294,14 +1308,14 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if (dam_type != 9) { // note special damage only gamed in hand-to-hand, not during animation if (party_can_see_monst(which_m) == true) { - boom_space(victim->m_loc,100,boom_gr[dam_type],how_much,sound_type); + boom_space(victim->cur_loc,100,boom_gr[dam_type],how_much,sound_type); if (how_much_spec > 0) - boom_space(victim->m_loc,100,51,how_much_spec,5); + boom_space(victim->cur_loc,100,51,how_much_spec,5); } else { - boom_space(victim->m_loc,overall_mode, boom_gr[dam_type],how_much,sound_type); + boom_space(victim->cur_loc,overall_mode, boom_gr[dam_type],how_much,sound_type); if (how_much_spec > 0) - boom_space(victim->m_loc,overall_mode,51,how_much_spec,5); + boom_space(victim->cur_loc,overall_mode,51,how_much_spec,5); } } @@ -1336,7 +1350,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s return true; } -void kill_monst(cPopulation::cCreature *which_m,short who_killed) +void kill_monst(cCreature *which_m,short who_killed) { short xp,i,j,s1,s2,s3; location l; @@ -1357,12 +1371,12 @@ void kill_monst(cPopulation::cCreature *which_m,short who_killed) } // Special killing effects - if (sd_legit(which_m->monst_start.spec1,which_m->monst_start.spec2) == true) - PSD[which_m->monst_start.spec1][which_m->monst_start.spec2] = 1; + if (sd_legit(which_m->spec1,which_m->spec2) == true) + PSD[which_m->spec1][which_m->spec2] = 1; - run_special(12,2,which_m->monst_start.special_on_kill,which_m->m_loc,&s1,&s2,&s3); + run_special(12,2,which_m->special_on_kill,which_m->cur_loc,&s1,&s2,&s3); if (which_m->m_d.radiate_1 == 15) - run_special(12,0,which_m->m_d.radiate_2,which_m->m_loc,&s1,&s2,&s3); + run_special(12,0,which_m->m_d.radiate_2,which_m->cur_loc,&s1,&s2,&s3); if ((in_scen_debug == false) && ((which_m->summoned >= 100) || (which_m->summoned == 0))) { // no xp for party-summoned monsters xp = which_m->m_d.level * 2; @@ -1375,15 +1389,15 @@ void kill_monst(cPopulation::cCreature *which_m,short who_killed) i = max((xp / 6),1); award_party_xp(i); } - l = which_m->m_loc; + l = which_m->cur_loc; place_glands(l,which_m->number); } if ((in_scen_debug == false) && (which_m->summoned == 0)) - place_treasure(which_m->m_loc, which_m->m_d.level / 2, which_m->m_d.treasure, 0); + place_treasure(which_m->cur_loc, which_m->m_d.level / 2, which_m->m_d.treasure, 0); - i = which_m->m_loc.x; - j = which_m->m_loc.y; + i = which_m->cur_loc.x; + j = which_m->cur_loc.y; switch (which_m->m_d.m_type) { case 7: make_sfx(i,j,6); break; case 8: if (which_m->number <= 59) make_sfx(i,j,7); break; @@ -1400,7 +1414,7 @@ void kill_monst(cPopulation::cCreature *which_m,short who_killed) univ.party.total_m_killed++; - which_m->monst_start.spec1 = 0; // make sure, if this is a spec. activated monster, it won't come back + which_m->spec1 = 0; // make sure, if this is a spec. activated monster, it won't come back which_m->active = 0; } @@ -1421,7 +1435,7 @@ void push_things()//// for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { - l = univ.town.monst.dudes[i].m_loc; + l = univ.town.monst.dudes[i].cur_loc; ter = univ.town->terrain(l.x,l.y); switch (scenario.ter_types[ter].special) { case 16: l.y--; break; @@ -1429,9 +1443,9 @@ void push_things()//// case 18: l.y++; break; case 19: l.x--; break; } - if (l != univ.town.monst.dudes[i].m_loc) { - univ.town.monst.dudes[i].m_loc = l; - if ((point_onscreen(center,univ.town.monst.dudes[i].m_loc) == true) || + if (l != univ.town.monst.dudes[i].cur_loc) { + univ.town.monst.dudes[i].cur_loc = l; + if ((point_onscreen(center,univ.town.monst.dudes[i].cur_loc) == true) || (point_onscreen(center,l) == true)) redraw = true; } diff --git a/osx/boe.specials.h b/osx/boe.specials.h index 9e53d8ca..61e968fc 100644 --- a/osx/boe.specials.h +++ b/osx/boe.specials.h @@ -10,7 +10,7 @@ bool adj_town_look(location where); void PSOE(short str1a,short str1b,short str2a,short str2b, short which_special,unsigned char *stuff_done_val,short where_put); bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type); -void kill_monst(cPopulation::cCreature *which_m,short who_killed); +void kill_monst(cCreature *which_m,short who_killed); void special_increase_age(); void out_move_party(char x,char y) ; void teleport_party(short x,short y,short mode); diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index 5b5c60f0..465963f4 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -35,7 +35,7 @@ typedef struct { buf_line text_buffer[TEXT_BUF_LEN]; short buf_pointer = 30, lines_to_print= 0, num_added_since_stop = 0; -char store_string[60],store_string2[60]; +//char store_string[60],store_string2[60]; short start_print_point= 0; short mark_where_printing_long; bool printing_long = false; @@ -161,7 +161,7 @@ void put_pc_screen() ForeColor(blueColor); } - sprintf((char *) to_draw, "%d. %-20s ", i + 1, (char *) ADVEN[i].name); + sprintf((char *) to_draw, "%d. %-20s ", i + 1, (char *) ADVEN[i].name.c_str()); win_draw_string( pc_stats_gworld,pc_buttons[i][0], to_draw,0,10,false); TextFace(0); @@ -325,7 +325,7 @@ void put_item_screen(short screen_num,short suppress_buttons) pc = screen_num; ForeColor(whiteColor); sprintf((char *) to_draw, "%s inventory:", - (char *) ADVEN[pc].name); + (char *) ADVEN[pc].name.c_str()); win_draw_string( item_stats_gworld,upper_frame_rect, to_draw,0,10,false); ForeColor(blackColor); @@ -710,7 +710,7 @@ void draw_pc_effects(short pc) dest_rect.bottom += pc * 25 + 18; } else { - name_width = string_length(ADVEN[pc].name); + name_width = string_length(ADVEN[pc].name.c_str()); right_limit = pc_buttons[0][1].left - 5; //dest_rect.left = pc_buttons[i][1].left - 16; dest_rect.left = name_width + 33; @@ -807,6 +807,7 @@ void draw_pc_effects(short pc) void print_party_stats() { + char store_string[255]; add_string_to_buf("PARTY STATS:"); sprintf((char *) store_string, " Number of kills: %lld ", univ.party.total_m_killed); add_string_to_buf((char *) store_string); @@ -829,6 +830,7 @@ short do_look(location space) short i,j,num_items = 0; bool gold_here = false, food_here = false, is_lit = true; location from_where; + string msg; from_where = get_cur_loc(); is_lit = pt_in_light(from_where,space); @@ -840,8 +842,8 @@ short do_look(location space) for (i = 0; i < 6; i++) if ((space == pc_pos[i]) && (ADVEN[i].main_status == 1) && (is_lit == true) && (can_see(pc_pos[current_pc],space,0) < 5)) { - sprintf((char *) store_string, " %s", (char *) ADVEN[i].name); - add_string_to_buf((char *) store_string); + msg = " " + ADVEN[i].name; + add_string_to_buf((char *) msg.c_str()); } if ((overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) { @@ -852,19 +854,19 @@ short do_look(location space) && (univ.town.monst.dudes[i].m_d.picture_num != 0)) { - get_m_name(store_string2,univ.town.monst.dudes[i].number); + msg = get_m_name(univ.town.monst.dudes[i].number); if (univ.town.monst.dudes[i].m_d.health < univ.town.monst.dudes[i].m_d.m_health) { if (univ.town.monst.dudes[i].attitude % 2 == 1) - sprintf((char *) store_string, " Wounded %s (H)", store_string2); - else sprintf((char *) store_string, " Wounded %s (F)", store_string2); + msg = " Wounded " + msg + " (H)"; + else msg = " Wounded " + msg + " (F)"; } else { if (univ.town.monst.dudes[i].attitude % 2 == 1) - sprintf((char *) store_string, " %s (H)", (char *) store_string2); - else sprintf((char *) store_string, " %s (F)", (char *) store_string2); + msg = " " + msg + " (H)"; + else msg = " " + msg + " (F)"; } - add_string_to_buf((char *) store_string); + add_string_to_buf((char *) msg.c_str()); } } @@ -874,9 +876,9 @@ short do_look(location space) && (space == univ.party.out_c[i].m_loc)) { for (j = 0; j < 7; j++) if (univ.party.out_c[i].what_monst.monst[j] != 0) { - get_m_name(store_string2,univ.party.out_c[i].what_monst.monst[j]); - sprintf((char *) store_string, " %s", store_string2); - add_string_to_buf((char *) store_string); + msg = get_m_name(univ.party.out_c[i].what_monst.monst[j]); + msg = " " + msg; + add_string_to_buf((char *) msg.c_str()); j = 7; } @@ -958,9 +960,9 @@ short do_look(location space) if ((univ.town.items[i].variety != 0) && (univ.town.items[i].variety != 3) &&(univ.town.items[i].variety != 11) && (space == univ.town.items[i].item_loc) && (!univ.town.items[i].is_contained())) { if (univ.town.items[i].is_ident()) - sprintf((char *) store_string, " %s",univ.town.items[i].full_name); - else sprintf((char *) store_string, " %s",univ.town.items[i].name); - add_string_to_buf((char *) store_string); + msg = " " + univ.town.items[i].full_name; + else msg = " " + univ.town.items[i].name; + add_string_to_buf((char *) msg.c_str()); } } } @@ -1019,9 +1021,9 @@ short out_horse_there(location where) void notify_out_combat_began(cOutdoors::cWandering encounter,short *nums) { short i; - - sprintf((char *) store_string, "COMBAT! "); - add_string_to_buf((char *) store_string); + string msg; + + add_string_to_buf((char *) "COMBAT! "); for (i = 0; i < 6; i++) if (encounter.monst[i] != 0) { @@ -1029,221 +1031,240 @@ void notify_out_combat_began(cOutdoors::cWandering encounter,short *nums) //// default: - get_m_name(store_string2,encounter.monst[i]); - sprintf((char *) store_string, " %d x %s ",nums[i],store_string2); + msg = get_m_name(encounter.monst[i]); + ostringstream sout; + sout << " " << nums[i] << " x " << msg << " "; + msg = sout.str(); break; } - add_string_to_buf((char *) store_string); + add_string_to_buf((char *) msg.c_str()); } if (encounter.monst[6] != 0) { - get_m_name(store_string2,encounter.monst[6]); - sprintf((char *) store_string, " %s ",store_string2); - add_string_to_buf((char *) store_string); + msg = " " + get_m_name(encounter.monst[6]) + " "; + add_string_to_buf((char *) msg.c_str()); } } -void get_m_name(char *str,unsigned char num) +string get_m_name(unsigned char num) { //// - strcpy((char *) str,(char *) scenario.scen_monsters[num].m_name); + //strcpy((char *) str,(char *) scenario.scen_monsters[num].m_name); + return scenario.scen_monsters[num].m_name; } -void get_ter_name(char *str,unsigned char num) +string get_ter_name(unsigned char num) { - Str255 store_name; + string store_name = "Pit"; //// - if ((num == 90) && ((is_out()) || (is_town()) || ((is_combat()) && (which_combat_type == 1)))) - sprintf((char *) store_name,"Pit"); + if ((num == 90) && ((is_out()) || (is_town()) || ((is_combat()) && (which_combat_type == 1)))); + //sprintf((char *) store_name,"Pit"); else { - strcpy((char *) store_name,(char *) scenario.ter_types[num].name.c_str()); + store_name = scenario.ter_types[num].name; } - strcpy((char *) str,(char *) store_name); + return store_name; } void print_monst_name(unsigned char m_type) { - get_m_name(store_string2,m_type); - sprintf ((char *) store_string, "%s:",store_string2); - add_string_to_buf((char *) store_string); + string msg = get_m_name(m_type) + ':'; + add_string_to_buf((char *) msg.c_str()); } void print_monst_attacks(unsigned char m_type,short target) //short target; // < 100 - pc >= 100 monst { - char store_string3[60]; + //char store_string3[60]; - get_m_name(store_string2,m_type); + string msg = get_m_name(m_type); + msg += " attacks "; if (target < 100) - sprintf ((char *) store_string, "%s attacks %s", - store_string2,(char *) ADVEN[target].name); - else { - get_m_name(store_string3,univ.town.monst.dudes[target - 100].number); - sprintf ((char *) store_string, "%s attacks %s", - store_string2,store_string3); - } - add_string_to_buf((char *) store_string); + msg += ADVEN[target].name; + else + msg += get_m_name(univ.town.monst.dudes[target - 100].number); + add_string_to_buf((char *) msg.c_str()); } //// void damaged_message(short damage,short type) { + string msg = " "; Str255 str; - get_str(str,20,130 + type); - sprintf ((char *) store_string, " %s for %d", - (char *) str,damage); - add_string_to_buf((char *) store_string); + msg += (char*)str; + ostringstream sout(msg); + sout << " for " << damage; + msg = sout.str(); + add_string_to_buf((char *) msg.c_str()); } // This prepares the monster's string for the text bar -void print_monster_going(char *combat_str,unsigned char m_num,short ap) +string print_monster_going(unsigned char m_num,short ap) { - get_m_name(store_string2,m_num); - sprintf ((char *) combat_str, "%s (ap: %d)", - store_string2,ap); + ostringstream sout(get_m_name(m_num)); + sout << " (ap: " << ap << ')'; + return sout.str(); } void monst_spell_note(unsigned char number,short which_mess) { - get_m_name(store_string2,number); + string msg = get_m_name(number); switch (which_mess) { case 1: - sprintf ((char *) store_string, " %s scared. ",store_string2);break; + msg = " " + msg + " scared. "; + break; case 2: - sprintf ((char *) store_string, " %s slowed. ",store_string2);break; + msg = " " + msg + " slowed. "; + break; case 3: - sprintf ((char *) store_string, " %s weakened.",store_string2);break; + msg = " " + msg + " weakened. "; + break; case 4: - sprintf ((char *) store_string, " %s poisoned.",store_string2);break; + msg = " " + msg + " poisoned. "; + break; case 5: - sprintf ((char *) store_string, " %s cursed.",store_string2);break; + msg = " " + msg + " cursed. "; + break; case 6: - sprintf ((char *) store_string, " %s ravaged.",store_string2);break; + msg = " " + msg + " ravaged. "; + break; case 7: - sprintf ((char *) store_string, " %s undamaged.",store_string2);break; + msg = " " + msg + " undamaged. "; + break; case 8: - sprintf ((char *) store_string, " %s is stoned.",store_string2);break; + msg = " " + msg + " is stoned. "; + break; case 9: - sprintf ((char *) store_string, " Gazes at %s.",store_string2);break; + msg = " Gazes at " + msg + '.'; + break; case 10: - sprintf ((char *) store_string, " %s resists.",store_string2);break; + msg = " " + msg + " resists. "; + break; case 11: - sprintf ((char *) store_string, " Drains %s.",store_string2);break; + msg = " Drains " + msg + '.'; + break; case 12: - sprintf ((char *) store_string, " Shoots at %s.",store_string2);break; + msg = " Shoots at " + msg + '.'; + break; case 13: - sprintf ((char *) store_string, " Throws spear at %s.", - store_string2); + msg = " Throws spear at " + msg + '.'; break; case 14: - sprintf ((char *) store_string, " Throws rock at %s.", - store_string2); + msg = " Throws rock at " + msg + '.'; break; case 15: - sprintf ((char *) store_string, " Throws razordisk at %s.", - store_string2); + msg = " Throws razordisk at " + msg + '.'; break; case 16: - sprintf ((char *) store_string, " Hits %s.", - store_string2); + msg = " Hits " + msg + '.'; break; case 17: - sprintf ((char *) store_string, "%s disappears.", - store_string2); + msg = " " + msg + " disappears. "; break; case 18: - sprintf ((char *) store_string, " Misses %s.", - store_string2); + msg = " Misses " + msg + '.'; break; case 19: - sprintf ((char *) store_string, " %s is webbed.",store_string2);break; + msg = " " + msg + " is webbed. "; + break; case 20: - sprintf ((char *) store_string, " %s chokes.",store_string2);break; + msg = " " + msg + " chokes. "; + break; case 21: - sprintf ((char *) store_string, " %s summoned.",store_string2);break; + msg = " " + msg + " summoned. "; + break; case 22: - sprintf ((char *) store_string, " %s is dumbfounded.",store_string2);break; + msg = " " + msg + " is dumbfounded. "; + break; case 23: - sprintf ((char *) store_string, " %s is charmed.",store_string2);break; + msg = " " + msg + " is charmed. "; + break; case 24: - sprintf ((char *) store_string, " %s is recorded.",store_string2);break; + msg = " " + msg + " is recorded. "; + break; case 25: - sprintf ((char *) store_string, " %s is diseased.",store_string2);break; + msg = " " + msg + " is diseased. "; + break; case 26: - sprintf ((char *) store_string, " %s is an avatar!",store_string2);break; + msg = " " + msg + " is an avatar!"; + break; case 27: - sprintf ((char *) store_string, " %s splits!",store_string2);break; + msg = " " + msg + " splits!"; + break; case 28: - sprintf ((char *) store_string, " %s falls asleep.",store_string2);break; + msg = " " + msg + " falls asleep. "; + break; case 29: - sprintf ((char *) store_string, " %s wakes up.",store_string2);break; + msg = " " + msg + " wakes up. "; + break; case 30: - sprintf ((char *) store_string, " %s paralyzed.",store_string2);break; + msg = " " + msg + " paralyzed. "; + break; case 31: - sprintf ((char *) store_string, " %s covered with acid.",store_string2);break; + msg = " " + msg + " covered with acid. "; + break; case 32: - sprintf ((char *) store_string, " Fires spines at %s.",store_string2);break; + msg = " Fires spines at " + msg + '.'; + break; case 33: - sprintf ((char *) store_string, " %s summons aid.",store_string2);break; + msg = " " + msg + " summons aid. "; + break; } if (which_mess > 0) - add_string_to_buf((char *) store_string); + add_string_to_buf((char *) msg.c_str()); } void monst_cast_spell_note(unsigned char number,short spell,short type) //short type; // 0 - mage 1- priest { - get_m_name(store_string2,number); - sprintf ((char *) store_string, "%s casts:", - (char *) store_string2); - add_string_to_buf((char *) store_string); - sprintf ((char *) store_string, " %s", - (type == 1) ? (char *) m_priest_sp[spell - 1] : (char *) m_mage_sp[spell - 1]); - add_string_to_buf((char *) store_string); + string msg = get_m_name(number); + msg += " casts:"; + add_string_to_buf((char *) msg.c_str()); + msg = (type == 1) ? m_priest_sp[spell - 1] : m_mage_sp[spell - 1]; + msg = " " + msg; + add_string_to_buf((char *) msg.c_str()); } void monst_breathe_note(unsigned char number) { - get_m_name(store_string2,number); - sprintf ((char *) store_string, "%s breathes.", - (char *) store_string2); - add_string_to_buf((char *) store_string); + string msg = get_m_name(number); + msg += " breathes."; + add_string_to_buf((char *) msg.c_str()); } void monst_damaged_mes(short which_m,short how_much,short how_much_spec) { - get_m_name(store_string2,univ.town.monst.dudes[which_m].number); + string msg = get_m_name(univ.town.monst.dudes[which_m].number); + msg = " " + msg + " takes "; + ostringstream sout(msg); + sout << how_much; if (how_much_spec > 0) - sprintf ((char *) store_string, " %s takes %d+%d", - store_string2, how_much,how_much_spec); - else sprintf ((char *) store_string, " %s takes %d", - store_string2, how_much); - - add_string_to_buf((char *) store_string); + sout << '+' << how_much_spec; + msg = sout.str(); + add_string_to_buf((char *) msg.c_str()); } void monst_killed_mes(short which_m) { - get_m_name(store_string2,univ.town.monst.dudes[which_m].number); - sprintf ((char *) store_string, " %s dies.", - (char *) store_string2); - add_string_to_buf((char *) store_string); + string msg = get_m_name(univ.town.monst.dudes[which_m].number); + msg = " " + msg + " dies."; + add_string_to_buf((char *) msg.c_str()); } void print_nums(short a,short b,short c) { - sprintf((char *) store_string, "debug: %d %d %d", a,b,c); - add_string_to_buf((char *) store_string); + ostringstream sout; + sout << "debug: " << a << ' ' << b << ' ' << c; + add_string_to_buf((char *) sout.str().c_str()); } @@ -1260,9 +1281,9 @@ short print_terrain(location space) if (overall_mode == MODE_LOOK_COMBAT) { which_terrain = combat_terrain[space.x][space.y]; } - get_ter_name(store_string2,which_terrain); - sprintf((char *) store_string, " %s", store_string2); - add_string_to_buf((char *) store_string); + string msg = get_ter_name(which_terrain); + msg = " " + msg; + add_string_to_buf((char *) msg.c_str()); return (short) which_terrain; } diff --git a/osx/boe.text.h b/osx/boe.text.h index f3d08c31..17885dbe 100644 --- a/osx/boe.text.h +++ b/osx/boe.text.h @@ -18,12 +18,12 @@ short out_boat_there(location where); short town_horse_there(location where); short out_horse_there(location where); void notify_out_combat_began(cOutdoors::cWandering encounter,short *nums) ; -void get_m_name(char *str,unsigned char num); -void get_ter_name(char *str,unsigned char num); +string get_m_name(unsigned char num); +string get_ter_name(unsigned char num); void print_monst_name(unsigned char m_type); void print_monst_attacks(unsigned char m_type,short target); void damaged_message(short damage,short type); -void print_monster_going(char *combat_str,unsigned char m_num,short ap); +string print_monster_going(unsigned char m_num,short ap); void monst_spell_note(unsigned char number,short which_mess); void monst_cast_spell_note(unsigned char number,short spell,short type); void monst_breathe_note(unsigned char number); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 6d5c75fa..f20ae816 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -38,7 +38,7 @@ extern short stat_window,store_spell_target,which_combat_type,current_pc,combat_ extern eGameMode overall_mode; extern location center; extern WindowPtr mainPtr; -extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern unsigned char combat_terrain[64][64]; //extern cOutdoors univ.out.outdoors[2][2]; //extern unsigned char univ.out.misc_i[64][64]; @@ -46,7 +46,7 @@ extern short store_current_pc,current_ground; //extern pascal bool cd_event_filter(); extern short dungeon_font_num,geneva_font_num; extern eGameMode store_pre_shop_mode,store_pre_talk_mode; -extern location monster_targs[60]; +//extern location monster_targs[60]; extern short special_queue[20]; extern bool modeless_exists[18],diff_depth_ok,belt_present; @@ -62,7 +62,7 @@ extern short town_type; //extern setup_save_type setup_save; extern bool web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; extern location pc_pos[6]; -extern short last_attacked[6],pc_dir[6],pc_parry[6],pc_moves[6]; +extern short last_attacked[6],pc_dir[6],pc_parry[6];//,pc_moves[6]; //extern stored_town_maps_type town_maps; extern location hor_vert_place[14]; @@ -233,11 +233,11 @@ void start_town_mode(short which_town, short entry_dir) monsters_loaded = true; for (j = 0; j < univ.town->max_monst(); j++) { - if (loc_off_act_area(univ.town.monst.dudes[j].m_loc) == true) + if (loc_off_act_area(univ.town.monst.dudes[j].cur_loc) == true) univ.town.monst.dudes[j].active = 0; if (univ.town.monst.dudes[j].active == 2) univ.town.monst.dudes[j].active = 1; - univ.town.monst.dudes[j].m_loc = univ.town->creatures(j).start_loc; + univ.town.monst.dudes[j].cur_loc = univ.town->creatures(j).start_loc; univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; univ.town.monst.dudes[j].m_d.mp = univ.town.monst.dudes[j].m_d.max_mp; univ.town.monst.dudes[j].m_d.morale = univ.town.monst.dudes[j].m_d.m_morale; @@ -245,52 +245,52 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst.dudes[j].m_d.status[k] = 0; if (univ.town.monst.dudes[j].summoned > 0) univ.town.monst.dudes[j].active = 0; - monst_target[j] = 6; + univ.town.monst.dudes[j].target = 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 < univ.town->max_monst(); j++) { - switch (univ.town.monst.dudes[j].monst_start.time_flag){ + switch (univ.town.monst.dudes[j].time_flag){ case 4: case 5 : //case 6: - if ((((short) (univ.party.age / 1000) % 3) + 4) != univ.town.monst.dudes[j].monst_start.time_flag) + if ((((short) (univ.party.age / 1000) % 3) + 4) != univ.town.monst.dudes[j].time_flag) univ.town.monst.dudes[j].active = 0; else { univ.town.monst.dudes[j].active = 1; - univ.town.monst.dudes[j].monst_start.spec_enc_code = 0; + univ.town.monst.dudes[j].spec_enc_code = 0; // Now remove time flag so it doesn't get reappearing - univ.town.monst.dudes[j].monst_start.time_flag = 0; - univ.town.monst.dudes[j].m_loc = univ.town->creatures(j).start_loc; + univ.town.monst.dudes[j].time_flag = 0; + univ.town.monst.dudes[j].cur_loc = univ.town->creatures(j).start_loc; univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; } break ; // Now, appearing/disappearing monsters might have arrived/disappeared. case 1: - if (day_reached(univ.town.monst.dudes[j].monst_start.monster_time, univ.town.monst.dudes[j].monst_start.time_code) == true) + if (day_reached(univ.town.monst.dudes[j].monster_time, univ.town.monst.dudes[j].time_code) == true) { univ.town.monst.dudes[j].active = 1; - univ.town.monst.dudes[j].monst_start.time_flag=0; // Now remove time flag so it doesn't get reappearing + univ.town.monst.dudes[j].time_flag=0; // Now remove time flag so it doesn't get reappearing } break; case 2: - if (day_reached(univ.town.monst.dudes[j].monst_start.monster_time, univ.town.monst.dudes[j].monst_start.time_code) == true) + if (day_reached(univ.town.monst.dudes[j].monster_time, univ.town.monst.dudes[j].time_code) == true) { univ.town.monst.dudes[j].active = 0; - univ.town.monst.dudes[j].monst_start.time_flag=0; // Now remove time flag so it doesn't get disappearing again + univ.town.monst.dudes[j].time_flag=0; // Now remove time flag so it doesn't get disappearing again } break; case 7: - if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[j].monst_start.time_code]){ //calc_day is used because of the "definition" of univ.party.key_times + if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[j].time_code]){ //calc_day is used because of the "definition" of univ.party.key_times univ.town.monst.dudes[j].active = 1; - univ.town.monst.dudes[j].monst_start.time_flag=0; // Now remove time flag so it doesn't get reappearing + univ.town.monst.dudes[j].time_flag=0; // Now remove time flag so it doesn't get reappearing } break; case 8: - if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[j].monst_start.time_code]){ + if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[j].time_code]){ univ.town.monst.dudes[j].active = 0; - univ.town.monst.dudes[j].monst_start.time_flag=0; // Now remove time flag so it doesn't get disappearing again + univ.town.monst.dudes[j].time_flag=0; // Now remove time flag so it doesn't get disappearing again } break; } @@ -310,58 +310,59 @@ void start_town_mode(short which_town, short entry_dir) if (univ.town->creatures(i).number == 0) { univ.town.monst.dudes[i].active = 0; univ.town.monst.dudes[i].number = 0; - univ.town.monst.dudes[i].monst_start.time_flag = 0; - univ.town.monst.dudes[i].m_loc.x = 80; + univ.town.monst.dudes[i].time_flag = 0; + univ.town.monst.dudes[i].cur_loc.x = 80; } else { // First set up the values. - monst_target[i] = 6; + univ.town.monst.dudes[i] = univ.town->creatures(i); + univ.town.monst.dudes[i].target = 6; univ.town.monst.dudes[i].active = 1; univ.town.monst.dudes[i].number = univ.town->creatures(i).number; univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; - univ.town.monst.dudes[i].m_loc = univ.town->creatures(i).start_loc; - univ.town.monst.dudes[i].mobile = univ.town->creatures(i).mobile; + univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; + univ.town.monst.dudes[i].mobility = univ.town->creatures(i).mobility; univ.town.monst.dudes[i].m_d = return_monster_template(univ.town.monst.dudes[i].number); univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].monst_start = univ.town->creatures(i); + univ.town.monst.dudes[i] = univ.town->creatures(i); - if (univ.town.monst.dudes[i].monst_start.spec_enc_code > 0) + if (univ.town.monst.dudes[i].spec_enc_code > 0) univ.town.monst.dudes[i].active = 0; // Now, if necessary, fry the monster. - switch (univ.town.monst.dudes[i].monst_start.time_flag) { + switch (univ.town.monst.dudes[i].time_flag) { case 1: - if (!day_reached(univ.town.monst.dudes[i].monst_start.monster_time, - univ.town.monst.dudes[i].monst_start.time_code)) + if (!day_reached(univ.town.monst.dudes[i].monster_time, + univ.town.monst.dudes[i].time_code)) univ.town.monst.dudes[i].active = 0; break; case 2: - if (day_reached(univ.town.monst.dudes[i].monst_start.monster_time, - univ.town.monst.dudes[i].monst_start.time_code)) + if (day_reached(univ.town.monst.dudes[i].monster_time, + univ.town.monst.dudes[i].time_code)) univ.town.monst.dudes[i].active = 0; break; case 3: // unused break; case 4: case 5: case 6: - if ((((short) (univ.party.age / 1000) % 3) + 4) != univ.town.monst.dudes[i].monst_start.time_flag) { + if ((((short) (univ.party.age / 1000) % 3) + 4) != univ.town.monst.dudes[i].time_flag) { univ.town.monst.dudes[i].active = 0; - univ.town.monst.dudes[i].monst_start.spec_enc_code = 50; + univ.town.monst.dudes[i].spec_enc_code = 50; } else { univ.town.monst.dudes[i].active = 1; // Now remove time flag so it doesn't keep reappearing - univ.town.monst.dudes[i].monst_start.time_flag = 0; + univ.town.monst.dudes[i].time_flag = 0; } break; case 7: - if (calc_day() < univ.party.key_times[univ.town.monst.dudes[i].monst_start.time_code]) + if (calc_day() < univ.party.key_times[univ.town.monst.dudes[i].time_code]) univ.town.monst.dudes[i].active = 0; break; case 8: - if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[i].monst_start.time_code]) + if (calc_day() >= univ.party.key_times[univ.town.monst.dudes[i].time_code]) univ.town.monst.dudes[i].active = 0; break; case 9: @@ -376,7 +377,7 @@ void start_town_mode(short which_town, short entry_dir) break; default: ASB("ERROR! Odd character data."); - print_nums(0,i,univ.town.monst.dudes[i].monst_start.time_flag); + print_nums(0,i,univ.town.monst.dudes[i].time_flag); break; } } @@ -389,7 +390,7 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst.dudes[i].active > 0) if (((univ.town.monst.dudes[i].m_d.x_width > 1) || (univ.town.monst.dudes[i].m_d.y_width > 1)) && - (monst_can_be_there(univ.town.monst.dudes[i].m_loc,i) == false)) + (monst_can_be_there(univ.town.monst.dudes[i].cur_loc,i) == false)) univ.town.monst.dudes[i].active = 0; } @@ -505,7 +506,7 @@ void start_town_mode(short which_town, short entry_dir) for (i = 0; i < univ.town->max_monst(); i++) - if (loc_off_act_area(univ.town.monst.dudes[i].m_loc) == true) + if (loc_off_act_area(univ.town.monst.dudes[i].cur_loc) == true) univ.town.monst.dudes[i].active = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) if (loc_off_act_area(univ.town.items[i].item_loc) == true) @@ -513,8 +514,8 @@ void start_town_mode(short which_town, short entry_dir) // Clean out unwanted monsters for (i = 0; i < univ.town->max_monst(); i++) - if (sd_legit(univ.town.monst.dudes[i].monst_start.spec1,univ.town.monst.dudes[i].monst_start.spec2) == true) { - if (PSD[univ.town.monst.dudes[i].monst_start.spec1][univ.town.monst.dudes[i].monst_start.spec2] > 0) + if (sd_legit(univ.town.monst.dudes[i].spec1,univ.town.monst.dudes[i].spec2) == true) { + if (PSD[univ.town.monst.dudes[i].spec1][univ.town.monst.dudes[i].spec2] > 0) univ.town.monst.dudes[i].active = 0; } @@ -570,7 +571,7 @@ void start_town_mode(short which_town, short entry_dir) } for (i = 0; i < univ.town->max_monst(); i++) - {monster_targs[i].x = 0; monster_targs[i].y = 0;} + {univ.town.monst.dudes[i].targ_loc.x = 0; univ.town.monst.dudes[i].targ_loc.y = 0;} //// check horses for (i = 0; i < 30; i++) { @@ -646,8 +647,8 @@ location end_town_mode(short switching_level,location destination) // returns n // Clean up special data, just in case for (i = 0; i < univ.town->max_monst(); i++) { - univ.town.monst.dudes[i].monst_start.spec1 = 0; - univ.town.monst.dudes[i].monst_start.spec2 = 0; + univ.town.monst.dudes[i].spec1 = 0; + univ.town.monst.dudes[i].spec2 = 0; } // Now store map @@ -794,7 +795,7 @@ void start_town_combat(short direction) combat_active_pc = 6; for (i = 0; i < univ.town->max_monst(); i++) - monst_target[i] = 6; + univ.town.monst.dudes[i].target = 6; for (i = 0; i < 6; i++) { last_attacked[i] = univ.town->max_monst() + 10; @@ -1710,7 +1711,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) if ((is_town()) && (PSD[SDF_PARTY_DETECT_LIFE] > 0)) for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { - where = univ.town.monst.dudes[i].m_loc; + where = univ.town.monst.dudes[i].cur_loc; 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))){ diff --git a/osx/classes/creatlist.cpp b/osx/classes/creatlist.cpp index 6066ce1c..747d6219 100644 --- a/osx/classes/creatlist.cpp +++ b/osx/classes/creatlist.cpp @@ -9,20 +9,6 @@ #include "classes.h" #include "oldstructs.h" -__attribute__((deprecated)) -cPopulation::cCreature& cPopulation::cCreature::operator = (legacy::creature_data_type old){ - active = old.active; - attitude = old.attitude; - number = old.number; - m_loc.x = old.m_loc.x; - m_loc.y = old.m_loc.y; - m_d = old.m_d; - mobile = old.mobile; - summoned = old.summoned; - monst_start = old.monst_start; - return *this; -} - __attribute__((deprecated)) cPopulation& cPopulation::operator = (legacy::creature_list_type old){ for(int i = 0; i < 60; i++) diff --git a/osx/classes/creatlist.h b/osx/classes/creatlist.h index 4190f7a5..5ccc0906 100644 --- a/osx/classes/creatlist.h +++ b/osx/classes/creatlist.h @@ -13,18 +13,18 @@ namespace legacy { class cPopulation { // formerly creature_list_type public: - class cCreature { // formerly creature_data_type - public: - short active, attitude; - unsigned char number; - location m_loc; - cMonster m_d; - bool mobile; - short summoned; - cTown::cCreature monst_start; - - cCreature& operator = (legacy::creature_data_type old); - }; +// class cCreature { // formerly creature_data_type +// public: +// short active, attitude; +// unsigned char number; +// location m_loc; +// cMonster m_d; +// bool mobile; +// short summoned; +// cTown::cCreature monst_start; +// +// cCreature& operator = (legacy::creature_data_type old); +// }; cCreature dudes[60]; short which_town; short friendly; diff --git a/osx/classes/item.cpp b/osx/classes/item.cpp index bb43e8a7..2885dc8a 100644 --- a/osx/classes/item.cpp +++ b/osx/classes/item.cpp @@ -118,8 +118,8 @@ cItemRec::cItemRec(){ special_class = 0; item_loc.x = 0; item_loc.y = 0; - strcpy(full_name,""); - strcpy(name,""); + full_name = ""; + name = ""; treas_class = 0; item_properties = 0; reserved1 = 0; @@ -150,8 +150,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 45; value = 2; weight = 7; - strcpy(full_name,"Bronze Knife"); - strcpy(name,"Knife"); + full_name = "Bronze Knife"; + name = "Knife"; set_ident(true); break; case 'buck': @@ -166,8 +166,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 65; value = 2; weight = 20; - strcpy(full_name,"Crude Buckler"); - strcpy(name,"Buckler"); + full_name = "Crude Buckler"; + name = "Buckler"; set_ident(true); break; case 'bow ': @@ -182,8 +182,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 10; value = 15; weight = 20; - strcpy(full_name,"Cavewood Bow"); - strcpy(name,"Bow"); + full_name = "Cavewood Bow"; + name = "Bow"; set_ident(true); break; case 'arrw': @@ -198,8 +198,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 47; value = 1; weight = 1; - strcpy(full_name,"Arrows"); - strcpy(name,"Arrows"); + full_name = "Arrows"; + name = "Arrows"; set_ident(true); break; case 'pole': @@ -214,8 +214,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 4; value = 10; weight = 20; - strcpy(full_name,"Stone Spear"); - strcpy(name,"Spear"); + full_name = "Stone Spear"; + name = "Spear"; set_ident(true); break; case 'helm': @@ -230,8 +230,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 66; value = 6; weight = 15; - strcpy(full_name,"Leather Helm"); - strcpy(name,"Helm"); + full_name = "Leather Helm"; + name = "Helm"; set_ident(true); break; case 'food': @@ -246,8 +246,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 62; value = 0; weight = 0; - strcpy(full_name,"Food"); - strcpy(name,"Food"); + full_name = "Food"; + name = "Food"; set_ident(false); break; case 'spel': @@ -262,8 +262,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 53; value = 0; weight = 0; - strcpy(full_name,""); - strcpy(name,""); + full_name = ""; + name = ""; set_ident(false); break; case 'alch': @@ -278,8 +278,8 @@ cItemRec::cItemRec(long preset){ graphic_num = 50; value = 0; weight = 8; - strcpy(full_name,"Potion"); - strcpy(name,"Potion"); + full_name = "Potion"; + name = "Potion"; set_ident(false); set_magic(true); break; @@ -310,8 +310,8 @@ cItemRec& cItemRec::operator = (legacy::item_record_type& old){ special_class = old.special_class; item_loc.x = old.item_loc.x; item_loc.y = old.item_loc.y; - strcpy(full_name,old.full_name); - strcpy(name,old.name); + full_name = old.full_name; + name = old.name; treas_class = old.treas_class; item_properties = old.item_properties; reserved1 = old.reserved1; @@ -369,10 +369,10 @@ void cItemRec::readAttrFrom(string cur, istream& sin){ else if(cur == "AT") sin >> item_loc.x >> item_loc.y; else if(cur == "FULLNAME"){ getline(sin,cur); - strcpy(full_name,cur.c_str()); + full_name = cur; }else if(cur == "NAME"){ getline(sin,cur); - strcpy(name,cur.c_str()); + name = cur; } else if(cur == "TREASURE") sin >> treas_class; else if(cur == "IDENTIFIED") set_ident(true); diff --git a/osx/classes/item.h b/osx/classes/item.h index 3c7ce52d..d7fdded4 100644 --- a/osx/classes/item.h +++ b/osx/classes/item.h @@ -201,8 +201,8 @@ public: unsigned char weight; unsigned char special_class; location item_loc; - char full_name[25]; - char name[15]; + string full_name; + string name; unsigned char treas_class; unsigned char item_properties; private: diff --git a/osx/classes/monster.cpp b/osx/classes/monster.cpp index d3e8400d..9d735795 100644 --- a/osx/classes/monster.cpp +++ b/osx/classes/monster.cpp @@ -14,7 +14,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){ int i; m_num = old.m_num; level = old.level; - strcpy((char*)m_name,(char*)old.m_name); + //m_name = old.m_name; health = old.health; m_health = old.m_health; mp = old.mp; @@ -54,3 +54,65 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){ picture_num = old.picture_num; return *this; } + +cCreature::cCreature(){ + // short personality; + // short special_on_kill,facial_pic; + //{-1,-1,-1} + id = number = active = attitude = start_attitude = 0; + start_loc.x = start_loc.y = cur_loc.x = cur_loc.y = targ_loc.x = targ_loc.y = 80; + mobility = 1; + time_flag = summoned = extra1 = extra2 = 0; + spec1 = spec2 = spec_enc_code = time_code = monster_time = 0; + personality = special_on_kill = facial_pic = -1; + target = 6; +} + +cCreature& cCreature::operator = (legacy::creature_start_type old){ + number = old.number; + start_attitude = old.start_attitude; + start_loc.x = old.start_loc.x; + start_loc.y = old.start_loc.y; + mobility = old.mobile; + time_flag = old.time_flag; + extra1 = old.extra1; + extra2 = old.extra2; + spec1 = old.spec1; + spec2 = old.spec2; + spec_enc_code = old.spec_enc_code; + time_code = old.time_code; + monster_time = old.monster_time; + personality = old.personality; + special_on_kill = old.special_on_kill; + facial_pic = old.facial_pic; + return *this; +} + +__attribute__((deprecated)) +cCreature& cCreature::operator = (legacy::creature_data_type old){ + active = old.active; + attitude = old.attitude; + number = old.number; + cur_loc.x = old.m_loc.x; + cur_loc.y = old.m_loc.y; + m_d = old.m_d; + mobility = old.mobile; + summoned = old.summoned; + number = old.monst_start.number; + start_attitude = old.monst_start.start_attitude; + start_loc.x = old.monst_start.start_loc.x; + start_loc.y = old.monst_start.start_loc.y; + mobility = old.monst_start.mobile; + time_flag = old.monst_start.time_flag; + extra1 = old.monst_start.extra1; + extra2 = old.monst_start.extra2; + spec1 = old.monst_start.spec1; + spec2 = old.monst_start.spec2; + spec_enc_code = old.monst_start.spec_enc_code; + time_code = old.monst_start.time_code; + monster_time = old.monst_start.monster_time; + personality = old.monst_start.personality; + special_on_kill = old.monst_start.special_on_kill; + facial_pic = old.monst_start.facial_pic; + return *this; +} diff --git a/osx/classes/monster.h b/osx/classes/monster.h index 72994ad1..1e2731d4 100644 --- a/osx/classes/monster.h +++ b/osx/classes/monster.h @@ -6,7 +6,11 @@ * */ -namespace legacy { struct monster_record_type; }; +namespace legacy { + struct monster_record_type; + struct creature_data_type; + struct creature_start_type; +}; /* Monsters Stuff */ /* Skills Same as PC */ @@ -103,7 +107,8 @@ enum eMonsterType { class cMonster { public: - unsigned char m_num,level,m_name[26]; + unsigned char m_num,level; + string m_name; short health,m_health,mp,max_mp; unsigned char armor,skill; short a[3]; @@ -120,3 +125,28 @@ public: cMonster& operator = (legacy::monster_record_type& old); void writeTo(ostream& file, string prefix); }; + +class cCreature { +public: + cMonster m_d; + unsigned long id; + unsigned short number; + short active, attitude; + unsigned char start_attitude; + location start_loc, cur_loc; + unsigned char mobility; // Was a bool, but am making it a char to allow for additional mobility states + unsigned char time_flag; + short summoned; + unsigned char extra1, extra2; + short spec1, spec2; + char spec_enc_code, time_code; + short monster_time, personality; + short special_on_kill, facial_pic; + short target; + location targ_loc; + + cCreature(); + + cCreature& operator = (legacy::creature_data_type old); + cCreature& operator = (legacy::creature_start_type old); +}; diff --git a/osx/classes/pc.cpp b/osx/classes/pc.cpp index 4f75e8ce..959999bd 100644 --- a/osx/classes/pc.cpp +++ b/osx/classes/pc.cpp @@ -13,7 +13,7 @@ __attribute__((deprecated)) cPlayer& cPlayer::operator = (legacy::pc_record_type old){ int i; main_status = (eMainStatus) old.main_status; - strcpy(name,old.name); + name = old.name; for(i = 0; i < 20; i++) skills[i] = old.skills[i]; max_health = old.max_health; @@ -62,7 +62,7 @@ short cPlayer::get_tnl(){ cPlayer::cPlayer(){ short i; main_status = MAIN_STATUS_ABSENT; - sprintf ((char *) name, "\n"); + name = "\n"; for (i = 0; i < 30; i++) skills[i] = (i < 3) ? 1 : 0; @@ -102,22 +102,22 @@ cPlayer::cPlayer(long key,short slot){ if(key == 'dbug'){ switch (slot) { case 0: - sprintf ((char *) name, "Gunther"); + name = "Gunther"; break; case 1: - sprintf ((char *) name, "Yanni"); + name = "Yanni"; break; case 2: - sprintf ((char *) name, "Mandolin"); + name = "Mandolin"; break; case 3: - sprintf ((char *) name, "Pete"); + name = "Pete"; break; case 4: - sprintf ((char *) name, "Vraiment"); + name = "Vraiment"; break; case 5: - sprintf ((char *) name, "Goo"); + name = "Goo"; break; } for (i = 0; i < 30; i++) @@ -177,22 +177,22 @@ cPlayer::cPlayer(long key,short slot){ main_status = MAIN_STATUS_ALIVE; switch (slot) { case 0: - sprintf ((char *) name, "Jenneke"); + name = "Jenneke"; break; case 1: - sprintf ((char *) name, "Thissa"); + name = "Thissa"; break; case 2: - sprintf ((char *) name, "Frrrrrr"); + name = "Frrrrrr"; break; case 3: - sprintf ((char *) name, "Adrianna"); + name = "Adrianna"; break; case 4: - sprintf ((char *) name, "Feodoric"); + name = "Feodoric"; break; case 5: - sprintf ((char *) name, "Michael"); + name = "Michael"; break; } diff --git a/osx/classes/pc.h b/osx/classes/pc.h index c96ab67d..80a691fc 100644 --- a/osx/classes/pc.h +++ b/osx/classes/pc.h @@ -33,7 +33,7 @@ enum eMainStatus { class cPlayer { public: eMainStatus main_status; - char name[20]; + string name; short skills[30]; unsigned short max_health; short cur_health; @@ -54,6 +54,7 @@ public: short race; //short exp_adj; short direction; + short ap; cPlayer& operator = (legacy::pc_record_type old); cPlayer(); diff --git a/osx/classes/regtown.cpp b/osx/classes/regtown.cpp index 76b8717d..9ae0f39e 100644 --- a/osx/classes/regtown.cpp +++ b/osx/classes/regtown.cpp @@ -122,7 +122,7 @@ rectangle& cTinyTown::room_rect(size_t i){ return _room_rect[i]; } -cTown::cCreature& cTinyTown::creatures(size_t i){ +cCreature& cTinyTown::creatures(size_t i){ return _creatures[i]; } @@ -138,7 +138,7 @@ rectangle& cMedTown::room_rect(size_t i){ return _room_rect[i]; } -cTown::cCreature& cMedTown::creatures(size_t i){ +cCreature& cMedTown::creatures(size_t i){ return _creatures[i]; } @@ -154,7 +154,7 @@ rectangle& cBigTown::room_rect(size_t i){ return _room_rect[i]; } -cTown::cCreature& cBigTown::creatures(size_t i){ +cCreature& cBigTown::creatures(size_t i){ return _creatures[i]; } @@ -164,7 +164,7 @@ unsigned char& cBigTown::lighting(size_t i, size_t r){ cBigTown::cBigTown(){ int i; - cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0}; + cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0}; Rect d_rect = {0,0,0,0}; for (i = 0; i < 16; i++) { _room_rect[i].top = d_rect.top; @@ -179,7 +179,7 @@ cBigTown::cBigTown(){ cMedTown::cMedTown(){ int i; - cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0}; + cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0}; Rect d_rect = {0,0,0,0}; for (i = 0; i < 16; i++) { _room_rect[i].top = d_rect.top; @@ -194,7 +194,7 @@ cMedTown::cMedTown(){ cTinyTown::cTinyTown(){ int i; - cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0}; + cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0}; Rect d_rect = {0,0,0,0}; for (i = 0; i < 16; i++) { _room_rect[i].top = d_rect.top; diff --git a/osx/classes/scenario.cpp b/osx/classes/scenario.cpp index d754e6f2..5335098a 100644 --- a/osx/classes/scenario.cpp +++ b/osx/classes/scenario.cpp @@ -102,7 +102,7 @@ void cScenario::append(legacy::scen_item_data_type& old){ for(i = 0; i < 400; i++) scen_items[i] = old.scen_items[i]; for(i = 0; i < 256; i++) - strcpy((char*)scen_monsters[i].m_name,(char*)old.monst_names[i]); + scen_monsters[i].m_name = old.monst_names[i]; for(i = 0; i < 256; i++) ter_types[i].name = old.ter_names[i]; } diff --git a/osx/classes/tmpltown.cpp b/osx/classes/tmpltown.cpp index 3d4ff643..833ffb71 100644 --- a/osx/classes/tmpltown.cpp +++ b/osx/classes/tmpltown.cpp @@ -16,7 +16,7 @@ rectangle& cBigTemplTown::room_rect(size_t i){ return _room_rect[i]; } -cTown::cCreature& cBigTemplTown::creatures(size_t i){ +cCreature& cBigTemplTown::creatures(size_t i){ return _creatures[i]; } diff --git a/osx/classes/town.cpp b/osx/classes/town.cpp index 16eebfe2..5696a6f1 100644 --- a/osx/classes/town.cpp +++ b/osx/classes/town.cpp @@ -151,26 +151,6 @@ char(& cTown::town_strs(short i))[256]{ return comment[1]; // random unused string } -cTown::cCreature& cTown::cCreature::operator = (legacy::creature_start_type old){ - number = old.number; - start_attitude = old.start_attitude; - start_loc.x = old.start_loc.x; - start_loc.y = old.start_loc.y; - mobile = old.mobile; - time_flag = old.time_flag; - extra1 = old.extra1; - extra2 = old.extra2; - spec1 = old.spec1; - spec2 = old.spec2; - spec_enc_code = old.spec_enc_code; - time_code = old.time_code; - monster_time = old.monster_time; - personality = old.personality; - special_on_kill = old.special_on_kill; - facial_pic = old.facial_pic; - return *this; -} - cTown::cWandering& cTown::cWandering::operator = (legacy::wandering_type old){ monst[0] = old.monst[0]; monst[1] = old.monst[1]; diff --git a/osx/classes/town.h b/osx/classes/town.h index 9124b181..1e28e2e5 100644 --- a/osx/classes/town.h +++ b/osx/classes/town.h @@ -19,21 +19,21 @@ namespace legacy { class cTown { // formerly town_record_type public: - class cCreature { // formerly creature_start_type - public: - unsigned short number; - unsigned char start_attitude; - location start_loc; - unsigned char mobile; - unsigned char time_flag; - unsigned char extra1,extra2; - short spec1, spec2; - char spec_enc_code,time_code; - short monster_time,personality; - short special_on_kill,facial_pic; - - cCreature& operator = (legacy::creature_start_type old); - }; +// class cCreature { // formerly creature_start_type +// public: +// unsigned short number; +// unsigned char start_attitude; +// location start_loc; +// unsigned char mobile; +// unsigned char time_flag; +// unsigned char extra1,extra2; +// short spec1, spec2; +// char spec_enc_code,time_code; +// short monster_time,personality; +// short special_on_kill,facial_pic; +// +// cCreature& operator = (legacy::creature_start_type old); +// }; class cWandering { // formerly wandering_type public: unsigned char monst[4]; diff --git a/osx/tools/dlgtool.cpp b/osx/tools/dlgtool.cpp index d544bbc5..a9bc111a 100644 --- a/osx/tools/dlgtool.cpp +++ b/osx/tools/dlgtool.cpp @@ -313,11 +313,11 @@ void cd_get_item_text(short dlog_num, short item_num, char *str){ else sprintf(str,"%s",text_short_str[item_index - 10]); } -void csit(short dlog_num, short item_num, char *str){ +void csit(short dlog_num, short item_num, const char *str){ cd_set_item_text( dlog_num, item_num, str); } -void cd_set_item_text(short dlog_num, short item_num, char *str){ +void cd_set_item_text(short dlog_num, short item_num, const char *str){ short dlg_index,item_index; if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) return ; @@ -367,7 +367,7 @@ short cd_retrieve_text_edit_num(short dlog_num, short item_num){ } // NOTE!!! Expects a c string -void cd_set_text_edit_str(short dlog_num, short item_num, char *str){ +void cd_set_text_edit_str(short dlog_num, short item_num, const char *str){ short dlg_index; short the_type; Handle the_handle = NULL; diff --git a/osx/tools/dlgtool.h b/osx/tools/dlgtool.h index 95f8d8dd..b075b0a8 100644 --- a/osx/tools/dlgtool.h +++ b/osx/tools/dlgtool.h @@ -93,11 +93,11 @@ void cd_set_pict(short dlog_num, short item_num, short pict_num, short pict_type void cd_activate_item(short dlog_num, short item_num, short status); short cd_get_active(short dlog_num, short item_num); void cd_get_item_text(short dlog_num, short item_num, char *str); -void csit(short dlog_num, short item_num, char *str); -void cd_set_item_text(short dlog_num, short item_num, char *str); +void csit(short dlog_num, short item_num, const char *str); +void cd_set_item_text(short dlog_num, short item_num, const char *str); void cd_retrieve_text_edit_str(short dlog_num, short item_num, char *str); short cd_retrieve_text_edit_num(short dlog_num, short item_num); -void cd_set_text_edit_str(short dlog_num, short item_num, char *str); +void cd_set_text_edit_str(short dlog_num, short item_num, const char *str); void cd_set_text_edit_num(short dlog_num, short item_num, short num); void cdsin(short dlog_num, short item_num, short num); void cd_set_item_num(short dlog_num, short item_num, short num); diff --git a/osx/tools/graphtool.cpp b/osx/tools/graphtool.cpp index bef2052d..93d66a1d 100644 --- a/osx/tools/graphtool.cpp +++ b/osx/tools/graphtool.cpp @@ -417,7 +417,7 @@ void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,sh SetPort(old_port);//printf("String drawn.\n"); } -short string_length(char *str){ // Why not just use strlen? +short string_length(const char *str){ // Why not just use strlen? short text_len[257]; short total_width = 0,i,len; Str255 p_str; diff --git a/osx/tools/graphtool.h b/osx/tools/graphtool.h index 2aaf70e5..2f76eda9 100644 --- a/osx/tools/graphtool.h +++ b/osx/tools/graphtool.h @@ -21,7 +21,7 @@ void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gwor void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height,bool main_win); void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height,bool main_win); void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height,bool main_win); -short string_length(char *str); +short string_length(const char *str); //OSStatus flip_pict(OSType domain, OSType type, short id, void *ptr, UInt32 size, bool isNative, void *refcon); //void draw_terrain(); Rect calc_rect(short i, short j);