21 extern short overall_mode
;
22 extern party_record_type party
;
23 extern piles_of_stuff_dumping_type
*data_store
;
24 extern piles_of_stuff_dumping_type2
*data_store2
;
25 extern talking_record_type talking
;
26 extern scenario_data_type scenario
;
28 extern current_town_type c_town
;
29 extern unsigned char out
[96][96];
30 extern unsigned char out_e
[96][96];
31 extern unsigned char combat_terrain
[64][64];
32 extern short current_pc
,stat_window
;
33 extern outdoor_record_type outdoors
[2][2];
34 extern location pc_pos
[6],center
;
35 extern town_item_list t_i
;
36 extern pc_record_type adven
[6];
37 extern big_tr_type t_d
;
38 extern Boolean registered
;
41 item_record_type null_thing
= {0,0, 0,0,0,0,0,0, 0,0,0,0,0,0, 0, 0,0, {0,0},"", "",0,0,0,0};
46 void activate_monster_enc(short enc_num
,short str1
,short str2
,short strsnd
,short *flip_bit
)
49 display_enc_string(str1
,str2
,strsnd
);
50 activate_monsters(enc_num
,1);
56 // OTS = One Time Strings
57 void OTS(short str1b
,short str2b
,short str12a
,short sound
,unsigned char *flip_bit
)
63 D2ES(str12a
,str1b
,0,0,sound
);
64 else D2ES(str12a
,str1b
,str12a
,str2b
,sound
);
67 // GFI go for it ... do simple dialog check
68 Boolean
GFI(short dialog_num
)
70 if (FCD(dialog_num
,0) > 1)
75 //DSG = Do Special Give
76 void DSG(short item_num
,unsigned char *flip_bit
,short dialog_num
,short what_spec
,short amt_gold
,short amt_food
)
77 //short special; // 0 - nah 3** - Set spec item 1000 + * give food 2000 + * give cash
81 item_record_type item
;
83 item
= get_stored_item(item_num
);
87 choice
= fancy_choice_dialog(dialog_num
,0);
91 if (item
.variety
== 0)
93 else did_give
= give_to_party(item
,0);
94 if (did_give
== true) {
95 party
.food
+= amt_food
;
96 party
.gold
+= amt_gold
;
98 if (party
.spec_items
[what_spec
] > 0) {
99 ASB("You already have this special item.");
102 party
.spec_items
[what_spec
] += 1;
103 put_item_screen(stat_window
,0);
108 else choice
= fancy_choice_dialog(1049,0);
113 Boolean
run_trap(short pc_num
,short trap_type
,short trap_level
,short diff
)
114 //short pc_num; // 6 - BOOM! 7 - pick here
115 //short trap_type; // 0 - random 1 - blade 2 - dart 3 - gas 4 - boom 5,6 - no
116 // 7 - level drain 8 - alert 9 - big flames 10 - dumbfound 11 - town hostile
117 // 20 + * - trap *, but nasty
119 short r1
,skill
,i
,num_hits
= 1,i_level
;
120 short trap_odds
[30] = {5,30,35,42,48, 55,63,69,75,77,
121 78,80,82,84,86, 88,90,92,94,96,98,99,99,99,99,99,99,99,99,99};
123 if (pc_num
> 7) { // Debug
125 ASB("TRAP ERROR! REPORT!");
130 pc_num
= select_pc(1,0);
136 num_hits
+= trap_level
;
139 trap_type
= get_ran(1,1,4);
140 if ((trap_type
== 5) || (trap_type
== 6))
144 i
= stat_adj(pc_num
,1);
145 if ((i_level
= get_prot_level(pc_num
,42)) > 0)
147 skill
= minmax(0,20,adven
[pc_num
].skills
[14] +
148 + adven
[pc_num
].skills
[18] / 2 + 1 - c_town
.difficulty
+ 2 * i
);
150 r1
= get_ran(1,0,100) + diff
;
152 if (adven
[pc_num
].traits
[3] == false)
156 if (r1
< trap_odds
[skill
]) {
157 add_string_to_buf(" Trap disarmed. ");
160 else add_string_to_buf(" Disarm failed. ");
165 for (i
= 0; i
< num_hits
; i
++) {
166 add_string_to_buf(" A knife flies out! ");
167 r1
= get_ran(2 + c_town
.difficulty
/ 14,1,10);
168 damage_pc(pc_num
,r1
,0,-1);
173 add_string_to_buf(" A dart flies out. ");
174 r1
= 3 + c_town
.difficulty
/ 14;
175 r1
= r1
+ trap_level
* 2;
176 poison_pc(pc_num
,r1
);
180 add_string_to_buf(" Poison gas pours out. ");
181 r1
= 2 + c_town
.difficulty
/ 14;
182 r1
= r1
+ trap_level
* 2;
183 for(i
= 0; i
< 6; i
++)
188 for (i
= 0; i
< num_hits
; i
++) {
189 add_string_to_buf(" There is an explosion. ");
190 r1
= get_ran(3 + c_town
.difficulty
/ 13,1,8);
196 add_string_to_buf(" A purple ray flies out. ");
197 r1
= 200 + c_town
.difficulty
* 100;
198 r1
= r1
+ trap_level
* 400;
199 sleep_pc(pc_num
,r1
,12,50);
202 add_string_to_buf(" You feel weak. ");
204 r1
= r1
+ trap_level
* 30;
205 adven
[pc_num
].experience
= max (0,adven
[pc_num
].experience
- r1
);
209 add_string_to_buf(" An alarm goes off!!! ");
214 add_string_to_buf(" Flames shoot from the walls. ");
215 r1
= get_ran(10 + trap_level
* 5,1,8);
219 add_string_to_buf(" You feel disoriented. ");
220 for(i
= 0; i
< 6; i
++)
221 dumbfound_pc(i
,2 + trap_level
* 2);
225 add_string_to_buf(" You prick your finger. ");
226 r1
= 3 + c_town
.difficulty
/ 14;
227 r1
= r1
+ trap_level
* 2;
228 disease_pc(pc_num
,r1
);
232 add_string_to_buf(" A foul substance sprays out.");
233 r1
= 2 + c_town
.difficulty
/ 14;
234 r1
= r1
+ trap_level
* 2;
235 for(i
= 0; i
< 6; i
++)
240 put_item_screen(stat_window
,0);
244 location
get_spec_loc(short which
)
246 location where
= {0,0};
249 for (i
= 0; i
< 50; i
++)
250 if (c_town
.town
.spec_id
[i
] == which
)
251 return c_town
.town
.special_locs
[i
];
256 void start_split(short a
,short b
,short noise
)
260 party
.stuff_done
[304][0] = 1;
261 party
.stuff_done
[304][1] = c_town
.p_loc
.x
;
262 party
.stuff_done
[304][2] = c_town
.p_loc
.y
;
265 for (i
= 0; i
< 6; i
++)
266 if (i
!= party
.stuff_done
[304][3])
267 adven
[i
].main_status
+= 10;
268 current_pc
= party
.stuff_done
[304][3];
269 update_explored(c_town
.p_loc
);
270 center
= c_town
.p_loc
;
275 void end_split(short noise
)
279 if (party
.stuff_done
[304][0] == 0) {
280 ASB("Party already together!");
283 c_town
.p_loc
.x
= party
.stuff_done
[304][1];
284 c_town
.p_loc
.y
= party
.stuff_done
[304][2];
285 party
.stuff_done
[304][0] = 0;
286 for (i
= 0; i
< 6; i
++)
287 if (adven
[i
].main_status
>= 10)
288 adven
[i
].main_status
-= 10;
289 update_explored(c_town
.p_loc
);
290 center
= c_town
.p_loc
;
293 add_string_to_buf("You are reunited.");
297 // 1 if in right position now.
298 // 2 if in left position
299 // levers should always start to left.
300 short handle_lever(location w
)
302 if (FCD(1020,0) == 1)
309 void switch_lever(location w
)
311 alter_space(w
.x
,w
.y
,scenario
.ter_types
[t_d
.terrain
[w
.x
][w
.y
]].trans_to_what
);