Wikia

Wikihack

Source:SLASH'EM 0.0.7E7F2/allmain.c

2,032pages on
this wiki
Talk0

Below is the full text to allmain.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/allmain.c#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)allmain.c	3.4	2003/04/02	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    /* various code that was replicated in *main.c */
6.    
7.    #include "hack.h"
8.    #ifndef NO_SIGNAL
9.    #include <signal.h>
10.   #endif
11.   #ifdef SHORT_FILENAMES
12.   #include "patchlev.h"
13.   #else
14.   #include "patchlevel.h"
15.   #endif
16.   
17.   #ifdef POSITIONBAR
18.   STATIC_DCL void NDECL(do_positionbar);
19.   #endif
20.   
21.   #define decrnknow(spell)	spl_book[spell].sp_know--
22.   #define spellid(spell)		spl_book[spell].sp_id
23.   #define spellknow(spell)	spl_book[spell].sp_know
24.   
25.   #ifdef OVL0
26.   
27.   void
28.   moveloop()
29.   {
30.   #if defined(MICRO) || defined(WIN32)
31.       char ch;
32.       int abort_lev;
33.   #endif
34.       int moveamt = 0, wtcap = 0, change = 0;
35.       boolean didmove = FALSE, monscanmove = FALSE;
36.   
37.       flags.moonphase = phase_of_the_moon();
38.       if(flags.moonphase == FULL_MOON) {
39.   	You("are lucky!  Full moon tonight.");
40.   	change_luck(1);
41.       } else if(flags.moonphase == NEW_MOON) {
42.   	pline("Be careful!  New moon tonight.");
43.       }
44.       flags.friday13 = friday_13th();
45.       if (flags.friday13) {
46.   	pline("Watch out!  Bad things can happen on Friday the 13th.");
47.   	change_luck(-1);
48.       }
49.       /* KMH -- February 2 */
50.       flags.groundhogday = groundhog_day();
51.       if (flags.groundhogday)
52.   	pline("Happy Groundhog Day!");
53.   
54.       initrack();
55.   
56.   
57.       /* Note:  these initializers don't do anything except guarantee that
58.   	    we're linked properly.
59.       */
60.       decl_init();
61.       monst_init();
62.       monstr_init();	/* monster strengths */
63.       objects_init();
64.   
65.   #ifdef WIZARD
66.       if (wizard) add_debug_extended_commands();
67.   #endif
68.   
69.       (void) encumber_msg(); /* in case they auto-picked up something */
70.       if (defer_see_monsters) {
71.   	defer_see_monsters = FALSE;
72.   	see_monsters();
73.       }
74.   
75.       u.uz0.dlevel = u.uz.dlevel;
76.       youmonst.movement = NORMAL_SPEED;	/* give the hero some movement points */
77.   
78.       for(;;) {
79.   	get_nh_event();
80.   #ifdef POSITIONBAR
81.   	do_positionbar();
82.   #endif
83.   
84.   	didmove = flags.move;
85.   	if(didmove) {
86.   	    /* actual time passed */
87.   	    youmonst.movement -= NORMAL_SPEED;
88.   
89.   	    do { /* hero can't move this turn loop */
90.   		wtcap = encumber_msg();
91.   
92.   		flags.mon_moving = TRUE;
93.   		do {
94.   		    monscanmove = movemon();
95.   		    if (youmonst.movement > NORMAL_SPEED)
96.   			break;	/* it's now your turn */
97.   		} while (monscanmove);
98.   		flags.mon_moving = FALSE;
99.   
100.  		if (!monscanmove && youmonst.movement < NORMAL_SPEED) {
101.  		    /* both you and the monsters are out of steam this round */
102.  		    /* set up for a new turn */
103.  		    struct monst *mtmp;
104.  		    mcalcdistress();	/* adjust monsters' trap, blind, etc */
105.  
106.  		    /* reallocate movement rations to monsters */
107.  		    for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
108.  			mtmp->movement += mcalcmove(mtmp);
109.  
110.  		    if(!rn2(u.uevent.udemigod ? 25 :
111.  			    (depth(&u.uz) > depth(&stronghold_level)) ? 50 : 70))
112.  			(void) makemon((struct permonst *)0, 0, 0, NO_MM_FLAGS);
113.  
114.  		    /* calculate how much time passed. */
115.  #ifdef STEED
116.  		    if (u.usteed && u.umoved) {
117.  			/* your speed doesn't augment steed's speed */
118.  			moveamt = mcalcmove(u.usteed);
119.  		    } else
120.  #endif
121.  		    {
122.  			moveamt = youmonst.data->mmove;
123.  
124.  			if (Very_fast) {	/* speed boots or potion */
125.  			    /* average movement is 1.67 times normal */
126.  			    moveamt += NORMAL_SPEED / 2;
127.  			    if (rn2(3) == 0) moveamt += NORMAL_SPEED / 2;
128.  			} else if (Fast) {
129.  			    /* average movement is 1.33 times normal */
130.  			    if (rn2(3) != 0) moveamt += NORMAL_SPEED / 2;
131.  			}
132.  			if (tech_inuse(T_BLINK)) { /* TECH: Blinking! */
133.  			    /* Case    Average  Variance
134.  			     * -------------------------
135.  			     * Normal    12         0
136.  			     * Fast      16        12
137.  			     * V fast    20        12
138.  			     * Blinking  24        12
139.  			     * F & B     28        18
140.  			     * V F & B   30        18
141.  			     */
142.  			    moveamt += NORMAL_SPEED * 2 / 3;
143.  			    if (rn2(3) == 0) moveamt += NORMAL_SPEED / 2;
144.  			}
145.  		    }
146.  
147.  		    switch (wtcap) {
148.  			case UNENCUMBERED: break;
149.  			case SLT_ENCUMBER: moveamt -= (moveamt / 4); break;
150.  			case MOD_ENCUMBER: moveamt -= (moveamt / 2); break;
151.  			case HVY_ENCUMBER: moveamt -= ((moveamt * 3) / 4); break;
152.  			case EXT_ENCUMBER: moveamt -= ((moveamt * 7) / 8); break;
153.  			default: break;
154.  		    }
155.  
156.  		    youmonst.movement += moveamt;
157.  		    if (youmonst.movement < 0) youmonst.movement = 0;
158.  		    settrack();
159.  
160.  		    monstermoves++;
161.  		    moves++;
162.  
163.  		    /********************************/
164.  		    /* once-per-turn things go here */
165.  		    /********************************/
166.  
167.  		    if (flags.bypasses) clear_bypasses();
168.  		    if(Glib) glibr();
169.  		    nh_timeout();
170.  		    run_regions();
171.  
172.  #ifdef DUNGEON_GROWTH
173.  		    dgn_growths(TRUE, TRUE);
174.  #endif
175.  
176.  		    if (u.ublesscnt)  u.ublesscnt--;
177.  		    
178.  		    if(flags.time && !flags.run)
179.  			flags.botl = 1;
180.  
181.  		    /* One possible result of prayer is healing.  Whether or
182.  		     * not you get healed depends on your current hit points.
183.  		     * If you are allowed to regenerate during the prayer, the
184.  		     * end-of-prayer calculation messes up on this.
185.  		     * Another possible result is rehumanization, which requires
186.  		     * that encumbrance and movement rate be recalculated.
187.  		     */
188.  		    if (u.uinvulnerable) {
189.  			/* for the moment at least, you're in tiptop shape */
190.  			wtcap = UNENCUMBERED;
191.  		    } else if (Upolyd && youmonst.data->mlet == S_EEL && !is_pool(u.ux,u.uy) && !Is_waterlevel(&u.uz)) {
192.  			if (u.mh > 1) {
193.  			    u.mh--;
194.  			    flags.botl = 1;
195.  			} else if (u.mh < 1)
196.  			    rehumanize();
197.  		    } else if (Upolyd && u.mh < u.mhmax) {
198.  			if (u.mh < 1)
199.  			    rehumanize();
200.  			else if (Regeneration ||
201.  				    (wtcap < MOD_ENCUMBER && !(moves%20))) {
202.  			    flags.botl = 1;
203.  			    u.mh++;
204.  			}
205.  		    } else if (u.uhp < u.uhpmax &&
206.  			 (wtcap < MOD_ENCUMBER || !u.umoved || Regeneration)) {
207.  /*
208.   * KMH, balance patch -- New regeneration code
209.   * Healthstones have been added, which alter your effective
210.   * experience level and constitution (-2 cursed, +1 uncursed,
211.   * +2 blessed) for the basis of regeneration calculations.
212.   */
213.  
214.   			int efflev = u.ulevel + u.uhealbonus;
215.   			int effcon = ACURR(A_CON) + u.uhealbonus;
216.  			int heal = 1;
217.  
218.  
219.  			if (efflev > 9 && !(moves % 3)) {
220.  			    if (effcon <= 12) {
221.  				heal = 1;
222.  			    } else {
223.  				heal = rnd(effcon);
224.    				if (heal > efflev-9) heal = efflev-9;
225.  			    }
226.  			    flags.botl = 1;
227.  			    u.uhp += heal;
228.  			    if(u.uhp > u.uhpmax)
229.  				u.uhp = u.uhpmax;
230.  			} else if (Regeneration ||
231.  			     (efflev <= 9 &&
232.  			      !(moves % ((MAXULEV+12) / (u.ulevel+2) + 1)))) {
233.  			    flags.botl = 1;
234.  			    u.uhp++;
235.  			}
236.  		    }
237.  
238.  		    if (!u.uinvulnerable && u.uen > 0 && u.uhp < u.uhpmax &&
239.  			    tech_inuse(T_CHI_HEALING)) {
240.  			u.uen--;
241.  			u.uhp++;
242.  			flags.botl = 1;
243.  		    }
244.  
245.  		    /* moving around while encumbered is hard work */
246.  		    if (wtcap > MOD_ENCUMBER && u.umoved) {
247.  			if(!(wtcap < EXT_ENCUMBER ? moves%30 : moves%10)) {
248.  			    if (Upolyd && u.mh > 1) {
249.  				u.mh--;
250.  			    } else if (!Upolyd && u.uhp > 1) {
251.  				u.uhp--;
252.  			    } else {
253.  				You("pass out from exertion!");
254.  				exercise(A_CON, FALSE);
255.  				fall_asleep(-10, FALSE);
256.  			    }
257.  			}
258.  		    }
259.  
260.  		    
261.  		    /* KMH -- OK to regenerate if you don't move */
262.  		    if ((u.uen < u.uenmax) && (Energy_regeneration ||
263.  				((wtcap < MOD_ENCUMBER || !flags.mv) &&
264.  				(!(moves%((MAXULEV + 15 - u.ulevel) *                                    
265.  				(Role_if(PM_WIZARD) ? 3 : 4) / 6)))))) {
266.  			u.uen += rn1((int)(ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1,1);
267.  #ifdef WIZ_PATCH_DEBUG
268.                  pline("mana was = %d now = %d",temp,u.uen);
269.  #endif
270.  
271.  			if (u.uen > u.uenmax)  u.uen = u.uenmax;
272.  			flags.botl = 1;
273.  		    }
274.  
275.  		    if(!u.uinvulnerable) {
276.  			if(Teleportation && !rn2(85)) {
277.  			    xchar old_ux = u.ux, old_uy = u.uy;
278.  			    tele();
279.  			    if (u.ux != old_ux || u.uy != old_uy) {
280.  				if (!next_to_u()) {
281.  				    check_leash(old_ux, old_uy);
282.  				}
283.  #ifdef REDO
284.  				/* clear doagain keystrokes */
285.  				pushch(0);
286.  				savech(0);
287.  #endif
288.  			    }
289.  			}
290.  			/* delayed change may not be valid anymore */
291.  			if ((change == 1 && !Polymorph) ||
292.  			    (change == 2 && u.ulycn == NON_PM))
293.  			    change = 0;
294.  			if(Polymorph && !rn2(100))
295.  			    change = 1;
296.  			else if (u.ulycn >= LOW_PM && !Upolyd &&
297.  				 !rn2(80 - (20 * night())))
298.  			    change = 2;
299.  			if (change && !Unchanging) {
300.  			    if (multi >= 0) {
301.  				if (occupation)
302.  				    stop_occupation();
303.  				else
304.  				    nomul(0);
305.  				if (change == 1) polyself(FALSE);
306.  				else you_were();
307.  				change = 0;
308.  			    }
309.  			}
310.  		}	/* !u.uinvulnerable */
311.  
312.  		    if(Searching && multi >= 0) (void) dosearch0(1);
313.  		    dosounds();
314.  		    do_storms();
315.  		    gethungry();
316.  		    age_spells();
317.  		    exerchk();
318.  		    invault();
319.  		    if (u.uhave.amulet) amulet();
320.  		if (!rn2(40+(int)(ACURR(A_DEX)*3))) u_wipe_engr(rnd(3));
321.  		    if (u.uevent.udemigod && !u.uinvulnerable) {
322.  			if (u.udg_cnt) u.udg_cnt--;
323.  			if (!u.udg_cnt) {
324.  			    intervene();
325.  			    u.udg_cnt = rn1(200, 50);
326.  			}
327.  		    }
328.  		    restore_attrib();
329.  
330.  		    /* underwater and waterlevel vision are done here */
331.  		    if (Is_waterlevel(&u.uz))
332.  			movebubbles();
333.  		    else if (Underwater)
334.  			under_water(0);
335.  		    /* vision while buried done here */
336.  		    else if (u.uburied) under_ground(0);
337.  
338.  		    /* when immobile, count is in turns */
339.  		    if(multi < 0) {
340.  			if (++multi == 0) {	/* finished yet? */
341.  			    unmul((char *)0);
342.  			    /* if unmul caused a level change, take it now */
343.  			    if (u.utotype) deferred_goto();
344.  			}
345.  		    }
346.  		}
347.  	    } while (youmonst.movement<NORMAL_SPEED); /* hero can't move loop */
348.  
349.  	    /******************************************/
350.  	    /* once-per-hero-took-time things go here */
351.  	    /******************************************/
352.  
353.  
354.  	} /* actual time passed */
355.  
356.  	/****************************************/
357.  	/* once-per-player-input things go here */
358.  	/****************************************/
359.  
360.  	find_ac();
361.  	if(!flags.mv || Blind) {
362.  	    /* redo monsters if hallu or wearing a helm of telepathy */
363.  	    if (Hallucination) {	/* update screen randomly */
364.  		see_monsters();
365.  		see_objects();
366.  		see_traps();
367.  		if (u.uswallow) swallowed(0);
368.  	    } else if (Unblind_telepat) {
369.  		see_monsters();
370.  	    } else if (Warning || Warn_of_mon)
371.  	     	see_monsters();
372.  
373.  	    if (vision_full_recalc) vision_recalc(0);	/* vision! */
374.  	}
375.  	if(flags.botl || flags.botlx) bot();
376.  
377.  	flags.move = 1;
378.  
379.  	if(multi >= 0 && occupation) {
380.  #if defined(MICRO) || defined(WIN32)
381.  	    abort_lev = 0;
382.  	    if (kbhit()) {
383.  		if ((ch = Getchar()) == ABORT)
384.  		    abort_lev++;
385.  # ifdef REDO
386.  		else
387.  		    pushch(ch);
388.  # endif /* REDO */
389.  	    }
390.  	    if (!abort_lev && (*occupation)() == 0)
391.  #else
392.  	    if ((*occupation)() == 0)
393.  #endif
394.  		occupation = 0;
395.  	    if(
396.  #if defined(MICRO) || defined(WIN32)
397.  		   abort_lev ||
398.  #endif
399.  		   monster_nearby()) {
400.  		stop_occupation();
401.  		reset_eat();
402.  	    }
403.  #if defined(MICRO) || defined(WIN32)
404.  	    if (!(++occtime % 7))
405.  		display_nhwindow(WIN_MAP, FALSE);
406.  #endif
407.  	    continue;
408.  	}
409.  
410.  	if ((u.uhave.amulet || Clairvoyant) &&
411.  	    !In_endgame(&u.uz) && !BClairvoyant &&
412.  	    !(moves % 15) && !rn2(2))
413.  		do_vicinity_map();
414.  
415.  	if(u.utrap && u.utraptype == TT_LAVA) {
416.  	    if(!is_lava(u.ux,u.uy))
417.  		u.utrap = 0;
418.  	    else if (!u.uinvulnerable) {
419.  		u.utrap -= 1<<8;
420.  		if(u.utrap < 1<<8) {
421.  		    killer_format = KILLED_BY;
422.  		    killer = "molten lava";
423.  		    You("sink below the surface and die.");
424.  		    done(DISSOLVED);
425.  		} else if(didmove && !u.umoved) {
426.  		    Norep("You sink deeper into the lava.");
427.  		    u.utrap += rnd(4);
428.  		}
429.  	    }
430.  	}
431.  
432.  #ifdef WIZARD
433.  	if (iflags.sanity_check)
434.  	    sanity_check();
435.  #elif defined(OBJ_SANITY)
436.  	if (iflags.sanity_check)
437.  	    obj_sanity_check();
438.  #endif
439.  
440.  #ifdef CLIPPING
441.  	/* just before rhack */
442.  	cliparound(u.ux, u.uy);
443.  #endif
444.  
445.  	u.umoved = FALSE;
446.  
447.  	if (multi > 0) {
448.  	    lookaround();
449.  	    if (!multi) {
450.  		/* lookaround may clear multi */
451.  		flags.move = 0;
452.  		if (flags.time) flags.botl = 1;
453.  		continue;
454.  	    }
455.  	    if (flags.mv) {
456.  		if(multi < COLNO && !--multi)
457.  		    flags.travel = iflags.travel1 = flags.mv = flags.run = 0;
458.  		domove();
459.  	    } else {
460.  		--multi;
461.  		rhack(save_cm);
462.  	    }
463.  	} else if (multi == 0) {
464.  #ifdef MAIL
465.  	    ckmailstatus();
466.  #endif
467.  	    rhack((char *)0);
468.  	}
469.  	if (u.utotype)		/* change dungeon level */
470.  	    deferred_goto();	/* after rhack() */
471.  	/* !flags.move here: multiple movement command stopped */
472.  	else if (flags.time && (!flags.move || !flags.mv))
473.  	    flags.botl = 1;
474.  
475.  	if (vision_full_recalc) vision_recalc(0);	/* vision! */
476.  	/* when running in non-tport mode, this gets done through domove() */
477.  	if ((!flags.run || iflags.runmode == RUN_TPORT) &&
478.  		(multi && (!flags.travel ? !(multi % 7) : !(moves % 7L)))) {
479.  	    if (flags.time && flags.run) flags.botl = 1;
480.  	    display_nhwindow(WIN_MAP, FALSE);
481.  	}
482.      }
483.  }
484.  
485.  
486.  #endif /* OVL0 */
487.  #ifdef OVL1
488.  
489.  void
490.  stop_occupation()
491.  {
492.  	if(occupation) {
493.  		if (!maybe_finished_meal(TRUE))
494.  		    You("stop %s.", occtxt);
495.  		occupation = 0;
496.  		flags.botl = 1; /* in case u.uhs changed */
497.  /* fainting stops your occupation, there's no reason to sync.
498.  		sync_hunger();
499.  */
500.  #ifdef REDO
501.  		nomul(0);
502.  		pushch(0);
503.  #endif
504.  	}
505.  }
506.  
507.  #endif /* OVL1 */
508.  #ifdef OVLB
509.  
510.  void
511.  display_gamewindows()
512.  {
513.      WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
514.      WIN_STATUS = create_nhwindow(NHW_STATUS);
515.      WIN_MAP = create_nhwindow(NHW_MAP);
516.      WIN_INVEN = create_nhwindow(NHW_MENU);
517.  
518.  #ifdef MAC
519.      /*
520.       * This _is_ the right place for this - maybe we will
521.       * have to split display_gamewindows into create_gamewindows
522.       * and show_gamewindows to get rid of this ifdef...
523.       */
524.  	if ( ! strcmp ( windowprocs . name , "mac" ) ) {
525.  	    SanePositions ( ) ;
526.  	}
527.  #endif
528.  
529.      /*
530.       * The mac port is not DEPENDENT on the order of these
531.       * displays, but it looks a lot better this way...
532.       */
533.      display_nhwindow(WIN_STATUS, FALSE);
534.      display_nhwindow(WIN_MESSAGE, FALSE);
535.      clear_glyph_buffer();
536.      display_nhwindow(WIN_MAP, FALSE);
537.  }
538.  
539.  void
540.  newgame()
541.  {
542.  	int i;
543.  
544.  #ifdef MFLOPPY
545.  	gameDiskPrompt();
546.  #endif
547.  
548.  	flags.ident = 1;
549.  
550.  	for (i = 0; i < NUMMONS; i++)
551.  		mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
552.  
553.  	init_objects();		/* must be before u_init() */
554.  
555.  	flags.pantheon = -1;	/* role_init() will reset this */
556.  	role_init();		/* must be before init_dungeons(), u_init(),
557.  				 * and init_artifacts() */
558.  
559.  	init_dungeons();	/* must be before u_init() to avoid rndmonst()
560.  				 * creating odd monsters for any tins and eggs
561.  				 * in hero's initial inventory */
562.  	init_artifacts();	/* before u_init() in case $WIZKIT specifies
563.  				 * any artifacts */
564.  	u_init();
565.  	init_artifacts1();	/* must be after u_init() */
566.  
567.  #ifndef NO_SIGNAL
568.  	(void) signal(SIGINT, (SIG_RET_TYPE) done1);
569.  #endif
570.  #ifdef NEWS
571.  	if(iflags.news) display_file_area(NEWS_AREA, NEWS, FALSE);
572.  #endif
573.  
574.  	load_qtlist();	/* load up the quest text info */
575.  /*	quest_init();*/	/* Now part of role_init() */
576.  
577.  	mklev();
578.  	u_on_upstairs();
579.  	vision_reset();		/* set up internals for level (after mklev) */
580.  	check_special_room(FALSE);
581.  
582.  	flags.botlx = 1;
583.  
584.  	/* Move the monster from under you or else
585.  	 * makedog() will fail when it calls makemon().
586.  	 *			- ucsfcgl!kneller
587.  	 */
588.  
589.  	if(MON_AT(u.ux, u.uy)) mnexto(m_at(u.ux, u.uy));
590.  	(void) makedog();
591.  
592.  	docrt();
593.  
594.  	if (flags.legacy) {
595.  		flush_screen(1);
596.  		com_pager(1);
597.  	}
598.  #ifdef INSURANCE
599.  	save_currentstate();
600.  #endif
601.  	program_state.something_worth_saving++;	/* useful data now exists */
602.  
603.  	/* Success! */
604.  	welcome(TRUE);
605.  	return;
606.  }
607.  
608.  /* show "welcome [back] to nethack" message at program startup */
609.  void
610.  welcome(new_game)
611.  boolean new_game;	/* false => restoring an old game */
612.  {
613.      char buf[BUFSZ];
614.      boolean currentgend = Upolyd ? u.mfemale : flags.female;
615.  
616.      /*
617.       * The "welcome back" message always describes your innate form
618.       * even when polymorphed or wearing a helm of opposite alignment.
619.       * Alignment is shown unconditionally for new games; for restores
620.       * it's only shown if it has changed from its original value.
621.       * Sex is shown for new games except when it is redundant; for
622.       * restores it's only shown if different from its original value.
623.       */
624.      *buf = '\0';
625.      if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
626.  	Sprintf(eos(buf), " %s", align_str(u.ualignbase[A_ORIGINAL]));
627.      if (!urole.name.f &&
628.  	    (new_game ? (urole.allow & ROLE_GENDMASK) == (ROLE_MALE|ROLE_FEMALE) :
629.  	     currentgend != flags.initgend))
630.  	Sprintf(eos(buf), " %s", genders[currentgend].adj);
631.  
632.  #if 0
633.      pline(new_game ? "%s %s, welcome to NetHack!  You are a%s %s %s."
634.  		   : "%s %s, the%s %s %s, welcome back to NetHack!",
635.  	  Hello((struct monst *) 0), plname, buf, urace.adj,
636.  	  (currentgend && urole.name.f) ? urole.name.f : urole.name.m);
637.  #endif
638.      if (new_game) pline("%s %s, welcome to %s!  You are a%s %s %s.",
639.  	  Hello((struct monst *) 0), plname, DEF_GAME_NAME, buf, urace.adj,
640.  	  (currentgend && urole.name.f) ? urole.name.f : urole.name.m);
641.      else pline("%s %s, the%s %s %s, welcome back to %s!",
642.  	  Hello((struct monst *) 0), plname, buf, urace.adj,
643.  	  (currentgend && urole.name.f) ? urole.name.f : urole.name.m, 
644.  	  DEF_GAME_NAME);
645.  }
646.  
647.  #ifdef POSITIONBAR
648.  STATIC_DCL void
649.  do_positionbar()
650.  {
651.  	static char pbar[COLNO];
652.  	char *p;
653.  	
654.  	p = pbar;
655.  	/* up stairway */
656.  	if (upstair.sx &&
657.  #ifdef DISPLAY_LAYERS
658.  	   (level.locations[upstair.sx][upstair.sy].mem_bg == S_upstair ||
659.  	    level.locations[upstair.sx][upstair.sy].mem_bg == S_upladder)) {
660.  #else
661.  	   (glyph_to_cmap(level.locations[upstair.sx][upstair.sy].glyph) ==
662.  	    S_upstair ||
663.   	    glyph_to_cmap(level.locations[upstair.sx][upstair.sy].glyph) ==
664.  	    S_upladder)) {
665.  #endif
666.  		*p++ = '<';
667.  		*p++ = upstair.sx;
668.  	}
669.  	if (sstairs.sx &&
670.  #ifdef DISPLAY_LAYERS
671.  	   (level.locations[sstairs.sx][sstairs.sy].mem_bg == S_upstair ||
672.  	    level.locations[sstairs.sx][sstairs.sy].mem_bg == S_upladder)) {
673.  #else
674.  	   (glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) ==
675.  	    S_upstair ||
676.   	    glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) ==
677.  	    S_upladder)) {
678.  #endif
679.  		*p++ = '<';
680.  		*p++ = sstairs.sx;
681.  	}
682.  
683.  	/* down stairway */
684.  	if (dnstair.sx &&
685.  #ifdef DISPLAY_LAYERS
686.  	   (level.locations[dnstair.sx][dnstair.sy].mem_bg == S_dnstair ||
687.  	    level.locations[dnstair.sx][dnstair.sy].mem_bg == S_dnladder)) {
688.  #else
689.  	   (glyph_to_cmap(level.locations[dnstair.sx][dnstair.sy].glyph) ==
690.  	    S_dnstair ||
691.   	    glyph_to_cmap(level.locations[dnstair.sx][dnstair.sy].glyph) ==
692.  	    S_dnladder)) {
693.  #endif
694.  		*p++ = '>';
695.  		*p++ = dnstair.sx;
696.  	}
697.  	if (sstairs.sx &&
698.  #ifdef DISPLAY_LAYERS
699.  	   (level.locations[sstairs.sx][sstairs.sy].mem_bg == S_dnstair ||
700.  	    level.locations[sstairs.sx][sstairs.sy].mem_bg == S_dnladder)) {
701.  #else
702.  	   (glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) ==
703.  	    S_dnstair ||
704.   	    glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) ==
705.  	    S_dnladder)) {
706.  #endif
707.  		*p++ = '>';
708.  		*p++ = sstairs.sx;
709.  	}
710.  
711.  	/* hero location */
712.  	if (u.ux) {
713.  		*p++ = '@';
714.  		*p++ = u.ux;
715.  	}
716.  	/* fence post */
717.  	*p = 0;
718.  
719.  	update_positionbar(pbar);
720.  }
721.  #endif
722.  
723.  #endif /* OVLB */
724.  
725.  /*allmain.c*/

Around Wikia's network

Random Wiki