ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/time.C
(Generate patch)

Comparing deliantra/server/server/time.C (file contents):
Revision 1.44 by root, Sat Apr 21 22:01:57 2007 UTC vs.
Revision 1.72 by root, Thu Nov 8 19:43:29 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * 20 *
22 * The authors can be reached via e-mail at <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 22 */
24 23
25/* 24/*
26 * Routines that is executed from objects based on their speed have been 25 * Routines that is executed from objects based on their speed have been
27 * collected in this file. 26 * collected in this file.
35 * so those will be removed shortly (in a cascade like fashion.) 34 * so those will be removed shortly (in a cascade like fashion.)
36 */ 35 */
37void 36void
38remove_door (object *op) 37remove_door (object *op)
39{ 38{
39 for (int i = 1; i < SIZEOFFREE1 + 1; i += 2)
40 {
41 object *tmp;
42 mapxy pos (op);
43 pos.move (i);
44 if (pos.normalise ()
45 && (tmp = present (DOOR, pos.m, pos.x, pos.y)))
46 {
47 tmp->set_speed (0.1f);
48 tmp->speed_left = -0.2f;
49 }
50 }
51
52 if (op->other_arch)
53 {
54 object *tmp = arch_to_object (op->other_arch);
55 tmp->x = op->x;
56 tmp->y = op->y;
57 tmp->map = op->map;
58 tmp->level = op->level;
59 insert_ob_in_map (tmp, op->map, op, 0);
60 }
61
62 op->destroy ();
63}
64
65void
66remove_door2 (object *op)
67{
40 int i; 68 int i;
41 object *tmp; 69 object *tmp;
42 70
43 for (i = 1; i < 9; i += 2) 71 for (i = 1; i < 9; i += 2)
72 {
44 if ((tmp = present (DOOR, op->map, op->x + freearr_x[i], op->y + freearr_y[i])) != NULL) 73 tmp = present (LOCKED_DOOR, op->map, op->x + freearr_x[i], op->y + freearr_y[i]);
45 { 74 if (tmp && tmp->slaying == op->slaying)
75 { /* same key both doors */
46 tmp->set_speed (0.1); 76 tmp->set_speed (0.1f);
47 tmp->speed_left = -0.2; 77 tmp->speed_left = -0.2f;
48 } 78 }
79 }
49 80
50 if (op->other_arch) 81 if (op->other_arch)
51 { 82 {
52 tmp = arch_to_object (op->other_arch); 83 tmp = arch_to_object (op->other_arch);
53 tmp->x = op->x; 84 tmp->x = op->x;
59 90
60 op->destroy (); 91 op->destroy ();
61} 92}
62 93
63void 94void
64remove_door2 (object *op)
65{
66 int i;
67 object *tmp;
68
69 for (i = 1; i < 9; i += 2)
70 {
71 tmp = present (LOCKED_DOOR, op->map, op->x + freearr_x[i], op->y + freearr_y[i]);
72 if (tmp && tmp->slaying == op->slaying)
73 { /* same key both doors */
74 tmp->set_speed (0.1);
75 tmp->speed_left = -0.2;
76 }
77 }
78
79 if (op->other_arch)
80 {
81 tmp = arch_to_object (op->other_arch);
82 tmp->x = op->x;
83 tmp->y = op->y;
84 tmp->map = op->map;
85 tmp->level = op->level;
86 insert_ob_in_map (tmp, op->map, op, 0);
87 }
88
89 op->destroy ();
90}
91
92static void
93generate_monster_tail (object *gen, object *op)
94{
95 op->expand_tail ();
96
97 int i = find_free_spot (op, gen->map, gen->x, gen->y, 1, 9);
98 if (i >= 0)
99 {
100 if (insert_ob_in_map_at (op, gen->map, gen, 0, gen->x + freearr_x[i], gen->y + freearr_y[i]))
101 {
102 if (rndm (0, 9))
103 generate_artifact (op, gen->map->difficulty);
104
105 if (op->has_random_items ())
106 create_treasure (op->randomitems, op, GT_APPLY, gen->map->difficulty);
107
108 return;
109 }
110 }
111
112 op->destroy ();
113}
114
115/* Will generate a monster according to content
116 * of generator.
117 */
118static void
119generate_monster_inv (object *gen)
120{
121 if (!gen->inv)
122 return;
123
124 /* First count number of objects in inv */
125 int index = 0;
126 object *op;
127 for (object *tmp = gen->inv; tmp; tmp = tmp->below)
128 if (!rndm (++index))
129 op = tmp;
130
131 op = object_create_clone (op);
132
133 CLEAR_FLAG (op, FLAG_IS_A_TEMPLATE);
134 unflag_inv (op, FLAG_IS_A_TEMPLATE);
135
136 generate_monster_tail (gen, op);
137}
138
139static void
140generate_monster_arch (object *gen)
141{
142 if (archetype *at = gen->other_arch)
143 generate_monster_tail (gen, arch_to_object (at));
144}
145
146void
147generate_monster (object *gen) 95generate_monster (object *gen)
148{ 96{
149 if (!gen->map) 97 if (!gen->map)
150 return; 98 return;
151 99
152 if (GENERATE_SPEED (gen) && rndm (0, GENERATE_SPEED (gen) - 1)) 100 if (GENERATE_SPEED (gen) && rndm (0, GENERATE_SPEED (gen) - 1))
153 return; 101 return;
154 102
103 object *op;
104 int dir;
105
155 if (QUERY_FLAG (gen, FLAG_CONTENT_ON_GEN)) 106 if (QUERY_FLAG (gen, FLAG_CONTENT_ON_GEN))
156 generate_monster_inv (gen); 107 {
108 // either copy one item from the inventory...
109 if (!gen->inv)
110 return;
111
112 // first select one item from the inventory
113 int index = 0;
114 for (object *tmp = gen->inv; tmp; tmp = tmp->below)
115 if (!rndm (++index))
116 op = tmp;
117
118 dir = find_free_spot (op, gen->map, gen->x, gen->y, 1, SIZEOFFREE1 + 1);
119 if (dir < 0)
120 return;
121
122 op = object_create_clone (op);
123
124 CLEAR_FLAG (op, FLAG_IS_A_TEMPLATE);
125 unflag_inv (op, FLAG_IS_A_TEMPLATE);
126 }
127 else if (gen->other_arch)
128 {
129 // ...or use other_arch
130 dir = find_free_spot (gen->other_arch, gen->map, gen->x, gen->y, 1, SIZEOFFREE1 + 1);
131 if (dir < 0)
132 return;
133
134 op = arch_to_object (gen->other_arch);
135 }
157 else 136 else
158 generate_monster_arch (gen); 137 return;
159 138
139 op->expand_tail ();
140
141 mapxy pos (gen); pos.move (dir);
142
143 if (pos.insert (op, gen))
144 {
145 if (rndm (0, 9))
146 generate_artifact (op, gen->map->difficulty);
147
148 if (op->has_random_items ())
149 create_treasure (op->randomitems, op, GT_APPLY, gen->map->difficulty);
150
151 return;
152 }
153
154 op->destroy ();
160} 155}
161 156
162void 157void
163remove_force (object *op) 158remove_force (object *op)
164{ 159{
233} 228}
234 229
235 230
236void 231void
237move_gate (object *op) 232move_gate (object *op)
238{ /* 1 = going down, 0 = goind up */ 233{ /* 1 = going down, 0 = going up */
239 object *tmp; 234 object *tmp;
240 235
241 if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) 236 if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op))
242 { 237 {
243 LOG (llevError, "Gate error: animation was %d, max=%d\n", op->stats.wc, NUM_ANIMATIONS (op)); 238 LOG (llevError, "Gate error: animation was %d, max=%d\n", op->stats.wc, NUM_ANIMATIONS (op));
248 if (op->value) 243 if (op->value)
249 { 244 {
250 if (--op->stats.wc <= 0) 245 if (--op->stats.wc <= 0)
251 { /* Reached bottom, let's stop */ 246 { /* Reached bottom, let's stop */
252 op->stats.wc = 0; 247 op->stats.wc = 0;
253 if (op->arch->clone.speed) 248 if (op->arch->speed)
254 op->value = 0; 249 op->value = 0;
255 else 250 else
256 op->set_speed (0); 251 op->set_speed (0);
257 } 252 }
258 253
278 * objects are above the gate. If so, we finish closing the gate, 273 * objects are above the gate. If so, we finish closing the gate,
279 * otherwise, we fall through to the code below which should lower 274 * otherwise, we fall through to the code below which should lower
280 * the gate slightly. 275 * the gate slightly.
281 */ 276 */
282 277
283 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 278 for (tmp = op->above; tmp; tmp = tmp->above)
284 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE)) 279 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE))
285 break; 280 break;
286 281
287 if (tmp == NULL) 282 if (!tmp)
288 { 283 {
289 if (op->arch->clone.speed) 284 if (op->arch->speed)
290 op->value = 1; 285 op->value = 1;
291 else 286 else
292 op->set_speed (0); 287 op->set_speed (0);
293 288
294 return; 289 return;
305 } 300 }
306 else 301 else
307 { /* The gate is still going up */ 302 { /* The gate is still going up */
308 op->stats.wc++; 303 op->stats.wc++;
309 304
310 if ((int) op->stats.wc >= (NUM_ANIMATIONS (op))) 305 if (op->stats.wc >= NUM_ANIMATIONS (op))
311 op->stats.wc = (signed char) NUM_ANIMATIONS (op) - 1; 306 op->stats.wc = NUM_ANIMATIONS (op) - 1;
312 307
313 /* If there is something on top of the gate, we try to roll it off. 308 /* If there is something on top of the gate, we try to roll it off.
314 * If a player/monster, we don't roll, we just hit them with damage 309 * If a player/monster, we don't roll, we just hit them with damage
315 */ 310 */
316 if ((int) op->stats.wc >= NUM_ANIMATIONS (op) / 2) 311 if (op->stats.wc >= NUM_ANIMATIONS (op) / 2)
317 { 312 {
318 /* Halfway or further, check blocks */ 313 /* Halfway or further, check blocks */
319 /* First, get the top object on the square. */ 314 /* First, get the top object on the square. */
320 for (tmp = op->above; tmp != NULL && tmp->above != NULL; tmp = tmp->above); 315 for (tmp = op->above; tmp && tmp->above; tmp = tmp->above)
316 ;
321 317
322 if (tmp != NULL) 318 if (tmp)
323 { 319 {
324 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 320 if (QUERY_FLAG (tmp, FLAG_ALIVE))
325 { 321 {
326 hit_player (tmp, random_roll (1, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1); 322 hit_player (tmp, random_roll (0, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1);
323 op->play_sound (sound_find ("blocked_gate"));
324
327 if (tmp->type == PLAYER) 325 if (tmp->type == PLAYER)
328 new_draw_info_format (NDI_UNIQUE, 0, tmp, "You are crushed by the %s!", &op->name); 326 new_draw_info_format (NDI_UNIQUE, 0, tmp, "You are crushed by the %s!", &op->name);
329 } 327 }
330 else
331 /* If the object is not alive, and the object either can 328 /* If the object is not alive, and the object either can
332 * be picked up or the object rolls, move the object 329 * be picked up or the object rolls, move the object
333 * off the gate. 330 * off the gate.
334 */ 331 */
335 if (!QUERY_FLAG (tmp, FLAG_ALIVE) && (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL))) 332 else if (!QUERY_FLAG (tmp, FLAG_ALIVE) && (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL)))
336 { 333 {
337 /* If it has speed, it should move itself, otherwise: */ 334 /* If it has speed, it should move itself, otherwise: */
338 int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); 335 int i = find_free_spot (tmp, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1);
339 336
340 /* If there is a free spot, move the object someplace */ 337 /* If there is a free spot, move the object someplace */
341 if (i != -1) 338 if (i > 0)
342 { 339 {
340 mapxy pos (tmp);
341 pos.move (i);
342 if (pos.normalise ())
343 tmp->remove (); 343 tmp->move_to (pos);
344 tmp->x += freearr_x[i], tmp->y += freearr_y[i];
345 insert_ob_in_map (tmp, op->map, op, 0);
346 } 344 }
347 } 345 }
348 } 346 }
349 347
350 /* See if there is still anything blocking the gate */ 348 /* See if there is still anything blocking the gate */
351 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 349 for (tmp = op->above; tmp; tmp = tmp->above)
352 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE)) 350 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE))
353 break; 351 break;
354 352
355 /* IF there is, start putting the gate down */ 353 /* IF there is, start putting the gate down */
356 if (tmp) 354 if (tmp)
357 {
358 op->stats.food = 1; 355 op->stats.food = 1;
359 }
360 else 356 else
361 { 357 {
362 op->move_block = MOVE_ALL; 358 op->move_block = MOVE_ALL;
359
363 if (!op->arch->clone.stats.ac) 360 if (!op->arch->stats.ac)
364 SET_FLAG (op, FLAG_BLOCKSVIEW); 361 SET_FLAG (op, FLAG_BLOCKSVIEW);
365 update_all_los (op->map, op->x, op->y); 362 update_all_los (op->map, op->x, op->y);
366 } 363 }
367 } /* gate is halfway up */ 364 } /* gate is halfway up */
368 365
381 int v = op->value; 378 int v = op->value;
382 379
383 if (op->stats.sp) 380 if (op->stats.sp)
384 { 381 {
385 move_gate (op); 382 move_gate (op);
383
386 if (op->value != v) /* change direction ? */ 384 if (op->value != v) /* change direction ? */
387 op->stats.sp = 0; 385 op->stats.sp = 0;
388 return; 386 return;
389 } 387 }
388
390 if (--op->stats.hp <= 0) 389 if (--op->stats.hp <= 0)
391 { /* keep gate down */ 390 { /* keep gate down */
392 move_gate (op); 391 move_gate (op);
392
393 if (op->value != v) 393 if (op->value != v)
394 op->set_speed (0); 394 op->set_speed (0);
395 } 395 }
396} 396}
397 397
409 int last = op->value; 409 int last = op->value;
410 int detected; 410 int detected;
411 411
412 detected = 0; 412 detected = 0;
413 413
414 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL && !detected; tmp = tmp->above) 414 for (tmp = op->ms ().bot; tmp && !detected; tmp = tmp->above)
415 { 415 {
416 object *tmp2; 416 object *tmp2;
417 417
418 if (op->stats.hp) 418 if (op->stats.hp)
419 { 419 {
439 if (detected && last == 0) 439 if (detected && last == 0)
440 { 440 {
441 op->value = 1; 441 op->value = 1;
442 push_button (op); 442 push_button (op);
443 } 443 }
444
444 if (!detected && last == 1) 445 if (!detected && last == 1)
445 { 446 {
446 op->value = 0; 447 op->value = 0;
447 push_button (op); 448 push_button (op);
448 } 449 }
452 if (detected && last == 1) 453 if (detected && last == 1)
453 { 454 {
454 op->value = 0; 455 op->value = 0;
455 push_button (op); 456 push_button (op);
456 } 457 }
458
457 if (!detected && last == 0) 459 if (!detected && last == 0)
458 { 460 {
459 op->value = 1; 461 op->value = 1;
460 push_button (op); 462 push_button (op);
461 } 463 }
462 } 464 }
463} 465}
464
465 466
466void 467void
467animate_trigger (object *op) 468animate_trigger (object *op)
468{ 469{
469 if ((unsigned char) ++op->stats.wc >= NUM_ANIMATIONS (op)) 470 if ((unsigned char) ++op->stats.wc >= NUM_ANIMATIONS (op))
501 502
502 SET_ANIMATION (op, op->stats.wc); 503 SET_ANIMATION (op, op->stats.wc);
503 update_object (op, UP_OBJ_FACE); 504 update_object (op, UP_OBJ_FACE);
504 return; 505 return;
505 } 506 }
507
506 /* We're closing */ 508 /* We're closing */
507 op->move_on = 0; 509 op->move_on = 0;
508 510
509 op->stats.wc++; 511 op->stats.wc++;
510 if ((int) op->stats.wc >= NUM_ANIMATIONS (op)) 512 if ((int) op->stats.wc >= NUM_ANIMATIONS (op))
585 return NULL; 587 return NULL;
586 } 588 }
587 589
588 op->set_speed (0); 590 op->set_speed (0);
589 op->direction = 0; 591 op->direction = 0;
590 op->move_on = 0; 592 op->move_on = 0;
591 op->move_type = 0; 593 op->move_type = 0;
594 op->skill = 0; // really?
595
596 // restore original wc, dam, attacktype and slaying
592 op->stats.wc = op->stats.sp; 597 op->stats.wc = op->stats.sp;
593 op->stats.dam = op->stats.hp; 598 op->stats.dam = op->stats.hp;
594 op->attacktype = op->stats.grace; 599 op->attacktype = op->stats.grace;
595 op->slaying = 0;
596 op->skill = 0;
597 600
598 if (op->spellarg != NULL) 601 if (op->spellarg)
599 { 602 {
600 op->slaying = op->spellarg; 603 op->slaying = op->spellarg;
601 free (op->spellarg); 604 free (op->spellarg);
602 op->spellarg = NULL; 605 op->spellarg = 0;
603 } 606 }
604 else 607 else
605 op->slaying = NULL; 608 op->slaying = 0;
606 609
607 /* Reset these to zero, so that object::can_merge will work properly */ 610 /* Reset these to zero, so that object::can_merge will work properly */
608 op->spellarg = NULL; 611 op->spellarg = NULL;
609 op->stats.sp = 0; 612 op->stats.sp = 0;
610 op->stats.hp = 0; 613 op->stats.hp = 0;
611 op->stats.grace = 0; 614 op->stats.grace = 0;
612 op->level = 0; 615 op->level = 0;
613 op->face = op->arch->clone.face; 616 op->face = op->arch->face;
614 op->owner = NULL; /* So that stopped arrows will be saved */ 617 op->owner = NULL; /* So that stopped arrows will be saved */
615 update_object (op, UP_OBJ_CHANGE); 618 update_object (op, UP_OBJ_CHANGE);
616 return op; 619 return op;
617} 620}
618 621
639 op->destroy (); 642 op->destroy ();
640 } 643 }
641 else 644 else
642 { 645 {
643 op = fix_stopped_arrow (op); 646 op = fix_stopped_arrow (op);
647
644 if (op) 648 if (op)
645 merge_ob (op, NULL); 649 merge_ob (op, 0);
646 } 650 }
647} 651}
648 652
649/* Move an arrow along its course. op is the arrow or thrown object. 653/* Move an arrow along its course. op is the arrow or thrown object.
650 */ 654 */
651void 655void
652move_arrow (object *op) 656move_arrow (object *op)
653{ 657{
654 object *tmp;
655 sint16 new_x, new_y;
656 int was_reflected, mflags; 658 int was_reflected;
657 maptile *m;
658 659
659 if (op->map == NULL) 660 if (!op->map)
660 { 661 {
661 LOG (llevError, "BUG: Arrow had no map.\n"); 662 LOG (llevError, "BUG: Arrow had no map.\n");
662 op->destroy (); 663 op->destroy ();
663 return; 664 return;
664 } 665 }
694 stop_arrow (op); 695 stop_arrow (op);
695 return; 696 return;
696 } 697 }
697 698
698 /* Calculate target map square */ 699 /* Calculate target map square */
699 new_x = op->x + DIRX (op);
700 new_y = op->y + DIRY (op);
701 was_reflected = 0; 700 was_reflected = 0;
702 701
703 m = op->map; 702 mapxy pos (op); pos.move (op->direction);
704 mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y);
705 703
706 if (mflags & P_OUT_OF_MAP) 704 if (!pos.normalise ())
707 { 705 {
708 stop_arrow (op); 706 stop_arrow (op);
709 return; 707 return;
710 } 708 }
711 709
712 /* only need to look for living creatures if this flag is set */ 710 /* only need to look for living creatures if this flag is set */
713 if (mflags & P_IS_ALIVE) 711 if (pos->flags () & P_IS_ALIVE)
714 { 712 {
715 for (tmp = GET_MAP_OB (m, new_x, new_y); tmp != NULL; tmp = tmp->above) 713 object *tmp;
714
715 for (tmp = pos->bot; tmp; tmp = tmp->above)
716 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 716 if (QUERY_FLAG (tmp, FLAG_ALIVE))
717 break; 717 break;
718 718
719 /* Not really fair, but don't let monsters hit themselves with 719 /* Not really fair, but don't let monsters hit themselves with
720 * their own arrow - this can be because they fire it then 720 * their own arrow - this can be because they fire it then
743 return; 743 return;
744 } 744 }
745 } /* if this is not hitting its owner */ 745 } /* if this is not hitting its owner */
746 } /* if there is something alive on this space */ 746 } /* if there is something alive on this space */
747 747
748 if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) 748 if (OB_TYPE_MOVE_BLOCK (op, pos->move_block))
749 { 749 {
750 int retry = 0; 750 int retry = 0;
751 751
752 /* if the object doesn't reflect, stop the arrow from moving 752 /* if the object doesn't reflect, stop the arrow from moving
753 * note that this code will now catch cases where a monster is 753 * note that this code will now catch cases where a monster is
766 if (op->direction & 1) 766 if (op->direction & 1)
767 { 767 {
768 op->direction = absdir (op->direction + 4); 768 op->direction = absdir (op->direction + 4);
769 retry = 1; 769 retry = 1;
770 } 770 }
771
771 /* There were two blocks with identical code - 772 /* There were two blocks with identical code -
772 * use this retry here to make this one block 773 * use this retry here to make this one block
773 * that did the same thing. 774 * that did the same thing.
774 */ 775 */
775 while (retry < 2) 776 while (retry < 2)
776 { 777 {
777 int left, right, mflags;
778 maptile *m1;
779 sint16 x1, y1;
780
781 retry++; 778 retry++;
782 779
783 /* Need to check for P_OUT_OF_MAP: if the arrow is tavelling 780 /* Need to check for P_OUT_OF_MAP: if the arrow is travelling
784 * over a corner in a tiled map, it is possible that 781 * over a corner in a tiled map, it is possible that
785 * op->direction is within an adjacent map but either 782 * op->direction is within an adjacent map but either
786 * op->direction-1 or op->direction+1 does not exist. 783 * op->direction-1 or op->direction+1 does not exist.
787 */ 784 */
788 mflags = get_map_flags (op->map, &m1, op->x + freearr_x[absdir (op->direction - 1)], 785 mapxy pos1 (pos); pos1.move (absdir (op->direction - 1));
789 op->y + freearr_y[absdir (op->direction - 1)], &x1, &y1); 786 bool left = pos1.normalise () && OB_TYPE_MOVE_BLOCK (op, pos1->move_block);
790 left = (mflags & P_OUT_OF_MAP) ? 0 : OB_TYPE_MOVE_BLOCK (op, (GET_MAP_MOVE_BLOCK (m1, x1, y1)));
791 787
792 mflags = get_map_flags (op->map, &m1, op->x + freearr_x[absdir (op->direction + 1)], 788 mapxy pos2 (pos); pos2.move (absdir (op->direction + 1));
793 op->y + freearr_y[absdir (op->direction + 1)], &x1, &y1); 789 bool right = pos2.normalise () && OB_TYPE_MOVE_BLOCK (op, pos2->move_block);
794 right = (mflags & P_OUT_OF_MAP) ? 0 : OB_TYPE_MOVE_BLOCK (op, (GET_MAP_MOVE_BLOCK (m1, x1, y1)));
795 790
796 if (left == right) 791 if (left == right)
797 op->direction = absdir (op->direction + 4); 792 op->direction = absdir (op->direction + 4);
798 else if (left) 793 else if (left)
799 op->direction = absdir (op->direction + 2); 794 op->direction = absdir (op->direction + 2);
800 else if (right) 795 else if (right)
801 op->direction = absdir (op->direction - 2); 796 op->direction = absdir (op->direction - 2);
802 797
803 mflags = get_map_flags (op->map, &m1, op->x + DIRX (op), op->y + DIRY (op), &x1, &y1);
804
805 /* If this space is not out of the map and not blocked, valid space - 798 /* If this space is not out of the map and not blocked, valid space -
806 * don't need to retry again. 799 * don't need to retry again.
807 */ 800 */
808 if (!(mflags & P_OUT_OF_MAP) && !OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m1, x1, y1))) 801 mapxy pos3 (pos); pos3.move (op->direction);
802 if (pos3.normalise () && !OB_TYPE_MOVE_BLOCK (op, pos3->move_block))
809 break; 803 break;
810
811 } 804 }
805
812 /* Couldn't find a direction to move the arrow to - just 806 /* Couldn't find a direction to move the arrow to - just
813 * top it from moving. 807 * stop it from moving.
814 */ 808 */
815 if (retry == 2) 809 if (retry == 2)
816 { 810 {
817 stop_arrow (op); 811 stop_arrow (op);
818 return; 812 return;
819 } 813 }
814
820 /* update object image for new facing */ 815 /* update object image for new facing */
821 /* many thrown objects *don't* have more than one face */ 816 /* many thrown objects *don't* have more than one face */
822 if (GET_ANIM_ID (op)) 817 if (GET_ANIM_ID (op))
823 SET_ANIMATION (op, op->direction); 818 SET_ANIMATION (op, op->direction);
824 } /* object is reflected */ 819 } /* object is reflected */
825 } /* object ran into a wall */ 820 } /* object ran into a wall */
826 821
827 /* Move the arrow. */
828 op->remove ();
829 op->x = new_x;
830 op->y = new_y;
831
832 /* decrease the speed as it flies. 0.05 means a standard bow will shoot 822 /* decrease the speed as it flies. 0.05 means a standard bow will shoot
833 * about 17 squares. Tune as needed. 823 * about 17 squares. Tune as needed.
834 */ 824 */
835 op->speed -= 0.05; 825 op->speed -= 0.05;
836 insert_ob_in_map (op, m, op, 0);
837}
838 826
839/* This routine doesnt seem to work for "inanimate" objects that 827 /* Move the arrow. */
840 * are being carried, ie a held torch leaps from your hands!. 828 op->move_to (pos);
841 * Modified this routine to allow held objects. b.t. */ 829}
842 830
843void 831void
844change_object (object *op) 832change_object (object *op)
845{ /* Doesn`t handle linked objs yet */ 833{ /* Doesn`t handle linked objs yet */
846 int i, j; 834 int i, j;
847 835
848 if (op->other_arch == NULL) 836 if (!op->other_arch)
849 { 837 {
850 LOG (llevError, "Change object (%s) without other_arch error.\n", &op->name); 838 LOG (llevError, "Change object (%s) without other_arch error.\n", op->debug_desc ());
851 return; 839 return;
852 } 840 }
853 841
854 /* In non-living items only change when food value is 0 */ 842 /* In non-living items only change when food value is 0 */
855 if (!QUERY_FLAG (op, FLAG_ALIVE)) 843 if (!QUERY_FLAG (op, FLAG_ALIVE))
856 { 844 {
857 if (op->stats.food-- > 0) 845 if (op->stats.food-- > 0)
858 return; 846 return;
859 else 847
860 op->stats.food = 1; /* so 1 other_arch is made */ 848 op->stats.food = 1; /* so 1 other_arch is made */
861 } 849 }
862 850
863 object *pl = op->in_player ();
864 object *env = op->env; 851 object *env = op->env;
865 852
866 op->remove (); 853 op->remove ();
867 for (i = 0; i < NROFNEWOBJS (op); i++) 854 for (i = 0; i < op->stats.food; i++)
868 { 855 {
869 object *tmp = arch_to_object (op->other_arch); 856 object *tmp = arch_to_object (op->other_arch);
870 857
871 if (op->type == LAMP) 858 if (op->type == LAMP)
872 tmp->stats.food = op->stats.food - 1; 859 tmp->stats.food = op->stats.food - 1;
873 860
874 tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */ 861 tmp->stats.hp = op->stats.hp; /* The only variable it keeps. */
875 if (env) 862 if (env)
876 { 863 {
877 tmp->x = env->x, tmp->y = env->y;
878 tmp = insert_ob_in_ob (tmp, env); 864 tmp = env->insert (tmp);
879 865
880 /* If this object is the players inventory, we need to tell the 866 /* If this object is the players inventory, we need to tell the
881 * client of the change. Insert_ob_in_map takes care of the 867 * client of the change. Insert_ob_in_map takes care of the
882 * updating the client, so we don't need to do that below. 868 * updating the client, so we don't need to do that below.
883 */ 869 */
884 if (pl) 870 if (object *pl = op->in_player ())
885 { 871 {
886 esrv_del_item (pl->contr, op->count); 872 esrv_del_item (pl->contr, op->count);
887 esrv_send_item (pl, tmp); 873 esrv_send_item (pl, tmp);
888 } 874 }
889 } 875 }
890 else 876 else
891 { 877 {
892 j = find_first_free_spot (tmp, op->map, op->x, op->y); 878 j = find_first_free_spot (tmp, op->map, op->x, op->y);
893 if (j == -1) /* No free spot */ 879 if (j < 0) /* No free spot */
894 tmp->destroy (); 880 tmp->destroy ();
895 else 881 else
896 { 882 {
897 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; 883 mapxy pos (op); pos.move (j);
898 insert_ob_in_map (tmp, op->map, op, 0); 884
885 if (pos.normalise ())
886 pos.insert (tmp, op);
899 } 887 }
900 } 888 }
901 } 889 }
902 890
903 op->destroy (); 891 op->destroy ();
919 move_teleporter (op->more); 907 move_teleporter (op->more);
920 908
921 if (op->head) 909 if (op->head)
922 head = op->head; 910 head = op->head;
923 911
924 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 912 for (tmp = op->above; tmp; tmp = tmp->above)
925 if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 913 if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR))
926 break; 914 break;
927 915
928 /* If nothing above us to move, nothing to do */ 916 /* If nothing above us to move, nothing to do */
929 if (!tmp || QUERY_FLAG (tmp, FLAG_WIZPASS)) 917 if (!tmp || QUERY_FLAG (tmp, FLAG_WIZPASS))
962 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) 950 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp)))
963 return; 951 return;
964 teleport (head, TELEPORTER, tmp); 952 teleport (head, TELEPORTER, tmp);
965 } 953 }
966} 954}
967
968 955
969/* This object will teleport someone to a different map 956/* This object will teleport someone to a different map
970 and will also apply changes to the player from its inventory. 957 and will also apply changes to the player from its inventory.
971 This was invented for giving classes, but there's no reason it 958 This was invented for giving classes, but there's no reason it
972 can't be generalized. 959 can't be generalized.
1025 return; /* dm has created a firewall in his inventory */ 1012 return; /* dm has created a firewall in his inventory */
1026 1013
1027 spell = op->inv; 1014 spell = op->inv;
1028 1015
1029 if (!spell || spell->type != SPELL) 1016 if (!spell || spell->type != SPELL)
1030 spell = &op->other_arch->clone; 1017 spell = op->other_arch;
1031 1018
1032 if (!spell) 1019 if (!spell)
1033 { 1020 {
1034 LOG (llevError, "move_firewall: no spell specified (%s, %s, %d, %d)\n", &op->name, &op->map->name, op->x, op->y); 1021 LOG (llevError, "move_firewall: no spell specified (%s, %s, %d, %d)\n", &op->name, &op->map->name, op->x, op->y);
1035 return; 1022 return;
1048 * it'll paralyze the victim for hp*his speed/op->speed 1035 * it'll paralyze the victim for hp*his speed/op->speed
1049 */ 1036 */
1050void 1037void
1051move_player_mover (object *op) 1038move_player_mover (object *op)
1052{ 1039{
1053 object *victim, *nextmover;
1054 int dir = op->stats.sp; 1040 int dir = op->stats.sp;
1055 sint16 nx, ny; 1041 sint16 nx, ny;
1056 maptile *m; 1042 maptile *m;
1057 1043
1058 /* Determine direction now for random movers so we do the right thing */ 1044 /* Determine direction now for random movers so we do the right thing */
1059 if (!dir) 1045 if (!dir)
1060 dir = rndm (1, 8); 1046 dir = rndm (1, 8);
1061 1047
1062 for (victim = GET_MAP_OB (op->map, op->x, op->y); victim != NULL; victim = victim->above) 1048 for (object *victim = op->ms ().bot; victim; victim = victim->above)
1063 { 1049 {
1064 if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) && 1050 if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) &&
1065 (victim->move_type & op->move_type || !victim->move_type)) 1051 (victim->move_type & op->move_type || !victim->move_type))
1066 { 1052 {
1067 1053
1084 } 1070 }
1085 1071
1086 if (should_director_abort (op, victim)) 1072 if (should_director_abort (op, victim))
1087 return; 1073 return;
1088 1074
1089 for (nextmover = GET_MAP_OB (m, nx, ny); nextmover != NULL; nextmover = nextmover->above) 1075 for (object *nextmover = m->at (nx, ny).bot; nextmover; nextmover = nextmover->above)
1090 { 1076 {
1091 if (nextmover->type == PLAYERMOVER) 1077 if (nextmover->type == PLAYERMOVER)
1092 nextmover->speed_left = -.99; 1078 nextmover->speed_left = -.99f;
1079
1093 if (QUERY_FLAG (nextmover, FLAG_ALIVE)) 1080 if (QUERY_FLAG (nextmover, FLAG_ALIVE))
1094 {
1095 op->speed_left = -1.1; /* wait until the next thing gets out of the way */ 1081 op->speed_left = -1.1f; /* wait until the next thing gets out of the way */
1096 }
1097 } 1082 }
1098 1083
1099 if (victim->type == PLAYER) 1084 if (victim->type == PLAYER)
1100 { 1085 {
1101 /* only level >=1 movers move people */ 1086 /* only level >=1 movers move people */
1105 * is cleared, otherwise the player will get stuck in 1090 * is cleared, otherwise the player will get stuck in
1106 * place. This can happen if the player used a spell to 1091 * place. This can happen if the player used a spell to
1107 * get to this space. 1092 * get to this space.
1108 */ 1093 */
1109 victim->contr->fire_on = 0; 1094 victim->contr->fire_on = 0;
1110 victim->speed_left = -FABS (victim->speed); 1095 victim->speed_left = 1.f;
1111 move_player (victim, dir); 1096 move_player (victim, dir);
1112 } 1097 }
1113 else 1098 else
1114 return; 1099 return;
1115 } 1100 }
1119 if (!op->stats.maxsp && op->attacktype) 1104 if (!op->stats.maxsp && op->attacktype)
1120 op->stats.maxsp = 2; 1105 op->stats.maxsp = 2;
1121 1106
1122 if (op->attacktype) 1107 if (op->attacktype)
1123 { /* flag to paralyze the player */ 1108 { /* flag to paralyze the player */
1124
1125 victim->speed_left = -FABS (op->stats.maxsp * victim->speed / op->speed); 1109 victim->speed_left = max (-5.f, -FABS (op->stats.maxsp * victim->speed / op->speed));
1126 /* Not sure why, but for some chars on metalforge, they
1127 * would sometimes get -inf speed_left, and from the
1128 * description, it could only happen here, so just put
1129 * a lower sanity limit. My only guess is that the
1130 * mover has 0 speed.
1131 */
1132 if (victim->speed_left < -5.0)
1133 victim->speed_left = -5.0;
1134 } 1110 }
1135 } 1111 }
1136 } 1112 }
1137} 1113}
1138 1114
1157 if (op->above == NULL) 1133 if (op->above == NULL)
1158 return; 1134 return;
1159 1135
1160 for (tmp = op->above; tmp; tmp = tmp->above) 1136 for (tmp = op->above; tmp; tmp = tmp->above)
1161 { 1137 {
1162 if (op->other_arch->name == tmp->arch->name) 1138 if (op->other_arch->archname == tmp->arch->archname)
1163 { 1139 {
1164 if (op->level <= 0) 1140 if (op->level <= 0)
1165 tmp->destroy (); 1141 tmp->destroy ();
1166 else 1142 else
1167 { 1143 {
1189 * has to make sure that there is in fact space for the object. 1165 * has to make sure that there is in fact space for the object.
1190 * It should really do this for small objects also, but there is 1166 * It should really do this for small objects also, but there is
1191 * more concern with large objects, most notably a part being placed 1167 * more concern with large objects, most notably a part being placed
1192 * outside of the map which would cause the server to crash 1168 * outside of the map which would cause the server to crash
1193*/ 1169*/
1194
1195void 1170void
1196move_creator (object *creator) 1171move_creator (object *creator)
1197{ 1172{
1198 object *new_ob; 1173 object *new_ob;
1199 1174
1234 new_ob = object_create_arch (creator->other_arch); 1209 new_ob = object_create_arch (creator->other_arch);
1235 fix_generated_item (new_ob, creator, 0, 0, GT_MINIMAL); 1210 fix_generated_item (new_ob, creator, 0, 0, GT_MINIMAL);
1236 } 1211 }
1237 1212
1238 /* Make sure this multipart object fits */ 1213 /* Make sure this multipart object fits */
1239 if (new_ob->arch->more && ob_blocked (new_ob, creator->map, creator->x, creator->y)) 1214 if (new_ob->arch->more && new_ob->blocked (creator->map, creator->x, creator->y))
1240 { 1215 {
1241 new_ob->destroy (); 1216 new_ob->destroy ();
1242 return; 1217 return;
1243 } 1218 }
1219
1220 // for now lets try to identify everything generated here, it mostly
1221 // happens automated, so this will at least fix many identify-experience holes
1222 SET_FLAG (new_ob, FLAG_IDENTIFIED);
1244 1223
1245 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y); 1224 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y);
1246 if (QUERY_FLAG (new_ob, FLAG_FREED)) 1225 if (QUERY_FLAG (new_ob, FLAG_FREED))
1247 return; 1226 return;
1248 1227
1263void 1242void
1264move_marker (object *op) 1243move_marker (object *op)
1265{ 1244{
1266 if (object *tmp = op->ms ().player ()) 1245 if (object *tmp = op->ms ().player ())
1267 { 1246 {
1268 object *tmp2;
1269
1270 /* remove an old force with a slaying field == op->name */ 1247 /* remove an old force with a slaying field == op->name */
1271 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 1248 if (object *force = tmp->force_find (op->name))
1272 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->name) 1249 force->destroy ();
1250
1251 if (!tmp->force_find (op->slaying))
1273 { 1252 {
1274 tmp2->destroy (); 1253 tmp->force_add (op->slaying, op->stats.food);
1275 break;
1276 }
1277 1254
1278 /* cycle through his inventory to look for the MARK we want to
1279 * place
1280 */
1281 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1282 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying)
1283 break;
1284
1285 /* if we didn't find our own MARK */
1286 if (!tmp2)
1287 {
1288 object *force = get_archetype (FORCE_NAME);
1289
1290 if (op->stats.food)
1291 {
1292 force->set_speed (0.01);
1293 force->speed_left = -op->stats.food;
1294 }
1295 else
1296 force->set_speed (0);
1297
1298 /* put in the lock code */
1299 force->slaying = op->slaying;
1300
1301 if (op->lore)
1302 force->lore = op->lore;
1303
1304 insert_ob_in_ob (force, tmp);
1305 if (op->msg) 1255 if (op->msg)
1306 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); 1256 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg);
1307 1257
1308 if (op->stats.hp > 0) 1258 if (op->stats.hp > 0)
1309 { 1259 {
1310 op->stats.hp--; 1260 op->stats.hp--;
1261
1311 if (op->stats.hp == 0) 1262 if (op->stats.hp == 0)
1312 { 1263 {
1313 /* marker expires--granted mark number limit */ 1264 /* marker expires--granted mark number limit */
1314 op->destroy (); 1265 op->destroy ();
1315 return; 1266 return;
1317 } 1268 }
1318 } 1269 }
1319 } 1270 }
1320} 1271}
1321 1272
1322int 1273void
1323process_object (object *op) 1274process_object (object *op)
1324{ 1275{
1325 if (QUERY_FLAG (op, FLAG_IS_A_TEMPLATE)) 1276 if (expect_false (QUERY_FLAG (op, FLAG_IS_A_TEMPLATE)))
1326 return 0; 1277 return;
1327 1278
1328 if (INVOKE_OBJECT (TICK, op)) 1279 if (expect_false (INVOKE_OBJECT (TICK, op)))
1329 return 0; 1280 return;
1330 1281
1331 if (QUERY_FLAG (op, FLAG_MONSTER)) 1282 if (QUERY_FLAG (op, FLAG_MONSTER))
1332 if (move_monster (op) || QUERY_FLAG (op, FLAG_FREED)) 1283 if (move_monster (op) || QUERY_FLAG (op, FLAG_FREED))
1333 return 1; 1284 return;
1334 1285
1335 if (QUERY_FLAG (op, FLAG_ANIMATE) && op->anim_speed == 0) 1286 if (QUERY_FLAG (op, FLAG_ANIMATE) && op->anim_speed == 0)
1336 { 1287 {
1337 if (op->type == PLAYER)
1338 animate_object (op, op->facing);
1339 else
1340 animate_object (op, op->direction); 1288 animate_object (op, op->contr ? op->facing : op->direction);
1341 1289
1342 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1290 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1343 make_sure_seen (op); 1291 make_sure_seen (op);
1344 } 1292 }
1345 1293
1294 if (expect_false (
1295 op->flag [FLAG_GENERATOR]
1296 || op->flag [FLAG_CHANGING]
1297 || op->flag [FLAG_IS_USED_UP]
1298 ))
1299 {
1346 if (QUERY_FLAG (op, FLAG_CHANGING) && !op->state) 1300 if (QUERY_FLAG (op, FLAG_CHANGING) && !op->state)
1347 { 1301 {
1348 change_object (op); 1302 change_object (op);
1349 return 1; 1303 return;
1350 } 1304 }
1351 1305
1352 if (QUERY_FLAG (op, FLAG_GENERATOR) && !QUERY_FLAG (op, FLAG_FRIENDLY)) 1306 if (QUERY_FLAG (op, FLAG_GENERATOR) && !QUERY_FLAG (op, FLAG_FRIENDLY))
1353 generate_monster (op); 1307 generate_monster (op);
1354 1308
1355 if (QUERY_FLAG (op, FLAG_IS_USED_UP) && --op->stats.food <= 0) 1309 if (QUERY_FLAG (op, FLAG_IS_USED_UP) && --op->stats.food <= 0)
1356 { 1310 {
1357 if (QUERY_FLAG (op, FLAG_APPLIED)) 1311 if (QUERY_FLAG (op, FLAG_APPLIED))
1358 remove_force (op); 1312 remove_force (op);
1359 else 1313 else
1360 { 1314 {
1361 /* IF necessary, delete the item from the players inventory */ 1315 /* If necessary, delete the item from the players inventory */
1362 object *pl = op->in_player (); 1316 if (object *pl = op->in_player ())
1363
1364 if (pl)
1365 esrv_del_item (pl->contr, op->count); 1317 esrv_del_item (pl->contr, op->count);
1366 1318
1367 op->remove (); 1319 op->remove ();
1368 1320
1369 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1321 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1370 make_sure_not_seen (op); 1322 make_sure_not_seen (op);
1371 1323
1372 op->destroy (); 1324 op->destroy ();
1373 } 1325 }
1374 1326
1375 return 1; 1327 return;
1328 }
1376 } 1329 }
1377 1330
1378 switch (op->type) 1331 switch (op->type)
1379 { 1332 {
1380 case SPELL_EFFECT: 1333 case SPELL_EFFECT:
1381 move_spell_effect (op); 1334 move_spell_effect (op);
1382 return 1; 1335 break;
1383 1336
1384 case ROD: 1337 case ROD:
1385 case HORN: 1338 case HORN:
1386 regenerate_rod (op); 1339 regenerate_rod (op);
1387 return 1; 1340 break;
1388 1341
1389 case FORCE: 1342 case FORCE:
1390 case POTION_EFFECT: 1343 case POTION_EFFECT:
1391 remove_force (op); 1344 remove_force (op);
1392 return 1; 1345 break;
1393 1346
1394 case BLINDNESS: 1347 case BLINDNESS:
1395 remove_blindness (op); 1348 remove_blindness (op);
1396 return 0; 1349 break;
1397 1350
1398 case POISONING: 1351 case POISONING:
1399 poison_more (op); 1352 poison_more (op);
1400 return 0; 1353 break;
1401 1354
1402 case DISEASE: 1355 case DISEASE:
1403 move_disease (op); 1356 move_disease (op);
1404 return 0; 1357 break;
1405 1358
1406 case SYMPTOM: 1359 case SYMPTOM:
1407 move_symptom (op); 1360 move_symptom (op);
1408 return 0; 1361 break;
1409 1362
1410 case THROWN_OBJ: 1363 case THROWN_OBJ:
1411 case ARROW: 1364 case ARROW:
1412 move_arrow (op); 1365 move_arrow (op);
1413 return 0; 1366 break;
1414 1367
1415 case DOOR: 1368 case DOOR:
1416 remove_door (op); 1369 remove_door (op);
1417 return 0; 1370 break;
1418 1371
1419 case LOCKED_DOOR: 1372 case LOCKED_DOOR:
1420 remove_door2 (op); 1373 remove_door2 (op);
1421 return 0; 1374 break;
1422 1375
1423 case TELEPORTER: 1376 case TELEPORTER:
1424 move_teleporter (op); 1377 move_teleporter (op);
1425 return 0; 1378 break;
1426 1379
1427 case GOLEM: 1380 case GOLEM:
1428 move_golem (op); 1381 move_golem (op);
1429 return 0; 1382 break;
1430 1383
1431 case EARTHWALL: 1384 case EARTHWALL:
1432 hit_player (op, 2, op, AT_PHYSICAL, 1); 1385 hit_player (op, 2, op, AT_PHYSICAL, 1);
1433 return 0; 1386 break;
1434 1387
1435 case FIREWALL: 1388 case FIREWALL:
1436 move_firewall (op); 1389 move_firewall (op);
1437 if (op->stats.maxsp) 1390 if (op->stats.maxsp)
1438 animate_turning (op); 1391 animate_turning (op);
1439 return 0; 1392 break;
1440 1393
1441 case MOOD_FLOOR: 1394 case MOOD_FLOOR:
1442 do_mood_floor (op); 1395 do_mood_floor (op);
1443 return 0; 1396 break;
1444 1397
1445 case GATE: 1398 case GATE:
1446 move_gate (op); 1399 move_gate (op);
1447 return 0; 1400 break;
1448 1401
1449 case TIMED_GATE: 1402 case TIMED_GATE:
1450 move_timed_gate (op); 1403 move_timed_gate (op);
1451 return 0; 1404 break;
1452 1405
1453 case TRIGGER: 1406 case TRIGGER:
1454 case TRIGGER_BUTTON: 1407 case TRIGGER_BUTTON:
1455 case TRIGGER_PEDESTAL: 1408 case TRIGGER_PEDESTAL:
1456 case TRIGGER_ALTAR: 1409 case TRIGGER_ALTAR:
1457 animate_trigger (op); 1410 animate_trigger (op);
1458 return 0; 1411 break;
1459 1412
1460 case DETECTOR: 1413 case DETECTOR:
1461 move_detector (op); 1414 move_detector (op);
1462 1415
1463 case DIRECTOR: 1416 case DIRECTOR:
1464 if (op->stats.maxsp) 1417 if (op->stats.maxsp)
1465 animate_turning (op); 1418 animate_turning (op);
1466 return 0; 1419 break;
1467 1420
1468 case HOLE: 1421 case HOLE:
1469 move_hole (op); 1422 move_hole (op);
1470 return 0; 1423 break;
1471 1424
1472 case DEEP_SWAMP: 1425 case DEEP_SWAMP:
1473 move_deep_swamp (op); 1426 move_deep_swamp (op);
1474 return 0; 1427 break;
1475 1428
1476 case RUNE: 1429 case RUNE:
1477 case TRAP: 1430 case TRAP:
1478 move_rune (op); 1431 move_rune (op);
1479 return 0; 1432 break;
1480 1433
1481 case PLAYERMOVER: 1434 case PLAYERMOVER:
1482 move_player_mover (op); 1435 move_player_mover (op);
1483 return 0; 1436 break;
1484 1437
1485 case CREATOR: 1438 case CREATOR:
1486 move_creator (op); 1439 move_creator (op);
1487 return 0; 1440 break;
1488 1441
1489 case MARKER: 1442 case MARKER:
1490 move_marker (op); 1443 move_marker (op);
1491 return 0; 1444 break;
1492 1445
1493 case PLAYER_CHANGER: 1446 case PLAYER_CHANGER:
1494 move_player_changer (op); 1447 move_player_changer (op);
1495 return 0; 1448 break;
1496 1449
1497 case PEACEMAKER: 1450 case PEACEMAKER:
1498 move_peacemaker (op); 1451 move_peacemaker (op);
1499 return 0; 1452 break;
1500 }
1501 1453
1502 return 0; 1454 case PLAYER:
1455 // players have their own speed-management, so undo the --speed_left
1456 ++op->speed_left;
1457 break;
1458 }
1503} 1459}
1460

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines