From 46aad7201ca8f55bc35c7e3084c9fc83f36166a6 Mon Sep 17 00:00:00 2001 From: Chokboyz Date: Thu, 1 Apr 2010 22:12:05 +0000 Subject: [PATCH] *Fixed a bug that prevented the Good Constitution Trait from giving bonus to shrug off disease. *Fixed the encumberance calculation function, the last 8 items are no longer ignored. Chokboyz git-svn-id: http://openexile.googlecode.com/svn/trunk@146 4ebdad44-0ea0-11de-aab3-ff745001d230 --- Win32/Blades of Exile/boe.actions.cpp | 456 +++++++------- Win32/Blades of Exile/boe.combat.cpp | 85 ++- Win32/Blades of Exile/boe.graphics.cpp | 278 ++++----- Win32/Blades of Exile/boe.items.cpp | 192 +++--- Win32/Blades of Exile/boe.monster.cpp | 306 +++++----- Win32/Blades of Exile/boe.party.cpp | 654 ++++++++++----------- Win32/Blades of Exile/boe.specials.cpp | 530 ++++++++--------- Win32/Blades of Exile/classes/LOCATION.CPP | 48 +- Win32/Blades of Exile/classes/PC.CPP | 298 +++++----- Win32/Blades of Exile/classes/consts.h | 200 ++++--- 10 files changed, 1522 insertions(+), 1525 deletions(-) diff --git a/Win32/Blades of Exile/boe.actions.cpp b/Win32/Blades of Exile/boe.actions.cpp index cbe7466c..b0a83e88 100644 --- a/Win32/Blades of Exile/boe.actions.cpp +++ b/Win32/Blades of Exile/boe.actions.cpp @@ -60,7 +60,7 @@ void init_screen_locs() shopping_rects[i][j] = shopping_rects[0][j]; OffsetRect(&shopping_rects[i][j],0,i * 36); } - + for (i = 0; i < 6; i++) { startup_button[i] = startup_base; @@ -70,7 +70,7 @@ void init_screen_locs() startup_top.bottom = startup_button[0].top; startup_top.left = 5; startup_top.right = startup_button[3].right; - + for (i = 0; i < 200; i++) for (j = 0; j < 8; j++) for (k = 0; k < 64; k++) @@ -95,7 +95,7 @@ void init_screen_locs() town_buttons[5] = medium_buttons[0]; town_buttons[6] = medium_buttons[1]; for (i = 5; i < 9; i++) combat_buttons[i] = medium_buttons[i - 5]; - + // name, use, give, drip, info, sell/id each one 13 down item_buttons[0][0].top = 17; item_buttons[0][0].bottom = item_buttons[0][0].top + 12; @@ -117,12 +117,12 @@ void init_screen_locs() item_buttons[0][5] = item_buttons[0][0]; item_buttons[0][5].left = 173; item_buttons[0][5].right = 232; - for (i = 1; i < 8; i++) - for (j = 0; j < 6; j++) { + for (i = 1; i < 8; i++) + for (j = 0; j < 6; j++) { item_buttons[i][j] = item_buttons[0][j]; OffsetRect(&item_buttons[i][j],0,13 * i); } - + // name, hp, sp, info, trade pc_buttons[0][0].top = 18; pc_buttons[0][0].bottom = pc_buttons[0][0].top + 12; @@ -140,8 +140,8 @@ void init_screen_locs() pc_buttons[0][4] = pc_buttons[0][0]; pc_buttons[0][4].left = 253; pc_buttons[0][4].right = 262; - for (i = 1; i < 6; i++) - for (j = 0; j < 5; j++) { + for (i = 1; i < 6; i++) + for (j = 0; j < 5; j++) { pc_buttons[i][j] = pc_buttons[0][j]; OffsetRect(&pc_buttons[i][j],0,13 * i); } @@ -149,7 +149,7 @@ void init_screen_locs() pc_help_button.bottom = 114; pc_help_button.left = 251; pc_help_button.right = 267; - + pc_area_rect.top = PC_WIN_UL_Y; pc_area_rect.left = PC_WIN_UL_X; pc_area_rect.bottom = PC_WIN_UL_Y + 116; @@ -176,7 +176,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) short find_direction_from,ter_looked_at,button_hit = 12; short store_sp[6]; - char str[60]; + char str[60]; POINT point_in_area; Boolean right_button = FALSE; Boolean ctrl_key = FALSE; @@ -187,11 +187,11 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) the_point.y -= uly; } if (lparam == -2) right_button = TRUE; - + if(((GetAsyncKeyState(VK_LCONTROL) & 32768) == 32768) || ((GetAsyncKeyState(VK_RCONTROL) & 32768) == 32768)){ ctrl_key = TRUE; } - + for (i = 0; i < 20; i++) special_queue[i].queued_special = -1; end_scenario = FALSE; @@ -207,7 +207,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) if (overall_mode != MODE_SHOPPING) return FALSE; } - + // First, figure out where party is @@ -218,31 +218,31 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) if (PtInRect ( &bottom_buttons[i], the_point) == TRUE) { button_hit = i; if (spell_forced == FALSE) - main_button_click(overall_mode,bottom_buttons[i]); + main_button_click(overall_mode,bottom_buttons[i]); } break; - + case MODE_TOWN: case MODE_TALK_TOWN: case MODE_TOWN_TARGET: case MODE_USE: case 5: case 6: case 7: case MODE_LOOK_TOWN: cur_loc = center; for (i = 0; i < 8; i++) if (PtInRect (&town_buttons[i], the_point) == TRUE) { button_hit = i; if (spell_forced == FALSE) - main_button_click(overall_mode,town_buttons[i]); + main_button_click(overall_mode,town_buttons[i]); } break; - + case MODE_TALKING: case MODE_SHOPPING: break; - - default: + + default: cur_loc = (overall_mode > MODE_COMBAT) ? center : pc_pos[current_pc]; for (i = 0; i < 9; i++) if (PtInRect (&combat_buttons[i], the_point) == TRUE) { button_hit = i; if (spell_forced == FALSE) - main_button_click(overall_mode,combat_buttons[i]); + main_button_click(overall_mode,combat_buttons[i]); } break; } @@ -255,7 +255,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) if (someone_awake() == FALSE) { ASB("Everyone's asleep/paralyzed."); need_reprint = TRUE; - need_redraw = TRUE; + need_redraw = TRUE; } if (overall_mode == MODE_OUTDOORS) { cast_spell(button_hit,0); @@ -296,7 +296,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) overall_mode = MODE_COMBAT; center = pc_pos[current_pc]; pause(10); - need_redraw = TRUE; + need_redraw = TRUE; } put_pc_screen(); put_item_screen(stat_window,0); @@ -358,7 +358,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } if(timed_special_happened && PSD[309][4] == 1){ i=200; - add_string_to_buf(" Rest interrupted."); + add_string_to_buf(" Rest interrupted."); } else i++; } @@ -373,21 +373,21 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) i = 200; adven.disease(2); } - // Plants and magic shops + // Plants and magic shops if (party.age % 4000 == 0) refresh_store_items(); timed_special_happened = special_increase_age(0); if(timed_special_happened && PSD[309][4] == 1){ i=200; - add_string_to_buf(" Rest interrupted."); + add_string_to_buf(" Rest interrupted."); } } if(i == 115){ add_string_to_buf(" Rest successful. "); adven.heal(get_ran(5,1,10)); adven.restoreSP(50); - put_pc_screen(); + put_pc_screen(); } } else{ @@ -442,22 +442,22 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) add_string_to_buf("Use: Select a space or item."); add_string_to_buf(" (Hit button again to cancel.)"); need_reprint = TRUE; - overall_mode = MODE_USE; + overall_mode = MODE_USE; } else if (overall_mode == MODE_USE) { overall_mode = MODE_TOWN; need_reprint = TRUE; - add_string_to_buf(" Cancelled."); + add_string_to_buf(" Cancelled."); } if (overall_mode == MODE_COMBAT) { need_reprint = TRUE; need_redraw = TRUE; pc_delayed = TRUE; } - + break; - case 6: + case 6: if (overall_mode == MODE_OUTDOORS) { do_load(); break; @@ -525,12 +525,12 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) need_reprint = TRUE; need_redraw = TRUE; did_something = TRUE; - menu_activate(1); - } + menu_activate(1); + } need_redraw = TRUE; } break; - + case 8: if (overall_mode == MODE_COMBAT) { @@ -541,14 +541,14 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) else { add_string_to_buf("All PC's now active. "); current_pc = combat_active_pc; - combat_active_pc = INVALID_PC; + combat_active_pc = INVALID_PC; } need_reprint = TRUE; } break; - - + + } // Begin : click in terrain @@ -606,7 +606,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) cur_direction = get_cur_direction(the_point); destination.x += cur_direction.x; destination.y += cur_direction.y; - + // Begin: Moving if ((right_button == FALSE) && (overall_mode == MODE_COMBAT)) { if (pc_combat_move(destination) == TRUE) { @@ -616,7 +616,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } need_redraw = TRUE; menu_activate(1); - } + } if ((right_button == FALSE) && (overall_mode == MODE_TOWN)) { if (someone_awake() == FALSE) { ASB("Everyone's asleep/paralyzed."); @@ -652,8 +652,8 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) menu_activate(1); } - else need_redraw = TRUE; - + else need_redraw = TRUE; + storage = out[party.p_loc.x][party.p_loc.y]; if (scenario.ter_types[storage].special == 21) {//// town entry @@ -661,9 +661,9 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) else if (party.direction == 4) find_direction_from = 0; else if (party.direction < 4) find_direction_from = 3; else find_direction_from = 1; - - for (i = 0; i < 8; i++) - if (same_point(party.loc_in_sec,outdoors[party.i_w_c.x][party.i_w_c.y].exit_locs[i]) == TRUE) { + + for (i = 0; i < 8; i++) + if (same_point(party.loc_in_sec,outdoors[party.i_w_c.x][party.i_w_c.y].exit_locs[i]) == TRUE) { which_t = outdoors[party.i_w_c.x][party.i_w_c.y].exit_dests[i]; if (which_t >= 0) start_town_mode(outdoors[party.i_w_c.x][party.i_w_c.y].exit_dests[i], find_direction_from); @@ -679,16 +679,16 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } } // End if(overall_mode == MODE_OUTDOORS) - } + } // End: Moving -// Begin: Looking at something +// Begin: Looking at something if ((right_button == TRUE) || (overall_mode == MODE_LOOK_OUTDOORS) || (overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) { destination.x = destination.x + i - 4; destination.y = destination.y + j - 4; need_reprint = TRUE; - + // if ((can_see(cur_loc,destination) >= 4) || ((overall_mode != 35) && (loc_off_world(destination) == TRUE))) if ((is_combat() == FALSE) && (party_can_see(destination) == 6)) add_string_to_buf(" Can't see space. "); @@ -752,14 +752,14 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } } - + // End: looking at something -// Begin : talking to someone - if (overall_mode == MODE_TALK_TOWN) { +// Begin : talking to someone + if (overall_mode == MODE_TALK_TOWN) { destination.x = destination.x + i - 4; destination.y = destination.y + j - 4; - + if ((can_see(cur_loc,destination,0) >= 4) || (loc_off_world(destination) == TRUE)) { add_string_to_buf(" Can't see space "); need_reprint = TRUE; @@ -780,7 +780,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) start_talk_mode(i,c_town.monst.dudes[i].monst_start.personality,c_town.monst.dudes[i].number, c_town.monst.dudes[i].monst_start.facial_pic); did_something = FALSE; - need_redraw = FALSE; + need_redraw = FALSE; } break; } @@ -794,11 +794,11 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } if (overall_mode != 20) need_redraw = TRUE; - } + } // End : talking to someone // Begin : Targeting a space - if ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || + if ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || (overall_mode == MODE_FANCY_TARGET) || (overall_mode == MODE_DROPPING)) { destination.x += i - 4; destination.y += j - 4; @@ -833,7 +833,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) destination.x += i - 4; destination.y += j - 4; switch (overall_mode) { - case 3: + case 3: cast_town_spell(destination); did_something = TRUE; break; @@ -860,7 +860,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) // End : Targeting a space } -//End: click in terrain +//End: click in terrain // Begin: Screen shift if ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || (overall_mode == MODE_FANCY_TARGET) @@ -885,12 +885,12 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) center.x++; need_redraw = TRUE; } - } -// End: Screen shift + } +// End: Screen shift // Process clicks in PC stats area - if (PtInRect (&pc_area_rect,the_point)) { + if (PtInRect (&pc_area_rect,the_point)) { point_in_area = the_point; point_in_area.x -= PC_WIN_UL_X; point_in_area.y -= PC_WIN_UL_Y; @@ -901,7 +901,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) FCD(1082,0); } for (i = 0; i < 6; i++) - for (j = 0; j < 5; j++) + for (j = 0; j < 5; j++) if ((pc_area_button_active[i][j] > 0) && (PtInRect (&pc_buttons[i][j],point_in_area))) { OffsetRect(&pc_buttons[i][j],PC_WIN_UL_X,PC_WIN_UL_Y); arrow_button_click(pc_buttons[i][j]); @@ -945,7 +945,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) add_string_to_buf("Trade places: Can't do this in combat."); else { switch_pc(i); - } + } break; } } @@ -959,7 +959,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } // Process clicks in item stats area - if (PtInRect (&item_area_rect,the_point)) { + if (PtInRect (&item_area_rect,the_point)) { point_in_area = the_point; point_in_area.x -= ITEM_WIN_UL_X; point_in_area.y -= ITEM_WIN_UL_Y; @@ -1070,7 +1070,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) else { play_sound(68); ASB("Your item is identified."); - adven[stat_window].items[item_hit].item_properties = + adven[stat_window].items[item_hit].item_properties = adven[stat_window].items[item_hit].item_properties | 1; } break; @@ -1129,7 +1129,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) adven[i].status[STATUS_WEBS] = 0; } } - i = 0; + i = 0; while ((i < 80) && (party_sees_a_monst() == FALSE)){ increase_age(); @@ -1156,7 +1156,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) else i++; } } - put_pc_screen(); + put_pc_screen(); } // If in combat and pc delayed, jump forward a step @@ -1164,11 +1164,11 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) { initiate_redraw(); current_pc++; - combat_next_step(); - set_stat_window(current_pc); + combat_next_step(); + set_stat_window(current_pc); put_pc_screen(); } - + // At this point, see if any specials have been queued up, and deal with them for (i = 0; i < 20; i++) if (special_queue[i].queued_special >= 0) { @@ -1193,8 +1193,8 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) if (s3 > 0) initiate_redraw(); } - - // Handle non-PC stuff (like monsters) if the party actually did something + + // Handle non-PC stuff (like monsters) if the party actually did something if (did_something == TRUE) { draw_map(modeless_dialogs[5],5); @@ -1223,17 +1223,17 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) if (!(is_out()) || ((is_out()) && (party.age % 10 == 0))) // no monst move is party outdoors and on horse do_monsters(); if (overall_mode != 0) do_monster_turn(); - // Wand monsts + // Wand monsts if ((overall_mode == 0) && (party_toast() == FALSE) && (party.age % 10 == 0)) { if (get_ran(1,1,70 + PSD[306][8] * 200) == 10) create_wand_monst(); - + for (i = 0; i < 10; i++) if (party.out_c[i].exists == TRUE) - if (((adjacent(party.p_loc,party.out_c[i].m_loc) == TRUE) || + if (((adjacent(party.p_loc,party.out_c[i].m_loc) == TRUE) || (party.out_c[i].what_monst.cant_flee >= 10)) - && (party.in_boat < 0) && (party.isFlying() == false)) { + && (party.in_boat < 0) && (party.isFlying() == false)) { store_wandering_special = party.out_c[i].what_monst; if (handle_wandering_specials(0) == TRUE) @@ -1254,10 +1254,10 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) } - + if (need_redraw == TRUE) initiate_redraw(); - + if ((need_reprint == TRUE) || (need_redraw == TRUE)) print_buf(); if (end_scenario == TRUE) { @@ -1266,7 +1266,7 @@ Boolean handle_action(POINT the_point, WPARAM wparam, LPARAM lparam ) in_scen_debug=FALSE; ghost_mode = FALSE; draw_startup(0); - menu_activate(1); + menu_activate(1); if (FCD(901,0) == 2) save_file(1); } if (party_toast() == TRUE) { @@ -1346,7 +1346,7 @@ void check_cd_event(HWND hwnd,UINT message, WPARAM wparam, LPARAM lparam) } if (wind_hit < 0) return; - + switch (wind_hit) { case -1: break; case 869: pick_prefab_scen_event_filter(item_hit); break; @@ -1382,10 +1382,10 @@ void check_cd_event(HWND hwnd,UINT message, WPARAM wparam, LPARAM lparam) } } -void handle_menu_spell(short spell_picked,short spell_type) +void handle_menu_spell(short spell_picked,short spell_type) { POINT pass_point; - + spell_forced = TRUE; pc_casting = current_pc; pc_last_cast[spell_type][current_pc] = spell_picked; @@ -1423,7 +1423,7 @@ void handle_menu_spell(short spell_picked,short spell_type) } // Delay((long) 100,&dummy); - + start_outdoor_combat(party.out_c[i], out[party.p_loc.x][party.p_loc.y], party.p_loc.countWalls()); party.out_c[i].exists = FALSE; @@ -1437,7 +1437,7 @@ void handle_menu_spell(short spell_picked,short spell_type) place_item(adven[m].items[n],to_place,TRUE); adven[m].items[n].variety = 0; } - + overall_mode = 10; center = pc_pos[current_pc]; initiate_redraw(); @@ -1503,7 +1503,7 @@ Boolean handle_syskeystroke(WPARAM wParam, LPARAM,short *handled) pass_point.y = 185; are_done = handle_action(pass_point,wParam,-1); return are_done; - } + } if ((wParam == VK_UP) || (wParam == VK_DOWN)) { //go up or down *handled = 1; pass_point.x = 150; @@ -1511,7 +1511,7 @@ Boolean handle_syskeystroke(WPARAM wParam, LPARAM,short *handled) are_done = handle_action(pass_point,wParam,-1); return are_done; } - + if ((wParam == VK_HOME) || (wParam == VK_PRIOR)) { //go northwest or northeast *handled = 1; pass_point.x = (wParam == VK_HOME) ? 120 : 170; @@ -1519,7 +1519,7 @@ Boolean handle_syskeystroke(WPARAM wParam, LPARAM,short *handled) are_done = handle_action(pass_point,wParam,-1); return are_done; } - + if ((wParam == VK_END) || (wParam == VK_NEXT)) { //go southwest or southeast *handled = 1; pass_point.x = (wParam == VK_END) ? 120 : 180; @@ -1527,7 +1527,7 @@ Boolean handle_syskeystroke(WPARAM wParam, LPARAM,short *handled) are_done = handle_action(pass_point,wParam,-1); return are_done; } - + return are_done; } @@ -1556,7 +1556,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) if (chr == '?') { party.help_received[5] = 0; give_help(205,6,0); - } + } for (i = 0; i < 9; i++) if (chr == talk_chars[i]) { pass_point.x = preset_words[i].word_rect.left + 9; @@ -1580,7 +1580,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) } if ((overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) { - + for (k = 0; k < (short) LOWORD(lParam); k++) switch(chr) { @@ -1594,10 +1594,10 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) { in_scen_debug = TRUE; ASB("Debug mode ON."); - } + } print_buf(); break; - case '&': + case '&': add_string_to_buf("If Valorim ..."); print_buf(); break; @@ -1605,14 +1605,14 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) add_string_to_buf("You want to save ..."); print_buf(); break; - case '(': + case '(': add_string_to_buf("Back up your save files ..."); print_buf(); break; case ')': add_string_to_buf("Burma Shave."); print_buf(); - break; + break; case '?': if (is_out()){ @@ -1620,7 +1620,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) break; } if (is_town()){ - FCD(1080,0); + FCD(1080,0); break; } if (is_combat()){ @@ -1635,7 +1635,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) are_done = handle_action(pass_point,wParam,-1); return are_done; break; - + case '9': pass_point.x = item_screen_button_rects[6].left + ITEM_WIN_UL_X; pass_point.y = item_screen_button_rects[6].top + ITEM_WIN_UL_Y; @@ -1656,14 +1656,14 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) break; - case 'z': + case 'z': if (((overall_mode >= 10) && (overall_mode < 20)) || (overall_mode == 37)) { set_stat_window(current_pc); put_item_screen(stat_window,0); } else { set_stat_window(0); - put_item_screen(stat_window,0); + put_item_screen(stat_window,0); } break; @@ -1691,7 +1691,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) put_pc_screen(); } break; - + // case 'A': Alchemy case 'B': // Leave town if (in_scen_debug) { @@ -1700,15 +1700,15 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) print_buf(); break; } - party.stuff_done[304][0] = 0; + party.stuff_done[304][0] = 0; for(i=0;i<6;i++) if(adven[i].main_status > 9) - adven[i].main_status -= 10; - overall_mode = MODE_OUTDOORS; + adven[i].main_status -= 10; + overall_mode = MODE_OUTDOORS; position_party(party.outdoor_corner.x,party.outdoor_corner.y,party.p_loc.x,party.p_loc.y); - clear_map(); - add_string_to_buf("Debug: Leaving town..."); - add_string_to_buf("Choose which direction to go."); + clear_map(); + add_string_to_buf("Debug: Leaving town..."); + add_string_to_buf("Choose which direction to go."); print_buf(); redraw_screen(0); } @@ -1729,18 +1729,18 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) adven[i].status[STATUS_PARALYZED] = 0; adven[i].status[STATUS_ACID] = 0; } - add_string_to_buf("Debug: You get cleaned up!"); + add_string_to_buf("Debug: You get cleaned up!"); print_buf(); put_pc_screen(); } break; -// case 'D': toggle Debug mode +// case 'D': toggle Debug mode //Can be moved out of this function to allow the character to switch debug mode during dialogues or shopping. case 'E': // Miscellaneous help if (in_scen_debug) { party.stuff_done[305][0] = 10; party.stuff_done[305][2] = 10; - party.stuff_done[305][3] = 10; + party.stuff_done[305][3] = 10; add_string_to_buf("Debug: Sanctuary, Detect, Lavawalk!"); print_buf(); put_pc_screen(); @@ -1749,12 +1749,12 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) case 'F': // Flight if (in_scen_debug) { if (overall_mode == MODE_TOWN){ - add_string_to_buf("Debug - Flying: Not while in Town !"); + add_string_to_buf("Debug - Flying: Not while in Town !"); print_buf(); break; } party.stuff_done[305][1] = 10; - add_string_to_buf("Debug: You start flying!"); + add_string_to_buf("Debug: You start flying!"); print_buf(); } break; @@ -1762,7 +1762,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) if(in_scen_debug){ if(ghost_mode){ ghost_mode = FALSE; - ASB("Debug: Ghost mode OFF."); + ASB("Debug: Ghost mode OFF."); } else{ ghost_mode = TRUE; @@ -1791,7 +1791,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) for (i = 0; i < T_M; i++) { if ((is_combat()) && (c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].attitude % 2 == 1)) c_town.monst.dudes[i].active = 0; - + if ((c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].attitude % 2 == 1) && (dist(c_town.monst.dudes[i].m_loc,c_town.p_loc) <= 10) ) damage_monst(i, 7,1000,0, 4); @@ -1802,18 +1802,18 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) break; } // case 'L': automap -// case 'M': repeat Mage spell +// case 'M': repeat Mage spell case 'N': // End scenario - if (in_scen_debug) { + if (in_scen_debug) { reload_startup(); in_startup_mode = TRUE; in_scen_debug=FALSE; ghost_mode = FALSE; draw_startup(0); - menu_activate(1); + menu_activate(1); if (FCD(901,0) == 2) save_file(1); } - break; + break; case 'O': // Location if (is_town()) { loc = c_town.p_loc; @@ -1831,8 +1831,8 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) sprintf (c_line, "Debug: You're in combat at x %d, y %d.", loc.x, loc.y); } add_string_to_buf((char *) c_line); - print_buf(); - break; + print_buf(); + break; // case 'P': repeat Priest spell case 'I': //debug info char buf[256]; //event timer off debug info @@ -1844,31 +1844,31 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) if (in_scen_debug) { if (overall_mode == MODE_OUTDOORS) { for (i = 0; i < 96; i++) - for (j = 0; j < 96; j++) + for (j = 0; j < 96; j++) make_explored(i,j); - } + } else { for (i = 0; i < 64; i++) - for (j = 0; j < 64; j++) + for (j = 0; j < 64; j++) make_explored(i,j); - } + } clear_map(); add_string_to_buf("Debug: Magic Map."); print_buf(); } break; case 'R': // Return to Start - if (in_scen_debug) { + if (in_scen_debug) { if (party.in_boat >= 0) { add_string_to_buf(" Not while in boat. "); print_buf(); - break; + break; } if (party.in_horse >= 0) { add_string_to_buf(" Not while on horse. "); print_buf(); break; - } + } force_town_enter(scenario.which_town_start,scenario.where_start); start_town_mode(scenario.which_town_start,9); position_party(scenario.out_sec_start.x,scenario.out_sec_start.y, @@ -1877,9 +1877,9 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) redraw_screen(0); add_string_to_buf("Debug: You are moved... "); print_buf(); - } + } break; - case 'S': // Set a SDF + case 'S': // Set a SDF if (in_scen_debug) { //and leave alone the 300+ SDF (game options/mechanics) char response[256]=""; display_strings("Enter Stuff Done Flag Part A (between 0 and 299)","",0,0,0,0,"Which SDFa ?",-1,130,0); @@ -1919,14 +1919,14 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) start_town_mode(i, find_direction_from); } } - break; + break; case 'W': if(in_scen_debug){ refresh_store_items(); add_string_to_buf("Debug: Refreshed jobs/shops. "); print_buf(); } - break; + break; case '<': // Advance clock by one day if (in_scen_debug) { ASB("Debug: One day passes..."); @@ -1944,9 +1944,9 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) party.creature_save[i].which_town = 200; } break; - case '/': // Help list + case '/': // Help list if(in_scen_debug){ - ASB(" Debug hot keys"); + ASB(" Debug hot keys"); ASB(" B: Leave town"); ASB(" C: Get cleaned up"); ASB(" D: Toggle Debug mode"); @@ -1956,7 +1956,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) ASB(" H: Heal"); ASB(" K: Kill things"); ASB(" N: End Scenario"); - ASB(" O: Location"); + ASB(" O: Location"); ASB(" Q: Magic map"); ASB(" R: Return to Start"); ASB(" S: Set a SDF"); @@ -1999,14 +1999,14 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) return are_done; } break; - - - case 'A': case 'M': case 'P': case 'd': case 'f': case 'g': case 'l': + + + case 'A': case 'M': case 'P': case 'd': case 'f': case 'g': case 'l': case 'm': case 'p': case 'r': case 't': case 'w': j = 50; - if ((chr == 'm') && ((overall_mode == 11) || (overall_mode == 14))) // cancel spell + if ((chr == 'm') && ((overall_mode == 11) || (overall_mode == 14))) // cancel spell j = 0; - if ((chr == 'p') && ((overall_mode == 11) || (overall_mode == 14))) // cancel spell + if ((chr == 'p') && ((overall_mode == 11) || (overall_mode == 14))) // cancel spell j = 1; if ((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_TOWN) || (overall_mode == MODE_COMBAT)) { switch (chr) { @@ -2161,7 +2161,7 @@ void do_save(short mode) //mode 0 - normal 1 - save as put_item_screen(stat_window,0); print_buf(); } - + void increase_age() { short i,j,item,how_many_short = 0,r1,store_day; @@ -2170,19 +2170,19 @@ void increase_age() // Increase age, adjust light level & stealth store_day = calc_day(); if (is_out()) { - if (party.in_horse < 0) + if (party.in_horse < 0) party.age -= party.age % 10; else party.age -= party.age % 5; party.age += 5; - if (party.in_horse < 0) + if (party.in_horse < 0) party.age += 5; - + } else party.age++; if (calc_day() != store_day) { // Day changed, so check for interesting stuff. update_stat = TRUE; } - + move_to_zero(party.light_level); // decrease monster present counter @@ -2199,10 +2199,10 @@ void increase_age() add_string_to_buf("Your feet stop glowing. ");} move_to_zero(party.stuff_done[305][3]); - if (party.stuff_done[305][1] == 2) + if (party.stuff_done[305][1] == 2) add_string_to_buf("You are starting to descend."); if (party.stuff_done[305][1] == 1) { - if (scenario.ter_types[out[party.p_loc.x][party.p_loc.y]].blockage > 2) { + if (scenario.ter_types[out[party.p_loc.x][party.p_loc.y]].blockage > 2) { add_string_to_buf(" You plummet to your deaths. "); adven.kill(2); print_buf(); @@ -2211,7 +2211,7 @@ void increase_age() else add_string_to_buf(" You land safely. "); reset_text_bar(); } - + move_to_zero(party.stuff_done[305][1]); if ((overall_mode > 0) && (c_town.town.lighting == 2)) @@ -2228,23 +2228,23 @@ void increase_age() update_stat = TRUE; adven.disease(2); } - - // Plants and magic shops + + // Plants and magic shops if (party.age % 4000 == 0) refresh_store_items(); - + // Protection, etc. for (i = 0; i < NUM_OF_PCS; i++) { // Process some status things, and check if stats updated - + if ((adven[i].status[STATUS_INVULNERABLE] == 1) || (adven[i].status[5] == 1) || (adven[i].status[8] == 1) || (adven[i].status[STATUS_ASLEEP] == 1)|| (adven[i].status[STATUS_PARALYZED] == 1)) update_stat = TRUE; move_to_zero(adven[i].status[STATUS_INVULNERABLE]); - move_to_zero(adven[i].status[STATUS_MAGIC_RESISTANCE]); - move_to_zero(adven[i].status[STATUS_INVISIBLE]); - move_to_zero(adven[i].status[STATUS_MARTYRS_SHIELD]); - move_to_zero(adven[i].status[STATUS_ASLEEP]); - move_to_zero(adven[i].status[STATUS_PARALYZED]); + move_to_zero(adven[i].status[STATUS_MAGIC_RESISTANCE]); + move_to_zero(adven[i].status[STATUS_INVISIBLE]); + move_to_zero(adven[i].status[STATUS_MARTYRS_SHIELD]); + move_to_zero(adven[i].status[STATUS_ASLEEP]); + move_to_zero(adven[i].status[STATUS_PARALYZED]); if ((party.age % 40 == 0) && (adven[i].status[0] > 0)) { update_stat = TRUE; move_to_zero(adven[i].status[0]); @@ -2297,7 +2297,7 @@ void increase_age() update_stat = TRUE; handle_acid(); } - + // Healing and restoration of spell pts. if (is_out()) { if (party.age % 100 == 0) { @@ -2323,7 +2323,7 @@ void increase_age() adven.restoreSP(2); } } - else { + else { if (party.age % 40 == 0) { for (i = 0; i < 6; i++) if ((adven[i].isAlive()) && (adven[i].cur_sp < adven[i].max_sp)) @@ -2333,34 +2333,34 @@ void increase_age() } // Recuperation and chronic disease disads - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) if (adven[i].isAlive()) { - if ((adven[i].traits[9] > 0) && (get_ran(1,0,10) == 1) && (adven[i].cur_health < adven[i].max_health)) { + if ((adven[i].traits[TRAIT_RECUPERATION] > 0) && (get_ran(1,0,10) == 1) && (adven[i].cur_health < adven[i].max_health)) { adven[i].heal(2); update_stat = TRUE; } - if ((adven[i].traits[13] > 0) && (get_ran(1,0,110) == 1)) { + if ((adven[i].traits[TRAIT_CHRONIC_DISEASE] > 0) && (get_ran(1,0,110) == 1)) { adven[i].disease(4); update_stat = TRUE; } - + } - + // Blessing, slowed,etc. - if (party.age % 4 == 0) + if (party.age % 4 == 0) for (i = 0; i < 6; i++) { if ((adven[i].status[1] != 0) || (adven[i].status[3] != 0)) update_stat = TRUE; move_to_zero(adven[i].status[1]); - move_to_zero(adven[i].status[3]); - if (((item = adven[i].hasAbilEquip(50)) < 24) + move_to_zero(adven[i].status[3]); + if (((item = adven[i].hasAbilEquip(50)) < 24) && (adven[i].cur_health < adven[i].max_health) && ((overall_mode > 0) || (get_ran(1,0,10) == 5))){ j = get_ran(1,0,adven[i].items[item].ability_strength / 3); if (adven[i].items[item].ability_strength / 3 == 0) j = get_ran(1,0,1); if (is_out()) j = j * 4; - adven[i].heal(j); + adven[i].heal(j); update_stat = TRUE; } } @@ -2368,9 +2368,9 @@ void increase_age() timed_special_happened = special_increase_age(0); push_things(); - + if (is_town()) process_fields(); - + // Cancel switching PC order current_switch = 6; @@ -2410,7 +2410,7 @@ void switch_pc(short which) void handle_death() { short choice; - + in_startup_mode = TRUE; while (in_startup_mode == TRUE) @@ -2418,10 +2418,10 @@ void handle_death() // Use death (or leave Exile) dialog in_startup_mode = FALSE; - + choice = FCD(1069,0); //// FCD hates it when it gets called in startup mode // and startup graphiocs aren't loaded. - + in_startup_mode = TRUE; if (choice == 1) { @@ -2434,15 +2434,15 @@ void handle_death() } else in_startup_mode = TRUE; } - - if (choice == 2) - start_new_game(); - + + if (choice == 2) + start_new_game(); + if (choice == 3) { in_startup_mode = FALSE; All_Done = TRUE; } - + } } @@ -2452,7 +2452,7 @@ void start_new_game() short choice; choice = FCD(1065,0); - + if (choice == 2) return; init_party(0); @@ -2462,7 +2462,7 @@ void start_new_game() for (i = 0 ; i < NUM_OF_PCS; i++) if (adven[i].isAlive()) i = 100; - + if (i == NUM_OF_PCS) return; @@ -2479,14 +2479,14 @@ void start_new_game() if (adven[i].isAlive()) { // Do stat adjs for selected race. if (adven[i].race == RACE_NEPHIL) { - if (adven[i].skills[1] < 18) - adven[i].skills[1] += 2; + if (adven[i].skills[SKILL_DEXTERITY] < 18) + adven[i].skills[SKILL_DEXTERITY] += 2; } if (adven[i].race == RACE_SLITH) { - if (adven[i].skills[0] < 18) - adven[i].skills[0] += 2; - if (adven[i].skills[2] < 19) - adven[i].skills[2] += 1; + if (adven[i].skills[SKILL_STRENGTH] < 18) + adven[i].skills[SKILL_STRENGTH] += 2; + if (adven[i].skills[SKILL_INTELLIGENCE] < 19) + adven[i].skills[SKILL_INTELLIGENCE] += 1; } adven[i].max_sp += adven[i].skills[SKILL_MAGE_SPELLS] * 3 + adven[i].skills[SKILL_PRIEST_SPELLS] * 3; adven[i].cur_sp = adven[i].max_sp; @@ -2513,7 +2513,7 @@ location get_cur_direction(POINT the_point) store_dir.y--; if ((y > 203) & (y >= (x / 2) + 123) & (y >= (-1 * (x / 2) + 268))) store_dir.y++; - + return store_dir; } @@ -2526,7 +2526,7 @@ Boolean outd_move_party(location destination,Boolean forced) location store_corner,store_iwc; unsigned char ter; short buffer_ptr; - + keep_going = check_special_terrain(destination,0,0,&spec_num,&check_f); if (check_f == TRUE) forced = TRUE; if (in_scen_debug && ghost_mode) forced = TRUE; @@ -2543,16 +2543,16 @@ Boolean outd_move_party(location destination,Boolean forced) store_corner = party.outdoor_corner; store_iwc = party.i_w_c; - + // Check if party moves into new sector if ((destination.x < 6) && (party.outdoor_corner.x > 0)) shift_universe_left(); if ((destination.x > 90) && (party.outdoor_corner.x < scenario.out_width - 1)) shift_universe_right(); if ((destination.y < 6) && (party.outdoor_corner.y > 0)) shift_universe_up(); else if ((destination.y > 90) && (party.outdoor_corner.y < scenario.out_height - 1)) - shift_universe_down(); + shift_universe_down(); // Now stop from going off the world's edge - real_dest.x = party.p_loc.x + real_dest.x; - real_dest.y = party.p_loc.y + real_dest.y; + real_dest.x = party.p_loc.x + real_dest.x; + real_dest.y = party.p_loc.y + real_dest.y; if ((real_dest.x < 4) && (party.outdoor_corner.x <= 0)) { ASB("You've reached the world's edge."); return FALSE; @@ -2573,7 +2573,7 @@ Boolean outd_move_party(location destination,Boolean forced) } ter = out[real_dest.x][real_dest.y]; - + if (party.in_boat >= 0) { if ((outd_is_blocked(real_dest) == FALSE) //&& (outd_is_special(real_dest) == FALSE) // not in towns @@ -2586,14 +2586,14 @@ Boolean outd_move_party(location destination,Boolean forced) else if (((real_dest.x != party.p_loc.x) && (real_dest.y != party.p_loc.y)) || ((forced == FALSE) && (out_boat_there(destination) < 30))) return FALSE; - else if ((outd_is_blocked(real_dest) == FALSE) + else if ((outd_is_blocked(real_dest) == FALSE) && (scenario.ter_types[ter].boat_over == TRUE) && (scenario.ter_types[ter].special != 21) && ter != 75 && ter!=76) { if ((fancy_choice_dialog(1086,0)) == 1) forced = TRUE; else { add_string_to_buf("You leave the boat. "); - party.in_boat = -1; + party.in_boat = -1; } } else if (scenario.ter_types[ter].boat_over == TRUE) @@ -2609,8 +2609,8 @@ Boolean outd_move_party(location destination,Boolean forced) give_help(61,0,0); add_string_to_buf("Move: You board the boat. "); party.in_boat = boat_num; - party.direction = set_direction(party.p_loc, destination); - + party.direction = set_direction(party.p_loc, destination); + party.p_loc = real_dest; party.i_w_c.x = (party.p_loc.x > 48) ? 1 : 0; party.i_w_c.y = (party.p_loc.y > 48) ? 1 : 0; @@ -2619,9 +2619,9 @@ Boolean outd_move_party(location destination,Boolean forced) if ((store_corner.x != party.outdoor_corner.x) || (store_corner.y != party.outdoor_corner.y) || (store_iwc.x != party.i_w_c.x) || (store_iwc.y != party.i_w_c.y)) clear_map(); - + return TRUE; - } + } else if (((horse_num = out_horse_there(real_dest)) < 30) && (party.in_boat < 0) && (party.in_horse < 0)) { if (party.isFlying()) { @@ -2633,8 +2633,8 @@ Boolean outd_move_party(location destination,Boolean forced) add_string_to_buf("Move: You mount the horses. "); play_sound(84); party.in_horse = horse_num; - party.direction = set_direction(party.p_loc, destination); - + party.direction = set_direction(party.p_loc, destination); + party.p_loc = real_dest; party.i_w_c.x = (party.p_loc.x > 48) ? 1 : 0; party.i_w_c.y = (party.p_loc.y > 48) ? 1 : 0; @@ -2643,9 +2643,9 @@ Boolean outd_move_party(location destination,Boolean forced) if ((store_corner.x != party.outdoor_corner.x) || (store_corner.y != party.outdoor_corner.y) || (store_iwc.x != party.i_w_c.x) || (store_iwc.y != party.i_w_c.y)) clear_map(); - + return TRUE; - } + } else if ((outd_is_blocked(real_dest) == FALSE) || (forced == TRUE) // Check if can fly over || ((party.isFlying()) && (scenario.ter_types[ter].fly_over == TRUE))) @@ -2659,23 +2659,23 @@ Boolean outd_move_party(location destination,Boolean forced) ASB("You can't take horses there!"); return FALSE; } - } - - party.direction = set_direction(party.p_loc, destination); + } + + party.direction = set_direction(party.p_loc, destination); if ((party.isFlying()) && (scenario.ter_types[ter].special == 21)) { add_string_to_buf("Moved: You have to land first. "); return FALSE; } - + party.p_loc = real_dest; party.i_w_c.x = (party.p_loc.x > 47) ? 1 : 0; party.i_w_c.y = (party.p_loc.y > 47) ? 1 : 0; party.loc_in_sec = party.p_loc.toLocal(); move_sound(out[real_dest.x][real_dest.y],num_out_moves); num_out_moves++; - + if (party.in_boat >= 0) { // Waterfall!!! while (scenario.ter_types[out[party.p_loc.x][party.p_loc.y + 1]].special == 15) { @@ -2713,7 +2713,7 @@ Boolean outd_move_party(location destination,Boolean forced) if ((store_corner.x != party.outdoor_corner.x) || (store_corner.y != party.outdoor_corner.y) || (store_iwc.x != party.i_w_c.x) || (store_iwc.y != party.i_w_c.y)) clear_map(); - + return TRUE; } else { @@ -2725,8 +2725,8 @@ Boolean outd_move_party(location destination,Boolean forced) print_buf(); } else{ - sprintf (create_line, "Blocked: %s",dir_string[set_direction(party.p_loc, destination)]); - add_string_to_buf(create_line); + sprintf (create_line, "Blocked: %s",dir_string[set_direction(party.p_loc, destination)]); + add_string_to_buf(create_line); previous_blocked_direction = set_direction(party.p_loc, destination); times_blocked = 1; } @@ -2745,14 +2745,14 @@ Boolean town_move_party(location destination,short forced) unsigned char ter; Boolean check_f = FALSE; short buffer_ptr; - + if (in_scen_debug && ghost_mode) forced = TRUE; - + if (monst_there(destination) > T_M) keep_going = check_special_terrain(destination,1,0,&spec_num,&check_f); if (check_f == TRUE) forced = TRUE; if (spec_num == 50) forced = TRUE; ter = t_d.terrain[destination.x][destination.y]; - + if (keep_going == TRUE) { if (party.in_boat >= 0) { if ((is_blocked(destination) == FALSE) && (is_special(destination) == FALSE) @@ -2763,15 +2763,15 @@ Boolean town_move_party(location destination,short forced) party.in_boat = -1; } else if ((destination.x != c_town.p_loc.x) && (destination.y != c_town.p_loc.y)) - return FALSE; + return FALSE; // Crossing bridge: land or go through else if ((is_blocked(destination) == FALSE) && (scenario.ter_types[ter].boat_over == TRUE) && ter != 75 && ter!=76) { if ((fancy_choice_dialog(1086,0)) == 1) forced = TRUE; else if (is_blocked(destination) == FALSE) { add_string_to_buf("You leave the boat. "); - party.in_boat = -1; - } + party.in_boat = -1; + } } // boat in destination else if (town_boat_there(destination) < 30) { @@ -2781,41 +2781,41 @@ Boolean town_move_party(location destination,short forced) // water or lava else if (scenario.ter_types[ter].boat_over == TRUE) forced = TRUE; - - + + } if (((boat_there = town_boat_there(destination)) < 30) && (party.in_boat < 0)) { if (party.boats[boat_there].property == TRUE) { add_string_to_buf(" Not your boat. "); - return FALSE; + return FALSE; } give_help(61,0,0); add_string_to_buf("Move: You board the boat. "); party.in_boat = boat_there; - party.direction = set_direction(c_town.p_loc, destination); - + party.direction = set_direction(c_town.p_loc, destination); + c_town.p_loc = destination; center = c_town.p_loc; return TRUE; - } + } else if (((horse_there = town_horse_there(destination)) < 30) && (party.in_horse < 0)) { if (party.horses[horse_there].property == TRUE) { add_string_to_buf(" Not your horses. "); - return FALSE; + return FALSE; } give_help(60,0,0); add_string_to_buf("Move: You mount the horses. "); play_sound(84); party.in_horse = horse_there; - party.direction = set_direction(c_town.p_loc, destination); - + party.direction = set_direction(c_town.p_loc, destination); + c_town.p_loc = destination; center = c_town.p_loc; return TRUE; - } + } else if ((is_blocked(destination) == FALSE) || (forced == 1)) { if (party.in_horse >= 0) { if ((scenario.ter_types[ter].special >= 2) && (scenario.ter_types[ter].special <= 4)) { @@ -2835,11 +2835,11 @@ Boolean town_move_party(location destination,short forced) c_town.p_loc = destination; move_sound(t_d.terrain[destination.x][destination.y],(short) party.age); - + if (party.in_boat >= 0) { // Watchout, party.p_loc is party outdoor location !!! Town location is c_town.p_loc ... if(party.stuff_done[309][2] > 0){ - + center = c_town.p_loc; //put on top of waterfall // Waterfall!!! @@ -2861,7 +2861,7 @@ Boolean town_move_party(location destination,short forced) } party.boats[party.in_boat].boat_loc = c_town.p_loc; party.boats[party.in_boat].which_town = c_town.town_num; - + } if (party.in_horse >= 0) { party.horses[party.in_horse].horse_loc = c_town.p_loc; @@ -2872,7 +2872,7 @@ Boolean town_move_party(location destination,short forced) } else { if (destination.isDoor()){ - sprintf (create_line, "Door locked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); + sprintf (create_line, "Door locked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); add_string_to_buf(create_line); } else{ @@ -2885,12 +2885,12 @@ Boolean town_move_party(location destination,short forced) } else{ sprintf (create_line, "Blocked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); - add_string_to_buf(create_line); + add_string_to_buf(create_line); previous_blocked_direction = set_direction(c_town.p_loc, destination); times_blocked = 1; } } - + return FALSE; } } @@ -2903,7 +2903,7 @@ bool pc_array::isPoisoned() for (int i = 0; i < NUM_OF_PCS; i++) if (pc[i].isAlive() && (pc[i].status[STATUS_POISON] > 0)) return true; - + return false; } diff --git a/Win32/Blades of Exile/boe.combat.cpp b/Win32/Blades of Exile/boe.combat.cpp index 57a47fe5..b76a8685 100644 --- a/Win32/Blades of Exile/boe.combat.cpp +++ b/Win32/Blades of Exile/boe.combat.cpp @@ -261,7 +261,7 @@ Boolean pc_combat_move(location destination) void char_parry() { pc_parry[current_pc] = (pc_moves[current_pc] / 4) * - (2 + adven[current_pc].statAdj(1) + adven[current_pc].skills[8]); + (2 + adven[current_pc].statAdj(SKILL_DEXTERITY) + adven[current_pc].skills[SKILL_DEFENSE]); pc_moves[current_pc] = 0; } @@ -633,7 +633,7 @@ void do_combat_cast(location target) } else { level = 1 + adven[current_pc].level / 2; - bonus = adven[current_pc].statAdj(2); + bonus = adven[current_pc].statAdj(SKILL_INTELLIGENCE); } force_wall_position = 10; s_num = spell_being_cast % 100; @@ -745,7 +745,7 @@ void do_combat_cast(location target) start_missile_anim(); switch (spell_being_cast) { - case 157: + case 157: //Divine Thud add_missile(target,9,1,0,0); store_sound = 11; r1 = min(18,(level * 7) / 10 + 2 * bonus); @@ -753,51 +753,51 @@ void do_combat_cast(location target) ashes_loc = target; break; - case 1: case 31: + case 1: case 31: //Spark - Ice Bolt r1 = (spell_being_cast == 1) ? get_ran(2,1,4) : get_ran(min(20,level + bonus),1,4); add_missile(target,6,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); hit_space(target,r1,(spell_being_cast == 1) ? 3 : 5,1,0); break; - case 27: // flame arrows + case 27: //Flame Arrows add_missile(target,4,1,0,0); r1 = get_ran(2,1,4); boom_type[i] = 1; boom_dam[i] = r1; //hit_space(target,r1,1,1,0); break; - case 129: // smite + case 129: //Smite add_missile(target,6,1,0,0); r1 = get_ran(2,1,5); boom_type[i] = 5; boom_dam[i] = r1; //hit_space(target,r1,5,1,0); break; - case 114: + case 114: //Wound r1 = get_ran(min(7,2 + bonus + level / 2),1,4); add_missile(target,14,1,0,0); do_missile_anim(100,pc_pos[current_pc],24); hit_space(target,r1,4,1,0); break; - case 11: + case 11: //Flame r1 = get_ran(min(10,1 + level / 3 + bonus),1,6); add_missile(target,2,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); hit_space(target,r1,1,1,0); break; - case 22: case 141: + case 22: case 141: //Fireball - Flamestrike r1 = min(9,1 + (level * 2) / 3 + bonus) + 1; add_missile(target,2,1,0,0); store_sound = 11; //do_missile_anim(100,pc_pos[current_pc],11); - if (spell_being_cast == 141) + if (spell_being_cast == 141) //Flamestrike r1 = (r1 * 14) / 10; else if (r1 > 10) r1 = (r1 * 8) / 10; if (r1 <= 0) r1 = 1; place_spell_pattern(square,target,50 + r1,TRUE,current_pc); ashes_loc = target; break; - case 40: + case 40: //Fire Storm add_missile(target,2,1,0,0); store_sound = 11; //do_missile_anim(100,pc_pos[current_pc],11); @@ -807,13 +807,13 @@ void do_combat_cast(location target) place_spell_pattern(radius2,target,50 + r1,TRUE,current_pc); ashes_loc = target; break; - case 48: // kill + case 48: // Kill add_missile(target,9,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); r1 = get_ran(3,0,10) + adven[current_pc].level * 2; hit_space(target,40 + r1,3,1,0); break; - case 61: // death arrows + case 61: //Death Arrows add_missile(target,9,1,0,0); store_sound = 11; r1 = get_ran(3,0,10) + adven[current_pc].level + 3 * bonus; @@ -953,31 +953,31 @@ void do_combat_cast(location target) store_sound = 55; break; - case 13: + case 13: //Dumbfound store_m_type = 14; cur_monst->dumbfound(1 + bonus / 3); store_sound = 53; break; - case 4: + case 4: //Scare store_m_type = 11; cur_monst->scare(get_ran(2 + bonus,1,6)); store_sound = 54; break; - case 24: + case 24: //Fear store_m_type = 11; cur_monst->scare(get_ran(min(20,adven[current_pc].level / 2 + bonus),1, ((spell_being_cast == 24) ? 8 : 6))); store_sound = 54; break; - case 12: + case 12: //Slow store_m_type = 11; r1 = get_ran(1,0,1); cur_monst->slow(2 + r1 + bonus); break; - case 10: case 36: + case 10: case 36: //Minor Poison - Venom Arrows store_m_type = (spell_being_cast == 36) ? 4 : 11; cur_monst->poison(2 + bonus / 2); store_sound = 55; @@ -986,33 +986,33 @@ void do_combat_cast(location target) store_m_type = 9; cur_monst->charm(-10,12,1000); break; - case 30: + case 30: //Poison store_m_type = 11; cur_monst->poison(4 + bonus / 2); store_sound = 55; break; - case 46: + case 46: //Major Poison store_m_type = 11; cur_monst->poison(8 + bonus / 2); store_sound = 55; break; - case 109: // stumble + case 109: // Stumble store_m_type = 8; cur_monst->curse(4 + bonus); break; - case 112: + case 112: //Curse store_m_type = 8; cur_monst->curse(2 + bonus); break; - case 122: + case 122: //Holy Scourge store_m_type = 8; cur_monst->curse(2 + adven[current_pc].level / 2); break; - case 103: case 132: + case 103: case 132: //Turn Undead - Dispel Undead if (cur_monst->m_d.m_type != 8) { add_string_to_buf(" Not undead. "); store_m_type = -1; @@ -1029,7 +1029,7 @@ void do_combat_cast(location target) } break; - case 155: + case 155: //Ravage Spirit if (cur_monst->m_d.m_type != 7) { add_string_to_buf(" Not a demon. "); store_m_type = -1; @@ -1177,11 +1177,11 @@ void fire_missile(location target) skill = (overall_mode == MODE_FIRING) ? adven[current_pc].skills[SKILL_ARCHERY] : adven[current_pc].skills[SKILL_THROWN_MISSILES]; range = (overall_mode == MODE_FIRING) ? 12 : 8; dam = adven[current_pc].items[ammo_inv_slot].item_level; - dam_bonus = adven[current_pc].items[ammo_inv_slot].bonus + minmax(-8,8,(int)adven[current_pc].status[1]); + dam_bonus = adven[current_pc].items[ammo_inv_slot].bonus + minmax(-8,8,(int)adven[current_pc].status[STATUS_BLESS_CURSE]); hit_bonus = (overall_mode == MODE_FIRING) ? adven[current_pc].items[missile_inv_slot].bonus : 0; - hit_bonus += adven[current_pc].statAdj(1) - can_see(pc_pos[current_pc],target,0) - + minmax(-8,8,(int) adven[current_pc].status[1]); - if ((skill_item = adven[current_pc].hasAbilEquip(41)) < 24) { + hit_bonus += adven[current_pc].statAdj(SKILL_DEXTERITY) - can_see(pc_pos[current_pc],target,0) + + minmax(-8,8,(int) adven[current_pc].status[STATUS_BLESS_CURSE]); + if ((skill_item = adven[current_pc].hasAbilEquip(ITEM_ACCURACY)) < 24) { hit_bonus += adven[current_pc].items[skill_item].ability_strength / 2; dam_bonus += adven[current_pc].items[skill_item].ability_strength / 2; } @@ -1190,7 +1190,7 @@ void fire_missile(location target) if (adven[current_pc].race == RACE_NEPHIL) hit_bonus += 2; - if (adven[current_pc].items[ammo_inv_slot].ability == 172) + if (adven[current_pc].items[ammo_inv_slot].ability == ITEM_MISSILE_EXPLODING) exploding = TRUE; if (dist(pc_pos[current_pc],target) > range) @@ -1234,8 +1234,8 @@ void fire_missile(location target) r1 = get_ran(1,0,100) - 5 * hit_bonus - 10; r1 += 5 * (adven[current_pc].status[6] / 3); r2 = get_ran(1,1,dam) + dam_bonus; - sprintf ((char *) create_line, "%s fires.",(char *) adven[current_pc].name); // debug - add_string_to_buf((char *) create_line); + sprintf (create_line, "%s fires.",adven[current_pc].name); // debug + add_string_to_buf(create_line); switch (overall_mode) { case MODE_THROWING: @@ -1434,13 +1434,13 @@ void combat_run_monst() move_to_zero(adven[i].status[12]); // Do special items - if (((item_level = adven[i].getProtLevel(47)) > 0) + if (((item_level = adven[i].getProtLevel(ITEM_OCCASIONAL_HASTE)) > 0) && (get_ran(1,0,10) == 5)) { update_stat = TRUE; adven[i].status[3] += item_level / 2; add_string_to_buf("An item hastes you!"); } - if ((item_level = adven[i].getProtLevel(46)) > 0) { + if ((item_level = adven[i].getProtLevel(ITEM_OCCASIONAL_BLESS)) > 0) { if (get_ran(1,0,10) == 5) { update_stat = TRUE; adven[i].status[1] += item_level / 2; @@ -3543,7 +3543,7 @@ void do_poison() if (get_ran(1,0,8) < 6) move_to_zero(adven[i].status[2]); if (get_ran(1,0,8) < 6) - if (adven[i].traits[6] == TRUE) + if (adven[i].traits[TRAIT_GOOD_CONST] == TRUE) move_to_zero(adven[i].status[2]); } put_pc_screen(); @@ -3558,14 +3558,14 @@ void handle_disease() for (i = 0; i < 6; i++) if (adven[i].isAlive()) - if (adven[i].status[7] > 0) + if (adven[i].status[STATUS_DISEASE] > 0) disease = TRUE; if (disease == TRUE) { add_string_to_buf("Disease: "); for (i = 0; i < NUM_OF_PCS; i++) if (adven[i].isAlive()) - if (adven[i].status[7] > 0) { + if (adven[i].status[STATUS_DISEASE] > 0) { r1 = get_ran(1,1,10); switch (r1) { case 1: case 2: @@ -3584,16 +3584,15 @@ void handle_disease() adven[i].dumbfound(3); break; case 9: case 10: - sprintf ((char *) create_line, " %s unaffected. ", - (char *) adven[i].name); - add_string_to_buf((char *) create_line); + sprintf ( create_line, " %s unaffected. ", adven[i].name); + add_string_to_buf(create_line); break; } r1 = get_ran(1,0,7); - if (adven[i].traits[6] == TRUE) + if (adven[i].traits[TRAIT_GOOD_CONST] == true) r1 -= 2; - if ((get_ran(1,0,7) <= 0) || (adven[i].hasAbilEquip(62) < 24)) - move_to_zero(adven[i].status[7]); + if ((r1 <= 0) || (adven[i].hasAbilEquip(ITEM_PROTECT_FROM_DISEASE) < 24)) + move_to_zero(adven[i].status[STATUS_DISEASE]); } put_pc_screen(); } diff --git a/Win32/Blades of Exile/boe.graphics.cpp b/Win32/Blades of Exile/boe.graphics.cpp index 98362eb7..7bf471a0 100644 --- a/Win32/Blades of Exile/boe.graphics.cpp +++ b/Win32/Blades of Exile/boe.graphics.cpp @@ -4,8 +4,8 @@ #include #include "global.h" #include "boe.graphics.h" -#include "boe.newgraph.h" -#include "boe.monster.h" +#include "boe.newgraph.h" +#include "boe.monster.h" #include "tools/dlogtool.h" #include "boe.locutils.h" #include "boe.fields.h" @@ -50,7 +50,7 @@ void plop_fancy_startup() if (done_fancy_startup_once == FALSE) { // initialize buffers and rects - + for (i = 0; i < 9; i++) for (j = 0; j < 9; j++) terrain_there[i][j] = -1; @@ -62,13 +62,13 @@ void plop_fancy_startup() main_dc = GetDC(mainPtr); SelectObject(main_dc,font); SetBkMode(main_dc,TRANSPARENT); - + main_dc2 = CreateCompatibleDC(main_dc); SetMapMode(main_dc2,GetMapMode((HDC)mainPtr)); - + main_dc3 = CreateCompatibleDC(main_dc); SetMapMode(main_dc3,GetMapMode((HDC) mainPtr)); - + SetStretchBltMode(main_dc,STRETCH_DELETESCANS); SetStretchBltMode(main_dc2,STRETCH_DELETESCANS); SetStretchBltMode(main_dc3,STRETCH_DELETESCANS); @@ -77,7 +77,7 @@ void plop_fancy_startup() old_brush = (HBRUSH) SelectObject(main_dc,GetStockObject(BLACK_BRUSH)); Rectangle(main_dc, whole_window.left,whole_window.top, whole_window.right,whole_window.bottom); - + //pict_to_draw = ReadBMP("blscened/SPIDLOGO.BMP"); pict_to_draw = load_pict(3001, (HDC) 0); @@ -92,10 +92,10 @@ void plop_fancy_startup() cur_time = GetCurrentTime(); while (GetCurrentTime() - cur_time < 1500); - + if(play_startup == TRUE){ - + pict_to_draw = load_pict(3000, (HDC) 0); RECT big_pic_from = {2,48,641,434}; @@ -157,7 +157,7 @@ void draw_startup(short but_type) rect_draw_some_item(startup_gworld,startup_from[1],startup_gworld,startup_button[i],0,1); draw_start_button(i,but_type); } - + draw_startup_anim(); draw_startup_stats(); } @@ -182,7 +182,7 @@ void draw_startup_stats() OffsetRect(&to_rect,175,40); char_win_draw_string(main_dc,to_rect,"No Party in Memory",0,18); } - + if (party_in_memory == TRUE) { frame_rect = startup_top; @@ -190,22 +190,22 @@ void draw_startup_stats() frame_rect.top += 30; OffsetRect(&frame_rect,ulx ,uly + 10); FrameRect(main_dc,&frame_rect,hbrush); - + SelectObject(main_dc,fantasy_font); OffsetRect(&to_rect,213,25); char_win_draw_string(main_dc,to_rect, "Your party:",0,18); - + SelectObject(main_dc,small_bold_font); - + /* at this point everything is ok */ - + for (i = 0; i < 6; i++) { pc_rect = startup_top; - + pc_rect.right = pc_rect.left + 300; // width = 300 pc_rect.bottom = pc_rect.top + 79; // height = 79 - + // 1) move 85 to right and 95 down // 2) move 85 to right and 140 down // 3) move 85 to right and 185 down @@ -213,7 +213,7 @@ void draw_startup_stats() // 5) move 292 to right and 140 down // 6) move 292 to right and 185 down OffsetRect(&pc_rect, 85 + 232 * (i / 3), 95 + 45 * (i % 3)); - + if (adven[i].main_status > MAIN_STATUS_ABSENT) { from_rect = get_party_template_rect(i,0); @@ -223,14 +223,14 @@ void draw_startup_stats() // 4) 56 right, 36 down // 5) 56 r, 72 down // 6) 56 r, 108 down - + to_rect = party_from; // width = 28, height = 36 OffsetRect(&to_rect,pc_rect.left,pc_rect.top + 2); - rect_draw_some_item(pcs_gworld,from_rect,NULL,to_rect,0,1); + rect_draw_some_item(pcs_gworld,from_rect,NULL,to_rect,0,1); InflateRect(&to_rect,1,1); OffsetRect(&to_rect,ulx,uly); FrameRect(main_dc,&to_rect,hbrush); - + SelectObject(main_dc, bold_font); OffsetRect(&pc_rect,35,0); char_win_draw_string(main_dc, pc_rect, adven[i].name, 0, 18); @@ -239,7 +239,7 @@ void draw_startup_stats() OffsetRect(&pc_rect,12,16); SelectObject(main_dc,small_bold_font); - + switch (adven[i].main_status) { case MAIN_STATUS_ALIVE: @@ -249,10 +249,10 @@ void draw_startup_stats() case 1: sprintf((char *) str,"Level %d Nephilim",adven[i].level); break; case 2: sprintf((char *) str,"Level %d Slithzerikai",adven[i].level); break; } - char_win_draw_string(main_dc,pc_rect,(char *) str,0,18); + char_win_draw_string(main_dc,pc_rect, str,0,18); OffsetRect(&pc_rect,0,13); - sprintf((char *) str,"Health %d, Spell pts. %d", adven[i].max_health,adven[i].max_sp); - char_win_draw_string(main_dc,pc_rect,(char *) str,0,18); + sprintf( str,"Health %d, Spell pts. %d", adven[i].max_health,adven[i].max_sp); + char_win_draw_string(main_dc,pc_rect, str,0,18); break; case MAIN_STATUS_DEAD: char_win_draw_string(main_dc,pc_rect,"Dead",0,18); break; case MAIN_STATUS_DUST: char_win_draw_string(main_dc,pc_rect,"Dust",0,18); break; @@ -260,7 +260,7 @@ void draw_startup_stats() } } } - + SelectObject(main_dc,small_bold_font); pc_rect = startup_from[0]; OffsetRect(&pc_rect,5,5); @@ -289,7 +289,7 @@ void draw_start_button(short which_position,short which_button) { RECT from_rect,to_rect; char *button_labels[] = - { + { "Load Game", "Make New Party", " < Unused > ", @@ -313,12 +313,12 @@ void draw_start_button(short which_position,short which_button) if (which_button == 5) which_button = 4; SetTextColor(main_dc,colors[2]); - + SelectObject(main_dc,fantasy_font); if (which_position == 3) OffsetRect(&to_rect,-7,0); SetTextColor(main_dc,colors[0]); - + OffsetRect(&to_rect,0,1); char_win_draw_string(main_dc,to_rect, (char *) button_labels[which_position],1,18); @@ -349,7 +349,7 @@ void main_button_click(short, RECT button_rect) if (play_sounds == TRUE) play_sound(37); else Delay(5,&dummy); - draw_buttons(0); + draw_buttons(0); undo_clip(); } @@ -358,7 +358,7 @@ void arrow_button_click(RECT button_rect) long dummy; ClipRect(&button_rect); - + refresh_stat_areas(1); if (play_sounds == TRUE) play_sound(37); @@ -371,9 +371,9 @@ void reload_startup()//// { if (startup_loaded == TRUE) return; - + DestroyWindow(modeless_dialogs[5]); - modeless_exists[5] = FALSE; + modeless_exists[5] = FALSE; if (text_sbar != NULL) { ShowScrollBar(text_sbar,SB_CTL,FALSE); ShowScrollBar(item_sbar,SB_CTL,FALSE); @@ -406,7 +406,7 @@ void Set_up_win () { RECT map_rect = {0,0,384,384}; short i,j; - RECT bg_from[9] = {{0,168,8,176},{23,206,31,214},{32,168,40,176},{102,174,110,182}, + RECT bg_from[9] = {{0,168,8,176},{23,206,31,214},{32,168,40,176},{102,174,110,182}, {173,191,181,199},{203,190,211,198},{273,183,281,191},{373,0,381,8}, {380,17,388,25}}; RECT map_from_orig = {372,0,380,8},map_from,brush_to = {0,0,8,8}; @@ -433,11 +433,11 @@ void Set_up_win () pcs_gworld = load_pict(902,main_dc); ter_anim_gworld = load_pict(820, main_dc); - + frills_gworld = load_pict(4000, main_dc); - + talking_portraits_gworld = load_pict(860,main_dc); - + for(i=0;i<10;i++) monsters_gworld[i] = load_pict(1100+i, main_dc); @@ -461,13 +461,13 @@ void Set_up_win () map_gworld = CreateCompatibleBitmap(main_dc,map_rect.right,map_rect.bottom); // Create and initialize map gworld - + for (i = 0; i < 9; i++) { bg_bitmap[i] = CreateCompatibleBitmap(main_dc,8,8); rect_draw_some_item(mixed_gworld,bg_from[i],bg_bitmap[i],brush_to,0,0); bg[i] = CreatePatternBrush(bg_bitmap[i]); } - + for (i = 0; i < 25; i++) { map_from = map_from_orig; OffsetRect(&map_from,8 * (i / 10),8 * (i % 10)); @@ -494,7 +494,7 @@ void lose_graphics() DeleteObject(orig_text_bar_gworld); DeleteObject(buttons_gworld); } - + DeleteObject(bw_bitmap); DeleteObject(dialog_pattern_gworld); DeleteObject(pattern_gworld); @@ -522,7 +522,7 @@ void lose_graphics() DeleteObject(monsters_gworld[i]); for(i=0;i<6;i++) DeleteObject(terrains_gworld[i]); - + DeleteDC(main_dc3); DeleteDC(main_dc2); DeleteObject(font); @@ -560,7 +560,7 @@ void load_main_screen() { HBITMAP temp_gworld; RECT from_rect = {0,0,271,116},to_rect = {0,0,0,0}; - + // load in graphic with 3 right side status areas, and copy each of them into // its own private HBITMAP temp_gworld = load_pict(700,main_dc); @@ -568,7 +568,7 @@ void load_main_screen() pc_stats_gworld = CreateCompatibleBitmap(main_dc,271,116); to_rect.right = 271; to_rect.bottom = 116; rect_draw_some_item(temp_gworld,from_rect,pc_stats_gworld,to_rect,0,0); - + item_stats_gworld = CreateCompatibleBitmap(main_dc,271,144); to_rect.bottom = 144; from_rect.top = 116; from_rect.bottom = 260; @@ -595,7 +595,7 @@ void create_clip_region() DeleteObject(clip_region); GetWindowRect(GetDesktopWindow(),&store_rect); - + clip_region = CreateRectRgn(0,0,store_rect.right * 2,store_rect.bottom * 2); @@ -638,7 +638,7 @@ void redraw_screen(short) mainPtr,(HMENU) 1,store_hInstance,NULL); lpsi.fMask = SIF_RANGE; lpsi.nMax =58; - SetScrollInfo(text_sbar,SB_CTL,&lpsi,FALSE); + SetScrollInfo(text_sbar,SB_CTL,&lpsi,FALSE); // SetScrollRange(text_sbar,SB_CTL,0,58,FALSE); item_sbar = CreateWindow("scrollbar",NULL, WS_CHILD | WS_TABSTOP | SBS_VERT | WS_VISIBLE, item_sbar_rect.left,item_sbar_rect.top,item_sbar_rect.right,item_sbar_rect.bottom, @@ -782,7 +782,7 @@ void draw_text_bar(short mode) remember_tiny_text = 500; if (is_out()) { for (i = 0; i < 8; i++) - if (pt_in_rect(loc,outdoors[party.i_w_c.x][party.i_w_c.y].info_rect[i])) + if (pt_in_rect(loc,outdoors[party.i_w_c.x][party.i_w_c.y].info_rect[i])) if ((remember_tiny_text == i) && (mode == 0)) return; else { @@ -797,7 +797,7 @@ void draw_text_bar(short mode) } if (is_town()) { for (i = 0; i < 16; i++) - if (pt_in_rect(loc,t_d.room_rect[i])) + if (pt_in_rect(loc,t_d.room_rect[i])) if ((remember_tiny_text == 200 + i) && (mode == 0)) return; else { @@ -809,7 +809,7 @@ void draw_text_bar(short mode) put_text_bar((char *) data_store->town_strs[0]); //// remember_tiny_text = 250; } - + } if ((is_combat()) && (current_pc < 6) && (monsters_going == FALSE)) { sprintf((char *) combat_string,"%s (ap: %d)", @@ -890,7 +890,7 @@ Boolean is_nature(char x, char y) { short pic; unsigned char ter_type; - + ter_type = coord_to_ter((short) x,(short) y); pic = scenario.ter_types[ter_type].picture; if ((pic >= 0) && (pic <= 45)) @@ -939,7 +939,7 @@ void swap_platform_graphics(){ rect_draw_some_item(mixed_gworld,bg_from[i],bg_bitmap[i],brush_to,0,0); bg[i] = CreatePatternBrush(bg_bitmap[i]); }*/ - + for (i = 0; i < 25; i++) {//need to remake the map brushes DeleteObject(map_bitmap[i]); DeleteObject(map_brush[i]); @@ -979,17 +979,17 @@ void draw_terrain(short mode) if (current_working_monster < 6) { ok_space[0] = pc_pos[current_working_monster]; ok_space[0].x = ok_space[0].x - center.x + 4; - ok_space[0].y = ok_space[0].y - center.y + 4; + ok_space[0].y = ok_space[0].y - center.y + 4; } mode = 0; } - + for (i = 0; i < 13; i++) for (j = 0; j < 13; j++) { light_area[i][j] = 0; unexplored_area[i][j] = 0; } - + sector_p_in.x = party.outdoor_corner.x + party.i_w_c.x; sector_p_in.y = party.outdoor_corner.y + party.i_w_c.y; @@ -999,7 +999,7 @@ void draw_terrain(short mode) view_loc = c_town.p_loc; if (is_combat()) view_loc = pc_pos[(current_pc < 6) ? current_pc : first_active_pc()]; - + for (i = 0; i < 13; i++) for (j = 0; j < 13; j++) { where_draw = (is_out()) ? party.p_loc : center; @@ -1021,7 +1021,7 @@ void draw_terrain(short mode) where_draw.x += q - 4; where_draw.y += r - 4; off_terrain = FALSE; - + draw_trim = TRUE; if ((is_out() == FALSE) && ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1))) { @@ -1029,7 +1029,7 @@ void draw_terrain(short mode) // Warning - this section changes where_draw if (where_draw.x < 0) where_draw.x = -1; - if (where_draw.x > town_size[town_type] - 1) + if (where_draw.x > town_size[town_type] - 1) where_draw.x = town_size[town_type]; if (where_draw.y < 0) where_draw.y = -1; @@ -1037,7 +1037,7 @@ void draw_terrain(short mode) where_draw.y = town_size[town_type]; if (can_see(view_loc,where_draw,0) < 5) can_draw = 1; - else can_draw = 0; + else can_draw = 0; spec_terrain = 0; } else if (is_out()) { @@ -1047,7 +1047,7 @@ void draw_terrain(short mode) else { spec_terrain = out[where_draw.x][where_draw.y]; can_draw = out_e[where_draw.x][where_draw.y]; - } + } } else if (is_combat()) { @@ -1063,19 +1063,19 @@ void draw_terrain(short mode) if (can_draw > 0) { if (pt_in_light(c_town.p_loc,where_draw) == FALSE) - can_draw = 0; - } + can_draw = 0; + } if ((overall_mode == 36) && (can_draw == 0)) can_draw = (party_can_see(where_draw) < 6) ? 1 : 0; } spot_seen[q][r] = can_draw; - + if ((can_draw != 0) && (overall_mode != 50)) { // if can see, not a pit, and not resting if (is_combat()) { anim_ticks = 0; } - + short_spec_terrain = spec_terrain; // Finally, draw this terrain spot @@ -1084,16 +1084,16 @@ void draw_terrain(short mode) case 82: // cave wway if (loc_off_act_area(where_draw) == FALSE) { if ((is_nature(where_draw.x - 1,where_draw.y)) && - (is_nature(where_draw.x,where_draw.y - 1) )) + (is_nature(where_draw.x,where_draw.y - 1) )) short_spec_terrain = 10219; if ((is_nature(where_draw.x + 1,where_draw.y) ) && - (is_nature(where_draw.x,where_draw.y - 1) )) + (is_nature(where_draw.x,where_draw.y - 1) )) short_spec_terrain = 10220; if ((is_nature(where_draw.x + 1,where_draw.y) ) && - (is_nature(where_draw.x,where_draw.y + 1) )) + (is_nature(where_draw.x,where_draw.y + 1) )) short_spec_terrain = 10221; if ((is_nature(where_draw.x - 1,where_draw.y) ) && - (is_nature(where_draw.x,where_draw.y + 1) )) + (is_nature(where_draw.x,where_draw.y + 1) )) short_spec_terrain = 10218; } draw_one_terrain_spot(q,r,short_spec_terrain,0); @@ -1101,39 +1101,39 @@ void draw_terrain(short mode) case 83: // ground wway if (loc_off_act_area(where_draw) == FALSE) { if ((is_nature(where_draw.x - 1,where_draw.y)) && - (is_nature(where_draw.x,where_draw.y - 1)) ) + (is_nature(where_draw.x,where_draw.y - 1)) ) short_spec_terrain = 10223; if ((is_nature(where_draw.x + 1,where_draw.y) ) && (is_nature(where_draw.x,where_draw.y - 1) )) short_spec_terrain = 10224; if ((is_nature(where_draw.x + 1,where_draw.y) ) && - (is_nature(where_draw.x,where_draw.y + 1) )) + (is_nature(where_draw.x,where_draw.y + 1) )) short_spec_terrain = 10225; if ((is_nature(where_draw.x - 1,where_draw.y) ) && - (is_nature(where_draw.x,where_draw.y + 1) )) + (is_nature(where_draw.x,where_draw.y + 1) )) short_spec_terrain = 10222; } draw_one_terrain_spot(q,r,short_spec_terrain,0); break; case 79: case 80: case 81: //roads (cave, grass, mountain) - if ((short_spec_terrain == 81) + if ((short_spec_terrain == 81) && ((out[where_draw.x][where_draw.y - 1] == 80) || (out[where_draw.x][where_draw.y - 1] == 79))) short_spec_terrain = 42; - if ((short_spec_terrain == 81) + if ((short_spec_terrain == 81) && ((out[where_draw.x][where_draw.y + 1] == 80) || (out[where_draw.x][where_draw.y + 1] == 79))) short_spec_terrain = 38; - if ((short_spec_terrain == 81) + if ((short_spec_terrain == 81) && ((out[where_draw.x - 1][where_draw.y] == 80) || (out[where_draw.x - 1][where_draw.y] == 79))) short_spec_terrain = 44; - if ((short_spec_terrain == 81) + if ((short_spec_terrain == 81) && ((out[where_draw.x + 1][where_draw.y ] == 80) || (out[where_draw.x + 1][where_draw.y] == 79))) short_spec_terrain = 40; - draw_one_terrain_spot(q,r,short_spec_terrain,0); + draw_one_terrain_spot(q,r,short_spec_terrain,0); place_road(q,r,where_draw); break; case 90: //pits - draw_one_terrain_spot(q,r,-1,0); + draw_one_terrain_spot(q,r,-1,0); break; default: draw_one_terrain_spot(q,r,short_spec_terrain,0); @@ -1171,7 +1171,7 @@ void draw_terrain(short mode) if (force_wall == TRUE) draw_one_spec_item(2,0,1); if (fire_wall == TRUE) draw_one_spec_item(4,1,1); if (antimagic == TRUE) draw_one_spec_item(8,2,1); - if (scloud == TRUE) draw_one_spec_item(16,3,1); + if (scloud == TRUE) draw_one_spec_item(16,3,1); if (ice_wall == TRUE) draw_one_spec_item(32,4,1); if (blade_wall == TRUE) draw_one_spec_item(64,5,1); if (sleep_field == TRUE) draw_one_spec_item(128,6,1); @@ -1208,7 +1208,7 @@ void draw_terrain(short mode) } - + supressing_some_spaces = FALSE; } @@ -1218,12 +1218,12 @@ void place_trim(short q,short r,location where,unsigned char ter_type) unsigned char store,store2,store3,store1; location targ; - char ground_type[260]= + char ground_type[260]= {0,0,2,2,2,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,2,2, - 2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,// 50 2,2,2,2,2,2,2,2,2,2, 2,0,0,0,0, 0,0 ,0,0,0, @@ -1245,23 +1245,23 @@ void place_trim(short q,short r,location where,unsigned char ter_type) 1,1,0,0,2,2,2,2,2,2, 2,2,2,2,2,2,0,2,2,2, 2,2,2,2,2,1,1,1,1,1};// 250 - + // First quick check ... if a pit or barrier in outdoor combat, no trim if ((is_combat()) && (which_combat_type == 0) && (ter_type == 90)) return; if (PSD[306][5] > 0) return; - + targ.x = q; targ.y = r; - if ((supressing_some_spaces == TRUE) && + if ((supressing_some_spaces == TRUE) && (same_point(targ,ok_space[0]) == FALSE) && (same_point(targ,ok_space[1]) == FALSE) && (same_point(targ,ok_space[2]) == FALSE) && (same_point(targ,ok_space[3]) == FALSE)) return; - - + + if (where.x == 0) at_left = TRUE; if (where.y == 0) @@ -1278,7 +1278,7 @@ void place_trim(short q,short r,location where,unsigned char ter_type) if (where.y == town_size[town_type]) at_bot = TRUE; } - + // First, trim for fluids if (((is_town()) || (is_combat())) && (town_trim[where.x][where.y] != 0)) { @@ -1288,7 +1288,7 @@ void place_trim(short q,short r,location where,unsigned char ter_type) } if (town_trim[where.x][where.y] & 2){ current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; - draw_trim(q,r,2,5); + draw_trim(q,r,2,5); } if (town_trim[where.x][where.y] & 4){ current_ground = ground_type[t_d.terrain[where.x + 1][where.y]]; @@ -1300,7 +1300,7 @@ void place_trim(short q,short r,location where,unsigned char ter_type) } if (town_trim[where.x][where.y] & 16){ current_ground = ground_type[t_d.terrain[where.x][where.y + 1]]; - draw_trim(q,r,1,1); + draw_trim(q,r,1,1); } if (town_trim[where.x][where.y] & 32){ current_ground = ground_type[t_d.terrain[where.x - 1][where.y + 1]]; @@ -1313,11 +1313,11 @@ void place_trim(short q,short r,location where,unsigned char ter_type) if (town_trim[where.x][where.y] & 128){ current_ground = ground_type[t_d.terrain[where.x - 1][where.y - 1]]; draw_trim(q,r,2,4); - } + } } if ((is_out()) && (out_trim[where.x][where.y] != 0)) { targ = where.toLocal(); - if (out_trim[where.x][where.y] & 1){ + if (out_trim[where.x][where.y] & 1){ // current_ground = ground_type[out[where.x][where.y - 1]]; current_ground = ground_type[outdoors[party.i_w_c.x][party.i_w_c.y].terrain[targ.x][targ.y - 1]]; draw_trim(q,r,1,0); @@ -1325,7 +1325,7 @@ void place_trim(short q,short r,location where,unsigned char ter_type) if (out_trim[where.x][where.y] & 2){ // current_ground = ground_type[out[where.x - 1][where.y - 1]]; current_ground = ground_type[outdoors[party.i_w_c.x][party.i_w_c.y].terrain[targ.x + 1][targ.y - 1]]; - draw_trim(q,r,2,5); + draw_trim(q,r,2,5); } if (out_trim[where.x][where.y] & 4){ // current_ground = ground_type[out[where.x - 1][where.y - 1]]; @@ -1337,10 +1337,10 @@ void place_trim(short q,short r,location where,unsigned char ter_type) current_ground = ground_type[outdoors[party.i_w_c.x][party.i_w_c.y].terrain[targ.x + 1][targ.y + 1]]; draw_trim(q,r,2,6); } - if (out_trim[where.x][where.y] & 16){ + if (out_trim[where.x][where.y] & 16){ // current_ground = ground_type[out[where.x - 1][where.y - 1]]; current_ground = ground_type[outdoors[party.i_w_c.x][party.i_w_c.y].terrain[targ.x][targ.y + 1]]; - draw_trim(q,r,1,1); + draw_trim(q,r,1,1); } if (out_trim[where.x][where.y] & 32){ // current_ground = ground_type[out[where.x - 1][where.y - 1]]; @@ -1359,7 +1359,7 @@ void place_trim(short q,short r,location where,unsigned char ter_type) } } - + // if (((ter_type >= 100) && (ter_type <= 137)) && (at_top == FALSE) && if (((ter_type >= 122) && (ter_type <= 169)) && (at_top == FALSE) && (at_bot == FALSE) && (at_left == FALSE) && (at_right == FALSE)) { @@ -1367,78 +1367,78 @@ void place_trim(short q,short r,location where,unsigned char ter_type) store1 = get_t_t(where.x,where.y - 1); store2 = get_t_t(where.x + 1,where.y); store3 = get_t_t(where.x,where.y + 1); - if ((is_wall(store) == TRUE) + if ((is_wall(store) == TRUE) && (is_wall(store1) == TRUE) && - (is_ground(store2) == TRUE) + (is_ground(store2) == TRUE) && (is_ground(store3) == TRUE)){ current_ground = ground_type[t_d.terrain[where.x + 1][where.y + 1]]; draw_trim(q,r,3,6); } - if ((is_wall(store) == TRUE) + if ((is_wall(store) == TRUE) && (is_wall(store3) == TRUE) && - (is_ground(store2) == TRUE) + (is_ground(store2) == TRUE) && (is_ground(store1) == TRUE)){ - current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; - draw_trim(q,r,3,5); + current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; + draw_trim(q,r,3,5); } - if ((is_wall(store2) == TRUE) + if ((is_wall(store2) == TRUE) && (is_wall(store1) == TRUE) && - (is_ground(store) == TRUE) + (is_ground(store) == TRUE) && (is_ground(store3) == TRUE)){ current_ground = ground_type[t_d.terrain[where.x - 1][where.y + 1]]; draw_trim(q,r,3,7); - } + } - if ((is_wall(store2) == TRUE) + if ((is_wall(store2) == TRUE) && (is_wall(store3) == TRUE) && - (is_ground(store) == TRUE) + (is_ground(store) == TRUE) && (is_ground(store1) == TRUE)){ current_ground = ground_type[t_d.terrain[where.x - 1][where.y - 1]]; draw_trim(q,r,3,4); - } + } - if ((is_ground(store) == TRUE) + if ((is_ground(store) == TRUE) && (is_ground(store1) == TRUE) && - (is_ground(store2) == TRUE) + (is_ground(store2) == TRUE) && (is_wall(store3) == TRUE)) { current_ground = ground_type[t_d.terrain[where.x - 1][where.y - 1]]; - draw_trim(q,r,3,4); - current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; - draw_trim(q,r,3,5); + draw_trim(q,r,3,4); + current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; + draw_trim(q,r,3,5); } - if ((is_wall(store) == TRUE) + if ((is_wall(store) == TRUE) && (is_ground(store3) == TRUE) && - (is_ground(store2) == TRUE) + (is_ground(store2) == TRUE) && (is_ground(store1) == TRUE)) { - current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; - draw_trim(q,r,3,5); + current_ground = ground_type[t_d.terrain[where.x + 1][where.y - 1]]; + draw_trim(q,r,3,5); current_ground = ground_type[t_d.terrain[where.x + 1][where.y + 1]]; - draw_trim(q,r,3,6); + draw_trim(q,r,3,6); } - if ((is_ground(store2) == TRUE) + if ((is_ground(store2) == TRUE) && (is_wall(store1) == TRUE) && - (is_ground(store) == TRUE) + (is_ground(store) == TRUE) && (is_ground(store3) == TRUE)) { current_ground = ground_type[t_d.terrain[where.x + 1][where.y + 1]]; - draw_trim(q,r,3,6); - current_ground = ground_type[t_d.terrain[where.x - 1][where.y + 1]]; - draw_trim(q,r,3,7); + draw_trim(q,r,3,6); + current_ground = ground_type[t_d.terrain[where.x - 1][where.y + 1]]; + draw_trim(q,r,3,7); } - if ((is_wall(store2) == TRUE) + if ((is_wall(store2) == TRUE) && (is_ground(store3) == TRUE) && - (is_ground(store) == TRUE) + (is_ground(store) == TRUE) && (is_ground(store1) == TRUE)) { current_ground = ground_type[t_d.terrain[where.x - 1][where.y - 1]]; - draw_trim(q,r,3,4); + draw_trim(q,r,3,4); current_ground = ground_type[t_d.terrain[where.x - 1][where.y + 1]]; - draw_trim(q,r,3,7); + draw_trim(q,r,3,7); } } } @@ -1471,7 +1471,7 @@ void draw_trim(short q,short r,short which_trim,short which_mode) to_rect.top = to_rect.top + trim_rects[which_mode].top; rect_draw_some_item(frills_gworld,from_rect,terrain_screen_gworld,to_rect,1,0); - + } @@ -1482,7 +1482,7 @@ Boolean extend_road_terrain(unsigned char ter) 203,204,215,216,90, 91,92,93,102,103, 104,105,112,113,114, 115,187,188,189,190, 192,193,194,195,196, 197,191,200,201}; - + for (i = 0; i < 39; i++) if (scenario.ter_types[ter].picture == extend_pics[i]) return TRUE; @@ -1651,12 +1651,12 @@ void pre_boom_space(location where,short mode,short type,short damage,short soun WinBlackDrawString(dam_str,text_rect.left + 12,text_rect.top + 6); else WinDrawString(dam_str,text_rect.left + 12,text_rect.top + 6); } - + if(party.stuff_done[305][7] > 0) //{del_len = PSD[306][6] * 3 + 4;Delay(del_len,&dummy);} play_sound(-sound_to_play[sound]); else{ play_sound(sound_to_play[sound]); - + if ((sound == 6) && (fast_bang == 0)) Delay(12, &dummy); @@ -1667,26 +1667,26 @@ void pre_boom_space(location where,short mode,short type,short damage,short soun Delay(del_len, &dummy); } } - + redraw_terrain(); if ((overall_mode > 9) && (overall_mode != 35) && (overall_mode != 36) && (overall_mode != 50)) - draw_pcs(center,1); + draw_pcs(center,1); } - -void draw_pointing_arrows() + +void draw_pointing_arrows() { RECT sources[4] = {{65,46,73,54},{56,46,64,54},{56,37,64,45},{65,37,73,45}}; RECT dests[8] = {{7,100,15,108},{7,170,15,178},{140,7,148,15},{212,7,220,15}, {346,100,354,108},{346,170,354,178},{140,274,148,282},{212,274,220,282}}; // rects modified below short i; - + for (i = 0; i < 4; i++) alter_rect(&sources[i]); for (i = 0; i < 8; i++) alter_rect(&dests[i]); - + if ((monsters_going == TRUE) || (overall_mode <= MODE_TOWN) || (overall_mode <= MODE_COMBAT) - || (overall_mode == 35)) + || (overall_mode == 35)) return; for (i = 0; i < 4; i++) { rect_draw_some_item (mixed_gworld,sources[i],mixed_gworld,dests[i * 2],1,1); @@ -1754,7 +1754,7 @@ void draw_targeting_line(POINT where_curs) k = (k * 28) + 32 ;//+ ulx; l = (l * 36) + 36 ; - if ((loc_off_act_area(which_space) == FALSE) && + if ((loc_off_act_area(which_space) == FALSE) && (can_see(from_loc,which_space,0) < 5) && (dist(from_loc,which_space) <= current_spell_range)) { SetViewportOrgEx(main_dc,ulx,uly,NULL); @@ -1770,7 +1770,7 @@ void draw_targeting_line(POINT where_curs) redraw_rect.right = max(where_curs.x,k) + 4; redraw_rect.top = min(where_curs.y,l) - 4; redraw_rect.bottom = max(where_curs.y,l) + 4; - + IntersectRect(&redraw_rect2,&redraw_rect,&on_screen_terrain_area); // Now place targeting pattern @@ -1819,7 +1819,7 @@ void draw_targeting_line(POINT where_curs) draw_pcs(center,1); else draw_party_symbol(center); if (overall_mode == 14) - draw_targets(center); + draw_targets(center); } } } @@ -1838,7 +1838,7 @@ void redraw_partial_terrain(RECT redraw_rect) RECT from_rect = redraw_rect; OffsetRect(&redraw_rect,5, 5); - + rect_draw_some_item(terrain_screen_gworld,from_rect,terrain_screen_gworld,redraw_rect,0,1); } diff --git a/Win32/Blades of Exile/boe.items.cpp b/Win32/Blades of Exile/boe.items.cpp index 856eaf26..93224915 100644 --- a/Win32/Blades of Exile/boe.items.cpp +++ b/Win32/Blades of Exile/boe.items.cpp @@ -25,7 +25,7 @@ Boolean give_to_party(item_record_type item,short print_result) { short i = 0; - + while (i < 6) { if (adven[i].giveToPC(item,print_result) == true) return TRUE; @@ -65,7 +65,7 @@ Boolean forced_give(short item_num,short abil) void party_record_type::giveGold(short amount, bool print_result) { if (amount < 0) return; - + gold += amount; if(gold > 30000){ gold = 30000; @@ -77,13 +77,13 @@ void party_record_type::giveGold(short amount, bool print_result) bool party_record_type::takeGold(short amount, bool print_result) { if (gold < amount) return false; - + gold -= amount; if(gold < 0) gold = 0; - + if (print_result) put_pc_screen(); - + return true; } @@ -92,7 +92,7 @@ bool party_record_type::takeGold(short amount, bool print_result) bool pc_array::hasAbil(short abil) { short i; - + for (i = 0; i < NUM_OF_PCS; i++) if (pc[i].isAlive()) if (pc[i].hasAbil(abil) < 24) @@ -113,14 +113,14 @@ short item_weight(item_record_type item) void party_record_type::giveFood(short amount, bool print_result) { if (amount < 0) return; - + food += amount; if(food > 25000){ food = 25000; add_string_to_buf("Excess food dropped. "); } - - if (print_result) put_pc_screen(); + + if (print_result) put_pc_screen(); } short party_record_type::takeFood(short amount, bool print_result) @@ -128,7 +128,7 @@ short party_record_type::takeFood(short amount, bool print_result) short diff; diff = amount - food; - + if (diff > 0) { food = 0; @@ -137,8 +137,8 @@ short party_record_type::takeFood(short amount, bool print_result) } food -= amount; - if (print_result) put_pc_screen(); - return 0; + if (print_result) put_pc_screen(); + return 0; } @@ -146,7 +146,7 @@ short party_record_type::takeFood(short amount, bool print_result) Boolean place_item(item_record_type item,location where,Boolean forced) { short i; - + for (i = 0; i < NUM_TOWN_ITEMS; i++) if (t_i.items[i].variety == 0) { t_i.items[i] = item; @@ -164,7 +164,7 @@ Boolean place_item(item_record_type item,location where,Boolean forced) reset_item_max(); return TRUE; } - + return TRUE; } @@ -195,7 +195,7 @@ void destroy_an_item() } i = get_ran(1,0,NUM_TOWN_ITEMS); t_i.items[i].variety = 0; - + } void set_item_flag(item_record_type *item) @@ -209,24 +209,24 @@ void set_item_flag(item_record_type *item) } short get_item(location place,short pc_num,Boolean check_container) -//short pc_num; // if 6, any +//short pc_num; // if 6, any { short i,taken = 0; Boolean item_near = FALSE; short mass_get = 1; - + for (i = 0; i < T_M; i++) if ((c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].attitude == 1) && (can_see(place,c_town.monst.dudes[i].m_loc,0) < 5)) mass_get = 0; - + for (i = 0; i < NUM_TOWN_ITEMS; i++) if (t_i.items[i].variety != 0) - if (((adjacent(place,t_i.items[i].item_loc) == TRUE) || + if (((adjacent(place,t_i.items[i].item_loc) == TRUE) || ((mass_get == 1) && (check_container == FALSE) && ((dist(place,t_i.items[i].item_loc) <= 4) || ((is_combat()) && (which_combat_type == 0))) - && (can_see(place,t_i.items[i].item_loc,0) < 5))) + && (can_see(place,t_i.items[i].item_loc,0) < 5))) && ((t_i.items[i].isContained() == false) || (check_container == TRUE))) { taken = 1; @@ -244,7 +244,7 @@ short get_item(location place,short pc_num,Boolean check_container) add_string_to_buf("Your crime was seen!"); } } - + if (pc_num != 10) { if (taken == 0) add_string_to_buf("Get: nothing here"); @@ -274,15 +274,15 @@ void set_town_status(unsigned char attitude) c_town.monst.dudes[i].mobile = TRUE; if (scenario.scen_monsters[num].spec_skill == 37) { c_town.monst.dudes[i].active = 2; - + // If a town, give power boost c_town.monst.dudes[i].m_d.health *= 3; c_town.monst.dudes[i].m_d.status[3] = 8; c_town.monst.dudes[i].m_d.status[1] = 8; } } - - + + // In some towns, doin' this'll getcha' killed. // wedge in special @@ -312,7 +312,7 @@ void put_item_graphics() char message[256]; // First make sure all arrays for who can get stuff are in order. - if ((current_getting_pc < 6) && ((adven[current_getting_pc].isAlive() == false) + if ((current_getting_pc < 6) && ((adven[current_getting_pc].isAlive() == false) || (adven[current_getting_pc].hasSpace() == 24))) { current_getting_pc = 6; @@ -331,23 +331,23 @@ void put_item_graphics() for (i = 0; i < NUM_OF_PCS; i++) if (current_getting_pc == i) cd_add_label(987,3 + i,"* ",1007); - else cd_add_label(987,3 + i," ",1007); - + else cd_add_label(987,3 + i," ",1007); + // darken arrows, as appropriate if (first_item_shown == 0) cd_activate_item(987,9,0); else cd_activate_item(987,9,1); - if ((first_item_shown > total_items_gettable - 7) || + if ((first_item_shown > total_items_gettable - 7) || (total_items_gettable <= 8) ) cd_activate_item(987,10,0); - else cd_activate_item(987,10,1); + else cd_activate_item(987,10,1); for (i = 0; i < 8; i++) { // first, clear whatever item graphic is there csp(987,20 + i * 4,950); if (item_array[i + first_item_shown] != 200) { // display an item in window - item = t_i.items[item_array[i + first_item_shown]]; + item = t_i.items[item_array[i + first_item_shown]]; sprintf ((char *) message, "%s", (item.isIdent()) ? (char *) item.full_name : (char *) item.name); @@ -369,15 +369,15 @@ void put_item_graphics() csit(987,53 + i,(char *) message); } } - + if (current_getting_pc < 6) { i = adven[current_getting_pc].amountCanCarry(); storage = adven[current_getting_pc].amountCarried(); sprintf ((char *) message, "%s is carrying %d out of %d.", adven[current_getting_pc].name,storage,i); csit(987,52,(char *) message); } - - for (i = 0; i < 6; i++) + + for (i = 0; i < 6; i++) if (adven[i].isAlive()) { csp(987,11 + i,800 + adven[i].which_graphic); } @@ -388,7 +388,7 @@ void display_item_event_filter (short item_hit) { item_record_type item; short i; - + switch (item_hit) { case 1: dialog_not_toast = FALSE; @@ -396,16 +396,16 @@ void display_item_event_filter (short item_hit) case 9: if (first_item_shown > 0) first_item_shown -= 8; - put_item_graphics(); + put_item_graphics(); break; case 10: if (first_item_shown < 116) first_item_shown += 8; - put_item_graphics(); + put_item_graphics(); break; - case 3: case 4: case 5: case 6:case 7: case 8: + case 3: case 4: case 5: case 6:case 7: case 8: current_getting_pc = item_hit - 3; - put_item_graphics(); + put_item_graphics(); break; default: if (current_getting_pc == 6) { @@ -473,22 +473,22 @@ short display_item(location from_loc,short pc_num, short mode, bool check_contai //pc_num; // < 6 - this pc only 6 - any pc //short mode; // 0 - adjacent 1 - all in sight { - short i,array_position = 0; + short i,array_position = 0; SetCursor(sword_curs); - + first_item_shown = 0; store_get_mode = mode; current_getting_pc = current_pc; store_pcnum = pc_num; dialog_answer = 0; - + for (i = 0; i < 130; i++) item_array[i] = 200; - + total_items_gettable = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) if (t_i.items[i].variety != 0) { - if (((adjacent(from_loc,t_i.items[i].item_loc) == TRUE) || + if (((adjacent(from_loc,t_i.items[i].item_loc) == TRUE) || ((mode == 1) && (check_container == false) && ((dist(from_loc,t_i.items[i].item_loc) <= 4) || ((is_combat()) && (which_combat_type == 0))) && (can_see(from_loc,t_i.items[i].item_loc,0) < 5))) && @@ -520,13 +520,13 @@ short display_item(location from_loc,short pc_num, short mode, bool check_contai } while (dialog_not_toast) - ModalDialog(); - + ModalDialog(); + cd_kill_dialog(987,0); put_item_screen(stat_window,0); put_pc_screen(); - + return dialog_answer; } @@ -567,20 +567,20 @@ short fancy_choice_dialog(short which_dlog,short parent) { short i,store_dialog_answer; char temp_str[256]; - + store_dialog_answer = dialog_answer; SetCursor(sword_curs); - + cd_create_dialog_parent_num(which_dlog,parent); - + if (which_dlog == 1062) { i = get_ran(1,0,12); GetIndString(temp_str,11,10 + i); csit(1062,10,(char *) temp_str); } while (dialog_not_toast) - ModalDialog(); - + ModalDialog(); + cd_kill_dialog(which_dlog,0); if (parent < 2) { @@ -590,7 +590,7 @@ short fancy_choice_dialog(short which_dlog,short parent) } i = dialog_answer; dialog_answer = store_dialog_answer; - + return i; } @@ -603,18 +603,18 @@ void select_pc_event_filter (short item_hit) } short char_select_pc(short active_only,short free_inv_only,char *title) -//active_only; // 0 - no 1 - yes 2 - disarm trap +//active_only; // 0 - no 1 - yes 2 - disarm trap { short i; SetCursor(sword_curs); - + cd_create_dialog(1018,mainPtr); - + if (active_only == 2) csit(1018,15,"Select PC to disarm trap:"); else csit( 1018,15,title); - + for (i = 0; i < 6; i++) { if ((adven[i].main_status == MAIN_STATUS_ABSENT) || ((active_only == TRUE) && (adven[i].main_status > MAIN_STATUS_ALIVE)) || @@ -623,13 +623,13 @@ 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 != MAIN_STATUS_ABSENT) { - csit(1018,9 + i,adven[i].name); - } + csit(1018,9 + i,adven[i].name); + } else cd_activate_item(1018, 9 + i, 0); } - + while (dialog_not_toast) - ModalDialog(); + ModalDialog(); cd_kill_dialog(1018,0); if (in_startup_mode == FALSE) @@ -640,7 +640,7 @@ short char_select_pc(short active_only,short free_inv_only,char *title) } short select_pc(short active_only,short free_inv_only) -//active_only; // 0 - no 1 - yes 2 - disarm trap +//active_only; // 0 - no 1 - yes 2 - disarm trap { if (active_only == 2) return char_select_pc(active_only,free_inv_only,"Trap! Who will disarm?"); @@ -664,21 +664,21 @@ short get_num_of_items(short max_num) char sign_text[256]; SetCursor(sword_curs); - + cd_create_dialog(1012,mainPtr); - + sprintf((char *) sign_text,"How many? (0-%d) ",max_num); - csit(1012,4,(char *)sign_text); + csit(1012,4,(char *)sign_text); sprintf((char *) sign_text,"%d",max_num); cd_set_text_edit_str(1012,(char *) sign_text); cd_set_edit_focus(); - + while (dialog_not_toast) - ModalDialog(); + ModalDialog(); cd_kill_dialog(1012,0); - + dialog_answer = minmax(0,(int)max_num,dialog_answer); - + return dialog_answer; } @@ -692,19 +692,19 @@ void place_glands(location where,unsigned char m_type) { item_record_type store_i; monster_record_type monst; - + monst = return_monster_template(m_type); - + if ((monst.corpse_item >= 0) && (monst.corpse_item < 400) && (get_ran(1,1,100) <= monst.corpse_item_chance)) { store_i = get_stored_item(monst.corpse_item); place_item(store_i,where,FALSE); } } -short pc_array::getTotalLevel() +short pc_array::getTotalLevel() { short i, j = 0; - + for (i = 0; i < NUM_OF_PCS; i++) if (pc[i].isAlive()) j += pc[i].level; @@ -756,17 +756,17 @@ void place_treasure(location where,short level,short loot,short mode) {10,10,15,20,20,30,40,50,75,100}, {50,100,100,100,100,200,200,200,200,200}}; short max,min; - + if (loot == 1) amt = get_ran(2,1,7) + 1; else amt = loot * (get_ran(1,0,10 + (loot * 6) + (level * 2)) + 5); if (adven.getTotalLevel() <= 12) - amt += 1; + amt += 1; if ((adven.getTotalLevel() <= 60) && (amt > 2)) amt += 2; - - if (amt > 3) { + + if (amt > 3) { new_item = get_stored_item(0); new_item.item_level = amt; r1 = get_ran(1,1,9); @@ -785,14 +785,14 @@ void place_treasure(location where,short level,short loot,short mode) max = 10000; min = 100; } - + // reality check if ((loot == 1) && (max > 100) && (get_ran(1,0,8) < 7)) max = 100; if ((loot == 2) && (max > 200) && (get_ran(1,0,8) < 6)) max = 200; - - + + new_item = return_treasure(treas_chart[loot][j],level,mode); if ((item_val(new_item) < min) || (item_val(new_item) > max)) { new_item = return_treasure(treas_chart[loot][j],level,mode); @@ -812,7 +812,7 @@ void place_treasure(location where,short level,short loot,short mode) if (new_item.isCursed() && (get_ran(1,0,5) < 3)) new_item.variety = 0; } - + // if forced, keep dipping until a treasure comes uo if ((mode == 1) && (max >= 20)) { do @@ -823,14 +823,14 @@ void place_treasure(location where,short level,short loot,short mode) // Not many cursed items if (new_item.isCursed() && (get_ran(1,0,2) == 1)) new_item.variety = 0; - + if (new_item.variety != 0) { for (i = 0; i < 6; i++) - if ((adven[i].isAlive()) - && (get_ran(1,0,100) < id_odds[adven[i].skills[13]])) + if ((adven[i].isAlive()) + && (get_ran(1,0,100) < id_odds[adven[i].skills[SKILL_ITEM_LORE]])) new_item.item_properties = new_item.item_properties | 1; place_item(new_item,where,FALSE); - } + } } } @@ -839,11 +839,11 @@ void place_treasure(location where,short level,short loot,short mode) short pc_array::getTotalLuck() { short i = 0; - + for (i = 0; i < NUM_OF_PCS; i++) if (pc[i].isAlive()) i += pc[i].skills[SKILL_LUCK]; - + return i; } @@ -862,7 +862,7 @@ item_record_type return_treasure(short loot,short,short) 7,8,8,9,9,10,11,12,12,13, 13,14, 9,10,11,9,10,11}; short r1; - + treas.variety = 0; r1 = get_ran(1,0,41); if (loot >= 3) r1 += 3; @@ -875,14 +875,14 @@ item_record_type return_treasure(short loot,short,short) case 6: treas = get_missile(loot); break; case 7: treas = get_potion(loot); break; case 8: treas = get_scroll(loot); break; - case 9: treas = get_wand(loot); break; + case 9: treas = get_wand(loot); break; case 10: treas = get_ring(loot); break; case 11: treas = get_necklace(loot); break; case 12: treas = get_poison(loot); break; case 13: treas = get_gloves(loot); break; case 14: treas = get_boots(loot); break; - } - if (treas.variety == 0) treas.value = 0; + } + if (treas.variety == 0) treas.value = 0; return treas; } @@ -892,7 +892,7 @@ void refresh_store_items() { short i,j; short loot_index[10] = {1,1,1,1,2,2,2,3,3,4}; - + for (i = 0; i < 5; i++) for (j = 0; j < 10; j++) { party.magic_store_items[i][j] = return_treasure(loot_index[j],7,1); @@ -909,15 +909,15 @@ void get_text_response(short dlg,char *str,short parent_num) short i; SetCursor(sword_curs); - + store_str = (char *) str; store_dnum = dlg; - + cd_create_dialog_parent_num(dlg,parent_num); cd_set_edit_focus(); - + while (dialog_not_toast) - ModalDialog(); + ModalDialog(); for (i = 0; i < 15; i++) if ((str[i] > 64) && (str[i] < 91)) str[i] = str[i] + 32; @@ -930,7 +930,7 @@ void get_text_response(short dlg,char *str,short parent_num) bool pc_array::checkClass(short item_class, short mode) { short i,j; - + if (item_class == 0) return false; for (i = 0; i < NUM_OF_PCS; i++) diff --git a/Win32/Blades of Exile/boe.monster.cpp b/Win32/Blades of Exile/boe.monster.cpp index 60e5d07e..4a16553d 100644 --- a/Win32/Blades of Exile/boe.monster.cpp +++ b/Win32/Blades of Exile/boe.monster.cpp @@ -19,18 +19,18 @@ monster_record_type return_monster_template(unsigned char store) { monster_record_type monst; short m_num,i; - + m_num = store; monst = scenario.scen_monsters[store]; if (monst.spec_skill == 11) monst.picture_num = 0; - + monst.m_num = m_num; monst.health = (PSD[306][7] == 0) ? monst.health : monst.health / 2; - + // now adjust for difficulty monst.health = monst.health * difficulty_adjust(); - + monst.m_health = monst.health; // in scenario file, health is stored in health field monst.max_mp = 0; monst.mp = monst.max_mp; @@ -39,16 +39,16 @@ monster_record_type return_monster_template(unsigned char store) if ((monst.mu > 0) || (monst.cl > 0)) monst.max_mp = monst.mp = 12 * monst.level; - + monst.m_morale = 10 * monst.level; if (monst.level >= 20) monst.m_morale += 10 * (monst.level - 20); - + monst.morale = monst.m_morale; monst.direction = 0; for (i = 0; i < 15; i++) monst.status[i] = 0; - + return monst; } @@ -56,28 +56,28 @@ short difficulty_adjust() { short i, j = 0; short to_return = 1; - + if(scenario.adjust_diff > 0) // don't automatically adjust difficulty flag activated return 1; - + for (i = 0; i < 6; i++) if (adven[i].isAlive()) j += adven[i].level; - + if ((scenario.difficulty <= 0) && (j >= 60)) to_return++; if ((scenario.difficulty <= 1) && (j >= 130)) to_return++; if ((scenario.difficulty <= 2) && (j >= 210)) to_return++; return to_return; -} +} short out_enc_lev_tot(short which) { short count = 0,i; monster_record_type store_m; short num[7] = {22,8,4,4,3,2,1}; - + if (party.out_c[which].what_monst.cant_flee == TRUE) return 10000; - + for (i = 0; i < 7; i++) if (party.out_c[which].what_monst.monst[i] != 0) { store_m = return_monster_template(party.out_c[which].what_monst.monst[i]); @@ -93,7 +93,7 @@ short current_town_type::countMonsters() for (int i = 0; i < T_M; i++) if (monst.dudes[i].active > 0) ++to_ret; - + return to_ret; } @@ -113,14 +113,14 @@ void create_wand_monst() place_outd_wand_monst(outdoors[party.i_w_c.x][party.i_w_c.y].wandering_locs[r2], outdoors[party.i_w_c.x][party.i_w_c.y].wandering[r1],0); } - + //// - + if (overall_mode != MODE_OUTDOORS) // won't place wandering is more than 50 monsters if ((c_town.town.wandering[r1].isNull() == false) && (c_town.countMonsters() <= 50) && (party.m_killed[c_town.town_num] < c_town.town.max_num_monst)) { r2 = get_ran(1,0,3); - while ((point_onscreen(c_town.town.wandering_locs[r2],c_town.p_loc) == TRUE) && + while ((point_onscreen(c_town.town.wandering_locs[r2],c_town.p_loc) == TRUE) && (loc_off_act_area(c_town.town.wandering_locs[r2]) == FALSE) && (num_tries++ < 100)) r2 = get_ran(1,0,3); for (i = 0; i < 4; i++) { @@ -137,7 +137,7 @@ void create_wand_monst() if ((r3 >= 2) && (i == 3) && (is_blocked(p_loc) == FALSE)) // place extra monsters? c_town.placeMonster(c_town.town.wandering[r1].monst[i],p_loc); } - } + } } } @@ -145,8 +145,8 @@ void place_outd_wand_monst(location where,out_wandering_type group,short forced) { short i = 0,j = 0; location l; - - + + while (i < 10) { //// if ((party.out_c[i].exists == FALSE) || ((i == 9) && (forced > 0))) { @@ -169,7 +169,7 @@ void place_outd_wand_monst(location where,out_wandering_type group,short forced) j++; } party.out_c[i].m_loc = l; - + i = 50; } i++; @@ -179,10 +179,10 @@ void place_outd_wand_monst(location where,out_wandering_type group,short forced) bool wandering_type::isNull() const { short i = 0; - + while (i < 4) { if (monst[i] != 0) return false; - i++; + i++; } return true; } @@ -190,10 +190,10 @@ bool wandering_type::isNull() const bool out_wandering_type::isNull() const { short i = 0; - + while (i < 7) { if (monst[i] != 0) return false; - i++; + i++; } return true; } @@ -215,8 +215,8 @@ void set_up_monst(short mode,unsigned char m_num) //mode; // 0 - unfriendly 1 - friendly & fightin' { short which; - - for (which = 0; which < T_M; which++) + + for (which = 0; which < T_M; which++) if (c_town.monst.dudes[which].active == 0) { c_town.monst.dudes[which].active = 2; c_town.monst.dudes[which].summoned = 0; @@ -234,9 +234,9 @@ void do_monsters() short i,j,r1,target; location l1,l2; Boolean acted_yet = FALSE; - - if (overall_mode == MODE_TOWN) - for (i = 0; i < T_M; i++) + + if (overall_mode == MODE_TOWN) + for (i = 0; i < T_M; i++) if ((c_town.monst.dudes[i].active != 0) && (c_town.monst.dudes[i].m_d.status[11] <= 0) && (c_town.monst.dudes[i].m_d.status[12] <= 0)) { // have to pick targets @@ -246,12 +246,12 @@ 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(c_town.monst.dudes[i].m_loc,c_town.p_loc) > 8) + if (dist(c_town.monst.dudes[i].m_loc,c_town.p_loc) > 8) target = 6; else target = select_active_pc(); } if ((c_town.monst.dudes[i].attitude % 2 != 1) && (target < 6)) - target = 6; + target = 6; } monst_target[i] = target; @@ -260,7 +260,7 @@ void do_monsters() acted_yet = FALSE; if (((c_town.monst.dudes[i].attitude == 0) || (monst_target[i] == 6)) && (c_town.hostile == 0)) { if (c_town.monst.dudes[i].mobile == TRUE) { // OK, it doesn't see the party or - // isn't nasty, and the town isn't totally hostile. + // isn't nasty, and the town isn't totally hostile. if ((c_town.monst.dudes[i].attitude % 2 != 1) || (get_ran(1,0,1) == 0)) { acted_yet = rand_move(i); } @@ -277,7 +277,7 @@ void do_monsters() acted_yet = flee_party(i,l1,l2); if (get_ran(1,0,10) < 6) c_town.monst.dudes[i].m_d.morale++; - } + } else if (monst_hate_spot(i,&l2) == TRUE) acted_yet = seek_party(i,l1,l2); else if (((c_town.monst.dudes[i].m_d.mu == 0) && (c_town.monst.dudes[i].m_d.mu == 0)) @@ -299,7 +299,7 @@ void do_monsters() add_string_to_buf("Monster saw you!"); // play go active sound switch (c_town.monst.dudes[i].m_d.m_type) { - case 0: case 3: case 4: case 5: case 6: case 9: + case 0: case 3: case 4: case 5: case 6: case 9: play_sound(18); break; default: play_sound(46); break; } @@ -307,9 +307,9 @@ void do_monsters() for (j = 0; j < T_M; j++) if ((c_town.monst.dudes[j].active == 2) && ((dist(c_town.monst.dudes[i].m_loc,c_town.monst.dudes[j].m_loc) <= 5) == TRUE)) - c_town.monst.dudes[i].active = 2; + c_town.monst.dudes[i].active = 2; } - + } if (overall_mode == MODE_OUTDOORS) { for (i = 0; i < 10; i++) @@ -320,7 +320,7 @@ void do_monsters() r1 = get_ran(1,1,6); if (r1 == 3) - acted_yet = rand_move(i); + acted_yet = rand_move(i); else acted_yet = seek_party(i,l1,l2); } } @@ -329,9 +329,9 @@ void do_monsters() Boolean monst_hate_spot(short which_m,location *good_loc) { location prospect,loc; - + loc = c_town.monst.dudes[which_m].m_loc; - if ((misc_i[loc.x][loc.y] & 224) + if ((misc_i[loc.x][loc.y] & 224) || (c_town.explored[loc.x][loc.y] & 64) // hate regular fields || ((c_town.explored[loc.x][loc.y] & 32) && (c_town.monst.dudes[which_m].m_d.radiate_1 != 2) && (c_town.monst.dudes[which_m].m_d.immunities & 32 == 0)) // hate ice wall? @@ -365,40 +365,40 @@ short monst_pick_target(short which_m) // First, any chance target is screwed? if (monst_target[which_m] >= 100) { - if (((cur_monst->attitude % 2 == 1) && + if (((cur_monst->attitude % 2 == 1) && (c_town.monst.dudes[monst_target[which_m] - 100].attitude == cur_monst->attitude)) || ((cur_monst->attitude % 2 == 0) && (c_town.monst.dudes[monst_target[which_m] - 100].attitude % 2 == 0))) monst_target[which_m] = 6; else if (c_town.monst.dudes[monst_target[which_m] - 100].active == 0) monst_target[which_m] = 6; } - if (monst_target[which_m] < 6) + if (monst_target[which_m] < 6) if (adven[monst_target[which_m]].isAlive() == false) - monst_target[which_m] = 6; - + monst_target[which_m] = 6; + if ((is_combat()) && (cur_monst->attitude % 2 == 1)) { if (spell_caster < 6) if ((get_ran(1,1,5) < 5) && (monst_can_see(which_m,pc_pos[spell_caster]) == TRUE) - && (adven[spell_caster].isAlive())) + && (adven[spell_caster].isAlive())) return spell_caster; if (missile_firer < 6) if ((get_ran(1,1,5) < 3) && (monst_can_see(which_m,pc_pos[missile_firer]) == TRUE) - && (adven[missile_firer].isAlive())) + && (adven[missile_firer].isAlive())) 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]].isAlive())) + && (adven[monst_target[which_m]].isAlive())) return monst_target[which_m]; } - + // Now pick a target pc and a target monst and see which is more attractive targ_pc = monst_pick_target_pc(which_m,cur_monst); targ_m = monst_pick_target_monst(cur_monst); - + if ((targ_pc != 6) && (targ_m == 6)) return targ_pc; if ((targ_pc == 6) && (targ_m != 6)) return targ_m; if ((targ_pc == 6) && (targ_m == 6)) return 6; - + if (is_town()) { if (cur_monst->attitude % 2 == 0) { return targ_m; @@ -435,7 +435,7 @@ short monst_pick_target_monst(creature_data_type *which_m) ((dist(which_m->m_loc,c_town.monst.dudes[i].m_loc) == min_dist) && (get_ran(1,0,7) < 4))) && (monst_can_see(i,c_town.monst.dudes[i].m_loc) == TRUE) ) { min_dist = dist(which_m->m_loc,c_town.monst.dudes[i].m_loc); - cur_targ = i + 100; + cur_targ = i + 100; } } @@ -450,7 +450,7 @@ short monst_pick_target_pc(short m_num,creature_data_type *which_m) return 6; if (is_town()) return 0; - + // First pick any visible, nearby PC r1 = get_ran(1,0,5); while ((num_tries < 6) && ((adven[r1].isAlive() == false) || @@ -460,7 +460,7 @@ short monst_pick_target_pc(short m_num,creature_data_type *which_m) } if (num_tries < 6) store_targ = r1; - + // Then, see if target can be replaced with someone nice and close r1 = get_ran(1,0,5); while ((num_tries < 4) && ((adven[r1].isAlive() == false) || @@ -479,11 +479,11 @@ short monst_pick_target_pc(short m_num,creature_data_type *which_m) short select_active_pc() { short r1, num_tries = 0; - + r1 = get_ran(1,0,5); while ((adven[r1].isAlive() == false) && (num_tries++ < 50)) r1 = get_ran(1,0,5); - + return r1; } @@ -503,7 +503,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) { location monst_loc; short i,num_adj = 0; - + monst_loc = c_town.monst.dudes[which_m].m_loc; // First, take care of friendly monsters. @@ -525,7 +525,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) return 0; if (is_town()) return orig_target; - + // If target is already adjacent, we're done here. if ((is_combat()) && (orig_target < 6)) if ((adven[orig_target].isAlive()) && (monst_adjacent(pc_pos[orig_target],which_m) == TRUE)) @@ -534,13 +534,13 @@ short switch_target_to_adjacent(short which_m,short orig_target) if ((c_town.monst.dudes[orig_target - 100].active > 0) && (monst_adjacent(c_town.monst.dudes[orig_target - 100].m_loc,which_m) == TRUE)) return orig_target; - + // Anyone unarmored? Heh heh heh... if (is_combat()) for (i = 0; i < 6; i++) - if ((adven[i].isAlive()) && (monst_adjacent(pc_pos[i],which_m) == TRUE) && + if ((adven[i].isAlive()) && (monst_adjacent(pc_pos[i],which_m) == TRUE) && (get_encumberance(i) < 2)) - return i; + return i; // Check for a nice, adjacent, friendly monster and maybe attack for (i = 0; i < T_M; i++) @@ -553,16 +553,16 @@ short switch_target_to_adjacent(short which_m,short orig_target) // OK. Now if this monster has PCs adjacent, pick one at randomn and hack. Otherwise, // stick with orig. target. for (i = 0; i < 6; i++) - if ((adven[i].isAlive()) && (monst_adjacent(pc_pos[i],which_m) == TRUE)) + if ((adven[i].isAlive()) && (monst_adjacent(pc_pos[i],which_m) == TRUE)) num_adj++; - if (num_adj == 0) + if (num_adj == 0) return orig_target; - + i = 0; num_adj = get_ran(1,1,num_adj); while ((num_adj > 1) || (adven[i].isAlive() == false) || (monst_adjacent(pc_pos[i],which_m) == FALSE)) { - if (adven[i].isAlive() && (monst_adjacent(pc_pos[i],which_m) == TRUE)) + if (adven[i].isAlive() && (monst_adjacent(pc_pos[i],which_m) == TRUE)) num_adj--; i++; } @@ -575,16 +575,16 @@ Boolean rand_move(int i) Boolean acted_yet = FALSE; short j; location store_loc; - - // first, if outdoor, just roam. + + // first, if outdoor, just roam. if (is_out()) { store_loc = party.out_c[i].m_loc.randomShift(); return outdoor_move_monster(i,store_loc); } - + if (same_point(monster_targs[i],c_town.monst.dudes[i].m_loc) == TRUE) monster_targs[i].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,c_town.monst.dudes[i].m_loc,monster_targs[i]); @@ -604,7 +604,7 @@ Boolean rand_move(int i) // maybe pick a wand loc, else juist pick a loc j = get_ran(1,0,3); store_loc = c_town.town.wandering_locs[j]; - + if ((loc_off_act_area(store_loc) == FALSE) && (get_ran(1,0,1) == 1)) monster_targs[i] = store_loc; else { @@ -630,27 +630,27 @@ Boolean seek_party(short i,location l1,location l2) { Boolean acted_yet = FALSE; short m,n; - if ((l1.x > l2.x) && (l1.y > l2.y)) + if ((l1.x > l2.x) && (l1.y > l2.y)) acted_yet = try_move(i,l1,-1,-1); - if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,1,1); - if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,-1,1); - if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,1,-1); - if ((l1.x > l2.x) & (acted_yet == FALSE)) + if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,1,1); + if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,-1,1); + if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,1,-1); + if ((l1.x > l2.x) & (acted_yet == FALSE)) acted_yet = try_move(i,l1,-1,0); - if ((l1.x < l2.x) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,1,0); - if ( (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,0,1); - if ( (l1.y > l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,0,-1); + if ((l1.x < l2.x) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,1,0); + if ( (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,0,1); + if ( (l1.y > l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,0,-1); if (acted_yet == FALSE) { futzing++; m = get_ran(1,0,2) - 1; n = get_ran(1,0,2) - 1; - acted_yet = try_move(i,l1,m,n); + acted_yet = try_move(i,l1,m,n); } return acted_yet; } @@ -659,26 +659,26 @@ Boolean flee_party(short i,location l1,location l2) { Boolean acted_yet = FALSE; - if ((l1.x > l2.x) & (l1.y > l2.y)) + if ((l1.x > l2.x) & (l1.y > l2.y)) acted_yet = try_move(i,l1,1,1); - if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,-1,-1); - if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,1,-1); - if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,-1,+1); - if ((l1.x > l2.x) & (acted_yet == FALSE)) + if ((l1.x < l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,-1,-1); + if ((l1.x > l2.x) & (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,1,-1); + if ((l1.x < l2.x) & (l1.y > l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,-1,+1); + if ((l1.x > l2.x) & (acted_yet == FALSE)) acted_yet = try_move(i,l1,1,0); - if ((l1.x < l2.x) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,-1,0); - if ( (l1.y < l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,0,-1); - if ( (l1.y > l2.y) & (acted_yet == FALSE)) - acted_yet = try_move(i,l1,0,1); + if ((l1.x < l2.x) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,-1,0); + if ( (l1.y < l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,0,-1); + if ( (l1.y > l2.y) & (acted_yet == FALSE)) + acted_yet = try_move(i,l1,0,1); if (acted_yet == FALSE) { futzing++; - acted_yet = rand_move(i); - } + acted_yet = rand_move(i); + } return acted_yet; } @@ -689,8 +689,8 @@ Boolean try_move(short i,location start,short x,short y) dest = start; dest.x = dest.x + x; dest.y = dest.y + y; - - + + if (overall_mode == MODE_TOWN) return town_move_monster(i,dest); if (overall_mode == MODE_OUTDOORS) @@ -701,7 +701,7 @@ Boolean try_move(short i,location start,short x,short y) } Boolean combat_move_monster(short which,location destination) -{ +{ if (monst_can_be_there(destination,which) == FALSE) return FALSE; else if (monst_check_special_terrain(destination,2,which) == FALSE) @@ -718,8 +718,8 @@ Boolean combat_move_monster(short which,location destination) (short) c_town.monst.dudes[which].m_d.ap); else move_sound(t_d.terrain[destination.x][destination.y], (short) c_town.monst.dudes[which].m_d.ap); - } - + } + return TRUE; } return FALSE; @@ -733,7 +733,7 @@ location find_clear_spot(location from_where,short mode) { location loc,store_loc; short num_tries = 0,r1; - + while (num_tries < 75) { num_tries++; loc = from_where; @@ -749,7 +749,7 @@ location find_clear_spot(location from_where,short mode) (!(c_town.explored[loc.x][loc.y] & 254))) { if ((mode == 0) || ((mode == 1) && (adjacent(from_where,loc) == TRUE))) return loc; - else store_loc = loc; + else store_loc = loc; } } return store_loc; @@ -762,7 +762,7 @@ short pc_there(location where) for (i = 0; i < 6; i++) if ((same_point(where,pc_pos[i]) == TRUE) && adven[i].isAlive()) return i; - return 6; + return 6; } location location::randomShift() @@ -778,10 +778,10 @@ location location::randomShift() Boolean outdoor_move_monster(short num,location dest) { - if ((outd_is_blocked(dest) == FALSE) && (outd_is_special(dest) == FALSE) && - (same_point(dest, party.p_loc) != TRUE) && + if ((outd_is_blocked(dest) == FALSE) && (outd_is_special(dest) == FALSE) && + (same_point(dest, party.p_loc) != TRUE) && ((out[dest.x][dest.y] > 21) || (out[dest.x][dest.y] < 5))) { - party.out_c[num].direction = + party.out_c[num].direction = set_direction(party.out_c[num].m_loc, dest); party.out_c[num].m_loc = dest; return TRUE; @@ -795,7 +795,7 @@ Boolean town_move_monster(short num,location dest) return FALSE; if (monst_can_be_there(dest,num) == TRUE) { - c_town.monst.dudes[num].m_d.direction = + c_town.monst.dudes[num].m_d.direction = set_direction(c_town.monst.dudes[num].m_loc, dest); c_town.monst.dudes[num].m_loc = dest; monst_inflict_fields(num); @@ -806,7 +806,7 @@ Boolean town_move_monster(short num,location dest) Boolean monster_placid(short m_num) { - if ((c_town.monst.dudes[m_num].attitude == 0) || + if ((c_town.monst.dudes[m_num].attitude == 0) || ((c_town.monst.dudes[m_num].attitude == 2) && (party.stuff_done[305][9] == 0))) { return TRUE;} else { return FALSE;} @@ -819,15 +819,15 @@ void monst_inflict_fields(short which_monst) short i,j,r1,k; location where_check; creature_data_type *which_m; - + if (c_town.monst.dudes[which_monst].active == 0) return; - + which_m = &c_town.monst.dudes[which_monst]; for (i = 0; i < c_town.monst.dudes[which_monst].m_d.x_width; i++) - for (j = 0; j < c_town.monst.dudes[which_monst].m_d.y_width; j++) + for (j = 0; j < c_town.monst.dudes[which_monst].m_d.y_width; j++) if (c_town.monst.dudes[which_monst].active > 0) { - where_check.x = c_town.monst.dudes[which_monst].m_loc.x + i; + where_check.x = c_town.monst.dudes[which_monst].m_loc.x + i; where_check.y = c_town.monst.dudes[which_monst].m_loc.y + j; if (is_quickfire(where_check.x,where_check.y)) { r1 = get_ran(2,1,8); @@ -869,14 +869,14 @@ void monst_inflict_fields(short which_monst) if (is_fire_wall(where_check.x,where_check.y)) { r1 = get_ran(2,1,6); if (c_town.monst.dudes[which_monst].m_d.spec_skill != 22) - damage_monst(which_monst,7,r1,0,1); + damage_monst(which_monst,7,r1,0,1); break; } } if (c_town.monst.dudes[which_monst].active > 0) for (i = 0; i < c_town.monst.dudes[which_monst].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[which_monst].m_d.y_width; j++) { - where_check.x = c_town.monst.dudes[which_monst].m_loc.x + i; + where_check.x = c_town.monst.dudes[which_monst].m_loc.x + i; where_check.y = c_town.monst.dudes[which_monst].m_loc.y + j; if ((is_crate(where_check.x,where_check.y)) || (is_barrel(where_check.x,where_check.y)) ) @@ -906,18 +906,18 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ short ter_abil; from_loc = c_town.monst.dudes[which_monst].m_loc; - switch (mode) { + switch (mode) { case 1: ter = t_d.terrain[where_check.x][where_check.y]; - break; + break; case 2: ter = combat_terrain[where_check.x][where_check.y]; - break; + break; } which_m = &c_town.monst.dudes[which_monst]; ter_abil = scenario.ter_types[ter].special; - - if ((mode > 0) && (ter_abil >= 16) && + + if ((mode > 0) && (ter_abil >= 16) && (ter_abil <= 19)) { if ( ((ter_abil == 16) && (where_check.y > from_loc.y)) || @@ -940,7 +940,7 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ guts = guts / 2; if (which_m->attitude == 0) guts = guts / 2; - + if ((is_antimagic(where_check.x,where_check.y)) && (mage == TRUE)) return FALSE; if ((is_fire_wall(where_check.x,where_check.y)) && (which_m->m_d.spec_skill != 22)) { @@ -1014,7 +1014,7 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ if ((t_i.items[i].variety > 0) && (same_point(t_i.items[i].item_loc,where_check)) && (t_i.items[i].isContained())) t_i.items[i].item_loc = to_loc; - + } } if (monster_placid(which_monst) && // monsters don't hop into bed when things are calm @@ -1042,10 +1042,10 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ } break; - case 20: case 21: case 15: + case 20: case 21: case 15: can_enter = FALSE; break; - + case 2: if (c_town.monst.dudes[which_monst].m_d.immunities & 8) return TRUE; @@ -1062,7 +1062,7 @@ Boolean monst_check_special_terrain(location where_check,short mode,short which_ if (adven[i].isAlive()) update_explored(pc_pos[i]); } - + return can_enter; } @@ -1087,7 +1087,7 @@ void forced_place_monster(unsigned char which,location where) i++; } } - + if (free_spot == FALSE){//get a random monster that has no life flag or break after 1200 try. i=0; do{ @@ -1175,7 +1175,7 @@ void creature_data_type::charm(short penalty,short which_status,short amount) // Also used for sleep and paralyze, which_statys is 0 means charm { short r1; - + if ((which_status == 11) && (number >= 138) && (number <= 142)) return; if ((which_status == 11) && (m_d.m_type == 8)) return; r1 = get_ran(1,0,100); @@ -1186,7 +1186,7 @@ void creature_data_type::charm(short penalty,short which_status,short amount) if (which_status == 12) r1 -= 15; if ((which_status == 11) && (m_d.spec_skill == 32)) return; - + if (r1 > charm_odds[m_d.level / 2]) { monst_spell_note(number,10); } @@ -1198,7 +1198,7 @@ void creature_data_type::charm(short penalty,short which_status,short amount) else { m_d.status[which_status] = amount; if (which_status == 11) monst_spell_note(number,28); - if (which_status == 12) monst_spell_note(number,30); + if (which_status == 12) monst_spell_note(number,30); } } } @@ -1207,10 +1207,10 @@ void creature_data_type::record() { short r1; char str[60]; - + r1 = get_ran(1,0,100); r1 = (r1 * 7) / 10; - + if ((m_d.x_width > 1) || (m_d.y_width > 1)) { ASB("Capture Soul: Monster is too big."); } @@ -1238,12 +1238,12 @@ void creature_data_type::record() short current_town_type::placeMonster(unsigned char which, location where) { short i = 0; - + while ((i < T_M) && ((monst.dudes[i].active != 0) || (monst.dudes[i].monst_start.spec_enc_code > 0))) { i++; } - + if (i < T_M) { monst.dudes[i].m_d = return_monster_template((unsigned char) which); monst.dudes[i].attitude = scenario.scen_monsters[which].default_attitude; @@ -1252,14 +1252,14 @@ short current_town_type::placeMonster(unsigned char which, location where) monst.dudes[i].mobile = TRUE; monst.dudes[i].active = 2; monst.dudes[i].number = which; - monst.dudes[i].m_loc = where; + monst.dudes[i].m_loc = where; monst.dudes[i].summoned = 0; - monst.dudes[i].monst_start = null_start_type; + monst.dudes[i].monst_start = null_start_type; monst_target[i] = 6; - + take_crate(where.x,where.y); take_barrel(where.x,where.y); - + return i; } return 90; @@ -1291,31 +1291,31 @@ Boolean summon_monster(unsigned char which,location where,short duration,short g return FALSE; loc = where; } - + spot = c_town.placeMonster(which,loc); if (spot >= T_M) { if (duration < 100) add_string_to_buf(" Too many monsters."); return FALSE; } - + c_town.monst.dudes[spot].attitude = given_attitude; - + if (which > 0) {//monster here for good c_town.monst.dudes[spot].summoned = duration; monst_spell_note(which,21); } else c_town.monst.dudes[spot].summoned = 0; - + return TRUE; } void current_town_type::activateMonsters(short code) { - short i; + short i; if (code == 0) return; - for (i = 0; i < T_M; i++) + for (i = 0; i < T_M; i++) if (monst.dudes[i].monst_start.spec_enc_code == code){ if((sd_legit(monst.dudes[i].monst_start.spec1,monst.dudes[i].monst_start.spec2) == TRUE) && (party.stuff_done[monst.dudes[i].monst_start.spec1][monst.dudes[i].monst_start.spec2] == 1)) @@ -1330,7 +1330,7 @@ void current_town_type::activateMonsters(short code) monst.dudes[i].m_loc = t_d.creatures[i].start_loc; monst.dudes[i].m_d = return_monster_template(monst.dudes[i].number); monst_target[i] = 6; - + take_crate(monst.dudes[i].m_loc.x,monst.dudes[i].m_loc.y); take_barrel(monst.dudes[i].m_loc.x,monst.dudes[i].m_loc.y); } @@ -1340,13 +1340,13 @@ void current_town_type::activateMonsters(short code) short get_encumberance(short pc_num) { short store = 0,i,what_val; - - for (i = 0; i < 16; i++) + + for (i = 0; i < 24; i++) if (adven[pc_num].equip[i] == TRUE) { what_val = adven[pc_num].items[i].awkward; - if ((what_val == 1) && (get_ran(1,0,130) < hit_chance[adven[pc_num].skills[8]])) + if ((what_val == 1) && (get_ran(1,0,130) < hit_chance[adven[pc_num].skills[SKILL_DEFENSE]])) what_val--; - if ((what_val > 1) && (get_ran(1,0,70) < hit_chance[adven[pc_num].skills[8]])) + if ((what_val > 1) && (get_ran(1,0,70) < hit_chance[adven[pc_num].skills[SKILL_DEFENSE]])) what_val--; store += what_val; } @@ -1356,7 +1356,7 @@ short get_encumberance(short pc_num) unsigned short get_summon_monster(short summon_class) { unsigned short i,j; - + for (i = 0; i < 200; i++) { j = get_ran(1,1,255); diff --git a/Win32/Blades of Exile/boe.party.cpp b/Win32/Blades of Exile/boe.party.cpp index 7d88257c..cf462423 100644 --- a/Win32/Blades of Exile/boe.party.cpp +++ b/Win32/Blades of Exile/boe.party.cpp @@ -38,21 +38,21 @@ void init_party(short mode) boat_record_type null_boat = {location(),location(),location(),200,FALSE,FALSE}; horse_record_type null_horse = {location(),location(),location(),200,FALSE,FALSE}; - + party.age = 0; party.gold = 200; party.food = 100; - + store_help = PSD[SDF_NO_INSTANT_HELP]; - + for (i = 0; i < 310; i++) for (j = 0; j < 10; j++) party.stuff_done[i][j] = 0; if(scenario.prog_make_ver[0] < 2) PSD[SDF_LEGACY_SCENARIO] = 1; //old scenario format ? so, no resurrection balm needed - else PSD[SDF_LEGACY_SCENARIO] = 0; - + else PSD[SDF_LEGACY_SCENARIO] = 0; + PSD[SDF_NO_INSTANT_HELP] = store_help; - + party.light_level = 0; party.outdoor_corner.x = 7; party.outdoor_corner.y = 8; @@ -64,10 +64,10 @@ void init_party(short mode) party.p_loc.y = 84; for (i = 0; i < 30; i++) party.boats[i] = null_boat; for (i = 0; i < 30; i++) party.horses[i] = null_horse; - + party.in_boat = -1; party.in_horse = -1; - + for (i = 0; i < 4; i++) party.creature_save[i].which_town = 200; for (i = 0; i < 10; i++) party.out_c[i].exists = FALSE; for (i = 0; i < 5; i++) @@ -76,16 +76,16 @@ void init_party(short mode) for (i = 0; i < 256; i++) party.m_seen[i] = 0; for (i = 0; i < 50; i++) party.journal_str[i] = -1; for (i = 0; i < 140; i++) - for (j = 0; j < 2; j++) party.special_notes_str[i][j] = 0; + for (j = 0; j < 2; j++) party.special_notes_str[i][j] = 0; for (i = 0; i < 120; i++) party.talk_save[i].personality = -1; - + party.total_m_killed = 0; party.total_dam_done = 0; party.total_xp_gained = 0; party.total_dam_taken = 0; party.direction = 0; party.at_which_save_slot = 0; - + for (i = 0; i < 20; i++) party.alchemy[i] = 0; for (i = 0; i < 200; i++) party.can_find_town[i] = 0; for (i = 0; i < 100; i++) party.key_times[i] = 30000; @@ -93,7 +93,7 @@ void init_party(short mode) for (i = 0; i < 50; i++) party.spec_items[i] = 0; for (i = 0; i < 120; i++) party.help_received[i] = 0; for (i = 0; i < 200; i++) party.m_killed[i] = 0; - + sprintf((char *) party.scen_name,""); for (i = 0; i < 200; i++) @@ -101,20 +101,20 @@ void init_party(short mode) party.item_taken[i][j] = 0; refresh_store_items(); - + for (i = 0; i < 6; i++) { adven[i] = return_dummy_pc(); if (mode != 1) adven[i] = create_prefab_pc(i); } - + for (i = 0; i < 96; i++) for (j = 0; j < 96; j++) out_e[i][j] = 0; for (i = 0; i < 3;i++) - for (j = 0; j < NUM_TOWN_ITEMS; j++) - stored_items[i].items[j] = return_dummy_item(); + for (j = 0; j < NUM_TOWN_ITEMS; j++) + stored_items[i].items[j] = return_dummy_item(); for (i = 0; i < 200; i++) for (j = 0; j < 8; j++) @@ -126,11 +126,11 @@ void init_party(short mode) for (k = 0; k < 6; k++) for (l = 0; l < 48; l++) o_maps.outdoor_maps[i][k][l] = 0; - + // Default is save maps party.stuff_done[306][0] = 0; - save_maps = TRUE; - + save_maps = TRUE; + // NOT DEBUG build_outdoors(); get_reg_data(); @@ -145,7 +145,7 @@ void init_party_scen_data() short i,j,k,l; Boolean stored_item = FALSE; short store_help; - + party.age = 0; store_help = PSD[SDF_NO_INSTANT_HELP]; for (i = 0; i < 310; i++) @@ -166,7 +166,7 @@ void init_party_scen_data() party.p_loc.y = scenario.out_start.y; for (i = 0; i < NUM_OF_BOATS; i++) party.boats[i] = scenario.scen_boats[i]; for (i = 0; i < NUM_OF_HORSES; i++) party.horses[i] = scenario.scen_horses[i]; - for (i = 0; i < 30; i++) + for (i = 0; i < 30; i++) { if ((scenario.scen_boats[i].which_town >= 0) && (scenario.scen_boats[i].boat_loc.x >= 0)) { if (party.boats[i].exists == FALSE) { @@ -181,10 +181,10 @@ void init_party_scen_data() } } } - + party.in_boat = -1; party.in_horse = -1; - + for (i = 0; i < 4; i++) party.creature_save[i].which_town = INVALID_TOWN; for (i = 0; i < 10; i++) party.out_c[i].exists = FALSE; for (i = 0; i < 5; i++) @@ -195,9 +195,9 @@ void init_party_scen_data() for (i = 0; i < 50; i++) party.journal_str[i] = -1; for (i = 0; i < 140; i++) for (j = 0; j < 2; j++) - party.special_notes_str[i][j] = 0; + party.special_notes_str[i][j] = 0; for (i = 0; i < 120; i++) party.talk_save[i].personality = -1; - + party.direction = 0; party.at_which_save_slot = 0; for (i = 0; i < 200; i++) party.can_find_town[i] = 1 - scenario.town_hidden[i]; @@ -211,19 +211,19 @@ void init_party_scen_data() party.item_taken[i][j] = 0; refresh_store_items(); - + for (i = 0; i < 96; i++) for (j = 0; j < 96; j++) out_e[i][j] = 0; for (i = 0; i < 3;i++) - for (j = 0; j < NUM_TOWN_ITEMS; j++) + for (j = 0; j < NUM_TOWN_ITEMS; j++) if (stored_items[i].items[j].variety != 0) stored_item = TRUE; if (stored_item == TRUE) if (FCD(911,0) == 1) { for (i = 0; i < 3;i++) - for (j = 0; j < NUM_TOWN_ITEMS; j++) + for (j = 0; j < NUM_TOWN_ITEMS; j++) if (stored_items[i].items[j].variety != 0) if (give_to_party(stored_items[i].items[j],FALSE) == FALSE) { i = 20; j = NUM_TOWN_ITEMS + 1; @@ -231,7 +231,7 @@ void init_party_scen_data() } for (i = 0; i < 3;i++) for (j = 0; j < NUM_TOWN_ITEMS; j++) { - stored_items[i].items[j] = return_dummy_item(); + stored_items[i].items[j] = return_dummy_item(); } for (i = 0; i < 200; i++) @@ -239,7 +239,7 @@ void init_party_scen_data() for (k = 0; k < 64; k++) { town_maps.town_maps[i][j][k] = 0; } - + for (i = 0; i < 100; i++) for (k = 0; k < 6; k++) for (l = 0; l < 48; l++) @@ -247,7 +247,7 @@ void init_party_scen_data() get_reg_data(); } -// When the party is placed into a scen from the startinbg screen, this is called to put the game into game +// When the party is placed into a scen from the startinbg screen, this is called to put the game into game // mode and load in the scen and init the party info // party record already contains scen name void put_party_in_scen() @@ -260,7 +260,7 @@ void put_party_in_scen() for (j = 0; j < 6; j++) for (i = 0; i < 15; i++) adven[j].status[i] = 0; - + for (j = 0; j < 6; j++) { // unite party @@ -270,7 +270,7 @@ void put_party_in_scen() // start with maximum amount of spell points adven[j].cur_sp = adven[j].max_sp; } - + for (j = 0; j < 6; j++) for (i = 23; i >= 0; i--) { @@ -280,7 +280,7 @@ void put_party_in_scen() adven[j].takeItem(i + 30); // strip away special items item_took = TRUE; } - if (adven[j].items[i].ability == 119) + if (adven[j].items[i].ability == 119) { adven[j].takeItem(i + 30); // strip away summoning items item_took = TRUE; @@ -291,11 +291,11 @@ void put_party_in_scen() item_took = TRUE; } } - + if (item_took == TRUE) FCD(910,0); - + if (load_scenario() == FALSE) return; - + init_party_scen_data(); // if at this point, startup must be over, so make this call to make sure we're ready, @@ -304,12 +304,12 @@ void put_party_in_scen() in_startup_mode = FALSE; set_up_ter_pics(); - + load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1,1,1,0,0,NULL); load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y + 1,0,1,0,0,NULL); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y,1,0,0,0,NULL); load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y,0,0,0,0,NULL); - + stat_screen_mode = 0; build_outdoors(); erase_out_specials(); @@ -352,15 +352,15 @@ pc_record_type return_dummy_pc() dummy_pc.main_status = MAIN_STATUS_ABSENT; sprintf ((char *) dummy_pc.name, "\n"); - + for (i = 0; i < 30; i++) dummy_pc.skills[i] = (i < 3) ? 1 : 0; - dummy_pc.cur_health = 6; - dummy_pc.max_health = 6; - dummy_pc.cur_sp = 0; - dummy_pc.max_sp = 0; - dummy_pc.experience = 0; - dummy_pc.skill_pts = 60; + dummy_pc.cur_health = 6; + dummy_pc.max_health = 6; + dummy_pc.cur_sp = 0; + dummy_pc.max_sp = 0; + dummy_pc.experience = 0; + dummy_pc.skill_pts = 60; dummy_pc.level = 1; for (i = 0; i < 15; i++) dummy_pc.status[i] = 0; for (i = 0; i < 24; i++) dummy_pc.items[i] = return_dummy_item(); @@ -375,12 +375,12 @@ pc_record_type return_dummy_pc() for (i = 0; i < 15; i++) { dummy_pc.advan[i] = FALSE; - dummy_pc.traits[i] = FALSE; - } + dummy_pc.traits[i] = FALSE; + } dummy_pc.race = RACE_HUMAN; dummy_pc.exp_adj = 100; - dummy_pc.direction = 0; - + dummy_pc.direction = 0; + return dummy_pc; } @@ -389,7 +389,7 @@ pc_record_type create_prefab_pc(short num) pc_record_type dummy_pc; short i; short pc_stats[6][19] = - { + { {8,6,2, 6,0,0,0,0,0, 0,0,0,0,1, 0,0,2,0,0}, {8,7,2, 0,0,6,3,0,3, 0,0,0,0,0, 0,0,0,2,0}, {8,6,2, 3,3,0,0,2,0, 0,0,0,0,0, 4,4,0,2,1}, @@ -401,16 +401,16 @@ pc_record_type create_prefab_pc(short num) short pc_sp[6] = {0,0,0,20,20,21}; short pc_graphics[6] = {3,32,29,16,23,14}; short pc_race[6] = {0,2,1,0,0,0}; - short pc_t[6][15] = {{0,0,1,0,0,0,1,0,0,0, 0,1,0,0,0}, - {1,0,0,0,0,1,0,0,0,0, 1,0,0,0,0}, - {0,0,0,1,0,0,0,0,0,0, 0,0,1,0,0}, - {0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0}, - {0,0,0,0,1,0,1,1,0,0, 0,0,0,0,1}, + short pc_t[6][15] = {{0,0,1,0,0,0,1,0,0,0, 0,1,0,0,0}, + {1,0,0,0,0,1,0,0,0,0, 1,0,0,0,0}, + {0,0,0,1,0,0,0,0,0,0, 0,0,1,0,0}, + {0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0}, + {0,0,0,0,1,0,1,1,0,0, 0,0,0,0,1}, {0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0}}; - + dummy_pc.main_status = MAIN_STATUS_ALIVE; - + switch (num) { case 0: strncpy ((char *) dummy_pc.name, "Jenneke", (size_t) 20); break; @@ -424,40 +424,40 @@ pc_record_type create_prefab_pc(short num) break; case 5: strncpy ((char *) dummy_pc.name, "Michael", (size_t) 20); break; - + } for (i = 0; i < 19; i++) dummy_pc.skills[i] = pc_stats[num][i]; - - dummy_pc.cur_health = pc_health[num]; - dummy_pc.max_health = pc_health[num]; - dummy_pc.experience = 0; - dummy_pc.skill_pts = 0; + + dummy_pc.cur_health = pc_health[num]; + dummy_pc.max_health = pc_health[num]; + dummy_pc.experience = 0; + dummy_pc.skill_pts = 0; dummy_pc.level = 1; for (i = 0; i < 15; i++) dummy_pc.status[i] = 0; for (i = 0; i < 24; i++) dummy_pc.items[i] = return_dummy_item(); for (i = 0; i < 24; i++) dummy_pc.equip[i] = FALSE; - dummy_pc.cur_sp = pc_sp[num]; - dummy_pc.max_sp = pc_sp[num]; - + dummy_pc.cur_sp = pc_sp[num]; + dummy_pc.max_sp = pc_sp[num]; + for (i = 0; i < 62; i++) { dummy_pc.priest_spells[i] = (i < 30) ? TRUE : FALSE;//// dummy_pc.mage_spells[i] = (i < 30) ? TRUE : FALSE; } - + for (i = 0; i < 15; i++) { dummy_pc.traits[i] = pc_t[num][i]; - dummy_pc.advan[i] = FALSE; + dummy_pc.advan[i] = FALSE; } - + dummy_pc.race = pc_race[num]; dummy_pc.exp_adj = 100; - dummy_pc.direction = 0; - + dummy_pc.direction = 0; + dummy_pc.which_graphic = pc_graphics[num]; - + return dummy_pc; } @@ -477,10 +477,10 @@ Boolean create_pc(short spot,short parent_num) adven[spot] = return_dummy_pc(); pick_race_abil(&adven[spot],0,parent_num); - + if (parent_num != 0) cd_initial_draw(989); - + still_ok = spend_xp(spot,0,parent_num); if (still_ok == FALSE) return FALSE; @@ -488,7 +488,7 @@ Boolean create_pc(short spot,short parent_num) adven[spot].cur_sp = adven[spot].max_sp; if (parent_num != 0) cd_initial_draw(989); - + pick_pc_graphic(spot,0,parent_num); if (parent_num != 0) @@ -496,7 +496,7 @@ Boolean create_pc(short spot,short parent_num) pick_pc_name(spot,parent_num); adven[spot].main_status = MAIN_STATUS_ALIVE; - + if (in_startup_mode == FALSE) { adven[spot].items[0] = start_items[adven[spot].race * 2]; adven[spot].equip[0] = TRUE; @@ -504,16 +504,16 @@ Boolean create_pc(short spot,short parent_num) adven[spot].equip[1] = TRUE; // Do stat adjs for selected race. - if (adven[spot].race == 1) - adven[spot].skills[1] += 2; - if (adven[spot].race == 2) { - adven[spot].skills[0] += 2; - adven[spot].skills[2] += 1; + if (adven[spot].race == RACE_NEPHIL) + adven[spot].skills[SKILL_DEXTERITY] += 2; + if (adven[spot].race == RACE_SLITH) { + adven[spot].skills[SKILL_STRENGTH] += 2; + adven[spot].skills[SKILL_INTELLIGENCE] += 1; } - adven[spot].max_sp += adven[spot].skills[9] * 3 + adven[spot].skills[10] * 3; + adven[spot].max_sp += adven[spot].skills[SKILL_MAGE_SPELLS] * 3 + adven[spot].skills[SKILL_PRIEST_SPELLS] * 3; adven[spot].cur_sp = adven[spot].max_sp; } - + return TRUE; } @@ -652,7 +652,7 @@ Boolean spend_xp_event_filter (short item_hit) dialog_answer = 0; talk_done = TRUE; break; - + case 82: party.help_received[10] = 0; give_help(210,11,1010); @@ -776,7 +776,7 @@ Boolean spend_xp_event_filter (short item_hit) } else { which_skill = (item_hit - 7) / 2; - + if (((store_skills[which_skill] >= skill_max[which_skill]) && ((item_hit - 7) % 2 == 1)) || ((store_skills[which_skill] == adven[pc_num].skills[which_skill]) && ((item_hit - 7) % 2 == 0) && (mode == 1)) || ((store_skills[which_skill] == 0) && ((item_hit - 7) % 2 == 0) && (mode == 0) && (which_skill > 2)) || @@ -806,10 +806,10 @@ Boolean spend_xp_event_filter (short item_hit) cd_set_item_num(1010,54 + which_skill,store_skills[which_skill]); draw_xp_skills(); } - } + } break; } - + store_train_pc = pc_num; if (talk_done == TRUE) { dialog_not_toast = FALSE; @@ -846,9 +846,9 @@ Boolean spend_xp(short pc_num, short mode, short parent) cd_add_label(1010,i,(char *) get_text,(i < 63) ? 1075 : 1069); } do_xp_draw(); - + dialog_answer = 0; - + if (party.help_received[10] == 0) { cd_initial_draw(1010); give_help(10,11,1010); @@ -856,10 +856,10 @@ Boolean spend_xp(short pc_num, short mode, short parent) while (dialog_not_toast) ModalDialog(); - + cd_kill_dialog(1010,0); - - + + return dialog_answer; } @@ -868,7 +868,7 @@ Boolean spend_xp(short pc_num, short mode, short parent) short pc_array::getMageLore() { short total = 0; - + for (int i = 0; i < NUM_OF_PCS; i++) if (pc[i].isAlive()) total += pc[i].skills[SKILL_MAGE_LORE]; @@ -900,19 +900,19 @@ Boolean poison_weapon( short pc_num, short how_much,short safe) // Nimble? if (adven[pc_num].traits[TRAIT_NIMBLE] == TRUE) r1 -= 6; - if ((r1 > p_chance[adven[pc_num].skills[17]]) && (safe == 0)) { + if ((r1 > p_chance[adven[pc_num].skills[SKILL_POISON]]) && (safe == 0)) { add_string_to_buf(" Poison put on badly. "); p_level = p_level / 2; r1 = get_ran(1,0,100); - if (r1 > p_chance[adven[pc_num].skills[17]] + 10) { + if (r1 > p_chance[adven[pc_num].skills[SKILL_POISON]] + 10) { add_string_to_buf(" You nick yourself. "); - adven[pc_num].status[2] += p_level; + adven[pc_num].status[STATUS_POISON] += p_level; } } if (safe != 1) play_sound(55); adven[pc_num].weap_poisoned = weap; - adven[pc_num].status[0] = max (adven[pc_num].status[0], + adven[pc_num].status[STATUS_POISONED_WEAPON] = max (adven[pc_num].status[STATUS_POISONED_WEAPON], p_level); return TRUE; @@ -939,7 +939,7 @@ void cast_spell(short type,short situation) add_string_to_buf(" Not in antimagic field."); return; } - + if (spell_forced == FALSE) spell = pick_spell(6, type, situation); else { @@ -954,7 +954,7 @@ void cast_spell(short type,short situation) do_mage_spell(pc_casting,spell); else do_priest_spell(pc_casting,spell); put_pc_screen(); - + } } @@ -976,7 +976,7 @@ Boolean repeat_cast_ok(short type) add_string_to_buf("Repeat cast: Can't cast."); return FALSE; } - store_select = (type == 0) ? mage_need_select[what_spell] : + store_select = (type == 0) ? mage_need_select[what_spell] : priest_need_select[what_spell]; if ((store_select > 0) && (store_spell_target == 6)) { add_string_to_buf("Repeat cast: No target stored."); @@ -1004,19 +1004,19 @@ void do_mage_spell(short pc_num,short spell_num) short i,j,item,target,adj,store; location where; unsigned short r1; - + where = c_town.p_loc; play_sound(25); current_spell_range = 8; - + adj = adven[who_cast].statAdj(2); - + switch (spell_num) { case 0: // Light adven[pc_num].cur_sp -= spell_cost[0][spell_num]; increase_light(50); break; - + case 6: // Identify adven[pc_num].cur_sp -= spell_cost[0][spell_num]; ASB("All of your items are identified."); @@ -1024,16 +1024,16 @@ void do_mage_spell(short pc_num,short spell_num) for (j = 0; j < 24; j++) adven[i].items[j].item_properties = adven[i].items[j].item_properties | 1; break; - + case 9: // true sight adven[pc_num].cur_sp -= spell_cost[0][spell_num]; for (where.x = 0; where.x < 64; where.x++) - for (where.y = 0; where.y < 64; where.y++) + for (where.y = 0; where.y < 64; where.y++) if (dist(where,c_town.p_loc) <= 2) make_explored(where.x,where.y); clear_map(); break; - + case 16: // summon beast //// r1 = get_summon_monster(1); if (r1 == 0) break; @@ -1078,7 +1078,7 @@ void do_mage_spell(short pc_num,short spell_num) case 50: store = get_ran(5,1,4) + 2 * adven[who_cast].statAdj(2); if (summon_monster(85,where,store,2) == FALSE) - add_string_to_buf(" Summon failed."); + add_string_to_buf(" Summon failed."); else adven[pc_num].cur_sp -= spell_cost[0][spell_num]; break; @@ -1086,11 +1086,11 @@ void do_mage_spell(short pc_num,short spell_num) add_string_to_buf(" Target spell. "); current_pat = square; overall_mode = 3; - set_town_spell(spell_num,pc_num); + set_town_spell(spell_num,pc_num); break; - + case 23: // Long light - adven[pc_num].cur_sp -= spell_cost[0][spell_num]; + adven[pc_num].cur_sp -= spell_cost[0][spell_num]; increase_light(200); break; @@ -1106,26 +1106,26 @@ void do_mage_spell(short pc_num,short spell_num) add_string_to_buf(" As the sapphire dissolves, "); add_string_to_buf(" you have a vision. "); for (i = 0; i < 64; i++) - for (j = 0; j < 64; j++) + for (j = 0; j < 64; j++) make_explored(i,j); clear_map(); } break; - - + + case 38: // Stealth adven[pc_num].cur_sp -= spell_cost[0][spell_num]; party.stuff_done[305][0] += max(6,adven[pc_num].level * 2); - break; + break; + - case 7: case 20: case 34: case 41: // Scry monster, Unlock, disp. barrier, Capture SOul add_string_to_buf(" Target spell. "); current_pat = single; overall_mode = 3; set_town_spell(spell_num,pc_num); - break; + break; case 42: case 59: case 60: // fire and force barriers, quickfire add_string_to_buf(" Target spell. "); @@ -1133,13 +1133,13 @@ void do_mage_spell(short pc_num,short spell_num) current_pat = single; set_town_spell(spell_num,pc_num); break; - + case 51: // antimagic add_string_to_buf(" Target spell. "); overall_mode = 3; current_pat = radius2; set_town_spell(spell_num,pc_num); - break; + break; case 53: // fly if (party.stuff_done[305][1] > 0) { @@ -1147,15 +1147,15 @@ void do_mage_spell(short pc_num,short spell_num) return; } if (party.in_boat >= 0) - add_string_to_buf(" Leave boat first. "); + add_string_to_buf(" Leave boat first. "); else if (party.in_horse >= 0) //// - add_string_to_buf(" Leave horse first. "); + add_string_to_buf(" Leave horse first. "); else { adven[pc_num].cur_sp -= spell_cost[0][spell_num]; add_string_to_buf(" You start flying! "); party.stuff_done[305][1] = 3; } - break; + break; case 29: case 57: // resist magic protection target = store_spell_target; @@ -1173,7 +1173,7 @@ void do_mage_spell(short pc_num,short spell_num) adven[target].status[5] += 2 + adven[pc_num].statAdj(2) + get_ran(2,1,2); sprintf ((char *) c_line, " %s protected.",adven[target].name); } - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); break; } } @@ -1183,8 +1183,8 @@ void do_priest_spell(short pc_num,short spell_num) short r1,r2, target, i,item,store,adj,x,y; location loc; location where; - - short store_victim_health,store_caster_health,targ_damaged; // for symbiosis + + short store_victim_health,store_caster_health,targ_damaged; // for symbiosis where = c_town.p_loc; @@ -1192,7 +1192,7 @@ void do_priest_spell(short pc_num,short spell_num) play_sound(24); current_spell_range = 8; - + switch (spell_num) { case 4: adven[pc_num].cur_sp -= spell_cost[1][spell_num]; @@ -1210,8 +1210,8 @@ void do_priest_spell(short pc_num,short spell_num) } add_string_to_buf((char *) c_line); - break; - + break; + case 7: case 25: // manna spells adven[pc_num].cur_sp -= spell_cost[1][spell_num]; store = adven[pc_num].level / 3 + 2 * adven[who_cast].statAdj(2) + get_ran(2,1,4); @@ -1219,26 +1219,26 @@ void do_priest_spell(short pc_num,short spell_num) if (spell_num == 7) r1 = r1 / 3 + 1; sprintf ((char *) c_line, " You gain %d food. ",r1); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); party.giveFood(r1,true); break; - + case 8: // Ritual - Sanctify add_string_to_buf(" Sanctify which space? "); current_pat = single; overall_mode = 3; - set_town_spell(100 + spell_num,pc_num); + set_town_spell(100 + spell_num,pc_num); break; - + case 13: adven[pc_num].cur_sp -= spell_cost[1][spell_num]; party.light_level += 210; break; - + case 15: store = adven[who_cast].statAdj(2); if (summon_monster(125,where,get_ran(2,1,4) + store,2) == FALSE) - add_string_to_buf(" Summon failed."); + add_string_to_buf(" Summon failed."); else adven[pc_num].cur_sp -= spell_cost[1][spell_num]; break; case 34: @@ -1249,23 +1249,23 @@ void do_priest_spell(short pc_num,short spell_num) store = get_ran(2,1,5) + adven[who_cast].statAdj(2); if (summon_monster((r2 == 1) ? 100 : 99,where,store,2 ) == FALSE) add_string_to_buf(" Summon failed."); - } + } break; case 43: adven[pc_num].cur_sp -= spell_cost[1][spell_num]; store = get_ran(2,1,4) + adven[who_cast].statAdj(2); if (summon_monster(126,where,store,2) == FALSE) - add_string_to_buf(" Summon failed."); + add_string_to_buf(" Summon failed."); for (i = 0; i < 4; i++) { store = get_ran(2,1,4) + adven[who_cast].statAdj(2); if (summon_monster(125,where,store,2) == FALSE) - add_string_to_buf(" Summon failed."); + add_string_to_buf(" Summon failed."); } break; case 50: store = get_ran(6,1,4) + adven[who_cast].statAdj(2); if (summon_monster(122,where,store,2) == FALSE) - add_string_to_buf(" Summon failed."); + add_string_to_buf(" Summon failed."); else adven[pc_num].cur_sp -= spell_cost[1][spell_num]; break; @@ -1273,14 +1273,14 @@ void do_priest_spell(short pc_num,short spell_num) add_string_to_buf(" Destroy what? "); current_pat = (spell_num == 16) ? single : square; overall_mode = 3; - set_town_spell(100 + spell_num,pc_num); + set_town_spell(100 + spell_num,pc_num); break; case 45: // dispelling fields add_string_to_buf(" Target spell. "); current_pat = (spell_num == 19) ? single : radius2; overall_mode = 3; - set_town_spell(100 + spell_num,pc_num); + set_town_spell(100 + spell_num,pc_num); break; case 23: // Detect life @@ -1294,7 +1294,7 @@ void do_priest_spell(short pc_num,short spell_num) party.stuff_done[305][3] += adven[pc_num].level / 12 + 2; adven[pc_num].cur_sp -= spell_cost[1][spell_num]; break; - + case 44: // shatter add_string_to_buf(" You send out a burst of energy. "); adven[pc_num].cur_sp -= spell_cost[1][spell_num]; @@ -1303,7 +1303,7 @@ void do_priest_spell(short pc_num,short spell_num) loc.crumbleWall(); update_explored(c_town.p_loc); break; - + case 60: if (overall_mode > MODE_OUTDOORS) { add_string_to_buf(" Can only cast outdoors. "); @@ -1311,11 +1311,11 @@ void do_priest_spell(short pc_num,short spell_num) } if (party.in_boat >= 0) { add_string_to_buf(" Not while in boat. "); - return; + return; } if (party.in_horse >= 0) {//// add_string_to_buf(" Not while on horseback. "); - return; + return; } adven[pc_num].cur_sp -= spell_cost[1][spell_num]; add_string_to_buf(" You are moved... "); @@ -1329,14 +1329,14 @@ void do_priest_spell(short pc_num,short spell_num) // update_explored(party.p_loc); redraw_screen(0); break; - + case 1: case 20: case 39: case 2: case 11: case 27: case 28: case 36: case 19: case 24: // target = select_pc(11,0); target = store_spell_target; if (target < 6) { adven[pc_num].cur_sp -= spell_cost[1][spell_num]; switch(spell_num) { - case 1: case 20: case 39: + 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); @@ -1350,7 +1350,7 @@ void do_priest_spell(short pc_num,short spell_num) r1 = ((spell_num == 2) ? 1 : 3) + get_ran(1,0,2) + adven[pc_num].statAdj(2) / 2; adven[target].cure(r1); break; - + case 19: // awaken if (adven[target].status[11] <= 0) { sprintf ((char *) c_line, " %s is already awake! " @@ -1385,17 +1385,17 @@ void do_priest_spell(short pc_num,short spell_num) r1 = 1 + get_ran(1,0,2) + adven[pc_num].statAdj(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); adven[target].status[7] = 0; - adven[target].status[6] = 0; + adven[target].status[6] = 0; break; } } - add_string_to_buf((char *) c_line); - put_pc_screen(); + add_string_to_buf((char *) c_line); + put_pc_screen(); break; case 47: case 49: case 40: case 56: case 33: case 5: case 6: case 35: @@ -1405,9 +1405,9 @@ void do_priest_spell(short pc_num,short spell_num) if ((spell_num == 6) && (target == pc_num)) { // check symbiosis add_string_to_buf(" Can't cast on self."); return; - } - - adven[pc_num].cur_sp -= spell_cost[1][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); @@ -1451,18 +1451,18 @@ 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); play_sound(53); } - else sprintf ((char *) c_line," Wasn't stoned. "); + else sprintf ((char *) c_line," Wasn't stoned. "); } if (spell_num == 33) { - for (i = 0; i < 24; i++) + for (i = 0; i < 24; i++) if (adven[target].items[i].isCursed()) { r1 = get_ran(1,0,200) - 10 * adven[pc_num].statAdj(2); if (r1 < 60) { - adven[target].items[i].item_properties = + adven[target].items[i].item_properties = adven[target].items[i].item_properties & 239; } } @@ -1477,12 +1477,12 @@ void do_priest_spell(short pc_num,short spell_num) else adven[pc_num].takeItem(item); } if (spell_num == 40) { - if (adven[target].main_status == MAIN_STATUS_DEAD) + if (adven[target].main_status == MAIN_STATUS_DEAD) 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); play_sound(5); - adven[target].main_status = MAIN_STATUS_DUST; + adven[target].main_status = MAIN_STATUS_DUST; } else { adven[target].main_status = MAIN_STATUS_ALIVE; @@ -1491,11 +1491,11 @@ 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); play_sound(52); - } - else sprintf ((char *) c_line," Didn't work. "); - + } + else sprintf ((char *) c_line," Didn't work. "); + } if (spell_num == 56) { if (adven[target].isAlive() == false) { @@ -1505,61 +1505,61 @@ 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); - play_sound(52); + (char *) adven[target].name); + play_sound(52); } - else sprintf ((char *) c_line," Was OK. "); + else sprintf ((char *) c_line," Was OK. "); } - add_string_to_buf((char *) c_line); - put_pc_screen(); + add_string_to_buf((char *) c_line); + put_pc_screen(); } - break; + break; case 21: case 46: case 54: - adven[pc_num].cur_sp -= spell_cost[1][spell_num]; + adven[pc_num].cur_sp -= spell_cost[1][spell_num]; r1 = get_ran(spell_num / 7 + adj, 1, 4); if (spell_num < 54) { sprintf ((char *) c_line, " Party healed %d. ", r1); - add_string_to_buf((char *) c_line); - adven.heal(r1); + add_string_to_buf((char *) c_line); + adven.heal(r1); play_sound(52); } else if (spell_num == 54) { sprintf ((char *) c_line, " Party revived. "); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); r1 = r1 * 2; adven.heal(r1); - play_sound(-53); + play_sound(-53); play_sound(-52); adven.cure(3 + adj); } break; - + case 30: - adven[pc_num].cur_sp -= spell_cost[1][spell_num]; + adven[pc_num].cur_sp -= spell_cost[1][spell_num]; sprintf ((char *) c_line, " Party cured. "); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); adven.cure(3 + adven[pc_num].statAdj(2)); break; - + case 42: case 61: case 48: - adven[pc_num].cur_sp -= spell_cost[1][spell_num]; + adven[pc_num].cur_sp -= spell_cost[1][spell_num]; switch (spell_num) { case 42: add_string_to_buf(" Party hidden.");break; case 61: add_string_to_buf(" Party cleansed.");break; case 48: add_string_to_buf(" Party is now really, REALLY awake.");break; - } + } for (i = 0; i < 6; i++) if (adven[i].isAlive()) { if (spell_num == 42) { store = get_ran(0,1,3) + adven[pc_num].level / 6 + adven[pc_num].statAdj(2); r1 = max(0,store); - adven[i].status[8] += r1; + adven[i].status[8] += r1; } if (spell_num == 61) { adven[i].status[6] = 0; - adven[i].status[7] = 0; + adven[i].status[7] = 0; } if (spell_num == 48) { // Hyperactivity adven[i].status[11] -= 6 + 2 * adven[pc_num].statAdj(2); @@ -1575,7 +1575,7 @@ void cast_town_spell(location where) short adjust,r1,targ,store; location loc; unsigned char ter; - + if ((where.x <= c_town.town.in_town_rect.left) || (where.x >= c_town.town.in_town_rect.right) || (where.y <= c_town.town.in_town_rect.top) || @@ -1583,13 +1583,13 @@ void cast_town_spell(location where) add_string_to_buf(" Can't target outside town."); return; } - + adjust = can_see(c_town.p_loc,where,0); - if (town_spell < 1000) + if (town_spell < 1000) adven[who_cast].cur_sp -= spell_cost[town_spell / 100][town_spell % 100]; else town_spell -= 1000; ter = t_d.terrain[where.x][where.y]; - + if (adjust > 4) add_string_to_buf(" Can't see target. "); else switch (town_spell) { @@ -1605,7 +1605,7 @@ void cast_town_spell(location where) } else add_string_to_buf(" No monster there."); break; - + case 119: case 145: case 18: add_string_to_buf(" You attempt to dispel. "); place_spell_pattern(current_pat,where,11,FALSE,7); @@ -1624,7 +1624,7 @@ void cast_town_spell(location where) if (is_fire_barrier(where.x,where.y)) add_string_to_buf(" You create the barrier. "); else add_string_to_buf(" Failed."); - break; + break; case 59: if ((get_obscurity(where.x,where.y) == 5) || (monst_there(where) < 90)) { add_string_to_buf(" Target space obstructed."); @@ -1633,19 +1633,19 @@ void cast_town_spell(location where) make_force_barrier(where.x,where.y); if (is_force_barrier(where.x,where.y)) add_string_to_buf(" You create the barrier. "); - else add_string_to_buf(" Failed."); - break; + else add_string_to_buf(" Failed."); + break; case 60: make_quickfire(where.x,where.y); if (is_quickfire(where.x,where.y)) add_string_to_buf(" You create quickfire. "); - else add_string_to_buf(" Failed."); + else add_string_to_buf(" Failed."); break; case 51: // am cloud add_string_to_buf(" You create an antimagic cloud. "); for (loc.x = 0; loc.x < town_size[town_type]; loc.x++) - for (loc.y = 0; loc.y < town_size[town_type]; loc.y++) + for (loc.y = 0; loc.y < town_size[town_type]; loc.y++) if ((dist(where,loc) <= 2) && (can_see(where,loc,2) < 5) && ((ex_abs(loc.x - where.x) < 2) || (ex_abs(loc.y - where.y) < 2))) make_antimagic(loc.x,loc.y); @@ -1654,7 +1654,7 @@ void cast_town_spell(location where) case 108: // RItual - sanctify check_spell_on_space(where,108); break; - + case 20: switch (scenario.ter_types[ter].special) { //// case 9: case 10: @@ -1680,7 +1680,7 @@ void cast_town_spell(location where) break; } break; - + case 41: if ((is_fire_barrier(where.x,where.y)) || (is_force_barrier(where.x,where.y))) { r1 = get_ran(1,0,100) - 5 * adven[who_cast].statAdj(2) + 5 * (c_town.difficulty / 10); @@ -1690,7 +1690,7 @@ void cast_town_spell(location where) add_string_to_buf(" Barrier broken. "); take_fire_barrier(where.x,where.y); take_force_barrier(where.x,where.y); - + // Now, show party new things update_explored(c_town.p_loc); } @@ -1704,7 +1704,7 @@ void cast_town_spell(location where) else add_string_to_buf(" No barrier there."); break; - + } } @@ -1717,7 +1717,7 @@ void check_spell_on_space(location where, unsigned char spell) //code is basical for (i = 0; i < 50; i++) if (same_point(where,c_town.town.special_locs[i]) == TRUE) { - if (c_town.town.specials[c_town.town.spec_id[i]].type == 24) + if (c_town.town.specials[c_town.town.spec_id[i]].type == 24) run_special(16,2,c_town.town.spec_id[i],where,&s1,&s2,&s3); return; } @@ -1728,7 +1728,7 @@ void check_spell_on_space(location where, unsigned char spell) //code is basical for (i = 0; i < 50; i++) if (same_point(where,c_town.town.special_locs[i]) == TRUE) { - if ((c_town.town.specials[c_town.town.spec_id[i]].type == 24) && (c_town.town.specials[c_town.town.spec_id[i]].ex1a == spell)) + if ((c_town.town.specials[c_town.town.spec_id[i]].type == 24) && (c_town.town.specials[c_town.town.spec_id[i]].ex1a == spell)) run_special(16,2,c_town.town.spec_id[i],where,&s1,&s2,&s3); return; } @@ -1740,15 +1740,15 @@ void check_spell_on_space(location where, unsigned char spell) //code is basical void do_mindduel(short pc_num,creature_data_type *monst) { short i = 0,adjust,r1,r2,balance = 0; - + adjust = (adven[pc_num].level + adven[pc_num].skills[2]) / 2 - monst->m_d.level * 2; - + if (adven[pc_num].hasAbilEquip(53) < 24) adjust += 20; if (monst->attitude % 2 != 1) set_town_status(0); monst->attitude = 1; - + add_string_to_buf("Mindduel!"); while ((adven[pc_num].isAlive()) && (monst->active > 0) && (i < 10)) { play_sound(1); @@ -1796,7 +1796,7 @@ void do_mindduel(short pc_num,creature_data_type *monst) void dispel_fields(short i,short j,short mode) { short r1; - + if (mode == 2) { take_fire_barrier(i,j); take_force_barrier(i,j); @@ -1829,7 +1829,7 @@ Boolean pc_can_cast_spell(short pc_num,short type,short spell_num) //short type; // 0 - mage 1 - priest { short level,store_w_cast; - + level = spell_level[spell_num]; if (overall_mode >= 20) @@ -1847,27 +1847,27 @@ Boolean pc_can_cast_spell(short pc_num,short type,short spell_num) if ((type == 1) && (adven[pc_num].priest_spells[spell_num] == FALSE)) return FALSE; if (adven[pc_num].status[9] >= 8 - level) - return FALSE; + return FALSE; if (adven[pc_num].status[12] != 0) - return FALSE; + return FALSE; if (adven[pc_num].status[11] > 0) - return FALSE; - + return FALSE; + // 0 - everywhere 1 - combat only 2 - town only 3 - town & outdoor only 4 - town & combat only 5 - outdoor only store_w_cast = spell_w_cast[type][spell_num]; - + if (is_out()) if ((store_w_cast == 1) || (store_w_cast == 2) || (store_w_cast == 4)) return FALSE; - + if (is_town()) if ((store_w_cast == 1) || (store_w_cast == 5)) return FALSE; - + if (is_combat()) if ((store_w_cast == 2) || (store_w_cast == 3) || (store_w_cast == 5)) return FALSE; - + return TRUE; } @@ -1875,7 +1875,7 @@ Boolean pc_can_cast_spell(short pc_num,short type,short spell_num) void draw_caster_buttons() { short i; - + if (can_choose_caster == FALSE) { for (i = 0; i < 6; i++) { if (i == pc_casting) @@ -1930,16 +1930,16 @@ void draw_spell_pc_info() if (adven[i].isAlive()) { cd_set_item_num(1098,24 + i, adven[i].cur_health); - cd_set_item_num(1098,30 + i, adven[i].cur_sp); + cd_set_item_num(1098,30 + i, adven[i].cur_sp); } - } + } } } void put_pc_caster_buttons() { - for (int i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) if (cd_get_active(1098,i + 4) > 0) { if (i == pc_casting) cd_text_frame(1098,i + 18,11); @@ -1965,7 +1965,7 @@ void put_spell_led_buttons() for (i = 0; i < 38; i++) { spell_for_this_button = (on_which_spell_page == 0) ? i : spell_index[i]; - + if (spell_for_this_button < 90) { if (((store_situation == 0) && (store_mage == spell_for_this_button)) || ((store_situation == 1) && (store_priest == spell_for_this_button))) { @@ -2012,7 +2012,7 @@ void put_spell_list() csit(1098,81,"Level 6:"); csit(1098,82,"Level 7:"); csit(1098,83,""); - for (i = 0; i < 38; i++) + for (i = 0; i < 38; i++) if (spell_index[i] < 90) { if (store_situation == 0) sprintf((char *) add_text,"%s %c %d",mage_s_name[spell_index[i]], @@ -2033,7 +2033,7 @@ void pick_spell_event_filter (short item_hit) char *got_target = " Target selected."; char *bad_spell = " Spell not available."; Boolean spell_toast = FALSE,dialog_done = FALSE; - + switch (item_hit) { case 4: case 5: case 6: case 7: case 8: case 9: // pick caster if (cd_get_active(1098,item_hit) == 1) { @@ -2054,18 +2054,18 @@ void pick_spell_event_filter (short item_hit) break; case 10: case 11: case 12: case 13: case 14: case 15: // pick target if (cd_get_active(1098,10 + pc_casting) == FALSE) { - cd_set_item_text(1098,36,no_target); + cd_set_item_text(1098,36,no_target); } else if (cd_get_active(1098,item_hit) == FALSE) { - cd_set_item_text(1098,36,bad_target); + cd_set_item_text(1098,36,bad_target); } else { - - cd_set_item_text(1098,36,got_target); + + cd_set_item_text(1098,36,got_target); store_spell_target = item_hit - 10; - draw_spell_info(); + draw_spell_info(); put_pc_target_buttons(); - } + } break; case 16: // cancel @@ -2075,18 +2075,18 @@ void pick_spell_event_filter (short item_hit) case 1: case 17: // cast! dialog_done = TRUE; break; - + case 75: // other spells on_which_spell_page = 1 - on_which_spell_page; put_spell_list(); put_spell_led_buttons(); break; - + case 79: // help party.help_received[7] = 0; give_help(207,8,1098); break; - + case 100: break; @@ -2097,16 +2097,16 @@ void pick_spell_event_filter (short item_hit) display_spells(store_situation,i,1098); } else if (cd_get_led(1098,item_hit) == 0) { - cd_set_item_text(1098,36,bad_spell); + cd_set_item_text(1098,36,bad_spell); } else { if (store_situation == 0) store_mage = (on_which_spell_page == 0) ? item_hit - 37 : spell_index[item_hit - 37]; - else store_priest = (on_which_spell_page == 0) ? item_hit - 37 : spell_index[item_hit - 37]; - draw_spell_info(); + else store_priest = (on_which_spell_page == 0) ? item_hit - 37 : spell_index[item_hit - 37]; + draw_spell_info(); put_spell_led_buttons(); - + if (store_spell_target < 6) { if (cd_get_active(1098,10 + store_spell_target) == FALSE) { store_spell_target = 6; @@ -2116,7 +2116,7 @@ void pick_spell_event_filter (short item_hit) } // Cute trick now... if a target is needed, caster can always be picked if ((store_spell_target == 6) && (cd_get_active(1098,10 + pc_casting) == 1)) { - cd_set_item_text(1098,36,choose_target); + cd_set_item_text(1098,36,choose_target); draw_spell_info(); // force_play_sound(45); play_sound(45); @@ -2126,7 +2126,7 @@ void pick_spell_event_filter (short item_hit) put_pc_target_buttons(); } - } + } break; } if (dialog_done == TRUE) { @@ -2184,14 +2184,14 @@ void pick_spell_event_filter (short item_hit) dialog_not_toast = FALSE; dialog_answer = item_hit; } - + } short pick_spell(short pc_num,short type,short) // 70 - no spell OW spell num //short pc_num; // if 6, anyone //short type; // 0 - mage 1 - priest //short situation; // 0 - out 1 - town 2 - combat -{ +{ store_mage_store = store_mage; store_priest_store = store_priest; store_store_target = store_spell_target; @@ -2202,7 +2202,7 @@ short pick_spell(short pc_num,short type,short) // 70 - no spell OW spell num pc_casting = (type == 0) ? store_last_cast_mage : store_last_cast_priest; if (pc_casting == 6) pc_casting = current_pc; - + if (pc_num == 6) { // See if can keep same caster can_choose_caster = TRUE; if (pc_can_cast_spell(pc_casting,type,type) == FALSE) { @@ -2235,7 +2235,7 @@ short pick_spell(short pc_num,short type,short) // 70 - no spell OW spell num add_string_to_buf("Cast: No spell points."); return 70; } - + } // If in combat, make the spell being cast this PCs most recent spell @@ -2302,12 +2302,12 @@ short pick_spell(short pc_num,short type,short) // 70 - no spell OW spell num draw_spell_pc_info(); draw_caster_buttons(); put_spell_led_buttons(); - + if (party.help_received[7] == 0) { cd_initial_draw(1098); give_help(7,8,1098); } - + while (dialog_not_toast) ModalDialog(); final_process_dialog(1098); @@ -2321,7 +2321,7 @@ void print_spell_cast(short spell_num,short which) { sprintf ((char *) c_line, "Spell: %s ", (which == 0) ? (char *) mage_s_name[spell_num] : (char *) priest_s_name[spell_num]); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); } void set_town_spell(short s_num,short who_c) @@ -2348,11 +2348,11 @@ void do_alchemy() 8,6,8,8,0, 5,2,8,5,8}; short potion_val[20] = {40,60,15,50,50, 180,200,100,150,100, 200,150,300,400,100, 300,500,175,250,500}; - + pc_num = select_pc(1,0); if (pc_num == INVALID_PC) return; - + which_p = alch_choice(pc_num); if (which_p < 20) { if (adven[pc_num].hasSpace() == 24) { @@ -2485,7 +2485,7 @@ Boolean pick_pc_graphic(short pc_num,short mode,short parent_num) // mode ... 0 - create 1 - created { short i; - + store_graphic_pc_num = pc_num; store_graphic_mode = mode; store_pc_graphic = adven[pc_num].which_graphic; @@ -2494,7 +2494,7 @@ Boolean pick_pc_graphic(short pc_num,short mode,short parent_num) cd_create_dialog_parent_num(1050,parent_num); - for (i = 41; i < 77; i++) + for (i = 41; i < 77; i++) csp(1050,i,800 + i - 41); for (i = 5; i < 41; i++) { if (store_pc_graphic + 5 == i) @@ -2510,7 +2510,7 @@ Boolean pick_pc_graphic(short pc_num,short mode,short parent_num) void pc_name_event_filter () { char get_text[256]; - + cd_get_text_edit_str(1051,(char *) get_text); if ((get_text[0] < 33) || (get_text[0] > 126)) { csit(1051,6,"Must begin with a letter."); @@ -2521,21 +2521,21 @@ void pc_name_event_filter () } } -Boolean pick_pc_name(short pc_num,short parent_num) +Boolean pick_pc_name(short pc_num,short parent_num) //town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors //short sign_type; // terrain type { store_train_pc = pc_num; SetCursor(sword_curs); - + cd_create_dialog_parent_num(1051,parent_num); cd_set_edit_focus(); while (dialog_not_toast) - ModalDialog(); + ModalDialog(); cd_kill_dialog(1051,0); - + return 1; } @@ -2545,18 +2545,18 @@ void pick_trapped_monst_event_filter (short item_hit) dialog_answer = item_hit; } -unsigned char pick_trapped_monst() +unsigned char pick_trapped_monst() // ignore parent in Mac version { short i; char sp[256]; monster_record_type get_monst; - + SetCursor(sword_curs); - + cd_create_dialog_parent_num(988,0); - - for (i = 0; i < 4; i++) + + for (i = 0; i < 4; i++) if (party.imprisoned_monst[i] == 0) { cd_activate_item(988, 2 + 3 * i, 0); } @@ -2566,13 +2566,13 @@ unsigned char pick_trapped_monst() get_monst = return_monster_template((unsigned char)(party.imprisoned_monst[i])); cdsin(988,4 + 3 * i,get_monst.level); } - + while (dialog_not_toast) ModalDialog(); cd_kill_dialog(988,0); if (dialog_answer == 1) return 0; - else return ((unsigned char)(party.imprisoned_monst[(dialog_answer - 2) / 3])); + else return ((unsigned char)(party.imprisoned_monst[(dialog_answer - 2) / 3])); } void pc_record_type::poison(short how_much) @@ -2580,23 +2580,23 @@ void pc_record_type::poison(short how_much) short tlevel = 0; if (isAlive()) { - if ((tlevel = getProtLevel(34)) > 0)//// + if ((tlevel = getProtLevel(ITEM_POISON_PROTECTION)) > 0)//// how_much -= tlevel / 2; - if ((tlevel = getProtLevel(31)) > 0)//// + if ((tlevel = getProtLevel(ITEM_FULL_PROTECTION)) > 0)//// how_much -= tlevel / 3; - if ((traits[12] == TRUE) && (how_much > 1)) how_much++; - if ((traits[12] == TRUE) && (how_much == 1) && (get_ran(1,0,1) == 0)) + if ((traits[TRAIT_FRAIL] == TRUE) && (how_much > 1)) how_much++; + if ((traits[TRAIT_FRAIL] == TRUE) && (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; - + if (how_much > 0) { - status[2] = min(status[2] + how_much,8); - sprintf ((char *) c_line, " %s poisoned.", (char *) name); - add_string_to_buf((char *) c_line); + status[STATUS_POISON] = min(status[STATUS_POISON] + how_much,8); + sprintf (c_line, " %s poisoned.", name); + add_string_to_buf(c_line); one_sound(17); give_help(33,0,0); } } - put_pc_screen(); + put_pc_screen(); } void pc_array::poison(short how_much) @@ -2613,7 +2613,7 @@ void affect_pc(short which_pc,short type,short how_much)//// adven[which_pc].status[type] = minmax (-8,8,adven[which_pc].status[type] + how_much); if (((type >= 4) && (type <= 10)) || (type == 12) || (type == 13)) adven[which_pc].status[type] = max(adven[which_pc].status[type],0); - put_pc_screen(); + put_pc_screen(); } void pc_array::affect(short type, short how_much) @@ -2621,7 +2621,7 @@ void pc_array::affect(short type, short how_much) { for (int i = 0; i < 6; i++) adven[i].status[type] = minmax (-8,8,adven[i].status[type] + how_much); - put_pc_screen(); + put_pc_screen(); } void void_sanctuary(short pc_num) @@ -2637,19 +2637,19 @@ void pc_array::damage(short how_much,short damage_type) { for (int i = 0; i < NUM_OF_PCS; i++) pc[i].damage(how_much,damage_type,-1); - - put_pc_screen(); + + put_pc_screen(); } void pc_array::kill(short mode) -{ +{ short i; - + boom_anim_active = FALSE; for (i = 0; i < 6; i++) if (pc[i].isAlive()) pc[i].main_status = mode; - + put_pc_screen(); } @@ -2662,9 +2662,9 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att { short i, r1, sound_type, tlevel; bool do_print = true; - + if (!isAlive()) return false; - + sound_type = damage_type / 100; damage_type = damage_type % 100; @@ -2677,31 +2677,31 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att if (sound_type == 0) { if ((damage_type == DAMAGE_FIRE) || (damage_type == DAMAGE_UNBLOCKABLE)) sound_type = 5; - if (damage_type == DAMAGE_MAGIC) sound_type = 12; - if (damage_type == DAMAGE_COLD) sound_type = 7; - if (damage_type == DAMAGE_POISON) sound_type = 11; + if (damage_type == DAMAGE_MAGIC) sound_type = 12; + if (damage_type == DAMAGE_COLD) sound_type = 7; + if (damage_type == DAMAGE_POISON) sound_type = 11; } - - // armor + + // armor if ((damage_type == DAMAGE_WEAPON) || (damage_type == DAMAGE_UNDEAD) ||(damage_type == DAMAGE_DEMON)) { how_much -= minmax(-5, 5, (int)status[STATUS_BLESS_CURSE]); for (i = 0; i < 24; i++) if ((items[i].variety != 0) && (equip[i] == TRUE)) { - if ((items[i].variety >= 12) && (items[i].variety <= 17)) { + if ((items[i].variety >= 12) && (items[i].variety <= 17)) {//armor r1 = get_ran(1,1,items[i].item_level); how_much -= r1; - + // bonus for magical items if (items[i].bonus > 0) { r1 = get_ran(1,1,items[i].bonus); how_much -= r1; how_much -= items[i].bonus / 2; } - + if (items[i].bonus < 0) how_much -= items[i].bonus; r1 = get_ran(1,0,100); - if (r1 < hit_chance[skills[8]] - 20) + if (r1 < hit_chance[skills[SKILL_DEFENSE]] - 20) how_much -= 1; } if (items[i].protection > 0) { @@ -2712,11 +2712,11 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att r1 = get_ran(1,1,-1 * items[i].protection); how_much += r1; } - } + } } - + // parry - + // ugly hack short which_pc = getNum(); @@ -2729,75 +2729,75 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att if (damage_type != DAMAGE_MARKED) { if (PSD[306][7] > 0) how_much -= 3; - + // toughness if (traits[TRAIT_TOUGHNESS] == TRUE) how_much--; - + // luck if (get_ran(1,0,100) < 2 * (hit_chance[skills[SKILL_LUCK]] - 20)) how_much -= 1; } - if ((damage_type == DAMAGE_WEAPON) && ((tlevel = getProtLevel(30)) > 0)) + if ((damage_type == DAMAGE_WEAPON) && ((tlevel = getProtLevel(ITEM_PROTECTION)) > 0)) how_much -= tlevel; - if ((damage_type == DAMAGE_UNDEAD) && ((tlevel = getProtLevel(57)) > 0)) + if ((damage_type == DAMAGE_UNDEAD) && ((tlevel = getProtLevel(ITEM_PROTECT_FROM_UNDEAD)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - if ((damage_type == DAMAGE_DEMON) && ((tlevel = getProtLevel(58)) > 0)) + if ((damage_type == DAMAGE_DEMON) && ((tlevel = getProtLevel(ITEM_PROTECT_FROM_DEMONS)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - - if ((type_of_attacker == 6) && ((tlevel = getProtLevel(59)) > 0))//protection from humanoids + + if ((type_of_attacker == MONSTER_TYPE_HUMANOID) && ((tlevel = getProtLevel(ITEM_PROTECT_FROM_HUMANOIDS)) > 0))//protection from humanoids how_much /= ((tlevel >= 7) ? 4 : 2); - if ((type_of_attacker == 1) && ((tlevel = getProtLevel(60)) > 0))//protection from reptiles + if ((type_of_attacker == MONSTER_TYPE_REPTILE) && ((tlevel = getProtLevel(ITEM_PROTECT_FROM_REPTILES)) > 0))//protection from reptiles how_much /= ((tlevel >= 7) ? 4 : 2); - if ((type_of_attacker == 9) && ((tlevel = getProtLevel(61)) > 0))//protection from giants + if ((type_of_attacker == MONSTER_TYPE_GIANT) && ((tlevel = getProtLevel(ITEM_PROTECT_FROM_GIANTS)) > 0))//protection from giants how_much /= ((tlevel >= 7) ? 4 : 2); - + // invuln if (status[STATUS_INVULNERABLE] > 0) how_much = 0; - + // magic resistance - if ((damage_type == DAMAGE_MAGIC) && ((tlevel = getProtLevel(35)) > 0)) + if ((damage_type == DAMAGE_MAGIC) && ((tlevel = getProtLevel(ITEM_MAGIC_PROTECTION)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - + // Mag. res helps w. fire and cold - if (((damage_type == DAMAGE_FIRE) || (damage_type == DAMAGE_COLD)) && (status[5] > 0)) + if (((damage_type == DAMAGE_FIRE) || (damage_type == DAMAGE_COLD)) && (status[STATUS_MAGIC_RESISTANCE] > 0)) how_much /= 2; - + // fire res. - if ((damage_type == DAMAGE_FIRE) && ((tlevel = getProtLevel(32)) > 0)) + if ((damage_type == DAMAGE_FIRE) && ((tlevel = getProtLevel(ITEM_FIRE_PROTECTION)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - + // cold res. - if ((damage_type == DAMAGE_COLD) && ((tlevel = getProtLevel(33)) > 0)) + if ((damage_type == DAMAGE_COLD) && ((tlevel = getProtLevel(ITEM_COLD_PROTECTION)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - + // major resistance - if (((damage_type == DAMAGE_FIRE) || (damage_type == DAMAGE_POISON) + if (((damage_type == DAMAGE_FIRE) || (damage_type == DAMAGE_POISON) || (damage_type == DAMAGE_MAGIC) || (damage_type == DAMAGE_COLD)) - && ((tlevel = getProtLevel(31)) > 0)) + && ((tlevel = getProtLevel(ITEM_FULL_PROTECTION)) > 0)) how_much /= ((tlevel >= 7) ? 4 : 2); - + //ugly hack // short which_pc = getNum(); - + // temporarily disabled if (boom_anim_active == TRUE) { if (how_much < 0) how_much = 0; pc_marked_damage[which_pc] += how_much; - + if (is_town()) add_explosion(c_town.p_loc,how_much,0,(damage_type > DAMAGE_POISON) ? 2 : 0,0,0); else add_explosion(pc_pos[which_pc],how_much,0,(damage_type > DAMAGE_POISON) ? 2 : 0,0,0); - + if (how_much == 0) return false; else return true; } - + if (how_much <= 0) { if ((damage_type == DAMAGE_WEAPON) || (damage_type == DAMAGE_UNDEAD) || (damage_type == DAMAGE_DEMON)) play_sound(2); @@ -2807,13 +2807,13 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att else { // if asleep, get bonus if (status[11] > 0) status[11]--; - + sprintf ((char *) c_line, " %s takes %d. ",(char *) name, how_much); if (do_print) add_string_to_buf((char *) c_line); if (damage_type != DAMAGE_MARKED) { if (is_combat()) boom_space(pc_pos[which_pc],overall_mode,boom_gr[damage_type],how_much,sound_type); - else if (is_town()) + else if (is_town()) boom_space(c_town.p_loc,overall_mode,boom_gr[damage_type],how_much,sound_type); else boom_space(party.p_loc,100,boom_gr[damage_type],how_much,sound_type); } @@ -2823,7 +2823,7 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att } party.total_dam_taken += how_much; - + if (cur_health >= how_much) cur_health -= how_much; else if (cur_health > 0) @@ -2831,7 +2831,7 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att else // Check if PC can die if (how_much > 25) { sprintf ((char *) c_line, " %s is obliterated. ",(char *) name); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); kill(3); } else { @@ -2847,18 +2847,18 @@ bool pc_record_type::damage(short how_much, short damage_type, short type_of_att void set_pc_moves() { short i,r,i_level; - + for (i = 0; i < 6; i++) if (adven[i].isAlive() == false) pc_moves[i] = 0; else { - pc_moves[i] = (adven[i].traits[10] == TRUE) ? 3 : 4; + pc_moves[i] = (adven[i].traits[TRAIT_SLUGGISH] == TRUE) ? 3 : 4; r = get_encumberance(i); pc_moves[i] = minmax(1,8,pc_moves[i] - (r / 3)); - - if ((i_level = adven[i].getProtLevel(55)) > 0) + + if ((i_level = adven[i].getProtLevel(ITEM_SPEED)) > 0) pc_moves[i] += i_level / 7 + 1; - if ((i_level = adven[i].getProtLevel(56)) > 0) + if ((i_level = adven[i].getProtLevel(ITEM_SLOW_WEARER)) > 0) pc_moves[i] -= i_level / 5; if ((adven[i].status[3] < 0) && (party.age % 2 == 1)) // slowed? @@ -2875,7 +2875,7 @@ void set_pc_moves() pc_moves[i] = pc_moves[i] * 3; else if (adven[i].status[3] > 0) pc_moves[i] = pc_moves[i] * 2; - if ((adven[i].status[11] > 0) || (adven[i].status[12] > 0)) + if ((adven[i].status[11] > 0) || (adven[i].status[12] > 0)) pc_moves[i] = 0; } @@ -2965,9 +2965,9 @@ void adjust_spell_menus() return; for (i = 0; i < 62; i++) { - on_spell_menu[1][i] = -1; + on_spell_menu[1][i] = -1; } - for (i = 0; i < 62; i++) + for (i = 0; i < 62; i++) if (pc_can_cast_spell(current_pc,1,i)) { on_spell_menu[1][spell_pos] = i; spell_pos++; diff --git a/Win32/Blades of Exile/boe.specials.cpp b/Win32/Blades of Exile/boe.specials.cpp index 3258ab84..eedff236 100644 --- a/Win32/Blades of Exile/boe.specials.cpp +++ b/Win32/Blades of Exile/boe.specials.cpp @@ -25,7 +25,7 @@ #include "globvar.h" -void start_split(short a, short b, short noise) +void start_split(short a, short b, short noise) { party.stuff_done[304][0] = 1; party.stuff_done[304][1] = c_town.p_loc.x; @@ -38,18 +38,18 @@ void start_split(short a, short b, short noise) current_pc = party.stuff_done[304][3]; update_explored(c_town.p_loc); center = c_town.p_loc; - + if (noise > 0) - play_sound(10); + play_sound(10); } -void end_split(short noise) +void end_split(short noise) { if (party.stuff_done[304][0] == 0) { ASB("Party already together!"); return; } - + c_town.p_loc.x = party.stuff_done[304][1]; c_town.p_loc.y = party.stuff_done[304][2]; party.stuff_done[304][0] = 0; @@ -59,7 +59,7 @@ void end_split(short noise) update_explored(c_town.p_loc); center = c_town.p_loc; if (noise > 0) - play_sound(10); + play_sound(10); add_string_to_buf("You are reunited."); } @@ -69,19 +69,19 @@ Boolean handle_wandering_specials (short mode) { short s1 = 0,s2 = 0,s3 = 0; location null_loc; - + if ((mode == 0) && (store_wandering_special.spec_on_meet >= 0)) { // When encountering run_special(13,1,store_wandering_special.spec_on_meet,null_loc,&s1,&s2,&s3); if (s1 > 0) return FALSE; } - + if ((mode == 1) && (store_wandering_special.spec_on_win >= 0)) {// After defeating run_special(15,1,store_wandering_special.spec_on_win,null_loc,&s1,&s2,&s3); } if ((mode == 2) && (store_wandering_special.spec_on_flee >= 0)) {// After fleeing like a buncha girly men run_special(14,1,store_wandering_special.spec_on_flee,null_loc,&s1,&s2,&s3); - } + } return TRUE; } @@ -96,30 +96,30 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho location out_where,from_loc,to_loc; short s1 = 0,s2 = 0,s3 = 0; char create_line[128]; - + *spec_num = -1; *forced = FALSE; - + switch (mode) { case 0: ter = out[where_check.x][where_check.y]; from_loc = party.p_loc; - break; + break; case 1: ter = t_d.terrain[where_check.x][where_check.y]; from_loc = c_town.p_loc; - break; + break; case 2: ter = combat_terrain[where_check.x][where_check.y]; from_loc = pc_pos[current_pc]; - break; + break; } ter_special = scenario.ter_types[ter].special; ter_flag1 = scenario.ter_types[ter].flag1; ter_flag2 = scenario.ter_types[ter].flag2; ter_pic = scenario.ter_types[ter].picture; - if ((mode > 0) && (ter_special >= 16) && + if ((mode > 0) && (ter_special >= 16) && (ter_special <= 19)) { if ( ((ter_special == 16) && (where_check.y > from_loc.y)) || @@ -134,7 +134,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho if (mode == 0) { out_where = where_check.toLocal(); - for (i = 0; i < 18; i++) + for (i = 0; i < 18; i++) if (same_point(out_where,outdoors[party.i_w_c.x][party.i_w_c.y].special_locs[i]) == TRUE) { *spec_num = outdoors[party.i_w_c.x][party.i_w_c.y].special_id[i]; if ((*spec_num >= 0) && @@ -145,8 +145,8 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho if (s1 > 0) can_enter = FALSE; erase_out_specials(); - put_pc_screen(); - put_item_screen(stat_window,0); + put_pc_screen(); + put_item_screen(stat_window,0); } } @@ -158,7 +158,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho if (((mode == 1) || ((mode == 2) && (which_combat_type == 1))) && (special(where_check.x,where_check.y))) { if (is_force_barrier(where_check.x,where_check.y)) { - add_string_to_buf(" Magic barrier! "); + add_string_to_buf(" Magic barrier! "); return FALSE; } for (i = 0; i < 50; i++) @@ -177,10 +177,10 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho can_enter = FALSE; } } - put_pc_screen(); - put_item_screen(stat_window,0); + put_pc_screen(); + put_item_screen(stat_window,0); } - + if((mode == 2) && town_boat_there(where_check) < 30){//can't enter boats while in combat mode sprintf (create_line, "Blocked: %s",dir_string[set_direction(pc_pos[current_pc], where_check)]); add_string_to_buf(create_line); @@ -188,7 +188,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho } if (can_enter == FALSE) return FALSE; - + if ((!is_out()) && (overall_mode < MODE_TALKING)) { check_fields(where_check,mode,which_pc); @@ -201,13 +201,13 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho adven[i].web(r1); } suppress_stat_screen = TRUE; - put_pc_screen(); + put_pc_screen(); } else adven[current_pc].web(get_ran(1,2,3)); take_web(where_check.x,where_check.y); } if (is_force_barrier(where_check.x,where_check.y)) { - add_string_to_buf(" Magic barrier! "); + add_string_to_buf(" Magic barrier! "); can_enter = FALSE; } if (is_crate(where_check.x,where_check.y)) { @@ -236,7 +236,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho switch (ter_special) { - case 1: + case 1: alter_space(where_check.x,where_check.y,ter_flag1); if (ter_flag2 < 200) { play_sound(-1 * ter_flag2); @@ -252,7 +252,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho add_string_to_buf(" It's hot!"); dam_type = 1; pic_type = 0; if (party.stuff_done[305][3] > 0) { - add_string_to_buf(" It doesn't affect you."); + add_string_to_buf(" It doesn't affect you."); break; } } @@ -277,8 +277,8 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho break; one_sound(17); if (mode < 2) { - for (i = 0; i < 6; i++) - if (adven[i].isAlive()) + for (i = 0; i < 6; i++) + if (adven[i].isAlive()) { if (get_ran(1,1,100) <= ter_flag2) { if (ter_special == 5) @@ -320,29 +320,29 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho can_enter = FALSE; break; - + // Locked doors case 9: case 10: if (is_combat()) { // No lockpicking in combat add_string_to_buf(" Can't enter: It's locked."); break; } - + // See what party wants to do. choice = fancy_choice_dialog(993,0); - + can_enter = FALSE; if (choice == 1) break; if ((door_pc = select_pc(1,0)) < 6) { if (choice == 2) where_check.pickLock(door_pc); else where_check.bashDoor(door_pc); - } + } break; - + } - + // Action may change terrain, so update what's been seen if (is_town()) update_explored(c_town.p_loc); @@ -358,7 +358,7 @@ void check_fields(location where_check,short mode,short which_pc) //mode; // 0 - out 1 - town 2 - combat { short r1,i; - + if (is_out()) return; if (is_town()) fast_bang = 1; if (is_fire_wall(where_check.x,where_check.y)) { @@ -367,7 +367,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,1,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,0,r1,5); + boom_space(party.p_loc,overall_mode,0,r1,5); } if (is_force_wall(where_check.x,where_check.y)) { add_string_to_buf(" Force wall! "); @@ -375,7 +375,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,3,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,1,r1,12); + boom_space(party.p_loc,overall_mode,1,r1,12); } if (is_ice_wall(where_check.x,where_check.y)) { add_string_to_buf(" Ice wall! "); @@ -383,7 +383,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,5,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,4,r1,7); + boom_space(party.p_loc,overall_mode,4,r1,7); } if (is_blade_wall(where_check.x,where_check.y)) { add_string_to_buf(" Blade wall! "); @@ -391,7 +391,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,0,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,3,r1,2); + boom_space(party.p_loc,overall_mode,3,r1,2); } if (is_quickfire(where_check.x,where_check.y)) { add_string_to_buf(" Quickfire! "); @@ -399,7 +399,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,1,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,0,r1,5); + boom_space(party.p_loc,overall_mode,0,r1,5); } if (is_scloud(where_check.x,where_check.y)) { add_string_to_buf(" Stinking cloud! "); @@ -434,7 +434,7 @@ void check_fields(location where_check,short mode,short which_pc) if (mode == 2) adven[which_pc].damage(r1,3,-1); if (overall_mode < MODE_COMBAT) - boom_space(party.p_loc,overall_mode,1,r1,12); + boom_space(party.p_loc,overall_mode,1,r1,12); } fast_bang = 0; } @@ -453,10 +453,10 @@ 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}, {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}}}; abil = adven[pc].items[item].ability; level = adven[pc].items[item].item_level; - + item_use_code = abil_chart[abil]; if (item_use_code >= 10) { item_use_code -= 10; @@ -475,7 +475,7 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, add_string_to_buf("Use: Can't - magically inept. "); take_charge = FALSE; } - + if (take_charge == TRUE) { if ((overall_mode == MODE_OUTDOORS) && (item_use_code > 0) && (item_use_code != 5)) { add_string_to_buf("Use: Not while outdoors. "); @@ -503,25 +503,25 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, if ((adven[pc].items[item].variety == ITEM_TYPE_POTION))// && // (adven[pc].items[item].graphic_num >= 50) && (adven[pc].items[item].graphic_num <= 52)) play_sound(56); - + str = adven[pc].items[item].ability_strength; store_item_spell_level = str * 2 + 1; type = adven[pc].items[item].magic_use_type; - + switch (abil) { case 70: // poison weapon take_charge = poison_weapon(pc,str,0); - break; + break; case 71: case 73: case 74: case 75: case 76: case 78: case 80: switch (abil) { - case 71: + case 71: play_sound(4); which_stat = 1; if (type % 2 == 1) { ASB(" You feel awkward."); str = str * -1;} else ASB(" You feel blessed."); break; - case 73: + case 73: play_sound(75); which_stat = 3; if (type % 2 == 1) { @@ -535,28 +535,28 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, ASB(" You feel odd."); str = str * -1;} else ASB(" You feel protected."); break; - case 75: + case 75: play_sound(51); which_stat = 5; if (type % 2 == 1) { ASB(" You feel odd."); str = str * -1;} else ASB(" You feel protected."); break; - case 76: + case 76: which_stat = 6; if (type % 2 == 1) ASB(" You feel sticky."); else { ASB(" Your skin tingles."); str = str * -1;} break; - case 78: + case 78: play_sound(43); which_stat = 8; if (type % 2 == 1) { ASB(" You feel exposed."); str = str * -1;} else ASB(" You feel obscure."); break; - case 80: + case 80: play_sound(43); which_stat = 10; if (type % 2 == 1) { @@ -618,7 +618,7 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, break; case 84: switch (type) { - case 0: + case 0: case 1: ASB(" You feel wonderful!"); adven[pc].heal(str * 20); @@ -667,14 +667,14 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, break; case 89: switch (type) { - case 0: + case 0: case 1: ASB(" You feel terrible."); adven[pc].drainXP(str * 5); adven[pc].damage(20 * str,4,0); adven[pc].disease(2 * str); adven[pc].dumbfound(2 * str); break; - case 2: + case 2: case 3: ASB(" You all feel terrible."); for (i = 0; i < 6; i++) { adven[i].drainXP(str * 5); adven[i].damage(20 * str,4,0); @@ -698,16 +698,16 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, break; } if (party.in_boat >= 0) - add_string_to_buf(" Leave boat first. "); + add_string_to_buf(" Leave boat first. "); else if (party.in_horse >= 0)//// - add_string_to_buf(" Leave horse first. "); + add_string_to_buf(" Leave horse first. "); else { ASB(" You rise into the air!"); party.stuff_done[305][1] += str; } break; case 94: switch (type) { - case 0: + case 0: case 1: ASB(" You feel wonderful."); adven[pc].heal(200); @@ -733,7 +733,7 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, if((is_town()) || ((is_combat()) && (which_combat_type == 1))) run_special(8,2,str,location(),&i,&j,&r1);// Call town special else - run_special(8,0,str,location(),&i,&j,&r1);// Call scenario special + run_special(8,0,str,location(),&i,&j,&r1);// Call scenario special break; case 2: if((is_town()) || ((is_combat()) && (which_combat_type == 1))) @@ -743,10 +743,10 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, break; case 3: run_special(8,0,str,location(),&i,&j,&r1);// Call scenario special - break; + break; } break; - + // spell effects case 110: add_string_to_buf(" It fires a bolt of flame."); @@ -779,11 +779,11 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, case 117: add_string_to_buf(" It shoots a white ray. "); start_spell_targeting(1132); - break; + break; case 118: add_string_to_buf(" It shoots a golden ray. "); start_spell_targeting(1155); - break; + break; case 119: if (summon_monster(str,user_loc,50,2) == FALSE) add_string_to_buf(" Summon failed."); @@ -831,10 +831,10 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, add_string_to_buf("Fire pours out!"); make_quickfire(user_loc.x,user_loc.y); break; - case 130: + case 130: ASB("It throbs, and emits odd rays."); for (i = 0; i < T_M; i++) { - if ((c_town.monst.dudes[i].active != 0) && (c_town.monst.dudes[i].attitude % 2 == 1) + if ((c_town.monst.dudes[i].active != 0) && (c_town.monst.dudes[i].attitude % 2 == 1) && (dist(pc_pos[current_pc],c_town.monst.dudes[i].m_loc) <= 8) && (can_see(pc_pos[current_pc],c_town.monst.dudes[i].m_loc,0) < 5)) { @@ -878,13 +878,13 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, // 63 - Summon Rat // 64 - Ice Wall Balls // 65 - Goo Bomb -// 66 - Foul Vapors +// 66 - Foul Vapors // 67 - Sleep cloud // 68 - spray acid // 69 - paralyze // 70 - mass sleep } - + put_pc_screen(); if ((take_charge == TRUE) && (adven[pc].items[item].charges > 0)) adven[pc].removeCharge(item); @@ -905,7 +905,7 @@ Boolean use_space(location where) from_loc = c_town.p_loc; add_string_to_buf("Use..."); - + if (is_web(where.x,where.y)) { add_string_to_buf(" You clear the webs."); take_web(where.x,where.y); @@ -939,7 +939,7 @@ Boolean use_space(location where) && (t_i.items[i].isContained())) t_i.items[i].item_loc = to_loc; } - + switch (scenario.ter_types[ter].special) { case 22: if (same_point(where,from_loc) == TRUE) { @@ -954,7 +954,7 @@ Boolean use_space(location where) case 23: // call special run_special(17,0,scenario.ter_types[ter].flag1,where,&i,&i,&i); return TRUE; - break; + break; } add_string_to_buf(" Nothing to use."); @@ -970,7 +970,7 @@ Boolean adj_town_look(location where) Boolean can_open = TRUE,item_there = FALSE,got_special = FALSE; short i = 0, s1 = 0, s2 = 0, s3 = 0; - for (i = 0; i < NUM_TOWN_ITEMS; i++) + for (i = 0; i < NUM_TOWN_ITEMS; i++) if ((t_i.items[i].variety > 0) && (t_i.items[i].isContained()) && (same_point(where,t_i.items[i].item_loc) == TRUE)) item_there = TRUE; @@ -986,28 +986,28 @@ Boolean adj_town_look(location where) if (s1 > 0) can_open = FALSE; got_special = TRUE; } - put_item_screen(stat_window,0); + put_item_screen(stat_window,0); } } - if ((is_container(where)) && (item_there == TRUE) && (can_open == TRUE)) + if ((is_container(where)) && (item_there == TRUE) && (can_open == TRUE)) get_item(where,6,TRUE); - + else if (scenario.ter_types[terrain].special == 22 || scenario.ter_types[terrain].special == 23) { add_string_to_buf(" (Use this space to do something"); add_string_to_buf(" with it.)"); } - + else if (got_special == FALSE) add_string_to_buf(" Search: You don't find anything. "); return FALSE; } -void out_move_party(char x,char y) +void out_move_party(char x,char y) { location l; - + l.x = x; l.y = y; l = l.toGlobal(); @@ -1021,12 +1021,12 @@ void teleport_party(short x,short y,short mode) { short i; location l; - + if (is_combat()) mode = 1; - + l = c_town.p_loc; update_explored(l); - + if (mode != 1) { start_missile_anim(); for (i = 0; i < 9; i++) @@ -1037,7 +1037,7 @@ void teleport_party(short x,short y,short mode) can_draw_pcs = FALSE; if (mode != 1) { do_explosion_anim(5,2); - end_missile_anim(); + end_missile_anim(); } center.x = x; center.y = y; if (is_combat()) { @@ -1048,30 +1048,30 @@ void teleport_party(short x,short y,short mode) c_town.p_loc.y = y; update_explored(l); draw_terrain(0); - - if (mode == 0) { + + if (mode == 0) { start_missile_anim(); for (i = 0; i < 14; i++) add_explosion(center,-1,1,1,0,0); do_explosion_anim(5,1); } can_draw_pcs = TRUE; - if (mode == 0) { + if (mode == 0) { do_explosion_anim(5,2); end_missile_anim(); - } + } draw_map(modeless_dialogs[5],5); } void change_level(short town_num,short x,short y) { location l; - + if ((town_num < 0) || (town_num >= scenario.num_towns)) { give_error("The scenario special encounter tried to put you into a town that doesn't exist.","",0); return; } - + l.x = x; l.y = y; force_town_enter(town_num,l); @@ -1083,8 +1083,8 @@ void change_level(short town_num,short x,short y) // Damaging and killing monsters needs to be here because several have specials attached to them. Boolean damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, short dam_type) //short which_m, who_hit, how_much, how_much_spec; // 6 for who_hit means dist. xp evenly 7 for no xp -//short dam_type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable 5 - cold - // 6 - demon 7 - undead +//short dam_type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable 5 - cold + // 6 - demon 7 - undead // 9 - marked damage, from during anim mode //+10 = no_print // 100s digit - damage sound for boom space @@ -1092,12 +1092,12 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc creature_data_type *victim; short r1,which_spot,sound_type; location where_put; - + Boolean do_print = TRUE; char resist; if (c_town.monst.dudes[which_m].active == 0) return FALSE; - + sound_type = dam_type / 100; dam_type = dam_type % 100; @@ -1108,44 +1108,44 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc if (sound_type == 0) { if ((dam_type == 1) || (dam_type == 4) ) - sound_type = 5; + sound_type = 5; if (dam_type == 5) - sound_type = 7; + sound_type = 7; if (dam_type == 3) - sound_type = 12; + sound_type = 12; if (dam_type == 2) - sound_type = 11; + sound_type = 11; } - - victim = &c_town.monst.dudes[which_m]; + + victim = &c_town.monst.dudes[which_m]; resist = victim->m_d.immunities; if (dam_type == 3) { if (resist & 1) how_much = how_much / 2; if (resist & 2) - how_much = 0; + how_much = 0; } if (dam_type == 1) { if (resist & 4) how_much = how_much / 2; if (resist & 8) - how_much = 0; + how_much = 0; } if (dam_type == 5) { if (resist & 16) how_much = how_much / 2; if (resist & 32) - how_much = 0; + how_much = 0; } if (dam_type == 2) { if (resist & 64) how_much = how_much / 2; if (resist & 128) - how_much = 0; + how_much = 0; } - + // Absorb damage? if (((dam_type == 1) || (dam_type == 3) || (dam_type == 5)) && (victim->m_d.spec_skill == 26)) { @@ -1154,7 +1154,7 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc ASB(" Magic absorbed."); return FALSE; } - + // Saving throw if (((dam_type == 1) || (dam_type == 5)) && (get_ran(1,0,20) <= victim->m_d.level)) how_much = how_much / 2; @@ -1164,12 +1164,12 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc // Rentar-Ihrno? if (victim->m_d.spec_skill == 36) how_much = how_much / 10; - + r1 = get_ran(1,0,(victim->m_d.armor * 5) / 4); r1 += victim->m_d.level / 4; if (dam_type == 0) how_much -= r1; - + if (boom_anim_active == TRUE) { if (how_much < 0) how_much = 0; @@ -1193,7 +1193,7 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc play_sound(2); } - return FALSE; + return FALSE; } if (do_print == TRUE) @@ -1201,11 +1201,11 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc victim->m_d.health = victim->m_d.health - how_much - how_much_spec; if (in_scen_debug == TRUE) - victim->m_d.health = -1; + victim->m_d.health = -1; // splitting monsters if ((victim->m_d.spec_skill == 12) && (victim->m_d.health > 0)){ where_put = find_clear_spot(victim->m_loc,1); - if (where_put.x > 0) + if (where_put.x > 0) if ((which_spot = c_town.placeMonster(victim->number,where_put)) < 90) { c_town.monst.dudes[which_spot].m_d.health = victim->m_d.health; c_town.monst.dudes[which_spot].monst_start = victim->monst_start; @@ -1214,10 +1214,10 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc } if (who_hit < 7) party.total_dam_done += how_much + how_much_spec; - + // Monster damages. Make it hostile. victim->active = 2; - + if (dam_type != 9) { // note special damage only gamed in hand-to-hand, not during animation if (party_can_see_monst(which_m) == TRUE) { @@ -1228,15 +1228,15 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc else { pre_boom_space(victim->m_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->m_loc,overall_mode,51,how_much_spec,5); } } - + if (victim->m_d.health < 0) { monst_killed_mes(which_m); - kill_monst(victim,who_hit); + kill_monst(victim,who_hit); } - else { + else { if (how_much > 0) victim->m_d.morale = victim->m_d.morale - 1; if (how_much > 5) @@ -1246,59 +1246,59 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc if (how_much > 20) victim->m_d.morale = victim->m_d.morale - 2; } - - if ((victim->attitude % 2 != 1) && (who_hit < 7) && + + if ((victim->attitude % 2 != 1) && (who_hit < 7) && (processing_fields == FALSE) && (monsters_going == FALSE)) { add_string_to_buf("Damaged an innocent. "); victim->attitude = 1; set_town_status(0); } - if ((victim->attitude % 2 != 1) && (who_hit < 7) && + if ((victim->attitude % 2 != 1) && (who_hit < 7) && ((processing_fields == TRUE) && (party.stuff_done[305][9] == 0))) { add_string_to_buf("Damaged an innocent."); victim->attitude = 1; set_town_status(0); } - + return TRUE; } void kill_monst(creature_data_type *which_m,short who_killed) { - short xp,i,j,s1,s2,s3; + short xp,i,j,s1,s2,s3; location l; creature_data_type killed_monster; - + killed_monster = *which_m; //work on a local copy of the monster - + //erase the original monster now so that if during a special chain the original monster's slot is filled with a new monster, it's not the new monster that is erased. which_m->monst_start.spec1 = 0; // make sure, if this is a spec. activated monster, it won't come back which_m->active = 0; - + switch (killed_monster.m_d.m_type) { - case 0: case 3: case 4: case 5: case 6: - if (( killed_monster.number == 38) || + case 0: case 3: case 4: case 5: case 6: + if (( killed_monster.number == 38) || ( killed_monster.number == 39)) i = 4; else if ( killed_monster.number == 45) i = 0; - else i = get_ran(1,0,1); + else i = get_ran(1,0,1); play_sound(29 + i); break; case 9: play_sound(29); break; case 1: case 2: case 7: case 8: case 11: i = get_ran(1,0,1); play_sound(31 + i); break; default: play_sound(33); break; } - + // Special killing effects if (sd_legit(killed_monster.monst_start.spec1,killed_monster.monst_start.spec2) == TRUE) party.stuff_done[killed_monster.monst_start.spec1][killed_monster.monst_start.spec2] = 1; - + run_special(12,2,killed_monster.monst_start.special_on_kill,killed_monster.m_loc,&s1,&s2,&s3); if (killed_monster.m_d.radiate_1 == 15) run_special(12,0,killed_monster.m_d.radiate_2,killed_monster.m_loc,&s1,&s2,&s3); - + if ((in_scen_debug == FALSE) && ((killed_monster.summoned >= 100) || (killed_monster.summoned == 0))) { // no xp for party-summoned monsters xp = killed_monster.m_d.level * 2; if (who_killed < NUM_OF_PCS) @@ -1311,11 +1311,11 @@ void kill_monst(creature_data_type *which_m,short who_killed) } l = killed_monster.m_loc; place_glands(l,killed_monster.number); - + } if ((in_scen_debug == FALSE) && (killed_monster.summoned == 0)) place_treasure(killed_monster.m_loc, killed_monster.m_d.level / 2, killed_monster.m_d.treasure, 0); - + i = killed_monster.m_loc.x; j = killed_monster.m_loc.y; switch (killed_monster.m_d.m_type) { @@ -1325,7 +1325,7 @@ void kill_monst(creature_data_type *which_m,short who_killed) case 11: make_sfx(i,j,8); break; default: make_sfx(i,j,1); break; } - + if (((is_town()) || (which_combat_type == 1)) && (killed_monster.summoned == 0)) { @@ -1333,23 +1333,23 @@ void kill_monst(creature_data_type *which_m,short who_killed) } party.total_m_killed++; - + } -// Pushes party and monsters around by moving walls and conveyor belts. -//This is very fragils, and only hands a few cases. +// Pushes party and monsters around by moving walls and conveyor belts. +//This is very fragils, and only hands a few cases. void push_things() { Boolean redraw = FALSE; short i,k; unsigned char ter; location l; - + if (is_out()) return; if (belt_present == FALSE) return; - + for (i = 0; i < T_M; i++) if (c_town.monst.dudes[i].active > 0) { l = c_town.monst.dudes[i].m_loc; @@ -1362,7 +1362,7 @@ void push_things() } if (same_point(l,c_town.monst.dudes[i].m_loc) == FALSE) { c_town.monst.dudes[i].m_loc = l; - if ((point_onscreen(center,c_town.monst.dudes[i].m_loc) == TRUE) || + if ((point_onscreen(center,c_town.monst.dudes[i].m_loc) == TRUE) || (point_onscreen(center,l) == TRUE)) redraw = TRUE; } @@ -1379,12 +1379,12 @@ void push_things() } if (same_point(l,t_i.items[i].item_loc) == FALSE) { t_i.items[i].item_loc = l; - if ((point_onscreen(center,t_i.items[i].item_loc) == TRUE) || + if ((point_onscreen(center,t_i.items[i].item_loc) == TRUE) || (point_onscreen(center,l) == TRUE)) redraw = TRUE; } } - + if (is_town()) { ter = t_d.terrain[c_town.p_loc.x][c_town.p_loc.y]; l = c_town.p_loc; @@ -1396,7 +1396,7 @@ void push_things() } if (same_point(l,c_town.p_loc) == FALSE) { ASB("You get pushed."); - if (scenario.ter_types[ter].special >= 16) + if (scenario.ter_types[ter].special >= 16) draw_terrain(0); center = l; c_town.p_loc = l; @@ -1405,18 +1405,18 @@ void push_things() draw_map(modeless_dialogs[5],5); if (is_barrel(c_town.p_loc.x,c_town.p_loc.y)) { take_barrel(c_town.p_loc.x,c_town.p_loc.y); - ASB("You smash the barrel."); + ASB("You smash the barrel."); } if (is_crate(c_town.p_loc.x,c_town.p_loc.y)) { take_crate(c_town.p_loc.x,c_town.p_loc.y); - ASB("You smash the crate."); + ASB("You smash the crate."); } for (k = 0; k < NUM_TOWN_ITEMS; k++) if ((t_i.items[k].variety > 0) && (t_i.items[k].isContained()) && (same_point(t_i.items[k].item_loc,c_town.p_loc) == TRUE)) - t_i.items[k].item_properties = t_i.items[k].item_properties & 247; + t_i.items[k].item_properties = t_i.items[k].item_properties & 247; redraw = TRUE; - } + } } if (is_combat()) { for (i = 0; i < 6; i++) @@ -1430,27 +1430,27 @@ void push_things() case 19: l.x--; break; } if (same_point(l, pc_pos[i]) == FALSE) { - ASB("Someone gets pushed."); + ASB("Someone gets pushed."); ter = t_d.terrain[l.x][l.y]; - if (scenario.ter_types[ter].special >= 16) + if (scenario.ter_types[ter].special >= 16) draw_terrain(0); pc_pos[i] = l; update_explored(l); draw_map(modeless_dialogs[5],5); if (is_barrel(pc_pos[i].x,pc_pos[i].y)) { take_barrel(pc_pos[i].x,pc_pos[i].y); - ASB("You smash the barrel."); + ASB("You smash the barrel."); } if (is_crate(pc_pos[i].x,pc_pos[i].y)) { take_crate(pc_pos[i].x,pc_pos[i].y); - ASB("You smash the crate."); + ASB("You smash the crate."); } for (k = 0; k < NUM_TOWN_ITEMS; k++) if ((t_i.items[k].variety > 0) && (t_i.items[k].isContained()) && (same_point(t_i.items[k].item_loc,pc_pos[i]) == TRUE)) - t_i.items[k].item_properties = t_i.items[k].item_properties & 247; + t_i.items[k].item_properties = t_i.items[k].item_properties & 247; redraw = TRUE; - } + } } } if (redraw == TRUE) { @@ -1465,7 +1465,7 @@ BOOL special_increase_age(char mode) short i,s1,s2,s3; Boolean redraw = FALSE,stat_area = FALSE; BOOL to_return = FALSE; - + for (i = 0; i < 8; i++) if ((c_town.town.timer_spec_times[i] > 0) && (party.age % c_town.town.timer_spec_times[i] == 0) && ((is_town() == TRUE) || ((is_combat() == TRUE) && (which_combat_type == 1)))) { @@ -1478,11 +1478,11 @@ BOOL special_increase_age(char mode) } else if (queue_position < 20){ special_queue[queue_position].queued_special = c_town.town.timer_specs[i]; - special_queue[queue_position].trigger_time = party.age; - special_queue[queue_position].type = 2; + special_queue[queue_position].trigger_time = party.age; + special_queue[queue_position].type = 2; special_queue[queue_position].mode = 9; special_queue[queue_position].where = location(); - queue_position++; + queue_position++; } } for (i = 0; i < 20; i++) @@ -1499,8 +1499,8 @@ BOOL special_increase_age(char mode) special_queue[queue_position].trigger_time = party.age; special_queue[queue_position].type = 0; special_queue[queue_position].mode = 10; - special_queue[queue_position].where = location(); - queue_position++; + special_queue[queue_position].where = location(); + queue_position++; } } for (i = 0; i < 30; i++) @@ -1575,7 +1575,7 @@ void run_special(short which_mode,short which_type,short start_spec,location spe give_error("The scenario called a special node while processing another special encounter. The second special will be ignored.","",0); return; } - + special_in_progress = TRUE; next_spec = start_spec; next_spec_type = which_type; @@ -1585,15 +1585,15 @@ void run_special(short which_mode,short which_type,short start_spec,location spe special_in_progress = FALSE; return; } - + while (next_spec >= 0) { - + cur_spec = next_spec; cur_spec_type = next_spec_type; next_spec = -1; cur_node = get_node(cur_spec,cur_spec_type); - if (cur_node.type == -1) { /// got an error + if (cur_node.type == -1) { /// got an error special_in_progress = FALSE; return; } @@ -1635,7 +1635,7 @@ void run_special(short which_mode,short which_type,short start_spec,location spe special_node_type get_node(short cur_spec,short cur_spec_type) { special_node_type dummy_node; - + dummy_node = scenario.scen_specials[0]; dummy_node.type = -1; if (cur_spec_type == 0) { @@ -1670,22 +1670,22 @@ void general_spec(short which_mode,special_node_type cur_node,short cur_spec_typ short store_val = 0,i; special_node_type spec; short mess_adj[3] = {160,10,20}; - + spec = cur_node; *next_spec = cur_node.jumpto; - + switch (cur_node.type) { case 0: break; // null spec case 1: check_mess = TRUE; setsd(cur_node.sd1,cur_node.sd2,cur_node.ex1a); - break; + break; case 2: check_mess = TRUE; setsd(cur_node.sd1,cur_node.sd2, PSD[cur_node.sd1][cur_node.sd2] + ((cur_node.ex1b == 0) ? 1 : -1) * cur_node.ex1a); - break; + break; case 3: - check_mess = TRUE;break; + check_mess = TRUE;break; case 5: get_strs((char *) str1,(char *) str2, cur_spec_type,cur_node.m1 + mess_adj[cur_spec_type], cur_node.m2 + mess_adj[cur_spec_type]); @@ -1693,32 +1693,32 @@ void general_spec(short which_mode,special_node_type cur_node,short cur_spec_typ ASB((char *) str1); if (cur_node.m2 >= 0) ASB((char *) str2); - break; + break; case 6: setsd(cur_node.sd1,cur_node.sd2, ((PSD[cur_node.sd1][cur_node.sd2] == 0) ? 1 : 0) ); - check_mess = TRUE;break; + check_mess = TRUE;break; case 7: if (is_out()) *next_spec = -1; if ((is_out()) && (spec.ex1a != 0) && (which_mode == 0)) { ASB("Can't go here while outdoors."); *a = 1; } - break; + break; case 8: if (is_town()) *next_spec = -1; if ((is_town()) && (spec.ex1a != 0) && (which_mode == 1)) { ASB("Can't go here while in town mode."); *a = 1; } - break; + break; case 9: if (is_combat()) *next_spec = -1; if ((is_combat()) && (spec.ex1a != 0) && (which_mode == 2)) { ASB("Can't go here during combat."); *a = 1; } - break; + break; case 10: if ((which_mode == 3) || (which_mode == 4)) *next_spec = -1; break; @@ -1832,8 +1832,8 @@ void general_spec(short which_mode,special_node_type cur_node,short cur_spec_typ for(i=0;i<6;i++)//temporary fix, maybe we'll do a special "you lose" dialog. if(adven[i].isAlive() == FALSE) store_val++; - - if(store_val != 6) + + if(store_val != 6) end_scenario = TRUE; break; case 28: @@ -1851,7 +1851,7 @@ void general_spec(short which_mode,special_node_type cur_node,short cur_spec_typ cd_create_custom_pic_dialog(mainPtr,displayed_picture); - while (dialog_not_toast) + while (dialog_not_toast) ModalDialog(); cd_kill_dialog(905,0); @@ -1874,7 +1874,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ special_node_type spec; item_record_type store_i; location l; - + spec = cur_node; *next_spec = cur_node.jumpto; if ((sd_legit(spec.sd1,spec.sd2) == TRUE) && (PSD[spec.sd1][spec.sd2] == 250)) { @@ -1919,7 +1919,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ for (i = 0; i < 3; i++) get_strs((char *) strs[i * 2],(char *) strs[i * 2 + 1],cur_spec_type, spec.m1 + i * 2 + spec_str_offset[cur_spec_type],spec.m1 + i * 2 + 1 + spec_str_offset[cur_spec_type]); - if (spec.m2 > 0) + if (spec.m2 > 0) {buttons[0] = 1; buttons[1] = spec.ex1a; buttons[2] = spec.ex2a; if ((spec.ex1a >= 0) || (spec.ex2a >= 0)) buttons[0] = 20; } if (spec.m2 <= 0) {buttons[0] = spec.ex1a;buttons[1] = spec.ex2a;} @@ -1938,7 +1938,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ if (spec.m2 > 0) { if (i == 1) { if ((spec.ex1a >= 0) || (spec.ex2a >= 0)) { - set_sd = FALSE; + set_sd = FALSE; } } if (i == 2) *next_spec = spec.ex1b; @@ -1994,7 +1994,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ else { l = party.p_loc.toLocal(); place_outd_wand_monst(l, - outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[spec.ex1a],TRUE); + outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[spec.ex1a],TRUE); } break; case 62: @@ -2010,7 +2010,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ buttons[0] = 3; buttons[1] = 2; i = custom_choice_dialog((char *) strs,727,buttons); } - else i = FCD(872,0); + else i = FCD(872,0); if (i == 1) {set_sd = FALSE; *next_spec = -1; *a = 1;} else { if (is_combat() == TRUE) @@ -2018,11 +2018,11 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ else { short tmp = select_pc(1,0); - + if (tmp == INVALID_PC) j = FALSE; else j = adven[tmp].runTrap(spec.ex1a,spec.ex1b,spec.ex2a); } - + if (j == 0) { *a = 1; @@ -2034,7 +2034,7 @@ void oneshot_spec(short which_mode,special_node_type cur_node,short cur_spec_typ if (check_mess == TRUE) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } - if ((set_sd == TRUE) && (sd_legit(spec.sd1,spec.sd2) == TRUE)) + if ((set_sd == TRUE) && (sd_legit(spec.sd1,spec.sd2) == TRUE)) PSD[spec.sd1][spec.sd2] = 250; } @@ -2045,7 +2045,7 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type Boolean check_mess = TRUE; short i,pc,r1; special_node_type spec; - + spec = cur_node; *next_spec = cur_node.jumpto; if((PSD[SDF_IS_PARTY_SPLIT] > 0) && (cur_node.type != SPEC_AFFECT_DEADNESS)) @@ -2117,7 +2117,7 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type if ((adven[i].main_status > MAIN_STATUS_ABSENT) && (adven[i].main_status < MAIN_STATUS_SPLIT)) adven[i].main_status=MAIN_STATUS_ALIVE; } - else + else if(party.stuff_done[309][1] == 0){//legacy behavior adven[i].kill(spec.ex1a + ((spec.ex1b == 2)? 22 : 12)); } @@ -2226,7 +2226,7 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type else r1 = spec.ex1a; for (i = 0; i < 6; i++) - if ((pc < 0) || (pc == i)) + if ((pc < 0) || (pc == i)) adven[i].mage_spells[r1 + 30] = spec.ex1b; break; case 100: @@ -2245,7 +2245,7 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type else r1 = spec.ex1a; for (i = 0; i < 6; i++) - if ((pc < 0) || (pc == i)) + if ((pc < 0) || (pc == i)) adven[i].priest_spells[r1 + 30] = spec.ex1b; break; case 101: @@ -2281,9 +2281,9 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 106: if (party.in_boat >= 0) - add_string_to_buf(" Can't fly when on a boat. "); + add_string_to_buf(" Can't fly when on a boat. "); else if (party.in_horse >= 0)//// - add_string_to_buf(" Can't fly when on a horse. "); + add_string_to_buf(" Can't fly when on a horse. "); else { r1 = (short) party.stuff_done[305][1]; r1 = minmax(0,250,r1 + spec.ex1a); @@ -2301,10 +2301,10 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type short i,j,k; special_node_type spec; location l; - + spec = cur_node; *next_spec = cur_node.jumpto; - + switch (cur_node.type) { case 130: if (sd_legit(spec.sd1,spec.sd2) == TRUE) { @@ -2324,7 +2324,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 133: if (spec.ex1a != minmax(0,49,(int)spec.ex1a)) { - give_error("Special item is out of range.","",0); + give_error("Special item is out of range.","",0); } else if (party.spec_items[spec.ex1a] > 0) *next_spec = spec.ex1b; @@ -2334,7 +2334,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type if (PSD[spec.ex1a][spec.ex1b] < PSD[spec.sd1][spec.sd2]) *next_spec = spec.ex2b; } - else give_error("A Stuff Done flag is out of range.","",0); + else give_error("A Stuff Done flag is out of range.","",0); break; case 135: if (((is_town()) || (is_combat())) && (t_d.terrain[spec.ex1a][spec.ex1b] == spec.ex2a)) @@ -2372,8 +2372,8 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type if (adven[i].isAlive()) for (j = 0; j < 24; j++) if ((adven[i].items[j].variety > 0) && (adven[i].items[j].special_class == spec.ex1a) - && (adven[i].equip[j] == TRUE)) - *next_spec = spec.ex1b; + && (adven[i].equip[j] == TRUE)) + *next_spec = spec.ex1b; break; case 142: if (party.gold >= spec.ex1a) { @@ -2409,7 +2409,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type for (j = 0; j < 24; j++) if ((adven[i].items[j].variety > 0) && (adven[i].items[j].special_class == spec.ex1a) && (adven[i].equip[j] == TRUE)) { - *next_spec = spec.ex1b; + *next_spec = spec.ex1b; *redraw = 1; adven[i].takeItem(j); } @@ -2420,15 +2420,15 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 148: for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (k = 0; k < town_size[town_type]; k++) if (is_barrel(j,k)) - *next_spec = spec.ex1b; + *next_spec = spec.ex1b; break; case 149: for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (k = 0; k < town_size[town_type]; k++) if (is_crate(j,k)) - *next_spec = spec.ex1b; + *next_spec = spec.ex1b; break; case 150: if (day_reached(spec.ex1a,spec.ex1b) == TRUE) @@ -2441,7 +2441,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 152: for (i = 0; i < 6; i++) - if ((adven[i].isAlive()) && (adven[i].traits[5] > 0)) + if ((adven[i].isAlive()) && (adven[i].traits[TRAIT_WOODSMAN] > 0)) *next_spec = spec.ex1b; break; case 153: //has enough statistic ? @@ -2454,12 +2454,12 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type *next_spec = spec.ex1b; break; } - + if((spec.ex2a < -1) || (spec.ex2a > 25)){ give_error("The check statistic node tried to check an out-of-range statistic (shoud be between 0 - strengh to 18 - luck and 25. -1 is default compatibility to check mage lore.).","",0); break; } - + if(current_pc_picked_in_spec_enc >= 0)// is a pc selected ? to_check = 10 + current_pc_picked_in_spec_enc; else @@ -2477,7 +2477,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type case 20: //max health if(k < adven[i].max_health) k = adven[i].max_health; - break; + break; case 21: //current spell points if(k < adven[i].cur_sp) k = adven[i].cur_sp; @@ -2514,7 +2514,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k += adven[i].max_health; - break; + break; case 21: //current spell points k += adven[i].cur_sp; break; @@ -2550,7 +2550,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type case 20: //max health if(k > adven[i].max_health) k = adven[i].max_health; - break; + break; case 21: //current spell points if(k > adven[i].cur_sp) k = adven[i].cur_sp; @@ -2576,7 +2576,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type k = adven[i].skills[spec.ex2a]; break; } - + break; case 10: //pc 1 if(adven[0].main_status == MAIN_STATUS_ALIVE) @@ -2586,7 +2586,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[0].max_health; - break; + break; case 21: //current spell points k = adven[0].cur_sp; break; @@ -2615,7 +2615,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[1].max_health; - break; + break; case 21: //current spell points k = adven[1].cur_sp; break; @@ -2635,7 +2635,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type k = adven[1].skills[spec.ex2a]; break; } - break; + break; case 12: //pc 3 if(adven[2].main_status == MAIN_STATUS_ALIVE) switch (spec.ex2a){ @@ -2644,7 +2644,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[2].max_health; - break; + break; case 21: //current spell points k = adven[2].cur_sp; break; @@ -2673,7 +2673,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[3].max_health; - break; + break; case 21: //current spell points k = adven[3].cur_sp; break; @@ -2702,7 +2702,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[4].max_health; - break; + break; case 21: //current spell points k = adven[4].cur_sp; break; @@ -2731,7 +2731,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k = adven[5].max_health; - break; + break; case 21: //current spell points k = adven[5].cur_sp; break; @@ -2751,7 +2751,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type k = adven[5].skills[spec.ex2a]; break; } - break; + break; default : // cumulative for(i = 0;i < 6;i++) if(adven[i].main_status == MAIN_STATUS_ALIVE) @@ -2761,7 +2761,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; case 20: //max health k += adven[i].max_health; - break; + break; case 21: //current spell points k += adven[i].cur_sp; break; @@ -2784,7 +2784,7 @@ void ifthen_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; } if (k >= spec.ex1a) - *next_spec = spec.ex1b; + *next_spec = spec.ex1b; break; case 154: // text response check_mess = FALSE; @@ -2838,12 +2838,12 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty location l; unsigned char ter; item_record_type store_i; - + spec = cur_node; *next_spec = cur_node.jumpto; - + l.x = spec.ex1a; l.y = spec.ex1b; - + if (is_out()) return; switch (cur_node.type) { @@ -2866,7 +2866,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty break; case 172: if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2a){ - set_terrain(l,spec.ex2b); + set_terrain(l,spec.ex2b); if(scenario.ter_types[spec.ex2b].special >= 16 && scenario.ter_types[spec.ex2b].special <=19) belt_present = TRUE; } @@ -2897,7 +2897,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty check_mess = FALSE; } else { // 1 no - if (which_mode < 3) + if (which_mode < 3) *a = 1; if ((which_mode == 7) || (spec.ex2a == 0)) teleport_party(spec.ex1a,spec.ex1b,1); @@ -2948,14 +2948,14 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty for (i = 0; i < T_M; i++) if (c_town.monst.dudes[i].number == spec.ex1a) { c_town.monst.dudes[i].active = 0; - } + } *redraw = 1; break; case 183: for (i = 0; i < T_M; i++) if ((c_town.monst.dudes[i].active > 0) && - (((spec.ex1a == 0) && (1 == 1)) || - ((spec.ex1a == 1) && (c_town.monst.dudes[i].attitude % 2 == 0)) || + (((spec.ex1a == 0) && (1 == 1)) || + ((spec.ex1a == 1) && (c_town.monst.dudes[i].attitude % 2 == 0)) || ((spec.ex1a == 2) && (c_town.monst.dudes[i].attitude % 2 == 1)))){ c_town.monst.dudes[i].active = 0; } @@ -2983,7 +2983,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty *next_spec = -1; } else if (FCD(870,0) == 1) { *next_spec = -1; if (which_mode < 3) *a = 1;} - else{ + else{ if (which_mode < 3) *a = 1; if ((which_mode == 7) || (spec.ex2a == 0)) @@ -2993,7 +2993,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty break; case 186: check_mess = FALSE; - if (FCD(871,0) == 2) + if (FCD(871,0) == 2) *next_spec = spec.ex1b; break; case 187: @@ -3031,7 +3031,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty else{ //town combat party.direction = end_town_combat(); set_stat_window(current_pc); - menu_activate(1); + menu_activate(1); } } *a = 1; @@ -3090,9 +3090,9 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty else { if (which_mode < 3) *a = 1; - if (spec.ex2a == 0) + if (spec.ex2a == 0) teleport_party(spec.ex1a,spec.ex1b,1); - else teleport_party(spec.ex1a,spec.ex1b,0); + else teleport_party(spec.ex1a,spec.ex1b,0); } } break; @@ -3117,11 +3117,11 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty if (spec.ex2b == 1) i = 2; else i = custom_choice_dialog((char *) strs,719,buttons) ; - - if (i == 1) { - *next_spec = -1; + + if (i == 1) { + *next_spec = -1; if(which_mode < 3) - *a = 1; + *a = 1; } else { if(overall_mode == MODE_TALKING) @@ -3138,7 +3138,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty else{ //town combat party.direction = end_town_combat(); set_stat_window(current_pc); - menu_activate(1); + menu_activate(1); } } *a = 1; @@ -3183,7 +3183,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty start_split(spec.ex1a,spec.ex1b,spec.ex2a); } else check_mess = FALSE; - } + } break; case 194: if (is_combat()) { @@ -3193,7 +3193,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty if (which_mode < 3) *a = 1; *next_spec = -1; - check_mess = FALSE; + check_mess = FALSE; end_split(spec.ex1a); break; case 195: @@ -3238,17 +3238,17 @@ void rect_spec(short which_mode,special_node_type cur_node,short cur_spec_type, special_node_type spec; location l; unsigned char ter; - + spec = cur_node; *next_spec = cur_node.jumpto; - + if (is_out()) return; - + *redraw = 1; for (i = spec.ex1b;i <= spec.ex2b;i++){ for (j = spec.ex1a; j <= spec.ex2a; j++) { - + l.x = i; l.y = j; switch (cur_node.type) { case 200: if (get_ran(1,1,100) <= spec.sd1 ) make_fire_wall(i,j); break; @@ -3272,22 +3272,22 @@ void rect_spec(short which_mode,special_node_type cur_node,short cur_spec_type, if ((t_i.items[k].variety > 0) && (same_point(t_i.items[k].item_loc,l) == TRUE)) { t_i.items[k].item_loc.x = spec.sd1; t_i.items[k].item_loc.y = spec.sd2; - } + } break; case 213: for (k = 0; k < NUM_TOWN_ITEMS; k++) if ((t_i.items[k].variety > 0) && (same_point(t_i.items[k].item_loc,l) == TRUE)) { t_i.items[k].variety = 0; - } + } break; case 214: - if (get_ran(1,1,100) <= spec.sd2){ + if (get_ran(1,1,100) <= spec.sd2){ set_terrain(l,spec.sd1); if(scenario.ter_types[spec.sd1].special >= 16 && scenario.ter_types[spec.sd1].special <=19) belt_present = TRUE; if(party.stuff_done[308][0] == 0) draw_map_rect(modeless_dialogs[5],l.x,l.y,l.x,l.y); - + } break; case 215: @@ -3345,12 +3345,12 @@ void outdoor_spec(short which_mode,special_node_type cur_node,short cur_spec_typ char str1[256] = "",str2[256] = ""; special_node_type spec; location l; - + spec = cur_node; *next_spec = cur_node.jumpto; - + if (is_out() == FALSE) return; - + switch (cur_node.type) { case 225: create_wand_monst(); *redraw = 1; @@ -3363,7 +3363,7 @@ void outdoor_spec(short which_mode,special_node_type cur_node,short cur_spec_typ out[l.x][l.y] = spec.ex2a; *redraw = 1; check_mess = TRUE; - break; + break; case 227: if (spec.ex1a != minmax(0,3,(int)spec.ex1a)) { give_error("Special outdoor enc. is out of range. Must be 0-3.","",0); @@ -3372,10 +3372,10 @@ void outdoor_spec(short which_mode,special_node_type cur_node,short cur_spec_typ else { l = party.p_loc.toLocal(); place_outd_wand_monst(l, - outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[spec.ex1a],TRUE); + outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[spec.ex1a],TRUE); check_mess = TRUE; } - break; + break; case 228: check_mess = TRUE; out_move_party(spec.ex1a,spec.ex1b); @@ -3397,9 +3397,9 @@ void outdoor_spec(short which_mode,special_node_type cur_node,short cur_spec_typ case 4: start_shop_mode(3,spec.ex1a,spec.ex1a + spec.ex2a - 1,spec.ex2b,(char *) str1); break; } *next_spec = -1; - break; + break; } - + if (check_mess == TRUE) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); } @@ -3419,16 +3419,16 @@ void handle_message(short which_mode,short cur_type,short mess1,short mess2,shor char str1[256] = "",str2[256] = ""; short label1 = -1,label2 = -1,label1b = -1,label2b = -1; short mess_adj[3] = {160,10,20}; - + if ((mess1 < 0) && (mess2 < 0)){ return; } if (which_mode == 7) { // talking - *a = mess1 + ((mess1 >= 0) ? mess_adj[cur_type] : 0); + *a = mess1 + ((mess1 >= 0) ? mess_adj[cur_type] : 0); *b = mess2 + ((mess2 >= 0) ? mess_adj[cur_type] : 0); return; } - get_strs((char *) str1,(char *) str2, cur_type, mess1 + ((mess1 >= 0) ? mess_adj[cur_type] : 0), + get_strs((char *) str1,(char *) str2, cur_type, mess1 + ((mess1 >= 0) ? mess_adj[cur_type] : 0), mess2 + ((mess2 >= 0) ? mess_adj[cur_type] : 0)) ; if (mess1 >= 0) { label1 = 1000 * cur_type + mess1 + mess_adj[cur_type]; @@ -3440,14 +3440,14 @@ void handle_message(short which_mode,short cur_type,short mess1,short mess2,shor label2b = (is_out()) ? (party.outdoor_corner.x + party.i_w_c.x) + scenario.out_width * (party.outdoor_corner.y + party.i_w_c.y) : c_town.town_num; } - display_strings((char *) str1, (char *) str2,label1,label2, label1b,label2b, + display_strings((char *) str1, (char *) str2,label1,label2, label1b,label2b, "",57,1600 + scenario.intro_pic,0); } - -void get_strs(char *str1,char *str2,short cur_type,short which_str1,short which_str2) + +void get_strs(char *str1,char *str2,short cur_type,short which_str1,short which_str2) { short num_strs[3] = {260,108,135}; - + if (((which_str1 >= 0) && (which_str1 != minmax((short) 0,num_strs[cur_type],which_str1))) || ((which_str2 >= 0) && (which_str2 != minmax((short) 0,num_strs[cur_type],which_str2)))) { give_error("The scenario attempted to access a message out of range.","",0); @@ -3459,21 +3459,21 @@ void get_strs(char *str1,char *str2,short cur_type,short which_str1,short which_ if (which_str1 < 160) strcpy((char *) str1,data_store5->scen_strs[which_str1]); else strcpy((char *) str1,scen_strs2[which_str1 - 160]); - + } if (which_str2 >= 0){ if (which_str2 < 160) strcpy((char *) str2,data_store5->scen_strs[which_str2]); - else strcpy((char *) str2,scen_strs2[which_str2 - 160]); + else strcpy((char *) str2,scen_strs2[which_str2 - 160]); } break; case 1: if (which_str1 >= 0) - load_outdoors(party.outdoor_corner.x + party.i_w_c.x, + load_outdoors(party.outdoor_corner.x + party.i_w_c.x, party.outdoor_corner.y + party.i_w_c.y, party.i_w_c.x, party.i_w_c.y, 1,which_str1,(char *) str1); if (which_str2 >= 0) - load_outdoors(party.outdoor_corner.x + party.i_w_c.x, + load_outdoors(party.outdoor_corner.x + party.i_w_c.x, party.outdoor_corner.y + party.i_w_c.y, party.i_w_c.x, party.i_w_c.y, 1,which_str2,(char *) str2); break; diff --git a/Win32/Blades of Exile/classes/LOCATION.CPP b/Win32/Blades of Exile/classes/LOCATION.CPP index e5267c6a..81926bf0 100644 --- a/Win32/Blades of Exile/classes/LOCATION.CPP +++ b/Win32/Blades of Exile/classes/LOCATION.CPP @@ -12,11 +12,11 @@ location location::toGlobal() { //return local_to_global(*this); - + location global = *this; - if (party.i_w_c.x == 1) global.x = global.x + 48; + if (party.i_w_c.x == 1) global.x = global.x + 48; if (party.i_w_c.y == 1) global.y = global.y + 48; - return global; + return global; } location location::toLocal() @@ -24,9 +24,9 @@ location location::toLocal() // return global_to_local(*this); location local = (*this); - if (party.i_w_c.x == 1) local.x = local.x - 48; + if (party.i_w_c.x == 1) local.x = local.x - 48; if (party.i_w_c.y == 1) local.y = local.y - 48; - return local; + return local; } short location::countWalls() const @@ -38,12 +38,12 @@ short location::countWalls() const for (k = 0; k < 31 ; k++) { - if (out[x + 1][y] == walls[k]) answer++; - if (out[x - 1][y] == walls[k]) answer++; - if (out[x][y + 1] == walls[k]) answer++; - if (out[x][y - 1] == walls[k]) answer++; + if (out[x + 1][y] == walls[k]) answer++; + if (out[x - 1][y] == walls[k]) answer++; + if (out[x][y + 1] == walls[k]) answer++; + if (out[x][y - 1] == walls[k]) answer++; } - return answer; + return answer; } // 0 if no pull. @@ -61,7 +61,7 @@ short location::handleLever() void location::crumbleWall() { unsigned char ter; - + if (loc_off_act_area(*this) == TRUE) return; ter = t_d.terrain[x][y]; @@ -70,7 +70,7 @@ void location::crumbleWall() t_d.terrain[x][y] = scenario.ter_types[ter].flag1; if(scenario.ter_types[scenario.ter_types[ter].flag1].special >= 16 && scenario.ter_types[scenario.ter_types[ter].flag1].special <=19) belt_present = TRUE; - add_string_to_buf(" Barrier crumbles."); + add_string_to_buf(" Barrier crumbles."); } } @@ -90,9 +90,9 @@ void location::pickLock(short pc_num) short r1,which_item; Boolean will_break = FALSE; short unlock_adjust; - + terrain = t_d.terrain[x][y]; - which_item = adven[pc_num].hasAbilEquip(161); + which_item = adven[pc_num].hasAbilEquip(ITEM_LOCKPICKS); if (which_item == 24) { add_string_to_buf(" Need lockpick equipped. "); return; @@ -103,21 +103,21 @@ void location::pickLock(short pc_num) if (r1 < 75) will_break = TRUE; - r1 = get_ran(1,0,100) - 5 * adven[pc_num].statAdj(1) + c_town.difficulty * 7 - - 5 * adven[pc_num].skills[15] - adven[pc_num].items[which_item].ability_strength * 7; + r1 = get_ran(1,0,100) - 5 * adven[pc_num].statAdj(SKILL_DEXTERITY) + c_town.difficulty * 7 + - 5 * adven[pc_num].skills[SKILL_LOCKPICKING] - adven[pc_num].items[which_item].ability_strength * 7; // Nimble? if (adven[pc_num].traits[TRAIT_NIMBLE] == TRUE) r1 -= 8; - if (adven[pc_num].hasAbilEquip(42) < 24) - r1 = r1 - 12; + if (adven[pc_num].hasAbilEquip(ITEM_THIEVING) < 24) + r1 = r1 - 12; if ((scenario.ter_types[terrain].special < 9) || (scenario.ter_types[terrain].special > 10)) { add_string_to_buf(" Wrong terrain type. "); return; } unlock_adjust = scenario.ter_types[terrain].flag2; - if ((unlock_adjust >= 5) || (r1 > (90 - unlock_adjust * 15))) { + if ((unlock_adjust >= 5) || (r1 > (90 - unlock_adjust * 15))) { add_string_to_buf(" Didn't work. "); if (will_break == TRUE) { @@ -125,7 +125,7 @@ void location::pickLock(short pc_num) adven[pc_num].removeCharge(which_item); } play_sound(41); - } + } else { add_string_to_buf(" Door unlocked. "); play_sound(9); @@ -143,7 +143,7 @@ void location::bashDoor(short pc_num) terrain = t_d.terrain[x][y]; r1 = get_ran(1,0,100) - 15 * adven[pc_num].statAdj(0) + c_town.difficulty * 4; - + if ((scenario.ter_types[terrain].special < 9) || (scenario.ter_types[terrain].special > 10)) { add_string_to_buf(" Wrong terrain type. "); @@ -151,12 +151,12 @@ void location::bashDoor(short pc_num) } unlock_adjust = scenario.ter_types[terrain].flag2; - - if ((unlock_adjust >= 5) || (r1 > (100 - unlock_adjust * 15)) || (scenario.ter_types[terrain].special != 10)) + + if ((unlock_adjust >= 5) || (r1 > (100 - unlock_adjust * 15)) || (scenario.ter_types[terrain].special != 10)) { add_string_to_buf(" Didn't work. "); adven[pc_num].damage(get_ran(1,1,4),4,-1); - } + } else { add_string_to_buf(" Lock breaks. "); diff --git a/Win32/Blades of Exile/classes/PC.CPP b/Win32/Blades of Exile/classes/PC.CPP index 1c421da7..8eb786fd 100644 --- a/Win32/Blades of Exile/classes/PC.CPP +++ b/Win32/Blades of Exile/classes/PC.CPP @@ -19,7 +19,7 @@ void pc_record_type::kill(short type) short i = 24; bool dummy, no_save = false, no_luck = false; location item_loc; - + if (type >= 20) { type -= 10; @@ -28,19 +28,19 @@ void pc_record_type::kill(short type) if(type >= 10) { type -= 10; - no_luck = true; + no_luck = true; } - + if(no_save == false){ if (type != 4) i = hasAbilEquip(48); //check if has life saving items else i = hasAbilEquip(49); //check if has protection vs petrification items } - + short which_pc = getNum(); - if ((no_luck == false) && (type != 0) && (skills[SKILL_LUCK] > 0) && + if ((no_luck == false) && (type != 0) && (skills[SKILL_LUCK] > 0) && (get_ran(1,0,100) < hit_chance[skills[SKILL_LUCK]])) { add_string_to_buf(" But you luck out! "); cur_health = 0; @@ -48,18 +48,18 @@ void pc_record_type::kill(short type) else if ((i == 24) || (type == 0)) { if (combat_active_pc == which_pc) combat_active_pc = 6; - + for (i = 0; i < 24; i++) equip[i] = false; item_loc = (overall_mode >= MODE_COMBAT) ? pc_pos[which_pc] : c_town.p_loc; - + if (type == 2) make_sfx(item_loc.x,item_loc.y,3); else if (type == 3) make_sfx(item_loc.x,item_loc.y,6); - - if (overall_mode != 0) + + if (overall_mode != 0) for (i = 0; i < 24; i++) if (items[i].variety != 0) { dummy = place_item(items[i],item_loc,true); @@ -88,13 +88,13 @@ void pc_record_type::kill(short type) } current_pc = first_active_pc(); - + if (current_pc > 5) { for (i = 0; i < NUM_OF_PCS; i++) if (adven[i].status > 0) current_pc = i; } - + put_pc_screen(); set_stat_window(current_pc); } @@ -106,20 +106,20 @@ bool pc_record_type::runTrap(short trap_type, short trap_level, short diff) 78,80,82,84,86, 88,90,92,94,96,98,99,99,99,99,99,99,99,99,99}; num_hits += trap_level; - + if (trap_type == TRAP_RANDOM) trap_type = get_ran(1,1,4); - + /// ??? => no trap after all ;) if (trap_type == 6) return true; - - i = statAdj(1); - - if ((i_level = getProtLevel(42)) > 0) + + i = statAdj(SKILL_DEXTERITY); + + if ((i_level = getProtLevel(ITEM_THIEVING)) > 0) i += i_level / 2; - - skill = minmax(0, 20, skills[14] + skills[SKILL_LUCK] / 2 + 1 - c_town.difficulty + 2 * i); + + skill = minmax(0, 20, skills[SKILL_DISARM_TRAPS] + skills[SKILL_LUCK] / 2 + 1 - c_town.difficulty + 2 * i); r1 = get_ran(1,0,100) + diff; // Nimble? @@ -131,7 +131,7 @@ bool pc_record_type::runTrap(short trap_type, short trap_level, short diff) return true; } else add_string_to_buf(" Disarm failed. "); - + switch (trap_type) { case TRAP_BLADE: @@ -141,65 +141,65 @@ bool pc_record_type::runTrap(short trap_type, short trap_level, short diff) damage(get_ran(2 + c_town.difficulty / 14,1,10),DAMAGE_WEAPON,-1); } break; - + case TRAP_DART: add_string_to_buf(" A dart flies out. "); poison((3 + c_town.difficulty / 14) + (trap_level * 2)); break; - + case TRAP_GAS: add_string_to_buf(" Poison gas pours out. "); adven.poison((2 + c_town.difficulty / 14) + trap_level * 2); break; - - case TRAP_EXPLOSION: + + case TRAP_EXPLOSION: for (i = 0; i < num_hits; i++) { add_string_to_buf(" There is an explosion. "); adven.damage(get_ran(3 + c_town.difficulty / 13,1,8), DAMAGE_FIRE); } break; - + case TRAP_SLEEP_RAY: add_string_to_buf(" A purple ray flies out. "); sleep((200 + c_town.difficulty * 100) + (trap_level * 400),12,50); break; - + case TRAP_DRAIN_XP: add_string_to_buf(" You feel weak. "); experience = max(0, experience - (40 + trap_level * 30)); break; - + case TRAP_ALERT: add_string_to_buf(" An alarm goes off!!! "); set_town_status(0); break; - case TRAP_FLAMES: + case TRAP_FLAMES: add_string_to_buf(" Flames shoot from the walls. "); adven.damage(get_ran(10 + trap_level * 5,1,8),DAMAGE_FIRE); break; - - case TRAP_DUMBFOUND: + + case TRAP_DUMBFOUND: add_string_to_buf(" You feel disoriented. "); adven.dumbfound(2 + trap_level * 2); break; - + case TRAP_DISEASE: add_string_to_buf(" You prick your finger. "); disease((3 + c_town.difficulty / 14) + (trap_level * 2)); break; - + case TRAP_DISEASE_ALL: add_string_to_buf(" A foul substance sprays out."); adven.disease((2 + c_town.difficulty / 14) + (trap_level * 2)); break; - + default: add_string_to_buf(" (ERROR: Unknown type of trap!)"); break; } - + put_pc_screen(); put_item_screen(stat_window,0); return true; @@ -208,24 +208,24 @@ bool pc_record_type::runTrap(short trap_type, short trap_level, short diff) short pc_record_type::statAdj(short which) { short tr; - + tr = skill_bonus[skills[which]]; - - if (which == 2) { - if (traits[1] == true) tr++; - if (hasAbilEquip(40) < 24) tr++; + + if (which == 2) { //2 = SKILL_INTELLIGENCE + if (traits[TRAIT_MAGICALLY_APT] == true) tr++; + if (hasAbilEquip(ITEM_INTELLIGENCE) < 24) tr++; } - - if (which == 0) - if (traits[8] == true) tr++; - if (hasAbilEquip(38) < 24) + + if (which == 0) // 0 = SKILL_STRENGTH + if (traits[TRAIT_STRENGTH] == true) tr++; + if (hasAbilEquip(ITEM_STRENGTH) < 24) tr++; - - if (which == 1) { - if (hasAbilEquip(39) < 24) + + if (which == 1) { // 1 = SKILL_DEXTERITY + if (hasAbilEquip(ITEM_DEXTERITY) < 24) tr++; } - + return tr; } @@ -234,23 +234,23 @@ void pc_record_type::giveXP(short amt) short adjust,add_hp; short xp_percent[30] = {150,120,100,90,80,70,60,50,50,50, 45,40,40,40,40,35,30,25,23,20, - 15,15,15,15,15,15,15,15,15,15}; - + 15,15,15,15,15,15,15,15,15,15}; + if (!isAlive()) return; - + if (level > 49) { level = 50; return; } - + if (amt > 200) { // debug MessageBeep(MB_OK); ASB("Oops! Too much xp!"); ASB("Report this!"); return; } - + if (amt < 0) { // debug MessageBeep(MB_OK); ASB("Oops! Negative xp!"); @@ -265,13 +265,13 @@ void pc_record_type::giveXP(short amt) { if (get_ran(1,0,100) < xp_percent[level / 2]) amt--; } - + if (amt <= 0) return; experience += (max(((amt * adjust) / 100), 0) * 100) / 100; - + party.total_xp_gained += (max(((amt * adjust) / 100), 0) * 100) / 100; - + if (experience < 0) { MessageBeep(MB_OK); ASB("Oops! Xp became negative somehow!"); @@ -279,33 +279,33 @@ void pc_record_type::giveXP(short amt) experience = level * (get_tnl(this)) - 1; return; } - + if (experience > 15000) { experience = 15000; return; } - + while (experience >= (level * (get_tnl(this)))) { play_sound(7); level++; - + sprintf ((char *) c_line, " %s is level %d! ",(char *) name, level); - add_string_to_buf((char *) c_line); + add_string_to_buf((char *) c_line); skill_pts += (level < 20) ? 5 : 4; add_hp = (level < 26) ? get_ran(1,2,6) + skill_bonus[skills[0]] : max (skill_bonus[skills[0]],0); - + if (add_hp < 0) add_hp = 0; max_health += add_hp; - + if (max_health > 250) max_health = 250; cur_health += add_hp; - + if (cur_health > 250) cur_health = 250; - - put_pc_screen(); + + put_pc_screen(); } } @@ -334,18 +334,18 @@ void pc_record_type::cure(short amt) status[STATUS_POISON] = 0; else status[STATUS_POISON] -= amt; - + one_sound(51); } void pc_record_type::curse(short how_much) { if (!isAlive()) return; - + status[STATUS_BLESS_CURSE] = max(status[STATUS_BLESS_CURSE] - how_much, -8); sprintf ((char *) c_line, " %s cursed.",(char *) name); add_string_to_buf((char *) c_line); - + put_pc_screen(); give_help(59,0,0); } @@ -355,23 +355,23 @@ void pc_record_type::dumbfound(short how_much) short r1; if (!isAlive()) return; - + r1 = get_ran(1,0,90); - + if (hasAbilEquip(53) < 24) { add_string_to_buf(" Ring of Will glows."); r1 -= 10; } - + if (r1 < level) how_much -= 2; - + if (how_much <= 0) { sprintf ((char *) c_line, " %s saved.",(char *) name); add_string_to_buf((char *) c_line); return; } - + status[STATUS_DUMB] = min(status[STATUS_DUMB] + how_much, 8); sprintf ((char *) c_line, " %s dumbfounded.",(char *) name); add_string_to_buf((char *) c_line); @@ -387,28 +387,28 @@ void pc_record_type::disease(short how_much) short r1, tlevel; if (!isAlive()) return; - + r1 = get_ran(1,0,100); - + if (r1 < level * 2) how_much -= 2; - + if (how_much <= 0) { - sprintf ((char *) c_line, " %s saved.",(char *) name); - add_string_to_buf((char *) c_line); + sprintf (c_line, " %s saved.", name); + add_string_to_buf(c_line); return; } - if ((tlevel = getProtLevel(62)) > 0) + if ((tlevel = getProtLevel(ITEM_PROTECT_FROM_DISEASE)) > 0) how_much -= tlevel / 2; - - if ((traits[12] == true) && (how_much > 1)) how_much++; - if ((traits[12] == true) && (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; - + + if ((traits[TRAIT_FRAIL] == true) && (how_much > 1)) how_much++; + if ((traits[TRAIT_FRAIL] == true) && (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; + status[STATUS_DISEASE] = min(status[STATUS_DISEASE] + how_much,8); - sprintf ((char *) c_line, " %s diseased.",(char *) name); - add_string_to_buf((char *) c_line); + sprintf (c_line, " %s diseased.", name); + add_string_to_buf(c_line); one_sound(66); put_pc_screen(); @@ -421,37 +421,37 @@ void pc_record_type::sleep(short how_much,short what_type,short adjust) { short r1, tlevel; if (!isAlive()) return; - + if (how_much == 0) return; - + if ((what_type == STATUS_ASLEEP) || (what_type == STATUS_PARALYZED)) { //// - if ((tlevel = getProtLevel(53)) > 0) + if ((tlevel = getProtLevel(ITEM_WILL)) > 0) how_much -= tlevel / 2; - if ((tlevel = getProtLevel(54)) > 0) + if ((tlevel = getProtLevel(ITEM_FREE_ACTION)) > 0) how_much -= (what_type == STATUS_ASLEEP) ? tlevel : tlevel * 300; } - + r1 = get_ran(1,0,100) + adjust; if (r1 < 30 + level * 2) how_much = -1; - if ((what_type == STATUS_ASLEEP) && ((traits[7] > 0) || (status[STATUS_ASLEEP] < 0))) + if ((what_type == STATUS_ASLEEP) && ((traits[TRAIT_HIGHLY_ALERT] > 0) || (status[STATUS_ASLEEP] < 0))) how_much = -1; if (how_much <= 0) { - sprintf ((char *) c_line, " %s resisted.",(char *) name); - add_string_to_buf((char *) c_line); + sprintf (c_line, " %s resisted.", name); + add_string_to_buf( c_line); return; } if (isAlive()) { status[what_type] = how_much; if (what_type == STATUS_ASLEEP) - sprintf ((char *) c_line, " %s falls asleep.",(char *) name); - else sprintf ((char *) c_line, " %s paralyzed.",(char *) name); + sprintf (c_line, " %s falls asleep.", name); + else sprintf (c_line, " %s paralyzed.", name); if (what_type == STATUS_ASLEEP) play_sound(96); else play_sound(90); - add_string_to_buf((char *) c_line); + add_string_to_buf(c_line); pc_moves[getNum()] = 0; } put_pc_screen(); @@ -463,7 +463,7 @@ void pc_record_type::sleep(short how_much,short what_type,short adjust) void pc_record_type::slow(short how_much) { if (!isAlive()) return; - + status[STATUS_HASTE_SLOW] = minmax(-8,8,status[STATUS_HASTE_SLOW] - how_much); if (how_much < 0) sprintf ((char *) c_line, " %s hasted.",(char *) name); @@ -478,7 +478,7 @@ void pc_record_type::slow(short how_much) void pc_record_type::web(short how_much) { if (!isAlive()) return; - + status[STATUS_WEBS] = min(status[STATUS_WEBS] + how_much,8); sprintf ((char *) c_line, " %s webbed.",(char *) name); add_string_to_buf((char *) c_line); @@ -491,18 +491,18 @@ void pc_record_type::web(short how_much) void pc_record_type::acid(short how_much) { if (!isAlive()) return; - + if (hasAbilEquip(36) < 24) { sprintf ((char *) c_line, " %s resists acid.",(char *) name); add_string_to_buf((char *) c_line); return; } - + status[STATUS_ACID] += how_much; sprintf ((char *) c_line, " %s covered with acid!",(char *) name); add_string_to_buf((char *) c_line); one_sound(42); - + put_pc_screen(); } @@ -510,9 +510,9 @@ void pc_record_type::heal(short amt) { if (!isAlive()) return; if (cur_health > max_health) return; - + cur_health += amt; - + if (cur_health > max_health) cur_health = max_health; } @@ -523,11 +523,11 @@ void pc_record_type::sortItems() short item_priority[26] = {20,8,8,20,9, 9,3,2,1,0, 7,20,10,10,10, 10,10,10,5,6, 4,11,12,9,9, 9}; bool no_swaps = false, store_equip; int i; - + while (no_swaps == false) { no_swaps = true; for (i = 0; i < 23; i++) - if (item_priority[items[i + 1].variety] < + if (item_priority[items[i + 1].variety] < item_priority[items[i].variety]) { no_swaps = false; store_item = items[i + 1]; @@ -547,12 +547,12 @@ void pc_record_type::sortItems() short pc_record_type::getNum() { short i; - + for (i = 0; i < NUM_OF_PCS; i++) { if (&adven[i] == this) break;; } - + return i; } @@ -560,10 +560,10 @@ bool pc_record_type::giveToPC(item_record_type item, bool print_result) { short free_space; char announce_string[60]; - + if (item.variety == 0) return true; - + if (item.variety == 3) { party.gold += item.item_level; ASB("You get some gold."); @@ -614,13 +614,13 @@ short pc_record_type::getProtLevel(short abil) for (int i = 0; i < 24; i++) if ((items[i].variety != 0) && (items[i].ability == abil) && (equip[i] == true)) return items[i].ability_strength; - return (-1); + return (-1); } short pc_record_type::hasAbilEquip(short abil) { short i = 0; - + while (((items[i].variety == 0) || (items[i].ability != abil) || (equip[i] == false)) && (i < 24)) i++; @@ -630,48 +630,48 @@ short pc_record_type::hasAbilEquip(short abil) short pc_record_type::hasAbil(short abil) { short i = 0; - + while (((items[i].variety == 0) || (items[i].ability != abil)) && (i < 24)) i++; return i; } short pc_record_type::amountCanCarry() { - return 100 + (15 * min(skills[0],20)) + ((traits[8] == 0) ? 0 : 30) - + ((traits[14] == 0) ? 0 : -50); + return 100 + (15 * min(skills[0],20)) + ((traits[TRAIT_STRENGTH] == 0) ? 0 : 30) + + ((traits[TRAIT_BAD_BACK] == 0) ? 0 : -50); } short pc_record_type::amountCarried() { short i, storage = 0; bool airy = false, heavy = false; - - for (i = 0; i < 24; i++) + + for (i = 0; i < 24; i++) if (items[i].variety > 0) { storage += item_weight(items[i]); if (items[i].ability == 44) airy = true; if (items[i].ability == 45) heavy = true; } - + if (airy) storage -= 30; if (heavy) storage += 30; if (storage < 0) storage = 0; - + return storage; } short pc_record_type::hasSpace() { int i = 0; - + while (i < 24) { if (items[i].variety == 0) return i; i++; } - + return 24; } @@ -679,7 +679,7 @@ short pc_record_type::hasSpace() short pc_record_type::okToBuy(short cost, item_record_type item) { int i; - + if ((item.variety != 3) && (item.variety != 11)) { for (i = 0; i < 24; i++) if ((items[i].variety > 0) && (items[i].type_flag == item.type_flag) @@ -689,7 +689,7 @@ short pc_record_type::okToBuy(short cost, item_record_type item) if (hasSpace() == 24) return 2; if (item_weight(item) > amountCanCarry() - amountCarried()) return 4; } - + if (party.takeGold(cost, false) == false) return 3; return 1; @@ -700,27 +700,27 @@ void pc_record_type::takeItem(short which_item) { int i; bool do_print = true; - + if (which_item >= 30) { do_print = false; which_item -= 30; } - + if ((weap_poisoned == which_item) && (status[0] > 0)) { add_string_to_buf(" Poison lost. "); status[0] = 0; } - - if ((weap_poisoned > which_item) && (status[0] > 0)) + + if ((weap_poisoned > which_item) && (status[0] > 0)) weap_poisoned--; - + for (i = which_item; i < 23; i++) { items[i] = items[i + 1]; equip[i] = equip[i + 1]; } items[23] = return_dummy_item(); equip[23] = false; - + if ((stat_window == getNum()) && (do_print)) put_item_screen(stat_window,1); } @@ -743,9 +743,9 @@ void pc_record_type::enchantWeapon(short item_hit, short enchant_type, short new char store_name[60]; if ((items[item_hit].isMagic()) || (items[item_hit].ability != 0)) return; - + items[item_hit].item_properties |= 4; - + switch (enchant_type) { case 0: sprintf((char *)store_name,"%s (+1)", items[item_hit].full_name); @@ -804,7 +804,7 @@ void pc_record_type::equipItem(short item_num) short num_hands_occupied = 0; short i; short equip_item_type = 0; - + if ((overall_mode == MODE_COMBAT) && (items[item_num].variety == 11)) add_string_to_buf("Equip: Not in combat"); else { @@ -827,18 +827,18 @@ void pc_record_type::equipItem(short item_num) if (equippable[items[item_num].variety] == false) add_string_to_buf("Equip: Can't equip this item."); else { - for (i = 0; i < 24; i++) + for (i = 0; i < 24; i++) if (equip[i] == true) { if (items[i].variety == items[item_num].variety) num_equipped_of_this_type++; num_hands_occupied = num_hands_occupied + num_hands_to_use[items[i].variety]; } - - + + equip_item_type = excluding_types[items[item_num].variety]; // Now if missile is already equipped, no more missiles if (equip_item_type > 0) { - for (i = 0; i < 24; i++) + for (i = 0; i < 24; i++) if ((equip[i] == true) && (excluding_types[items[i].variety] == equip_item_type)) { add_string_to_buf("Equip: You have something of"); add_string_to_buf(" this type equipped."); @@ -857,7 +857,7 @@ void pc_record_type::equipItem(short item_num) add_string_to_buf("Equip: OK"); } } - + } } @@ -872,11 +872,11 @@ void pc_record_type::dropItem(short item_num, location where_drop) item_record_type item_store; bool take_given_item = true; location loc; - + item_store = items[item_num]; - if ((equip[item_num] == true) && (items[item_num].isCursed())) - add_string_to_buf("Drop: Item is cursed. "); + if ((equip[item_num] == true) && (items[item_num].isCursed())) + add_string_to_buf("Drop: Item is cursed. "); else switch (overall_mode) { case 0: choice = fancy_choice_dialog(1093,0); @@ -891,7 +891,7 @@ void pc_record_type::dropItem(short item_num, location where_drop) } else takeItem(item_num); break; - + case 5: case 15: loc = where_drop; if ((item_store.type_flag > 0) && (item_store.charges > 1)) { @@ -914,7 +914,7 @@ void pc_record_type::dropItem(short item_num, location where_drop) else add_string_to_buf("Drop: OK"); items[item_num].charges -= how_many; if (take_given_item) takeItem(item_num); - } + } break; } } @@ -925,7 +925,7 @@ void pc_record_type::giveThing(short item_num) item_record_type item_store; bool take_given_item = true; short pc_num = getNum(); - + if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Give: Item is cursed. "); else { @@ -936,7 +936,7 @@ void pc_record_type::giveThing(short item_num) who_to = 6; } - if ((who_to < 6) && (who_to != pc_num) + if ((who_to < 6) && (who_to != pc_num) && ((overall_mode != MODE_COMBAT) || (adjacent(pc_pos[pc_num],pc_pos[who_to]) == true))) { if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); @@ -946,9 +946,9 @@ void pc_record_type::giveThing(short item_num) take_given_item = false; items[item_num].charges -= how_many; item_store.charges = how_many; - } + } if (adven[who_to].giveToPC(item_store,0) == true) { - if (take_given_item) takeItem(item_num); + if (take_given_item) takeItem(item_num); } else { if (adven[who_to].hasSpace() == 24) @@ -956,7 +956,7 @@ void pc_record_type::giveThing(short item_num) else ASB("Can't give: PC carrying too much."); if (how_many > 0) items[item_num].charges += how_many; - } + } } } } @@ -964,12 +964,12 @@ void pc_record_type::giveThing(short item_num) void pc_record_type::combineThings() { int i,j,test; - + for (i = 0; i < 24; i++) { - if ((items[i].variety > 0) && (items[i].type_flag > 0) && (items[i].isIdent())) + if ((items[i].variety > 0) && (items[i].type_flag > 0) && (items[i].isIdent())) { for (j = i + 1; j < 24; j++) - if ((items[j].variety > 0) && (items[j].type_flag == items[i].type_flag) && (items[j].isIdent())) + if ((items[j].variety > 0) && (items[j].type_flag == items[i].type_flag) && (items[j].isIdent())) { add_string_to_buf("(items combined)"); test = items[i].charges + items[j].charges; @@ -984,7 +984,7 @@ void pc_record_type::combineThings() } takeItem(30 + j); } - } + } if ((items[i].variety > 0) && (items[i].charges < 0)) items[i].charges = 1; } diff --git a/Win32/Blades of Exile/classes/consts.h b/Win32/Blades of Exile/classes/consts.h index 92362761..785be718 100644 --- a/Win32/Blades of Exile/classes/consts.h +++ b/Win32/Blades of Exile/classes/consts.h @@ -36,7 +36,7 @@ #define SDF_EASY_MODE 306][7 #define SDF_LESS_WANDER_ENC 306][8 #define SDF_NO_TER_ANIM 306][9 -#define SDF_HIDDEN_MAP 308][0 +#define SDF_HIDDEN_MAP 308][0 #define SDF_LEGACY_SCENARIO 305][8 //0 is new scenario, 1 is legacy #define INVALID_TOWN 200 @@ -148,6 +148,49 @@ enum eStatus { STATUS_ASLEEP = 11, STATUS_PARALYZED = 12, STATUS_ACID = 13, +}; + +/* adven[i].skills */ //complete +enum eSkill { + SKILL_STRENGTH = 0, + SKILL_DEXTERITY = 1, + SKILL_INTELLIGENCE = 2, + SKILL_EDGED_WEAPONS = 3, + SKILL_BASHING_WEAPONS = 4, + SKILL_POLE_WEAPONS = 5, + SKILL_THROWN_MISSILES = 6, + SKILL_ARCHERY = 7, + SKILL_DEFENSE = 8, + SKILL_MAGE_SPELLS = 9, + SKILL_PRIEST_SPELLS = 10, + SKILL_MAGE_LORE = 11, + SKILL_ALCHEMY = 12, + SKILL_ITEM_LORE = 13, + SKILL_DISARM_TRAPS = 14, + SKILL_LOCKPICKING = 15, + SKILL_ASSASSINATION = 16, + SKILL_POISON = 17, + SKILL_LUCK = 18, +}; + +/* adven[i].traits */ //complete +enum eTrait { + TRAIT_TOUGHNESS = 0, + TRAIT_MAGICALLY_APT = 1, + TRAIT_AMBIDEXTROUS = 2, + TRAIT_NIMBLE = 3, + TRAIT_CAVE_LORE = 4, + TRAIT_WOODSMAN = 5, + TRAIT_GOOD_CONST = 6, + TRAIT_HIGHLY_ALERT = 7, + TRAIT_STRENGTH = 8, + TRAIT_RECUPERATION = 9, + TRAIT_SLUGGISH = 10, + TRAIT_MAGICALLY_INEPT = 11, + TRAIT_FRAIL = 12, + TRAIT_CHRONIC_DISEASE = 13, + TRAIT_BAD_BACK = 14, + TRAIT_PACIFIST = 15, }; /* Monster Type */ @@ -224,62 +267,62 @@ enum eMonstAbil { //at least for proper code comprehension //legacy spec_skill -/* Special Ability a.k.a spec_skill */ - -/* #define MONSTER_NO_SPECIAL_ABILITY 0 - #define MONSTER_THROWS_DARTS 1 - #define MONSTER_SHOOTS_ARROWS 2 - #define MONSTER_THROWS_SPEARS 3 - #define MONSTER_THROWS_ROCKS1 4 //4-24 damages - #define MONSTER_THROWS_ROCKS2 5 //5-30 damages - #define MONSTER_THROWS_ROCKS3 6 //6-36 damages - #define MONSTER_THROWS_RAZORDISKS 7 - #define MONSTER_PETRIFICATION_RAY 8 - #define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray - #define MONSTER_HEAT_RAY 10 - #define MONSTER_INVISIBLE 11 - #define MONSTER_SPLITS 12 - #define MONSTER_MINDLESS 13 - #define MONSTER_BREATHES_STINKING_CLOUDS 14 - #define MONSTER_ICY_TOUCH 15 - #define MONSTER_XP_DRAINING_TOUCH 16 - #define MONSTER_ICY_AND_DRAINING_TOUCH 17 - #define MONSTER_SLOWING_TOUCH 18 - #define MONSTER_SHOOTS_WEB 19 - #define MONSTER_GOOD_ARCHER 20 - #define MONSTER_STEALS_FOOD 21 - #define MONSTER_PERMANENT_MARTYRS_SHIELD 22 - #define MONSTER_PARALYSIS_RAY 23 - #define MONSTER_DUMBFOUNDING_TOUCH 24 - #define MONSTER_DISEASE_TOUCH 25 - #define MONSTER_ABSORB_SPELLS 26 - #define MONSTER_WEB_TOUCH 27 - #define MONSTER_SLEEP_TOUCH 28 - #define MONSTER_PARALYSIS_TOUCH 29 - #define MONSTER_PETRIFICATION_TOUCH 30 - #define MONSTER_ACID_TOUCH 31 - #define MONSTER_BREATHES_SLEEP_CLOUDS 32 - #define MONSTER_ACID_SPIT 33 - #define MONSTER_SHOOTS_SPINES 34 - #define MONSTER_DEATH_TOUCH 35 - #define MONSTER_INVULNERABILITY 36 +/* Special Ability a.k.a spec_skill */ + +/* #define MONSTER_NO_SPECIAL_ABILITY 0 + #define MONSTER_THROWS_DARTS 1 + #define MONSTER_SHOOTS_ARROWS 2 + #define MONSTER_THROWS_SPEARS 3 + #define MONSTER_THROWS_ROCKS1 4 //4-24 damages + #define MONSTER_THROWS_ROCKS2 5 //5-30 damages + #define MONSTER_THROWS_ROCKS3 6 //6-36 damages + #define MONSTER_THROWS_RAZORDISKS 7 + #define MONSTER_PETRIFICATION_RAY 8 + #define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray + #define MONSTER_HEAT_RAY 10 + #define MONSTER_INVISIBLE 11 + #define MONSTER_SPLITS 12 + #define MONSTER_MINDLESS 13 + #define MONSTER_BREATHES_STINKING_CLOUDS 14 + #define MONSTER_ICY_TOUCH 15 + #define MONSTER_XP_DRAINING_TOUCH 16 + #define MONSTER_ICY_AND_DRAINING_TOUCH 17 + #define MONSTER_SLOWING_TOUCH 18 + #define MONSTER_SHOOTS_WEB 19 + #define MONSTER_GOOD_ARCHER 20 + #define MONSTER_STEALS_FOOD 21 + #define MONSTER_PERMANENT_MARTYRS_SHIELD 22 + #define MONSTER_PARALYSIS_RAY 23 + #define MONSTER_DUMBFOUNDING_TOUCH 24 + #define MONSTER_DISEASE_TOUCH 25 + #define MONSTER_ABSORB_SPELLS 26 + #define MONSTER_WEB_TOUCH 27 + #define MONSTER_SLEEP_TOUCH 28 + #define MONSTER_PARALYSIS_TOUCH 29 + #define MONSTER_PETRIFICATION_TOUCH 30 + #define MONSTER_ACID_TOUCH 31 + #define MONSTER_BREATHES_SLEEP_CLOUDS 32 + #define MONSTER_ACID_SPIT 33 + #define MONSTER_SHOOTS_SPINES 34 + #define MONSTER_DEATH_TOUCH 35 + #define MONSTER_INVULNERABILITY 36 #define MONSTER_GUARD 37 */ - - /* Create Monsters/Fields */ - -/* #define MONSTER_NO_RADIATE 0 - #define MONSTER_RADIATE_FIRE_FIELDS 1 - #define MONSTER_RADIATE_ICE_FIELDS 2 - #define MONSTER_RADIATE_SHOCK_FIELDS 3 - #define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 - #define MONSTER_RADIATE_SLEEP_FIELDS 5 - #define MONSTER_RADIATE_STINKING_CLOUDS 6 - //as said 7,8 and 9 are unused - #define MONSTER_SUMMON1 10 //5 percent chance - #define MONSTER_SUMMON2 11 //20 percent chance - #define MONSTER_SUMMON3 12 //50 percent chance - //as said 13 and 14 are unused - #define MONSTER_DEATH_TRIGGERS 15 //death triggers global special + + /* Create Monsters/Fields */ + +/* #define MONSTER_NO_RADIATE 0 + #define MONSTER_RADIATE_FIRE_FIELDS 1 + #define MONSTER_RADIATE_ICE_FIELDS 2 + #define MONSTER_RADIATE_SHOCK_FIELDS 3 + #define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 + #define MONSTER_RADIATE_SLEEP_FIELDS 5 + #define MONSTER_RADIATE_STINKING_CLOUDS 6 + //as said 7,8 and 9 are unused + #define MONSTER_SUMMON1 10 //5 percent chance + #define MONSTER_SUMMON2 11 //20 percent chance + #define MONSTER_SUMMON3 12 //50 percent chance + //as said 13 and 14 are unused + #define MONSTER_DEATH_TRIGGERS 15 //death triggers global special */ @@ -545,51 +588,6 @@ enum eItemAbil { ITEM_MISSILE_HEAL_TARGET = 176, }; - -/* adven[i].skills */ //complete -enum eSkill { - SKILL_STRENGTH = 0, - SKILL_DEXTERITY = 1, - SKILL_INTELLIGENCE = 2, - SKILL_EDGED_WEAPONS = 3, - SKILL_BASHING_WEAPONS = 4, - SKILL_POLE_WEAPONS = 5, - SKILL_THROWN_MISSILES = 6, - SKILL_ARCHERY = 7, - SKILL_DEFENSE = 8, - SKILL_MAGE_SPELLS = 9, - SKILL_PRIEST_SPELLS = 10, - SKILL_MAGE_LORE = 11, - SKILL_ALCHEMY = 12, - SKILL_ITEM_LORE = 13, - SKILL_DISARM_TRAPS = 14, - SKILL_LOCKPICKING = 15, - SKILL_ASSASSINATION = 16, - SKILL_POISON = 17, - SKILL_LUCK = 18, -}; - -/* adven[i].traits */ //complete -enum eTrait { - TRAIT_TOUGHNESS = 0, - TRAIT_MAGICALLY_APT = 1, - TRAIT_AMBIDEXTROUS = 2, - TRAIT_NIMBLE = 3, - TRAIT_CAVE_LORE = 4, - TRAIT_WOODSMAN = 5, - TRAIT_GOOD_CONST = 6, - TRAIT_HIGHLY_ALERT = 7, - TRAIT_STRENGTH = 8, - TRAIT_RECUPERATION = 9, - TRAIT_SLUGGISH = 10, - TRAIT_MAGICALLY_INEPT = 11, - TRAIT_FRAIL = 12, - TRAIT_CHRONIC_DISEASE = 13, - TRAIT_BAD_BACK = 14, - TRAIT_PACIFIST = 15, -}; - - /* damage type*/ /* used as parameter to some functions */ enum eDamageType {