NetHack: Legacy For Mac

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

  1. NetHack: Legacy (game, roguelike, high fantasy) Released 1987. Ranked #507 game of 1987 among Glitchwave users. The cruel god Moloch has stolen the most powerful of artifacts, the Amulet of Yendor. You have been entrusted by your god to recover the amulet from the bottom of Gehennom, located beneath the Dungeons of Doom.
  2. Mac GUI – customize your Mac’s look and feel with Themes, Desktops, Icons, Widgets, etc. Mac OS 9 Lives – tips and software for running the Classic Mac OS; audio-centric focus U-Mich Software Archives – large legacy software collection, for Macs and other platforms.
  • 2moveloop
    • 2.2Main loop

Nethack 4 Nethack 4. (default off, AMIGA NetHack only). MACgraphics (default on, Mac NetHack only). Pagewait (default on, Mac NetHack only). Rawio Force raw (non-cbreak) mode for faster output and more bulletproof input (MS-DOS sometimes treats `^P' as a printer toggle without it) (default off, OS/2, PC, and ST NetHack only). Cataclysm: Dark Days Ahead, FTL: Faster Than Light, and Slay the Spire are probably your best bets out of the 85 options considered. 'Tons of depth' is the primary reason people pick Cataclysm: Dark Days Ahead over the competition. This page is powered by a knowledgeable community that helps you make an informed decision.

Top of file

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.

moveloop

Initialization

The luck adjustments are simply to set initial luck using change_luck. Actual base luck is defined in nh_timeout.

initrack initialises the tracking system by which pets (and certain monsters such as leprechauns can follow the player.

decl_init, monst_init, monstr_init, and objects_init are all empty routines used to force the appropriate definitions to compile and be available to the rest of the program.

add_debug_extended_commands enables the wizard mode extended commands.

encumber_msg recalculates the player's encumbrance and displays an appropriate message if it has changed.

Main loop

get_nh_event and do_positionbar are routines related to the current interface. get_nh_event invokes any system processing related to window updating and do_positionbar generates information related to a horizontal positoning bar that may be present in the window system.

flags.move is set whenever the player has performed an action that requires actual game time (moving, fighting, dropping and picking up objects, etc.).

Any action that takes time requires NORMAL_SPEEDmovement points.

Now that the player has moved, give all monsters at least one chance to move using movemon. If the player does not have sufficient movement points to move any more this turn keep moving monsters; otherwise give monsters only one chance at a move.

Once-per-turn events

Nothing more can move this turn; therefore prepare to move to the next turn.

mcalcdistress is responsible for updates of change-of-turn monster data.

This grants movement points to monsters for the coming turn. mcalcmove determines how many points the monster will get.

This important segment is responsible for all random monster generation. The flag u.uevent.demigod is set after killing the Wizard of Yendor for the first time or on performing the invocation ritual; therefore after these events a monster is generated randomly on the level with a 1/25 chance each turn; otherwise there is a 1/50 chance if you are below the Castle and 1/70 chance if you are not.

If you are mounted, your movement point allocation is that of your steed.

This segment calculates your movement rate for the turn. It is first set to the normal movement rate of your current form (which of course changes if you are polymorphed). If you are fast, you have a 2/3 chance of earning an extra NORMAL_SPEED / 2 movement points; if you are very fast you are guaranteed at least NORMAL_SPEED / 2 points with a 1/3 chance of another NORMAL_SPEED / 2. (Note that NORMAL_SPEED does not vary if you are polymorphed, so the speed intrinsic is more effective if you are in a very slow form and less effective if you are in a very fast form.) Finally, your speed is adjusted for encumbrance and added to your current movement point total.

settrack updates your position in the tracking system.

Legacy

Finally, the turn counter is incremented; we are now on a new turn.

clear_bypasses clears a flag related to whether an object should be hit by a wand zapped at it (amongst other events).

glibr is the code relating to slippery fingers.

nh_timeout handles all timeouts related to time-delayed functions such as extrinsics from potions, stoning, sliming, etc.

run_regions handles timeouts for area effects, currently only used for stinking clouds.

Decrements the prayer timeout.

Indicates that the status line needs to be updated if the turn counter is shown in the bottom line.

u.uinvulnerable is set whenever you are being protected by your deity while praying; during this time you are not considered to be encumbered.

If you are polymorphed into a sea monster and are out of water, you lose one hit point per turn down to a minimum of one.

If you are killed in a polymorphed form, attempt to return the player to their normal form.

If you are in a polymorphed form and are either regenerating or on a twentieth move, regain a hitpoint.

If you are not polymorphed, regenerate hitpoints. Every third turn if you are level 10 or above, gain an amount of hitpoints equal to a random value up to your current constitution if it is 13 or above, or 1 if your current constitution is below 13. Otherwise gain one hitpoint if you are regenerating, or you are level 9 or less and a certain number of turns related to your current level has passed. This requires that you are not stressed or worse if you are not regenerating.

If you are strained or overtaxed, lose hit points from trying to move around; this is every thirty turns if you are strained and every ten if you are overtaxed.

Regenerate power if you are not stressed or worse on every (38 - current level) * 4 moves if you are not a wizard or * 3 if you are, or have the energy regeneration extrinsic from the Eye of the Aethiopica; you gain from 1 to 1/15th the sum of your current intelligence and wisdom totals.

This implements teleportitis, if you are not protected while praying; if they have the intrinsic, teleport the player on a 1/85th chance each turn.

Polymorphing is delayed while wearing an amulet of unchanging; if such a polymorph is no longer valid cancel it.

If you have the polymorphing intrinsic (from a ring of polymorph), attempt to polymorph on a 1/100 chance each turn.

If you are a lycanthrope, attempt to change on a 1/80 chance (or 1/60 if it is night) per turn.

Enact the above polymorphs if you are not wearing an amulet of unchanging; otherwise delay it (as above).

If you have the searching intrinsic, perform the search.

dosounds generates the sounds resulting from dungeon features.

do_storms generates storm effects for the Plane of Air.

gethungry handles normal nutrition depletion and effects.

age_spells handles spell timeouts.

exerchk checks if attributes have been exercised enough for a change to occur.

invault handles vaultguard checks.

amulet handles turn-to-turn events related to holding the Amulet of Yendor.

This attempts to scuff engravings at your location on a random chance that decreases with dexterity.

If you have killed the Wizard of Yendor or performed the invocation ritual, intervene is called every 50-249 turns; this is responsible for the Wizard's interventions and resurrections.

restore_attrib restores temporary changes of attributes.

movebubbles handles bubble movements on the Plane of Water.

under_water handles display routines related to being under water.

under_ground handles display routines related to being buried (a deferred feature).

If you are immobile, decrement the turn counter for being immobile and handle any effects meant to occur once the timeout for this reaches zero.

Once-per-action events

Once-per-input events

find_ac calculates and updates the player's armor class.

see_monsters, see_traps, and traps determine which glyphs to display for those features.

Nethack: legacy for mac osx

vision_recalc calculates which squares are visible to the player.

If the status line needs to be updated, update it with bot.

Assume that the next player action will require time; if it does not flags.move will be reset at that time.

multi is greater than zero if a player has entered in a repeated command or some other interruptible action; occupation is set to whatever function represents this action if this is the case.

If a key has been pressed either when no action is in process or in the middle of an interruptible action, check if that key is ABORT (^A by default); if so, interrupt any current action if possible and if not add the key to the key queue with pushch. Actions will also be interrupted if the player senses a monster (checked with monster_nearby).

On some platforms, update the map on a regular basis.

Nethack: legacy for mac osx

If it is a fifteenth turn and you are clairvoyant and not in the endgame, on a one half chance generate the clairvoyance map with do_vicinity_map.

Family

After each player action, when you are in a lava trap, sink into the lava some more. After 11 to 14 actions, kill the player. Note: u.utrap is set at trap.c#line3991.

sanity_check performs some debugging checks if a wizard mode player has them enabled.

cliparound is a window system routine meant to ensure the player is centred in the screen (to the extent that is possible with the windowing system).

Assume that the player has not entered in a movement command until they actually do so.

Repeated command code, also used for interruptible actions. If nothing interrupts the action (checked with lookaround) perform the stored move or command with rhack. Rhack essentially reads the keyboard input and kicks off player actions.

If there are no repeated commands or interruptible actions, bring in the mail daemon as necessary with ckmailstatus and then take player input with rhack.

deferred_goto checks if the player has changed levels and takes appropriate action if they have.

Recalulate visible tiles if the command just entered necessiates it.

Update the map window every seven moves or turns if certain flags are set.

stop_occupation

display_gamewindows

newgame

welcome

do_positionbar

Retrieved from 'http://nethackwiki.com/mediawiki/index.php?title=Source:NetHack_3.4.3/src/allmain.c&oldid=84998'

Starting in NetHack 3.6.0, the symset option selects one of several symbol sets for display of a text-mode map for the normal dungeon. The roguesymset option does the same for the Rogue level. The file 'symbols', placed in the directory where NetHack is installed, defines the available symbol sets. The user may edit this file to change existing symbol sets or to define new symbol sets.

The symset option supersedes IBMgraphics, DECgraphics and MACgraphics. Those options are still recognized for backward compatibility. It also replaces the variables named under Custom map symbols, except that BOULDER is still accepted.

Individual symbols may be set in the options file with SYMBOLS:

  • 1Available symbol sets
  • 3Screenshots
    • 3.1Main dungeon
    • 3.2Rogue level

Nethack: Legacy For Mac Osx

Available symbol sets

Normal dungeon

Nethack: legacy for mac mojave

The following symbol sets are available for the normal dungeon and for the Rogue level:

Nethack: Legacy For Mac Osx

  • Default symbols -- plain ASCII. This set is coded directly and not defined in the symbols file.
  • DECgraphics
  • IBMgraphics
  • IBMGraphics_1 -- displays walls as solid lines and all other characters the same way as ASCII
  • IBMGraphics_2 -- rolls back certain symbols to ASCII, for consistent display with code pages other than 437. The IBMgraphics article discusses code pages at length.
  • MACgraphics
  • NHAccess -- an ASCII-compatible symbol set intended for visually impaired players.

Rogue level

In addition to the above symbol sets, the following symbol sets are available for the Rogue level:

  • RogueIBM
  • RogueEpyx
  • RogueWindows

Of these, only RogueEpyx displays in color. RogueIBM and RogueWindows are in fact identical.

The symbols file supports limiting a symbol set to the main dungeon, but no preconfigured symbol set is restricted this way.

Nethack: Legacy For Mac Catalina

File format

Nethack: Legacy For Mac Pro

The symbols file is a plain text file and can be edited by the user. Blank lines are ignored. Comments begin with '#' and continue to the end of the line. Lines consist of either the keyword 'finish' standing alone or a keyword, a colon or equals sign, and a value. Keywords are not case sensitive.

A symbol set consists of:

  • a single line with keyword 'start' or 'begin' and a value constituting the name of the symbol set
  • a single line with keyword 'handling' and a value of either 'DEC' or 'IBM'; the provided symbols file uses 'MAC' for MACgraphics, but the source code does not recognize this value
  • an optional single line with keyword 'description' and a line to be displayed in the options menu, to describe the symbol set
  • an optional single line with keyword 'color' or 'colour' and a value of any of 'true', 'yes', 'on', 'false', 'no' or 'off'; the default is to enable color in the main dungeon and disable it in the Rogue level
  • an optional single line with keyword 'restrictions' and a value of 'primary' or 'rogue'; the default is no restriction
  • zero or more lines in which the keyword is a symbol name and the value is the character to be displayed; symbols for which no line is defined will be displayed as ASCII
  • a single line with keyword 'finish' and no value

The character may be a single printable character other than backslash (which begins an escape), caret (which indicates a control character; you probably don't want this) or '#' (which begins a comment), or it may be an escape sequence. C-style escape sequences of the form '123' are interpreted as octal, 'x45' as hex and 'd123' as decimal. 'Mx' gives a 'meta' character, with the eighth bit set.

Recognized symbol names are as follows:

Default (ASCII)NameDescription
Walls, doors etc.
-S_blcornbottom left corner (of a room)
-S_brcornbottom right corner (of a room)
-S_crwallwall
-S_hwallhorizontal wall
-S_tdwallwall
-S_tlcorntop left corner (of a room)
|S_tlwallwall
-S_trcorntop right corner (of a room)
|S_trwallwall
-S_tuwallwall
|S_vwallvertical wall
#S_corrcorridor
#S_litcorrlit corridor
<space>S_stonedark part of a room or solid rock
.S_iceice
.S_roomfloor of a room
.S_ndoordoorway (with no or broken door)
+S_hcdoorclosed door (in horizontal wall)
|S_hodooropen door (in horizontal wall)
+S_vcdoorclosed door (in vertical wall)
-S_vodooropen door (in vertical wall)
>S_dnladderladder down
>S_dnstairstaircase down
<S_upladderladder up
<S_upstairstaircase up
Dungeon features
<space>S_airair
_S_altaraltar
#S_barsiron bars
#S_cloudcloud
{S_fountainfountain
|S_gravegrave
#S_hcdbridgehorizontal raised drawbridge
.S_hodbridgehorizontal lowered drawbridge
#S_vcdbridgevertical raised drawbridge
.S_vodbridgevertical lowered drawbridge
}S_lavamolten lava
#S_poisoncloudpoison cloud
#S_sinksink
S_throneopulent throne
#S_treetree
}S_poolwater
}S_waterwater
Traps
^S_anti_magic_trapanti-magic field
^S_arrow_traparrow trap
^S_bear_trapbear trap
^S_dart_trapdart trap
^S_falling_rock_trapfalling rock trap
^S_fire_trapfire trap
^S_holehole
^S_land_mineland mine
^S_level_teleporterlevel teleporter
^S_magic_portalmagic portal
^S_magic_trapmagic trap
^S_pitpit
^S_polymorph_trappolymorph trap
^S_rolling_boulder_traprolling boulder trap
^S_rust_traprust trap
^S_sleeping_gas_trapsleeping gas trap
^S_spiked_pitspiked pit
^S_squeaky_boardsqueaky board
^S_statue_trapstatue trap
^S_teleportation_trapteleportation trap
^S_trap_doortrap door
^S_vibrating_squarevibrating square
'S_webweb
Items
'S_amuletamulet
[S_armor or S_armoursuit or piece of armor
0S_balliron ball
+S_bookspellbook
`S_boulderboulder
_S_chainiron chain
$S_coinpile of coins
%S_foodpiece of food
*S_gemgem or rock
!S_potionpotion
=S_ringring
`S_rockboulder or statue
?S_scrollscroll
(S_tool(useful item (pick-axe, key, lamp...)
/S_wandwand
)S_weaponweapon
Monsters
<space>S_ghostghost
AS_angelangelic being
BS_batbat or bird
CS_centaurcentaur
DS_dragondragon
ES_elementalelemental
FS_fungusfungus or mold
GS_gnomegnome
HS_giantgiant humanoid
JS_jabberwockjabberwock
KS_kopKeystone Kop
LS_lichlich
MS_mummymummy
NS_naganaga
OS_ogreogre
PS_puddingpudding or ooze
QS_quantmechquantum mechanic
RS_rustmonstrust monster or disenchanter
SS_snakesnake
TS_trolltroll
US_umberumber hulk
VS_vampirevampire
WS_wraithwraith
XS_xornxorn
YS_yetiapelike creature
ZS_zombiezombie
aS_antant or other insect
bS_blobblob
cS_cockatricecockatrice
dS_dogdog or other canine
eS_eyeeye or sphere
fS_felinecat or other feline
gS_gremlingremlin
hS_humanoidhumanoid
iS_impimp or minor demon
jS_jellyjelly
kS_koboldkobold
lS_leprechaunleprechaun
mS_mimicmimic
]S_mimic_defmimic
nS_nymphnymph
oS_orcorc
pS_piercerpiercer
qS_quadrupedquadruped
rS_rodentrodent
sS_spiderarachnid or centipede
tS_trappertrapper or lurker above
uS_unicornunicorn or horse
vS_vortexvortex
wS_wormworm
~S_worm_taillong worm tail
xS_xanxan or other mythical/fantastic insect
yS_lightlight
zS_zrutyzruty
&S_demonmajor demon
'S_golemgolem
:S_lizardlizard
;S_eelsea monster
@S_humanhuman or elf
Effects
)S_boomleftboomerang open left
S_boomrightboomerang open right
*S_digbeamdig beam
/S_explode1explosion top left
-S_explode2explosion top center
S_explode3explosion top right
|S_explode4explosion middle left
S_explode5explosion middle center
|S_explode6explosion middle right
S_explode7explosion bottom left
-S_explode8explosion bottom center
/S_explode9explosion bottom right
!S_flashbeamflash beam
0S_ss1magic shield 1 of 4
#S_ss2magic shield 2 of 4
@S_ss3magic shield 3 of 4
*S_ss4magic shield 4 of 4
-S_sw_bcswallow bottom center
S_sw_blswallow bottom left
/S_sw_brswallow bottom right
|S_sw_mlswallow middle left
|S_sw_mrswallow middle right
-S_sw_tcswallow top center
/S_sw_tlswallow top left
S_sw_trswallow top right
-S_hbeamhorizontal beam
|S_vbeamvertical beam
/S_rslantdiagonal beam (NE/SW)
S_lslantdiagonal beam (NW/SE)
.S_venomsplash of venom

Example

The following defines the traditional IBMgraphics symbol set:

Screenshots

Main dungeon

Here are four screenshots of the same scene, using the three IBMgraphics variants and also DECgraphics.

With IBMgraphics

Note that the floor symbol is centered with respect to the @ sign on the left.

With IBMgraphics_2

The moat, the floor and the fountain are displayed with their ASCII symbols. The floor is an ASCII period, and displays low with respect to the @ sign on the left.

With IBMgraphics_1

The doors are displayed with their ASCII symbols.

With DECgraphics

Rogue level

Here are two screenshots of the same scene, using the two Rogue level symbol sets.

With RogueIBM/RogueWindows

With RogueEpyx


This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.0. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-360}} tag to the current version's tag or {{noversion}} as appropriate.

Retrieved from 'http://nethackwiki.com/mediawiki/index.php?title=Symset&oldid=125782'