27 extern short overall_mode
;
28 extern party_record_type far party
;
29 extern piles_of_stuff_dumping_type
*data_store
;
30 extern piles_of_stuff_dumping_type2
*data_store2
;
31 extern talking_record_type far talking
;
32 extern scenario_data_type far scenario
;
34 extern current_town_type far c_town
;
35 extern unsigned char far out
[96][96];
36 extern unsigned char far out_e
[96][96];
37 extern unsigned char far combat_terrain
[64][64];
38 extern unsigned char far sfx
[64][64];
39 extern short which_combat_type
,current_pc
,stat_window
;
40 extern outdoor_record_type far outdoors
[2][2];
41 extern location pc_pos
[6],center
;
42 extern Boolean in_scen_debug
,belt_present
,registered
,processing_fields
,monsters_going
,suppress_stat_screen
,boom_anim_active
;
43 extern big_tr_type far t_d
;
44 extern pc_record_type far adven
[6];
45 extern effect_pat_type current_pat
;
46 extern town_item_list far t_i
;
47 extern out_wandering_type store_wandering_special
;
48 extern short pc_marked_damage
[6];
49 extern short monst_marked_damage
[T_M
];
50 extern HWND modeless_dialogs
[18];
51 extern Boolean fast_bang
,end_scenario
;
52 extern short town_size
[3];
53 extern short town_type
;
54 extern piles_of_stuff_dumping_type5
*data_store5
;
55 extern char far scen_strs2
[110][256];
57 Boolean can_draw_pcs
= TRUE
;
58 short store_item_spell_level
= 10;
59 Boolean special_in_progress
= FALSE
;
61 item_record_type null_item
= {0,0, 0,0,0,0,0,0, 0,0,0,0,0,0, 0, 0,0, {0,0},"", "",0,0,0,0};
62 short spec_str_offset
[3] = {160,10,20};
63 short current_pc_picked_in_spec_enc
= -1; // pc that's been selected, -1 if none
64 location store_special_loc
;
65 short boom_gr
[8] = {3,0,2,1,1,4,3,3};
66 short skill_max
[20] = {20,20,20,20,20,20,20,20,20,7,
67 7,20,20,10,20,20,20,20,20};
69 // 0 - everywhere 1 - combat only 2 - town only 3 - town & combat only 4 - can't use 5 - outdoor
70 // + 10 - mag. inept can use
71 short abil_chart
[200] = {4,4,4,4,4,4,4,4,4,4,
72 4,4,4,4,4,4,4,4,4,4,
73 4,4,4,4,4,4,4,4,4,4,
74 4,4,4,4,4,4,4,4,4,4,
75 4,4,4,4,4,4,4,4,4,4,
76 4,4,4,4,4,4,4,4,4,4, // 50
77 4,4,4,4,4,4,4,4,4,4,
78 13,0,0,0,3, 3,3,0,3,3,
79 3,3,3,3,3, 0,0,0,0,3,
80 13,3,3,5,0, 0,0,0,0,0,
81 4,4,4,4,4,4,4,4,4,4, // 100
82 1,1,1,1,1, 1,1,1,1,3,
83 3,1,1,1,1, 1,1,1,1,3,
84 1,2,2,1,1, 1,4,4,4,4,
85 4,4,4,4,4,4,4,4,4,4,
86 4,4,4,4,4,4,4,4,4,4, // 150
87 4,4,4,4,4,4,4,4,4,4,
88 4,4,4,4,4,4,4,4,4,4,
89 4,4,4,4,4,4,4,4,4,4,
92 Boolean
town_specials(short which
,short t_num
)
93 //short which; // number, 0 - 39, of special
95 Boolean can_enter
= TRUE
;
96 short choice
,spec_id
,str_resource
;
100 l
= c_town
.town
.special_locs
[which
];
101 spec_id
= c_town
.town
.spec_id
[which
];
112 Boolean
handle_wandering_specials (short which
,short mode
)
113 //short mode; // 0 - pre 1 - end by victory 2 - end by flight
114 // wanderin spec 99 -> generic spec
118 short s1
= 0,s2
= 0,s3
= 0;
119 location null_loc
= {0,0};
121 if ((mode
== 0) && (store_wandering_special
.spec_on_meet
>= 0)) { // When encountering
122 run_special(13,1,store_wandering_special
.spec_on_meet
,null_loc
,&s1
,&s2
,&s3
);
127 if ((mode
== 1) && (store_wandering_special
.spec_on_win
>= 0)) {// After defeating
128 run_special(15,1,store_wandering_special
.spec_on_win
,null_loc
,&s1
,&s2
,&s3
);
130 if ((mode
== 2) && (store_wandering_special
.spec_on_flee
>= 0)) {// After fleeing like a buncha girly men
131 run_special(14,1,store_wandering_special
.spec_on_flee
,null_loc
,&s1
,&s2
,&s3
);
137 Boolean
check_special_terrain(location where_check
,short mode
,short which_pc
,short *spec_num
,
139 //short mode; // 0 - out 1 - town 2 - combat
142 short r1
,i
,choice
,door_pc
,x
,ter_special
,ter_flag1
,ter_flag2
,dam_type
= 0,pic_type
= 0,ter_pic
= 0;
143 Boolean can_enter
= TRUE
;
144 location out_where
,from_loc
,to_loc
;
145 short s1
= 0,s2
= 0,s3
= 0;
152 ter
= out
[where_check
.x
][where_check
.y
];
153 from_loc
= party
.p_loc
;
156 ter
= t_d
.terrain
[where_check
.x
][where_check
.y
];
157 from_loc
= c_town
.p_loc
;
160 ter
= combat_terrain
[where_check
.x
][where_check
.y
];
161 from_loc
= pc_pos
[current_pc
];
164 ter_special
= scenario
.ter_types
[ter
].special
;
165 ter_flag1
= scenario
.ter_types
[ter
].flag1
;
166 ter_flag2
= scenario
.ter_types
[ter
].flag2
;
167 ter_pic
= scenario
.ter_types
[ter
].picture
;
169 if ((mode
> 0) && (ter_special
>= 16) &&
170 (ter_special
<= 19)) {
172 ((ter_special
== 16) && (where_check
.y
> from_loc
.y
)) ||
173 ((ter_special
== 17) && (where_check
.x
< from_loc
.x
)) ||
174 ((ter_special
== 18) && (where_check
.y
< from_loc
.y
)) ||
175 ((ter_special
== 19) && (where_check
.x
> from_loc
.x
)) ) {
176 ASB("The moving floor prevents you.");
182 out_where
= global_to_local(where_check
);
184 for (i
= 0; i
< 18; i
++)
185 if (same_point(out_where
,outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_locs
[i
]) == TRUE
) {
186 *spec_num
= outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_id
[i
];
187 if ((*spec_num
>= 0) &&
188 (outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].specials
[*spec_num
].type
== 4))
191 run_special(mode
,1,outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_id
[i
],out_where
,&s1
,&s2
,&s3
);
194 erase_out_specials();
196 put_item_screen(stat_window
,0);
200 if ((is_combat()) && (((ter_pic
<= 207) && (ter_pic
>= 212)) || (ter_pic
== 406))) {
201 ASB("Move: Can't trigger this special in combat.");
205 if (((mode
== 1) || ((mode
== 2) && (which_combat_type
== 1)))
206 && (special(where_check
.x
,where_check
.y
))) {
207 if (is_force_barrier(where_check
.x
,where_check
.y
)) {
208 add_string_to_buf(" Magic barrier! ");
211 for (i
= 0; i
< 50; i
++)
212 if ((same_point(where_check
,c_town
.town
.special_locs
[i
]) == TRUE
) &&
213 (c_town
.town
.spec_id
[i
] >= 0)) {
214 if (c_town
.town
.specials
[c_town
.town
.spec_id
[i
]].type
== 4) {
217 *spec_num
= c_town
.town
.spec_id
[i
];
218 if ((is_blocked(where_check
) == FALSE
) || (ter_special
== 1)
219 || (ter_special
== 12) || (ter_special
== 13)) {
221 run_special(mode
,2,c_town
.town
.spec_id
[i
],where_check
,&s1
,&s2
,&s3
);
227 put_item_screen(stat_window
,0);
230 if (can_enter
== FALSE
)
233 if ((!is_out()) && (overall_mode
< 20)) {
234 check_fields(where_check
,mode
,which_pc
);
236 if (is_web(where_check
.x
,where_check
.y
)) {
237 add_string_to_buf(" Webs! ");
239 suppress_stat_screen
= TRUE
;
240 for (i
= 0; i
< 6; i
++) {
244 suppress_stat_screen
= TRUE
;
247 else web_pc(current_pc
,get_ran(1,2,3));
248 take_web(where_check
.x
,where_check
.y
);
250 if (is_force_barrier(where_check
.x
,where_check
.y
)) {
251 add_string_to_buf(" Magic barrier! ");
254 if (is_crate(where_check
.x
,where_check
.y
)) {
255 add_string_to_buf(" You push the crate.");
256 to_loc
= push_loc(from_loc
,where_check
);
257 take_crate((short) where_check
.x
,(short) where_check
.y
);
259 make_crate((short) to_loc
.x
,(short) to_loc
.y
);
260 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
261 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,where_check
))
262 && (is_contained(t_i
.items
[i
]) == TRUE
))
263 t_i
.items
[i
].item_loc
= to_loc
;
265 if (is_barrel(where_check
.x
,where_check
.y
)) {
266 add_string_to_buf(" You push the barrel.");
267 to_loc
= push_loc(from_loc
,where_check
);
268 take_barrel((short) where_check
.x
,(short) where_check
.y
);
270 make_barrel((short) to_loc
.x
,(short) to_loc
.y
);
271 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
272 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,where_check
))
273 && (is_contained(t_i
.items
[i
]) == TRUE
))
274 t_i
.items
[i
].item_loc
= to_loc
;
279 switch (ter_special
) {
281 alter_space(where_check
.x
,where_check
.y
,ter_flag1
);
282 if (ter_flag2
< 200) {
283 play_sound(-1 * ter_flag2
);
286 if (scenario
.ter_types
[ter
].blockage
> 2)
289 case 2: case 3:case 4:
292 if (ter_special
== 2) {
293 add_string_to_buf(" It's hot!");
294 dam_type
= 1; pic_type
= 0;
295 if (party
.stuff_done
[305][3] > 0) {
296 add_string_to_buf(" It doesn't affect you.");
300 if (ter_special
== 3) {
301 add_string_to_buf(" You feel cold!");
302 dam_type
= 5; pic_type
= 4;
304 if (ter_special
== 4) {
305 add_string_to_buf(" Something shocks you!");
306 dam_type
= 3; pic_type
= 1;
308 r1
= get_ran(ter_flag2
,dam_type
,ter_flag1
);
313 damage_pc(which_pc
,r1
,dam_type
,-1);
314 if (overall_mode
< 10)
315 boom_space(party
.p_loc
,overall_mode
,pic_type
,r1
,12);
321 if (party
.in_boat
>= 0)
325 for (i
= 0; i
< 6; i
++)
326 if (adven
[i
].main_status
== 1)
328 if (get_ran(1,1,100) <= ter_flag2
) {
329 if (ter_special
== 5)
330 poison_pc(i
,ter_flag1
);
331 else disease_pc(i
,ter_flag1
);
335 //print_nums(1,which_pc,current_pc);
337 if (get_ran(1,1,100) <= ter_flag2
){
338 if (ter_special
== 5)
339 poison_pc(which_pc
,ter_flag1
);
340 else disease_pc(which_pc
,ter_flag1
);
344 case 12: // local special
345 run_special(mode
,2,ter_flag1
,where_check
,&s1
,&s2
,&s3
);
349 case 13: // global special
350 run_special(mode
,0,ter_flag1
,where_check
,&s1
,&s2
,&s3
);
358 if (is_combat()) { // No lockpicking in combat
359 add_string_to_buf(" Can't enter: It's locked.");
363 // See what party wants to do.
364 choice
= fancy_choice_dialog(993,0);
369 if ((door_pc
= select_pc(1,0)) < 6) {
371 pick_lock(where_check
,door_pc
);
372 else bash_door(where_check
,door_pc
);
379 // Action may change terrain, so update what's been seen
381 update_explored(c_town
.p_loc
);
383 update_explored(pc_pos
[current_pc
]);
388 // This procedure find the effects of fields that would affect a PC who moves into
389 // a space or waited in that same space
390 void check_fields(location where_check
,short mode
,short which_pc
)
391 //mode; // 0 - out 1 - town 2 - combat
393 short r1
,i
,choice
,door_pc
;
399 if (is_fire_wall(where_check
.x
,where_check
.y
)) {
400 add_string_to_buf(" Fire wall! ");
401 r1
= get_ran(1,1,6) + 1;
405 damage_pc(which_pc
,r1
,1,-1);
406 if (overall_mode
< 10)
407 boom_space(party
.p_loc
,overall_mode
,0,r1
,5);
409 if (is_force_wall(where_check
.x
,where_check
.y
)) {
410 add_string_to_buf(" Force wall! ");
415 damage_pc(which_pc
,r1
,3,-1);
416 if (overall_mode
< 10)
417 boom_space(party
.p_loc
,overall_mode
,1,r1
,12);
419 if (is_ice_wall(where_check
.x
,where_check
.y
)) {
420 add_string_to_buf(" Ice wall! ");
425 damage_pc(which_pc
,r1
,5,-1);
426 if (overall_mode
< 10)
427 boom_space(party
.p_loc
,overall_mode
,4,r1
,7);
429 if (is_blade_wall(where_check
.x
,where_check
.y
)) {
430 add_string_to_buf(" Blade wall! ");
435 damage_pc(which_pc
,r1
,0,-1);
436 if (overall_mode
< 10)
437 boom_space(party
.p_loc
,overall_mode
,3,r1
,2);
439 if (is_quickfire(where_check
.x
,where_check
.y
)) {
440 add_string_to_buf(" Quickfire! ");
445 damage_pc(which_pc
,r1
,1,-1);
446 if (overall_mode
< 10)
447 boom_space(party
.p_loc
,overall_mode
,0,r1
,5);
449 if (is_scloud(where_check
.x
,where_check
.y
)) {
450 add_string_to_buf(" Stinking cloud! ");
452 suppress_stat_screen
= TRUE
;
453 for (i
= 0; i
< 6; i
++) {
457 suppress_stat_screen
= FALSE
;
460 else curse_pc(current_pc
,get_ran(1,2,3));
462 if (is_sleep_cloud(where_check
.x
,where_check
.y
)) {
463 add_string_to_buf(" Sleep cloud! ");
465 suppress_stat_screen
= TRUE
;
466 for (i
= 0; i
< 6; i
++) {
469 suppress_stat_screen
= FALSE
;
472 else sleep_pc(current_pc
,3,11,0);
474 if (is_fire_barrier(where_check
.x
,where_check
.y
)) {
475 add_string_to_buf(" Magic barrier! ");
476 r1
= get_ran(2,1,10);
480 damage_pc(which_pc
,r1
,3,-1);
481 if (overall_mode
< 10)
482 boom_space(party
.p_loc
,overall_mode
,1,r1
,12);
486 void use_item(short pc
,short item
)
488 Boolean take_charge
= TRUE
,inept_ok
= FALSE
;
489 short abil
,level
,i
,j
,item_use_code
,store
,str
,type
,amt
,which_stat
,r1
;
492 creature_data_type
*which_m
;
493 effect_pat_type s
= {{{0,0,0,0,0,0,0,0,0},
501 {0,0,0,0,0,0,0,0,0}}};
502 abil
= adven
[pc
].items
[item
].ability
;
503 level
= adven
[pc
].items
[item
].item_level
;
505 item_use_code
= abil_chart
[abil
];
506 if (item_use_code
>= 10) {
512 user_loc
= party
.p_loc
;
514 user_loc
= c_town
.p_loc
;
516 user_loc
= pc_pos
[current_pc
];
518 if (item_use_code
== 4) {
519 add_string_to_buf("Use: Can't use this item. ");
522 if ((adven
[pc
].traits
[11] == TRUE
) && (inept_ok
== FALSE
)){
523 add_string_to_buf("Use: Can't - magically inept. ");
527 if (take_charge
== TRUE
) {
528 if ((overall_mode
== 0) && (item_use_code
> 0) && (item_use_code
!= 5)) {
529 add_string_to_buf("Use: Not while outdoors. ");
532 if ((overall_mode
== 1) && (item_use_code
== 1)) {
533 add_string_to_buf("Use: Not while in town. ");
536 if ((overall_mode
== 10) && (item_use_code
== 2)) {
537 add_string_to_buf("Use: Not in combat. ");
540 if ((overall_mode
!= 0) && (item_use_code
== 5)){
541 add_string_to_buf("Use: Only outdoors. ");
545 if (take_charge
== TRUE
) {
546 if (is_ident(adven
[pc
].items
[item
]) == FALSE
)
547 sprintf((char *) to_draw
, "Use: %s",adven
[pc
].items
[item
].name
);
548 else sprintf((char *) to_draw
, "Use: %s",adven
[pc
].items
[item
].full_name
);
549 add_string_to_buf((char *) to_draw
);
551 if ((adven
[pc
].items
[item
].variety
== 7) &&
552 (adven
[pc
].items
[item
].graphic_num
>= 50) && (adven
[pc
].items
[item
].graphic_num
<= 52))
555 str
= adven
[pc
].items
[item
].ability_strength
;
556 store_item_spell_level
= str
* 2 + 1;
557 type
= adven
[pc
].items
[item
].magic_use_type
;
560 case 70: // poison weapon
561 take_charge
= poison_weapon(pc
,str
,0);
563 case 71: case 73: case 74: case 75: case 76:
569 ASB(" You feel awkward."); str
= str
* -1;}
570 else ASB(" You feel blessed.");
576 ASB(" You feel sluggish."); str
= str
* -1;}
577 else ASB(" You feel speedy.");
583 ASB(" You feel odd."); str
= str
* -1;}
584 else ASB(" You feel protected.");
590 ASB(" You feel odd."); str
= str
* -1;}
591 else ASB(" You feel protected.");
596 ASB(" You feel sticky.");
598 ASB(" Your skin tingles."); str
= str
* -1;}
604 ASB(" You feel exposed."); str
= str
* -1;}
605 else ASB(" You feel obscure.");
611 ASB(" You feel dull."); str
= str
* -1;}
612 else ASB(" You start to glow slightly.");
616 affect_party(which_stat
,str
);
617 else affect_pc(pc
,which_stat
,str
);
621 case 0: ASB(" You feel better."); cure_pc(pc
,str
); break;
622 case 1: ASB(" You feel ill."); poison_pc(pc
,str
); break;
623 case 2: ASB(" You all feel better."); cure_party(str
); break;
624 case 3: ASB(" You all feel ill."); poison_party(str
); break;
629 case 0: ASB(" You feel healthy."); affect_pc(pc
,7,-1 * str
); break;
630 case 1: ASB(" You feel sick."); disease_pc(pc
,str
); break;
631 case 2: ASB(" You all feel healthy."); affect_party(7,-1 * str
); break;
632 case 3: ASB(" You all feel sick."); for (i
= 0; i
< 6; i
++) disease_pc(i
,str
); break;
637 case 0: ASB(" You feel clear headed."); affect_pc(pc
,9,-1 * str
); break;
638 case 1: ASB(" You feel confused."); dumbfound_pc(pc
,str
); break;
639 case 2: ASB(" You all feel clear headed."); affect_party(9,-1 * str
); break;
640 case 3: ASB(" You all feel confused."); for (i
= 0; i
< 6; i
++) dumbfound_pc(i
,str
); break;
645 case 0: ASB(" You feel alert."); affect_pc(pc
,11,-1 * str
); break;
646 case 1: ASB(" You feel very tired."); sleep_pc(pc
,str
+ 1,11,200); break;
647 case 2: ASB(" You all feel alert."); affect_party(11,-1 * str
); break;
648 case 3: ASB(" You all feel very tired."); for (i
= 0; i
< 6; i
++) sleep_pc(i
,str
+ 1,11,200); break;
653 case 0: ASB(" You find it easier to move."); affect_pc(pc
,12,-1 * str
* 100); break;
654 case 1: ASB(" You feel very stiff."); sleep_pc(pc
,str
* 20 + 10,12,200); break;
655 case 2: ASB(" You all find it easier to move."); affect_party(12,-1 * str
* 100); break;
656 case 3: ASB(" You all feel very stiff."); for (i
= 0; i
< 6; i
++) sleep_pc(i
,str
* 20 + 10,12,200); break;
661 case 0: ASB(" Your skin tingles pleasantly."); affect_pc(pc
,13,-1 * str
); break;
662 case 1: ASB(" Your skin burns!"); acid_pc(pc
,str
); break;
663 case 2: ASB(" You all tingle pleasantly."); affect_party(13,-1 * str
); break;
664 case 3: ASB(" Everyone's skin burns!"); for (i
= 0; i
< 6; i
++) acid_pc(i
,str
); break;
670 case 1: ASB(" You feel wonderful!"); heal_pc(pc
,str
* 20); affect_pc(pc
,1,str
); break;
672 case 3: ASB(" Everyone feels wonderful!"); for (i
= 0; i
< 6; i
++) {
673 heal_pc(i
,str
* 20); affect_pc(i
,1,str
); } break;
678 case 0: ASB(" You feel much smarter."); award_xp(pc
,str
* 5); break;
679 case 1: ASB(" You feel forgetful."); drain_pc(pc
,str
* 5); break;
680 case 2: ASB(" You all feel much smarter."); award_party_xp(str
* 5); break;
681 case 3: ASB(" You all feel forgetful."); for (i
= 0; i
< 6; i
++) drain_pc(i
,str
* 5); break;
687 case 0: ASB(" You feel much smarter."); adven
[pc
].skill_pts
+= str
; break;
688 case 1: ASB(" You feel forgetful."); adven
[pc
].skill_pts
= max(0,adven
[pc
].skill_pts
- str
); break;
689 case 2: ASB(" You all feel much smarter."); for (i
= 0; i
< 6; i
++) adven
[i
].skill_pts
+= str
; break;
690 case 3: ASB(" You all feel forgetful."); for (i
= 0; i
< 6; i
++) adven
[i
].skill_pts
= max(0,adven
[i
].skill_pts
- str
); break;
695 case 0: ASB(" You feel better."); heal_pc(pc
,str
* 20); break;
696 case 1: ASB(" You feel sick."); damage_pc(pc
,20 * str
,4,0); break;
697 case 2: ASB(" You all feel better."); heal_party(str
* 20); break;
698 case 3: ASB(" You all feel sick."); hit_party(20 * str
,4); break;
703 case 0: ASB(" You feel energized."); restore_sp_pc(pc
,str
* 5); break;
704 case 1: ASB(" You feel drained."); adven
[pc
].cur_sp
= max(0,adven
[pc
].cur_sp
- str
* 5); break;
705 case 2: ASB(" You all feel energized."); restore_sp_party(str
* 5); break;
706 case 3: ASB(" You all feel drained."); for (i
= 0; i
< 6; i
++) adven
[i
].cur_sp
= max(0,adven
[i
].cur_sp
- str
* 5); break;
712 case 1: ASB(" You feel terrible."); drain_pc(pc
,str
* 5); damage_pc(pc
,20 * str
,4,0); disease_pc(pc
,2 * str
); dumbfound_pc(pc
,2 * str
); break;
714 case 3: ASB(" You all feel terrible."); for (i
= 0; i
< 6; i
++) {
715 drain_pc(i
,str
* 5); damage_pc(i
,20 * str
,4,0); disease_pc(i
,2 * str
); dumbfound_pc(i
,2 * str
);} break;
719 ASB(" You have more light."); increase_light(50 * str
);
722 ASB(" Your footsteps become quieter."); party
.stuff_done
[305][0] += 5 * str
;
725 ASB(" You feel chilly."); party
.stuff_done
[305][3] += 2 * str
;
728 if (party
.stuff_done
[305][1] > 0) {
729 add_string_to_buf(" Not while already flying. ");
732 if (party
.in_boat
>= 0)
733 add_string_to_buf(" Leave boat first. ");
734 else if (party
.in_horse
>= 0)////
735 add_string_to_buf(" Leave horse first. ");
737 ASB(" You rise into the air!"); party
.stuff_done
[305][1] += str
;
743 case 1: ASB(" You feel wonderful."); heal_pc(pc
,200); cure_pc(pc
,8); break;
745 case 3: ASB(" You all feel wonderful."); heal_party(200); cure_party(8); break;
751 add_string_to_buf(" It fires a bolt of flame.");
752 start_spell_targeting(1011);
755 add_string_to_buf(" It shoots a fireball. ");
756 start_spell_targeting(1022);
759 add_string_to_buf(" It shoots a huge fireball. ");
760 start_spell_targeting(1040);
763 add_string_to_buf(" It shoots a black ray. ");
764 start_spell_targeting(1048);
767 add_string_to_buf(" It fires a ball of ice. ");
768 start_spell_targeting(1031);
771 add_string_to_buf(" It fires a purple ray. ");
772 start_spell_targeting(1012);
775 add_string_to_buf(" The ground shakes! ");
776 do_shockwave(pc_pos
[current_pc
]);
779 add_string_to_buf(" It shoots a white ray. ");
780 start_spell_targeting(1132);
783 add_string_to_buf(" It shoots a golden ray. ");
784 start_spell_targeting(1155);
787 if (summon_monster(str
,user_loc
,50,2) == FALSE
)
788 add_string_to_buf(" Summon failed.");
792 for (i
= 0; i
< get_ran(1,3,5); i
++)
793 if (summon_monster(str
,user_loc
,r1
,2) == FALSE
)
794 add_string_to_buf(" Summon failed.");
797 add_string_to_buf(" Acid sprays from the tip! ");
798 start_spell_targeting(1068);
801 add_string_to_buf(" It creates a cloud of gas. ");
802 start_spell_targeting(1066);
805 add_string_to_buf(" It creates a shimmering cloud. ");
806 start_spell_targeting(1019);
809 add_string_to_buf(" A green ray emerges. ");
810 start_spell_targeting(1030);
813 add_string_to_buf(" Sparks fly.");
814 start_spell_targeting(1044);
817 add_string_to_buf(" It shoots a silvery beam. ");
818 start_spell_targeting(1069);
821 add_string_to_buf(" It explodes!");
822 start_spell_targeting(1065);
825 add_string_to_buf(" It shoots a fiery red ray. ");
826 start_spell_targeting(1062);
829 add_string_to_buf("Fire pours out!");
830 make_quickfire(user_loc
.x
,user_loc
.y
);
833 ASB("It throbs, and emits odd rays.");
834 for (i
= 0; i
< T_M
; i
++) {
835 if ((c_town
.monst
.dudes
[i
].active
!= 0) && (c_town
.monst
.dudes
[i
].attitude
% 2 == 1)
836 && (dist(pc_pos
[current_pc
],c_town
.monst
.dudes
[i
].m_loc
) <= 8)
837 && (can_see(pc_pos
[current_pc
],c_town
.monst
.dudes
[i
].m_loc
,0) < 5)) {
838 which_m
= &c_town
.monst
.dudes
[i
];
839 charm_monst(which_m
,0,0,8);
844 if (c_town
.town
.specials2
% 10 == 1) {
845 add_string_to_buf(" It doesn't work.");
848 add_string_to_buf(" You have a vision. ");
849 for (i
= 0; i
< town_size
[town_type
]; i
++)
850 for (j
= 0; j
< town_size
[town_type
]; j
++)
855 add_string_to_buf(" It fires a blinding ray.");
856 add_string_to_buf(" Target spell. ");
859 set_town_spell(1041,current_pc
);
862 add_string_to_buf(" It shoots a blue sphere. ");
863 start_spell_targeting(1064);
866 add_string_to_buf(" It fires a lovely, sparkling beam.");
867 start_spell_targeting(1117);
870 add_string_to_buf(" Your hair stands on end. ");
871 start_spell_targeting(1051);
877 // 64 - Ice Wall Balls
887 if ((take_charge
== TRUE
) && (adven
[pc
].items
[item
].charges
> 0))
888 remove_charge(pc
,item
);
889 if (take_charge
== FALSE
) {
891 put_item_screen(stat_window
,0);
895 // Returns TRUE if an action is actually carried out. This can only be reached in town.
896 Boolean
use_space(location where
)
900 short r1
,i
,choice
,door_pc
,spec_num
;
901 Boolean can_enter
= TRUE
;
902 location out_where
,from_loc
,to_loc
;
905 ter
= t_d
.terrain
[where
.x
][where
.y
];
906 from_loc
= c_town
.p_loc
;
908 add_string_to_buf("Use...");
910 if (is_web(where
.x
,where
.y
)) {
911 add_string_to_buf(" You clear the webs.");
912 take_web(where
.x
,where
.y
);
915 if (is_crate(where
.x
,where
.y
)) {
916 to_loc
= push_loc(from_loc
,where
);
917 if (same_point(from_loc
,to_loc
) == TRUE
) {
918 add_string_to_buf(" Can't push crate.");
921 add_string_to_buf(" You push the crate.");
922 take_crate((short) where
.x
,(short) where
.y
);
923 make_crate((short) to_loc
.x
,(short) to_loc
.y
);
924 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
925 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,where
))
926 && (is_contained(t_i
.items
[i
]) == TRUE
))
927 t_i
.items
[i
].item_loc
= to_loc
;
929 if (is_barrel(where
.x
,where
.y
)) {
930 to_loc
= push_loc(from_loc
,where
);
931 if (same_point(from_loc
,to_loc
) == TRUE
) {
932 add_string_to_buf(" Can't push barrel.");
935 add_string_to_buf(" You push the barrel.");
936 take_barrel((short) where
.x
,(short) where
.y
);
937 make_barrel((short) to_loc
.x
,(short) to_loc
.y
);
938 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
939 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,where
))
940 && (is_contained(t_i
.items
[i
]) == TRUE
))
941 t_i
.items
[i
].item_loc
= to_loc
;
944 switch (scenario
.ter_types
[ter
].special
) {
946 if (same_point(where
,from_loc
) == TRUE
) {
947 add_string_to_buf(" Not while on space.");
950 add_string_to_buf(" OK.");
951 alter_space(where
.x
,where
.y
,scenario
.ter_types
[ter
].flag1
);
952 play_sound(scenario
.ter_types
[ter
].flag2
);
955 case 23: // call special
956 run_special(17,0,scenario
.ter_types
[ter
].flag1
,where
,&i
,&i
,&i
);
959 add_string_to_buf(" Nothing to use.");
964 // Note ... if this is a container, the code must first process any specials. If
965 //specials return FALSE, can't get items inside. If TRUE, can get items inside.
966 // Can't get items out in combat.
967 Boolean
adj_town_look(location where
)
970 Boolean can_open
= TRUE
,item_there
= FALSE
,got_special
= FALSE
;
971 short i
= 0,trap_pc
,s1
= 0, s2
= 0, s3
= 0;
973 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
974 if ((t_i
.items
[i
].variety
> 0) && (is_contained(t_i
.items
[i
]) == TRUE
) &&
975 (same_point(where
,t_i
.items
[i
].item_loc
) == TRUE
))
978 terrain
= t_d
.terrain
[where
.x
][where
.y
];
979 if (special(where
.x
,where
.y
)) {// && (get_blockage(terrain) > 0)) {
980 if (adjacent(c_town
.p_loc
,where
) == FALSE
)
981 add_string_to_buf(" Not close enough to search.");
983 for (i
= 0; i
< 50; i
++)
984 if (same_point(where
,c_town
.town
.special_locs
[i
]) == TRUE
) {
985 if (get_blockage(t_d
.terrain
[where
.x
][where
.y
]) > 0) {
986 // tell party you find something, if looking at a space they can't step in
987 //if (c_town.town.special_id[i] >= 10)
988 // add_string_to_buf(" Search: You find something! ");
989 // else if (party.stuff_done[c_town.town_num][c_town.town.special_id[i]] < 20)
990 // add_string_to_buf(" Search: You find something! ");
992 //call special can_open = town_specials(i,c_town.town_num);
994 run_special(4,2,c_town
.town
.spec_id
[i
],where
,&s1
,&s2
,&s3
);
999 put_item_screen(stat_window
,0);
1002 if ((is_container(where
)) && (item_there
== TRUE
) && (can_open
== TRUE
)) {
1003 get_item(where
,6,TRUE
);
1005 else switch (terrain
) {
1007 add_string_to_buf(" (Use this space to do something");
1008 add_string_to_buf(" with it.)");
1012 if (got_special
== FALSE
)
1013 add_string_to_buf(" Search: You don't find anything. ");
1019 // PSOE - place_special_outdoor_encounter
1020 void PSOE(short str1a
,short str1b
,short str2a
,short str2b
,
1021 short which_special
,unsigned char *stuff_done_val
,short where_put
)
1022 // if always, stuff_done_val is NULL
1024 short i
,j
,graphic_num
= 0;
1026 if (stuff_done_val
!= NULL
) {
1027 if (*stuff_done_val
> 0)
1029 else *stuff_done_val
= 20;
1031 for (i
= 0; i
< 18; i
++)
1032 if (outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_id
[i
] == where_put
) {
1033 for (j
= 0; j
< 7; j
++)
1034 if (outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_enc
[which_special
].monst
[j
] > 0) {
1035 graphic_num
= 400 + get_monst_picnum(outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_enc
[which_special
].monst
[j
]);
1038 //display_strings( str1a, str1b, str2a, str2b,
1039 //// "Encounter!",57, graphic_num, 0);
1042 //if (outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[which_special].spec_code == 0)
1043 // outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[which_special].spec_code = 1;
1044 //place_outd_wand_monst(outdoors[party.i_w_c.x][party.i_w_c.y].special_locs[i],
1045 // outdoors[party.i_w_c.x][party.i_w_c.y].special_enc[which_special]);
1054 void out_move_party(char x
,char y
)
1059 l
= local_to_global(l
);
1065 void teleport_party(short x
,short y
,short mode
)
1066 // mode - 0 full teleport flash 1 no teleport flash 2 only fade flash
1078 start_missile_anim();
1079 for (i
= 0; i
< 9; i
++)
1080 add_explosion(l
,-1,1,1,0,0);
1081 do_explosion_anim(5,1);
1084 can_draw_pcs
= FALSE
;
1086 do_explosion_anim(5,2);
1089 center
.x
= x
; center
.y
= y
;
1091 pc_pos
[current_pc
].x
= x
;pc_pos
[current_pc
].y
= y
;
1100 start_missile_anim();
1101 for (i
= 0; i
< 14; i
++)
1102 add_explosion(center
,-1,1,1,0,0);
1103 do_explosion_anim(5,1);
1105 can_draw_pcs
= TRUE
;
1107 do_explosion_anim(5,2);
1110 draw_map(modeless_dialogs
[5],5);
1119 start_missile_anim();
1120 for (i
= 0; i
< 14; i
++)
1121 add_explosion(l
,-1,1,1,0,0);
1122 do_explosion_anim(5,1);
1123 c_town
.p_loc
.x
= 100;
1124 c_town
.p_loc
.y
= 100;
1125 do_explosion_anim(5,2);
1129 void change_level(short town_num
,short x
,short y
)
1133 if ((town_num
< 0) || (town_num
>= scenario
.num_towns
)) {
1134 give_error("The scenario special encounter tried to put you into a town that doesn't exist.","",0);
1140 force_town_enter(town_num
,l
);
1142 start_town_mode(town_num
,9);
1146 // Damaging and killing monsters needs to be here because several have specials attached to them.
1147 Boolean
damage_monst(short which_m
, short who_hit
, short how_much
, short how_much_spec
, short dam_type
)
1148 //short which_m, who_hit, how_much, how_much_spec; // 6 for who_hit means dist. xp evenly 7 for no xp
1149 //short dam_type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable 5 - cold
1150 // 6 - demon 7 - undead
1151 // 9 - marked damage, from during anim mode
1153 // 100s digit - damage sound for boom space
1155 creature_data_type
*victim
;
1156 short r1
,which_spot
,sound_type
;
1159 Boolean do_print
= TRUE
;
1162 //print_num(which_m,(short)c_town.monst.dudes[which_m].m_loc.x,(short)c_town.monst.dudes[which_m].m_loc.y);
1164 if (c_town
.monst
.dudes
[which_m
].active
== 0) return FALSE
;
1166 sound_type
= dam_type
/ 100;
1167 dam_type
= dam_type
% 100;
1169 if (dam_type
>= 10) {
1174 if (sound_type
== 0) {
1175 if ((dam_type
== 1) || (dam_type
== 4) )
1186 victim
= &c_town
.monst
.dudes
[which_m
];
1187 resist
= victim
->m_d
.immunities
;
1189 if (dam_type
== 3) {
1191 how_much
= how_much
/ 2;
1195 if (dam_type
== 1) {
1197 how_much
= how_much
/ 2;
1201 if (dam_type
== 5) {
1203 how_much
= how_much
/ 2;
1207 if (dam_type
== 2) {
1209 how_much
= how_much
/ 2;
1215 if (((dam_type
== 1) || (dam_type
== 3) || (dam_type
== 5))
1216 && (victim
->m_d
.spec_skill
== 26)) {
1217 victim
->m_d
.health
+= how_much
;
1218 ASB(" Magic absorbed.");
1223 if (((dam_type
== 1) || (dam_type
== 5)) && (get_ran(1,0,20) <= victim
->m_d
.level
))
1224 how_much
= how_much
/ 2;
1225 if ((dam_type
== 3) && (get_ran(1,0,24) <= victim
->m_d
.level
))
1226 how_much
= how_much
/ 2;
1229 if (victim
->m_d
.spec_skill
== 36)
1230 how_much
= how_much
/ 10;
1233 r1
= get_ran(1,0,(victim
->m_d
.armor
* 5) / 4);
1234 r1
+= victim
->m_d
.level
/ 4;
1238 if (boom_anim_active
== TRUE
) {
1241 monst_marked_damage
[which_m
] += how_much
;
1242 add_explosion(victim
->m_loc
,how_much
,0,(dam_type
> 2) ? 2 : 0,14 * (victim
->m_d
.x_width
- 1),18 * (victim
->m_d
.y_width
- 1));
1248 if (how_much
<= 0) {
1250 monst_spell_note(victim
->number
,7);
1251 if ((how_much
<= 0) && ((dam_type
== 0) || (dam_type
== 6) || (dam_type
== 7))) {
1255 // sprintf ((char *) create_line, " No damage. ");
1256 // add_string_to_buf((char *) create_line);
1260 if (do_print
== TRUE
)
1261 monst_damaged_mes(which_m
,how_much
,how_much_spec
);
1262 victim
->m_d
.health
= victim
->m_d
.health
- how_much
- how_much_spec
;
1264 if (in_scen_debug
== TRUE
)
1265 victim
->m_d
.health
= -1;
1266 // splitting monsters
1267 if ((victim
->m_d
.spec_skill
== 12) && (victim
->m_d
.health
> 0)){
1268 where_put
= find_clear_spot(victim
->m_loc
,1);
1269 if (where_put
.x
> 0)
1270 if ((which_spot
= place_monster(victim
->number
,where_put
)) < 90) {
1271 c_town
.monst
.dudes
[which_spot
].m_d
.health
= victim
->m_d
.health
;
1272 c_town
.monst
.dudes
[which_spot
].monst_start
= victim
->monst_start
;
1273 monst_spell_note(victim
->number
,27);
1277 party
.total_dam_done
+= how_much
+ how_much_spec
;
1279 // Monster damages. Make it hostile.
1283 if (dam_type
!= 9) { // note special damage only gamed in hand-to-hand, not during animation
1284 if (party_can_see_monst(which_m
) == TRUE
) {
1285 pre_boom_space(victim
->m_loc
,100,boom_gr
[dam_type
],how_much
,sound_type
);
1286 if (how_much_spec
> 0)
1287 boom_space(victim
->m_loc
,100,51,how_much_spec
,5);
1290 pre_boom_space(victim
->m_loc
,overall_mode
, boom_gr
[dam_type
],how_much
,sound_type
);
1291 if (how_much_spec
> 0)
1292 boom_space(victim
->m_loc
,overall_mode
,51,how_much_spec
,5);
1296 if (victim
->m_d
.health
< 0) {
1297 monst_killed_mes(which_m
);
1298 kill_monst(victim
,who_hit
);
1302 victim
->m_d
.morale
= victim
->m_d
.morale
- 1;
1304 victim
->m_d
.morale
= victim
->m_d
.morale
- 1;
1306 victim
->m_d
.morale
= victim
->m_d
.morale
- 1;
1308 victim
->m_d
.morale
= victim
->m_d
.morale
- 2;
1311 if ((victim
->attitude
% 2 != 1) && (who_hit
< 7) &&
1312 (processing_fields
== FALSE
) && (monsters_going
== FALSE
)) {
1313 add_string_to_buf("Damaged an innocent. ");
1314 victim
->attitude
= 1;
1315 make_town_hostile();
1317 if ((victim
->attitude
% 2 != 1) && (who_hit
< 7) &&
1318 ((processing_fields
== TRUE
) && (party
.stuff_done
[305][9] == 0))) {
1319 add_string_to_buf("Damaged an innocent.");
1320 victim
->attitude
= 1;
1321 make_town_hostile();
1327 void kill_monst(creature_data_type
*which_m
,short who_killed
)
1329 short xp
,i
,j
,num_brooch
= 0,s1
,s2
,s3
;
1330 location false_loc
= {20,20},l
;
1331 /* item_record_type items[4] = {
1332 {8,0,0,0,0,0,0,33,69,0,0,0,1,0,0,{0,0},"Nephilim Map","Scroll"},
1333 {13,7,3,0,0,0,0,16,0,0,0,150,0,0,0,{0,0},"Bronze Breastplate","Breastplate"},
1334 {7,3,0,0,0,1,1,30,3,0,0,350,0,0,1,{0,0},"Strong Healing P.","Potion"},
1335 {8,0,0,0,0,0,0,33,106,0,0,0,1,0,0,{0,0},"Empire orders","Scroll"}
1338 // play_sound(29 + get_ran(1,0,2));
1340 switch (which_m
->m_d
.m_type
) {
1341 case 0: case 3: case 4: case 5: case 6:
1342 if (( which_m
->number
== 38) ||
1343 ( which_m
->number
== 39))
1345 else if ( which_m
->number
== 45)
1347 else i
= get_ran(1,0,1);
1348 play_sound(29 + i
); break;
1349 case 9: play_sound(29); break;
1350 case 1: case 2: case 7: case 8: case 11:
1351 i
= get_ran(1,0,1); play_sound(31 + i
); break;
1352 default: play_sound(33); break;
1355 // Special killing effects
1356 if (sd_legit(which_m
->monst_start
.spec1
,which_m
->monst_start
.spec2
) == TRUE
)
1357 party
.stuff_done
[which_m
->monst_start
.spec1
][which_m
->monst_start
.spec2
] = 1;
1359 run_special(12,2,which_m
->monst_start
.special_on_kill
,which_m
->m_loc
,&s1
,&s2
,&s3
);
1360 if (which_m
->m_d
.radiate_1
== 15)
1361 run_special(12,0,which_m
->m_d
.radiate_2
,which_m
->m_loc
,&s1
,&s2
,&s3
);
1363 if ((in_scen_debug
== FALSE
) && ((which_m
->summoned
>= 100) || (which_m
->summoned
== 0))) { // no xp for party-summoned monsters
1364 xp
= which_m
->m_d
.level
* 2;
1366 award_xp(who_killed
,xp
);
1367 else if (who_killed
== 6)
1368 award_party_xp(xp
/ 6 + 1);
1369 if (who_killed
< 7) {
1370 i
= max((xp
/ 6),1);
1374 place_glands(l
,which_m
->number
);
1377 if ((in_scen_debug
== FALSE
) && (which_m
->summoned
== 0))
1378 place_treasure(which_m
->m_loc
, which_m
->m_d
.level
/ 2, which_m
->m_d
.treasure
, 0);
1380 i
= which_m
->m_loc
.x
;
1381 j
= which_m
->m_loc
.y
;
1382 switch (which_m
->m_d
.m_type
) {
1383 case 7: make_sfx(i
,j
,6); break;
1384 case 8: if (which_m
->number
<= 59) make_sfx(i
,j
,7); break;
1385 case 10: case 12: make_sfx(i
,j
,4); break;
1386 case 11: make_sfx(i
,j
,8); break;
1387 default: make_sfx(i
,j
,1); break;
1392 if (((is_town()) || (which_combat_type
== 1)) && (which_m
->summoned
== 0)) {
1393 party
.m_killed
[c_town
.town_num
]++;
1396 party
.total_m_killed
++;
1398 which_m
->monst_start
.spec1
= 0; // make sure, if this is a spec. activated monster, it won't come back
1400 which_m
->active
= 0;
1403 // Pushes party and monsters around by moving walls and conveyor belts.
1404 //This is very fragils, and only hands a few cases.
1407 Boolean redraw
= FALSE
;
1414 if (belt_present
== FALSE
)
1417 for (i
= 0; i
< T_M
; i
++)
1418 if (c_town
.monst
.dudes
[i
].active
> 0) {
1419 l
= c_town
.monst
.dudes
[i
].m_loc
;
1420 ter
= t_d
.terrain
[l
.x
][l
.y
];
1421 switch (scenario
.ter_types
[ter
].special
) {
1422 case 16: l
.y
--; break;
1423 case 17: l
.x
++; break;
1424 case 18: l
.y
++; break;
1425 case 19: l
.x
--; break;
1427 if (same_point(l
,c_town
.monst
.dudes
[i
].m_loc
) == FALSE
) {
1428 c_town
.monst
.dudes
[i
].m_loc
= l
;
1429 if ((point_onscreen(center
,c_town
.monst
.dudes
[i
].m_loc
) == TRUE
) ||
1430 (point_onscreen(center
,l
) == TRUE
))
1434 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
1435 if (t_i
.items
[i
].variety
> 0) {
1436 l
= t_i
.items
[i
].item_loc
;
1437 ter
= t_d
.terrain
[l
.x
][l
.y
];
1438 switch (scenario
.ter_types
[ter
].special
) {
1439 case 16: l
.y
--; break;
1440 case 17: l
.x
++; break;
1441 case 18: l
.y
++; break;
1442 case 19: l
.x
--; break;
1444 if (same_point(l
,t_i
.items
[i
].item_loc
) == FALSE
) {
1445 t_i
.items
[i
].item_loc
= l
;
1446 if ((point_onscreen(center
,t_i
.items
[i
].item_loc
) == TRUE
) ||
1447 (point_onscreen(center
,l
) == TRUE
))
1453 ter
= t_d
.terrain
[c_town
.p_loc
.x
][c_town
.p_loc
.y
];
1455 switch (scenario
.ter_types
[ter
].special
) {
1456 case 16: l
.y
--; break;
1457 case 17: l
.x
++; break;
1458 case 18: l
.y
++; break;
1459 case 19: l
.x
--; break;
1461 if (same_point(l
,c_town
.p_loc
) == FALSE
) {
1462 ASB("You get pushed.");
1463 if (scenario
.ter_types
[ter
].special
>= 16)
1468 ter
= t_d
.terrain
[c_town
.p_loc
.x
][c_town
.p_loc
.y
];
1469 draw_map(modeless_dialogs
[5],5);
1470 if (is_barrel(c_town
.p_loc
.x
,c_town
.p_loc
.y
)) {
1471 take_barrel(c_town
.p_loc
.x
,c_town
.p_loc
.y
);
1472 ASB("You smash the barrel.");
1474 if (is_crate(c_town
.p_loc
.x
,c_town
.p_loc
.y
)) {
1475 take_crate(c_town
.p_loc
.x
,c_town
.p_loc
.y
);
1476 ASB("You smash the crate.");
1478 for (k
= 0; k
< NUM_TOWN_ITEMS
; k
++)
1479 if ((t_i
.items
[k
].variety
> 0) && (is_contained(t_i
.items
[k
]) == TRUE
)
1480 && (same_point(t_i
.items
[k
].item_loc
,c_town
.p_loc
) == TRUE
))
1481 t_i
.items
[k
].item_properties
= t_i
.items
[k
].item_properties
& 247;
1486 for (i
= 0; i
< 6; i
++)
1487 if (adven
[i
].main_status
== 1) {
1488 ter
= t_d
.terrain
[pc_pos
[i
].x
][pc_pos
[i
].y
];
1490 switch (scenario
.ter_types
[ter
].special
) {
1491 case 16: l
.y
--; break;
1492 case 17: l
.x
++; break;
1493 case 18: l
.y
++; break;
1494 case 19: l
.x
--; break;
1496 if (same_point(l
, pc_pos
[i
]) == FALSE
) {
1497 ASB("Someone gets pushed.");
1498 ter
= t_d
.terrain
[l
.x
][l
.y
];
1499 if (scenario
.ter_types
[ter
].special
>= 16)
1503 draw_map(modeless_dialogs
[5],5);
1504 if (is_barrel(pc_pos
[i
].x
,pc_pos
[i
].y
)) {
1505 take_barrel(pc_pos
[i
].x
,pc_pos
[i
].y
);
1506 ASB("You smash the barrel.");
1508 if (is_crate(pc_pos
[i
].x
,pc_pos
[i
].y
)) {
1509 take_crate(pc_pos
[i
].x
,pc_pos
[i
].y
);
1510 ASB("You smash the crate.");
1512 for (k
= 0; k
< NUM_TOWN_ITEMS
; k
++)
1513 if ((t_i
.items
[k
].variety
> 0) && (is_contained(t_i
.items
[k
]) == TRUE
)
1514 && (same_point(t_i
.items
[k
].item_loc
,pc_pos
[i
]) == TRUE
))
1515 t_i
.items
[k
].item_properties
= t_i
.items
[k
].item_properties
& 247;
1520 if (redraw
== TRUE
) {
1526 void special_increase_age()
1529 Boolean redraw
= FALSE
,stat_area
= FALSE
;
1530 location null_loc
= {0,0};
1532 for (i
= 0; i
< 8; i
++)
1533 if ((c_town
.town
.timer_spec_times
[i
] > 0) && (party
.age
% c_town
.town
.timer_spec_times
[i
] == 0)
1534 && ((is_town() == TRUE
) || ((is_combat() == TRUE
) && (which_combat_type
== 1)))) {
1535 run_special(9,2,c_town
.town
.timer_specs
[i
],null_loc
,&s1
,&s2
,&s3
);
1540 for (i
= 0; i
< 20; i
++)
1541 if ((scenario
.scenario_timer_times
[i
] > 0) && (party
.age
% scenario
.scenario_timer_times
[i
] == 0)) {
1542 run_special(10,0,scenario
.scenario_timer_specs
[i
],null_loc
,&s1
,&s2
,&s3
);
1547 for (i
= 0; i
< 30; i
++)
1548 if (party
.party_event_timers
[i
] > 0) {
1549 if (party
.party_event_timers
[i
] == 1) {
1550 if (party
.global_or_town
[i
] == 0)
1551 run_special(11,0,party
.node_to_call
[i
],null_loc
,&s1
,&s2
,&s3
);
1552 else run_special(11,2,party
.node_to_call
[i
],null_loc
,&s1
,&s2
,&s3
);
1553 party
.party_event_timers
[i
] = 0;
1558 else party
.party_event_timers
[i
]--;
1560 if (stat_area
== TRUE
) {
1562 put_item_screen(stat_window
,0);
1569 // This is the big painful one, the main special engine
1570 // which_mode - says when it was called
1571 // 0 - out moving (a - 1 if blocked)
1572 // 1 - town moving (a - 1 if blocked)
1573 // 2 - combat moving (a - 1 if blocked)
1574 // 3 - out looking (a - 1 if don't get items inside) NOT USED!!!
1575 // 4 - town looking (a - 1 if don't get items inside)
1576 // 5 - entering town
1578 // 7 - talking (a,b - numbers of strings to respond)
1579 // 8 - using a special item
1582 // 11 - party countdown timer
1583 // 12 - killed a monst
1584 // 13 - encountering outdoor enc (a - 1 if no fight)
1585 // 14 - winning outdoor enc
1586 // 15 - fleeing outdoor enc
1587 // 16 - ritual of sanct
1589 // which_type - 0 - scen 1 - out 2 - town
1590 // start spec - the number of the first spec to call
1591 // a,b - 2 values that can be returned
1592 // redraw - 1 if now need redraw
1593 void run_special(short which_mode
,short which_type
,short start_spec
,location spec_loc
,short *a
,short *b
,short *redraw
)
1595 short cur_spec
,cur_spec_type
,next_spec
,next_spec_type
;
1596 special_node_type cur_node
;
1597 short num_nodes
= 0;
1599 if (special_in_progress
== TRUE
) {
1600 give_error("The scenario called a special node while processing another special encounter. The second special will be ignored.","",0);
1603 special_in_progress
= TRUE
;
1604 next_spec
= start_spec
;
1605 next_spec_type
= which_type
;
1606 current_pc_picked_in_spec_enc
= -1;
1607 store_special_loc
= spec_loc
;
1608 if (end_scenario
== TRUE
) {
1609 special_in_progress
= FALSE
;
1613 while (next_spec
>= 0) {
1615 cur_spec
= next_spec
;
1616 cur_spec_type
= next_spec_type
;
1618 cur_node
= get_node(cur_spec
,cur_spec_type
);
1620 //print_nums(1111,cur_spec_type,cur_node.type);
1622 if (cur_node
.type
== -1) { /// got an error
1623 special_in_progress
= FALSE
;
1626 if ((cur_node
.type
>= 0) && (cur_node
.type
<= 27)) {
1627 general_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1629 if ((cur_node
.type
>= 50) && (cur_node
.type
<= 63)) {
1630 oneshot_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1632 if ((cur_node
.type
>= 80) && (cur_node
.type
<= 106)) {
1633 affect_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1635 if ((cur_node
.type
>= 130) && (cur_node
.type
<= 155)) {
1636 ifthen_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1638 if ((cur_node
.type
>= 170) && (cur_node
.type
<= 195)) {
1639 townmode_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1641 if ((cur_node
.type
>= 200) && (cur_node
.type
<= 218)) {
1642 rect_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1644 if ((cur_node
.type
>= 225) && (cur_node
.type
<= 229)) {
1645 outdoor_spec(which_mode
,cur_node
,cur_spec_type
,&next_spec
,&next_spec_type
,a
,b
,redraw
);
1649 if (num_nodes
>= 50) {
1650 give_error("A special encounter can be at most 50 nodes long. The 50th node was just processed. The encounter will now end.","",0);
1655 erase_out_specials();
1656 else erase_specials();
1657 special_in_progress
= FALSE
;
1660 special_node_type
get_node(short cur_spec
,short cur_spec_type
)
1662 special_node_type dummy_node
;
1664 dummy_node
= scenario
.scen_specials
[0];
1665 dummy_node
.type
= -1;
1666 if (cur_spec_type
== 0) {
1667 if (cur_spec
!= minmax(0,255,cur_spec
)) {
1668 give_error("The scenario called a scenario special node out of range.","",0);
1671 return scenario
.scen_specials
[cur_spec
];
1673 if (cur_spec_type
== 1) {
1674 if (cur_spec
!= minmax(0,59,cur_spec
)) {
1675 give_error("The scenario called an outdoor special node out of range.","",0);
1678 return outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].specials
[cur_spec
];
1680 if (cur_spec_type
== 2) {
1681 if (cur_spec
!= minmax(0,99,cur_spec
)) {
1682 give_error("The scenario called a town special node out of range.","",0);
1685 return c_town
.town
.specials
[cur_spec
];
1690 void general_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
1691 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
1693 Boolean check_mess
= FALSE
;
1694 char str1
[256] = "",str2
[256] = "";
1695 short store_val
= 0,i
,j
;
1696 special_node_type spec
;
1697 short mess_adj
[3] = {160,10,20};
1700 *next_spec
= cur_node
.jumpto
;
1702 switch (cur_node
.type
) {
1703 case 0: break; // null spec
1705 check_mess
= TRUE
; setsd(cur_node
.sd1
,cur_node
.sd2
,cur_node
.ex1a
);
1709 setsd(cur_node
.sd1
,cur_node
.sd2
,
1710 PSD
[cur_node
.sd1
][cur_node
.sd2
] + ((cur_node
.ex1b
== 0) ? 1 : -1) * cur_node
.ex1a
);
1713 check_mess
= TRUE
;break;
1715 get_strs((char *) str1
,(char *) str2
, cur_spec_type
,cur_node
.m1
+ mess_adj
[cur_spec_type
],
1716 cur_node
.m2
+ mess_adj
[cur_spec_type
]);
1717 if (cur_node
.m1
>= 0)
1719 if (cur_node
.m2
>= 0)
1723 setsd(cur_node
.sd1
,cur_node
.sd2
,
1724 ((PSD
[cur_node
.sd1
][cur_node
.sd2
] == 0) ? 1 : 0) );
1725 check_mess
= TRUE
;break;
1727 if (is_out()) *next_spec
= -1;
1728 if ((is_out()) && (spec
.ex1a
!= 0) && (which_mode
== 0)) {
1729 ASB("Can't go here while outdoors.");
1734 if (is_town()) *next_spec
= -1;
1735 if ((is_town()) && (spec
.ex1a
!= 0) && (which_mode
== 1)) {
1736 ASB("Can't go here while in town mode.");
1741 if (is_combat()) *next_spec
= -1;
1742 if ((is_combat()) && (spec
.ex1a
!= 0) && (which_mode
== 2)) {
1743 ASB("Can't go here during combat.");
1748 if ((which_mode
== 3) || (which_mode
== 4)) *next_spec
= -1;
1752 if (which_mode
< 3) {
1759 check_mess
= TRUE
; party
.age
+= spec
.ex1a
;
1763 for (i
= 0; i
< 30; i
++)
1764 if (party
.party_event_timers
[i
] == 0) {
1765 party
.party_event_timers
[i
] = spec
.ex1a
;
1766 party
.node_to_call
[i
] = spec
.ex1b
;
1767 party
.global_or_town
[i
] = 0;
1772 play_sound(1000 + spec
.ex1a
);
1776 if (spec
.ex1a
!= minmax(0,29,spec
.ex1a
))
1777 give_error("Horse out of range.","",0);
1778 else party
.horses
[spec
.ex1a
].property
= (spec
.ex2a
== 0) ? 1 : 0;
1782 if (spec
.ex1a
!= minmax(0,29,spec
.ex1a
))
1783 give_error("Boat out of range.","",0);
1784 else party
.boats
[spec
.ex1a
].property
= (spec
.ex2a
== 0) ? 1 : 0;
1788 if (spec
.ex1a
!= minmax(0,scenario
.num_towns
- 1,spec
.ex1a
))
1789 give_error("Town out of range.","",0);
1790 else party
.can_find_town
[spec
.ex1a
] = (spec
.ex2a
== 0) ? 0 : 1;
1795 if (spec
.ex1a
!= minmax(1,10,spec
.ex1a
))
1796 give_error("Event code out of range.","",0);
1797 else if (party
.key_times
[spec
.ex1a
] == 30000)
1798 party
.key_times
[spec
.ex1a
] = calc_day();
1802 if ((forced_give(spec
.ex1a
,0) == FALSE
) && ( spec
.ex1b
>= 0))
1803 *next_spec
= spec
.ex1b
;
1806 for (i
= 0; i
< 144; i
++)
1807 if (party_check_class(spec
.ex1a
,0) == TRUE
)
1809 if (store_val
== 0) {
1810 if ( spec
.ex1b
>= 0)
1811 *next_spec
= spec
.ex1b
;
1815 give_gold(store_val
* spec
.ex2a
,TRUE
);
1819 *next_spec_type
= 0;
1822 if (spec
.sd1
!= minmax(0,299,spec
.sd1
))
1823 give_error("Stuff Done flag out of range.","",0);
1824 else for (i
= 0; i
< 10; i
++) PSD
[spec
.sd1
][i
] = spec
.ex1a
;
1827 if ((sd_legit(spec
.sd1
,spec
.sd2
) == FALSE
) || (sd_legit(spec
.ex1a
,spec
.ex1b
) == FALSE
))
1828 give_error("Stuff Done flag out of range.","",0);
1829 else PSD
[spec
.sd1
][spec
.sd2
] = PSD
[spec
.ex1a
][spec
.ex1b
];
1832 if (which_mode
!= 16)
1833 *next_spec
= spec
.ex1b
;
1837 party
.age
+= spec
.ex1a
;
1838 heal_party(spec
.ex1b
); restore_sp_party(spec
.ex1b
);
1841 if (which_mode
!= 13)
1843 *a
= (spec
.ex1a
== 0) ? 1 : 0;
1846 end_scenario
= TRUE
;
1849 if (check_mess
== TRUE
) {
1850 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
1855 void general_spec(short which_mode,special_node_type cur_node,short cur_spec_type,
1856 short *next_spec,short *next_spec_type,short *a,short *b,short *redraw)
1858 Boolean check_mess = FALSE;
1859 Str255 str1 = "",str2 = "";
1860 short store_val = 0,i,j;
1861 special_node_type spec;
1864 *next_spec = cur_node.jumpto;
1866 switch (cur_node.type) {
1870 if (check_mess == TRUE) {
1871 handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b);
1876 void oneshot_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
1877 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
1879 Boolean check_mess
= TRUE
,set_sd
= TRUE
;
1880 char str1
[256] = "",str2
[256] = "";
1881 char strs
[6][256] = {"","","","","",""};
1882 short store_val
= 0,i
,j
,buttons
[3] = {-1,-1,-1};
1883 special_node_type spec
;
1884 item_record_type store_i
;
1888 *next_spec
= cur_node
.jumpto
;
1889 if ((sd_legit(spec
.sd1
,spec
.sd2
) == TRUE
) && (PSD
[spec
.sd1
][spec
.sd2
] == 250)) {
1893 switch (cur_node
.type
) {
1895 if (forced_give(spec
.ex1a
,0) == FALSE
) {
1897 if ( spec
.ex2b
>= 0)
1898 *next_spec
= spec
.ex2b
;
1901 give_gold(spec
.ex1b
,TRUE
);
1902 give_food(spec
.ex2a
,TRUE
);
1906 if (spec
.ex1a
!= minmax(0,49,spec
.ex1a
)) {
1907 give_error("Special item is out of range.","",0);
1911 party
.spec_items
[spec
.ex1a
] = (spec
.ex1b
== 0) ? 1 : 0;
1913 if (stat_window
== 6)
1924 case 55: case 56: case 57:
1928 for (i
= 0; i
< 3; i
++)
1929 get_strs((char *) strs
[i
* 2],(char *) strs
[i
* 2 + 1],cur_spec_type
,
1930 spec
.m1
+ i
* 2 + spec_str_offset
[cur_spec_type
],spec
.m1
+ i
* 2 + 1 + spec_str_offset
[cur_spec_type
]);
1932 {buttons
[0] = 1; buttons
[1] = spec
.ex1a
; buttons
[2] = spec
.ex2a
;
1933 if ((spec
.ex1a
>= 0) || (spec
.ex2a
>= 0)) buttons
[0] = 20; }
1934 if (spec
.m2
<= 0) {buttons
[0] = spec
.ex1a
;buttons
[1] = spec
.ex2a
;}
1935 if ((buttons
[0] < 0) && (buttons
[1] < 0)) {
1936 give_error("Dialog box ended up with no buttons.","",0);
1939 switch (cur_node
.type
) {
1940 case 55: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2400,buttons
) ;
1941 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1942 case 56: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2000,buttons
) ;
1943 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1944 case 57: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2000,buttons
) ;
1945 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1949 if ((spec
.ex1a
>= 0) || (spec
.ex2a
>= 0)) {
1953 if (i
== 2) *next_spec
= spec
.ex1b
;
1954 if (i
== 3) *next_spec
= spec
.ex2b
;
1957 if (i
== 1) *next_spec
= spec
.ex1b
;
1958 if (i
== 2) *next_spec
= spec
.ex2b
;
1961 case 58: case 59: case 60:
1965 for (i
= 0; i
< 3; i
++)
1966 get_strs((char *) strs
[i
* 2],(char *) strs
[i
* 2 + 1],cur_spec_type
,
1967 spec
.m1
+ i
* 2 + spec_str_offset
[cur_spec_type
],spec
.m1
+ i
* 2 + 1 + spec_str_offset
[cur_spec_type
]);
1968 buttons
[0] = 20; buttons
[1] = 19;
1969 //i = custom_choice_dialog(strs,spec.pic,buttons) ;
1970 switch (cur_node
.type
) {
1971 case 58: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2400,buttons
) ;
1972 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1973 case 59: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2000,buttons
) ;
1974 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1975 case 60: if (spec
.pic
>= 1000) i
= custom_choice_dialog((char *) strs
,(spec
.pic
% 1000) + 2000,buttons
) ;
1976 else i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
) ; break;
1978 if (i
== 1) {set_sd
= FALSE
; *next_spec
= -1;}
1980 store_i
= get_stored_item(spec
.ex1a
);
1981 if ((spec
.ex1a
>= 0) && (give_to_party(store_i
,TRUE
) == FALSE
)) {
1982 set_sd
= FALSE
; *next_spec
= -1;
1985 give_gold(spec
.ex1b
,TRUE
);
1986 give_food(spec
.ex2a
,TRUE
);
1987 if ((spec
.m2
>= 0) && (spec
.m2
< 50)) {
1988 if (party
.spec_items
[spec
.m2
] == 0)
1989 ASB("You get a special item.");
1990 party
.spec_items
[spec
.m2
] = 1;
1992 if (stat_window
== 6)
1995 if (spec
.ex2b
>= 0) *next_spec
= spec
.ex2b
;
2000 if (spec
.ex1a
!= minmax(0,3,spec
.ex1a
)) {
2001 give_error("Special outdoor enc. is out of range. Must be 0-3.","",0);
2005 l
= global_to_local(party
.p_loc
);
2006 place_outd_wand_monst(l
,
2007 outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_enc
[spec
.ex1a
],TRUE
);
2011 activate_monsters(spec
.ex1a
,0);
2015 if ((spec
.m1
>= 0) || (spec
.m2
>= 0)) {
2016 get_strs((char *) strs
[0],(char *) strs
[1],
2018 spec
.m1
+ ((spec
.m1
>= 0) ? spec_str_offset
[cur_spec_type
] : 0),
2019 spec
.m2
+ ((spec
.m2
>= 0) ? spec_str_offset
[cur_spec_type
] : 0));
2020 buttons
[0] = 3; buttons
[1] = 2;
2021 i
= custom_choice_dialog((char *) strs
,727,buttons
);
2023 else i
= FCD(872,0);
2024 if (i
== 1) {set_sd
= FALSE
; *next_spec
= -1; *a
= 1;}
2026 if (is_combat() == TRUE
)
2027 j
= run_trap(current_pc
,spec
.ex1a
,spec
.ex1b
,spec
.ex2a
);
2028 else j
= run_trap(7,spec
.ex1a
,spec
.ex1b
,spec
.ex2a
);
2030 *a
= 1; set_sd
= FALSE
;
2035 if (check_mess
== TRUE
) {
2036 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2038 if ((set_sd
== TRUE
) && (sd_legit(spec
.sd1
,spec
.sd2
) == TRUE
))
2039 PSD
[spec
.sd1
][spec
.sd2
] = 250;
2043 void affect_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
2044 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
2046 Boolean check_mess
= TRUE
;
2047 char str1
[256] = "",str2
[256] = "";
2048 short store_val
= 0,i
,j
,pc
,r1
;
2049 special_node_type spec
;
2052 *next_spec
= cur_node
.jumpto
;
2053 pc
= current_pc_picked_in_spec_enc
;
2056 if ((check_mess
== TRUE
) && (cur_node
.type
!= 80)) {
2057 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2061 switch (cur_node
.type
) {
2064 current_pc_picked_in_spec_enc
= -1;
2065 else if (spec
.ex1a
== 1) {
2068 current_pc_picked_in_spec_enc
= i
;
2070 else if (spec
.ex1a
== 0) {
2073 current_pc_picked_in_spec_enc
= i
;
2075 if (i
== 6)// && (spec.ex1b >= 0))
2076 *next_spec
= spec
.ex1b
;
2079 r1
= get_ran(spec
.ex1a
,1,spec
.ex1b
) + spec
.ex2a
;
2081 hit_party(r1
,spec
.ex2b
);
2083 else damage_pc(pc
,r1
,spec
.ex2b
,0);
2086 for (i
= 0; i
< 6; i
++)
2087 if ((pc
< 0) || (pc
== i
))
2088 adven
[i
].cur_health
= minmax(0, adven
[i
].max_health
,
2089 adven
[i
].cur_health
+ spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2092 for (i
= 0; i
< 6; i
++)
2093 if ((pc
< 0) || (pc
== i
))
2094 adven
[i
].cur_sp
= minmax(0, adven
[i
].max_sp
,
2095 adven
[i
].cur_sp
+ spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2098 for (i
= 0; i
< 6; i
++)
2099 if ((pc
< 0) || (pc
== i
)) {
2100 if (spec
.ex1b
== 0) award_xp(i
,spec
.ex1a
); else drain_pc(i
,spec
.ex1a
);
2104 for (i
= 0; i
< 6; i
++)
2105 if ((pc
< 0) || (pc
== i
))
2106 adven
[i
].skill_pts
= minmax(0, 100,
2107 adven
[i
].skill_pts
+ spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2110 for (i
= 0; i
< 6; i
++)
2111 if ((pc
< 0) || (pc
== i
)) {
2112 if (spec
.ex1b
== 0) {
2113 if ((adven
[i
].main_status
> 0) && (adven
[i
].main_status
< 10))
2114 adven
[i
].main_status
= 1;
2116 else kill_pc(i
,spec
.ex1a
+ 2 + 10);
2121 for (i
= 0; i
< 6; i
++)
2122 if ((pc
< 0) || (pc
== i
)) {
2123 if (spec
.ex1b
== 0) {
2124 cure_pc(i
,spec
.ex1a
);
2126 else poison_pc(i
,spec
.ex1a
);
2130 for (i
= 0; i
< 6; i
++)
2131 if ((pc
< 0) || (pc
== i
)) {
2132 if (spec
.ex1b
== 0) {
2133 slow_pc(i
,-1 * spec
.ex1a
);
2135 else slow_pc(i
,spec
.ex1a
);
2139 for (i
= 0; i
< 6; i
++)
2140 if ((pc
< 0) || (pc
== i
))
2141 affect_pc(i
,4,spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2144 for (i
= 0; i
< 6; i
++)
2145 if ((pc
< 0) || (pc
== i
))
2146 affect_pc(i
,5,spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2149 for (i
= 0; i
< 6; i
++)
2150 if ((pc
< 0) || (pc
== i
))
2151 affect_pc(i
,6,spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2154 for (i
= 0; i
< 6; i
++)
2155 if ((pc
< 0) || (pc
== i
))
2156 affect_pc(i
,7,spec
.ex1a
* ((spec
.ex1b
!= 0) ? 1: -1));
2159 for (i
= 0; i
< 6; i
++)
2160 if ((pc
< 0) || (pc
== i
))
2161 affect_pc(i
,8,spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2164 for (i
= 0; i
< 6; i
++)
2165 if ((pc
< 0) || (pc
== i
))
2166 affect_pc(i
,1,spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2169 for (i
= 0; i
< 6; i
++)
2170 if ((pc
< 0) || (pc
== i
))
2171 affect_pc(i
,9,spec
.ex1a
* ((spec
.ex1b
== 0) ? -1: 1));
2174 for (i
= 0; i
< 6; i
++)
2175 if ((pc
< 0) || (pc
== i
)) {
2176 if (spec
.ex1b
== 0) {
2177 affect_pc(i
,11,-1 * spec
.ex1a
);
2179 else sleep_pc(i
,spec
.ex1a
,11,10);
2183 for (i
= 0; i
< 6; i
++)
2184 if ((pc
< 0) || (pc
== i
)) {
2185 if (spec
.ex1b
== 0) {
2186 affect_pc(i
,12,-1 * spec
.ex1a
);
2188 else sleep_pc(i
,spec
.ex1a
,12,10);
2192 if (spec
.ex2a
!= minmax(0,18,spec
.ex2a
)) {
2193 give_error("Skill is out of range.","",0);
2196 for (i
= 0; i
< 6; i
++)
2197 if (((pc
< 0) || (pc
== i
)) && (get_ran(1,0,100) < spec
.pic
))
2198 adven
[i
].skills
[spec
.ex2a
] = minmax(0, skill_max
[spec
.ex2a
],
2199 adven
[i
].skills
[spec
.ex2a
] + spec
.ex1a
* ((spec
.ex1b
!= 0) ? -1: 1));
2202 if (spec
.ex1a
!= minmax(0,31,spec
.ex1a
)) {
2203 give_error("Mage spell is out of range (0 - 31). See docs.","",0);
2206 for (i
= 0; i
< 6; i
++)
2207 if ((pc
< 0) || (pc
== i
))
2208 adven
[i
].mage_spells
[spec
.ex1a
+ 30] = TRUE
;
2211 if (spec
.ex1a
!= minmax(0,31,spec
.ex1a
)) {
2212 give_error("Priest spell is out of range (0 - 31). See docs.","",0);
2215 for (i
= 0; i
< 6; i
++)
2216 if ((pc
< 0) || (pc
== i
))
2217 adven
[i
].priest_spells
[spec
.ex1a
+ 30] = TRUE
;
2221 give_gold(spec
.ex1a
,TRUE
);
2222 else if (party
.gold
< spec
.ex1a
)
2224 else take_gold(spec
.ex1a
,FALSE
);
2228 give_food(spec
.ex1a
,TRUE
);
2229 else if (party
.food
< spec
.ex1a
)
2231 else take_food(spec
.ex1a
,FALSE
);
2234 if (spec
.ex1a
!= minmax(0,19,spec
.ex1a
)) {
2235 give_error("Alchemy is out of range.","",0);
2238 party
.alchemy
[spec
.ex1a
] = TRUE
;
2241 r1
= (short) party
.stuff_done
[305][0];
2242 r1
= minmax(0,250,r1
+ spec
.ex1a
);
2243 party
.stuff_done
[305][0] = r1
;
2246 r1
= (short) party
.stuff_done
[305][3];
2247 r1
= minmax(0,250,r1
+ spec
.ex1a
);
2248 party
.stuff_done
[305][3] = r1
;
2251 if (party
.in_boat
>= 0)
2252 add_string_to_buf(" Can't fly when on a boat. ");
2253 else if (party
.in_horse
>= 0)////
2254 add_string_to_buf(" Can't fly when on a horse. ");
2256 r1
= (short) party
.stuff_done
[305][1];
2257 r1
= minmax(0,250,r1
+ spec
.ex1a
);
2258 party
.stuff_done
[305][1] = r1
;
2264 void ifthen_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
2265 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
2267 Boolean check_mess
= FALSE
;
2268 char str1
[256] = "",str2
[256] = "",str3
[256] = "";
2269 short store_val
= 0,i
,j
,k
;
2270 special_node_type spec
;
2274 *next_spec
= cur_node
.jumpto
;
2276 switch (cur_node
.type
) {
2278 if (sd_legit(spec
.sd1
,spec
.sd2
) == TRUE
) {
2279 if ((spec
.ex1a
>= 0) && (PSD
[spec
.sd1
][spec
.sd2
] >= spec
.ex1a
))
2280 *next_spec
= spec
.ex1b
;
2281 else if ((spec
.ex2a
>= 0) && (PSD
[spec
.sd1
][spec
.sd2
] < spec
.ex2a
))
2282 *next_spec
= spec
.ex2b
;
2286 if (((is_town()) || (is_combat())) && (c_town
.town_num
== spec
.ex1a
))
2287 *next_spec
= spec
.ex1b
;
2290 if (get_ran(1,1,100) < spec
.ex1a
)
2291 *next_spec
= spec
.ex1b
;
2294 if (spec
.ex1a
!= minmax(0,49,spec
.ex1a
)) {
2295 give_error("Special item is out of range.","",0);
2297 else if (party
.spec_items
[spec
.ex1a
] > 0)
2298 *next_spec
= spec
.ex1b
;
2301 if ((sd_legit(spec
.sd1
,spec
.sd2
) == TRUE
) && (sd_legit(spec
.ex1a
,spec
.ex1b
) == TRUE
)) {
2302 if (PSD
[spec
.ex1a
][spec
.ex1b
] < PSD
[spec
.sd1
][spec
.sd2
])
2303 *next_spec
= spec
.ex2b
;
2305 else give_error("A Stuff Done flag is out of range.","",0);
2308 if (((is_town()) || (is_combat())) && (t_d
.terrain
[spec
.ex1a
][spec
.ex1b
] == spec
.ex2a
))
2309 *next_spec
= spec
.ex2b
;
2312 l
.x
= spec
.ex1a
; l
.y
= spec
.ex1b
;
2313 l
= local_to_global(l
);
2314 if ((is_out()) && (out
[l
.x
][l
.y
] == spec
.ex2a
))
2315 *next_spec
= spec
.ex2b
;
2318 if (party
.gold
>= spec
.ex1a
)
2319 *next_spec
= spec
.ex1b
;
2322 if (party
.food
>= spec
.ex1a
)
2323 *next_spec
= spec
.ex1b
;
2328 l
.x
= spec
.ex1a
; l
.y
= spec
.ex1b
;
2329 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
2330 if ((t_i
.items
[i
].variety
> 0) && (t_i
.items
[i
].special_class
== spec
.ex2a
)
2331 && (same_point(l
,t_i
.items
[i
].item_loc
) == TRUE
))
2332 *next_spec
= spec
.ex2b
;
2335 if (party_check_class(spec
.ex1a
,1) == TRUE
)
2336 *next_spec
= spec
.ex1b
;
2339 for (i
= 0; i
< 6; i
++)
2340 if (adven
[i
].main_status
== 1)
2341 for (j
= 0; j
< 24; j
++)
2342 if ((adven
[i
].items
[j
].variety
> 0) && (adven
[i
].items
[j
].special_class
== spec
.ex1a
)
2343 && (adven
[i
].equip
[j
] == TRUE
))
2344 *next_spec
= spec
.ex1b
;
2347 if (party
.gold
>= spec
.ex1a
) {
2348 take_gold(spec
.ex1a
,TRUE
);
2349 *next_spec
= spec
.ex1b
;
2353 if (party
.food
>= spec
.ex1a
) {
2354 take_food(spec
.ex1a
,TRUE
);
2355 *next_spec
= spec
.ex1b
;
2361 l
.x
= spec
.ex1a
; l
.y
= spec
.ex1b
;
2362 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
2363 if ((t_i
.items
[i
].variety
> 0) && (t_i
.items
[i
].special_class
== spec
.ex2a
)
2364 && (same_point(l
,t_i
.items
[i
].item_loc
) == TRUE
)) {
2365 *next_spec
= spec
.ex2b
;
2367 t_i
.items
[i
].variety
= 0;
2371 if (party_check_class(spec
.ex1a
,0) == TRUE
)
2372 *next_spec
= spec
.ex1b
;
2375 for (i
= 0; i
< 6; i
++)
2376 if (adven
[i
].main_status
== 1)
2377 for (j
= 0; j
< 24; j
++)
2378 if ((adven
[i
].items
[j
].variety
> 0) && (adven
[i
].items
[j
].special_class
== spec
.ex1a
)
2379 && (adven
[i
].equip
[j
] == TRUE
)) {
2380 *next_spec
= spec
.ex1b
;
2386 if (calc_day() >= spec
.ex1a
)
2387 *next_spec
= spec
.ex1b
;
2390 for (j
= 0; j
< town_size
[town_type
]; j
++)
2391 for (k
= 0; k
< town_size
[town_type
]; k
++)
2393 *next_spec
= spec
.ex1b
;
2396 for (j
= 0; j
< town_size
[town_type
]; j
++)
2397 for (k
= 0; k
< town_size
[town_type
]; k
++)
2399 *next_spec
= spec
.ex1b
;
2402 if (day_reached(spec
.ex1a
,spec
.ex1b
) == TRUE
)
2403 *next_spec
= spec
.ex2b
;
2406 for (i
= 0; i
< 6; i
++)
2407 if ((adven
[i
].main_status
== 1) && (adven
[i
].traits
[4] > 0))
2408 *next_spec
= spec
.ex1b
;
2411 for (i
= 0; i
< 6; i
++)
2412 if ((adven
[i
].main_status
== 1) && (adven
[i
].traits
[5] > 0))
2413 *next_spec
= spec
.ex1b
;
2416 if (mage_lore_total() >= spec
.ex1a
)
2417 *next_spec
= spec
.ex1b
;
2419 case 154: // text response
2421 get_text_response(873,str3
,0);
2423 spec
.pic
= minmax(0,8,spec
.pic
);
2424 get_strs((char *) str1
,(char *) str2
,0,spec
.ex1a
,spec
.ex2a
);
2425 for (i
= 0; i
< spec
.pic
;i
++) {
2426 if ((spec
.ex1a
< 0) || (str3
[i
] != str1
[i
]))
2428 if ((spec
.ex2a
< 0) || (str3
[i
] != str2
[i
]))
2432 *next_spec
= spec
.ex1b
;
2434 *next_spec
= spec
.ex2b
;
2437 if (sd_legit(spec
.sd1
,spec
.sd2
) == TRUE
) {
2438 if (PSD
[spec
.sd1
][spec
.sd2
] == spec
.ex1a
)
2439 *next_spec
= spec
.ex1b
;
2443 if (check_mess
== TRUE
) {
2444 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2448 void townmode_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
2449 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
2451 Boolean check_mess
= TRUE
;
2452 char str1
[256] = "",str2
[256] = "",strs
[6][256] = {"","","","","",""};
2453 short store_val
= 0,i
,j
,buttons
[3] = {-1,-1,-1},r1
;
2454 special_node_type spec
;
2457 item_record_type store_i
;
2460 *next_spec
= cur_node
.jumpto
;
2462 l
.x
= spec
.ex1a
; l
.y
= spec
.ex1b
;
2466 switch (cur_node
.type
) {
2468 make_town_hostile();
2471 set_terrain(l
,spec
.ex2a
);
2475 if (coord_to_ter(spec
.ex1a
,spec
.ex1b
) == spec
.ex2a
)
2476 set_terrain(l
,spec
.ex2b
);
2477 else if (coord_to_ter(spec
.ex1a
,spec
.ex1b
) == spec
.ex2b
)
2478 set_terrain(l
,spec
.ex2a
);
2482 ter
= coord_to_ter(spec
.ex1a
,spec
.ex1b
);
2483 set_terrain(l
,scenario
.ter_types
[ter
].trans_to_what
);
2488 ASB("Not while in combat.");
2496 if ((which_mode
== 7) || (spec
.ex2a
== 0))
2497 teleport_party(spec
.ex1a
,spec
.ex1b
,1);
2498 else teleport_party(spec
.ex1a
,spec
.ex1b
,0);
2503 if (which_mode
== 7)
2505 hit_space(l
,spec
.ex2a
,spec
.ex2b
,1,1);
2509 if (which_mode
== 7)
2511 radius_damage(l
,spec
.pic
, spec
.ex2a
, spec
.ex2b
);
2515 ter
= coord_to_ter(spec
.ex1a
,spec
.ex1b
);
2516 if (scenario
.ter_types
[ter
].special
== 8)
2517 set_terrain(l
,scenario
.ter_types
[ter
].flag1
);
2521 ter
= coord_to_ter(spec
.ex1a
,spec
.ex1b
);
2522 if ((scenario
.ter_types
[ter
].special
== 9) || (scenario
.ter_types
[ter
].special
== 10))
2523 set_terrain(l
,scenario
.ter_types
[ter
].flag1
);
2527 if (which_mode
== 7)
2529 run_a_boom(l
,spec
.ex2a
,0,0);
2532 create_wand_monst();
2537 forced_place_monster(spec
.ex2a
,l
);
2538 else place_monster(spec
.ex2a
,l
);
2542 for (i
= 0; i
< T_M
; i
++)
2543 if (c_town
.monst
.dudes
[i
].number
== spec
.ex1a
) {
2544 c_town
.monst
.dudes
[i
].active
= 0;
2549 for (i
= 0; i
< T_M
; i
++)
2550 if ((c_town
.monst
.dudes
[i
].active
> 0) &&
2551 (((spec
.ex1a
== 0) && (1 == 1)) ||
2552 ((spec
.ex1a
== 1) && (c_town
.monst
.dudes
[i
].attitude
% 2 == 0)) ||
2553 ((spec
.ex1a
== 2) && (c_town
.monst
.dudes
[i
].attitude
% 2 == 1)))){
2554 c_town
.monst
.dudes
[i
].active
= 0;
2559 if (which_mode
> 4) {
2560 ASB("Can't use lever now.");
2565 if (handle_lever(store_special_loc
) > 0)
2566 *next_spec
= spec
.ex1b
;
2571 ASB("Not while in combat.");
2577 else if ((which_mode
!= 1) && (which_mode
!= 4)) {
2578 ASB("Can't teleport now.");
2584 else if (FCD(870,0) == 2) {
2586 if ((which_mode
== 7) || (spec
.ex2a
== 0))
2587 teleport_party(spec
.ex1a
,spec
.ex1b
,1);
2588 else teleport_party(spec
.ex1a
,spec
.ex1b
,0);
2592 if (FCD(871,0) == 2)
2593 *next_spec
= spec
.ex1b
;
2597 ASB("Can't change level in combat.");
2603 else if (which_mode
!= 1) {
2604 ASB("Can't change level now.");
2612 if (spec
.ex2b
< 0) spec
.ex2b
= 0;
2613 if ((spec
.ex2b
>= 8) || (FCD(880 + spec
.ex2b
,0) == 2))
2614 change_level(spec
.ex2a
,l
.x
,l
.y
);
2621 if (which_mode
> 4) {
2622 ASB("Can't use lever now.");
2627 for (i
= 0; i
< 3; i
++)
2628 get_strs((char *) strs
[i
* 2],(char *) strs
[i
* 2 + 1],cur_spec_type
,
2629 spec
.m1
+ i
* 2 + spec_str_offset
[cur_spec_type
],spec
.m1
+ i
* 2 + 1 + spec_str_offset
[cur_spec_type
]);
2630 buttons
[0] = 9; buttons
[1] = 35;
2631 i
= custom_choice_dialog((char *) strs
,spec
.pic
,buttons
);
2632 if (i
== 1) {*next_spec
= -1;}
2634 ter
= coord_to_ter(store_special_loc
.x
,store_special_loc
.y
);
2635 set_terrain(store_special_loc
,scenario
.ter_types
[ter
].trans_to_what
);
2636 *next_spec
= spec
.ex1b
;
2645 ASB("Not while in combat.");
2651 else if ((which_mode
!= 1) && (which_mode
!= 4)) {
2652 ASB("Can't teleport now.");
2659 for (i
= 0; i
< 3; i
++)
2660 get_strs((char *) strs
[i
* 2],(char *) strs
[i
* 2 + 1]
2661 ,cur_spec_type
,spec
.m1
+ i
* 2 + spec_str_offset
[cur_spec_type
],spec
.m1
+ i
* 2 + 1 + spec_str_offset
[cur_spec_type
]);
2662 buttons
[0] = 9; buttons
[1] = 8;
2663 i
= custom_choice_dialog((char *) strs
,722,buttons
);
2664 if (i
== 1) { *next_spec
= -1; if (which_mode
< 3) *a
= 1;}
2667 if (which_mode
== 7)
2668 teleport_party(spec
.ex1a
,spec
.ex1b
,1);
2669 else teleport_party(spec
.ex1a
,spec
.ex1b
,0);
2675 if ((spec
.m1
< 0) && (spec
.ex2b
!= 1))
2678 ASB("Can't change level in combat.");
2684 else if (which_mode
!= 1) {
2685 ASB("Can't change level now.");
2693 for (i
= 0; i
< 3; i
++)
2694 get_strs((char *) strs
[i
* 2],(char *) strs
[i
* 2 + 1],cur_spec_type
,
2695 spec
.m1
+ i
* 2 + spec_str_offset
[cur_spec_type
],spec
.m1
+ i
* 2 + 1 + spec_str_offset
[cur_spec_type
]);
2696 buttons
[0] = 20; buttons
[1] = 24;
2700 else i
= custom_choice_dialog((char *) strs
,719,buttons
) ;
2702 if (i
== 1) { *next_spec
= -1;}
2705 change_level(spec
.ex2a
,l
.x
,l
.y
);
2710 position_party(spec
.ex1a
,spec
.ex1b
,spec
.ex2a
,spec
.ex2b
);
2713 store_i
= get_stored_item(spec
.ex2a
);
2714 place_item(store_i
,l
,TRUE
);
2717 if (which_mode
== 7)
2720 ASB("Not while in combat.");
2726 if (party
.stuff_done
[304][0] > 0) {
2727 ASB("Party is already split.");
2733 r1
= char_select_pc(1,0,"Which character goes?");
2737 party
.stuff_done
[304][3] = r1
;
2739 start_split(spec
.ex1a
,spec
.ex1b
,spec
.ex2a
);
2741 else check_mess
= FALSE
;
2745 ASB("Not while in combat.");
2752 end_split(spec
.ex1a
);
2755 for (i
= 0; i
< 30; i
++)
2756 if (party
.party_event_timers
[i
] == 0) {
2757 party
.party_event_timers
[i
] = spec
.ex1a
;
2758 party
.node_to_call
[i
] = spec
.ex1b
;
2759 party
.global_or_town
[i
] = 1;
2764 if (check_mess
== TRUE
) {
2765 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2769 void rect_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
2770 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
2772 Boolean check_mess
= TRUE
;
2773 char str1
[256] = "",str2
[256] = "";
2774 short store_val
= 0,i
,j
,k
;
2775 special_node_type spec
;
2780 *next_spec
= cur_node
.jumpto
;
2786 for (i
= spec
.ex1b
;i
<= spec
.ex2b
;i
++)
2787 for (j
= spec
.ex1a
; j
<= spec
.ex2a
; j
++) {
2790 switch (cur_node
.type
) {
2791 case 200: if (get_ran(1,0,100) <= spec
.sd1
) make_fire_wall(i
,j
); break;
2792 case 201: if (get_ran(1,0,100) <= spec
.sd1
) make_force_wall(i
,j
); break;
2793 case 202: if (get_ran(1,0,100) <= spec
.sd1
) make_ice_wall(i
,j
); break;
2794 case 203: if (get_ran(1,0,100) <= spec
.sd1
) make_blade_wall(i
,j
); break;
2795 case 204: if (get_ran(1,0,100) <= spec
.sd1
) make_scloud(i
,j
); break;
2796 case 205: if (get_ran(1,0,100) <= spec
.sd1
) make_sleep_cloud(i
,j
); break;
2797 case 206: if (get_ran(1,0,100) <= spec
.sd1
) make_quickfire(i
,j
); break;
2798 case 207: if (get_ran(1,0,100) <= spec
.sd1
) make_fire_barrier(i
,j
); break;
2799 case 208: if (get_ran(1,0,100) <= spec
.sd1
) make_force_barrier(i
,j
); break;
2800 case 209: if (spec
.sd1
== 0) dispel_fields(i
,j
,1); else dispel_fields(i
,j
,2);break;
2801 case 210: if (get_ran(1,0,100) <= spec
.sd1
) make_sfx(i
,j
,spec
.sd2
+ 1); break;
2802 case 211: if (get_ran(1,0,100) <= spec
.sd1
) {
2803 if (spec
.sd2
== 0) make_web(i
,j
);
2804 if (spec
.sd2
== 1) make_barrel(i
,j
);
2805 if (spec
.sd2
== 2) make_crate(i
,j
);
2808 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
2809 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,l
) == TRUE
)) {
2810 t_i
.items
[i
].item_loc
.x
= spec
.sd1
;
2811 t_i
.items
[i
].item_loc
.y
= spec
.sd2
;
2815 for (i
= 0; i
< NUM_TOWN_ITEMS
; i
++)
2816 if ((t_i
.items
[i
].variety
> 0) && (same_point(t_i
.items
[i
].item_loc
,l
) == TRUE
)) {
2817 t_i
.items
[i
].variety
= 0;
2821 if (get_ran(1,0,100) <= spec
.sd2
) set_terrain(l
,spec
.sd1
);
2824 if (coord_to_ter(i
,j
) == spec
.sd1
) set_terrain(l
,spec
.sd2
);
2825 else if (coord_to_ter(i
,j
) == spec
.sd2
) set_terrain(l
,spec
.sd1
);
2828 ter
= coord_to_ter(i
,j
);
2829 set_terrain(l
,scenario
.ter_types
[ter
].trans_to_what
);
2832 ter
= coord_to_ter(i
,j
);
2833 if (scenario
.ter_types
[ter
].special
== 8)
2834 set_terrain(l
,scenario
.ter_types
[ter
].flag1
);
2837 ter
= coord_to_ter(i
,j
);
2838 if ((scenario
.ter_types
[ter
].special
== 9) || (scenario
.ter_types
[ter
].special
== 10))
2839 set_terrain(l
,scenario
.ter_types
[ter
].flag1
);
2844 if (check_mess
== TRUE
) {
2845 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2849 void outdoor_spec(short which_mode
,special_node_type cur_node
,short cur_spec_type
,
2850 short *next_spec
,short *next_spec_type
,short *a
,short *b
,short *redraw
)
2852 Boolean check_mess
= FALSE
;
2853 char str1
[256] = "",str2
[256] = "";
2854 short store_val
= 0,i
,j
;
2855 special_node_type spec
;
2859 *next_spec
= cur_node
.jumpto
;
2861 if (is_out() == FALSE
) return;
2863 switch (cur_node
.type
) {
2864 case 225: create_wand_monst();
2868 outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].terrain
[spec
.ex1a
][spec
.ex1b
] = spec
.ex2a
;
2871 l
= local_to_global(l
);
2872 out
[l
.x
][l
.y
] = spec
.ex2a
;
2877 if (spec
.ex1a
!= minmax(0,3,spec
.ex1a
)) {
2878 give_error("Special outdoor enc. is out of range. Must be 0-3.","",0);
2882 l
= global_to_local(party
.p_loc
);
2883 place_outd_wand_monst(l
,
2884 outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].special_enc
[spec
.ex1a
],TRUE
);
2890 out_move_party(spec
.ex1a
,spec
.ex1b
);
2895 get_strs((char *) str1
,(char *) str2
,1,spec
.m1
+ 10,-1);
2896 if (spec
.ex2a
>= 40)
2900 spec
.ex2b
= minmax(0,6,spec
.ex2b
);
2901 switch (spec
.ex1b
) {
2902 case 0: start_shop_mode(0,spec
.ex1a
,spec
.ex1a
+ spec
.ex2a
- 1,spec
.ex2b
,(char *) str1
); break;
2903 case 1: start_shop_mode(10,spec
.ex1a
,spec
.ex1a
+ spec
.ex2a
- 1,spec
.ex2b
,(char *) str1
); break;
2904 case 2: start_shop_mode(11,spec
.ex1a
,spec
.ex1a
+ spec
.ex2a
- 1 ,spec
.ex2b
,(char *) str1
); break;
2905 case 3: start_shop_mode(12,spec
.ex1a
,spec
.ex1a
+ spec
.ex2a
- 1,spec
.ex2b
,(char *) str1
); break;
2906 case 4: start_shop_mode(3,spec
.ex1a
,spec
.ex1a
+ spec
.ex2a
- 1,spec
.ex2b
,(char *) str1
); break;
2912 if (check_mess
== TRUE
) {
2913 handle_message(which_mode
,cur_spec_type
,cur_node
.m1
,cur_node
.m2
,a
,b
);
2917 void setsd(short a
,short b
,short val
)
2919 if (sd_legit(a
,b
) == FALSE
) {
2920 give_error("The scenario attempted to change an out of range Stuff Done flag.","",0);
2926 void handle_message(short which_mode
,short cur_type
,short mess1
,short mess2
,short *a
,short *b
)
2928 char str1
[256] = "",str2
[256] = "";
2929 short label1
= -1,label2
= -1,label1b
= -1,label2b
= -1;
2930 short mess_adj
[3] = {160,10,20};
2932 if ((mess1
< 0) && (mess2
< 0))
2934 if (which_mode
== 7) { // talking
2935 *a
= mess1
+ ((mess1
>= 0) ? mess_adj
[cur_type
] : 0);
2936 *b
= mess2
+ ((mess2
>= 0) ? mess_adj
[cur_type
] : 0);
2939 get_strs((char *) str1
,(char *) str2
, cur_type
, mess1
+ ((mess1
>= 0) ? mess_adj
[cur_type
] : 0),
2940 mess2
+ ((mess2
>= 0) ? mess_adj
[cur_type
] : 0)) ;
2942 label1
= 1000 * cur_type
+ mess1
+ mess_adj
[cur_type
];
2943 label1b
= (is_out()) ? (party
.outdoor_corner
.x
+ party
.i_w_c
.x
) +
2944 scenario
.out_width
* (party
.outdoor_corner
.y
+ party
.i_w_c
.y
) : c_town
.town_num
;
2947 label2
= 1000 * cur_type
+ mess2
+ mess_adj
[cur_type
];
2948 label2b
= (is_out()) ? (party
.outdoor_corner
.x
+ party
.i_w_c
.x
) +
2949 scenario
.out_width
* (party
.outdoor_corner
.y
+ party
.i_w_c
.y
) : c_town
.town_num
;
2951 display_strings((char *) str1
, (char *) str2
,label1
,label2
, label1b
,label2b
,
2952 "",57,1600 + scenario
.intro_pic
,0);
2955 void get_strs(char *str1
,char *str2
,short cur_type
,short which_str1
,short which_str2
)
2957 short num_strs
[3] = {260,108,135};
2959 if (((which_str1
>= 0) && (which_str1
!= minmax(0,num_strs
[cur_type
],which_str1
))) ||
2960 ((which_str2
>= 0) && (which_str2
!= minmax(0,num_strs
[cur_type
],which_str2
)))) {
2961 give_error("The scenario attempted to access a message out of range.","",0);
2966 if (which_str1
>= 0) {
2967 if (which_str1
< 160)
2968 strcpy((char *) str1
,data_store5
->scen_strs
[which_str1
]);
2969 else strcpy((char *) str1
,scen_strs2
[which_str1
- 160]);
2972 if (which_str2
>= 0){
2973 if (which_str2
< 160)
2974 strcpy((char *) str2
,data_store5
->scen_strs
[which_str2
]);
2975 else strcpy((char *) str2
,scen_strs2
[which_str2
- 160]);
2979 if (which_str1
>= 0)
2980 load_outdoors(party
.outdoor_corner
.x
+ party
.i_w_c
.x
,
2981 party
.outdoor_corner
.y
+ party
.i_w_c
.y
, party
.i_w_c
.x
, party
.i_w_c
.y
,
2982 1,which_str1
,(char *) str1
);
2983 if (which_str2
>= 0)
2984 load_outdoors(party
.outdoor_corner
.x
+ party
.i_w_c
.x
,
2985 party
.outdoor_corner
.y
+ party
.i_w_c
.y
, party
.i_w_c
.x
, party
.i_w_c
.y
,
2986 1,which_str2
,(char *) str2
);
2989 if (which_str1
>= 0)
2990 strcpy((char *) str1
,data_store
->town_strs
[which_str1
]);
2991 if (which_str2
>= 0)
2992 strcpy((char *) str2
,data_store
->town_strs
[which_str2
]);
2999 void use_spec_item(short item
)
3002 location null_loc
= {0,0};
3004 run_special(8,0,scenario
.special_item_special
[item
],null_loc
,&i
,&j
,&k
);