Source:NetHack 2.2a/timeout.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to timeout.c from the source code of NetHack 2.2a.

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

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

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