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.35 by root, Tue Jan 9 01:28:32 2007 UTC vs.
Revision 1.42 by root, Sat Mar 17 20:36:05 2007 UTC

245 return; 245 return;
246 } 246 }
247 247
248 if (op->stats.food == 1) 248 if (op->stats.food == 1)
249 { 249 {
250 /* need to remove the object before fix_player is called, else fix_player 250 /* need to unapply the object before update_stats is called, else fix_player
251 * will not do anything. 251 * will not do anything.
252 */ 252 */
253 if (op->env->type == PLAYER) 253 if (op->env->type == PLAYER)
254 { 254 {
255 CLEAR_FLAG (op, FLAG_APPLIED); 255 CLEAR_FLAG (op, FLAG_APPLIED);
455 455
456 if (op->stats.hp) 456 if (op->stats.hp)
457 { 457 {
458 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 458 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
459 { 459 {
460 if (op->slaying && !strcmp (op->slaying, tmp->name)) 460 if (op->slaying && op->slaying == tmp->name)
461 detected = 1; 461 detected = 1;
462
462 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) 463 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying)
463 detected = 1; 464 detected = 1;
464 } 465 }
465 } 466 }
467
466 if (op->slaying && !strcmp (op->slaying, tmp->name)) 468 if (op->slaying && op->slaying == tmp->name)
467 {
468 detected = 1; 469 detected = 1;
469 }
470 else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying) 470 else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying)
471 detected = 1; 471 detected = 1;
472 } 472 }
473 473
474 /* the detector sets the button if detection is found */ 474 /* the detector sets the button if detection is found */
604void 604void
605fix_stopped_item (object *op, maptile *map, object *originator) 605fix_stopped_item (object *op, maptile *map, object *originator)
606{ 606{
607 if (map == NULL) 607 if (map == NULL)
608 return; 608 return;
609
609 if (QUERY_FLAG (op, FLAG_REMOVED)) 610 if (QUERY_FLAG (op, FLAG_REMOVED))
610 insert_ob_in_map (op, map, originator, 0); 611 insert_ob_in_map (op, map, originator, 0);
611 else if (op->type == ARROW) 612 else if (op->type == ARROW)
612 merge_ob (op, NULL); /* only some arrows actually need this */ 613 merge_ob (op, NULL); /* only some arrows actually need this */
613} 614}
614
615 615
616object * 616object *
617fix_stopped_arrow (object *op) 617fix_stopped_arrow (object *op)
618{ 618{
619 if (rndm (0, 99) < op->stats.food) 619 if (rndm (0, 99) < op->stats.food)
648 op->stats.hp = 0; 648 op->stats.hp = 0;
649 op->stats.grace = 0; 649 op->stats.grace = 0;
650 op->level = 0; 650 op->level = 0;
651 op->face = op->arch->clone.face; 651 op->face = op->arch->clone.face;
652 op->owner = NULL; /* So that stopped arrows will be saved */ 652 op->owner = NULL; /* So that stopped arrows will be saved */
653 update_object (op, UP_OBJ_FACE); 653 update_object (op, UP_OBJ_CHANGE);
654 return op; 654 return op;
655} 655}
656 656
657/* stop_arrow() - what to do when a non-living flying object 657/* stop_arrow() - what to do when a non-living flying object
658 * has to stop. Sept 96 - I added in thrown object code in 658 * has to stop. Sept 96 - I added in thrown object code in
684 } 684 }
685} 685}
686 686
687/* Move an arrow along its course. op is the arrow or thrown object. 687/* Move an arrow along its course. op is the arrow or thrown object.
688 */ 688 */
689
690void 689void
691move_arrow (object *op) 690move_arrow (object *op)
692{ 691{
693 object *tmp; 692 object *tmp;
694 sint16 new_x, new_y; 693 sint16 new_x, new_y;
765 * as below. (Note that for living creatures there is a small 764 * as below. (Note that for living creatures there is a small
766 * chance that reflect_missile fails.) 765 * chance that reflect_missile fails.)
767 */ 766 */
768 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10)) 767 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10))
769 { 768 {
770 int number = op->face->number; 769 int number = op->face;
771 770
772 op->direction = absdir (op->direction + 4); 771 op->direction = absdir (op->direction + 4);
773 op->state = 0; 772 update_turn_face (op);
774
775 if (GET_ANIM_ID (op))
776 {
777 number += 4;
778
779 if (number > GET_ANIMATION (op, 8))
780 number -= 8;
781
782 op->face = &new_faces[number];
783 }
784
785 was_reflected = 1; /* skip normal movement calculations */ 773 was_reflected = 1; /* skip normal movement calculations */
786 } 774 }
787 else 775 else
788 { 776 {
789 /* Attack the object. */ 777 /* Attack the object. */
1204 return; 1192 return;
1205 } 1193 }
1206 1194
1207 if (op->above == NULL) 1195 if (op->above == NULL)
1208 return; 1196 return;
1197
1209 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 1198 for (tmp = op->above; tmp; tmp = tmp->above)
1210 { 1199 {
1211 if (strcmp (op->other_arch->name, tmp->arch->name) == 0) 1200 if (op->other_arch->name == tmp->arch->name)
1212 { 1201 {
1213 if (op->level <= 0) 1202 if (op->level <= 0)
1214 tmp->destroy (); 1203 tmp->destroy ();
1215 else 1204 else
1216 { 1205 {
1307 with a specific code as the slaying field. 1296 with a specific code as the slaying field.
1308 At that time, it writes the contents of its own message 1297 At that time, it writes the contents of its own message
1309 field to the player. The marker will decrement hp to 1298 field to the player. The marker will decrement hp to
1310 0 and then delete itself every time it grants a mark. 1299 0 and then delete itself every time it grants a mark.
1311 unless hp was zero to start with, in which case it is infinite.*/ 1300 unless hp was zero to start with, in which case it is infinite.*/
1312
1313void 1301void
1314move_marker (object *op) 1302move_marker (object *op)
1315{ 1303{
1316 if (object *tmp = op->ms ().player ()) 1304 if (object *tmp = op->ms ().player ())
1317 { 1305 {
1318 object *tmp2; 1306 object *tmp2;
1319 1307
1320 /* remove an old force with a slaying field == op->name */ 1308 /* remove an old force with a slaying field == op->name */
1321 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 1309 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1322 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) 1310 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->name)
1323 { 1311 {
1324 tmp2->destroy (); 1312 tmp2->destroy ();
1325 break; 1313 break;
1326 } 1314 }
1327 1315
1328 /* cycle through his inventory to look for the MARK we want to 1316 /* cycle through his inventory to look for the MARK we want to
1329 * place 1317 * place
1330 */ 1318 */
1331 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) 1319 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1332 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) 1320 if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying)
1333 break; 1321 break;
1334 1322
1335 /* if we didn't find our own MARK */ 1323 /* if we didn't find our own MARK */
1336 if (tmp2 == NULL) 1324 if (!tmp2)
1337 { 1325 {
1338 object *force = get_archetype (FORCE_NAME); 1326 object *force = get_archetype (FORCE_NAME);
1339 1327
1340 if (op->stats.food) 1328 if (op->stats.food)
1341 { 1329 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines