Source:NetHack 1.3d/timeout.c

From NetHackWiki
Jump to: navigation, search

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

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

Screenshots and source code from Hack are used under the CWI license.

1.    /*	SCCS Id: @(#)timeout.c	1.3	87/07/14
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* timeout.c - version 1.0.3 */
4.    
5.    #include	"hack.h"
6.    
7.    timeout(){
8.    register struct prop *upp;
9.    #ifdef KAA
10.   register struct monst *mtmp;
11.   #endif
12.   	if(Stoned) stoned_dialogue();
13.   #ifdef KAA
14.   	if(u.mtimedone) if (!--u.mtimedone) rehumanize();
15.   # ifdef KOPS
16.   	if(u.ucreamed > 0) u.ucreamed--;
17.   # endif
18.   #endif
19.   	for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
20.   	    if((upp->p_flgs & TIMEOUT) && !(--upp->p_flgs & TIMEOUT)) {
21.   		if(upp->p_tofn) (*upp->p_tofn)();
22.   		else switch(upp - u.uprops){
23.   		case STONED:
24.   			killer = "cockatrice";
25.   			done("died");
26.   			break;
27.   		case SICK:
28.   			pline("You die because of food poisoning.");
29.   			killer = u.usick_cause;
30.   			done("died");
31.   			break;
32.   		case FAST:
33.   			pline("You feel yourself slowing down.");
34.   			break;
35.   		case CONFUSION:
36.   			if (Hallucination) pline("You feel less trippy now.");
37.   			else
38.   				pline("You feel less confused now.");
39.   			break;
40.   		case BLIND:
41.   			if (Hallucination) pline("Oh like wow! What a rush.");
42.   			else		   pline("You can see again.");
43.   			setsee();
44.   			break;
45.   		case INVIS:
46.   			on_scr(u.ux,u.uy);
47.   			if (!See_invisible)
48.   				pline("You are no longer invisible.");
49.   			break;
50.   		case WOUNDED_LEGS:
51.   			heal_legs();
52.   			break;
53.   #ifdef KAA
54.   		case HALLUCINATION:
55.   			pline("Everything looks SO boring now.");
56.   			setsee();
57.   			for (mtmp=fmon; mtmp; mtmp=mtmp->nmon)
58.   				if ((Blind && Telepat) || canseemon(mtmp))
59.   					atl(mtmp->mx, mtmp->my, (!mtmp->mappearance || 
60.   					Protection_from_shape_changers) 
61.   					? mtmp->data->mlet : mtmp->mappearance);
62.   			break;
63.   #endif
64.   		}
65.   	}
66.   }
67.   
68.   /* He is being petrified - dialogue by inmet!tower */
69.   char *stoned_texts[] = {
70.   	"You are slowing down.",		/* 5 */
71.   	"Your limbs are stiffening.",		/* 4 */
72.   	"Your limbs have turned to stone.",	/* 3 */
73.   	"You have turned to stone.",		/* 2 */
74.   	"You are a statue."			/* 1 */
75.   };
76.   
77.   stoned_dialogue()
78.   {
79.   	register long i = (Stoned & TIMEOUT);
80.   
81.   	if(i > 0 && i <= SIZE(stoned_texts))
82.   		pline(stoned_texts[SIZE(stoned_texts) - i]);
83.   	if(i == 5)
84.   		Fast = 0;
85.   	if(i == 3)
86.   		nomul(-3);
87.   }