Lines Matching refs:otmp

87 	struct obj *otmp;
89 otmp = mkobj(let, artif);
90 place_object(otmp, x, y);
91 return(otmp);
99 struct obj *otmp;
101 otmp = mksobj(otyp, init, artif);
102 place_object(otmp, x, y);
103 return(otmp);
142 register struct obj *otmp;
161 if (!(otmp = mksobj(CORPSE, TRUE, TRUE))) continue;
165 otmp->age = 0L;
166 if (otmp->timed) {
167 (void) stop_timer(ROT_CORPSE, (genericptr_t)otmp);
168 (void) stop_timer(REVIVE_MON, (genericptr_t)otmp);
176 if (!(otmp = mkobj(iprobs->iclass, TRUE))) continue;
179 if (otmp->oclass == COIN_CLASS) {
181 otmp->quan = (long)(rnd(level_difficulty()+2) * rnd(75));
182 otmp->owt = weight(otmp);
183 } else while (otmp->otyp == ROCK) {
184 otmp->otyp = rnd_class(DILITHIUM_CRYSTAL, LOADSTONE);
185 if (otmp->quan > 2L) otmp->quan = 1L;
186 otmp->owt = weight(otmp);
189 if (Is_mbag(otmp)) {
190 otmp->otyp = SACK;
191 otmp->spe = 0;
192 otmp->owt = weight(otmp);
193 } else while (otmp->otyp == WAN_CANCELLATION)
194 otmp->otyp = rnd_class(WAN_LIGHT, WAN_LIGHTNING);
197 (void) add_to_container(box, otmp);
231 struct obj *otmp;
235 otmp = newobj(obj->oxlth + obj->onamelth);
236 *otmp = *obj; /* copies whole structure */
237 otmp->o_id = flags.ident++;
238 if (!otmp->o_id) otmp->o_id = flags.ident++; /* ident overflowed */
239 otmp->timed = 0; /* not timed, yet */
240 otmp->lamplit = 0; /* ditto */
241 otmp->owornmask = 0L; /* new object isn't worn */
244 otmp->quan = num;
245 otmp->owt = weight(otmp); /* -= obj->owt ? */
246 obj->nobj = otmp;
250 obj->nexthere = otmp;
252 (void)memcpy((genericptr_t)otmp->oextra, (genericptr_t)obj->oextra,
255 (void)strncpy(ONAME(otmp), ONAME(obj), (int)obj->onamelth);
256 if (obj->unpaid) splitbill(obj,otmp);
257 if (obj->timed) obj_split_timers(obj, otmp);
258 if (obj_sheds_light(obj)) obj_split_light_source(obj, otmp);
259 return otmp;
263 * Insert otmp right after obj in whatever chain(s) it is on. Then extract
272 replace_object(obj, otmp)
274 struct obj *otmp;
276 otmp->where = obj->where;
282 otmp->nobj = obj->nobj;
283 obj->nobj = otmp;
287 otmp->nobj = obj->nobj;
288 otmp->ocontainer = obj->ocontainer;
289 obj->nobj = otmp;
293 otmp->nobj = obj->nobj;
294 otmp->ocarry = obj->ocarry;
295 obj->nobj = otmp;
299 otmp->nobj = obj->nobj;
300 otmp->nexthere = obj->nexthere;
301 otmp->ox = obj->ox;
302 otmp->oy = obj->oy;
303 obj->nobj = otmp;
304 obj->nexthere = otmp;
322 * The caller is responsible for checking otmp->unpaid and
323 * costly_spot(u.ux, u.uy). This function will make otmp no charge.
329 bill_dummy_object(otmp)
330 register struct obj *otmp;
334 if (otmp->unpaid)
335 subfrombill(otmp, shop_keeper(*u.ushops));
336 dummy = newobj(otmp->oxlth + otmp->onamelth);
337 *dummy = *otmp;
342 if (otmp->oxlth)
344 (genericptr_t)otmp->oextra, otmp->oxlth);
345 if (otmp->onamelth)
346 (void)strncpy(ONAME(dummy), ONAME(otmp), (int)otmp->onamelth);
349 otmp->no_charge = 1;
350 otmp->unpaid = 0;
369 struct obj *otmp;
372 otmp = newobj(0);
373 *otmp = zeroobj;
374 otmp->age = monstermoves;
375 otmp->o_id = flags.ident++;
376 if (!otmp->o_id) otmp->o_id = flags.ident++; /* ident overflowed */
377 otmp->quan = 1L;
378 otmp->oclass = let;
379 otmp->otyp = otyp;
380 otmp->where = OBJ_FREE;
381 otmp->dknown = index(dknowns, let) ? 0 : 1;
382 if ((otmp->otyp >= ELVEN_SHIELD && otmp->otyp <= ORCISH_SHIELD) ||
383 otmp->otyp == SHIELD_OF_REFLECTION)
384 otmp->dknown = 0;
385 if (!objects[otmp->otyp].oc_uses_known)
386 otmp->known = 1;
388 otmp->oinvis = !rn2(1250);
392 otmp->quan = is_multigen(otmp) ? (long) rn1(6,6) : 1L;
394 otmp->spe = rne(3);
395 otmp->blessed = rn2(2);
397 curse(otmp);
398 otmp->spe = -rne(3);
399 } else blessorcurse(otmp, 10);
400 if (is_poisonable(otmp) && !rn2(100))
401 otmp->opoisoned = 1;
404 otmp = mk_artifact(otmp, (aligntyp)A_NONE);
407 otmp->oeaten = 0;
408 switch(otmp->otyp) {
412 do otmp->corpsenm = undead_to_corpse(rndmonnum());
413 while ((mvitals[otmp->corpsenm].mvflags & G_NOCORPSE) && (--tryct > 0));
417 otmp->corpsenm = PM_HUMAN;
422 otmp->corpsenm = NON_PM; /* generic egg */
426 otmp->corpsenm = mndx; /* typed egg */
427 attach_egg_hatch_timeout(otmp);
433 otmp->corpsenm = NON_PM; /* empty (so far) */
435 otmp->spe = 1; /* spinach */
440 otmp->corpsenm = mndx;
444 blessorcurse(otmp, 10);
447 otmp->spe = current_fruit;
450 otmp->quan = (long) rnd(2);
453 if (otmp->otyp == CORPSE || otmp->otyp == MEAT_RING ||
454 otmp->otyp == KELP_FROND) break;
458 if (otmp->otyp == LOADSTONE) curse(otmp);
459 else if (otmp->otyp == ROCK) otmp->quan = (long) rn1(6,6);
460 else if (otmp->otyp != LUCKSTONE && !rn2(6)) otmp->quan = 2L;
461 else otmp->quan = 1L;
464 switch(otmp->otyp) {
466 case WAX_CANDLE: otmp->spe = 1;
467 otmp->age = 20L * /* 400 or 200 */
468 (long)objects[otmp->otyp].oc_cost;
469 otmp->lamplit = 0;
470 otmp->quan = 1L +
472 blessorcurse(otmp, 5);
475 case OIL_LAMP: otmp->spe = 1;
476 otmp->age = (long) rn1(500,1000);
477 otmp->lamplit = 0;
478 blessorcurse(otmp, 5);
480 case MAGIC_LAMP: otmp->spe = 1;
481 otmp->lamplit = 0;
482 blessorcurse(otmp, 2);
485 case LARGE_BOX: otmp->olocked = !!(rn2(5));
486 otmp->otrapped = !(rn2(10));
490 case BAG_OF_HOLDING: mkbox_cnts(otmp);
496 case MAGIC_MARKER: otmp->spe = rn1(70,30);
498 case CAN_OF_GREASE: otmp->spe = rnd(25);
499 blessorcurse(otmp, 10);
501 case CRYSTAL_BALL: otmp->spe = rnd(5);
502 blessorcurse(otmp, 2);
505 case BAG_OF_TRICKS: otmp->spe = rnd(20);
509 otmp->corpsenm = rndmonnum();
510 while(is_human(&mons[otmp->corpsenm])
512 blessorcurse(otmp, 4);
515 case BELL_OF_OPENING: otmp->spe = 3;
522 otmp->spe = rn1(5,4);
527 if (otmp->otyp == AMULET_OF_YENDOR) flags.made_amulet = TRUE;
528 if(rn2(10) && (otmp->otyp == AMULET_OF_STRANGULATION ||
529 otmp->otyp == AMULET_OF_CHANGE ||
530 otmp->otyp == AMULET_OF_RESTFUL_SLEEP)) {
531 curse(otmp);
532 } else blessorcurse(otmp, 10);
538 if (otmp->otyp == POT_OIL)
539 otmp->age = MAX_OIL_IN_FLASK; /* amount of oil */
543 if (otmp->otyp != SCR_MAIL)
545 blessorcurse(otmp, 4);
548 blessorcurse(otmp, 17);
551 if(rn2(10) && (otmp->otyp == FUMBLE_BOOTS ||
552 otmp->otyp == LEVITATION_BOOTS ||
553 otmp->otyp == HELM_OF_OPPOSITE_ALIGNMENT ||
554 otmp->otyp == GAUNTLETS_OF_FUMBLING ||
556 curse(otmp);
557 otmp->spe = -rne(3);
559 otmp->blessed = rn2(2);
560 otmp->spe = rne(3);
561 } else blessorcurse(otmp, 10);
563 otmp = mk_artifact(otmp, (aligntyp)A_NONE);
565 if (Role_if(PM_SAMURAI) && otmp->otyp == SPLINT_MAIL &&
569 otmp->oerodeproof = 1;
570 otmp->rknown = 1;
572 otmp->oerodeproof = otmp->rknown = 1;
577 if(otmp->otyp == WAN_WISHING) otmp->spe = rnd(3); else
578 otmp->spe = rn1(5,
579 (objects[otmp->otyp].oc_dir == NODIR) ? 11 : 4);
580 blessorcurse(otmp, 17);
581 otmp->recharged = 0; /* used to control recharging */
584 if(objects[otmp->otyp].oc_charged) {
585 blessorcurse(otmp, 3);
587 if(rn2(10) && bcsign(otmp))
588 otmp->spe = bcsign(otmp) * rne(3);
589 else otmp->spe = rn2(2) ? rne(3) : -rne(3);
592 if (otmp->spe == 0) otmp->spe = rn2(4) - rn2(3);
594 if (otmp->spe < 0 && rn2(5)) curse(otmp);
595 } else if(rn2(10) && (otmp->otyp == RIN_TELEPORTATION ||
596 otmp->otyp == RIN_POLYMORPH ||
597 otmp->otyp == RIN_AGGRAVATE_MONSTER ||
598 otmp->otyp == RIN_HUNGER || !rn2(9))) {
599 curse(otmp);
603 switch (otmp->otyp) {
606 otmp->corpsenm = rndmonnum();
607 if (!verysmall(&mons[otmp->corpsenm]) &&
609 (void) add_to_container(otmp,
616 impossible("impossible mkobj %d, sym '%c'.", otmp->otyp,
617 objects[otmp->otyp].oc_class);
622 switch (otmp->otyp) {
624 start_corpse_timeout(otmp);
629 if (objects[otyp].oc_unique && !otmp->oartifact)
630 otmp = mk_artifact(otmp, (aligntyp)A_NONE);
631 otmp->owt = weight(otmp);
632 return(otmp);
688 bless(otmp)
689 register struct obj *otmp;
692 if (otmp->oclass == COIN_CLASS) return;
694 otmp->cursed = 0;
695 otmp->blessed = 1;
696 if (carried(otmp) && confers_luck(otmp))
698 else if (otmp->otyp == BAG_OF_HOLDING)
699 otmp->owt = weight(otmp);
700 else if (otmp->otyp == FIGURINE && otmp->timed)
701 (void) stop_timer(FIG_TRANSFORM, (genericptr_t) otmp);
706 unbless(otmp)
707 register struct obj *otmp;
709 otmp->blessed = 0;
710 if (carried(otmp) && confers_luck(otmp))
712 else if (otmp->otyp == BAG_OF_HOLDING)
713 otmp->owt = weight(otmp);
717 curse(otmp)
718 register struct obj *otmp;
721 if (otmp->oclass == COIN_CLASS) return;
723 otmp->blessed = 0;
724 otmp->cursed = 1;
726 if (otmp == uwep && bimanual(uwep)) reset_remarm();
729 if (otmp == uswapwep && u.twoweap)
732 if (carried(otmp) && confers_luck(otmp))
734 else if (otmp->otyp == BAG_OF_HOLDING)
735 otmp->owt = weight(otmp);
736 else if (otmp->otyp == FIGURINE) {
737 if (otmp->corpsenm != NON_PM
738 && !dead_species(otmp->corpsenm,TRUE)
739 && (carried(otmp) || mcarried(otmp)))
740 attach_fig_transform_timeout(otmp);
746 uncurse(otmp)
747 register struct obj *otmp;
749 otmp->cursed = 0;
750 if (carried(otmp) && confers_luck(otmp))
752 else if (otmp->otyp == BAG_OF_HOLDING)
753 otmp->owt = weight(otmp);
754 else if (otmp->otyp == FIGURINE && otmp->timed)
755 (void) stop_timer(FIG_TRANSFORM, (genericptr_t) otmp);
763 blessorcurse(otmp, chance)
764 register struct obj *otmp;
767 if(otmp->blessed || otmp->cursed) return;
771 curse(otmp);
773 bless(otmp);
783 bcsign(otmp)
784 register struct obj *otmp;
786 return(!!otmp->blessed - !!otmp->cursed);
914 register struct obj *otmp;
919 otmp = mksobj(objtype, init, FALSE);
920 if (otmp) rloco(otmp);
922 otmp = mksobj_at(objtype, x, y, init, FALSE);
923 if (otmp) {
928 /* save_mtraits frees original data pointed to by otmp */
929 otmp2 = save_mtraits(otmp, mtmp);
930 if (otmp2) otmp = otmp2;
935 int old_corpsenm = otmp->corpsenm;
937 otmp->corpsenm = monsndx(ptr);
938 otmp->owt = weight(otmp);
939 if (otmp->otyp == CORPSE &&
941 special_corpse(otmp->corpsenm))) {
942 obj_stop_timers(otmp);
943 start_corpse_timeout(otmp);
947 return(otmp);
959 struct obj *otmp;
966 otmp = realloc_obj(obj, lth, (genericptr_t) &mid, namelth, ONAME(obj));
968 otmp = obj;
969 otmp->oxlth = sizeof(mid);
970 (void) memcpy((genericptr_t)otmp->oextra, (genericptr_t)&mid,
973 if (otmp && otmp->oxlth) otmp->oattached = OATTACHED_M_ID; /* mark it */
974 return otmp;
982 struct obj *otmp;
987 otmp = realloc_obj(obj, lth, (genericptr_t) mtmp, namelth, ONAME(obj));
988 if (otmp && otmp->oxlth) {
989 struct monst *mtmp2 = (struct monst *)otmp->oextra;
997 otmp->oattached = OATTACHED_MONST; /* mark it */
999 return otmp;
1039 register struct obj *otmp, *otmp2;
1044 if ((otmp = mksobj_at(objtype, x, y, initialize_it, FALSE)) != 0) {
1046 if ((otmp2 = tt_oname(otmp)) != 0) otmp = otmp2;
1048 return(otmp);
1059 struct obj *otmp;
1061 otmp = mkcorpstat(objtype, (struct monst *)0, ptr,
1064 otmp = oname(otmp, nm);
1065 return(otmp);
1069 is_flammable(otmp)
1070 register struct obj *otmp;
1072 int otyp = otmp->otyp;
1082 is_rottable(otmp)
1083 register struct obj *otmp;
1085 int otyp = otmp->otyp;
1101 place_object(otmp, x, y)
1102 register struct obj *otmp;
1107 if (otmp->where != OBJ_FREE)
1110 obj_no_longer_held(otmp);
1111 if (otmp->otyp == BOULDER) block_point(x,y); /* vision */
1115 otmp->nexthere = otmp2->nexthere;
1116 otmp2->nexthere = otmp;
1118 otmp->nexthere = otmp2;
1119 level.objects[x][y] = otmp;
1123 otmp->ox = x;
1124 otmp->oy = y;
1126 otmp->where = OBJ_FLOOR;
1129 otmp->nobj = fobj;
1130 fobj = otmp;
1131 if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
1145 struct obj *otmp;
1147 for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) {
1148 if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
1151 for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj) {
1152 if (otmp->ox == x && otmp->oy == y) {
1153 if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
1167 peek_at_iced_corpse_age(otmp)
1168 struct obj *otmp;
1170 long age, retval = otmp->age;
1172 if (otmp->otyp == CORPSE && ON_ICE(otmp)) {
1174 age = monstermoves - otmp->age;
1175 retval = otmp->age + (age / ROT_ICE_ADJUSTMENT);
1177 pline_The("%s age has ice modifications:otmp->age = %ld, returning %ld.",
1178 s_suffix(doname(otmp)),otmp->age, retval);
1187 obj_timer_checks(otmp, x, y, force)
1188 struct obj *otmp;
1195 boolean on_floor = (otmp->where == OBJ_FLOOR);
1196 boolean buried = (otmp->where == OBJ_BURIED);
1199 if (otmp->otyp == CORPSE && (on_floor || buried) && is_ice(x,y)) {
1200 tleft = stop_timer(action, (genericptr_t)otmp);
1203 tleft = stop_timer(action, (genericptr_t)otmp);
1210 ON_ICE(otmp) = 1;
1212 pline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y);
1218 age = monstermoves - otmp->age;
1219 otmp->age = monstermoves - (age * ROT_ICE_ADJUSTMENT);
1224 (otmp->otyp == CORPSE && ON_ICE(otmp) &&
1226 tleft = stop_timer(action, (genericptr_t)otmp);
1229 tleft = stop_timer(action, (genericptr_t)otmp);
1235 ON_ICE(otmp) = 0;
1237 pline("%s is no longer on ice at %d,%d.", The(xname(otmp)),x,y);
1243 age = monstermoves - otmp->age;
1244 otmp->age = otmp->age + (age / ROT_ICE_ADJUSTMENT);
1249 (void) start_timer(tleft, TIMER_OBJECT, action, (genericptr_t)otmp);
1256 remove_object(otmp)
1257 register struct obj *otmp;
1259 xchar x = otmp->ox;
1260 xchar y = otmp->oy;
1262 if (otmp->where != OBJ_FLOOR)
1264 if (otmp->otyp == BOULDER) unblock_point(x,y); /* vision */
1265 extract_nexthere(otmp, &level.objects[x][y]);
1266 extract_nobj(otmp, &fobj);
1267 if (otmp->timed) obj_timer_checks(otmp,x,y,0);
1275 struct obj *otmp;
1277 while ((otmp = mtmp->minvent) != 0) {
1278 obj_extract_self(otmp);
1279 obfree(otmp, (struct obj *)0); /* dealloc_obj() isn't sufficient */
1393 struct obj *otmp;
1399 for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
1400 if (merged(&otmp, &obj))
1418 struct obj *otmp;
1426 for (otmp = container->cobj; otmp; otmp = otmp->nobj)
1427 if (merged(&otmp, &obj)) return (otmp);