… | |
… | |
90 | } |
90 | } |
91 | |
91 | |
92 | op->drop_and_destroy (); |
92 | op->drop_and_destroy (); |
93 | } |
93 | } |
94 | |
94 | |
95 | void |
95 | static void |
96 | generate_monster (object *gen) |
96 | generate_monster (object *gen) |
97 | { |
97 | { |
98 | if (!gen->map) |
98 | if (!gen->map) |
99 | return; |
99 | return; |
100 | |
100 | |
… | |
… | |
158 | } |
158 | } |
159 | |
159 | |
160 | op->destroy (); |
160 | op->destroy (); |
161 | } |
161 | } |
162 | |
162 | |
163 | void |
163 | static void |
164 | remove_force (object *op) |
164 | remove_force (object *op) |
165 | { |
165 | { |
166 | if (--op->duration > 0) |
166 | if (--op->duration > 0) |
167 | return; |
167 | return; |
168 | |
168 | |
… | |
… | |
180 | } |
180 | } |
181 | |
181 | |
182 | op->destroy (); |
182 | op->destroy (); |
183 | } |
183 | } |
184 | |
184 | |
185 | void |
185 | static void |
186 | remove_blindness (object *op) |
186 | remove_blindness (object *op) |
187 | { |
187 | { |
188 | if (--op->stats.food > 0) |
188 | if (--op->stats.food > 0) |
189 | return; |
189 | return; |
190 | |
190 | |
… | |
… | |
197 | } |
197 | } |
198 | |
198 | |
199 | op->destroy (); |
199 | op->destroy (); |
200 | } |
200 | } |
201 | |
201 | |
202 | void |
202 | static void |
203 | poison_more (object *op) |
203 | poison_more (object *op) |
204 | { |
204 | { |
205 | if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) |
205 | if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) |
206 | { |
206 | { |
207 | op->destroy (); |
207 | op->destroy (); |
… | |
… | |
232 | |
232 | |
233 | hit_player (op->env, op->stats.dam, op, AT_INTERNAL, 1); |
233 | hit_player (op->env, op->stats.dam, op, AT_INTERNAL, 1); |
234 | } |
234 | } |
235 | |
235 | |
236 | |
236 | |
237 | void |
237 | static void |
238 | move_gate (object *op) |
238 | move_gate (object *op) |
239 | { /* 1 = going down, 0 = going up */ |
239 | { /* 1 = going down, 0 = going up */ |
240 | object *tmp; |
240 | object *tmp; |
241 | |
241 | |
242 | if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) |
242 | if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) |
… | |
… | |
376 | |
376 | |
377 | /* hp : how long door is open/closed |
377 | /* hp : how long door is open/closed |
378 | * maxhp : initial value for hp |
378 | * maxhp : initial value for hp |
379 | * sp : 1 = open, 0 = close |
379 | * sp : 1 = open, 0 = close |
380 | */ |
380 | */ |
381 | void |
381 | static void |
382 | move_timed_gate (object *op) |
382 | move_timed_gate (object *op) |
383 | { |
383 | { |
384 | int v = op->value; |
384 | int v = op->value; |
385 | |
385 | |
386 | if (op->stats.sp) |
386 | if (op->stats.sp) |
… | |
… | |
405 | * speed: frequency of 'glances' |
405 | * speed: frequency of 'glances' |
406 | * connected: connected value of detector |
406 | * connected: connected value of detector |
407 | * sp: 1 if detection sets buttons |
407 | * sp: 1 if detection sets buttons |
408 | * -1 if detection unsets buttons |
408 | * -1 if detection unsets buttons |
409 | */ |
409 | */ |
410 | |
410 | static void |
411 | void |
|
|
412 | move_detector (object *op) |
411 | move_detector (object *op) |
413 | { |
412 | { |
414 | object *tmp; |
413 | object *tmp; |
415 | int last = op->value; |
414 | int last = op->value; |
416 | int detected; |
415 | int detected; |
… | |
… | |
483 | SET_ANIMATION (op, op->stats.wc); |
482 | SET_ANIMATION (op, op->stats.wc); |
484 | update_object (op, UP_OBJ_FACE); |
483 | update_object (op, UP_OBJ_FACE); |
485 | } |
484 | } |
486 | } |
485 | } |
487 | |
486 | |
488 | void |
487 | static void |
489 | move_hole (object *op) |
488 | move_hole (object *op) |
490 | { /* 1 = opening, 0 = closing */ |
489 | { /* 1 = opening, 0 = closing */ |
491 | if (op->value) |
490 | if (op->value) |
492 | { /* We're opening */ |
491 | { /* We're opening */ |
493 | if (--op->stats.wc <= 0) |
492 | if (--op->stats.wc <= 0) |
… | |
… | |
825 | |
824 | |
826 | /* Move the arrow. */ |
825 | /* Move the arrow. */ |
827 | op->move_to (pos); |
826 | op->move_to (pos); |
828 | } |
827 | } |
829 | |
828 | |
830 | void |
829 | static void |
831 | change_object (object *op) |
830 | change_object (object *op) |
832 | { /* Doesn`t handle linked objs yet */ |
831 | { /* Doesn`t handle linked objs yet */ |
833 | int i, j; |
832 | int i, j; |
834 | |
833 | |
835 | if (!op->other_arch) |
834 | if (!op->other_arch) |
… | |
… | |
942 | /* This object will teleport someone to a different map |
941 | /* This object will teleport someone to a different map |
943 | and will also apply changes to the player from its inventory. |
942 | and will also apply changes to the player from its inventory. |
944 | This was invented for giving classes, but there's no reason it |
943 | This was invented for giving classes, but there's no reason it |
945 | can't be generalized. |
944 | can't be generalized. |
946 | */ |
945 | */ |
947 | void |
946 | static void |
948 | move_player_changer (object *op) |
947 | move_player_changer (object *op) |
949 | { |
948 | { |
950 | object *player; |
949 | object *player; |
951 | object *walk; |
950 | object *walk; |
952 | |
951 | |
… | |
… | |
1018 | * moves them in the op->stats.sp direction. speed is how often it'll move. |
1017 | * moves them in the op->stats.sp direction. speed is how often it'll move. |
1019 | * If attacktype is nonzero it will paralyze the player. If lifesave is set, |
1018 | * If attacktype is nonzero it will paralyze the player. If lifesave is set, |
1020 | * it'll dissapear after hp+1 moves. If hp is set and attacktype is set, |
1019 | * it'll dissapear after hp+1 moves. If hp is set and attacktype is set, |
1021 | * it'll paralyze the victim for hp*his speed/op->speed |
1020 | * it'll paralyze the victim for hp*his speed/op->speed |
1022 | */ |
1021 | */ |
1023 | void |
1022 | static void |
1024 | move_player_mover (object *op) |
1023 | move_player_mover (object *op) |
1025 | { |
1024 | { |
1026 | int dir = op->stats.sp; |
1025 | int dir = op->stats.sp; |
1027 | sint16 nx, ny; |
1026 | sint16 nx, ny; |
1028 | maptile *m; |
1027 | maptile *m; |
… | |
… | |
1072 | /* only level >=1 movers move people */ |
1071 | /* only level >=1 movers move people */ |
1073 | if (op->level) |
1072 | if (op->level) |
1074 | { |
1073 | { |
1075 | /* Following is a bit of hack. We need to make sure it |
1074 | /* Following is a bit of hack. We need to make sure it |
1076 | * is cleared, otherwise the player will get stuck in |
1075 | * is cleared, otherwise the player will get stuck in |
1077 | * place. This can happen if the player used a spell to |
1076 | * place. This can happen if the player used a spell to |
1078 | * get to this space. |
1077 | * get to this space. |
1079 | */ |
1078 | */ |
1080 | victim->contr->fire_on = 0; |
1079 | victim->contr->fire_on = 0; |
1081 | victim->speed_left = 1.f; |
1080 | victim->speed_left = 1.f; |
1082 | move_player (victim, dir); |
1081 | move_player (victim, dir); |
… | |
… | |
1254 | } |
1253 | } |
1255 | } |
1254 | } |
1256 | |
1255 | |
1257 | // mapscript objects activate themselves (only) then their timer fires |
1256 | // mapscript objects activate themselves (only) then their timer fires |
1258 | // TODO: maybe they should simply trigger the link like any other object? |
1257 | // TODO: maybe they should simply trigger the link like any other object? |
1259 | void |
1258 | static void |
1260 | move_mapscript (object *op) |
1259 | move_mapscript (object *op) |
1261 | { |
1260 | { |
1262 | op->set_speed (0); |
1261 | op->set_speed (0); |
1263 | cfperl_mapscript_activate (op, true, op, 0); |
1262 | cfperl_mapscript_activate (op, true, op, 0); |
1264 | } |
1263 | } |
1265 | |
1264 | |
|
|
1265 | static void |
1266 | void move_lamp (object *op) |
1266 | move_lamp (object *op) |
1267 | { |
1267 | { |
1268 | // if the lamp/torch is off, we should disable it. |
1268 | // if the lamp/torch is off, we should disable it. |
1269 | if (!op->glow_radius) |
1269 | if (!op->glow_radius) |
1270 | { |
1270 | { |
1271 | op->set_speed (0); |
1271 | op->set_speed (0); |