28 RECT bottom_buttons
[7];
29 RECT town_buttons
[10];
30 RECT combat_buttons
[9];
31 RECT world_screen
= {23, 23, 274,346};
32 RECT item_screen_button_rects
[9] = {{11,126,28,140},{40,126,57,140},{69,126,86,140},{98,126,115,140},
33 {127,126,144,140},{156,126,173,140},{176,126,211,141},{213,126,248,141},{251,127,267,139}};
35 RECT border_rect
[4] = {{5, 5, 283, 15}, {5, 5, 15, 355},
36 {5, 345, 283, 355}, {273, 5, 283, 355}};
37 RECT medium_buttons
[4] = {{190, 383,225,401}, {190, 402, 225, 420},
38 {227, 383, 263, 401}, {227, 402, 263,420}}; ;
40 RECT item_buttons
[8][6];
41 // name, use, give, drip, info, sell/id
42 RECT pc_buttons
[6][5];
43 // name, hp, sp, info, trade
44 short num_chirps_played
= 0;
46 short special_queue
[20];
47 Boolean end_scenario
= FALSE
;
49 extern RECT startup_button
[6];
51 // For menu spell casting, some info needs to be stored up here.
52 short refer_mage
[62] = {0,2,1,1,2,2,0,2,2,0, 2,2,2,2,1,2,2,2,2,2, 0,1,2,0,2,2,3,3,2,1,
53 2,2,1,0,2,2,3,2, 0,1,2,0,2,3,2,3, 2,1,2,3,2,2,2,0, 1,1,1,0,3,2,2,3};
54 short refer_priest
[62] = {1,0,0,2,0,0,0,0,0,2, 1,0,2,0,2,2,0,2,3,0, 0,0,2,0,0,0,2,0,0,3,
55 0,1,2,0,3,0,0,0, 1,0,0,2,0,3,0,2, 0,0,0,0,2,1,1,1, 0,2,0,2,1,2,0,0};
56 // 0 - refer 1 - do in combat immed. 2 - need targeting 3 - need fancy targeting
57 short mage_need_select
[62] = {0,0,1,1,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0, 0,1,0,0,0,0,0,0,0,1,
58 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,1,0,0,0,0};
59 short priest_need_select
[62] = {1,1,1,0,0,1,1,0,0,0, 1,1,0,0,0,0,0,0,0,1, 1,0,0,0,1,0,0,1,1,0,
60 0,0,0,1,0,1,1,0, 0,1,2,0,0,0,0,0, 0,1,0,2,0,0,0,0, 0,0,2,0,0,0,0,0};
61 // 0 - no select 1 - active only 2 - any existing
63 word_rect_type preset_words
[9] = {{"Look",{4,366,54,389}},{"Name",{70,366,130,389}},{"Job",{136,366,186,389}},
64 {"Buy",{4,389,54,412}},{"Sell",{70,389,120,412}},{"Record",{121,389,186,412}},
65 {"Done",{210,389,270,412}},{"Go Back",{190,366,270,389}},
66 {"Ask About...",{4,343,134,366}}};
68 Boolean item_area_button_active
[8][6];
69 Boolean pc_area_button_active
[6][5];
70 short item_bottom_button_active
[9] = {0,0,0,0,0, 0,1,1,1};
72 RECT pc_help_button
,pc_area_rect
,item_area_rect
;
74 short current_terrain_type
= 0,num_out_moves
= 0;
75 short door_pc
,store_drop_item
;
76 short current_switch
= 6;
77 out_wandering_type store_wandering_special
;
79 short store_shop_type
;
82 short store_selling_values
[8] = {0,0,0,0,0,0,0,0};
84 extern short cen_x
, cen_y
, overall_mode
, stat_window
,give_delays
,pc_moves
[6];
85 extern POINT to_create
;
86 extern Boolean in_startup_mode
,All_Done
,play_sounds
,frills_on
,spell_forced
,save_maps
,monsters_going
;
87 extern Boolean debug_on
,registered
,cartoon_happening
,in_scen_debug
,party_in_memory
;
92 extern party_record_type party
;
93 extern piles_of_stuff_dumping_type
*data_store
;
94 extern piles_of_stuff_dumping_type2
*data_store2
;
95 extern talking_record_type talking
;
96 extern scenario_data_type scenario
;
98 extern pc_record_type adven
[6];
99 extern outdoor_record_type outdoors
[2][2];
100 extern current_town_type c_town
;
101 extern big_tr_type t_d
;
102 extern unsigned char out
[96][96];
103 extern unsigned char out_e
[96][96];
104 extern short which_item_page
[6],current_ground
;
105 extern short town_size
[3],store_spell_target
,pc_last_cast
[2][6],pc_casting
,store_mage
,store_priest
;
106 extern town_item_list t_i
; // shouldn't be here
107 extern unsigned char misc_i
[64][64];
108 extern short spec_item_array
[60];
109 extern stored_town_maps_type town_maps
,town_maps2
;
114 extern short which_combat_type
,num_targets_left
;
115 extern unsigned char combat_terrain
[64][64];
116 extern location center
;
117 extern location pc_pos
[6];
118 extern short current_pc
,town_type
;
119 extern short combat_active_pc
,stat_screen_mode
;
121 extern Boolean modeless_exists
[18],diff_depth_ok
;
122 extern short modeless_key
[18];
123 extern HWND modeless_dialogs
[18];
125 extern stored_items_list_type stored_items
[3];
126 extern stored_outdoor_maps_type o_maps
;
127 extern short ulx
,uly
;
128 extern HWND text_sbar
,item_sbar
,shop_sbar
;
129 extern short shop_identify_cost
;
130 extern Boolean fry_startup
;
133 char const *dir_string
[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"};
134 char get_new_terrain();
135 creature_start_type save_monster_type
;
137 short wand_loc_count
= 0;
138 short monst_place_count
= 0; // 1 - standard place 2 - place last
139 Boolean unreg_party_in_scen_not_check
= FALSE
;
141 item_record_type start_items
[6] =
143 {1,4, 0,1,0,0,1,0, 45,0,0,0,0,0, 2, 7,0, {0,0},"Bronze Knife","Knife",0,1,0,0},
144 {12,1,1,0,0,0,0,0, 65,0,0,0,0,0, 2, 20,0, {0,0},"Crude Buckler","Buckler",0,1,0,0},
145 {4,0,0,0,0,0,0,0, 10,0,0,0,0,0, 15, 20,0, {0,0},"Cavewood Bow","Bow",0,1,0,0},
146 {5,12,0,0,0,12,0,0, 47,0,0,0,0,0, 1, 1,0, {0,0},"Arrows","Arrows",0,1,0,0},
147 {2,9,0,0,0,0,3,0, 4,0,0,0,0,0, 10, 30,0, {0,0},"Stone Spear","Spear",0,1,0,0},
148 {14,1,0,0,0,0,0,0, 66,0,0,0,0,0, 6, 15,0, {0,0},"Leather Helm","Helm",0,1,0,0}
151 // 0 - whole area, 1 - active area 2 - graphic 3 - item name
152 // 4 - item cost 5 - item extra str 6 - item help button
153 RECT shopping_rects
[8][7];
155 void init_screen_locs()
158 RECT bottom_base
= {0,0,18,15},startup_base
= {5,279,306,327};
159 RECT shop_base
= {12,63,267,99}; /**/
161 for (i
= 0; i
< 7; i
++)
162 shopping_rects
[0][i
] = shop_base
;
163 shopping_rects
[0][1].right
-= 35;
164 shopping_rects
[0][2].right
= shopping_rects
[0][2].left
+ 28;
165 shopping_rects
[0][3].top
+= 4;
166 shopping_rects
[0][3].left
+= 28;
167 shopping_rects
[0][4].top
+= 20;
168 shopping_rects
[0][4].left
+= 154;
169 shopping_rects
[0][5].top
+= 20;
170 shopping_rects
[0][5].left
+= 34;
171 shopping_rects
[0][6].top
+= 3;
172 shopping_rects
[0][6].bottom
-= 21;
173 shopping_rects
[0][6].right
-= 19;
174 shopping_rects
[0][6].left
= shopping_rects
[0][6].right
- 14;
175 for (i
= 1; i
< 8; i
++)
176 for (j
= 0; j
< 7; j
++) {
177 shopping_rects
[i
][j
] = shopping_rects
[0][j
];
178 OffsetRect(&shopping_rects
[i
][j
],0,i
* 36);
182 for (i
= 0; i
< 6; i
++) {
183 startup_button
[i
] = startup_base
;
184 OffsetRect(&startup_button
[i
],301 * (i
/ 3) - 0,48 * (i
% 3));
187 startup_top
.bottom
= startup_button
[0].top
;
188 startup_top
.left
= 5;
189 startup_top
.right
= startup_button
[3].right
;
191 for (i
= 0; i
< 100; i
++)
192 for (j
= 0; j
< 8; j
++)
193 for (k
= 0; k
< 64; k
++)////
194 town_maps
.town_maps
[i
][j
][k
] = 0;
195 for (i
= 0; i
< 100; i
++)
196 for (j
= 0; j
< 8; j
++)
197 for (k
= 0; k
< 64; k
++)////
198 town_maps2
.town_maps
[i
][j
][k
] = 0;
200 for (i
= 0; i
< 100; i
++)
201 for (k
= 0; k
< 6; k
++)
202 for (l
= 0; l
< 48; l
++)
203 o_maps
.outdoor_maps
[i
][k
][l
] = 0;
205 for (i
= 0; i
< 7; i
++) {
206 bottom_buttons
[i
].top
= 383;
207 bottom_buttons
[i
].bottom
= 420;
208 bottom_buttons
[i
].left
= 5 + (i
* 37);
209 bottom_buttons
[i
].right
= bottom_buttons
[i
].left
+ 36;
210 town_buttons
[i
] = bottom_buttons
[i
];
212 //FrameRect (&bottom_buttons[i]);
215 for (i
= 0; i
< 5; i
++) {
216 combat_buttons
[i
] = bottom_buttons
[i
];
218 town_buttons
[7] = bottom_buttons
[6];
219 town_buttons
[5] = medium_buttons
[0];
220 town_buttons
[6] = medium_buttons
[1];
221 for (i
= 5; i
< 9; i
++) {
222 combat_buttons
[i
] = medium_buttons
[i
- 5];
225 // name, use, give, drip, info, sell/id each one 13 down
226 item_buttons
[0][0].top
= 17;
227 item_buttons
[0][0].bottom
= item_buttons
[0][0].top
+ 12;
228 item_buttons
[0][0].left
= 3;
229 item_buttons
[0][0].right
= item_buttons
[0][0].left
+ 185;
230 OffsetRect(&item_buttons
[0][0],0,1);
231 item_buttons
[0][1] = item_buttons
[0][0];
232 item_buttons
[0][1].left
= 196;
233 item_buttons
[0][1].right
= 210;
234 item_buttons
[0][2] = item_buttons
[0][0];
235 item_buttons
[0][2].left
= 210;
236 item_buttons
[0][2].right
= 224;
237 item_buttons
[0][3] = item_buttons
[0][0];
238 item_buttons
[0][3].left
= 224;
239 item_buttons
[0][3].right
= 238;
240 item_buttons
[0][4] = item_buttons
[0][0];
241 item_buttons
[0][4].left
= 238;
242 item_buttons
[0][4].right
= 252;
243 item_buttons
[0][5] = item_buttons
[0][0];
244 item_buttons
[0][5].left
= 173;
245 item_buttons
[0][5].right
= 232;
246 for (i
= 1; i
< 8; i
++)
247 for (j
= 0; j
< 6; j
++) {
248 item_buttons
[i
][j
] = item_buttons
[0][j
];
249 OffsetRect(&item_buttons
[i
][j
],0,13 * i
);
252 /* for (i = 0; i < 8; i++) {
253 item_screen_button_rects[i] = bottom_base;
254 OffsetRect(&item_screen_button_rects[i],10 + i * 29,126);
256 item_screen_button_rects[6].left = 176;
257 item_screen_button_rects[6].right = 211;
258 item_screen_button_rects[7].left = 213;
259 item_screen_button_rects[7].right = 248;
260 item_screen_button_rects[8].top = 127;
261 item_screen_button_rects[8].bottom = 140;
262 item_screen_button_rects[8].left = 251;
263 item_screen_button_rects[8].right = 267; */
265 // name, hp, sp, info, trade
266 pc_buttons
[0][0].top
= 18;
267 pc_buttons
[0][0].bottom
= pc_buttons
[0][0].top
+ 12;
268 pc_buttons
[0][0].left
= 3;
269 pc_buttons
[0][0].right
= pc_buttons
[0][0].left
+ 177;
270 pc_buttons
[0][1] = pc_buttons
[0][0];
271 pc_buttons
[0][1].left
= 184;
272 pc_buttons
[0][1].right
= 214;
273 pc_buttons
[0][2] = pc_buttons
[0][0];
274 pc_buttons
[0][2].left
= 214;
275 pc_buttons
[0][2].right
= 237;
276 pc_buttons
[0][3] = pc_buttons
[0][0];
277 pc_buttons
[0][3].left
= 241;
278 pc_buttons
[0][3].right
= 253;
279 pc_buttons
[0][4] = pc_buttons
[0][0];
280 pc_buttons
[0][4].left
= 253;
281 pc_buttons
[0][4].right
= 262;
282 for (i
= 1; i
< 6; i
++)
283 for (j
= 0; j
< 5; j
++) {
284 pc_buttons
[i
][j
] = pc_buttons
[0][j
];
285 OffsetRect(&pc_buttons
[i
][j
],0,13 * i
);
287 pc_help_button
.top
= 101;
288 pc_help_button
.bottom
= 114;
289 pc_help_button
.left
= 251;
290 pc_help_button
.right
= 267;
292 pc_area_rect
.top
= PC_WIN_UL_Y
;
293 pc_area_rect
.left
= PC_WIN_UL_X
;
294 pc_area_rect
.bottom
= PC_WIN_UL_Y
+ 116;
295 pc_area_rect
.right
= PC_WIN_UL_X
+ 271;
296 item_area_rect
.top
= ITEM_WIN_UL_Y
;
297 item_area_rect
.left
= ITEM_WIN_UL_X
;
298 item_area_rect
.bottom
= ITEM_WIN_UL_Y
+ 143;
299 item_area_rect
.right
= ITEM_WIN_UL_X
+ 271;
305 if ((overall_mode
< 2) || (overall_mode
== 10))
310 Boolean
handle_action(POINT the_point
, UINT wparam
, LONG lparam
)
312 short i
,j
,k
, store_dest
,i_num
,item_hit
,which_t
,s1
,s2
,s3
;
313 Boolean are_done
= FALSE
;
315 Boolean need_redraw
= FALSE
, did_something
= FALSE
, need_reprint
= FALSE
;
316 Boolean town_move_done
= FALSE
,pc_delayed
= FALSE
;
317 location destination
,cur_loc
,sector
= {0,0},loc_in_sec
,cur_direction
= {0,0};
319 unsigned char storage
;
320 short find_direction_from
,ter_looked_at
,button_hit
= 12,store_cur_pc
;
326 Boolean right_button
= FALSE
;
327 Boolean ctrl_key
= FALSE
;
336 if (MK_CONTROL
& wparam
)
339 for (i
= 0; i
< 20; i
++)
340 special_queue
[i
] = -1;
341 end_scenario
= FALSE
;
343 if (unreg_party_in_scen_not_check
== TRUE
) {
344 if (enter_password() == FALSE
) {
348 in_scen_debug
= TRUE
;
349 ASB("Debug mode ON.");
351 unreg_party_in_scen_not_check
= FALSE
;
354 // Now split off the extra stuff, like talking and shopping.
355 if (overall_mode
== 20) {
356 handle_talk_event(the_point
,right_button
);
357 if (overall_mode
!= 20)
360 if (overall_mode
== 21) {
361 handle_shop_event(the_point
,right_button
);
362 if (overall_mode
!= 21)
366 num_chirps_played
= 0;
368 // First, figure out where party is
369 switch (overall_mode
) {
371 cur_loc
= party
.p_loc
;
372 for (i
= 0; i
< 7; i
++)
373 if (PtInRect ( &bottom_buttons
[i
], the_point
) == TRUE
) {
375 if (spell_forced
== FALSE
)
376 main_button_click(overall_mode
,bottom_buttons
[i
]);
380 case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 36:
381 // cur_loc = c_town.p_loc;
383 for (i
= 0; i
< 8; i
++)
384 if (PtInRect (&town_buttons
[i
], the_point
) == TRUE
) {
386 if (spell_forced
== FALSE
)
387 main_button_click(overall_mode
,town_buttons
[i
]);
391 case 20: case 21: break;
394 cur_loc
= (overall_mode
> 10) ? center
: pc_pos
[current_pc
];
395 for (i
= 0; i
< 9; i
++)
396 if (PtInRect (&combat_buttons
[i
], the_point
) == TRUE
) {
398 if (spell_forced
== FALSE
)
399 main_button_click(overall_mode
,combat_buttons
[i
]);
404 // Then, handle a button being hit.
405 if (button_hit
!= 12)
409 if (someone_awake() == FALSE
) {
410 ASB("Everyone's asleep/paralyzed.");
414 if (overall_mode
== 0) {
415 cast_spell(button_hit
,0);
416 spell_forced
= FALSE
;
420 else if (overall_mode
== 1) {
421 for (i
= 0; i
< 6; i
++)
422 store_sp
[i
] = adven
[i
].cur_sp
;
423 cast_spell(button_hit
,1);
424 spell_forced
= FALSE
;
427 for (i
= 0; i
< 6; i
++)
428 if (store_sp
[i
] != adven
[i
].cur_sp
)
429 did_something
= TRUE
;
431 else if (overall_mode
== 3) {
432 add_string_to_buf(" Cancelled. ");
435 else if (overall_mode
== 10) {
436 if ((overall_mode
== 10) && (button_hit
== 0)) {
437 did_something
= combat_cast_mage_spell();
440 if ((overall_mode
== 10) && (button_hit
== 1)) {
441 did_something
= combat_cast_priest_spell();
444 if ((overall_mode
!= 11) && (overall_mode
!= 14)) {
447 else did_something
= FALSE
;
448 spell_forced
= FALSE
;
451 else if ((overall_mode
== 11) || (overall_mode
== 14)) {
452 add_string_to_buf(" Cancelled. ");
454 center
= pc_pos
[current_pc
];
459 put_item_screen(stat_window
,0);
463 if (overall_mode
== 0) {
465 add_string_to_buf("Look: Select a space. You can also ");
466 add_string_to_buf(" right click to look.");
469 if (overall_mode
== 1) {
471 add_string_to_buf("Look: Select a space. You can also ");
472 add_string_to_buf(" right click to look.");
475 if (overall_mode
== 10) {
477 add_string_to_buf("Look: Select a space. You can also ");
478 add_string_to_buf(" right click to look.");
484 if (overall_mode
== 10) {
485 add_string_to_buf("Parry. ");
487 did_something
= TRUE
;
491 if (overall_mode
== 1) {
493 add_string_to_buf("Talk: Select someone ");
496 if (overall_mode
== 0) { // Resting
498 ter
= out
[party
.p_loc
.x
][party
.p_loc
.y
];
499 if (party
.in_boat
>= 0)
500 add_string_to_buf("Rest: Not in boat. ");
501 else if (someone_poisoned() == TRUE
)
502 add_string_to_buf("Rest: Someone poisoned. ");
503 else if (party
.food
<= 12)
504 add_string_to_buf("Rest: Not enough food. ");
505 else if (nearest_monster() <= 3)
506 add_string_to_buf("Rest: Monster too close. ");
507 else if ((scenario
.ter_types
[ter
].special
>= 2) && (scenario
.ter_types
[ter
].special
<= 6))
508 add_string_to_buf("Rest: It's dangerous here.");////
509 else if (flying() == TRUE
)
510 add_string_to_buf("Rest: Not while flying. ");
512 add_string_to_buf("Resting... ");
526 if (nearest_monster() <= 3) {
528 add_string_to_buf(" Monsters nearby.");
535 party
.age
+= 1200;////
536 add_string_to_buf(" Rest successful. ");
537 heal_party(get_ran(5,1,10));
538 restore_sp_party(50);
547 if (overall_mode
== 0) {
553 if ((overall_mode
== 1) || (overall_mode
== 10)) {
554 if (party
.in_boat
>= 0) {
556 add_string_to_buf("Get: Not while in boat. ");
558 if (overall_mode
== 1)
559 j
= get_item(c_town
.p_loc
,6,FALSE
);
561 j
= get_item(pc_pos
[current_pc
],current_pc
,FALSE
);
565 put_item_screen(stat_window
, 0);
568 did_something
= TRUE
;
575 if (overall_mode
== 0) {
581 if (overall_mode
== 1) {
582 add_string_to_buf("Use: Select a space or item.");
583 add_string_to_buf(" (Hit button again to cancel.)");
587 else if (overall_mode
== 4) {
590 add_string_to_buf(" Cancelled.");
592 if (overall_mode
== 10) {
601 if (overall_mode
== 0) {
605 if (overall_mode
== 1) {
611 if (overall_mode
== 10) {
616 else if ((overall_mode
== 12) || (overall_mode
== 13)) {
617 add_string_to_buf(" Cancelled. ");
618 center
= pc_pos
[current_pc
];
626 if (overall_mode
== 1) {
627 if (party
.in_boat
>= 0) {
629 add_string_to_buf("Combat: Not while in boat. ");
631 else if (party
.in_horse
>= 0) {
633 add_string_to_buf("Combat: Not while on horseback. ");
636 add_string_to_buf("Combat! ");
639 //print_nums(999,current_pc,party.direction);
640 start_town_combat(party
.direction
);
641 //MessageBox(mainPtr,"Started town combat","Debug note",MB_OK | MB_ICONEXCLAMATION);
644 did_something
= TRUE
;
646 //MessageBox(mainPtr,"PC screen up","Debug note",MB_OK | MB_ICONEXCLAMATION);
649 else if (overall_mode
== 10) {
650 if (which_combat_type
== 0) {
651 if (hit_end_c_button() == TRUE
) {
652 end_town_mode(0,c_town
.p_loc
);
654 add_string_to_buf("End combat. ");
655 handle_wandering_specials(0,1);
658 set_stat_window(current_pc
);
660 else add_string_to_buf("Can't end combat yet. ");
663 party
.direction
= end_town_combat();
664 center
= c_town
.p_loc
;
666 set_stat_window(current_pc
);
671 did_something
= TRUE
;
680 if (overall_mode
== 10) {
681 if (combat_active_pc
== 6) {
682 add_string_to_buf("This PC now active. ");
683 combat_active_pc
= current_pc
;
686 add_string_to_buf("All PC's now active. ");
687 current_pc
= combat_active_pc
;
688 combat_active_pc
= 6;
698 /* if (overall_mode == 30) /// I don't know what this is for.
699 if (PtInRect(the_point, &text_panel_rect)) {
705 // Begin : click in terrain
706 if ((PtInRect ( &world_screen
,the_point
)) && ((is_out()) || (is_town()) || (is_combat())) ){
707 i
= (the_point
.x
- 23) / 28;
708 j
= (the_point
.y
- 23) / 36;
710 destination
= cur_loc
;
712 if ((overall_mode
== 0) || (overall_mode
== 1) || (overall_mode
== 10))
713 if ((i
== 4) && (j
== 4) && (right_button
== FALSE
)) { // Pausing
714 if (overall_mode
== 10) {
716 add_string_to_buf("Stand ready. ");
717 if (adven
[current_pc
].status
[6] > 0) {
718 add_string_to_buf("You clean webs. ");
719 adven
[current_pc
].status
[6] = move_to_zero(adven
[current_pc
].status
[6]);
720 adven
[current_pc
].status
[6] = move_to_zero(adven
[current_pc
].status
[6]);
723 check_fields(pc_pos
[current_pc
],2,current_pc
);
726 add_string_to_buf("Pause.");
727 for (k
= 0; k
< 6; k
++)
728 if ((adven
[k
].main_status
== 1) && (adven
[k
].status
[6] > 0)) {
729 sprintf((char *) str
,"%s cleans webs.",adven
[k
].name
);
730 add_string_to_buf((char *) str
);
731 adven
[k
].status
[6] = move_to_zero(adven
[k
].status
[6]);
732 adven
[k
].status
[6] = move_to_zero(adven
[k
].status
[6]);
734 if (party
.in_horse
>= 0) {
735 if (overall_mode
== 0) {
736 party
.horses
[party
.in_horse
].which_town
= 200;
737 party
.horses
[party
.in_horse
].horse_loc_in_sec
= global_to_local(party
.p_loc
);
738 party
.horses
[party
.in_horse
].horse_loc
= party
.p_loc
;
739 party
.horses
[party
.in_horse
].horse_sector
.x
= party
.outdoor_corner
.x
+ party
.i_w_c
.x
;
740 party
.horses
[party
.in_horse
].horse_sector
.y
= party
.outdoor_corner
.y
+ party
.i_w_c
.y
;
743 else if (overall_mode
== 1){
744 party
.horses
[party
.in_horse
].horse_loc
= c_town
.p_loc
;
745 party
.horses
[party
.in_horse
].which_town
= c_town
.town_num
;
750 check_fields(c_town
.p_loc
,1,0);
753 did_something
= TRUE
;
756 else if (right_button
== FALSE
) {
757 cur_direction
= get_cur_direction(the_point
);
758 destination
.x
+= cur_direction
.x
;
759 destination
.y
+= cur_direction
.y
;
764 if ((right_button
== FALSE
) && (overall_mode
== 10)) {
765 if (pc_combat_move(destination
) == TRUE
) {
766 center
= pc_pos
[current_pc
];
767 did_something
= TRUE
;
768 update_explored(destination
);
773 if ((right_button
== FALSE
) && (overall_mode
== 1)) {
774 if (someone_awake() == FALSE
) {
775 ASB("Everyone's asleep/paralyzed.");
781 if (town_move_party(destination
,0) == TRUE
) {
782 did_something
= TRUE
;
783 center
= c_town
.p_loc
;
784 update_explored(destination
);
786 if (loc_off_act_area(c_town
.p_loc
) == TRUE
) {
788 destination
= end_town_mode(0,destination
);
791 town_move_done
= TRUE
;
795 else need_reprint
= TRUE
;
799 if ((right_button
== FALSE
) && (overall_mode
== 0)) {
800 if (outd_move_party(destination
,town_move_done
) == TRUE
) {
801 center
= destination
;
803 did_something
= TRUE
;
804 update_explored(party
.p_loc
);
808 else need_redraw
= TRUE
;
810 storage
= out
[party
.p_loc
.x
][party
.p_loc
.y
];
811 if (scenario
.ter_types
[storage
].special
== 21) {//// town entry
813 if (party
.direction
== 0) find_direction_from
= 2;
814 else if (party
.direction
== 4) find_direction_from
= 0;
815 else if (party
.direction
< 4) find_direction_from
= 3;
816 else find_direction_from
= 1;
818 for (i
= 0; i
< 8; i
++)
819 if (same_point(party
.loc_in_sec
,outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].exit_locs
[i
]) == TRUE
) {
820 which_t
= outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].exit_dests
[i
];
822 start_town_mode(outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].exit_dests
[i
], find_direction_from
);
823 if (is_town() == TRUE
) {
826 if (party
.in_boat
>= 0)
827 party
.boats
[party
.in_boat
].which_town
= c_town
.town_num
;
828 if (party
.in_horse
>= 0)
829 party
.horses
[party
.in_horse
].which_town
= c_town
.town_num
;
833 } // End if(overall_mode == 0)
838 // Begin: Looking at something
839 if ((right_button
== TRUE
) || (overall_mode
== 35) || (overall_mode
== 36) || (overall_mode
== 37)) {
840 destination
.x
= destination
.x
+ i
- 4;
841 destination
.y
= destination
.y
+ j
- 4;
845 // if ((can_see(cur_loc,destination) >= 4) || ((overall_mode != 35) && (loc_off_world(destination) == TRUE)))
846 if ((is_combat() == FALSE
) && (party_can_see(destination
) == 6))
847 add_string_to_buf(" Can't see space. ");
848 else if ((is_combat() == TRUE
) && (can_see(pc_pos
[current_pc
],destination
,0) >= 4))
849 add_string_to_buf(" Can't see space. ");
851 add_string_to_buf("You see... ");
852 ter_looked_at
= do_look(destination
);
853 if ((is_town()) || (is_combat()))
854 if (adjacent(c_town
.p_loc
,destination
) == TRUE
)
855 if (adj_town_look(destination
) == TRUE
)
857 if (is_sign(ter_looked_at
)) {
859 need_reprint
= FALSE
;
863 if (same_point (destination
, c_town
.town
.sign_locs
[k
]) == TRUE
) {
865 if (adjacent(c_town
.town
.sign_locs
[k
],c_town
.p_loc
)==TRUE
)
866 do_sign(c_town
.town_num
,k
,(short) ter_looked_at
,destination
);
867 else add_string_to_buf(" Too far away to read sign. ");
873 loc_in_sec
= party
.loc_in_sec
;
874 loc_in_sec
.x
+= i
- 4;
875 loc_in_sec
.y
+= j
- 4;
877 if (same_point (loc_in_sec
,
878 outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].sign_locs
[k
]) == TRUE
) {
880 if (adjacent(outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].sign_locs
[k
],party
.loc_in_sec
)==TRUE
)
881 do_sign((short) (200 + get_outdoor_num()),k
,(short) ter_looked_at
,destination
);
882 else add_string_to_buf(" Too far away to read sign. ");
890 // sprintf(store_str," Mod: %d",event.modifiers);
891 // add_string_to_buf(store_str);
893 // If option not pressed, looking done, so restore center
894 if ((ctrl_key
== FALSE
) && (right_button
== FALSE
)) {
895 if (overall_mode
== 37) {
897 center
= pc_pos
[current_pc
];
901 else if (overall_mode
== 36) {
903 center
= c_town
.p_loc
;
906 else if (overall_mode
== 35)
912 // End: looking at something
913 if (get_ran(1,0,100) == 50)
914 if (load_blades_data() == FALSE
)
917 // Begin : talking to someone
918 if (overall_mode
== 2) {
919 destination
.x
= destination
.x
+ i
- 4;
920 destination
.y
= destination
.y
+ j
- 4;
922 if ((can_see(cur_loc
,destination
,0) >= 4) || (loc_off_world(destination
) == TRUE
)) {
923 add_string_to_buf(" Can't see space ");
928 for (i
= 0; i
< T_M
; i
++) {
929 if (monst_on_space(destination
,i
) == TRUE
) {
930 did_something
= TRUE
;
932 if (c_town
.monst
.dudes
[i
].attitude
% 2 == 1) {
933 add_string_to_buf(" Creature is hostile. ");
935 else if ((c_town
.monst
.dudes
[i
].summoned
> 0)////
936 || (c_town
.monst
.dudes
[i
].monst_start
.personality
< 0))
937 add_string_to_buf("Talk: No response. ");
938 else switch (c_town
.monst
.dudes
[i
].monst_start
.personality
) {
940 start_talk_mode(i
,c_town
.monst
.dudes
[i
].monst_start
.personality
,c_town
.monst
.dudes
[i
].number
,
941 c_town
.monst
.dudes
[i
].monst_start
.facial_pic
); did_something
= FALSE
;
947 if ((did_something
== FALSE
) && (overall_mode
!= 20)){
948 add_string_to_buf(" Nobody there");
951 if (overall_mode
!= 20)
954 if (overall_mode
!= 20)
957 // End : talking to someone
959 // Begin : Targeting a space
960 if ((overall_mode
== 11) || (overall_mode
== 12) || (overall_mode
== 13) ||
961 (overall_mode
== 14) || (overall_mode
== 15)) {
962 destination
.x
= destination
.x
+ i
- 4;
963 destination
.y
= destination
.y
+ j
- 4;
964 if (overall_mode
== 11)
965 do_combat_cast(destination
);
966 if ((overall_mode
== 13) || (overall_mode
== 12))
967 fire_missile(destination
);
968 if (overall_mode
== 14) {
969 place_target(destination
);
972 if (overall_mode
!= 14) {
973 did_something
= TRUE
;
974 center
= pc_pos
[current_pc
];
976 if (overall_mode
== 15) { // dropping
977 if (adjacent(pc_pos
[current_pc
],destination
) == FALSE
)
978 add_string_to_buf("Drop: must be adjacent.");
980 drop_item(current_pc
,store_drop_item
,destination
);
986 if ((overall_mode
>= 10) && (overall_mode
< 20) && (overall_mode
!= 14))
989 put_item_screen(stat_window
,0);
991 if ((overall_mode
> 2) && (overall_mode
< 6)) {
992 destination
.x
= destination
.x
+ i
- 4;
993 destination
.y
= destination
.y
+ j
- 4;
994 switch (overall_mode
) {
996 cast_town_spell(destination
);
997 did_something
= TRUE
;
1000 if (adjacent(destination
,c_town
.p_loc
) == FALSE
)
1001 add_string_to_buf(" Must be adjacent. ");
1003 did_something
= use_space(destination
);
1007 if (adjacent(c_town
.p_loc
,destination
) == FALSE
)
1008 add_string_to_buf("Drop: must be adjacent.");
1009 else if (get_obscurity(destination
.x
,destination
.y
) == 5)
1010 ASB("Drop: Space is blocked.");
1011 else drop_item(current_pc
,store_drop_item
,destination
);
1017 put_item_screen(stat_window
,0);
1019 // End : Targeting a space
1022 //End: click in terrain
1023 if (get_ran(1,0,100) == 50)
1024 if (load_blades_data() == FALSE
)
1027 // Begin: Screen shift
1028 if ((overall_mode
== 11) || (overall_mode
== 12) || (overall_mode
== 13) || (overall_mode
== 14)
1029 || (overall_mode
== 37) || (overall_mode
== 36)) {
1030 if ((PtInRect ( &border_rect
[0],the_point
)) && (center
.y
> c_town
.town
.in_town_rect
.top
)
1031 && (center
.y
> 4)) {
1035 if ((PtInRect ( &border_rect
[1],the_point
)) && (center
.x
> c_town
.town
.in_town_rect
.left
)
1036 && (center
.x
> 4)) {
1040 if ((PtInRect ( &border_rect
[2],the_point
)) && (center
.y
< c_town
.town
.in_town_rect
.bottom
)
1041 && (center
.y
< town_size
[town_type
] - 5)) {
1045 if ((PtInRect (&border_rect
[3],the_point
)) && (center
.x
< c_town
.town
.in_town_rect
.right
)
1046 && (center
.x
< town_size
[town_type
] - 5)) {
1051 // End: Screen shift
1054 // Process clicks in PC stats area
1055 if (PtInRect (&pc_area_rect
,the_point
)) {
1056 point_in_area
= the_point
;
1057 point_in_area
.x
-= PC_WIN_UL_X
;
1058 point_in_area
.y
-= PC_WIN_UL_Y
;
1059 if (PtInRect (&pc_help_button
,point_in_area
)) {
1060 OffsetRect(&pc_help_button
,PC_WIN_UL_X
,PC_WIN_UL_Y
);
1061 arrow_button_click(pc_help_button
);
1062 OffsetRect(&pc_help_button
,-1 * PC_WIN_UL_X
,-1 * PC_WIN_UL_Y
);
1065 for (i
= 0; i
< 6; i
++)
1066 for (j
= 0; j
< 5; j
++)
1067 if ((pc_area_button_active
[i
][j
] > 0) && (PtInRect (&pc_buttons
[i
][j
],point_in_area
))) {
1068 OffsetRect(&pc_buttons
[i
][j
],PC_WIN_UL_X
,PC_WIN_UL_Y
);
1069 arrow_button_click(pc_buttons
[i
][j
]);
1070 OffsetRect(&pc_buttons
[i
][j
],-1 * PC_WIN_UL_X
,-1 * PC_WIN_UL_Y
);
1073 if ((prime_time() == FALSE
) && (overall_mode
!= 21)&& (overall_mode
!= 20))
1074 add_string_to_buf("Set active: Finish what you're doing first.");
1075 else if (is_combat())
1076 add_string_to_buf("Set active: Can't set this in combat.");
1077 else if ((adven
[i
].main_status
!= 1) &&
1078 ((overall_mode
!= 21) || (store_shop_type
!= 3)))
1079 add_string_to_buf("Set active: PC must be here & active.");
1082 set_stat_window (i
);
1083 if (overall_mode
== 21)
1084 sprintf((char *) str
,"Now shopping: %s",adven
[i
].name
);
1085 else sprintf((char *) str
,"Now active: %s",adven
[i
].name
);
1086 add_string_to_buf((char *)str
);
1087 adjust_spell_menus();
1091 sprintf((char *) str
,"%s has %d health out of %d.",adven
[i
].name
,
1092 adven
[i
].cur_health
,adven
[i
].max_health
);
1093 add_string_to_buf((char *)str
);
1096 sprintf((char *) str
,"%s has %d spell pts. out of %d.",adven
[i
].name
,
1097 adven
[i
].cur_sp
,adven
[i
].max_sp
);
1098 add_string_to_buf((char *)str
);
1103 case 4: // trade places
1104 if (prime_time() == FALSE
)
1105 add_string_to_buf("Trade places: Finish what you're doing first.");
1106 else if (is_combat())
1107 add_string_to_buf("Trade places: Can't do this in combat.");
1114 need_reprint
= TRUE
;
1116 put_item_screen(stat_window
,0);
1117 if (overall_mode
== 21) {
1118 set_up_shop_array();
1119 draw_shop_graphics(0,pc_buttons
[0][0]);
1124 if (get_ran(1,0,1000) == 50)
1125 if (load_blades_data() == FALSE
)
1127 // Process clicks in item stats area
1128 if (PtInRect (&item_area_rect
,the_point
)) {
1129 point_in_area
= the_point
;
1130 point_in_area
.x
-= ITEM_WIN_UL_X
;
1131 point_in_area
.y
-= ITEM_WIN_UL_Y
;
1133 for (i
= 0; i
< 9; i
++)
1134 if ((item_bottom_button_active
[i
] > 0) && (PtInRect (&item_screen_button_rects
[i
],point_in_area
))) {
1135 OffsetRect(&item_screen_button_rects
[i
],ITEM_WIN_UL_X
,ITEM_WIN_UL_Y
);
1136 arrow_button_click(item_screen_button_rects
[i
]);
1137 OffsetRect(&item_screen_button_rects
[i
],-1 * ITEM_WIN_UL_X
,-1 * ITEM_WIN_UL_Y
);
1139 case 0: case 1: case 2: case 3: case 4: case 5:
1140 if ((prime_time() == FALSE
) && (overall_mode
!= 20) && (overall_mode
!= 21))
1141 add_string_to_buf("Set active: Finish what you're doing first.");
1143 if (!(is_combat())) {
1144 if ((adven
[i
].main_status
!= 1) &&
1145 ((overall_mode
!= 21) || (store_shop_type
!= 12)))
1146 add_string_to_buf("Set active: PC must be here & active.");
1149 sprintf((char *) str
,"Now active: %s",adven
[i
].name
);
1150 add_string_to_buf((char *)str
);
1151 adjust_spell_menus();
1155 if (overall_mode
== 21) {
1156 set_up_shop_array();
1157 draw_shop_graphics(0,item_screen_button_rects
[i
]); // rect is dummy
1161 case 6: // special screen
1174 if (stat_window
< 7) {
1175 for (i
= 0; i
< 8; i
++)
1176 for (j
= 0; j
< 6; j
++)
1177 if ((item_area_button_active
[i
][j
] > 0) && (PtInRect (&item_buttons
[i
][j
],point_in_area
))) {
1178 OffsetRect(&item_buttons
[i
][j
],ITEM_WIN_UL_X
,ITEM_WIN_UL_Y
);
1179 if ((j
> 0) || (stat_screen_mode
< 2))
1180 arrow_button_click(item_buttons
[i
][j
]);
1181 OffsetRect(&item_buttons
[i
][j
],-1 * ITEM_WIN_UL_X
,-1 * ITEM_WIN_UL_Y
);
1183 item_hit
= GetScrollPos(item_sbar
,SB_CTL
) + i
;
1184 if ((prime_time() == FALSE
) && (j
< 4)
1185 && ((j
> 0) || (stat_screen_mode
< 2)))
1186 add_string_to_buf("Item action: Finish what you're doing first.");
1189 if (overall_mode
== 4) {
1190 add_string_to_buf("Note: Clicking 'U' button by item");
1191 add_string_to_buf(" uses the item.");
1192 use_item(stat_window
, item_hit
);
1196 else if (prime_time() == TRUE
) {
1197 equip_item(stat_window
, item_hit
);
1202 use_item(stat_window
, item_hit
);
1203 if ((overall_mode
!= 3) && (overall_mode
!= 11))
1204 did_something
= TRUE
;
1208 give_thing(stat_window
, item_hit
);
1209 did_something
= TRUE
;
1214 if (stat_window
== 6){
1215 use_spec_item(spec_item_array
[item_hit
]);
1216 need_redraw
= TRUE
;////
1219 drop_item(stat_window
,item_hit
,party
.p_loc
);
1221 add_string_to_buf("Drop item: Click where to drop item.");
1222 store_drop_item
= item_hit
;
1223 overall_mode
= (is_town()) ? 5 : 15;
1227 if (stat_window
== 6)
1228 put_spec_item_info(spec_item_array
[item_hit
]);
1229 else display_pc_item(stat_window
, item_hit
,adven
[stat_window
].items
[item_hit
],0);
1231 case 5: // sell? That this codes was reached indicates that the item was sellable
1232 switch (stat_screen_mode
) {
1233 case 2: // identify item
1234 if (take_gold(shop_identify_cost
,FALSE
) == FALSE
)
1235 ASB("Identify: You don't have the gold.");
1238 ASB("Your item is identified.");
1239 adven
[stat_window
].items
[item_hit
].item_properties
=
1240 adven
[stat_window
].items
[item_hit
].item_properties
| 1;
1243 case 3: case 4: case 5: // various selling
1245 party
.gold
+= store_selling_values
[i
];
1246 ASB("You sell your item.");
1247 take_item(stat_window
,item_hit
);
1249 case 6: // enchant item
1250 if (take_gold(store_selling_values
[i
],FALSE
) == FALSE
)
1251 ASB("Enchant: You don't have the gold.");
1254 ASB("Your item is now enchanted.");
1255 enchant_weapon(stat_window
,item_hit
,shop_identify_cost
,store_selling_values
[i
]);
1265 put_item_screen(stat_window
,0);
1266 need_reprint
= TRUE
;
1271 if (the_point
.x
== 1000) {
1272 need_reprint
= TRUE
;
1274 if (overall_mode
== 1) {
1277 else add_string_to_buf("Alchemy: Only in town.");
1282 // Wait 40 spaces (town only)
1283 if (the_point
.x
== 1001) {
1284 need_reprint
= TRUE
;
1287 if (party_sees_a_monst() == TRUE
)
1288 add_string_to_buf("Long wait: Monster in sight.");
1290 add_string_to_buf("Long wait... ");
1295 for (i
= 0; i
< 6; i
++){
1296 store_sp
[i
] = adven
[i
].cur_health
;
1297 adven
[i
].status
[6] = 0;
1302 while ((i
< 80) && (party_sees_a_monst() == FALSE
)){
1306 j
= get_ran(1,1,160 - c_town
.difficulty
);
1308 create_wand_monst();
1309 for (j
= 0; j
< 6; j
++)
1310 if (adven
[j
].cur_health
< store_sp
[j
]) {
1313 add_string_to_buf(" Waiting interrupted.");
1315 if (party_sees_a_monst() == TRUE
) {
1317 add_string_to_buf(" Monster sighted! ");
1324 // If in combat and pc delayed, jump forward a step
1325 if (pc_delayed
== TRUE
) {
1330 set_stat_window(current_pc
);
1334 // At this point, see if any specials have been queued up, and deal with them
1335 for (i
= 0; i
< 20; i
++)
1336 if (special_queue
[i
] >= 0) {
1340 run_special(5,2,special_queue
[0],c_town
.p_loc
,&s1
,&s2
,&s3
);
1343 run_special(6,2,special_queue
[1],party
.p_loc
,&s1
,&s2
,&s3
);
1350 // Handle non-PC stuff (like monsters) if the party actually did something
1351 if (did_something
== TRUE
) {
1352 draw_map(modeless_dialogs
[5],5);
1354 if ((overall_mode
>= 10) && (overall_mode
< 20)) {
1355 if (no_pcs_left() == TRUE
) {
1357 if (which_combat_type
== 0) {
1358 end_town_mode(0,party
.p_loc
);
1359 add_string_to_buf("Fled the combat. ");
1360 handle_wandering_specials(0,2);
1365 if (need_redraw
== TRUE
) {
1367 if ((combat_active_pc
== 6) || (pc_moves
[combat_active_pc
] > 0))
1368 need_redraw
= FALSE
;
1371 store_cur_pc
= current_pc
;
1372 if (combat_next_step() == TRUE
)
1374 /* if ((store_cur_pc != current_pc) && (combat_active_pc == 6)) {
1375 // need_reprint = TRUE;
1383 if (!(is_out()) || ((is_out()) && (party
.age
% 10 == 0))) // no monst move is party outdoors and on horse
1385 if (overall_mode
!= 0)
1388 if ((overall_mode
== 0) && (party_toast() == FALSE
) && (party
.age
% 10 == 0)) {
1390 i
= get_ran(1,1,70 + PSD
[306][8] * 200);
1392 create_wand_monst();
1393 for (i
= 0; i
< 10; i
++)
1394 if (party
.out_c
[i
].exists
== TRUE
)
1395 if (((adjacent(party
.p_loc
,party
.out_c
[i
].m_loc
) == TRUE
) ||
1396 (party
.out_c
[i
].what_monst
.cant_flee
>= 10))
1397 && (party
.in_boat
< 0) && (flying() == FALSE
)) {
1398 store_wandering_special
= party
.out_c
[i
].what_monst
;
1400 if (handle_wandering_specials(0,0) == TRUE
)
1401 initiate_outdoor_combat(i
);
1402 party
.out_c
[i
].exists
= FALSE
;
1404 // Get rid of excess keyclicks
1407 need_reprint
= FALSE
;
1411 if (overall_mode
== 1) {
1412 i
= get_ran(1,1,160 - c_town
.difficulty
+ PSD
[306][8] * 200);
1414 create_wand_monst();
1423 if (need_redraw
== TRUE
) {
1428 if ((need_reprint
== TRUE
) || (need_redraw
== TRUE
)) {
1432 if (end_scenario
== TRUE
) {
1434 in_startup_mode
= TRUE
;
1437 if (FCD(901,0) == 2)
1440 if (party_toast() == TRUE
) {
1441 for (i
= 0; i
< 6; i
++)
1442 if (adven
[i
].main_status
== 5) {
1443 adven
[i
].main_status
= 1;
1445 end_town_mode(0,c_town
.p_loc
);
1446 add_string_to_buf("End combat. ");
1447 handle_wandering_specials(0,2);
1450 if (party
.stuff_done
[304][0] > 0) {
1455 else if (is_town()) {
1458 center
= c_town
.p_loc
;
1463 put_item_screen(stat_window
,0);
1464 if (party_toast() == TRUE
) {
1467 if (All_Done
== TRUE
)
1472 // MessageBox(mainPtr,"At end","Debug note",MB_OK | MB_ICONEXCLAMATION);
1473 are_done
= All_Done
;
1477 Boolean
someone_awake()
1481 for (i
= 0; i
< 6; i
++)
1482 if ((adven
[i
].main_status
== 1) && (adven
[i
].status
[11] <= 0) && (adven
[i
].status
[12] <= 0))
1487 void check_cd_event(HWND hwnd
,UINT message
,UINT wparam
,LONG lparam
)
1490 Boolean action_done
= FALSE
;
1491 short wind_hit
= -1,item_hit
= -1;
1495 // pare out command messages sent from text box
1498 cd_find_dlog(hwnd
,&wind_hit
,&item_hit
); // item_hit is dummy
1499 item_hit
= (short) wparam
;
1502 wind_hit
= cd_process_syskeystroke(hwnd
, wparam
, lparam
,&item_hit
);
1506 wind_hit
= cd_process_keystroke(hwnd
, wparam
, lparam
,&item_hit
);
1509 case WM_LBUTTONDOWN
:
1510 press
= MAKEPOINT(lparam
);
1511 wind_hit
= cd_process_click(hwnd
,press
, wparam
, lparam
,&item_hit
);
1513 case WM_RBUTTONDOWN
:
1514 press
= MAKEPOINT(lparam
);
1515 wparam
= wparam
| MK_CONTROL
;
1516 wind_hit
= cd_process_click(hwnd
,press
, wparam
, lparam
,&item_hit
);
1527 case 823: give_password_filter(item_hit
); break;
1528 case 869: pick_prefab_scen_event_filter(item_hit
); break;
1529 case 947: pick_a_scen_event_filter(item_hit
); break;
1530 case 958: tip_of_day_event_filter(item_hit
); break;
1531 case 960: talk_notes_event_filter(item_hit
); break;
1532 case 961: adventure_notes_event_filter(item_hit
); break;
1533 case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit
); break;
1534 case 987: display_item_event_filter(item_hit
); break;
1535 case 988: pick_trapped_monst_event_filter(item_hit
); break;
1536 case 989: edit_party_event_filter(item_hit
); break;
1537 case 991: display_pc_event_filter(item_hit
); break;
1538 case 996: display_alchemy_event_filter(item_hit
); break;
1539 case 997: display_help_event_filter(item_hit
); break;
1540 case 998: display_pc_item_event_filter(item_hit
); break;
1541 case 999: display_monst_event_filter(item_hit
); break;
1542 case 1010: spend_xp_event_filter (item_hit
); break;
1543 case 1012: get_num_of_items_event_filter (item_hit
); break;
1544 case 1013: pick_race_abil_event_filter (item_hit
); break;
1545 case 1014: sign_event_filter (item_hit
); break;
1546 case 1017: case 873: get_text_response_event_filter (item_hit
); break;
1547 case 1018: select_pc_event_filter (item_hit
); break;
1548 case 1019: give_pc_info_event_filter(item_hit
); break;
1549 case 1047: alch_choice_event_filter(item_hit
); break;
1550 case 1050: pc_graphic_event_filter(item_hit
); break;
1551 case 1051: pc_name_event_filter(item_hit
); break;
1552 case 1073: give_reg_info_event_filter (item_hit
); break;
1553 case 1075: do_registration_event_filter (item_hit
); break;
1554 case 1096: display_spells_event_filter (item_hit
); break;
1555 case 1097: display_skills_event_filter (item_hit
); break;
1556 case 1098: pick_spell_event_filter (item_hit
); break;
1557 case 1099: prefs_event_filter (item_hit
); break;
1558 default: fancy_choice_dialog_event_filter (item_hit
); break;
1563 void flash_rect(RECT to_flash
)
1569 hdc
= GetDC(mainPtr
);
1570 SetViewportOrg( hdc
,ulx
,uly
);
1571 InvertRect (hdc
,&to_flash
);
1574 InvertRect (hdc
,&to_flash
);
1575 fry_dc(mainPtr
,hdc
);
1579 void button_flash_rect(RECT to_flash
)
1585 hdc
= GetDC(mainPtr
);
1586 InvertRect (hdc
,&to_flash
);
1587 if (play_sounds
== TRUE
)
1589 else Delay(5,&dummy
);
1590 InvertRect (hdc
,&to_flash
);
1591 fry_dc(mainPtr
,hdc
);
1595 void flash_round_rect(RECT to_flash
,short radius
)
1601 hdc
= GetDC(mainPtr
);
1602 SetViewportOrg( hdc
,ulx
,uly
);
1603 InvertRect (hdc
,&to_flash
);
1606 InvertRect (hdc
,&to_flash
);
1607 fry_dc(mainPtr
,hdc
);
1612 void handle_menu_spell(short spell_picked
,short spell_type
)
1616 spell_forced
= TRUE
;
1617 pc_casting
= current_pc
;
1618 pc_last_cast
[spell_type
][current_pc
] = spell_picked
;
1619 if (spell_type
== 0)
1620 store_mage
= spell_picked
;
1621 else store_priest
= spell_picked
;
1622 if ((spell_type
== 0) && (mage_need_select
[spell_picked
] > 0)) {
1623 if ((store_spell_target
= char_select_pc(2 - mage_need_select
[spell_picked
],0,"Cast spell on who?")) == 6)
1627 if ((spell_type
== 1) && (priest_need_select
[spell_picked
] > 0))
1628 if ((store_spell_target
= char_select_pc(2 - priest_need_select
[spell_picked
],0,"Cast spell on who?")) == 6)
1632 pass_point
.x
= bottom_buttons
[spell_type
].left
+ 5;
1633 pass_point
.y
= bottom_buttons
[spell_type
].top
+ 5;
1634 handle_action(pass_point
,0,-1);
1637 void initiate_outdoor_combat(short i
)
1640 short m
,n
,store_lev
;
1645 // Is combat too easy?
1646 if ((party_total_level() > ((out_enc_lev_tot(i
) * 5) / 3) ) && (out_enc_lev_tot(i
) < 200)
1647 && (party
.out_c
[i
].what_monst
.cant_flee
% 10 != 1)) {
1648 add_string_to_buf("Combat: Monsters fled! ");
1649 party
.out_c
[i
].exists
= FALSE
;
1653 // Delay((long) 100,&dummy);
1655 start_outdoor_combat(party
.out_c
[i
], out
[party
.p_loc
.x
][party
.p_loc
.y
],count_walls(party
.p_loc
));
1657 party
.out_c
[i
].exists
= FALSE
;
1659 for (m
= 0; m
< 6; m
++)
1660 if (adven
[m
].main_status
== 1)
1661 to_place
= pc_pos
[m
];
1662 for (m
= 0; m
< 6; m
++)
1663 for (n
= 0; n
< 24; n
++)
1664 if ((adven
[m
].main_status
!= 1) && (adven
[m
].items
[n
].variety
!= 0)) {
1665 place_item(adven
[m
].items
[n
],to_place
,TRUE
);
1666 adven
[m
].items
[n
].variety
= 0;
1670 center
= pc_pos
[current_pc
];
1674 void initiate_redraw()
1675 // Draw changes in terrain, but only if terrain is onscreen
1677 /*if (is_combat()) {
1678 print_nums(0,0,current_pc);
1680 MessageBox(mainPtr,"In redraw proc now","Debug note",MB_OK | MB_ICONEXCLAMATION);
1682 if ((overall_mode
< 20) || (overall_mode
>= 30))
1686 Boolean
handle_syskeystroke(UINT wParam
,LONG lParam
,short *handled
)
1688 UINT kp
[10] = {VK_NUMPAD0
,VK_NUMPAD1
, VK_NUMPAD2
, VK_NUMPAD3
, VK_NUMPAD4
,
1689 VK_NUMPAD5
, VK_NUMPAD6
, VK_NUMPAD7
, VK_NUMPAD8
, VK_NUMPAD9
};
1690 POINT terrain_click
[10] = {{150,185},{120,215},{150,215},{180,215},
1691 {120,185},{150,185},{180,185},
1692 {120,155},{150,155},{180,135}};
1694 Boolean are_done
= FALSE
;
1697 if (in_startup_mode
== TRUE
)
1700 for (i
= 0; i
< 10; i
++)
1701 if (wParam
== kp
[i
]) {
1704 return handle_keystroke((UINT
) 'z',-1);
1708 pass_point
.x
= terrain_click
[i
].x
;
1709 pass_point
.y
= terrain_click
[i
].y
;
1712 are_done
= handle_action(pass_point
,wParam
,-1);
1717 if (overall_mode
== 20) {
1718 if (wParam
== VK_ESCAPE
) {
1719 pass_point
.x
= preset_words
[6].word_rect
.left
+ 9;
1720 pass_point
.y
= preset_words
[6].word_rect
.top
+ 9;
1721 are_done
= handle_action(pass_point
,wParam
,-1);
1725 else if (overall_mode
== 21) { // shopping keystrokes
1726 if (wParam
== VK_ESCAPE
) {
1729 are_done
= handle_action(pass_point
,wParam
,-1);
1734 if ((wParam
== VK_LEFT
) || (wParam
== VK_RIGHT
)) {
1736 pass_point
.x
= (wParam
== VK_LEFT
) ? 120 : 180;
1738 are_done
= handle_action(pass_point
,wParam
,-1);
1741 if ((wParam
== VK_UP
) || (wParam
== VK_DOWN
)) {
1744 pass_point
.y
= (wParam
== VK_UP
) ? 155 : 215;
1745 are_done
= handle_action(pass_point
,wParam
,-1);
1752 Boolean
handle_keystroke(UINT wParam
,LONG lParam
)
1754 Boolean are_done
= FALSE
;
1757 long i2
,j2
,k2
,l2
,dum2
;
1763 char keypad
[10] = {82,83,84,85,86,87,88,89,91,92};
1764 POINT terrain_click
[10] = {{150,185},{120,215},{150,215},{180,215},
1765 {120,185},{150,185},{180,185},
1766 {120,155},{150,155},{180,135}};
1767 char talk_chars
[9] = {'l','n','j','b','s','r','d','g','a'};
1768 Boolean dialog_grabbed_key
= FALSE
;
1771 if (in_startup_mode
== TRUE
)
1774 chr
= (char) wParam
;
1776 if (overall_mode
== 20) {
1779 for (i
= 0; i
< 9; i
++)
1780 if (chr
== talk_chars
[i
]) {
1781 pass_point
.x
= preset_words
[i
].word_rect
.left
+ 9;
1782 pass_point
.y
= preset_words
[i
].word_rect
.top
+ 9;
1783 are_done
= handle_action(pass_point
,wParam
,-1);
1787 else if (overall_mode
== 21) { // shopping keystrokes
1788 for (i
= 0; i
< 8; i
++)
1789 if (chr
== 97 + i
) {
1790 pass_point
.x
= shopping_rects
[i
][1].left
+ 9;
1791 pass_point
.y
= shopping_rects
[i
][1].top
+ 9;
1792 are_done
= handle_action(pass_point
,wParam
,-1);
1797 if ((overall_mode
!= 20) && (overall_mode
!= 21)) {
1799 for (k
= 0; k
< (short) LOWORD(lParam
); k
++)
1804 if (in_scen_debug
== TRUE
) {
1805 if (registered
== FALSE
) {
1806 ASB("Until your copy is registered,");
1807 ASB("you can't turn debug mode off.");
1810 in_scen_debug
= FALSE
;
1811 ASB("Debug mode OFF.");
1813 else if (enter_password() == FALSE
)
1814 ASB("Password incorrect.");
1816 in_scen_debug
= TRUE
;
1817 ASB("Debug mode ON.");
1823 add_string_to_buf("Memory check:");
1824 ASB("Num 1: Free memory div by 1000");
1825 ASB("Num 2: % of user resources left");
1826 ASB("Num 3: % of graphics resources left");
1827 s1
= GetFreeSpace(0);
1828 s2
= GetFreeSystemResources(GFSR_USERRESOURCES
);
1829 i
= (short) (s1
/ 1000);
1831 s2
= GetFreeSystemResources(GFSR_GDIRESOURCES
);
1839 add_string_to_buf("If Valorim ...");
1843 add_string_to_buf("You want to save ...");
1847 add_string_to_buf("Back up your save files ...");
1851 add_string_to_buf("Burma Shave.");
1856 if (is_out()) FCD(1079,0);
1857 if (is_town()) FCD(1080,0);
1858 if (is_combat()) FCD(1081,0);
1859 if (overall_mode
== 21) {
1860 party
.help_received
[26] = 0;
1861 give_help(226,27,0);
1863 if (overall_mode
== 21) {
1864 party
.help_received
[26] = 0;
1865 give_help(226,27,0);
1867 if (overall_mode
== 20) {
1868 party
.help_received
[5] = 0;
1873 case '1': case '2': case '3': case '4': case '5': case '6':
1874 pass_point
.x
= pc_buttons
[((short) chr
) - 49][0].left
+ 1 + PC_WIN_UL_X
;
1875 pass_point
.y
= pc_buttons
[((short) chr
) - 49][0].top
+ PC_WIN_UL_Y
;
1876 are_done
= handle_action(pass_point
,wParam
,-1);
1881 pass_point
.x
= item_screen_button_rects
[6].left
+ ITEM_WIN_UL_X
;
1882 pass_point
.y
= item_screen_button_rects
[6].top
+ ITEM_WIN_UL_Y
;
1883 are_done
= handle_action(pass_point
,wParam
,-1);
1888 if (overall_mode
== 14) { // cast multi-target spell, set # targets to 0 so that
1889 // space clicked doesn't matter
1890 num_targets_left
= 0;
1891 pass_point
= terrain_click
[5];
1892 are_done
= handle_action(pass_point
,wParam
,-1);
1895 if (overall_mode
== 11)
1896 spell_cast_hit_return();
1901 if (((overall_mode
>= 10) && (overall_mode
< 20)) || (overall_mode
== 37)) {
1902 set_stat_window(current_pc
);
1903 put_item_screen(stat_window
,0);
1907 put_item_screen(stat_window
,0);
1912 if (debug_on
== FALSE
) {
1913 for (i
= 0; i
< 6; i
++)
1914 adven
[i
].exp_adj
= 100;
1919 for (i
= 0; i
< 6; i
++) {
1920 adven
[i
].main_status
= 1;
1921 adven
[i
].cur_health
= 100;
1922 adven
[i
].cur_sp
= 100;
1925 refresh_store_items();
1926 for (i
= 0; i
< 6; i
++)
1927 for (j
= 0; j
< 62; j
++) {
1928 adven
[i
].mage_spells
[j
] = TRUE
;
1929 adven
[i
].priest_spells
[j
] = TRUE
;
1930 adven
[i
].skills
[9] = 7;
1931 adven
[i
].skills
[10] = 7;
1934 add_string_to_buf("Debug: Add stuff and heal. ");
1941 for (i
= 0; i
< T_M
; i
++) {
1942 if ((is_combat()) && (c_town
.monst
.dudes
[i
].active
> 0) && (c_town
.monst
.dudes
[i
].attitude
% 2 == 1))
1943 c_town
.monst
.dudes
[i
].active
= 0;
1945 if ((c_town
.monst
.dudes
[i
].active
> 0) && (c_town
.monst
.dudes
[i
].attitude
% 2 == 1)
1946 && (dist(c_town
.monst
.dudes
[i
].m_loc
,c_town
.p_loc
) <= 10) )
1947 damage_monst(i
, 7,1000,0, 4);
1949 // kill_monst(&c_town.monst.dudes[i],6);
1951 add_string_to_buf("Debug: Kill things. ");
1960 refresh_store_items();
1961 add_string_to_buf("Debug: Refreshed jobs/shops. ");
1966 // current_switch = 6;
1967 // start_new_game(0);
1980 if (debug_on
== TRUE
) {
1981 print_nums(-999,-999,-999);
1984 if (debug_ok
== 1) {
1985 print_nums(999,999,999);
1990 if (debug_on
== TRUE
) {
1991 ASB("Debug: Increase age.");
1998 ASB("DEBUG: Towns have short memory.");
1999 ASB("Your deeds have been forgotten.");
2001 for (i
= 0; i
< 4; i
++)
2002 party
.creature_save
[i
].which_town
= 200;
2005 if (overall_mode
< 2) {
2006 pass_point
.x
= (overall_mode
== 0) ? 170 : 221;
2008 are_done
= handle_action(pass_point
,wParam
,-1);
2014 case 'b': case 'u': case 'L':
2015 if (overall_mode
== 1) {
2016 pass_point
.x
= (chr
== 'u') ? 220 : 205;
2017 pass_point
.y
= (chr
== 'L') ? 405 : 388;
2018 are_done
= handle_action(pass_point
,wParam
,-1);
2023 case 's': case 'x': case 'e':
2024 if ((overall_mode
== 10) ||
2025 ((overall_mode
== 12) && (chr
== 's')) ||
2026 ((overall_mode
== 13) && (chr
== 's')) ) {
2027 pass_point
.x
= (chr
== 's') ? 205 : 240;
2028 pass_point
.y
= (chr
== 'e') ? 390 : 406;
2029 are_done
= handle_action(pass_point
,wParam
,-1);
2035 case 'm': case 'p': case 'l': case 'r': case 'w': case 't': case 'd': case 'g': case 'f':
2036 case 'M': case 'P': case 'A':
2038 if ((chr
== 'm') && ((overall_mode
== 11) || (overall_mode
== 14))) // cancel spell
2040 if ((chr
== 'p') && ((overall_mode
== 11) || (overall_mode
== 14))) // cancel spell
2042 if ((overall_mode
== 0) || (overall_mode
== 1) || (overall_mode
== 10)) {
2044 case 'M': spell_forced
= TRUE
; j
= 0; break;
2045 case 'm': j
= 0; break;
2046 case 'P': spell_forced
= TRUE
; j
= 1; break;
2047 case 'p': j
= 1; break;
2048 case 'l': j
= 2; break;
2049 case 'r': if (overall_mode
!= 0) return FALSE
;
2052 case 't': if (overall_mode
== 1)
2056 case 'A':if (overall_mode
== 1) {
2057 pass_point
.x
= 1000;
2058 are_done
= handle_action(pass_point
,wParam
,-1);
2061 add_string_to_buf("Alchemy: In town only.");
2066 case 'w':if (overall_mode
== 10)
2068 else if (overall_mode
== 1) {
2069 pass_point
.x
= 1001;
2070 are_done
= handle_action(pass_point
,wParam
,-1);
2073 add_string_to_buf("Wait: In town only.");
2078 case 'd': if (overall_mode
!= 10) return FALSE
;
2081 case 'g': if (overall_mode
== 0) return FALSE
;
2084 case 'f': if (overall_mode
!= 1) return FALSE
;
2090 pass_point
.x
= bottom_buttons
[j
].left
+ 5;
2091 pass_point
.y
= bottom_buttons
[j
].top
+ 5;
2092 are_done
= handle_action(pass_point
,wParam
,-1);
2101 spell_forced
= FALSE
;
2106 void menu_activate( short type
)
2107 // type; // 0 - save off alter off 1 - not all off
2112 menu
= GetMenu(mainPtr
);
2114 if (in_startup_mode
== TRUE
) {
2115 EnableMenuItem(menu
,2,MF_GRAYED
| MF_BYCOMMAND
);
2116 EnableMenuItem(menu
,3,MF_GRAYED
| MF_BYCOMMAND
);
2117 EnableMenuItem(menu
,21,MF_GRAYED
| MF_BYCOMMAND
);
2118 EnableMenuItem(menu
,22,MF_GRAYED
| MF_BYCOMMAND
);
2119 EnableMenuItem(menu
,23,MF_GRAYED
| MF_BYCOMMAND
);
2120 EnableMenuItem(menu
,24,MF_GRAYED
| MF_BYCOMMAND
);
2121 EnableMenuItem(menu
,26,MF_GRAYED
| MF_BYCOMMAND
);
2122 EnableMenuItem(menu
,27,MF_GRAYED
| MF_BYCOMMAND
);
2123 EnableMenuItem(menu
,28,MF_GRAYED
| MF_BYCOMMAND
);
2124 EnableMenuItem(menu
,29,MF_GRAYED
| MF_BYCOMMAND
);
2125 EnableMenuItem(menu
,81,MF_GRAYED
| MF_BYCOMMAND
);
2126 EnableMenuItem(menu
,82,MF_GRAYED
| MF_BYCOMMAND
);
2127 EnableMenuItem(menu
,84,MF_GRAYED
| MF_BYCOMMAND
);
2128 //EnableMenuItem(menu,,MF_GRAYED | MF_BYCOMMAND);
2130 DrawMenuBar(mainPtr
);
2134 EnableMenuItem(menu
,3,MF_ENABLED
| MF_BYCOMMAND
);
2135 EnableMenuItem(menu
,2,MF_ENABLED
| MF_BYCOMMAND
);
2136 EnableMenuItem(menu
,21,MF_ENABLED
| MF_BYCOMMAND
);
2137 EnableMenuItem(menu
,22,MF_ENABLED
| MF_BYCOMMAND
);
2138 EnableMenuItem(menu
,23,MF_ENABLED
| MF_BYCOMMAND
);
2139 EnableMenuItem(menu
,24,MF_ENABLED
| MF_BYCOMMAND
);
2140 EnableMenuItem(menu
,26,MF_ENABLED
| MF_BYCOMMAND
);
2141 EnableMenuItem(menu
,27,MF_ENABLED
| MF_BYCOMMAND
);
2142 EnableMenuItem(menu
,28,MF_ENABLED
| MF_BYCOMMAND
);
2143 EnableMenuItem(menu
,29,MF_ENABLED
| MF_BYCOMMAND
);
2144 EnableMenuItem(menu
,81,MF_ENABLED
| MF_BYCOMMAND
);
2145 EnableMenuItem(menu
,82,MF_ENABLED
| MF_BYCOMMAND
);
2146 EnableMenuItem(menu
,84,MF_ENABLED
| MF_BYCOMMAND
);
2147 DrawMenuBar(mainPtr
);
2148 /* cur_menu = GetMHandle(600);
2149 EnableItem(cur_menu,0);
2150 cur_menu = GetMHandle(700);
2151 EnableItem(cur_menu,0);
2152 cur_menu = GetMHandle(800);
2153 EnableItem(cur_menu,0);
2154 cur_menu = GetMHandle(900);
2155 EnableItem(cur_menu,0);
2156 cur_menu = GetMHandle(950);
2157 EnableItem(cur_menu,0);
2159 cur_menu = GetMHandle(550);
2160 EnableItem(cur_menu,2);
2161 EnableItem(cur_menu,3);
2168 if (in_startup_mode
== FALSE
)
2179 if (overall_mode
== 0)
2180 update_explored(party
.p_loc
);
2181 if (overall_mode
== 1) {
2186 create_clip_region();
2190 stat_window
= first_active_pc();
2194 //initiate_redraw();
2196 //beep(); beep();beep();beep();beep();
2203 adjust_spell_menus();
2204 adjust_monst_menu();
2206 cartoon_happening
= FALSE
;
2209 void do_save(short mode
)
2210 //mode; // 0 - normal 1 - save as
2212 // SelectWindow(mainPtr);
2213 if (overall_mode
> 1) {
2214 add_string_to_buf("Save: Only while outdoors, or in ");
2215 add_string_to_buf(" town and not looking/casting. ");
2223 put_item_screen(stat_window
,0);
2229 short i
,j
,k
,item
,how_many_short
= 0,r1
,store_day
;
2230 Boolean update_stat
= FALSE
;
2233 // Increase age, adjust light level & stealth
2234 store_day
= calc_day();
2236 if (party
.in_horse
< 0)
2237 party
.age
-= party
.age
% 10;
2238 else party
.age
-= party
.age
% 5;
2240 if (party
.in_horse
< 0)
2245 if (calc_day() != store_day
) { // Day changed, so check for interesting stuff.
2249 party
.light_level
= move_to_zero(party
.light_level
);
2251 // if (party.stuff_done[128][9] == 1)
2254 // decrease monster present counter
2255 party
.stuff_done
[305][9] = move_to_zero(party
.stuff_done
[305][9]);
2257 // Party spell effects
2258 if (party
.stuff_done
[305][0] == 1) {reset_text_bar();
2259 add_string_to_buf("Your footsteps grow louder. "); }
2260 party
.stuff_done
[305][0] = move_to_zero(party
.stuff_done
[305][0]);
2261 if (party
.stuff_done
[305][2] == 1) {reset_text_bar();
2262 add_string_to_buf("You stop detecting monsters. ");}
2263 party
.stuff_done
[305][2] = move_to_zero(party
.stuff_done
[305][2]);
2264 if (party
.stuff_done
[305][3] == 1) {reset_text_bar();
2265 add_string_to_buf("Your feet stop glowing. ");}
2266 party
.stuff_done
[305][3] = move_to_zero(party
.stuff_done
[305][3]);
2268 if (party
.stuff_done
[305][1] == 2)
2269 add_string_to_buf("You are starting to descend.");
2270 if (party
.stuff_done
[305][1] == 1) {
2271 if (scenario
.ter_types
[out
[party
.p_loc
.x
][party
.p_loc
.y
]].blockage
> 2) {
2272 add_string_to_buf(" You plummet to your deaths. ");
2277 else add_string_to_buf(" You land safely. ");
2281 party
.stuff_done
[305][1] = move_to_zero(party
.stuff_done
[305][1]);
2283 if ((overall_mode
> 0) && (c_town
.town
.lighting
== 2))
2284 party
.light_level
= max (0,party
.light_level
- 9);
2285 if (c_town
.town
.lighting
== 3) {
2286 if (party
.light_level
> 0)
2287 ASB("Your light is drained.");
2288 party
.light_level
= 0;
2292 // Specials countdowns
2293 if ((party
.age
% 500 == 0) && (get_ran(1,0,5) == 3) && (party_has_abil(52) == TRUE
)) {
2295 display_enc_string(52,39,3);
2296 for (i
= 0; i
< 6; i
++)
2301 // Plants and magic shops
2302 if (party
.age
% 4000 == 0) {
2304 //ASB("DEBUG: Stuff replaced.");
2305 refresh_store_items();
2306 //for (i = 0; i < 10; i++)
2307 // party.stuff_done[302][i] = 0;
2308 //for (i = 0; i < 10; i++)
2309 // party.stuff_done[301][i] = 0;
2310 //for (i = 0; i < 10; i++)
2311 //// party.stuff_done[300][i] = 0;
2315 for (i
= 0; i
< 6; i
++) { // Process some status things, and check if stats updated
2317 if ((adven
[i
].status
[4] == 1) || (adven
[i
].status
[5] == 1) || (adven
[i
].status
[8] == 1)
2318 || (adven
[i
].status
[11] == 1)|| (adven
[i
].status
[12] == 1))
2320 adven
[i
].status
[4] = move_to_zero(adven
[i
].status
[4]);
2321 adven
[i
].status
[5] = move_to_zero(adven
[i
].status
[5]);
2322 adven
[i
].status
[8] = move_to_zero(adven
[i
].status
[8]);
2323 adven
[i
].status
[10] = move_to_zero(adven
[i
].status
[10]);
2324 adven
[i
].status
[11] = move_to_zero(adven
[i
].status
[11]);
2325 adven
[i
].status
[12] = move_to_zero(adven
[i
].status
[12]);
2326 if ((party
.age
% 40 == 0) && (adven
[i
].status
[0] > 0)) {
2328 adven
[i
].status
[0] = move_to_zero(adven
[i
].status
[0]);
2334 if ((party
.age
% 1000 == 0) && (overall_mode
< 10)) {
2335 for (i
= 0; i
< 6; i
++)
2336 if (adven
[i
].main_status
== 1)
2338 how_many_short
= take_food (how_many_short
,FALSE
);
2339 if (how_many_short
> 0) {
2340 add_string_to_buf("Starving! ");
2342 r1
= get_ran(3,1,6);
2345 if (overall_mode
< 10)
2346 boom_space(party
.p_loc
,overall_mode
,0,r1
,0);
2350 add_string_to_buf("You eat. ");
2355 // Poison, acid, disease damage
2356 for (i
= 0; i
< 6; i
++) // Poison
2357 if (adven
[i
].status
[2] > 0) {
2359 if (((overall_mode
== 0) && (party
.age
% 50 == 0)) || ((overall_mode
== 1) && (party
.age
% 20 == 0))) {
2364 for (i
= 0; i
< 6; i
++) // Disease
2365 if (adven
[i
].status
[7] > 0) {
2367 if (((overall_mode
== 0) && (party
.age
% 100 == 0)) || ((overall_mode
== 1) && (party
.age
% 25 == 0))) {
2372 for (i
= 0; i
< 6; i
++) // Acid
2373 if (adven
[i
].status
[13] > 0) {
2379 // Healing and restoration of spell pts.
2381 if (party
.age
% 100 == 0) {
2382 for (i
= 0; i
< 6; i
++)
2383 if ((adven
[i
].main_status
== 1) && (adven
[i
].cur_health
< adven
[i
].max_health
))
2389 if (party
.age
% 50 == 0) {
2390 for (i
= 0; i
< 6; i
++)
2391 if ((adven
[i
].main_status
== 1) && (adven
[i
].cur_health
< adven
[i
].max_health
))
2397 if (party
.age
% 80 == 0) {
2398 for (i
= 0; i
< 6; i
++)
2399 if ((adven
[i
].main_status
== 1) && (adven
[i
].cur_sp
< adven
[i
].max_sp
))
2401 restore_sp_party(2);
2405 if (party
.age
% 40 == 0) {
2406 for (i
= 0; i
< 6; i
++)
2407 if ((adven
[i
].main_status
== 1) && (adven
[i
].cur_sp
< adven
[i
].max_sp
))
2409 restore_sp_party(1);
2413 // Recuperation and chronic disease disads
2414 for (i
= 0; i
< 6; i
++)
2415 if (adven
[i
].main_status
== 1) {
2416 if ((adven
[i
].traits
[9] > 0) && (get_ran(1,0,10) == 1) && (adven
[i
].cur_health
< adven
[i
].max_health
)) {
2420 if ((adven
[i
].traits
[13] > 0) && (get_ran(1,0,110) == 1)) {
2428 // Blessing, slowed,etc.
2429 if (party
.age
% 4 == 0)
2430 for (i
= 0; i
< 6; i
++) {
2431 if ((adven
[i
].status
[1] != 0) || (adven
[i
].status
[3] != 0))
2433 adven
[i
].status
[1] = move_to_zero(adven
[i
].status
[1]);
2434 adven
[i
].status
[3] = move_to_zero(adven
[i
].status
[3]);
2435 if (((item
= pc_has_abil_equip(i
,50)) < 24)
2436 && (adven
[i
].cur_health
< adven
[i
].max_health
)
2437 && ((overall_mode
> 0) || (get_ran(1,0,10) == 5))){
2438 j
= get_ran(1,0,adven
[i
].items
[item
].ability_strength
/ 3);
2439 if (adven
[i
].items
[item
].ability_strength
/ 3 == 0)
2441 if (is_out()) j
= j
* 4;
2449 special_increase_age();
2450 //if (debug_on == FALSE)
2459 // Cancel switching PC order
2462 // If a change, draw stat screen
2463 if (update_stat
== TRUE
)
2465 adjust_spell_menus();
2468 void handle_cave_lore()
2477 ter
= out
[party
.p_loc
.x
][party
.p_loc
.y
];
2478 pic
= scenario
.ter_types
[ter
].picture
;
2479 for (i
= 0; i
< 6; i
++)
2480 if ((adven
[i
].main_status
== 1) && (adven
[i
].traits
[4] > 0) && (get_ran(1,0,12) == 5)
2481 && (((pic
>= 0) && (pic
<= 1)) || ((pic
>= 70) && (pic
<= 76))) ) {
2482 sprintf((char *)str
,"%s hunts.",adven
[i
].name
);
2483 party
.food
+= get_ran(2,1,6);
2484 add_string_to_buf((char *)str
);
2487 for (i
= 0; i
< 6; i
++)
2489 (adven
[i
].main_status
== 1) && (adven
[i
].traits
[5] > 0) && (get_ran(1,0,12) == 5)
2490 && (((pic
>= 2) && (pic
<= 4)) || ((pic
>= 79) && (pic
<= 84)))) {
2491 sprintf((char *)str
,"%s hunts.",adven
[i
].name
);
2492 party
.food
+= get_ran(2,1,6);
2493 add_string_to_buf((char *)str
);
2500 void switch_pc(short which
)
2502 pc_record_type store_pc
;
2504 if (current_switch
< 6) {
2505 if (current_switch
!= which
) {
2506 add_string_to_buf("Switch: OK.");
2507 store_pc
= adven
[which
];
2508 adven
[which
] = adven
[current_switch
];
2509 adven
[current_switch
] = store_pc
;
2510 if (current_pc
== current_switch
)
2512 else if (current_pc
== which
)
2513 current_pc
= current_switch
;
2514 set_stat_window(current_pc
);
2515 update_pc_graphics();
2519 ASB("Switch: Not with self.");
2524 add_string_to_buf("Switch: Switch with who? ");
2525 current_switch
= which
;
2529 void drop_pc(short which
)
2533 choice
= fancy_choice_dialog(1053,0);
2535 add_string_to_buf("Delete PC: Cancelled. ");
2538 add_string_to_buf("Delete PC: OK. ");
2540 for (i
= which
; i
< 5; i
++)
2541 adven
[i
] = adven
[i
+ 1];
2542 adven
[5].main_status
= 0;
2551 in_startup_mode
= TRUE
;
2553 while (in_startup_mode
== TRUE
) {
2554 // Use death (or leave Exile) dialog
2555 in_startup_mode
= FALSE
;
2556 choice
= FCD(1069,0); //// FCD hates it when it gets called in startup mode
2557 // and startup graphiocs aren't loaded.
2558 in_startup_mode
= TRUE
;
2561 in_startup_mode
= FALSE
;
2565 in_startup_mode
= FALSE
;
2567 if (party_toast() == FALSE
) {
2568 if (in_startup_mode
== FALSE
)
2572 else in_startup_mode
= TRUE
;
2581 void start_new_game()
2583 short which
,i
,r1
; // 0 - make party 1 - sample party
2584 short num_pcs
= 0,choice
;
2585 Boolean creation_done
= FALSE
;
2586 location in_town_loc
= {59,6};
2588 choice
= FCD(1065,0);
2592 //which = choice - 1;
2597 //while (creation_done == FALSE) {
2599 /* if ((i > 0) || (in_startup_mode == FALSE))
2600 creation_done = TRUE;
2601 if ((i == 0) && (in_startup_mode == FALSE))
2605 // if no PCs left, forget it
2606 for (i
= 0 ; i
< 6; i
++)
2607 if (adven
[i
].main_status
== 1)
2613 // everyone gets a weapon
2614 for (i
= 0; i
< 6; i
++)
2615 if (adven
[i
].main_status
== 1) {
2616 adven
[i
].items
[0] = start_items
[adven
[i
].race
* 2];
2617 adven
[i
].equip
[0] = TRUE
;
2618 adven
[i
].items
[1] = start_items
[adven
[i
].race
* 2 + 1];
2619 adven
[i
].equip
[1] = TRUE
;
2621 // PCs get adjustments
2622 for (i
= 0; i
< 6; i
++)
2623 if (adven
[i
].main_status
== 1) {
2624 // Do stat adjs for selected race.
2625 if (adven
[i
].race
== 1) {
2626 if (adven
[i
].skills
[1] < 18)
2627 adven
[i
].skills
[1] += 2;
2629 if (adven
[i
].race
== 2) {
2630 if (adven
[i
].skills
[0] < 18)
2631 adven
[i
].skills
[0] += 2;
2632 if (adven
[i
].skills
[2] < 19)
2633 adven
[i
].skills
[2] += 1;
2635 adven
[i
].max_sp
+= adven
[i
].skills
[9] * 3 + adven
[i
].skills
[10] * 3;
2636 adven
[i
].cur_sp
= adven
[i
].max_sp
;
2639 party_in_memory
= TRUE
;
2643 location
get_cur_direction(POINT the_point
)
2645 location store_dir
= {0,0};
2647 // This is a kludgy adjustment to adjust for the screen shifting between Exile I & II
2651 if ((the_point
.x
< 135) & (the_point
.y
>= ((the_point
.x
* 34) / 10) - 293)
2652 & (the_point
.y
<= (-1 * ((the_point
.x
* 34) / 10) + 663)))
2654 if ((the_point
.x
> 163) & (the_point
.y
<= ((the_point
.x
* 34) / 10) - 350)
2655 & (the_point
.y
>= (-1 * ((the_point
.x
* 34) / 10) + 721)))
2658 if ((the_point
.y
< 167) & (the_point
.y
<= (the_point
.x
/ 2) + 102)
2659 & (the_point
.y
<= (-1 * (the_point
.x
/ 2) + 249)))
2661 if ((the_point
.y
> 203) & (the_point
.y
>= (the_point
.x
/ 2) + 123)
2662 & (the_point
.y
>= (-1 * (the_point
.x
/ 2) + 268)))
2668 Boolean
outd_move_party(location destination
,Boolean forced
)
2670 char create_line
[60];
2671 short i
,boat_num
,horse_num
,spec_num
;
2672 location real_dest
, sector_p_in
;
2673 Boolean keep_going
= TRUE
,check_f
;
2674 location store_corner
,store_iwc
;
2677 keep_going
= check_special_terrain(destination
,0,0,&spec_num
,&check_f
);
2678 if (check_f
== TRUE
)
2680 if (debug_on
== TRUE
)
2685 // If not blocked and not put in town by a special, process move
2686 if ((keep_going
== TRUE
) && (overall_mode
== 0)) {
2688 real_dest
.x
= destination
.x
- party
.p_loc
.x
;
2689 real_dest
.y
= destination
.y
- party
.p_loc
.y
;
2691 sector_p_in
.x
= party
.outdoor_corner
.x
+ party
.i_w_c
.x
;
2692 sector_p_in
.y
= party
.outdoor_corner
.y
+ party
.i_w_c
.y
;
2694 store_corner
= party
.outdoor_corner
;
2695 store_iwc
= party
.i_w_c
;
2697 // Check if party moves into new sector
2698 if ((destination
.x
< 6) && (party
.outdoor_corner
.x
> 0))
2699 shift_universe_left();
2700 if ((destination
.x
> 90) && (party
.outdoor_corner
.x
< scenario
.out_width
- 1))
2701 shift_universe_right();
2702 if ((destination
.y
< 6) && (party
.outdoor_corner
.y
> 0)) {
2703 shift_universe_up();
2705 else if ((destination
.y
> 90) && (party
.outdoor_corner
.y
< scenario
.out_height
- 1))
2706 shift_universe_down();
2707 // Now stop from going off the world's edge
2708 real_dest
.x
= party
.p_loc
.x
+ real_dest
.x
;
2709 real_dest
.y
= party
.p_loc
.y
+ real_dest
.y
;
2710 if ((real_dest
.x
< 4) && (party
.outdoor_corner
.x
<= 0)) {
2711 ASB("You've reached the world's edge.");
2714 if (((real_dest
.x
> 92) && (party
.outdoor_corner
.x
>= scenario
.out_width
- 2)) ||
2715 ((real_dest
.x
> 44) && (party
.outdoor_corner
.x
>= scenario
.out_width
- 1))) {
2716 ASB("You've reached the world's edge.");
2719 if ((real_dest
.y
< 4) && (party
.outdoor_corner
.y
<= 0)) {
2720 ASB("You've reached the world's edge.");
2723 else if (((real_dest
.y
> 92) && (party
.outdoor_corner
.y
>= scenario
.out_height
- 2)) ||
2724 ((real_dest
.y
> 44) && (party
.outdoor_corner
.y
>= scenario
.out_height
- 1))) {
2725 ASB("You've reached the world's edge.");
2729 // if ((store_corner.x != party.outdoor_corner.x) || (store_corner.y != party.outdoor_corner.y) ||
2730 // (store_iwc.x != party.i_w_c.x) || (store_iwc.y != party.i_w_c.y))
2735 //if (forced == TRUE)
2736 // for (i = 0; i < 10; i++)
2737 // if (same_point(destination,party.out_c[i].m_loc) == TRUE)
2738 // party.out_c[i].exists = FALSE;
2740 ter
= out
[real_dest
.x
][real_dest
.y
];
2741 if (party
.in_boat
>= 0) {
2742 if ((outd_is_blocked(real_dest
) == FALSE
) //&& (outd_is_special(real_dest) == FALSE)
2744 && ((scenario
.ter_types
[ter
].boat_over
== FALSE
)
2745 || ((real_dest
.x
!= party
.p_loc
.x
) && (real_dest
.y
!= party
.p_loc
.y
)))
2746 && (scenario
.ter_types
[ter
].special
!= 21)) {
2747 add_string_to_buf("You leave the boat.");
2750 else if (((real_dest
.x
!= party
.p_loc
.x
) && (real_dest
.y
!= party
.p_loc
.y
))
2751 || ((forced
== FALSE
) && (out_boat_there(destination
) < 30)))
2753 else if ((outd_is_blocked(real_dest
) == FALSE
)
2754 && (scenario
.ter_types
[ter
].boat_over
== TRUE
)
2755 && (scenario
.ter_types
[ter
].special
!= 21)) {
2756 if ((fancy_choice_dialog(1086,0)) == 1)
2759 add_string_to_buf("You leave the boat. ");
2763 else if (scenario
.ter_types
[ter
].boat_over
== TRUE
)
2767 if (((boat_num
= out_boat_there(real_dest
)) < 30) && (party
.in_boat
< 0) && (party
.in_horse
< 0)) {
2768 if (flying() == TRUE
) {
2769 add_string_to_buf("You land first. ");
2770 party
.stuff_done
[305][1] = 0;
2773 add_string_to_buf("Move: You board the boat. ");
2774 party
.in_boat
= boat_num
;
2775 party
.direction
= set_direction(party
.p_loc
, destination
);
2777 party
.p_loc
= real_dest
;
2778 party
.i_w_c
.x
= (party
.p_loc
.x
> 48) ? 1 : 0;
2779 party
.i_w_c
.y
= (party
.p_loc
.y
> 48) ? 1 : 0;
2780 party
.loc_in_sec
= global_to_local(party
.p_loc
);
2782 if ((store_corner
.x
!= party
.outdoor_corner
.x
) || (store_corner
.y
!= party
.outdoor_corner
.y
) ||
2783 (store_iwc
.x
!= party
.i_w_c
.x
) || (store_iwc
.y
!= party
.i_w_c
.y
))
2788 else if (((horse_num
= out_horse_there(real_dest
)) < 30) && (party
.in_boat
< 0) && (party
.in_horse
< 0)) {
2789 if (flying() == TRUE
) {
2790 add_string_to_buf("Land before mounting horses.");
2793 if ((scenario
.ter_types
[ter
].special
>= 2) && (scenario
.ter_types
[ter
].special
<= 4)) {
2794 ASB("Your horses quite sensibly refuse.");
2799 add_string_to_buf("Move: You mount the horses. ");
2801 party
.in_horse
= horse_num
;
2802 party
.direction
= set_direction(party
.p_loc
, destination
);
2804 party
.p_loc
= real_dest
;
2805 party
.i_w_c
.x
= (party
.p_loc
.x
> 48) ? 1 : 0;
2806 party
.i_w_c
.y
= (party
.p_loc
.y
> 48) ? 1 : 0;
2807 party
.loc_in_sec
= global_to_local(party
.p_loc
);
2809 if ((store_corner
.x
!= party
.outdoor_corner
.x
) || (store_corner
.y
!= party
.outdoor_corner
.y
) ||
2810 (store_iwc
.x
!= party
.i_w_c
.x
) || (store_iwc
.y
!= party
.i_w_c
.y
))
2815 else if ((outd_is_blocked(real_dest
) == FALSE
) || (forced
== TRUE
)
2816 // Check if can fly over
2817 || ((flying() == TRUE
) &&
2818 (scenario
.ter_types
[ter
].fly_over
== TRUE
)) ) {
2819 party
.direction
= set_direction(party
.p_loc
, destination
);
2821 if ((flying() == TRUE
) && (scenario
.ter_types
[ter
].special
== 21)) {
2822 add_string_to_buf("Moved: You have to land first. ");
2827 party
.p_loc
= real_dest
;
2828 party
.i_w_c
.x
= (party
.p_loc
.x
> 47) ? 1 : 0;
2829 party
.i_w_c
.y
= (party
.p_loc
.y
> 47) ? 1 : 0;
2830 party
.loc_in_sec
= global_to_local(party
.p_loc
);
2831 //sprintf ((char *) create_line, "Moved: %s",dir_string[party.direction]);//, party.p_loc.x, party.p_loc.y, party.loc_in_sec.x, party.loc_in_sec.y);
2832 //add_string_to_buf((char *) create_line);
2833 move_sound(out
[real_dest
.x
][real_dest
.y
],num_out_moves
);
2836 if (party
.in_boat
>= 0) {
2838 while (scenario
.ter_types
[out
[party
.p_loc
.x
][party
.p_loc
.y
+ 1]].special
== 15) {
2839 add_string_to_buf(" Waterfall! ");
2841 party
.loc_in_sec
.y
+= 2;
2842 update_explored(party
.p_loc
);
2845 if ((cave_lore_present() > 0) && (get_ran(1,0,1) == 0))
2846 add_string_to_buf(" (No supplies lost.)");
2847 else if (party
.food
> 1800)
2849 else party
.food
= (party
.food
* 19) / 20;
2854 party
.boats
[party
.in_boat
].which_town
= 200;
2855 party
.boats
[party
.in_boat
].boat_loc_in_sec
= party
.loc_in_sec
;
2856 party
.boats
[party
.in_boat
].boat_loc
= party
.p_loc
;
2857 party
.boats
[party
.in_boat
].boat_sector
.x
= party
.outdoor_corner
.x
+ party
.i_w_c
.x
;
2858 party
.boats
[party
.in_boat
].boat_sector
.y
= party
.outdoor_corner
.y
+ party
.i_w_c
.y
;
2861 if (party
.in_horse
>= 0) {
2862 party
.horses
[party
.in_horse
].which_town
= 200;
2863 party
.horses
[party
.in_horse
].horse_loc_in_sec
= party
.loc_in_sec
;
2864 party
.horses
[party
.in_horse
].horse_loc
= party
.p_loc
;
2865 party
.horses
[party
.in_horse
].horse_sector
.x
= party
.outdoor_corner
.x
+ party
.i_w_c
.x
;
2866 party
.horses
[party
.in_horse
].horse_sector
.y
= party
.outdoor_corner
.y
+ party
.i_w_c
.y
;
2870 if ((store_corner
.x
!= party
.outdoor_corner
.x
) || (store_corner
.y
!= party
.outdoor_corner
.y
) ||
2871 (store_iwc
.x
!= party
.i_w_c
.x
) || (store_iwc
.y
!= party
.i_w_c
.y
))
2877 sprintf ((char *) create_line
, "Blocked: %s",dir_string
[set_direction(party
.p_loc
, destination
)]);
2878 add_string_to_buf((char *) create_line
);
2887 Boolean
town_move_party(location destination
,short forced
)
2889 char create_line
[60],keep_going
= TRUE
;
2890 short boat_there
,horse_there
,spec_num
,i
;
2892 Boolean check_f
= FALSE
;
2894 if (debug_on
== TRUE
)
2897 // remove if not registered
2899 if ((scenario.out_width != 3) || (scenario.out_height != 3) ||
2900 (scenario.num_towns != 21) || (scenario.town_size[3] != 1) || (scenario.town_size[9] != 0)) {
2901 ASB("Blades of Exile must be registered");
2902 ASB("before you can play scenarios besides");
2903 ASB("the unmodified Valley of Dying things.");
2909 if (monst_there(destination
) > T_M
)
2910 keep_going
= check_special_terrain(destination
,1,0,&spec_num
,&check_f
);
2911 if (check_f
== TRUE
)
2916 ter
= t_d
.terrain
[destination
.x
][destination
.y
];
2918 if (keep_going
== TRUE
) {
2919 if (party
.in_boat
>= 0) {
2920 if ((is_blocked(destination
) == FALSE
) && (is_special(destination
) == FALSE
)
2921 // If to bridge, exit if heading diagonal, keep going is head horiz or vert
2922 && ( (scenario
.ter_types
[ter
].boat_over
== FALSE
)
2923 || ((destination
.x
!= c_town
.p_loc
.x
) && (destination
.y
!= c_town
.p_loc
.y
)))) {
2924 add_string_to_buf("You leave the boat. ");
2927 else if ((destination
.x
!= c_town
.p_loc
.x
) && (destination
.y
!= c_town
.p_loc
.y
))
2929 // Crossing bridge: land or go through
2930 else if ((is_blocked(destination
) == FALSE
) && (scenario
.ter_types
[ter
].boat_over
== TRUE
)) {
2931 if ((fancy_choice_dialog(1086,0)) == 1)
2933 else if (is_blocked(destination
) == FALSE
) {
2934 add_string_to_buf("You leave the boat. ");
2938 // boat in destination
2939 else if (town_boat_there(destination
) < 30) {
2940 add_string_to_buf(" Boat there already. ");
2944 else if (scenario
.ter_types
[ter
].boat_over
== TRUE
)
2948 if (((boat_there
= town_boat_there(destination
)) < 30) && (party
.in_boat
< 0)) {
2949 if (party
.boats
[boat_there
].property
== TRUE
) {
2950 add_string_to_buf(" Not your boat. ");
2954 add_string_to_buf("Move: You board the boat. ");
2955 party
.in_boat
= boat_there
;
2956 party
.direction
= set_direction(c_town
.p_loc
, destination
);
2958 c_town
.p_loc
= destination
;
2959 center
= c_town
.p_loc
;
2963 else if (((horse_there
= town_horse_there(destination
)) < 30) && (party
.in_horse
< 0)) {
2964 if (party
.horses
[horse_there
].property
== TRUE
) {
2965 add_string_to_buf(" Not your horses. ");
2969 add_string_to_buf("Move: You mount the horses. ");
2971 party
.in_horse
= horse_there
;
2972 party
.direction
= set_direction(c_town
.p_loc
, destination
);
2974 c_town
.p_loc
= destination
;
2975 center
= c_town
.p_loc
;
2979 else if ((is_blocked(destination
) == FALSE
) || (forced
== 1)) {
2980 if (party
.in_horse
>= 0) {
2981 if ((scenario
.ter_types
[ter
].special
>= 2) && (scenario
.ter_types
[ter
].special
<= 4)) {
2982 ASB("Your horses quite sensibly refuse.");
2985 if (scenario
.ter_types
[ter
].block_horse
== TRUE
) {
2986 ASB("You can't take horses there!");
2989 if ((c_town
.town
.lighting
> 0) && (get_ran(1,0,1) == 0)) {
2990 ASB("The darkness spooks your horses.");
2995 party
.direction
= set_direction(c_town
.p_loc
, destination
);
2996 c_town
.p_loc
= destination
;
2997 //sprintf ((char *) create_line, "Moved: %s",dir_string[party.direction]);
2998 //add_string_to_buf((char *) create_line);
2999 // place_treasure(destination,5,3);
3001 move_sound(t_d
.terrain
[destination
.x
][destination
.y
],(short) party
.age
);
3003 if (party
.in_boat
>= 0) {
3004 party
.boats
[party
.in_boat
].boat_loc
= c_town
.p_loc
;
3005 party
.boats
[party
.in_boat
].which_town
= c_town
.town_num
;
3007 if (party
.in_horse
>= 0) {
3008 party
.horses
[party
.in_horse
].horse_loc
= c_town
.p_loc
;
3009 party
.horses
[party
.in_horse
].which_town
= c_town
.town_num
;
3011 center
= c_town
.p_loc
;
3015 if (is_door(destination
) == TRUE
)
3016 sprintf ((char *) create_line
, "Door locked: %s ",dir_string
[set_direction(c_town
.p_loc
, destination
)]);
3017 else sprintf ((char *) create_line
, "Blocked: %s ",dir_string
[set_direction(c_town
.p_loc
, destination
)]);
3018 add_string_to_buf((char *) create_line
);
3027 Boolean
someone_poisoned()
3031 for (i
= 0; i
< 6; i
++)
3032 if ((adven
[i
].main_status
== 1) && (adven
[i
].status
[2] > 0))
3037 short nearest_monster()
3042 for (j
= 0; j
< 10; j
++)
3043 if (party
.out_c
[j
].exists
== TRUE
) {
3044 s
= dist(party
.p_loc
,party
.out_c
[j
].m_loc
);
3050 void setup_outdoors(location where
)
3052 update_explored(where
);
3055 short get_outdoor_num()
3057 return (scenario
.out_width
* (party
.outdoor_corner
.y
+ party
.i_w_c
.y
) + party
.outdoor_corner
.x
+ party
.i_w_c
.x
);
3060 short count_walls(location loc
)
3062 unsigned char walls
[31] = {5,6,7,8,9, 10,11,12,13,14, 15,16,17,18,19, 20,21,22,23,24,
3063 25,26,27,28,29, 30,31,32,33,34, 35};
3067 for (k
= 0; k
< 31 ; k
++) {
3068 if (out
[loc
.x
+ 1][loc
.y
] == walls
[k
])
3070 if (out
[loc
.x
- 1][loc
.y
] == walls
[k
])
3072 if (out
[loc
.x
][loc
.y
+ 1] == walls
[k
])
3074 if (out
[loc
.x
][loc
.y
- 1] == walls
[k
])
3080 Boolean
is_sign(unsigned char ter
)
3082 unsigned char signs
[6] = {110,127,142,213,214,252};
3085 if (scenario
.ter_types
[ter
].special
== 11)