Source:NetHack 3.4.3/src/explode.c

From NetHackWiki
Jump to: navigation, search

Below is the full text to src/explode.c from NetHack 3.4.3. To link to a particular line, write [[explode.c#line123]], for example.

Top of file[edit]

  1. /*	SCCS Id: @(#)explode.c	3.4	2002/11/10	*/
  2. /*	Copyright (C) 1990 by Ken Arromdee */
  3. /* NetHack may be freely redistributed.  See license for details. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1. #include "hack.h"
  2.  
  3. #ifdef OVL0
  4.  
  5. /* Note: Arrays are column first, while the screen is row first */
  6. static int expl[3][3] = {
  7. 	{ S_explode1, S_explode4, S_explode7 },
  8. 	{ S_explode2, S_explode5, S_explode8 },
  9. 	{ S_explode3, S_explode6, S_explode9 }
  10. };

explode[edit]

  1. /* Note: I had to choose one of three possible kinds of "type" when writing
  2. * this function: a wand type (like in zap.c), an adtyp, or an object type.
  3. * Wand types get complex because they must be converted to adtyps for
  4. * determining such things as fire resistance.  Adtyps get complex in that
  5. * they don't supply enough information--was it a player or a monster that
  6. * did it, and with a wand, spell, or breath weapon?  Object types share both
  7. * these disadvantages....
  8. */
  9. void
  10. explode(x, y, type, dam, olet, expltype)
  11. int x, y;
  12. int type; /* the same as in zap.c */
  13. int dam;
  14. char olet;
  15. int expltype;
  16. {
  17. 	int i, j, k, damu = dam;
  18. 	boolean starting = 1;
  19. 	boolean visible, any_shield;
  20. 	int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */
  21. 	const char *str;
  22. 	int idamres, idamnonres;
  23. 	struct monst *mtmp;
  24. 	uchar adtyp;
  25. 	int explmask[3][3];
  26. 		/* 0=normal explosion, 1=do shieldeff, 2=do nothing */
  27. 	boolean shopdamage = FALSE;
  28. 	boolean generic = FALSE;
  29.  
  30. 	if (olet == WAND_CLASS)		/* retributive strike */
  31. 		switch (Role_switch) {
  32. 			case PM_PRIEST:
  33. 			case PM_MONK:
  34. 			case PM_WIZARD: damu /= 5;
  35. 				  break;
  36. 			case PM_HEALER:
  37. 			case PM_KNIGHT: damu /= 2;
  38. 				  break;
  39. 			default:  break;
  40. 		}
  41.  
  42. 	if (olet == MON_EXPLODE) {
  43. 	    str = killer;
  44. 	    killer = 0;		/* set again later as needed */
  45. 	    adtyp = AD_PHYS;
  46. 	} else
  47. 	switch (abs(type) % 10) {
  48. 		case 0: str = "magical blast";
  49. 			adtyp = AD_MAGM;
  50. 			break;
  51. 		case 1: str =   olet == BURNING_OIL ?	"burning oil" :
  52. 				olet == SCROLL_CLASS ?	"tower of flame" :
  53. 							"fireball";
  54. 			adtyp = AD_FIRE;
  55. 			break;
  56. 		case 2: str = "ball of cold";
  57. 			adtyp = AD_COLD;
  58. 			break;
  59. 		case 4: str =  (olet == WAND_CLASS) ? "death field" :
  60. 							"disintegration field";
  61. 			adtyp = AD_DISN;
  62. 			break;
  63. 		case 5: str = "ball of lightning";
  64. 			adtyp = AD_ELEC;
  65. 			break;
  66. 		case 6: str = "poison gas cloud";
  67. 			adtyp = AD_DRST;
  68. 			break;
  69. 		case 7: str = "splash of acid";
  70. 			adtyp = AD_ACID;
  71. 			break;
  72. 		default: impossible("explosion base type %d?", type); return;
  73. 	}
  74.  
  75. 	any_shield = visible = FALSE;
  76. 	for (i=0; i<3; i++) for (j=0; j<3; j++) {
  77. 		if (!isok(i+x-1, j+y-1)) {
  78. 			explmask[i][j] = 2;
  79. 			continue;
  80. 		} else
  81. 			explmask[i][j] = 0;
  82.  
  83. 		if (i+x-1 == u.ux && j+y-1 == u.uy) {
  84. 		    switch(adtyp) {
  85. 			case AD_PHYS:                        
  86. 				explmask[i][j] = 0;
  87. 				break;
  88. 			case AD_MAGM:
  89. 				explmask[i][j] = !!Antimagic;
  90. 				break;
  91. 			case AD_FIRE:
  92. 				explmask[i][j] = !!Fire_resistance;
  93. 				break;
  94. 			case AD_COLD:
  95. 				explmask[i][j] = !!Cold_resistance;
  96. 				break;
  97. 			case AD_DISN:
  98. 				explmask[i][j] = (olet == WAND_CLASS) ?
  99. 						!!(nonliving(youmonst.data) || is_demon(youmonst.data)) :
  100. 						!!Disint_resistance;
  101. 				break;
  102. 			case AD_ELEC:
  103. 				explmask[i][j] = !!Shock_resistance;
  104. 				break;
  105. 			case AD_DRST:
  106. 				explmask[i][j] = !!Poison_resistance;
  107. 				break;
  108. 			case AD_ACID:
  109. 				explmask[i][j] = !!Acid_resistance;
  110. 				break;
  111. 			default:
  112. 				impossible("explosion type %d?", adtyp);
  113. 				break;
  114. 		    }
  115. 		}
  116. 		/* can be both you and mtmp if you're swallowed */
  117. 		mtmp = m_at(i+x-1, j+y-1);
  118. #ifdef STEED
  119. 		if (!mtmp && i+x-1 == u.ux && j+y-1 == u.uy)
  120. 			mtmp = u.usteed;
  121. #endif
  122. 		if (mtmp) {
  123. 		    if (mtmp->mhp < 1) explmask[i][j] = 2;
  124. 		    else switch(adtyp) {
  125. 			case AD_PHYS:                        
  126. 				break;
  127. 			case AD_MAGM:
  128. 				explmask[i][j] |= resists_magm(mtmp);
  129. 				break;
  130. 			case AD_FIRE:
  131. 				explmask[i][j] |= resists_fire(mtmp);
  132. 				break;
  133. 			case AD_COLD:
  134. 				explmask[i][j] |= resists_cold(mtmp);
  135. 				break;
  136. 			case AD_DISN:
  137. 				explmask[i][j] |= (olet == WAND_CLASS) ?
  138. 					(nonliving(mtmp->data) || is_demon(mtmp->data)) :
  139. 					resists_disint(mtmp);
  140. 				break;
  141. 			case AD_ELEC:
  142. 				explmask[i][j] |= resists_elec(mtmp);
  143. 				break;
  144. 			case AD_DRST:
  145. 				explmask[i][j] |= resists_poison(mtmp);
  146. 				break;
  147. 			case AD_ACID:
  148. 				explmask[i][j] |= resists_acid(mtmp);
  149. 				break;
  150. 			default:
  151. 				impossible("explosion type %d?", adtyp);
  152. 				break;
  153. 		    }
  154. 		}
  155. 		if (mtmp && cansee(i+x-1,j+y-1) && !canspotmon(mtmp))
  156. 		    map_invisible(i+x-1, j+y-1);
  157. 		else if (!mtmp && glyph_is_invisible(levl[i+x-1][j+y-1].glyph)) {
  158. 		    unmap_object(i+x-1, j+y-1);
  159. 		    newsym(i+x-1, j+y-1);
  160. 		}
  161. 		if (cansee(i+x-1, j+y-1)) visible = TRUE;
  162. 		if (explmask[i][j] == 1) any_shield = TRUE;
  163. 	}
  164.  
  165. 	if (visible) {
  166. 		/* Start the explosion */
  167. 		for (i=0; i<3; i++) for (j=0; j<3; j++) {
  168. 			if (explmask[i][j] == 2) continue;
  169. 			tmp_at(starting ? DISP_BEAM : DISP_CHANGE,
  170. 				explosion_to_glyph(expltype,expl[i][j]));
  171. 			tmp_at(i+x-1, j+y-1);
  172. 			starting = 0;
  173. 		}
  174. 		curs_on_u();	/* will flush screen and output */
  175.  
  176. 		if (any_shield && flags.sparkle) { /* simulate shield effect */
  177. 		    for (k = 0; k < SHIELD_COUNT; k++) {
  178. 			for (i=0; i<3; i++) for (j=0; j<3; j++) {
  179. 			    if (explmask[i][j] == 1)
  180. 				/*
  181. 				 * Bypass tmp_at() and send the shield glyphs
  182. 				 * directly to the buffered screen.  tmp_at()
  183. 				 * will clean up the location for us later.
  184. 				 */
  185. 				show_glyph(i+x-1, j+y-1,
  186. 					cmap_to_glyph(shield_static[k]));
  187. 			}
  188. 			curs_on_u();	/* will flush screen and output */
  189. 			delay_output();
  190. 		    }
  191.  
  192. 		    /* Cover last shield glyph with blast symbol. */
  193. 		    for (i=0; i<3; i++) for (j=0; j<3; j++) {
  194. 			if (explmask[i][j] == 1)
  195. 			    show_glyph(i+x-1,j+y-1,
  196. 					explosion_to_glyph(expltype, expl[i][j]));
  197. 		    }
  198.  
  199. 		} else {		/* delay a little bit. */
  200. 		    delay_output();
  201. 		    delay_output();
  202. 		}
  203.  
  204. 		tmp_at(DISP_END, 0); /* clear the explosion */
  205. 	} else {
  206. 	    if (olet == MON_EXPLODE) {
  207. 		str = "explosion";
  208. 		generic = TRUE;
  209. 	    }
  210. 	    if (flags.soundok) You_hear("a blast.");
  211. 	}
  212.  
  213. if (dam)
  214. 	for (i=0; i<3; i++) for (j=0; j<3; j++) {
  215. 		if (explmask[i][j] == 2) continue;
  216. 		if (i+x-1 == u.ux && j+y-1 == u.uy)
  217. 			uhurt = (explmask[i][j] == 1) ? 1 : 2;
  218. 		idamres = idamnonres = 0;
  219. 		if (type >= 0)
  220. 		    (void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1),
  221. 		    		type, &shopdamage);
  222.  
  223. 		mtmp = m_at(i+x-1, j+y-1);
  224. #ifdef STEED
  225. 		if (!mtmp && i+x-1 == u.ux && j+y-1 == u.uy)
  226. 			mtmp = u.usteed;
  227. #endif
  228. 		if (!mtmp) continue;
  229. 		if (u.uswallow && mtmp == u.ustuck) {
  230. 			if (is_animal(u.ustuck->data))
  231. 				pline("%s gets %s!",
  232. 				      Monnam(u.ustuck),
  233. 				      (adtyp == AD_FIRE) ? "heartburn" :
  234. 				      (adtyp == AD_COLD) ? "chilly" :
  235. 				      (adtyp == AD_DISN) ? ((olet == WAND_CLASS) ?
  236. 				       "irradiated by pure energy" : "perforated") :
  237. 				      (adtyp == AD_ELEC) ? "shocked" :
  238. 				      (adtyp == AD_DRST) ? "poisoned" :
  239. 				      (adtyp == AD_ACID) ? "an upset stomach" :
  240. 				       "fried");
  241. 			else
  242. 				pline("%s gets slightly %s!",
  243. 				      Monnam(u.ustuck),
  244. 				      (adtyp == AD_FIRE) ? "toasted" :
  245. 				      (adtyp == AD_COLD) ? "chilly" :
  246. 				      (adtyp == AD_DISN) ? ((olet == WAND_CLASS) ?
  247. 				       "overwhelmed by pure energy" : "perforated") :
  248. 				      (adtyp == AD_ELEC) ? "shocked" :
  249. 				      (adtyp == AD_DRST) ? "intoxicated" :
  250. 				      (adtyp == AD_ACID) ? "burned" :
  251. 				       "fried");
  252. 		} else if (cansee(i+x-1, j+y-1)) {
  253. 		    if(mtmp->m_ap_type) seemimic(mtmp);
  254. 		    pline("%s is caught in the %s!", Monnam(mtmp), str);
  255. 		}
  256.  
  257. 		idamres += destroy_mitem(mtmp, SCROLL_CLASS, (int) adtyp);
  258. 		idamres += destroy_mitem(mtmp, SPBOOK_CLASS, (int) adtyp);
  259. 		idamnonres += destroy_mitem(mtmp, POTION_CLASS, (int) adtyp);
  260. 		idamnonres += destroy_mitem(mtmp, WAND_CLASS, (int) adtyp);
  261. 		idamnonres += destroy_mitem(mtmp, RING_CLASS, (int) adtyp);
  262.  
  263. 		if (explmask[i][j] == 1) {
  264. 			golemeffects(mtmp, (int) adtyp, dam + idamres);
  265. 			mtmp->mhp -= idamnonres;
  266. 		} else {
  267. 		/* call resist with 0 and do damage manually so 1) we can
  268. 		 * get out the message before doing the damage, and 2) we can
  269. 		 * call mondied, not killed, if it's not your blast
  270. 		 */
  271. 			int mdam = dam;
  272.  
  273. 			if (resist(mtmp, olet, 0, FALSE)) {
  274. 			    if (cansee(i+x-1,j+y-1))
  275. 				pline("%s resists the %s!", Monnam(mtmp), str);
  276. 			    mdam = dam/2;
  277. 			}
  278. 			if (mtmp == u.ustuck)
  279. 				mdam *= 2;
  280. 			if (resists_cold(mtmp) && adtyp == AD_FIRE)
  281. 				mdam *= 2;
  282. 			else if (resists_fire(mtmp) && adtyp == AD_COLD)
  283. 				mdam *= 2;
  284. 			mtmp->mhp -= mdam;
  285. 			mtmp->mhp -= (idamres + idamnonres);
  286. 		}
  287. 		if (mtmp->mhp <= 0) {
  288. 			/* KMH -- Don't blame the player for pets killing gas spores */
  289. 			if (!flags.mon_moving) killed(mtmp);
  290. 			else monkilled(mtmp, "", (int)adtyp);
  291. 		} else if (!flags.mon_moving) setmangry(mtmp);
  292. 	}
  293.  
  294. 	/* Do your injury last */
  295. 	if (uhurt) {
  296. 		if ((type >= 0 || adtyp == AD_PHYS) &&	/* gas spores */
  297. 				flags.verbose && olet != SCROLL_CLASS)
  298. 			You("are caught in the %s!", str);
  299. 		/* do property damage first, in case we end up leaving bones */
  300. 		if (adtyp == AD_FIRE) burn_away_slime();
  301. 		if (Invulnerable) {
  302. 		    damu = 0;
  303. 		    You("are unharmed!");
  304. 		} else if (Half_physical_damage && adtyp == AD_PHYS)
  305. 		    damu = (damu+1) / 2;
  306. 		if (adtyp == AD_FIRE) (void) burnarmor(&youmonst);
  307. 		destroy_item(SCROLL_CLASS, (int) adtyp);
  308. 		destroy_item(SPBOOK_CLASS, (int) adtyp);
  309. 		destroy_item(POTION_CLASS, (int) adtyp);
  310. 		destroy_item(RING_CLASS, (int) adtyp);
  311. 		destroy_item(WAND_CLASS, (int) adtyp);
  312.  
  313. 		ugolemeffects((int) adtyp, damu);
  314. 		if (uhurt == 2) {
  315. 		    if (Upolyd)
  316. 		    	u.mh  -= damu;
  317. 		    else
  318. 			u.uhp -= damu;
  319. 		    flags.botl = 1;
  320. 		}
  321.  
  322. 		if (u.uhp <= 0 || (Upolyd && u.mh <= 0)) {
  323. 		    if (Upolyd) {
  324. 			rehumanize();
  325. 		    } else {
  326. 			if (olet == MON_EXPLODE) {
  327. 			    /* killer handled by caller */
  328. 			    if (str != killer_buf && !generic)
  329. 				Strcpy(killer_buf, str);
  330. 			    killer_format = KILLED_BY_AN;
  331. 			} else if (type >= 0 && olet != SCROLL_CLASS) {
  332. 			    killer_format = NO_KILLER_PREFIX;
  333. 			    Sprintf(killer_buf, "caught %sself in %s own %s",
  334. 				    uhim(), uhis(), str);
  335. 			} else if (!strncmpi(str,"tower of flame", 8) ||
  336. 				   !strncmpi(str,"fireball", 8)) {
  337. 			    killer_format = KILLED_BY_AN;
  338. 			    Strcpy(killer_buf, str);
  339. 			} else {
  340. 			    killer_format = KILLED_BY;
  341. 			    Strcpy(killer_buf, str);
  342. 			}
  343. 			killer = killer_buf;
  344. 			/* Known BUG: BURNING suppresses corpse in bones data,
  345. 			   but done does not handle killer reason correctly */
  346. 			done((adtyp == AD_FIRE) ? BURNING : DIED);
  347. 		    }
  348. 		}
  349. 		exercise(A_STR, FALSE);
  350. 	}
  351.  
  352. 	if (shopdamage) {
  353. 		pay_for_damage(adtyp == AD_FIRE ? "burn away" :
  354. 			       adtyp == AD_COLD ? "shatter" :
  355. 			       adtyp == AD_DISN ? "disintegrate" : "destroy",
  356. 			       FALSE);
  357. 	}
  358.  
  359. 	/* explosions are noisy */
  360. 	i = dam * dam;
  361. 	if (i < 50) i = 50;	/* in case random damage is very small */
  362. 	wake_nearto(x, y, i);
  363. }
  364. #endif /* OVL0 */

scatter[edit]

  1. #ifdef OVL1
  2.  
  3. struct scatter_chain {
  4. 	struct scatter_chain *next;	/* pointer to next scatter item	*/
  5. 	struct obj *obj;		/* pointer to the object	*/
  6. 	xchar ox;			/* location of			*/
  7. 	xchar oy;			/*	item			*/
  8. 	schar dx;			/* direction of			*/
  9. 	schar dy;			/*	travel			*/
  10. 	int range;			/* range of object		*/
  11. 	boolean stopped;		/* flag for in-motion/stopped	*/
  12. };
  13.  
  14. /*
  15. * scflags:
  16. *	VIS_EFFECTS	Add visual effects to display
  17. *	MAY_HITMON	Objects may hit monsters
  18. *	MAY_HITYOU	Objects may hit hero
  19. *	MAY_HIT		Objects may hit you or monsters
  20. *	MAY_DESTROY	Objects may be destroyed at random
  21. *	MAY_FRACTURE	Stone objects can be fractured (statues, boulders)
  22. */
  23.  
  24. /* returns number of scattered objects */
  25. long
  26. scatter(sx,sy,blastforce,scflags, obj)
  27. int sx,sy;				/* location of objects to scatter */
  28. int blastforce;				/* force behind the scattering	*/
  29. unsigned int scflags;
  30. struct obj *obj;			/* only scatter this obj        */
  31. {
  32. 	register struct obj *otmp;
  33. 	register int tmp;
  34. 	int farthest = 0;
  35. 	uchar typ;
  36. 	long qtmp;
  37. 	boolean used_up;
  38. 	boolean individual_object = obj ? TRUE : FALSE;
  39. 	struct monst *mtmp;
  40. 	struct scatter_chain *stmp, *stmp2 = 0;
  41. 	struct scatter_chain *schain = (struct scatter_chain *)0;
  42. 	long total = 0L;
  43.  
  44. 	while ((otmp = individual_object ? obj : level.objects[sx][sy]) != 0) {
  45. 	    if (otmp->quan > 1L) {
  46. 		qtmp = otmp->quan - 1;
  47. 		if (qtmp > LARGEST_INT) qtmp = LARGEST_INT;
  48. 		qtmp = (long)rnd((int)qtmp);
  49. 		otmp = splitobj(otmp, qtmp);
  50. 	    } else {
  51. 		obj = (struct obj *)0; /* all used */
  52. 	    }
  53. 	    obj_extract_self(otmp);
  54. 	    used_up = FALSE;
  55.  
  56. 	    /* 9 in 10 chance of fracturing boulders or statues */
  57. 	    if ((scflags & MAY_FRACTURE)
  58. 			&& ((otmp->otyp == BOULDER) || (otmp->otyp == STATUE))
  59. 			&& rn2(10)) {
  60. 		if (otmp->otyp == BOULDER) {
  61. 		    pline("%s apart.", Tobjnam(otmp, "break"));
  62. 		    fracture_rock(otmp);
  63. 		    place_object(otmp, sx, sy);
  64. 		    if ((otmp = sobj_at(BOULDER, sx, sy)) != 0) {
  65. 			/* another boulder here, restack it to the top */
  66. 			obj_extract_self(otmp);
  67. 			place_object(otmp, sx, sy);
  68. 		    }
  69. 		} else {
  70. 		    struct trap *trap;
  71.  
  72. 		    if ((trap = t_at(sx,sy)) && trap->ttyp == STATUE_TRAP)
  73. 			    deltrap(trap);
  74. 		    pline("%s.", Tobjnam(otmp, "crumble"));
  75. 		    (void) break_statue(otmp);
  76. 		    place_object(otmp, sx, sy);	/* put fragments on floor */
  77. 		}
  78. 		used_up = TRUE;
  79.  
  80. 	    /* 1 in 10 chance of destruction of obj; glass, egg destruction */
  81. 	    } else if ((scflags & MAY_DESTROY) && (!rn2(10)
  82. 			|| (objects[otmp->otyp].oc_material == GLASS
  83. 			|| otmp->otyp == EGG))) {
  84. 		if (breaks(otmp, (xchar)sx, (xchar)sy)) used_up = TRUE;
  85. 	    }
  86.  
  87. 	    if (!used_up) {
  88. 		stmp = (struct scatter_chain *)
  89. 					alloc(sizeof(struct scatter_chain));
  90. 		stmp->next = (struct scatter_chain *)0;
  91. 		stmp->obj = otmp;
  92. 		stmp->ox = sx;
  93. 		stmp->oy = sy;
  94. 		tmp = rn2(8);		/* get the direction */
  95. 		stmp->dx = xdir[tmp];
  96. 		stmp->dy = ydir[tmp];
  97. 		tmp = blastforce - (otmp->owt/40);
  98. 		if (tmp < 1) tmp = 1;
  99. 		stmp->range = rnd(tmp); /* anywhere up to that determ. by wt */
  100. 		if (farthest < stmp->range) farthest = stmp->range;
  101. 		stmp->stopped = FALSE;
  102. 		if (!schain)
  103. 		    schain = stmp;
  104. 		else
  105. 		    stmp2->next = stmp;
  106. 		stmp2 = stmp;
  107. 	    }
  108. 	}
  109.  
  110. 	while (farthest-- > 0) {
  111. 		for (stmp = schain; stmp; stmp = stmp->next) {
  112. 		   if ((stmp->range-- > 0) && (!stmp->stopped)) {
  113. 			bhitpos.x = stmp->ox + stmp->dx;
  114. 			bhitpos.y = stmp->oy + stmp->dy;
  115. 			typ = levl[bhitpos.x][bhitpos.y].typ;
  116. 			if(!isok(bhitpos.x, bhitpos.y)) {
  117. 				bhitpos.x -= stmp->dx;
  118. 				bhitpos.y -= stmp->dy;
  119. 				stmp->stopped = TRUE;
  120. 			} else if(!ZAP_POS(typ) ||
  121. 					closed_door(bhitpos.x, bhitpos.y)) {
  122. 				bhitpos.x -= stmp->dx;
  123. 				bhitpos.y -= stmp->dy;
  124. 				stmp->stopped = TRUE;
  125. 			} else if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) {
  126. 				if (scflags & MAY_HITMON) {
  127. 				    stmp->range--;
  128. 				    if (ohitmon(mtmp, stmp->obj, 1, FALSE)) {
  129. 					stmp->obj = (struct obj *)0;
  130. 					stmp->stopped = TRUE;
  131. 				    }
  132. 				}
  133. 			} else if (bhitpos.x==u.ux && bhitpos.y==u.uy) {
  134. 				if (scflags & MAY_HITYOU) {
  135. 				    int hitvalu, hitu;
  136.  
  137. 				    if (multi) nomul(0);
  138. 				    hitvalu = 8 + stmp->obj->spe;
  139. 				    if (bigmonst(youmonst.data)) hitvalu++;
  140. 				    hitu = thitu(hitvalu,
  141. 						 dmgval(stmp->obj, &youmonst),
  142. 						 stmp->obj, (char *)0);
  143. 				    if (hitu) {
  144. 					stmp->range -= 3;
  145. 					stop_occupation();
  146. 				    }
  147. 				}
  148. 			} else {
  149. 				if (scflags & VIS_EFFECTS) {
  150. 				    /* tmp_at(bhitpos.x, bhitpos.y); */
  151. 				    /* delay_output(); */
  152. 				}
  153. 			}
  154. 			stmp->ox = bhitpos.x;
  155. 			stmp->oy = bhitpos.y;
  156. 		   }
  157. 		}
  158. 	}
  159. 	for (stmp = schain; stmp; stmp = stmp2) {
  160. 		int x,y;
  161.  
  162. 		stmp2 = stmp->next;
  163. 		x = stmp->ox; y = stmp->oy;
  164. 		if (stmp->obj) {
  165. 			if ( x!=sx || y!=sy )
  166. 			    total += stmp->obj->quan;
  167. 			place_object(stmp->obj, x, y);
  168. 			stackobj(stmp->obj);
  169. 		}
  170. 		free((genericptr_t)stmp);
  171. 		newsym(x,y);
  172. 	}
  173.  
  174. 	return total;
  175. }

splatter_burning_oil[edit]

  1. /*
  2. * Splatter burning oil from x,y to the surrounding area.
  3. *
  4. * This routine should really take a how and direction parameters.
  5. * The how is how it was caused, e.g. kicked verses thrown.  The
  6. * direction is which way to spread the flaming oil.  Different
  7. * "how"s would give different dispersal patterns.  For example,
  8. * kicking a burning flask will splatter differently from a thrown
  9. * flask hitting the ground.
  10. *
  11. * For now, just perform a "regular" explosion.
  12. */
  13. void
  14. splatter_burning_oil(x, y)
  15. int x, y;
  16. {
  17. /* ZT_SPELL(ZT_FIRE) = ZT_SPELL(AD_FIRE-1) = 10+(2-1) = 11 */
  18. #define ZT_SPELL_O_FIRE 11 /* value kludge, see zap.c */
  19. explode(x, y, ZT_SPELL_O_FIRE, d(4,4), BURNING_OIL, EXPL_FIERY);
  20. }
  21.  
  22. #endif /* OVL1 */
  23.  
  24. /*explode.c*/