Source:NetHack 3.3.0/worn.c

Below is the full text to worn.c from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/worn.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)worn.c	3.3	1999/07/17	*/ 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    #include "hack.h"  6. 7.   STATIC_DCL void FDECL(m_lose_armor, (struct monst *,struct obj *)); 8.   STATIC_DCL void FDECL(m_dowear_type, (struct monst *,long,BOOLEAN_P)); 9.    10.   const struct worn { 11.  	long w_mask; 12.  	struct obj **w_obj; 13.  } worn[] = { 14.  	{ W_ARM, &uarm }, 15.  	{ W_ARMC, &uarmc }, 16.  	{ W_ARMH, &uarmh }, 17.  	{ W_ARMS, &uarms }, 18.  	{ W_ARMG, &uarmg }, 19.  	{ W_ARMF, &uarmf }, 20.  #ifdef TOURIST 21.  	{ W_ARMU, &uarmu }, 22.  #endif 23.  	{ W_RINGL, &uleft }, 24.  	{ W_RINGR, &uright }, 25.  	{ W_WEP, &uwep }, 26.  	{ W_SWAPWEP, &uswapwep }, 27.  	{ W_QUIVER, &uquiver }, 28.  	{ W_AMUL, &uamul }, 29.  	{ W_TOOL, &ublindf }, 30.  	{ W_BALL, &uball }, 31.  	{ W_CHAIN, &uchain }, 32.  	{ 0, 0 }  33.   };  34.    35.   /* This only allows for one blocking item per property */ 36.  #define w_blocks(o,m) \ 37.  		((o->otyp == MUMMY_WRAPPING && ((m) & W_ARMC)) ? INVIS : \  38.   		 (o->otyp == CORNUTHAUM && ((m) & W_ARMH) && \ 39.  			!Role_if(PM_WIZARD)) ? CLAIRVOYANT : 0) 40.  		/* note: monsters don't have clairvoyance, so your role 41.  		   has no significant effect on their use of w_blocks */ 42.   43.    44.   /* Updated to use the extrinsic and blocked fields. */ 45.   void 46.  setworn(obj, mask) 47.  register struct obj *obj; 48.  long mask; 49.  {  50.   	register const struct worn *wp; 51.  	register struct obj *oobj; 52.  	register int p;  53. 54.  	if ((mask & (W_ARM|I_SPECIAL)) == (W_ARM|I_SPECIAL)) { 55.  	    /* restoring saved game; no properties are conferred via skin */ 56.  	    uskin = obj; 57.  	 /* assert( !uarm ); */ 58.  	} else { 59.  	    for(wp = worn; wp->w_mask; wp++) if(wp->w_mask & mask) { 60.  		oobj = *(wp->w_obj); 61.  		if(oobj && !(oobj->owornmask & wp->w_mask)) 62.  			impossible("Setworn: mask = %ld.", wp->w_mask); 63.  		if(oobj) { 64.  		    oobj->owornmask &= ~wp->w_mask; 65.  		    if (wp->w_mask & ~(W_SWAPWEP|W_QUIVER)) { 66.  			/* leave as "x = x  y", here and below, for broken 67.  			 * compilers */ 68.  			p = objects[oobj->otyp].oc_oprop; 69.  			u.uprops[p].extrinsic = 70.  					u.uprops[p].extrinsic & ~wp->w_mask; 71.  			if ((p = w_blocks(oobj,mask)) != 0) 72.  			    u.uprops[p].blocked &= ~wp->w_mask; 73.  			if (oobj->oartifact) 74.  			    set_artifact_intrinsic(oobj, 0, mask); 75.  		    }  76.   		}  77.   		*(wp->w_obj) = obj; 78.  		if(obj) { 79.  		    obj->owornmask |= wp->w_mask; 80.  		    /* Prevent getting/blocking intrinsics from wielding 81.  		     * potions, through the quiver, etc. 82.  		     * Allow weapon-tools, too. 83.  		     * wp_mask should be same as mask at this point. 84.  		     */  85.   		    if (wp->w_mask & ~(W_SWAPWEP|W_QUIVER)) { 86.  			if (obj->oclass == WEAPON_CLASS || is_weptool(obj) ||  87.   					    mask != W_WEP) { 88.  			    p = objects[obj->otyp].oc_oprop; 89.  			    u.uprops[p].extrinsic = 90.  					u.uprops[p].extrinsic | wp->w_mask; 91.  			    if ((p = w_blocks(obj, mask)) != 0) 92.  				u.uprops[p].blocked |= wp->w_mask; 93.  			}  94.   			if (obj->oartifact) 95.  			    set_artifact_intrinsic(obj, 1, mask); 96.  		    }  97.   		}  98.   	    }  99.   	}  100.  	update_inventory; 101. }  102.   103.  /* called e.g. when obj is destroyed */ 104. /* Updated to use the extrinsic and blocked fields. */ 105.  void 106. setnotworn(obj) 107. register struct obj *obj; 108. {  109.  	register const struct worn *wp; 110. 	register int p;  111. 112. 	if (!obj) return; 113. 	for(wp = worn; wp->w_mask; wp++) 114. 		if(obj == *(wp->w_obj)) { 115. 			*(wp->w_obj) = 0; 116. 			p = objects[obj->otyp].oc_oprop; 117. 			u.uprops[p].extrinsic = u.uprops[p].extrinsic & ~wp->w_mask; 118. 			obj->owornmask &= ~wp->w_mask; 119. 			if (obj->oartifact) 120. 			    set_artifact_intrinsic(obj, 0, wp->w_mask); 121. 			if ((p = w_blocks(obj,wp->w_mask)) != 0) 122. 			    u.uprops[p].blocked &= ~wp->w_mask; 123. 		}  124.  	update_inventory; 125. }  126.   127.  void 128. mon_set_minvis(mon) 129. struct monst *mon; 130. {  131.  	mon->perminvis = 1; 132. 	if (!mon->invis_blkd) { 133. 	    mon->minvis = 1; 134. 	    newsym(mon->mx, mon->my);		/* make it disappear */ 135. 	    if (mon->wormno) see_wsegs(mon);	/* and any tail too */ 136. 	}  137.  }  138.   139.  void 140. mon_adjust_speed(mon, adjust) 141. struct monst *mon; 142. int adjust;	/* positive => increase speed, negative => decrease */ 143. {  144.      struct obj *otmp; 145.  146.      switch (adjust) { 147.      case  2: 148. 	mon->permspeed = MFAST; 149. 	break; 150.      case  1: 151. 	if (mon->permspeed == MSLOW) mon->permspeed = 0; 152. 	else mon->permspeed = MFAST; 153. 	break; 154.      case  0:			/* just check for worn speed boots */ 155. 	break; 156.      case -1: 157. 	if (mon->permspeed == MFAST) mon->permspeed = 0; 158. 	else mon->permspeed = MSLOW; 159. 	break; 160.      case -2: 161. 	mon->permspeed = MSLOW; 162. 	break; 163.     }  164.   165.      for (otmp = mon->minvent; otmp; otmp = otmp->nobj) 166. 	if (otmp->owornmask && objects[otmp->otyp].oc_oprop == FAST) 167. 	    break; 168.     if (otmp)		/* speed boots */ 169. 	mon->mspeed = MFAST; 170.     else 171. 	mon->mspeed = mon->permspeed; 172. }  173.   174.  /* armor put on or taken off; might be magical variety */ 175. void 176. update_mon_intrinsics(mon, obj, on) 177. struct monst *mon; 178. struct obj *obj; 179. boolean on; 180. {  181.      int unseen; 182.     uchar mask; 183.     struct obj *otmp; 184.     int which = (int) objects[obj->otyp].oc_oprop; 185.  186.      if (!which) return; 187.  188.      unseen = !canseemon(mon); 189.     if (on) { 190. 	switch (which) { 191. 	 case INVIS: 192. 	    mon->minvis = !mon->invis_blkd; 193. 	    break; 194. 	 case FAST: 195. 	    mon_adjust_speed(mon, 0); 196. 	    break; 197. 	/* properties handled elsewhere */ 198. 	 case ANTIMAGIC: 199. 	 case REFLECTING: 200. 	    break; 201. 	/* properties which have no effect for monsters */ 202. 	 case CLAIRVOYANT: 203. 	 case STEALTH: 204. 	 case TELEPAT: 205. 	    break; 206. 	/* properties which should have an effect but aren't implemented */ 207. 	 case LEVITATION: 208. 	 case WWALKING: 209. 	    break; 210. 	/* properties which maybe should have an effect but don't */ 211. 	 case DISPLACED: 212. 	 case FUMBLING: 213. 	 case JUMPING: 214. 	 case PROTECTION: 215. 	    break; 216. 	 default: 217. 	    if (which <= 8) {	/* 1 thru 8 correspond to MR_xxx mask values */ 218. 		/* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */ 219. 		mask = (uchar) (1 << (which - 1)); 220. 		mon->mintrinsics |= (unsigned short) mask; 221. 	    }  222.  	    break; 223. 	}  224.      } else {	    /* off */ 225. 	switch (which) { 226. 	 case INVIS: 227. 	    mon->minvis = mon->perminvis; 228. 	    break; 229. 	 case FAST: 230. 	    mon_adjust_speed(mon, 0); 231. 	    break; 232. 	 case FIRE_RES: 233. 	 case COLD_RES: 234. 	 case SLEEP_RES: 235. 	 case DISINT_RES: 236. 	 case SHOCK_RES: 237. 	 case POISON_RES: 238. 	 case ACID_RES: 239. 	 case STONE_RES: 240. 	    mask = (uchar) (1 << (which - 1)); 241. 	    /* If the monster doesn't have this resistance intrinsically, 242. 	       check whether any other worn item confers it. Note that 243. 	       we don't currently check for anything conferred via simply 244. 	       carrying an object. */ 245.  	    if (!(mon->data->mresists & mask)) { 246. 		for (otmp = mon->minvent; otmp; otmp = otmp->nobj) 247. 		    if (otmp->owornmask &&  248.  			    (int) objects[otmp->otyp].oc_oprop == which) 249. 			break; 250. 		if (!otmp) 251. 		    mon->mintrinsics &= ~((unsigned short) mask); 252. 	    }  253.  	    break; 254. 	 default: 255. 	    break; 256. 	}  257.      }  258.      /* obj->owornmask has been cleared by this point, so we can't use it. 259.        However, since monsters don't wield armor, we don't have to guard 260.        against that and can get away with a blanket worn-mask value. */ 261.      switch (w_blocks(obj,~0L)) { 262.      case INVIS: 263. 	mon->invis_blkd = on ? 1 : 0; 264.  	mon->minvis = on ? 0 : mon->perminvis; 265. 	break; 266.      default: 267. 	break; 268.     }  269.   270.      /* if couldn't see it but now can, or vice versa, update display */ 271.     if (unseen ^ !canseemon(mon)) 272. 	newsym(mon->mx, mon->my); 273. }  274.   275.  int 276. find_mac(mon) 277. register struct monst *mon; 278. {  279.  	register struct obj *obj; 280. 	int base = mon->data->ac; 281. 	long mwflags = mon->misc_worn_check; 282.  283.  	for (obj = mon->minvent; obj; obj = obj->nobj) { 284. 	    if (obj->owornmask & mwflags) 285. 		base -= ARM_BONUS(obj); 286. 		/* since ARM_BONUS is positive, subtracting it increases AC */ 287. 	}  288.  	return base; 289. }  290.   291.  /* weapons are handled separately; rings and eyewear aren't used by monsters */ 292.  293.  /* Wear the best object of each type that the monster has. During creation, 294.  * the monster can put everything on at once; otherwise, wearing takes time. 295.  * This doesn't affect monster searching for objects--a monster may very well 296.  * search for objects it would not want to wear, because we don't want to  297. * check which_armor each round. 298.  *  299.   * We'll let monsters put on shirts and/or suits under worn cloaks, but 300.  * not shirts under worn suits. This is somewhat arbitrary, but it's 301. * too tedious to have them remove and later replace outer garments, 302.  * and preventing suits under cloaks makes it a little bit too easy for 303.  * players to influence what gets worn. Putting on a shirt underneath 304.  * already worn body armor is too obviously buggy...  305. */ 306.  void 307. m_dowear(mon, creation) 308. register struct monst *mon; 309. boolean creation; 310. {  311.  	/* Note the restrictions here are the same as in dowear in do_wear.c  312. * except for the additional restriction on intelligence. (Players 313.  	 * are always intelligent, even if polymorphed). 314. 	 */  315.  	if (verysmall(mon->data) || nohands(mon->data) || is_animal(mon->data)) 316. 		return; 317. 	/* give mummies a chance to wear their wrappings */ 318. 	if (mindless(mon->data) && (mon->data->mlet != S_MUMMY || !creation)) 319. 		return; 320.  321.  	m_dowear_type(mon, W_AMUL, creation); 322. #ifdef TOURIST 323. 	/* can't put on shirt if already wearing suit */ 324. 	if (!cantweararm(mon->data) || (mon->misc_worn_check & W_ARM)) 325. 	    m_dowear_type(mon, W_ARMU, creation); 326. #endif 327. 	/* treating small as a special case allows 328. 	   hobbits, gnomes, and kobolds to wear cloaks */ 329. 	if (!cantweararm(mon->data) || mon->data->msize == MZ_SMALL) 330. 	    m_dowear_type(mon, W_ARMC, creation); 331. 	m_dowear_type(mon, W_ARMH, creation); 332. 	if (!MON_WEP(mon) || !bimanual(MON_WEP(mon))) 333. 	    m_dowear_type(mon, W_ARMS, creation); 334. 	m_dowear_type(mon, W_ARMG, creation); 335. 	if (!slithy(mon->data) && mon->data->mlet != S_CENTAUR) 336. 	    m_dowear_type(mon, W_ARMF, creation); 337. 	if (!cantweararm(mon->data)) 338. 	    m_dowear_type(mon, W_ARM, creation); 339. }  340.   341.  STATIC_OVL void 342. m_dowear_type(mon, flag, creation) 343. struct monst *mon; 344. long flag; 345. boolean creation; 346. {  347.  	struct obj *old, *best, *obj; 348. 	int m_delay = 0; 349.  350.  	if (mon->mfrozen) return; /* probably putting previous item on */ 351.  352.  	old = which_armor(mon, flag); 353. 	if (old && old->cursed) return; 354. 	if (old && flag == W_AMUL) return; /* no such thing as better amulets */ 355. 	best = old; 356.  357.  	for(obj = mon->minvent; obj; obj = obj->nobj) { 358. 	    switch(flag) { 359. 		case W_AMUL: 360. 		    if (obj->oclass != AMULET_CLASS ||  361.  			    (obj->otyp != AMULET_OF_LIFE_SAVING && 362. 				obj->otyp != AMULET_OF_REFLECTION)) 363. 			continue; 364. 		    best = obj; 365. 		    goto outer_break; /* no such thing as better amulets */ 366. #ifdef TOURIST 367. 		case W_ARMU: 368. 		    if (!is_shirt(obj)) continue; 369. 		    break; 370. #endif 371. 		case W_ARMC: 372. 		    if (!is_cloak(obj)) continue; 373. 		    break; 374. 		case W_ARMH: 375. 		    if (!is_helmet(obj)) continue; 376. 		    break; 377. 		case W_ARMS: 378. 		    if (!is_shield(obj)) continue; 379. 		    break; 380. 		case W_ARMG: 381. 		    if (!is_gloves(obj)) continue; 382. 		    break; 383. 		case W_ARMF: 384. 		    if (!is_boots(obj)) continue; 385. 		    break; 386. 		case W_ARM: 387. 		    if (!is_suit(obj)) continue; 388. 		    break; 389. 	    }  390.  	    if (obj->owornmask) continue; 391. 	    /* I'd like to define a VISIBLE_ARM_BONUS which doesn't assume the 392. 	     * monster knows obj->spe, but if I did that, a monster would keep 393. 	     * switching forever between two -2 caps since when it took off one 394. 	     * it would forget spe and once again think the object is better 395. 	     * than what it already has. 396. 	     */  397.  	    if (best && (ARM_BONUS(best) >= ARM_BONUS(obj))) continue; 398. 	    best = obj; 399. 	}  400.  outer_break: 401. 	if (!best || best == old) return; 402.  403.  	/* if wearing a cloak, account for the time spent removing 404. 	   and re-wearing it when putting on a suit or shirt */ 405. 	if ((flag == W_ARM 406. #ifdef TOURIST 407. 	  || flag == W_ARMU 408. #endif 409. 			  ) && (mon->misc_worn_check & W_ARMC)) 410. 	    m_delay += 2; 411. 	/* when upgrading a piece of armor, account for time spent 412. 	   taking off current one */ 413. 	if (old) 414. 	    m_delay += objects[old->otyp].oc_delay; 415.  416.  	if (old) /* do this first to avoid "(being worn)" */ 417. 	    old->owornmask = 0L; 418. 	if (!creation && canseemon(mon)) { 419. 	    if (old) { 420. 		char buf[BUFSZ]; 421.  422.  		Sprintf(buf, "%s", distant_name(old, doname)); 423. 		pline("%s removes %s and puts on %s.",  424.  		    Monnam(mon), buf, distant_name(best, doname)); 425. 	    } else 426. 		pline("%s puts on %s.", Monnam(mon),distant_name(best,doname)); 427. 	    m_delay += objects[best->otyp].oc_delay; 428. 	    mon->mfrozen = m_delay; 429. 	    if (mon->mfrozen) mon->mcanmove = 0; 430. 	}  431.  	if (old) 432. 	    update_mon_intrinsics(mon, old, FALSE); 433. 	mon->misc_worn_check |= flag; 434. 	best->owornmask |= flag; 435. 	update_mon_intrinsics(mon, best, TRUE); 436. }  437.   438.  struct obj * 439. which_armor(mon, flag) 440. struct monst *mon; 441. long flag; 442. {  443.  	register struct obj *obj; 444.  445.  	for(obj = mon->minvent; obj; obj = obj->nobj) 446. 		if (obj->owornmask & flag) return obj; 447. 	return((struct obj *)0); 448. }  449.   450.  /* remove an item of armor and then drop it */ 451. STATIC_OVL void 452. m_lose_armor(mon, obj) 453. struct monst *mon; 454. struct obj *obj; 455. {  456.  	mon->misc_worn_check &= ~obj->owornmask; 457. 	obj->owornmask = 0L; 458. 	update_mon_intrinsics(mon, obj, FALSE); 459.  460.  	obj_extract_self(obj); 461. 	place_object(obj, mon->mx, mon->my); 462. 	/* call stackobj if we ever drop anything that can merge */ 463. 	newsym(mon->mx, mon->my); 464. }  465.   466.  void 467. mon_break_armor(mon) 468. struct monst *mon; 469. {  470.  	register struct obj *otmp; 471. 	struct permonst *mdat = mon->data; 472. 	boolean vis = cansee(mon->mx, mon->my); 473. 	const char *pronoun = him[pronoun_gender(mon)], 474. 			*ppronoun = his[pronoun_gender(mon)]; 475.  476.  	if (breakarm(mdat)) { 477. 	    if ((otmp = which_armor(mon, W_ARM)) != 0) { 478. 		if (vis) 479. 		    pline("%s breaks out of %s armor!", Monnam(mon), ppronoun); 480. 		else 481. 		    You_hear("a cracking sound."); 482. 		m_useup(mon, otmp); 483. 	    }  484.  	    if ((otmp = which_armor(mon, W_ARMC)) != 0) { 485. 		if (otmp->oartifact) { 486. 		    if (vis) 487. 			pline("%s cloak falls off!", s_suffix(Monnam(mon))); 488. 		    m_lose_armor(mon, otmp); 489. 		} else { 490. 		    if (vis) 491. 			pline("%s cloak tears apart!", s_suffix(Monnam(mon))); 492. 		    else 493. 			You_hear("a ripping sound."); 494. 		    m_useup(mon, otmp); 495. 		}  496.  	    }  497.  #ifdef TOURIST 498. 	    if ((otmp = which_armor(mon, W_ARMU)) != 0) { 499. 		if (vis) 500. 		    pline("%s shirt rips to shreds!", s_suffix(Monnam(mon))); 501. 		else 502. 		    You_hear("a ripping sound."); 503. 		m_useup(mon, otmp); 504. 	    }  505.  #endif 506. 	} else if (sliparm(mdat)) { 507. 	    if ((otmp = which_armor(mon, W_ARM)) != 0) { 508. 		if (vis) 509. 		    pline("%s armor falls around %s!",  510.  				 s_suffix(Monnam(mon)), pronoun); 511. 		else 512. 		    You_hear("a thud."); 513. 		m_lose_armor(mon, otmp); 514. 	    }  515.  	    if ((otmp = which_armor(mon, W_ARMC)) != 0) { 516. 		if (vis) 517. 		    if (is_whirly(mon->data)) 518. 			pline("%s cloak falls, unsupported!",  519.  				     s_suffix(Monnam(mon))); 520. 		    else 521. 			pline("%s shrinks out of %s cloak!", Monnam(mon),  522.  								ppronoun); 523. 		m_lose_armor(mon, otmp); 524. 	    }  525.  #ifdef TOURIST 526. 	    if ((otmp = which_armor(mon, W_ARMU)) != 0) { 527. 		if (vis) 528. 		    if (sliparm(mon->data)) 529. 			pline("%s seeps right through %s shirt!",  530.  					Monnam(mon), ppronoun); 531. 		    else 532. 			pline("%s becomes much too small for %s shirt!",  533.  					Monnam(mon), ppronoun); 534. 		m_lose_armor(mon, otmp); 535. 	    }  536.  #endif 537. 	}  538.  	if (nohands(mdat) || verysmall(mdat)) { 539. 	    if ((otmp = which_armor(mon, W_ARMG)) != 0) { 540. 		if (vis) 541. 		    pline("%s drops %s gloves%s!", Monnam(mon), ppronoun,  542.  					MON_WEP(mon) ? " and weapon" : ""); 543. 		possibly_unwield(mon); 544. 		m_lose_armor(mon, otmp); 545. 	    }  546.  	    if ((otmp = which_armor(mon, W_ARMS)) != 0) { 547. 		if (vis) 548. 		    pline("%s can no longer hold %s shield!", Monnam(mon),  549.  								ppronoun); 550. 		else 551. 		    You_hear("a clank."); 552. 		m_lose_armor(mon, otmp); 553. 	    }  554.  	    if ((otmp = which_armor(mon, W_ARMH)) != 0) { 555. 		if (vis) 556. 		    pline("%s helmet falls to the %s!",  557.  			  s_suffix(Monnam(mon)), surface(mon->mx, mon->my)); 558. 		else 559. 		    You_hear("a clank."); 560. 		m_lose_armor(mon, otmp); 561. 	    }  562.  	}  563.  	if (nohands(mdat) || verysmall(mdat) || slithy(mdat) ||  564.  	    mdat->mlet == S_CENTAUR) { 565. 	    if ((otmp = which_armor(mon, W_ARMF)) != 0) { 566. 		if (vis) { 567. 		    if (is_whirly(mon->data)) 568. 			pline("%s boots fall away!",  569.  				       s_suffix(Monnam(mon))); 570. 		    else pline("%s boots %s off %s feet!",  571.  			s_suffix(Monnam(mon)),  572.  			verysmall(mdat) ? "slide" : "are pushed", ppronoun); 573. 		}  574.  		m_lose_armor(mon, otmp); 575. 	    }  576.  	}  577.  #ifdef STEED 578. 	if (!can_saddle(mon)) { 579. 	    if ((otmp = which_armor(mon, W_SADDLE)) != 0) { 580. 		m_lose_armor(mon, otmp); 581. 		if (vis) 582. 		    pline("%s saddle falls off.", s_suffix(Monnam(mon))); 583. 	    }  584.  	    if (mon == u.usteed) 585. 		goto noride; 586. 	} else if (mon == u.usteed && !can_ride(mon)) { 587. 	noride: 588. 	    You("can no longer ride %s.", mon_nam(mon)); 589. 	    if (touch_petrifies(u.usteed->data) &&  590.  			!Stone_resistance && rnl(3)) { 591. 		char buf[BUFSZ]; 592.  593.  		You("touch %s.", mon_nam(u.usteed)); 594. 		Sprintf(buf, "falling off %s",  595.  				an(u.usteed->data->mname)); 596. 		instapetrify(buf); 597. 	    }  598.  	    dismount_steed(DISMOUNT_FELL); 599. 	}  600.  #endif 601. 	return; 602. }  603.   604.  /*worn.c*/