7 extern current_town_type far c_town
;
8 extern short overall_mode
,which_combat_type
,current_pc
,town_type
;
9 extern Boolean web
,crate
,barrel
,fire_barrier
,force_barrier
,quickfire
,force_wall
,fire_wall
,antimagic
,scloud
,ice_wall
,blade_wall
;
10 extern Boolean sleep_field
;
11 extern big_tr_type far t_d
;
12 extern outdoor_record_type far outdoors
[2][2];
13 extern unsigned char far combat_terrain
[64][64];
14 extern unsigned char far out
[96][96];
15 extern unsigned char far out_e
[96][96];
16 extern unsigned char far misc_i
[64][64];
17 extern unsigned char far sfx
[64][64];
18 extern char terrain_blocked
[256];
19 extern short town_size
[3];
20 extern scenario_data_type far scenario
;
22 Boolean
is_explored(short i
,short j
)
25 if ((i
!= minmax(0,95,i
)) || (j
!= minmax(0,95,j
)))
27 return (out_e
[i
][j
] != 0) ? TRUE
: FALSE
;
29 if (c_town
.explored
[i
][j
] & 1) {
34 void make_explored(short i
,short j
)
38 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 1;
41 void take_explored(short i
,short j
)
45 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 254;
50 if ((overall_mode
== 0) || (overall_mode
== 35))
56 if (((overall_mode
> 0) && (overall_mode
< 10)) || (overall_mode
== 36))
62 if (((overall_mode
>= 10) && (overall_mode
< 20)) || (overall_mode
== 37))
69 Boolean
special(short i
,short j
)
71 if (((misc_i
[i
][j
]) & 2) != 0)
75 void flip_special(short i
,short j
)
77 misc_i
[i
][j
] = misc_i
[i
][j
] ^ (char) (2);
79 void make_special(short i
,short j
)
81 misc_i
[i
][j
] = misc_i
[i
][j
] | (char) (2);
83 void take_special(short i
,short j
)
85 misc_i
[i
][j
] = misc_i
[i
][j
] & 253;
88 Boolean
is_web(short i
,short j
)
90 return (misc_i
[i
][j
] & 4) ? TRUE
: FALSE
;
92 void make_web(short i
,short j
)
94 if (spot_impassable(i
,j
) == TRUE
)
96 if ((misc_i
[i
][j
] & 224) || (c_town
.explored
[i
][j
] & 238))
98 misc_i
[i
][j
] = misc_i
[i
][j
] | 4;
101 void take_web(short i
,short j
)
103 misc_i
[i
][j
] = misc_i
[i
][j
] & 251;
106 Boolean
is_crate(short i
,short j
)
108 return (misc_i
[i
][j
] & 8) ? TRUE
: FALSE
;
110 void make_crate(short i
,short j
)
112 // if (misc_i[i][j] & 240)
114 misc_i
[i
][j
] = misc_i
[i
][j
] | 8;
117 void take_crate(short i
,short j
)
119 misc_i
[i
][j
] = misc_i
[i
][j
] & 247;
122 Boolean
is_barrel(short i
,short j
)
124 return (misc_i
[i
][j
] & 16) ? TRUE
: FALSE
;
126 void make_barrel(short i
,short j
)
128 // if (misc_i[i][j] & 234)
130 misc_i
[i
][j
] = misc_i
[i
][j
] | 16;
133 void take_barrel(short i
,short j
)
135 misc_i
[i
][j
] = misc_i
[i
][j
] & 239;
138 Boolean
is_fire_barrier(short i
,short j
)
140 return (misc_i
[i
][j
] & 32) ? TRUE
: FALSE
;
142 void make_fire_barrier(short i
,short j
)
144 if ((is_antimagic(i
,j
)) && (get_ran(1,0,3) < 3))
146 if (misc_i
[i
][j
] & 248)
149 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 1;
150 misc_i
[i
][j
] = misc_i
[i
][j
] | 32;
153 void take_fire_barrier(short i
,short j
)
155 misc_i
[i
][j
] = misc_i
[i
][j
] & 223;
158 Boolean
is_force_barrier(short i
,short j
)
160 return (misc_i
[i
][j
] & 64) ? TRUE
: FALSE
;
162 void make_force_barrier(short i
,short j
)
164 if ((is_antimagic(i
,j
)) && (get_ran(1,0,2) < 2))
166 if (misc_i
[i
][j
] & 248)
169 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 1;
170 misc_i
[i
][j
] = misc_i
[i
][j
] | 64;
171 force_barrier
= TRUE
;
173 void take_force_barrier(short i
,short j
)
175 misc_i
[i
][j
] = misc_i
[i
][j
] & 191;
178 Boolean
is_quickfire(short i
,short j
)
180 return (misc_i
[i
][j
] & 128) ? TRUE
: FALSE
;
182 void make_quickfire(short i
,short j
)
186 if ((is_antimagic(i
,j
)) && (get_ran(1,0,1) == 0))
188 if ((is_force_barrier(i
,j
)) || (is_fire_barrier(i
,j
)))
190 ter
= coord_to_ter(i
,j
);
191 if (scenario
.ter_types
[ter
].blockage
== 1)
193 if (scenario
.ter_types
[ter
].blockage
== 5)
195 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 1;
196 misc_i
[i
][j
] = misc_i
[i
][j
] & 3;
197 misc_i
[i
][j
] = misc_i
[i
][j
] | 128;
200 void take_quickfire(short i
,short j
)
202 misc_i
[i
][j
] = misc_i
[i
][j
] & 127;
205 Boolean
is_force_wall(short i
,short j
)
207 return (c_town
.explored
[i
][j
] & 2) ? TRUE
: FALSE
;
209 void make_force_wall(short i
,short j
)
211 if (spot_impassable(i
,j
) == TRUE
)
213 if ((c_town
.explored
[i
][j
] & 74) || (misc_i
[i
][j
] & 248))
217 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 2;
220 void take_force_wall(short i
,short j
)
222 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 253;
226 Boolean
is_fire_wall(short i
,short j
)
228 return (c_town
.explored
[i
][j
] & 4) ? TRUE
: FALSE
;
230 void make_fire_wall(short i
,short j
)
232 if (spot_impassable(i
,j
) == TRUE
)
234 if ((c_town
.explored
[i
][j
] & 248) || (misc_i
[i
][j
] & 254))
237 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 4;
240 void take_fire_wall(short i
,short j
)
242 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 251;
245 Boolean
is_antimagic(short i
,short j
)
247 return (c_town
.explored
[i
][j
] & 8) ? TRUE
: FALSE
;
249 void make_antimagic(short i
,short j
)
251 if (spot_impassable(i
,j
) == TRUE
)
253 if (misc_i
[i
][j
] & 224)
256 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 1;
257 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 8;
260 void take_antimagic(short i
,short j
)
262 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 247;
265 Boolean
is_scloud(short i
,short j
)
267 return (c_town
.explored
[i
][j
] & 16) ? TRUE
: FALSE
;
269 void make_scloud(short i
,short j
)
271 if (spot_impassable(i
,j
) == TRUE
)
274 if ((c_town
.explored
[i
][j
] & 238) || (misc_i
[i
][j
] & 224))
276 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 16;
279 void take_scloud(short i
,short j
)
281 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 239;
284 Boolean
is_ice_wall(short i
,short j
)
286 return (c_town
.explored
[i
][j
] & 32) ? TRUE
: FALSE
;
288 void make_ice_wall(short i
,short j
)
290 if (spot_impassable(i
,j
) == TRUE
)
292 if ((c_town
.explored
[i
][j
] & 74) || (misc_i
[i
][j
] & 252))
296 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 32;
299 void take_ice_wall(short i
,short j
)
301 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 223;
305 Boolean
is_blade_wall(short i
,short j
)
307 return (c_town
.explored
[i
][j
] & 64) ? TRUE
: FALSE
;
309 void make_blade_wall(short i
,short j
)
311 if (spot_impassable(i
,j
) == TRUE
)
313 if ((c_town
.explored
[i
][j
] & 8) || (misc_i
[i
][j
] & 224))
315 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 9;
316 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 64;
319 void take_blade_wall(short i
,short j
)
321 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 191;
323 Boolean
is_sleep_cloud(short i
,short j
)
325 return (c_town
.explored
[i
][j
] & 128) ? TRUE
: FALSE
;
327 void make_sleep_cloud(short i
,short j
)
329 if (spot_impassable(i
,j
) == TRUE
)
331 if ((c_town
.explored
[i
][j
] & 8) || (misc_i
[i
][j
] & 224))
333 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 9;
334 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] | 128;
337 void take_sleep_cloud(short i
,short j
)
339 c_town
.explored
[i
][j
] = c_town
.explored
[i
][j
] & 127;
343 Boolean
is_small_blood(short i
,short j
)
345 return (sfx
[i
][j
] & 1) ? TRUE
: FALSE
;
347 Boolean
is_medium_blood(short i
,short j
)
349 return (sfx
[i
][j
] & 2) ? TRUE
: FALSE
;
351 Boolean
is_large_blood(short i
,short j
)
353 return (sfx
[i
][j
] & 4) ? TRUE
: FALSE
;
355 Boolean
is_small_slime(short i
,short j
)
357 return (sfx
[i
][j
] & 8) ? TRUE
: FALSE
;
359 Boolean
is_big_slime(short i
,short j
)
361 return (sfx
[i
][j
] & 16) ? TRUE
: FALSE
;
363 Boolean
is_ash(short i
,short j
)
365 return (sfx
[i
][j
] & 32) ? TRUE
: FALSE
;
367 Boolean
is_bones(short i
,short j
)
369 return (sfx
[i
][j
] & 64) ? TRUE
: FALSE
;
371 Boolean
is_rubble(short i
,short j
)
373 return (sfx
[i
][j
] & 128) ? TRUE
: FALSE
;
375 void make_sfx(short i
,short j
, short type
)
379 if (get_obscurity(i
,j
) > 0)
381 ter
= coord_to_ter(i
,j
);
382 if (terrain_blocked
[ter
] != 0)
389 type
= min(3,type
+ sfx
[i
][j
]);
396 sfx
[i
][j
] = s_pow(2,type
- 1);
399 void spread_sfx(short type
,short prob
)
404 for (i
= 0; i
< town_size
[town_type
]; i
++)
405 for (j
= 0; j
< town_size
[town_type
]; j
++)
406 if ((t_d
.terrain
[i
][j
] < 5) && (get_ran(1,0,100) <= prob
))