diff --git a/DEVEL/code_features.txt b/DEVEL/code_features.txt new file mode 100644 index 000000000..414a51dbf --- /dev/null +++ b/DEVEL/code_features.txt @@ -0,0 +1,83 @@ +$NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ +code_features.txt + +Developer-useful info about code features, assumptions, purpose, +rationale, etc. + +============================================== +FEATURE_NOTICE Alerts for a Release + +There is a code mechanism for alterting players to a change in behavior +over prior versions of the game. + +Here's how to do it: + o Where the change in behavior needs to alert the player, + - Add an 'if statement' to invoke the alert behavior + if the condition is met, for example + if (flags.suppress_alert < FEATURE_NOTICE_VER(3.6.0)) + pline("Note: and explain the change here."); + - The example above will alert the users for a new feature + added in 3.6.0 via a one-liner via pline(), but you + could get more elaborate (just make sure it is all done + in the 'if' code block.. + +Once the user finds the alert no longer useful, or becoming +annoying, they can set the "suppress_alert" option. + - The user can only set the suppress_alert to the current + version, not future versions. That restriction is done + so that the feature can be used for new things in new + releases. + - The suppression can be done interactively mid game with + the 'O' command, or via + OPTIONS=suppress_alert:3.6.0 + in the user's config file. + +============================================== +PREFIXES_IN_USE and NOCWD_ASSUMPTIONS + +Those provide a storage mechanism for holding the paths to various different +types of files. Those paths are stored in the fqn_prefix[] array. They are a +mechanism for enabling separation of the different files that NetHack needs. + +The prefixes are added to the beginning of file names by various routines in +files.c immediately prior to opening one of the types of files that the game +uses. + +They aren't about config file options (although config file options would be +one way to set non-default values for some of the paths in the fqn_prefix[] +array). Obviously the very first path needed (now sysconfdir, previously +configdir) isn't viable for setting via config file options, but the game +still needs to hunt it down "someplace." When the "someplace" is figured +out, that place (path) would be stored in fqn_prefix[SYSCONPREFIX]. How it +gets stored in fqn_prefix[SYSCONPREFIX] is up to us as developers. + +Any of the fqn_prefix[] entries can be set somehow. It could be done in port +startup code; in options processing; in config file processing; by +translating a system environment variable such as USERPROFILE; whatever +you/we want. The point is that NOCWD_ASSUMPTIONS and PREFIXES_IN_USE are +there to ensure that there is a place to store that path information. The +code to *utilize* the information is already in files.c (see fqname()). + +There is a fqn_prefix[] entry for holding the path to each of the following: + PREFIX NAME +0 HACKPREFIX hackdir +1 LEVELPREFIX leveldir location to create level files +2 SAVEPREFIX savedir location to create/read saved games +3 BONESPREFIX bonesir location to create/read bones +4 DATAPREFIX datadir location to read data.base etc. +5 SCOREPREFIX scoredir location to read/write scorefile +6 LOCKPREFIX lockdir location to create/read lock files +7 SYSCONFPREFIX sysconfdir location to read SYSCF_FILE +8 CONFIGPREFIX configdir location to read user configuration file +9 TROUBLEPREFIX troubledir location to place panic files etc. + +To recap, they are about enabling "different paths for different things", and +separation of: +- read-only stuff from read-write stuff. +- sysadmin stuff from user-writeable stuff. +etc. + +=================== NEXT FEATURE ========================== + + + diff --git a/dat/.gitignore b/dat/.gitignore index 88e516283..1784229ab 100644 --- a/dat/.gitignore +++ b/dat/.gitignore @@ -5,6 +5,9 @@ rip.xpm pet_mark.xbm quest.dat rumors +bogusmon +engrave +epitaph x11tiles *.lev spec_levs diff --git a/dat/bogusmon.txt b/dat/bogusmon.txt new file mode 100644 index 000000000..2ec3e7fe7 --- /dev/null +++ b/dat/bogusmon.txt @@ -0,0 +1,481 @@ +# Hallucinatory monsters +# +# +# prefix codes: +# dash - female, personal name +# underscore _ female, general name +# plus + male, personal name +# vertical bar | male, general name +# equals = gender not specified, personal name + +# misc. +jumbo shrimp +giant pigmy +gnu +killer penguin +giant cockroach +giant slug +maggot +pterodactyl +tyrannosaurus rex +basilisk +beholder +nightmare +efreeti +marid +rot grub +bookworm +master lichen +shadow +hologram +jester +attorney +sleazoid +killer tomato +amazon +robot +battlemech +rhinovirus +harpy +lion-dog +rat-ant +Y2K bug +angry mariachi +arch-pedant +bluebird of happiness +cardboard golem +duct tape golem +diagonally moving grid bug +evil overlord +newsgroup troll +ninja pirate zombie robot +octarine dragon +gonzo journalist +lag monster +loan shark +possessed waffle iron +poultrygeist +stuffed raccoon puppet +viking +wee green blobbie +wereplatypus +hag of bolding +blancmange +raging nerd +spelling bee +land octopus +frog prince +pigasus +_Semigorgon +conventioneer +large microbat +small megabat +uberhulk +tofurkey ++Dudley + +# Quendor (Zork, &c.) +grue +Christmas-tree monster +luck sucker +paskald +brogmoid +dornbeast + +# Moria +Ancient Multi-Hued Dragon ++Evil Iggy + +# Rogue V5 http://rogue.rogueforge.net/vade-mecum/ +rattlesnake +ice monster +phantom +quagga +aquator +griffin +emu +kestrel +xeroc +venus flytrap + +# Wizardry +creeping coins + +# Greek legend +hydra +siren + +# Monty Python +killer bunny + +# The Princess Bride +rodent of unusual size + +# Wallace & Gromit +were-rabbit + +# "Only you can prevent forest fires! ++Smokey Bear + +# Discworld +Luggage + +# Lord of the Rings +Ent + +# Xanth +tangle tree +nickelpede +wiggle + +# Lewis Carroll +white rabbit +snark + +# Dr. Dolittle +pushmi-pullyu + +# The Smurfs +smurf + +# Star Trek +tribble +Klingon +Borg + +# Star Wars +Ewok + +# Tonari no Totoro +Totoro + +# Nausicaa +ohmu + +# Sailor Moon +youma + +# Pokemon (Meowth) +nyaasu + +# monster movies +-Godzilla ++King Kong + +# old L of SH +earthquake beast + +# Robotech +Invid + +# The Terminator +Terminator + +# Bubblegum Crisis +boomer + +# Dr. Who ("Exterminate!") +Dalek + +# HGttG +microscopic space fleet +Ravenous Bugblatter Beast of Traal + +# TMNT +teenage mutant ninja turtle + +# Usagi Yojimbo +samurai rabbit + +# Cerebus +aardvark + +# Little Shop of Horrors +=Audrey II + +# 50's rock 'n' roll +witch doctor +one-eyed one-horned flying purple people eater + +# saccharine kiddy TV ++Barney the dinosaur + +# Angband ++Morgoth + +# Babylon 5 +Vorlon + +# King Arthur +questing beast + +# Movie +Predator + +# common pest +mother-in-law + +# Actual creatures +praying mantis +beluga whale +chicken +coelacanth +star-nosed mole +lungfish +slow loris +sea cucumber +tapeworm +liger +velociraptor +corpulent porpoise + +# european cryptids +wolpertinger +elwedritsche +skvader ++Nessie +tatzelwurm +dahu + +# fictitious beasts +dropbear +wild haggis +jackalope +flying pig +hippocampus +hippogriff +kelpie + +# Unusually animate body parts +bouncing eye +floating nose +wandering eye + +# Computerese +buffer overflow +dangling pointer +walking disk drive +floating point +regex engine +netsplit +wiki +peer +COBOL + +# bugs +bohrbug +mandelbug +schroedinbug +heisenbug + +# DooM +cacodemon +scrag + +# MST3K ++Crow T. Robot + +# Items and stuff +chess pawn +chocolate pudding +ooblecks +terracotta warrior +hearse +roomba +miniature blimp +dust speck + +# DnD monster +gazebo + +# SciFi elements +gray goo +magnetic monopole +first category perpetual motion device + +# Ultima ++Lord British + +# They Might Be Giants +particle man + +# Robot Finds Kitten +kitten prospecting robot + +# Typography +guillemet +solidus +obelus + +# Their actual character +apostrophe golem +voluptuous ampersand + +# Web comics and animation ++Bob the angry flower ++Strong Bad ++Magical Trevor + +# KoL +one-winged dewinged stab-bat + +# deities +Invisible Pink Unicorn +Flying Spaghetti Monster + +# Monkey Island +three-headed monkey ++El Pollo Diablo + +# modern folklore +little green man + +# Portal +weighted Companion Cube + +# /b/ +/b/tard + +# South Park +manbearpig + +# internet memes +bonsai-kitten +tie-thulu ++Domo-kun +looooooooooooong cat +nyan cat + +# the Internet is made for cat pix +ceiling cat +basement cat +monorail cat + +# POWDER +tridude + +# Radomir Dopieralski +orcus cosmicus + +# Angband +yeek +quylthulg +Greater Hell Beast + +# Souljazz ++Vendor of Yizard + +# Dungeon Crawl Stone Soup ++Sigmund +lernaean hydra ++Ijyb ++Gloorx Vloq ++Blork the orc + +# Wil Wheaton, John Scalzi +unicorn pegasus kitten + +# Minecraft +enderman + +# Pun +wight supremacist + +# Starcraft 2 +zergling + +# Feelings +existential angst +figment of your imagination +flash of insight + +# Fish +ghoti + +# Roald Dahl +vermicious knid + +# Carcassonne +meeple + +# The Wombles +womble + +# Fraggle Rock +fraggle + +# soundex and typos of monsters +gloating eye +flush golem +martyr orc +mortar orc +acid blog +acute blob +aria elemental +aliasing priest +aligned parasite +aligned parquet +aligned proctor +baby balky dragon +baby blues dragon +baby caricature +baby crochet +baby grainy dragon +baby bong worm +baby long word +baby parable worm +barfed devil +beer wight +boor wight +brawny mold +rave spider +clue golem +bust vortex +errata elemental +elastic eel +electrocardiogram eel +fir elemental +tire elemental +flamingo sphere +fallacy golem +frizzed centaur +forest centerfold +fierceness sphere +frosted giant +geriatric snake +gnat ant +giant bath +grant beetle +grind bug +giant mango +glossy golem +gnome laureate +gnome dummy +gooier ooze +green slide +guardian nacho +hell hound pun +high purist +hairnet devil +ice trowel +killer beet +feather golem +lounge worm +mountain lymph +pager golem +pie fiend +prophylactic worm +sock mole +rogue piercer +seesawing sphere +simile mimic +moldier ant +stain vortex +scone giant +umbrella hulk +vampire mace +verbal jabberwock +water lemon +water melon +winged grizzly +yellow wight diff --git a/dat/engrave.txt b/dat/engrave.txt new file mode 100644 index 000000000..6390c3ee1 --- /dev/null +++ b/dat/engrave.txt @@ -0,0 +1,82 @@ +# Random engravings on the floor +# +Elbereth +# trap engravings +Vlad was here +ad aerarium + +# take-offs and other famous engravings +Owlbreath +Galadriel +Kilroy was here + +# Journey to the Center of the Earth +A.S. -> +<- A.S. +# Adventure +You won't get it up the steps +# Inferno +Lasciate ogni speranza o voi ch'entrate. +# Prisoner +Well Come +# So Long... +We apologize for the inconvenience. +# Thriller +See you next Wednesday +# Smokey Stover +notary sojak + +For a good time call 8?7-5309 +# Various zoos around the world +Please don't feed the animals. +# A palindrome +Madam, in Eden, I'm Adam. +# Siskel & Ebert +Two thumbs up! +# The First C Program +Hello, World! +^?MAIL +# AOL +You've got mail! +^. +# Clueless +As if! +# 200x incarnation of Dr.Who +BAD WOLF + +# Gang tag +Arooo! Werewolves of Yendor! + +# Strategy and pun +Dig for Victory here + +# Pompeii +Gaius Julius Primigenius was here. Why are you late? + +# Helpful guiding +Don't go this way +Go left ---> +<--- Go right +X marks the spot +X <--- You are here. +Here be dragons +Save now, and do your homework! +There was a hole here. It's gone now. +The Vibrating Square +This is a pit! +This is not the dungeon you are looking for. +Watch out, there's a gnome with a wand of death behind that door! + +# Misc fun +This square deliberately left blank. + +# Viking graffiti +Haermund Hardaxe carved these runes + +# Advertising +Need a light? Come visit the Minetown branch of Izchak's Lighting Store! +Snakes on the Astral Plane - Soon in a dungeon near you +You are the one millionth visitor to this place! Please wait 200 turns for your wand of wishing. + +# DnD +Warning, Exploding runes! diff --git a/dat/epitaph.txt b/dat/epitaph.txt new file mode 100644 index 000000000..58bb62228 --- /dev/null +++ b/dat/epitaph.txt @@ -0,0 +1,396 @@ +# Epitaphs for random headstones +# +# +Rest in peace +R.I.P. +Rest In Pieces +Note -- there are NO valuable items in this grave +1994-1995. The Longest-Lived Hacker Ever +The Grave of the Unknown Hacker +We weren't sure who this was, but we buried him here anyway +Sparky -- he was a very good dog +Beware of Electric Third Rail +Made in Taiwan +Og friend. Og good dude. Og died. Og now food +Beetlejuice Beetlejuice Beetlejuice +Look out below! +Please don't dig me up. I'm perfectly happy down here. -- Resident +Postman, please note forwarding address: Gehennom, Asmodeus's Fortress, fifth lemure on the left +Mary had a little lamb/Its fleece was white as snow/When Mary was in trouble/The lamb was first to go +Be careful, or this could happen to you! +Soon you'll join this fellow in hell! -- the Wizard of Yendor +Caution! This grave contains toxic waste +Sum quod eris +Here lies an Atheist, all dressed up and no place to go +Here lies Ezekiel, age 102. The good die young. +Here lies my wife: Here let her lie! Now she's at rest and so am I. +Here lies Johnny Yeast. Pardon me for not rising. +He always lied while on the earth and now he's lying in it +I made an ash of myself +Soon ripe. Soon rotten. Soon gone. But not forgotten. +Here lies the body of Jonathan Blake. Stepped on the gas instead of the brake. +Go away! +Alas fair Death, 'twas missed in life - some peace and quiet from my wife +Applaud, my friends, the comedy is finished. +At last... a nice long sleep. +Audi Partem Alteram +Basil, assaulted by bears +Burninated +Confusion will be my epitaph +Do not open until Christmas +Don't be daft, they couldn't hit an elephant at this dist- +Don't forget to stop and smell the roses +Don't let this happen to you! +Dulce et decorum est pro patria mori +Et in Arcadia ego +Fatty and skinny went to bed. Fatty rolled over and skinny was dead. Skinny Smith 1983-2000. +Finally I am becoming stupider no more +Follow me to hell +...for famous men have the whole earth as their memorial +Game over, man. Game over. +Go away! I'm trying to take a nap in here! Bloody adventurers... +Gone fishin' +Good night, sweet prince: And flights of angels sing thee to thy rest! +Go Team Ant! +He farmed his way here +Here lies a programmer. Killed by a fatal error. +Here lies Bob - decided to try an acid blob +Here lies Dudley, killed by another %&#@#& newt. +Here lies Gregg, choked on an egg +Here lies Lies. It's True +Here lies The Lady's maid, died of a Vorpal Blade +Here lies the left foot of Jack, killed by a land mine. Let us know if you find any more of him +He waited too long +I'd rather be sailing +If a man's deeds do not outlive him, of what value is a mark in stone? +I'm gonna make it! +I took both pills! +I will survive! +Killed by a black dragon -- This grave is empty +Let me out of here! +Lookin' good, Medusa. +Mrs. Smith, choked on an apple. She left behind grieving husband, daughter, and granddaughter. +Nobody believed her when she said her feet were killing her +No! I don't want to see my damn conduct! +One corpse, sans head +On the whole, I'd rather be in Minetown +On vacation +Oops. +Out to Lunch +SOLD +Someone set us up the bomb! +Take my stuff, I don't need it anymore +Taking a year dead for tax reasons +The reports of my demise are completely accurate +(This space for sale) +This was actually just a pit, but since there was a corpse, we filled it +This way to the crypt +Tu quoque, Brute? +VACANCY +Welcome! +Wish you were here! +Yea, it got me too +You should see the other guy +...and they made me engrave my own headstone too! +...but the blood has stopped pumping and I am left to decay... + +A masochist is never satisfied. +Ach, 'twas a wee monster in the loch +Adapt. Enjoy. Survive. +Adventure, hah! Excitement, hah! +After all, what are friends for... +After this, nothing will shock me +After three days, fish and guests stink +Age and treachery will always overcome youth and skill +Ageing is not so bad. The real killer is when you stop. +Ain't I a stinker? +Algernon +All else failed... +All hail RNG +All right, we'll call it a draw! +All's well that end well +Alone at last! +Always attack a floating eye from behind! +Am I having fun yet? +And I can still crawl, I'm not dead yet! +And all I wanted was a free lunch +And all of the signs were right there on your face +And don't give me that innocent look either! +And everyone died. Boo hoo hoo. +And here I go again... +And nobody cares until somebody famous dies... +And so it ends? +And so... it begins. +And sometimes the bear eats you. +And then 'e nailed me 'ead to the floor! +And they said it couldn't be done! +And what do I look like? The living? +And yes, it was ALL his fault! +And you said it was pretty here... +Another lost soul +Any day above ground is a good day! +Any more of this and I'll die of a stroke before I'm 30. +Anybody seen my head? +Anyone for deathmatch? +Anything for a change. +Anything that kills you makes you ... well, dead +Anything worth doing is worth overdoing. +Are unicorns supposedly peaceful if you're a virgin? Hah! +Are we all being disintegrated, or is it just me? +At least I'm good at something +Attempted suicide +Auri sacra fames +Auribus teneo lupum +Be prepared +Beauty survives +Been Here. Now Gone. Had a Good Time. +Been through Hell, eh? What did you bring me? +Beg your pardon, didn't recognize you, I've changed a lot. +Being dead builds character +Beloved daughter, a treasure, buried here. +Best friends come and go... Mine just die. +Better be dead than a fat slave +Better luck next time +Beware of Discordians bearing answers +Beware the ... +Bloody Hell... +Bloody barbarians! +Blown upward out of sight: He sought the leak by candlelight +Brains... Brains... Fresh human brains... +Buried the cat. Took an hour. Damn thing kept fighting. +But I disarmed the trap! +CONNECT 1964 - NO CARRIER 1994 +Call me if you need my phone number! +Can YOU fly? +Can you believe that thing is STILL moving? +Can you come up with some better ending for this? +Can you feel anything when I do this? +Can you give me mouth to mouth, you just took my breath away. +Can't I just have a LITTLE peril? +Can't eat, can't sleep, had to bury the husband here. +Can't you hit me?! +Chaos, panic and disorder. My work here is done. +Check enclosed. +Check this out! It's my brain! +Chivalry is only reasonably dead +Coffin for sale. Lifetime guarantee. +Come Monday, I'll be all right. +Come and see the violence inherent in the system +Come back here! I'll bite your bloody knees off! +Commodore Business Machines, Inc. Died for our sins. +Complain to one who can help you +Confess my sins to god? Which one? +Confusion will be my epitaph +Cooties? Ain't no cooties on me! +Could somebody get this noose off me? +Could you check again? My name MUST be there. +Could you please take a breath mint? +Couldn't I be sedated for this? +Courage is looking at your setbacks with serenity +Cover me, I'm going in! +Crash course in brain surgery +Cross my fingers for me. +Curse god and die +Cut to fit +De'Ath +Dead Again? Pardon me for not getting it right the first time! +Dead and loving every moment! +Dear wife of mine. Died of a broken heart, after I took it out of her. +Don't tread on me! +Dragon? What dragon? +Drawn and quartered +Either I'm dead or my watch has stopped. +Eliza -- Was I really alive, or did I just think I was? +Elvis +Enter not into the path of the wicked +Eris? I don't need Eris +Eternal Damnation, Come and stay a long while! +Even The Dead pay taxes (and they aren't Grateful). +Even a tomb stone will say good things when you're down! +Ever notice that live is evil backwards? +Every day is starting to look like Monday +Every day, in every way, I am getting better and better. +Every survival kit should include a sense of humor +Evil I did dwell; lewd did I live +Ex post fucto +Excellent day to have a rotten day. +Excuse me for not standing up. +Experience isn't everything. First, You've got to survive +First shalt thou pull out the Holy Pin +For a Breath, I Tarry... +For recreational use only. +For sale: One soul, slightly used. Asking for 3 wishes. +For some moments in life, there are no words. +Forget Disney World, I'm going to Hell! +Forget about the dog, Beware of my wife. +Funeral - Real fun. +Gawd, it's depressing in here, isn't it? +Genuine Exploding Gravestone. (c)Acme Gravestones Inc. +Get back here! I'm not finished yet... +Go ahead, I dare you to! +Go ahead, it's either you or him. +Goldilocks -- This casket is just right +Gone But Not Forgotten +Gone Underground For Good +Gone away owin' more than he could pay. +Gone, but not forgiven +Got a life. Didn't know what to do with it. +Grave? But I was cremated! +Greetings from Hell - Wish you were here. +HELP! It's dark in here... Oh, my eyes are closed - sorry +Ha! I NEVER pay income tax! +Have you come to raise the dead? +Having a good time can be deadly. +Having a great time. Where am I exactly?? +He died of the flux. +He died today... May we rest in peace! +He got the upside, I got the downside. +He lost his face when he was beheaded. +He missed me first. +He's not dead, he just smells that way. +Help! I've fallen and I can't get up! +Help, I can't wake up! +Here lies Pinocchio +Here lies the body of John Round. Lost at sea and never found. +Here there be dragons +Hey, I didn't write this stuff! +Hodie mihi, cras tibi +Hold my calls +Home Sweet Hell +Humpty Dumpty, a Bad Egg. He was pushed off the wall. +I KNEW this would happen if I lived long enough. +I TOLD you I was sick! +I ain't broke but I am badly bent. +I ain't old. I'm chronologically advantaged. +I am NOT a vampire. I just like to bite..nibble, really! +I am here. Wish you were fine. +I am not dead yet, but watch for further reports. +I believe them bones are me. +I broke his brain. +I can feel it. My mind. It's going. I can feel it. +I can't go to Hell. They're afraid I'm gonna take over! +I can't go to hell, they don't want me. +I didn't believe in reincarnation the last time, either. +I didn't mean it when I said 'Bite me' +I died laughing +I disbelieved in reincarnation in my last life, too. +I hacked myself to death +I have all the time in the world +I knew I'd find a use for this gravestone! +I know my mind. And it's around here someplace. +I lied! I'll never be alright! +I like it better in the dark. +I like to be here when I can. +I may rise but I refuse to shine. +I never get any either. +I said hit HIM with the fireball, not me! +I told you I would never say goodbye. +I used to be amusing. Now I'm just disgusting. +I used up all my sick days, so now I'm calling in dead. +I was killed by +I was somebody. Who, is no business of yours. +I will not go quietly. +I'd give you a piece of my mind... but I can't find it. +I'd rather be breathing +I'll be back! +I'll be mellow when I'm dead. For now, let's PARTY! +I'm doing this only for tax purposes. +I'm not afraid of Death! What's he gonna do? Kill me? +I'm not getting enough money, so I'm not going to engrave anything useful here. +I'm not saying anything. +I'm weeth stupeed ---> +If you thought you had problems... +Ignorance kills daily. +Ignore me... I'm just here for my looks! +Ilene Toofar -- Fell off a cliff +Is that all? +Is there life before Death? +Is this a joke, or a grave matter? +It happens sometimes. People just explode. +It must be Thursday. I never could get the hang of Thursdays. +It wasn't a fair fight +It wasn't so easy. +It's Loot, Pillage and THEN Burn... +Just doing my job here +Killed by diarrhea of mouth and constipation of brain. +Let her RIP +Let it be; I am dead. +Let's play Hide the Corpse +Life is NOT a dream +Madge Ination -- It wasn't all in my head +Meet me in Heaven +Move on, there's nothing to see here. +Mr. Flintstone -- Yabba-dabba-done +My heart is not in this +No one ever died from it +No, you want room 12A, next door. +Nope. No trap on that chest. I swear. +Not again! +Not every soil can bear all things +Now I have a life +Now I lay thee down to sleep... wanna join me? +OK, here is a question: Where ARE your tanlines? +Obesa Cantavit +Oh! An untimely death. +Oh, by the way, how was my funeral? +Oh, honey..I missed you! She said, and fired again. +Ok, so the light does go off. Now let me out of here. +One stone brain +Ooh! Somebody STOP me! +Oops! +Out for the night. Leave a message. +Ow! Do that again! +Pardon my dust. +Part of me still works. +Please, not in front of those orcs! +Prepare to meet me in Heaven +R2D2 -- Rest, Tin Piece +Relax. Nothing ever happens on the first level. +Res omnia mea culpa est +Rest In Pieces +Rest, rest, perturbed spirit. +Rip Torn +She always said her feet were killing her but nobody believed her. +She died of a chest cold. +So let it be written, so let it be done! +So then I says, How do I know you're the real angel of death? +Some patients insist on dying. +Some people have it dead easy, don't they? +Some things are better left buried. +Sure, trust me, I'm a lawyer... +Thank God I wore my corset, because I think my sides have split. +That is all +The Gods DO have a sense of humor: I'm living proof! +The frog's dead. He Kermitted suicide. +This dungeon is a pushover +This elevator doesn't go to Heaven +This gravestone is shareware. To register, please send me 10 zorkmids +This gravestone provided by The Yendorian Grave Services Inc. +This is not an important part of my life. +This one's on me. +This side up +Tim Burr -- Smashed by a tree +Tone it down a bit, I'm trying to get some rest here. +Virtually Alive +We Will Meet Again. +Weep not, he is at rest +Welcome to Dante's. What level please? +Well, at least they listened to my sermon... +Went to be an angel. +What are you doing over there? +What are you smiling at? +What can you say, Death's got appeal...! +What health care? +What pit? +When the gods want to punish you, they answer your prayers. +Where e'er you be let your wind go free. Keeping it in was the death of me! +Where's my refund? +Will let you know for sure in a day or two... +Wizards are wimps +Worms at work, do not disturb! +Would you mind moving a bit? I'm short of breath down here. +Would you quit being evil over my shoulder? +Ya really had me going baby, but now I'm gone. +Yes Dear, just a few more minutes... +You said it wasn't poisonous! +You set my heart aflame. You gave me heartburn. diff --git a/dat/history b/dat/history index b97c99039..0e15a079c 100644 --- a/dat/history +++ b/dat/history @@ -1,4 +1,4 @@ -NetHack History file for release 3.4 +NetHack History file for release 3.6 Behold, mortal, the origins of NetHack... @@ -120,7 +120,6 @@ publicly available web-site listing all the bugs that had been discovered. Despite that constantly growing bug list, 3.3 proved stable enough to last for more than a year and a half. - The 3.4 development team initially consisted of Michael Allison, Ken Arromdee, David Cohrs, Jessie Collet, Kevin Hugo, Ken Lorber, Dean Luick, Pat Rankin, Mike Stephenson, Janet Walz, and Paul Winner, with Warwick Allison joining @@ -150,7 +149,69 @@ Amiga port of 3.5 after Janne Salmijarvi resurrected it for 3.3.1. Christian `Marvin' Bressler maintained 3.5 for the Atari after he resurrected it for 3.3.1. -There is a NetHack web site maintained by Ken Lorber at http://www.nethack.org/. +The release of NetHack 3.4.3 in December 2003 marked the beginning of a +long release hiatus. 3.4.3 proved to be a remarkably stable version that +provided continued enjoyment by the community for more than a decade. The +devteam slowly and quietly continued to work on the game behind the scenes +during the tenure of 3.4.3. It was during that same period that several new +variants emerged within the NetHack community. Notably sporkhack by +Derek S. Ray, unnethack by Patric Mueller, nitrohack and its successors +originally by Daniel Thaler and then by Alex Smith, and +Dynahack by Tung Nguyen. Some of those variants continue to be developed, +maintained, and enjoyed by the community to this day. + +In September 2014, an interim snapshot of the code under development was +released publicly by other parties. Since that code was a work-in-progress +and had not gone through a period of debugging, it was decided that the +version numbers present on that code snapshot would be retired and never +used in an official NetHack release. An announcement was posted on the +devteam's official nethack.org website to that effect, stating that there +would never be a 3.4.4, 3.5, or 3.5.0 official release version. + +In January 2015, preparation began for the release of NetHack 3.6. + +At the beginning of development for what would eventually get released +as 3.6.0, the development team consisted of Michael Allison, +Warwick Allison, Ken Arromdee, David Cohrs, Jessie Collet, Ken Lorber, +Dean Luick, Pat Rankin, Mike Stephenson, Janet Walz, and Paul Winner. + +Leading up to the release of 3.6.0 in early 2015, new members Sean Hunt, +Pasi Kallinen, and Derek S. Ray joined the NetHack development team. + +3.6.0 - insert apprpriate description of 3.6.0 here + +The development team, as well as Steve VanDevender and Kevin Smolkowski +ensured that NetHack 3.6.0 continued to operate on various Unix flavors +as well as maintaining the X11 interface. + +Ken Lorber, Haoyang Wang, Pat Rankin, and Dean Luick maintained the port +of NetHack 3.6.0 for Mac. + +Michael Allison, Derek S. Ray, Yitzhak Sapir, Alex Kompel, and David Cohrs +maintained the port of NetHack 3.6.0 for Microsoft Windows. + +Jeff Bailey created and maintained a port of NetHack 3.6.0 for Chrome. + +Alex Kompel maintained a port of NetHack 3.6.0 to Windows Phone. ? + +This version of the game is special in a particular way. Near the end of +the development of 3.6, one of the significant inspirations for many of the +humorous and fun features found in the game, author Terry Pratchett, +passed away. This version of the game is dedicated to + + +An official NetHack web site continues to be maintained by Ken Lorber at +http://www.nethack.org/. + +-- +SHOUT-OUTS + +The devteam would like to give a special "shout-out" to thank the generous +people primarily responsible for the public NetHack servers available for +playing the game at nethack.alt.org and devnull.net. In addition to providing +a way for the public to play a game of NetHack from almost anywhere, they +have hosted annual NetHack tournaments for many, many years. + write up something for Robin, M. Drew Streib, Pasi Kallinen - - - - - - - - - - diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 250b09d85..5d9f4707a 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1089,6 +1089,7 @@ change command X to twoweapon toggle pressing @ when cursor positioning moves cursor on top of hero pressing # when cursor positioning toggles automatic description of features under the cursor +cursor positioning ignores uninteresting dungeon features Platform- and/or Interface-Specific New Features @@ -1125,6 +1126,7 @@ adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray paranoid_confirm:pray y to confirm #pray; supersedes prayconfirm paranoid_confirm:Remove always pick from inventory for 'R' and 'T' adopt/adapt/improve Dungeon Overview +Aardvark Joe's Extended Logfile Code Cleanup and Reorganization diff --git a/doc/makedefs.6 b/doc/makedefs.6 index 7b850108c..61bd7c741 100644 --- a/doc/makedefs.6 +++ b/doc/makedefs.6 @@ -105,6 +105,15 @@ Generate the file. .br .TP +.B -s +Generate the +.I bogusmon +, +.I engrave +and +.IR epitaph files. +.br +.TP .B -h Generate the .B oracles diff --git a/include/config.h b/include/config.h index 930bd549c..d8c96af14 100644 --- a/include/config.h +++ b/include/config.h @@ -187,6 +187,7 @@ #endif #define LOGFILE "logfile" /* larger file for debugging purposes */ +#define XLOGFILE "xlogfile" /* even larger logfile */ #define NEWS "news" /* the file containing the latest hack news */ #define PANICLOG "paniclog" /* log of panic and impossible events */ diff --git a/include/decl.h b/include/decl.h index 4591226e4..15191842e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -67,6 +67,8 @@ E struct dgn_topology { /* special dungeon levels for speed */ xchar d_mines_dnum, d_quest_dnum; d_level d_qstart_level, d_qlocate_level, d_nemesis_level; d_level d_knox_level; + d_level d_mineend_level; + d_level d_sokoend_level; } dungeon_topology; /* macros for accesing the dungeon levels by their old names */ #define oracle_level (dungeon_topology.d_oracle_level) @@ -97,6 +99,8 @@ E struct dgn_topology { /* special dungeon levels for speed */ #define qlocate_level (dungeon_topology.d_qlocate_level) #define nemesis_level (dungeon_topology.d_nemesis_level) #define knox_level (dungeon_topology.d_knox_level) +#define mineend_level (dungeon_topology.d_mineend_level) +#define sokoend_level (dungeon_topology.d_sokoend_level) E NEARDATA stairway dnstair, upstair; /* stairs up and down */ #define xdnstair (dnstair.sx) @@ -180,6 +184,7 @@ E NEARDATA struct kinfo { E long done_money; E const char *configfile; +E char lastconfigfile[BUFSZ]; /* used for messaging */ E NEARDATA char plname[PL_NSIZ]; E NEARDATA char dogname[]; E NEARDATA char catname[]; @@ -240,6 +245,7 @@ E NEARDATA anything zeroany; /* init'd and defined in decl.c */ #include "you.h" E NEARDATA struct you u; E NEARDATA time_t ubirthday; +E NEARDATA struct u_realtime urealtime; #include "onames.h" #ifndef PM_H /* (pm.h has already been included via youprop.h) */ @@ -357,9 +363,10 @@ E const char * const monexplain[], invisexplain[], * const oclass_names[]; #define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */ #define SCOREPREFIX 5 #define LOCKPREFIX 6 -#define CONFIGPREFIX 7 -#define TROUBLEPREFIX 8 -#define PREFIX_COUNT 9 +#define SYSCONFPREFIX 7 +#define CONFIGPREFIX 8 +#define TROUBLEPREFIX 9 +#define PREFIX_COUNT 10 /* used in files.c; xxconf.h can override if needed */ # ifndef FQN_MAX_FILENAME #define FQN_MAX_FILENAME 512 diff --git a/include/dungeon.h b/include/dungeon.h index f2bf75ef6..3607649b0 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -122,6 +122,8 @@ typedef struct branch { #define Is_qlocate(x) (on_level(x, &qlocate_level)) #define Is_nemesis(x) (on_level(x, &nemesis_level)) #define Is_knox(x) (on_level(x, &knox_level)) +#define Is_mineend_level(x) (on_level(x, &mineend_level)) +#define Is_sokoend_level(x) (on_level(x, &sokoend_level)) #define In_sokoban(x) ((x)->dnum == sokoban_dnum) #define Inhell In_hell(&u.uz) /* now gehennom */ diff --git a/include/extern.h b/include/extern.h index d7d1a3d57..a31c3f0f8 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 extern.h $NHDT-Date: 1426496453 2015/03/16 09:00:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.407 $ */ +/* NetHack 3.5 extern.h $NHDT-Date: 1426966688 2015/03/21 19:38:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */ /* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -26,6 +26,7 @@ E void NDECL(stop_occupation); E void NDECL(display_gamewindows); E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); +E time_t NDECL(get_realtime); /* ### apply.c ### */ @@ -386,7 +387,7 @@ E char *FDECL(Adjmonnam, (struct monst *,const char *)); E char *FDECL(Amonnam, (struct monst *)); E char *FDECL(a_monnam, (struct monst *)); E char *FDECL(distant_monnam, (struct monst *,int,char *)); -E const char *NDECL(rndmonnam); +E char *FDECL(rndmonnam, (char *)); E const char *FDECL(hcolor, (const char *)); E const char *NDECL(rndcolor); E const char *NDECL(roguename); @@ -738,6 +739,9 @@ E void FDECL(free_saved_games, (char**)); #ifdef SELF_RECOVER E boolean NDECL(recover_savefile); #endif +#ifdef SYSCF_FILE +E void NDECL(assure_syscf_file); +#endif #ifdef HOLD_LOCKFILE_OPEN E void NDECL(really_close); #endif @@ -812,6 +816,7 @@ E void FDECL(copynchars, (char *,const char *,int)); E char FDECL(chrcasecpy, (int,int)); E char *FDECL(strcasecpy, (char *,const char *)); E char *FDECL(s_suffix, (const char *)); +E char *FDECL(ing_suffix, (const char *)); E char *FDECL(xcrypt, (const char *,char *)); E boolean FDECL(onlyspace, (const char *)); E char *FDECL(tabexpand, (char *)); @@ -1174,7 +1179,7 @@ E struct obj *FDECL(mkobj_at, (CHAR_P,int,int,BOOLEAN_P)); E struct obj *FDECL(mksobj_at, (int,int,int,BOOLEAN_P,BOOLEAN_P)); E struct obj *FDECL(mkobj, (CHAR_P,BOOLEAN_P)); E int NDECL(rndmonnum); -E boolean FDECL(bogon_is_pname, (const char *)); +E boolean FDECL(bogon_is_pname, (CHAR_P)); E struct obj *FDECL(splitobj, (struct obj *,long)); E void FDECL(replace_object, (struct obj *,struct obj *)); E void FDECL(bill_dummy_object, (struct obj *)); @@ -1931,6 +1936,7 @@ E const char *NDECL(Goodbye); /* ### rumors.c ### */ E char *FDECL(getrumor, (int,char *, BOOLEAN_P)); +E char *FDECL(get_rnd_text, (const char *, char *)); E void FDECL(outrumor, (int,int)); E void FDECL(outoracle, (BOOLEAN_P, BOOLEAN_P)); E void FDECL(save_oracles, (int,int)); @@ -2286,9 +2292,6 @@ E void NDECL(port_help); E void FDECL(sethanguphandler, (void (*)(int))); E boolean NDECL(authorize_wizard_mode); E boolean FDECL(check_user_string, (char *)); -# ifdef SYSCF_FILE -E void NDECL(assure_syscf_file); -# endif #endif /* UNIX */ /* ### unixtty.c ### */ diff --git a/include/global.h b/include/global.h index 6179409bb..a67066d64 100644 --- a/include/global.h +++ b/include/global.h @@ -30,6 +30,9 @@ #define OPTIONFILE "opthelp" /* file explaining runtime options */ #define OPTIONS_USED "options" /* compile-time options, for #version */ #define SYMBOLS "symbols" /* replacement symbol sets */ +#define EPITAPHFILE "epitaph" /* random epitaphs on graves */ +#define ENGRAVEFILE "engrave" /* random engravings on the floor */ +#define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */ #define LEV_EXT ".lev" /* extension for special level files */ diff --git a/include/ntconf.h b/include/ntconf.h index 95a506635..b51459151 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 ntconf.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 ntconf.h $NHDT-Date: 1426966690 2015/03/21 19:38:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */ /* NetHack 3.5 ntconf.h $Date: 2012/01/15 19:11:38 $ $Revision: 1.35 $ */ /* SCCS Id: @(#)ntconf.h 3.5 2002/03/10 */ /* Copyright (c) NetHack PC Development Team 1993, 1994. */ @@ -25,6 +25,9 @@ #define SELF_RECOVER /* Allow the game itself to recover from an aborted game */ +#define SYSCF /* Use a global configuration */ +#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */ + #define USER_SOUNDS #ifdef WIN32CON diff --git a/include/obj.h b/include/obj.h index fe43d0878..7af927919 100644 --- a/include/obj.h +++ b/include/obj.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 obj.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 obj.h $NHDT-Date: 1426949157 2015/03/21 14:45:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.36 $ */ /* NetHack 3.5 obj.h $Date: 2012/01/10 17:47:16 $ $Revision: 1.31 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -107,8 +107,10 @@ struct obj { int corpsenm; /* type of corpse is mons[corpsenm] */ #define leashmon corpsenm /* gets m_id of attached pet */ -#define spestudied corpsenm /* # of times a spellbook has been studied */ #define fromsink corpsenm /* a potion from a sink */ +#define record_achieve_special corpsenm + int usecount; /* overloaded for various things that tally */ +#define spestudied usecount /* # of times a spellbook has been studied */ unsigned oeaten; /* nutrition left in food, if partly eaten */ long age; /* creation date */ long owornmask; diff --git a/include/patchlevel.h b/include/patchlevel.h index 00411a2c2..eab90e89f 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 patchlevel.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 patchlevel.h $NHDT-Date: 1426948844 2015/03/21 14:40:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.95 $ */ /* NetHack 3.5 patchlevel.h $Date: 2012/04/14 08:31:03 $ $Revision: 1.93 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,10 +14,10 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 56 +#define EDITLEVEL 58 #define COPYRIGHT_BANNER_A \ -"NetHack, Copyright 1985-2012" +"NetHack, Copyright 1985-2015" #define COPYRIGHT_BANNER_B \ " By Stichting Mathematisch Centrum and M. Stephenson." /* COPYRIGHT_BANNER_C is generated by makedefs into date.h */ diff --git a/include/you.h b/include/you.h index 0c343b3c4..0fc5c6073 100644 --- a/include/you.h +++ b/include/you.h @@ -53,6 +53,26 @@ struct u_event { Bitfield(ascended,1); /* has offered the Amulet */ }; +struct u_achieve { + Bitfield(amulet,1); /* touched Amulet */ + Bitfield(bell,1); /* touched Bell */ + Bitfield(book,1); /* touched Book */ + Bitfield(menorah,1); /* touched Candelabrum */ + Bitfield(enter_gehennom,1); /* entered Gehennom (or Valley) by any means */ + Bitfield(ascended,1); /* not quite the same as u.uevent.ascended */ + Bitfield(mines_luckstone,1); /* got a luckstone at end of mines */ + Bitfield(finish_sokoban,1); /* obtained the sokoban prize */ + + Bitfield(killed_medusa,1); +}; + +struct u_realtime { + time_t realtime; /* actual playing time up until the last restore */ + time_t restored; /* time the game was started or restored */ + time_t endtime; +}; + + /* KMH, conduct -- * These are voluntary challenges. Each field denotes the number of * times a challenge has been violated. @@ -306,6 +326,7 @@ struct you { /* 1 free bit! */ unsigned udg_cnt; /* how long you have been demigod */ + struct u_achieve uachieve; /* achievements */ struct u_event uevent; /* certain events have happened */ struct u_have uhave; /* you're carrying special objects */ struct u_conduct uconduct; /* KMH, conduct */ diff --git a/src/allmain.c b/src/allmain.c index 2bb1c4240..45c319037 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -533,6 +533,13 @@ newgame() #endif program_state.something_worth_saving++; /* useful data now exists */ + urealtime.realtime = (time_t)0L; +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *)&urealtime.restored); +#else + (void) time(&urealtime.restored); +#endif + /* Success! */ welcome(TRUE); return; diff --git a/src/decl.c b/src/decl.c index 6c83f0f14..75203c056 100644 --- a/src/decl.c +++ b/src/decl.c @@ -136,6 +136,7 @@ NEARDATA struct sysflag sysflags = DUMMY; NEARDATA struct instance_flags iflags = DUMMY; NEARDATA struct you u = DUMMY; NEARDATA time_t ubirthday = DUMMY; +NEARDATA struct u_realtime urealtime = DUMMY; schar lastseentyp[COLNO][ROWNO] = {DUMMY}; /* last seen/touched dungeon typ */ @@ -267,12 +268,14 @@ char toplines[TBUFSZ]; struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 }; /* AS,AE, LI,CO */ char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0, - (char *)0, (char *)0, (char *)0, (char *)0, (char *)0 }; + (char *)0, (char *)0, (char *)0, (char *)0, + (char *)0 , (char *)0 }; #ifdef PREFIXES_IN_USE char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir", "bonesdir", "datadir", "scoredir", - "lockdir", "configdir", "troubledir" }; + "lockdir", "sysconfdir", "configdir", + "troubledir" }; #endif NEARDATA struct savefile_info sfcap = { diff --git a/src/do.c b/src/do.c index 41e25a1b0..b387752d6 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 do.c $NHDT-Date: 1426497723 2015/03/16 09:22:03 $ $NHDT-Branch: H3724 $:$NHDT-Revision: 1.109 $ */ +/* NetHack 3.5 do.c $NHDT-Date: 1426991040 2015/03/22 02:24:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */ /* NetHack 3.5 do.c $Date: 2014/11/18 03:10:39 $ $Revision: 1.101 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1014,15 +1014,18 @@ boolean at_stairs, falling, portal; /* If you have the amulet and are trying to get out of Gehennom, going * up a set of stairs sometimes does some very strange things! - * Biased against law and towards chaos, but not nearly as strongly - * as it used to be (prior to 3.2.0). - * Odds: old new - * "up" L N C "up" L N C - * +1 75.0 75.0 75.0 +1 75.0 75.0 75.0 - * 0 0.0 12.5 25.0 0 6.25 8.33 12.5 - * -1 8.33 4.17 0.0 -1 6.25 8.33 12.5 - * -2 8.33 4.17 0.0 -2 6.25 8.33 0.0 - * -3 8.33 4.17 0.0 -3 6.25 0.0 0.0 + * Biased against law and towards chaos. (The chance to be sent + * down multiple levels when attempting to go up are significantly + * less than the corresponding comment in older versions indicated + * due to overlooking the effect of the call to assign_rnd_lvl().) + * + * Odds for making it to the next level up, or of being sent down: + * "up" L N C + * +1 75.0 75.0 75.0 + * 0 6.25 8.33 12.5 + * -1 11.46 12.50 12.5 + * -2 5.21 4.17 0.0 + * -3 2.08 0.0 0.0 */ if (Inhell && up && u.uhave.amulet && !newdungeon && !portal && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)-3)) { @@ -1321,6 +1324,7 @@ boolean at_stairs, falling, portal; #endif You_hear("groans and moans everywhere."); } else pline("It is hot here. You smell smoke..."); + u.uachieve.enter_gehennom = 1; } /* in case we've managed to bypass the Valley's stairway down */ if (Inhell && !Is_valley(&u.uz)) u.uevent.gehennom_entered = 1; diff --git a/src/do_name.c b/src/do_name.c index 37daffbc4..0f837c9d4 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -204,9 +204,25 @@ const char *goal; lo_x = (pass == 0 && ty == lo_y) ? cx + 1 : 1; hi_x = (pass == 1 && ty == hi_y) ? cx : COLNO - 1; for (tx = lo_x; tx <= hi_x; tx++) { - k = levl[tx][ty].glyph; + /* look at dungeon feature, not at user-visible glyph */ + k = back_to_glyph(tx,ty); + /* uninteresting background glyph */ if (glyph_is_cmap(k) && - matching[glyph_to_cmap(k)]) { + (IS_DOOR(levl[tx][ty].typ) || + glyph_to_cmap(k) == S_room || + glyph_to_cmap(k) == S_corr || + glyph_to_cmap(k) == S_litcorr)) { + /* what the hero remembers to be at tx,ty */ + k = glyph_at(tx, ty); + } + if (glyph_is_cmap(k) && + matching[glyph_to_cmap(k)] && + levl[tx][ty].seenv && + (!IS_WALL(levl[tx][ty].typ)) && + (levl[tx][ty].typ != SDOOR) && + glyph_to_cmap(k) != S_room && + glyph_to_cmap(k) != S_corr && + glyph_to_cmap(k) != S_litcorr) { cx = tx, cy = ty; if (msg_given) { clear_nhwindow(WIN_MESSAGE); @@ -793,10 +809,10 @@ boolean called; /* Put the actual monster name or type into the buffer now */ /* Be sure to remember whether the buffer starts with a name */ if (do_hallu) { - const char *rname = rndmonnam(); - + char rnamecode; + char *rname = rndmonnam(&rnamecode); Strcat(buf, rname); - name_at_start = bogon_is_pname(rname); + name_at_start = bogon_is_pname(rnamecode); } else if (has_mname(mtmp)) { char *name = MNAME(mtmp); @@ -990,113 +1006,44 @@ char *outbuf; return outbuf; } -/* - * Name prefix codes (same as shknam.c): - * dash - female, personal name - * underscore _ female, general name - * plus + male, personal name - * vertical bar | male, general name - * equals = gender not specified, personal name - */ - -static const char * const bogusmons[] = { - "jumbo shrimp", "giant pigmy", "gnu", "killer penguin", - "giant cockroach", "giant slug", "maggot", "pterodactyl", - "tyrannosaurus rex", "basilisk", "beholder", "nightmare", - "efreeti", "marid", "rot grub", "bookworm", "master lichen", - "shadow", "hologram", "jester", "attorney", "sleazoid", - "killer tomato", "amazon", "robot", "battlemech", - "rhinovirus", "harpy", "lion-dog", "rat-ant", "Y2K bug", - /* misc. */ - "grue", "Christmas-tree monster", "luck sucker", "paskald", - "brogmoid", "dornbeast", /* Quendor (Zork, &c.) */ - "Ancient Multi-Hued Dragon", "+Evil Iggy", - /* Moria */ - "emu", "kestrel", "xeroc", "venus flytrap", - /* Rogue */ - "creeping coins", /* Wizardry */ - "hydra", "siren", /* Greek legend */ - "killer bunny", /* Monty Python */ - "rodent of unusual size", /* The Princess Bride */ - "were-rabbit", /* Wallace & Gromit */ - "+Smokey Bear", /* "Only you can prevent forest fires!" */ - "Luggage", /* Discworld */ - "Ent", /* Lord of the Rings */ - "tangle tree", "nickelpede", "wiggle", /* Xanth */ - "white rabbit", "snark", /* Lewis Carroll */ - "pushmi-pullyu", /* Dr. Dolittle */ - "smurf", /* The Smurfs */ - "tribble", "Klingon", "Borg", /* Star Trek */ - "Ewok", /* Star Wars */ - "Totoro", /* Tonari no Totoro */ - "ohmu", /* Nausicaa */ - "youma", /* Sailor Moon */ - "nyaasu", /* Pokemon (Meowth) */ - "-Godzilla", "+King Kong", /* monster movies */ - "earthquake beast", /* old L of SH */ - "Invid", /* Robotech */ - "Terminator", /* The Terminator */ - "boomer", /* Bubblegum Crisis */ - "Dalek", /* Dr. Who ("Exterminate!") */ - "microscopic space fleet", "Ravenous Bugblatter Beast of Traal", - /* HGttG */ - "teenage mutant ninja turtle", /* TMNT */ - "samurai rabbit", /* Usagi Yojimbo */ - "aardvark", /* Cerebus */ - "=Audrey II", /* Little Shop of Horrors */ - "witch doctor", "one-eyed one-horned flying purple people eater", - /* 50's rock 'n' roll */ - "+Barney the dinosaur", /* saccharine kiddy TV */ - "+Morgoth", /* Angband */ - "Vorlon", /* Babylon 5 */ - "questing beast", /* King Arthur */ - "Predator", /* Movie */ - "mother-in-law" /* common pest */ -}; - - +#define BOGUSMONSIZE 100 /* arbitrary */ /* return a random monster name, for hallucination */ -const char * -rndmonnam() +char * +rndmonnam(code) +char *code; { - const char *mname; + static char buf[BUFSZ]; + char *mname = buf; int name; + if (code) *code = '\0'; + do { - name = rn1(SPECIAL_PM + SIZE(bogusmons) - LOW_PM, LOW_PM); + name = rn1(SPECIAL_PM + BOGUSMONSIZE - LOW_PM, LOW_PM); } while (name < SPECIAL_PM && (type_is_pname(&mons[name]) || (mons[name].geno & G_NOGEN))); if (name >= SPECIAL_PM) { - mname = bogusmons[name - SPECIAL_PM]; + get_rnd_text(BOGUSMONFILE, buf); /* strip prefix if present */ - if (!letter(*mname)) ++mname; + if (!letter(*mname)) { + if (code) *code = *mname; + ++mname; + } } else { - mname = mons[name].mname; + Strcpy(buf, mons[name].mname); } return mname; } +#undef BOGUSMONSIZE /* scan bogusmons to check whether this name is in the list and has a prefix */ boolean -bogon_is_pname(mname) -const char *mname; +bogon_is_pname(code) +char code; { - const char *bname; - int name; - - if (!mname || !*mname) return FALSE; - if (!strncmpi(mname, "the ", 4)) mname += 4; - /* scan the bogusmons[] list; case sensitive here */ - for (name = 0; name < SIZE(bogusmons); name++) { - bname = bogusmons[name]; - /* we can skip all ordinary entries */ - if (letter(*bname)) continue; - /* starts with a classification code; does rest of name match? */ - if (!strcmp(mname, bname + 1)) - return index("-+=", *bname) ? TRUE : FALSE; - } - return FALSE; + if (!code) return FALSE; + return index("-+=", code) ? TRUE : FALSE; } const char * diff --git a/src/do_wear.c b/src/do_wear.c index 9925ceaf0..39d3b6c3f 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -391,7 +391,7 @@ Helmet_on(VOID_ARGS) properties, including levitation; uarmh could get dropped or destroyed here */ uchangealign((u.ualign.type != A_NEUTRAL) ? -u.ualign.type : - rn2(2) ? A_CHAOTIC : A_LAWFUL, 1); + (uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL, 1); /* makeknown(uarmh->otyp); -- moved below, after xname() */ /*FALLTHRU*/ case DUNCE_CAP: diff --git a/src/dungeon.c b/src/dungeon.c index ed87652f1..d02f3aec6 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -672,6 +672,8 @@ struct level_map { { "wizard1", &wiz1_level }, { "wizard2", &wiz2_level }, { "wizard3", &wiz3_level }, + { "minend", &mineend_level }, + { "soko1", &sokoend_level }, { X_START, &qstart_level }, { X_LOCATE, &qlocate_level }, { X_GOAL, &nemesis_level }, diff --git a/src/eat.c b/src/eat.c index 983f6bcec..a5b413772 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1252,7 +1252,7 @@ const char *mesg; what = "chicken"; which = 1; /* suppress pluralization */ } else if (Hallucination) { - what = rndmonnam(); + what = rndmonnam(NULL); } else { what = mons[mnum].mname; if (the_unique_pm(&mons[mnum])) which = 2; diff --git a/src/end.c b/src/end.c index 995ef8ec7..7ada39767 100644 --- a/src/end.c +++ b/src/end.c @@ -911,6 +911,7 @@ die: topten figure it out separately and possibly getting different time or even day if player is slow responding to --More-- */ endtime = getnow(); + urealtime.realtime += (endtime - urealtime.restored); /* Sometimes you die on the first move. Life's not fair. * On those rare occasions you get hosed immediately, go out diff --git a/src/engrave.c b/src/engrave.c index ebfcd0829..5a8aa38f3 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -9,33 +9,6 @@ STATIC_VAR NEARDATA struct engr *head_engr; -/* random engravings */ -static const char *random_mesg[] = { - "Elbereth", - /* trap engravings */ - "Vlad was here", "ad aerarium", - /* take-offs and other famous engravings */ - "Owlbreath", "Galadriel", - "Kilroy was here", - "A.S. ->", "<- A.S.", /* Journey to the Center of the Earth */ - "You won't get it up the steps", /* Adventure */ - "Lasciate ogni speranza o voi ch'entrate.", /* Inferno */ - "Well Come", /* Prisoner */ - "We apologize for the inconvenience.", /* So Long... */ - "See you next Wednesday", /* Thriller */ - "notary sojak", /* Smokey Stover */ - "For a good time call 8?7-5309", - "Please don't feed the animals.", /* Various zoos around the world */ - "Madam, in Eden, I'm Adam.", /* A palindrome */ - "Two thumbs up!", /* Siskel & Ebert */ - "Hello, World!", /* The First C Program */ -#ifdef MAIL - "You've got mail!", /* AOL */ -#endif - "As if!", /* Clueless */ - "BAD WOLF", /* 200x incarnation of Dr.Who */ -}; - char * random_engraving(outbuf) char *outbuf; @@ -44,8 +17,10 @@ char *outbuf; /* a random engraving may come from the "rumors" file, or from the list above */ - if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor) - Strcpy(outbuf, random_mesg[rn2(SIZE(random_mesg))]); + if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor) { + char buf[BUFSZ]; + Strcpy(outbuf, get_rnd_text(ENGRAVEFILE, buf)); + } wipeout_text(outbuf, (int)(strlen(outbuf) / 4), 0); return outbuf; @@ -1232,39 +1207,6 @@ struct engr *ep; } -/* Epitaphs for random headstones */ -static const char *epitaphs[] = { - "Rest in peace", - "R.I.P.", - "Rest In Pieces", - "Note -- there are NO valuable items in this grave", - "1994-1995. The Longest-Lived Hacker Ever", - "The Grave of the Unknown Hacker", - "We weren't sure who this was, but we buried him here anyway", - "Sparky -- he was a very good dog", - "Beware of Electric Third Rail", - "Made in Taiwan", - "Og friend. Og good dude. Og died. Og now food", - "Beetlejuice Beetlejuice Beetlejuice", - "Look out below!", - "Please don't dig me up. I'm perfectly happy down here. -- Resident", - "Postman, please note forwarding address: Gehennom, Asmodeus's Fortress, fifth lemure on the left", - "Mary had a little lamb/Its fleece was white as snow/When Mary was in trouble/The lamb was first to go", - "Be careful, or this could happen to you!", - "Soon you'll join this fellow in hell! -- the Wizard of Yendor", - "Caution! This grave contains toxic waste", - "Sum quod eris", - "Here lies an Atheist, all dressed up and no place to go", - "Here lies Ezekiel, age 102. The good die young.", - "Here lies my wife: Here let her lie! Now she's at rest and so am I.", - "Here lies Johnny Yeast. Pardon me for not rising.", - "He always lied while on the earth and now he's lying in it", - "I made an ash of myself", - "Soon ripe. Soon rotten. Soon gone. But not forgotten.", - "Here lies the body of Jonathan Blake. Stepped on the gas instead of the brake.", - "Go away!" -}; - /* Create a headstone at the given location. * The caller is responsible for newsym(x, y). */ @@ -1280,9 +1222,12 @@ const char *str; levl[x][y].typ = GRAVE; /* Engrave the headstone */ - if (!str) str = epitaphs[rn2(SIZE(epitaphs))]; del_engr_at(x, y); - make_engr_at(x, y, str, 0L, HEADSTONE); + if (str) make_engr_at(x, y, str, 0L, HEADSTONE); + else { + char buf[BUFSZ]; + make_engr_at(x, y, get_rnd_text(EPITAPHFILE, buf), 0L, HEADSTONE); + } return; } diff --git a/src/explode.c b/src/explode.c index 65dbe82a5..905b7b94b 100644 --- a/src/explode.c +++ b/src/explode.c @@ -283,7 +283,7 @@ int expltype; so avoid any which begins with a capital letter) */ do { Sprintf(hallu_buf, "%s explosion", - s_suffix(rndmonnam())); + s_suffix(rndmonnam(NULL))); } while (*hallu_buf != lowc(*hallu_buf)); str = hallu_buf; } @@ -365,7 +365,7 @@ int expltype; if (do_hallu) { /* (see explanation above) */ do { Sprintf(hallu_buf, "%s explosion", - s_suffix(rndmonnam())); + s_suffix(rndmonnam(NULL))); } while (*hallu_buf != lowc(*hallu_buf)); str = hallu_buf; } diff --git a/src/files.c b/src/files.c index a6f17b906..ace417e7d 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.134 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */ /* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -362,7 +362,9 @@ char *reasonbuf; /* reasonbuf must be at least BUFSZ, supplied by caller */ #if defined(NOCWD_ASSUMPTIONS) for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) { /* don't test writing to configdir or datadir; they're readonly */ - if (prefcnt == CONFIGPREFIX || prefcnt == DATAPREFIX) continue; + if (prefcnt == SYSCONFPREFIX || + prefcnt == CONFIGPREFIX || + prefcnt == DATAPREFIX) continue; filename = fqname("validate", prefcnt, 3); if ((fp = fopen(filename, "w"))) { fclose(fp); @@ -1811,6 +1813,8 @@ const char *configfile = # endif #endif +/* used for messaging */ +char lastconfigfile[BUFSZ]; #ifdef MSDOS /* conflict with speed-dial under windows @@ -1857,8 +1861,15 @@ int src; /* fall through to standard names */ } else #endif - if ((fp = fopenp(filename, "r")) != (FILE *)0) { - configfile = filename; +#ifdef PREFIXES_IN_USE + if (src == SET_IN_SYS) { + (void) strncpy(lastconfigfile, + fqname(filename, SYSCONFPREFIX, 0), BUFSZ-1); + } else +#endif + (void) strncpy(lastconfigfile, filename, BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) { return(fp); #if defined(UNIX) || defined(VMS) } else { @@ -1872,24 +1883,32 @@ int src; } #if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32) - if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r")) - != (FILE *)0) + (void) strncpy(lastconfigfile, + fqname(configfile, CONFIGPREFIX, 0), BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) { return(fp); + } # ifdef MSDOS - else if ((fp = fopenp(fqname(backward_compat_configfile, - CONFIGPREFIX, 0), "r")) != (FILE *)0) + (void) strncpy(lastconfigfile, + fqname(backward_compat_configfile, CONFIGPREFIX, 0), + BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + else if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) return(fp); # endif #else /* constructed full path names don't need fqname() */ # ifdef VMS - if ((fp = fopenp(fqname("nethackini", CONFIGPREFIX, 0), "r")) - != (FILE *)0) { - configfile = "nethackini"; + (void) strncpy(lastconfigfile, fqname("nethackini", CONFIGPREFIX, 0), + BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) { return(fp); } - if ((fp = fopenp("sys$login:nethack.ini", "r")) != (FILE *)0) { - configfile = "nethack.ini"; + (void) strncpy(lastconfigfile,"sys$login:nethack.ini", BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) { return(fp); } @@ -1898,6 +1917,9 @@ int src; Strcpy(tmp_config, "NetHack.cnf"); else Sprintf(tmp_config, "%s%s", envp, "NetHack.cnf"); + + (void) strncpy(lastconfigfile, tmp_config, BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) return(fp); # else /* should be only UNIX left */ @@ -1906,18 +1928,25 @@ int src; Strcpy(tmp_config, ".nethackrc"); else Sprintf(tmp_config, "%s/%s", envp, ".nethackrc"); - if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) + + (void) strncpy(lastconfigfile, tmp_config, BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) return(fp); # if defined(__APPLE__) /* try an alternative */ if (envp) { Sprintf(tmp_config, "%s/%s", envp, "Library/Preferences/NetHack Defaults"); - if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) + (void) strncpy(lastconfigfile, tmp_config, BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) return(fp); Sprintf(tmp_config, "%s/%s", envp, "Library/Preferences/NetHack Defaults.txt"); - if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) + (void) strncpy(lastconfigfile, tmp_config, BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) return(fp); } # endif @@ -1932,7 +1961,7 @@ int src; # endif details = ""; raw_printf("Couldn't open default config file %s %s(%d).", - tmp_config, details, errno); + lastconfigfile, details, errno); wait_synch(); } # endif /* Unix */ @@ -3199,6 +3228,29 @@ int ifd, ofd; /* ---------- END INTERNAL RECOVER ----------- */ #endif /*SELF_RECOVER*/ +/* ---------- OTHER ----------- */ + +#ifdef SYSCF +# ifdef SYSCF_FILE +void +assure_syscf_file() { + /* All we really care about is the end result - can we read the file? + * So just check that directly. */ + int fd; + fd = open(SYSCF_FILE, O_RDONLY); + if(fd >= 0){ + /* readable */ + close(fd); + return; + } + raw_printf("Unable to open SYSCF_FILE.\n"); + exit(EXIT_FAILURE); +} + +# endif /* SYSCF_FILE */ +#endif /* SYSCF */ + + #ifdef DEBUG /* used by debugpline() to decide whether to issue a message from a partiular source file; caller passes __FILE__ and we check diff --git a/src/fountain.c b/src/fountain.c index e87748e0a..405fac4a3 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 fountain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 fountain.c $NHDT-Date: 1426953330 2015/03/21 15:55:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */ /* NetHack 3.5 fountain.c $Date: 2011/08/20 00:22:20 $ $Revision: 1.32 $ */ /* Copyright Scott R. Turner, srt@ucla, 10/27/86 */ /* NetHack may be freely redistributed. See license for details. */ @@ -39,7 +39,7 @@ dowatersnakes() /* Fountain of snakes! */ if (!(mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) { if (!Blind) pline("An endless stream of %s pours forth!", - Hallucination ? makeplural(rndmonnam()) : "snakes"); + Hallucination ? makeplural(rndmonnam(NULL)) : "snakes"); else You_hear("%s hissing!", something); while(num-- > 0) @@ -402,12 +402,14 @@ register struct obj *obj; if(in_town(u.ux, u.uy)) (void) angry_guards(FALSE); return; - } else if (water_damage(obj, NULL, TRUE) != ER_NOTHING) { - if (obj->otyp == POT_ACID) { /* Acid and water don't mix */ - useup(obj); - return; - } else if (!rn2(2)) /* no further effect */ - return; + } else { + int er = water_damage(obj, NULL, TRUE); + if (obj->otyp == POT_ACID && er != ER_DESTROYED) { /* Acid and water don't mix */ + useup(obj); + return; + } else if (er != ER_NOTHING && !rn2(2)) { /* no further effect */ + return; + } } switch (rnd(30)) { diff --git a/src/hacklib.c b/src/hacklib.c index 78f12dea5..4fdbceb80 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -26,6 +26,7 @@ NetHack, except that rounddiv may call panic(). char chrcasecpy (int,int) char * strcasecpy (char *,const char *) char * s_suffix (const char *) + char * ing_suffix (const char *) char * xcrypt (const char *, char *) boolean onlyspace (const char *) char * tabexpand (char *) @@ -235,6 +236,39 @@ s_suffix(s) /* return a name converted to possessive */ return buf; } +char * +ing_suffix(s) + const char *s; +{ + const char *vowel = "aeiouy"; + static char buf[BUFSZ]; + char onoff[10]; + char *p; + Strcpy(buf, s); + p = eos(buf); + onoff[0] = *p = *(p+1) = '\0'; + if ((strlen(buf) > 4) && + (!strcmpi(p-3, " on") || + !strcmpi(p-4, " off") || + !strcmpi(p-5, " with"))) { + p = strrchr(buf, ' '); + Strcpy(onoff, p); + } + if (!index(vowel, *(p-1)) && index(vowel, *(p-2)) && !index(vowel, *(p-3))) { + /* tip -> tipp + ing */ + *p = *(p-1); + *(p+1) = '\0'; + } else if (!strcmpi(p-2, "ie")) { /* vie -> vy + ing */ + *(p-2) = 'y'; + *(p-1) = '\0'; + } else if (*(p-1) == 'e') /* grease -> greas + ing */ + *(p-1) = '\0'; + Strcat(buf, "ing"); + if (onoff[0]) Strcat(buf, onoff); + return buf; +} + + char * xcrypt(str, buf) /* trivial text encryption routine (see makedefs) */ const char *str; diff --git a/src/invent.c b/src/invent.c index 62295915c..12f0ef1b3 100644 --- a/src/invent.c +++ b/src/invent.c @@ -240,15 +240,19 @@ struct obj *obj; } else if (obj->otyp == AMULET_OF_YENDOR) { if (u.uhave.amulet) impossible("already have amulet?"); u.uhave.amulet = 1; + u.uachieve.amulet = 1; } else if (obj->otyp == CANDELABRUM_OF_INVOCATION) { if (u.uhave.menorah) impossible("already have candelabrum?"); u.uhave.menorah = 1; + u.uachieve.menorah = 1; } else if (obj->otyp == BELL_OF_OPENING) { if (u.uhave.bell) impossible("already have silver bell?"); u.uhave.bell = 1; + u.uachieve.bell = 1; } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { if (u.uhave.book) impossible("already have the book?"); u.uhave.book = 1; + u.uachieve.book = 1; } else if (obj->oartifact) { if (is_quest_artifact(obj)) { if (u.uhave.questart) @@ -258,6 +262,15 @@ struct obj *obj; } set_artifact_intrinsic(obj, 1, W_ART); } + if(obj->otyp == LUCKSTONE && obj->record_achieve_special) { + u.uachieve.mines_luckstone = 1; + obj->record_achieve_special = 0; + } else if((obj->otyp == AMULET_OF_REFLECTION || + obj->otyp == BAG_OF_HOLDING) && + obj->record_achieve_special) { + u.uachieve.finish_sokoban = 1; + obj->record_achieve_special = 0; + } } /* @@ -959,7 +972,21 @@ register const char *let,*word; return((struct obj *)0); } if(ilet == '-') { - return(allownone ? &zeroobj : (struct obj *) 0); + if (!allownone) { + char *suf = NULL; + strcpy(buf, word); + if ((bp = strstr(buf, " on the ")) != NULL) { /* rub on the stone[s] */ + *bp = '\0'; + suf = (bp + 1); + } + if ((bp = strstr(buf, " or ")) != NULL) { + *bp = '\0'; + bp = (rn2(2) ? buf : (bp + 4)); + } else bp = buf; + You("mime %s something%s%s.", ing_suffix(bp), + suf ? " " : "", suf ? suf : ""); + } + return(allownone ? &zeroobj : (struct obj *) 0); } if(ilet == def_oc_syms[COIN_CLASS].sym) { if (!usegold) { diff --git a/src/mon.c b/src/mon.c index cfe5cddca..c65be0aa7 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1605,6 +1605,8 @@ register struct monst *mtmp; } if(mtmp->iswiz) wizdead(); if(mtmp->data->msound == MS_NEMESIS) nemdead(); + if(mtmp->data == &mons[PM_MEDUSA]) + u.uachieve.killed_medusa = 1; if(glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) unmap_object(mtmp->mx, mtmp->my); m_detach(mtmp, mptr); diff --git a/src/muse.c b/src/muse.c index 855a91887..9ea9c1d14 100644 --- a/src/muse.c +++ b/src/muse.c @@ -88,7 +88,7 @@ struct obj *obj; if (vis) { pline("As %s opens the bottle, an enormous %s emerges!", mon_nam(mon), - Hallucination ? rndmonnam() : (const char *)"ghost"); + Hallucination ? rndmonnam(NULL) : (const char *)"ghost"); pline("%s is frightened to death, and unable to move.", Monnam(mon)); } diff --git a/src/objnam.c b/src/objnam.c index fe692b226..898dfb60a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 objnam.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 objnam.c $NHDT-Date: 1426977394 2015/03/21 22:36:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.108 $ */ /* NetHack 3.5 objnam.c $Date: 2011/10/27 02:24:54 $ $Revision: 1.101 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1682,7 +1682,7 @@ static struct sing_plur one_off[] = { static const char *const as_is[] = { /* makesingular() leaves these plural due to how they're used */ "boots", "shoes", - "gloves", "lenses", "scales", + "gloves", "lenses", "scales", "eyes", "gauntlets", "iron bars", /* both singular and plural are spelled the same */ diff --git a/src/options.c b/src/options.c index 98ab3724b..147e0a701 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 options.c $NHDT-Date: 1425083082 2015/02/28 00:24:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.158 $ */ +/* NetHack 3.5 options.c $NHDT-Date: 1427073746 2015/03/23 01:22:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */ /* NetHack 3.5 options.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.153 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -798,10 +798,10 @@ rejectoption(optname) const char *optname; { #ifdef MICRO - pline("\"%s\" settable only from %s.", optname, configfile); + pline("\"%s\" settable only from %s.", optname, lastconfigfile); #else pline("%s can be set only from NETHACKOPTIONS or %s.", optname, - configfile); + lastconfigfile); #endif } @@ -821,7 +821,7 @@ const char *opts; #endif if(from_file) - raw_printf("Bad syntax in OPTIONS in %s: %s.", configfile, opts); + raw_printf("Bad syntax in OPTIONS in %s: %s.", lastconfigfile, opts); else raw_printf("Bad syntax in NETHACKOPTIONS: %s.", opts); @@ -2484,7 +2484,7 @@ goodfruit: #if defined(BACKWARD_COMPAT) fullname = "DECgraphics"; - if (match_optname(opts, fullname, 10, TRUE)) { + if (match_optname(opts, fullname, 3, TRUE)) { boolean badflag = FALSE; if (duplicate) complain_about_duplicate(opts,1); if (!negated) { @@ -2508,7 +2508,7 @@ goodfruit: return; } fullname = "IBMgraphics"; - if (match_optname(opts, fullname, 10, TRUE)) { + if (match_optname(opts, fullname, 3, TRUE)) { const char *sym_name = fullname; boolean badflag = FALSE; if (duplicate) complain_about_duplicate(opts,1); @@ -2542,7 +2542,7 @@ goodfruit: #endif #ifdef MAC_GRAPHICS_ENV fullname = "MACgraphics"; - if (match_optname(opts, fullname, 11, TRUE)) { + if (match_optname(opts, fullname, 3, TRUE)) { boolean badflag = FALSE; if (duplicate) complain_about_duplicate(opts,1); if (!negated) { @@ -4070,7 +4070,7 @@ option_help() winid datawin; datawin = create_nhwindow(NHW_TEXT); - Sprintf(buf, "Set options as OPTIONS= in %s", configfile); + Sprintf(buf, "Set options as OPTIONS= in %s", lastconfigfile); opt_intro[CONFIG_SLOT] = (const char *) buf; for (i = 0; opt_intro[i]; i++) putstr(datawin, 0, opt_intro[i]); diff --git a/src/pickup.c b/src/pickup.c index 3eba9874f..1d78dea76 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2040,7 +2040,7 @@ struct obj *box; (void) add_to_container(box, deadcat); } pline_The("%s inside the box is dead!", - Hallucination ? rndmonnam() : "housecat"); + Hallucination ? rndmonnam(NULL) : "housecat"); } box->owt = weight(box); return; diff --git a/src/potion.c b/src/potion.c index d4bfcdad3..d9e5e9ca8 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 potion.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 potion.c $NHDT-Date: 1426953330 2015/03/21 15:55:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */ /* NetHack 3.5 potion.c $Date: 2013/11/05 00:57:55 $ $Revision: 1.91 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -371,7 +371,7 @@ ghost_from_bottle() return; } pline("As you open the bottle, an enormous %s emerges!", - Hallucination ? rndmonnam() : (const char *)"ghost"); + Hallucination ? rndmonnam(NULL) : (const char *)"ghost"); if(flags.verbose) You("are frightened to death, and unable to move."); nomul(-3); @@ -1664,8 +1664,8 @@ dodip() rider_cant_reach(); /* not skilled enough to reach */ } else { if (obj->otyp == POT_ACID) obj->in_use = 1; - (void) water_damage(obj, 0, TRUE); - if (obj->in_use) useup(obj); + if (water_damage(obj, 0, TRUE) != ER_DESTROYED && obj->in_use) + useup(obj); } return 1; } diff --git a/src/pray.c b/src/pray.c index d2b24c00a..ffdee9b49 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1373,6 +1373,7 @@ dosacrifice() done(ESCAPED); } else { /* super big win */ adjalign(10); + u.uachieve.ascended = 1; pline("An invisible choir sings, and you are bathed in radiance..."); godvoice(altaralign, "Congratulations, mortal!"); display_nhwindow(WIN_MESSAGE, FALSE); diff --git a/src/priest.c b/src/priest.c index 1ef7ea286..a28f2b8d4 100644 --- a/src/priest.c +++ b/src/priest.c @@ -284,13 +284,14 @@ char *pname; /* caller-supplied output buffer */ boolean do_hallu = Hallucination, aligned_priest = mon->data == &mons[PM_ALIGNED_PRIEST], high_priest = mon->data == &mons[PM_HIGH_PRIEST]; - const char *what = do_hallu ? rndmonnam() : mon->data->mname; + char whatcode = '\0'; + const char *what = do_hallu ? rndmonnam(&whatcode) : mon->data->mname; if (!mon->ispriest && !mon->isminion) /* should never happen... */ return strcpy(pname, what); /* caller must be confused */ *pname = '\0'; - if (!do_hallu || !bogon_is_pname(what)) Strcat(pname, "the "); + if (!do_hallu || !bogon_is_pname(whatcode)) Strcat(pname, "the "); if (mon->minvis) Strcat(pname, "invisible "); if (mon->isminion && EMIN(mon)->renegade) Strcat(pname, "renegade "); diff --git a/src/restore.c b/src/restore.c index 24a0f777c..4e4502b53 100644 --- a/src/restore.c +++ b/src/restore.c @@ -551,9 +551,20 @@ unsigned int *stuckid, *steedid; amii_setpens(amii_numcolors); /* use colors from save file */ #endif mread(fd, (genericptr_t) &u, sizeof(struct you)); - mread(fd, (genericptr_t) timebuf, 14); - timebuf[14] = '\0'; - ubirthday = time_from_yyyymmddhhmmss(timebuf); + +#define ReadTimebuf(foo) mread(fd, (genericptr_t) timebuf, 14); \ + timebuf[14] = '\0'; \ + foo = time_from_yyyymmddhhmmss(timebuf); + + ReadTimebuf(ubirthday); + ReadTimebuf(urealtime.realtime); + ReadTimebuf(urealtime.restored); +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *)&urealtime.restored); +#else + (void) time(&urealtime.restored); +#endif + set_uasmon(); #ifdef CLIPPING diff --git a/src/rumors.c b/src/rumors.c index 081b81d8d..4bcb5c177 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -266,6 +266,46 @@ rumor_check() } } + +/* Gets a random line of text from file 'fname', and returns it. */ +char * +get_rnd_text(fname, buf) +const char *fname; +char *buf; +{ + dlb *fh; + + buf[0] = '\0'; + + fh = dlb_fopen(fname, "r"); + + if (fh) { + /* TODO: cache sizetxt, starttxt, endtxt. maybe cache file contents? */ + long sizetxt = 0, starttxt = 0, endtxt = 0, tidbit = 0; + char *endp, line[BUFSZ], xbuf[BUFSZ]; + (void) dlb_fgets(line, sizeof line, fh); /* skip "don't edit" comment */ + + (void) dlb_fseek(fh, 0L, SEEK_CUR); + starttxt = dlb_ftell(fh); + (void) dlb_fseek(fh, 0L, SEEK_END); + endtxt = dlb_ftell(fh); + sizetxt = endtxt - starttxt; + tidbit = Rand() % sizetxt; + + (void) dlb_fseek(fh, starttxt + tidbit, SEEK_SET); + (void) dlb_fgets(line, sizeof line, fh); + if (!dlb_fgets(line, sizeof line, fh)) { + (void) dlb_fseek(fh, starttxt, SEEK_SET); + (void) dlb_fgets(line, sizeof line, fh); + } + if ((endp = index(line, '\n')) != 0) *endp = 0; + Strcat(buf, xcrypt(line, xbuf)); + (void) dlb_fclose(fh); + } else impossible("Can't open file %s!", fname); + return buf; +} + + void outrumor(truth, mechanism) int truth; /* 1=true, -1=false, 0=either */ diff --git a/src/save.c b/src/save.c index 802d560a9..807ecd7dc 100644 --- a/src/save.c +++ b/src/save.c @@ -307,8 +307,11 @@ register int fd, mode; #ifdef SYSFLAGS bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif + urealtime.realtime += (getnow() - urealtime.restored); bwrite(fd, (genericptr_t) &u, sizeof(struct you)); bwrite(fd, yyyymmddhhmmss(ubirthday), 14); + bwrite(fd, yyyymmddhhmmss(urealtime.realtime), 14); + bwrite(fd, yyyymmddhhmmss(urealtime.restored), 14); save_killers(fd, mode); /* must come before migrating_objs and migrating_mons are freed */ diff --git a/src/sounds.c b/src/sounds.c index 3b2ee2f56..6204847e8 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1006,7 +1006,7 @@ dochat() if (!Blind) { if (Hallucination) { /* if you're hallucinating, you can't tell it's a statue */ - pline_The("%s seems not to notice you.", rndmonnam()); + pline_The("%s seems not to notice you.", rndmonnam(NULL)); } else { pline_The("statue seems not to notice you."); diff --git a/src/sp_lev.c b/src/sp_lev.c index 46334a4ab..8278a344b 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1639,6 +1639,18 @@ struct mkroom *croom; } } + /* Nasty hack here: try to determine if this is the Mines or Sokoban + * "prize" and then set record_achieve_special (maps to corpsenm) + * for the object. That field will later be checked to find out if + * the player obtained the prize. */ + if(otmp->otyp == LUCKSTONE && Is_mineend_level(&u.uz)) { + otmp->record_achieve_special = 1; + } else if((otmp->otyp == AMULET_OF_REFLECTION || + otmp->otyp == BAG_OF_HOLDING) && + Is_sokoend_level(&u.uz)) { + otmp->record_achieve_special = 1; + } + stackobj(otmp); if (o->lit) { diff --git a/src/timeout.c b/src/timeout.c index 481b16ae7..e47d863fb 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -164,7 +164,7 @@ slime_dialogue() if (!Blind) /* [what if you're already green?] */ pline(buf, hcolor(NH_GREEN)); } else - pline(buf, an(Hallucination ? rndmonnam() : "green slime")); + pline(buf, an(Hallucination ? rndmonnam(NULL) : "green slime")); } else pline1(buf); } diff --git a/src/topten.c b/src/topten.c index db2e6fccb..b68ad1bce 100644 --- a/src/topten.c +++ b/src/topten.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 topten.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 topten.c $NHDT-Date: 1426731079 2015/03/19 02:11:19 $ $NHDT-Branch: harder_d8 $:$NHDT-Revision: 1.25 $ */ /* NetHack 3.5 topten.c $Date: 2012/01/24 04:26:15 $ $Revision: 1.23 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -65,6 +65,9 @@ STATIC_DCL void FDECL(outentry, (int,struct toptenentry *,BOOLEAN_P)); STATIC_DCL void FDECL(discardexcess, (FILE *)); STATIC_DCL void FDECL(readentry, (FILE *,struct toptenentry *)); STATIC_DCL void FDECL(writeentry, (FILE *,struct toptenentry *)); +STATIC_DCL void FDECL(writexlentry, (FILE*, struct toptenentry *)); +STATIC_DCL long NDECL(encodeconduct); +STATIC_DCL long NDECL(encodeachieve); STATIC_DCL void FDECL(free_ttlist, (struct toptenentry *)); STATIC_DCL int FDECL(classmon, (char *,BOOLEAN_P)); STATIC_DCL int FDECL(score_wanted, @@ -292,6 +295,100 @@ struct toptenentry *tt; #endif } +/* as tab is never used in eg. plname or death, no need to mangle those. */ +STATIC_OVL void +writexlentry(rfile,tt) +FILE *rfile; +struct toptenentry *tt; +{ +#define Fprintf (void)fprintf +#define XLOG_SEP '\t' /* xlogfile field separator. */ + char buf[BUFSZ]; + + Sprintf(buf, "version=%d.%d.%d", + tt->ver_major, tt->ver_minor, tt->patchlevel); + Sprintf(eos(buf), "%cpoints=%ld%cdeathdnum=%d%cdeathlev=%d", + XLOG_SEP, tt->points, + XLOG_SEP, tt->deathdnum, + XLOG_SEP, tt->deathlev); + Sprintf(eos(buf), "%cmaxlvl=%d%chp=%d%cmaxhp=%d", + XLOG_SEP, tt->maxlvl, + XLOG_SEP, tt->hp, + XLOG_SEP, tt->maxhp); + Sprintf(eos(buf), "%cdeaths=%d%cdeathdate=%ld%cbirthdate=%ld%cuid=%d", + XLOG_SEP, tt->deaths, + XLOG_SEP, tt->deathdate, + XLOG_SEP, tt->birthdate, + XLOG_SEP, tt->uid); + Fprintf(rfile, "%s", buf); + Sprintf(buf, "%crole=%s%crace=%s%cgender=%s%calign=%s", + XLOG_SEP, tt->plrole, + XLOG_SEP, tt->plrace, + XLOG_SEP, tt->plgend, + XLOG_SEP, tt->plalign); + Fprintf(rfile, "%s%cname=%s%cdeath=%s", + buf, /* (already includes separator) */ + XLOG_SEP, plname, + XLOG_SEP, tt->death); + Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", + XLOG_SEP, encodeconduct(), + XLOG_SEP, moves, + XLOG_SEP, encodeachieve()); + Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", + XLOG_SEP, (long)urealtime.realtime, + XLOG_SEP, (long)ubirthday, + XLOG_SEP, (long)urealtime.endtime); + Fprintf(rfile, "%cgender0=%s%calign0=%s", + XLOG_SEP, genders[flags.initgend].filecode, + XLOG_SEP, aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); + Fprintf(rfile, "\n"); +#undef XLOG_SEP +} + +STATIC_OVL long +encodeconduct() +{ + long e = 0L; + + if(!u.uconduct.food) e |= 1L << 0; + if(!u.uconduct.unvegan) e |= 1L << 1; + if(!u.uconduct.unvegetarian) e |= 1L << 2; + if(!u.uconduct.gnostic) e |= 1L << 3; + if(!u.uconduct.weaphit) e |= 1L << 4; + if(!u.uconduct.killer) e |= 1L << 5; + if(!u.uconduct.literate) e |= 1L << 6; + if(!u.uconduct.polypiles) e |= 1L << 7; + if(!u.uconduct.polyselfs) e |= 1L << 8; + if(!u.uconduct.wishes) e |= 1L << 9; + if(!u.uconduct.wisharti) e |= 1L << 10; + if(!num_genocides()) e |= 1L << 11; + + return e; +} + +STATIC_OVL long +encodeachieve() +{ + long r = 0L; + + if(u.uachieve.bell) r |= 1L << 0; + if(u.uachieve.enter_gehennom) r |= 1L << 1; + if(u.uachieve.menorah) r |= 1L << 2; + if(u.uachieve.book) r |= 1L << 3; + if(u.uevent.invoked) r |= 1L << 4; + if(u.uachieve.amulet) r |= 1L << 5; + if(In_endgame(&u.uz)) r |= 1L << 6; + if(Is_astralevel(&u.uz)) r |= 1L << 7; + if(u.uachieve.ascended) r |= 1L << 8; + if(u.uachieve.mines_luckstone) r |= 1L << 9; + if(u.uachieve.finish_sokoban) r |= 1L << 10; + if(u.uachieve.killed_medusa) r |= 1L << 11; + + return r; +} + + + STATIC_OVL void free_ttlist(tt) struct toptenentry *tt; @@ -322,6 +419,9 @@ time_t when; #ifdef LOGFILE FILE *lfile; #endif /* LOGFILE */ +#ifdef XLOGFILE + FILE *xlfile; +#endif /* XLOGFILE */ /* Under DICE 3.0, this crashes the system consistently, apparently due to * corruption of *rfile somewhere. Until I figure this out, just cut out @@ -380,6 +480,7 @@ time_t when; t0->birthdate = yyyymmdd(ubirthday); t0->deathdate = yyyymmdd(when); t0->tt_next = 0; + urealtime.endtime = when; #ifdef UPDATE_RECORD_IN_PLACE t0->fpos = -1L; #endif @@ -395,6 +496,17 @@ time_t when; unlock_file(LOGFILE); } #endif /* LOGFILE */ +#ifdef XLOGFILE + if (lock_file(XLOGFILE, SCOREPREFIX, 10)) { + if(!(xlfile = fopen_datafile(XLOGFILE, "a", SCOREPREFIX))) { + HUP raw_print("Cannot open extended log file!"); + } else { + writexlentry(xlfile, t0); + (void) fclose(xlfile); + } + unlock_file(XLOGFILE); + } +#endif /* XLOGFILE */ if (wizard || discover) { if (how != PANICKED) HUP { diff --git a/src/trap.c b/src/trap.c index 8fa07cbe4..60022b955 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 trap.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */ +/* NetHack 3.5 trap.c $NHDT-Date: 1426805491 2015/03/19 22:51:31 $ $NHDT-Branch: water_damage $:$NHDT-Revision: 1.198 $ */ /* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -621,7 +621,7 @@ int *fail_reason; "statue"); pline("%s %s!", upstart(statuename), comes_to_life); } else if (Hallucination) { /* They don't know it's a statue */ - pline_The("%s suddenly seems more animated.", rndmonnam()); + pline_The("%s suddenly seems more animated.", rndmonnam(NULL)); } else if (cause == ANIMATE_SHATTER) { if (cansee(x, y)) Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue), @@ -3145,6 +3145,14 @@ struct obj *obj; erode_obj(obj, NULL, ERODE_CORRODE, EF_GREASE | EF_VERBOSE); } +/* context for water_damage(), managed by water_damage_chain(); + when more than one stack of potions of acid explode while processing + a chain of objects, use alternate phrasing after the first message */ +static struct h2o_ctx { + int dkn_boom, unk_boom; /* track dknown, !dknown separately */ + boolean ctx_valid; +} acid_ctx = { 0, 0, FALSE }; + /* Get an object wet and damage it appropriately. * "ostr", if present, is used instead of the object name in some * messages. @@ -3158,6 +3166,7 @@ const char *ostr; boolean force; { boolean exploded = FALSE; + if (!obj) return ER_NOTHING; if (snuff_lit(obj)) return ER_DAMAGED; @@ -3201,18 +3210,36 @@ boolean force; return ER_DAMAGED; } else if (obj->oclass == POTION_CLASS) { if (obj->otyp == POT_ACID) { - char *bufp, buf[BUFSZ]; - boolean one = (obj->quan == 1L); - boolean update = carried(obj); + char *bufp; + boolean one = (obj->quan == 1L), + update = carried(obj), + exploded = FALSE; - bufp = strcpy(buf, "potion"); - if (!one) bufp = makeplural(bufp); - /* [should we damage player/monster?] */ + if (Blind && !carried(obj)) obj->dknown = 0; + if (acid_ctx.ctx_valid) + exploded = ((obj->dknown ? acid_ctx.dkn_boom + : acid_ctx.unk_boom) > 0); + /* First message is + * "a [potion| potion|potion of acid] explodes" + * depending on obj->dknown (potion has been seen) and + * objects[POT_ACID].oc_name_known (fully discovered), + * or "some {plural version} explode" when relevant. + * Second and subsequent messages for same chain and + * matching dknown status are + * "another [potion| &c] explodes" or plural + * variant. + */ + bufp = simpleonames(obj); pline("%s %s %s!", /* "A potion explodes!" */ !exploded ? (one ? "A" : "Some") : - (one ? "Another" : "More"), + (one ? "Another" : "More"), bufp, vtense(bufp, "explode")); - exploded = TRUE; + if (acid_ctx.ctx_valid) { + if (obj->dknown) + acid_ctx.dkn_boom++; + else + acid_ctx.unk_boom++; + } setnotworn(obj); delobj(obj); if (update) @@ -3244,10 +3271,20 @@ struct obj *obj; boolean here; { struct obj *otmp; + + /* initialize acid context: so far, neither seen (dknown) potions of + acid nor unseen have exploded during this water damage sequence */ + acid_ctx.dkn_boom = acid_ctx.unk_boom = 0; + acid_ctx.ctx_valid = TRUE; + for (; obj; obj = otmp) { otmp = here ? obj->nexthere : obj->nobj; water_damage(obj, NULL, FALSE); } + + /* reset acid context */ + acid_ctx.dkn_boom = acid_ctx.unk_boom = 0; + acid_ctx.ctx_valid = FALSE; } /* diff --git a/src/u_init.c b/src/u_init.c index bfe54671c..79954841c 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -500,6 +500,7 @@ u_init() (void) memset((genericptr_t)&u, 0, sizeof(u)); u.ustuck = (struct monst *)0; (void) memset((genericptr_t)&ubirthday, 0, sizeof(ubirthday)); + (void) memset((genericptr_t)&urealtime, 0, sizeof(urealtime)); #if 0 /* documentation of more zero values as desirable */ u.usick_cause[0] = 0; diff --git a/src/wield.c b/src/wield.c index 9e1447bff..c70bec601 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 wield.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 wield.c $NHDT-Date: 1427062304 2015/03/22 22:11:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ /* NetHack 3.5 wield.c $Date: 2009/05/06 10:48:14 $ $Revision: 1.31 $ */ /* SCCS Id: @(#)wield.c 3.5 2009/01/20 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ @@ -349,10 +349,6 @@ dowieldquiver() /* will_weld(), touch_petrifies(), etc. */ multi = 0; - /* Because 'Q' used to be quit... */ - if (flags.suppress_alert < FEATURE_NOTICE_VER(3,3,0)) - pline("Note: Please use #quit if you wish to exit the game."); - /* Prompt for a new quiver */ if (!(newquiver = getobj(quivee_types, "ready"))) /* Cancelled */ diff --git a/src/zap.c b/src/zap.c index 5f39fc30e..3134c8b88 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1799,7 +1799,7 @@ struct obj *obj, *otmp; if (break_statue(obj)) { if (cansee(obj->ox, obj->oy)) { if (Hallucination) - pline_The("%s shatters.", rndmonnam()); + pline_The("%s shatters.", rndmonnam(NULL)); else pline_The("statue shatters."); } else diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 6635c56ad..67ae57dba 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -1,9 +1,9 @@ -/* NetHack 3.5 pcmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 pcmain.c $NHDT-Date: 1426966701 2015/03/21 19:38:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */ /* NetHack 3.5 pcmain.c $Date: 2012/01/20 03:41:31 $ $Revision: 1.48 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ -/* main.c - MSDOS, OS/2, ST, Amiga, and NT NetHack */ +/* main.c - MSDOS, OS/2, ST, Amiga, and Windows NetHack */ #include "hack.h" #include "dlb.h" @@ -244,6 +244,9 @@ char *argv[]; #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) chdirx(hackdir,0); +#endif +#ifdef SYSCF + initoptions(); #endif prscore(argc, argv); nethack_exit(EXIT_SUCCESS); diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat index ad9cb6e2d..17c543897 100644 --- a/sys/unix/Makefile.dat +++ b/sys/unix/Makefile.dat @@ -9,7 +9,7 @@ NHSROOT=.. # SHELL=E:/GEMINI2/MUPFEL.TTP # UUDECODE=uudecode -VARDAT = data rumors quest.dat oracles options +VARDAT = bogusmon data engrave epitaph rumors quest.dat oracles options all: $(VARDAT) spec_levs quest_levs dungeon @@ -98,6 +98,15 @@ quest.dat: quest.txt ../util/makedefs oracles: oracles.txt ../util/makedefs ../util/makedefs -h +engrave: engrave.txt ../util/makedefs + ../util/makedefs -s + +epitaph: epitaph.txt ../util/makedefs + ../util/makedefs -s + +bogusmon: bogusmon.txt ../util/makedefs + ../util/makedefs -s + # note: 'options' should have already been made when include/date.h was created options: ../util/makedefs ../util/makedefs -v diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 6d94d6908..77cd28fa1 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -56,7 +56,7 @@ VARDIR = $(HACKDIR) # for Gnome # VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm -VARDATD = data oracles options quest.dat rumors +VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors VARDAT = $(VARDATD) $(VARDATND) # Some versions of make use the SHELL environment variable as the shell @@ -109,6 +109,15 @@ manpages: data: $(GAME) ( cd dat ; $(MAKE) data ) +engrave: $(GAME) + ( cd dat ; $(MAKE) engrave ) + +bogusmon: $(GAME) + ( cd dat ; $(MAKE) bogusmon ) + +epitaph: $(GAME) + ( cd dat ; $(MAKE) epitaph ) + rumors: $(GAME) ( cd dat ; $(MAKE) rumors ) @@ -264,10 +273,10 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs # set up the game files ( $(MAKE) dofiles ) # set up some additional files - touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile - -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \ - $(CHGRP) $(GAMEGRP) perm record logfile ; \ - chmod $(VARFILEPERM) perm record logfile ) + touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile + -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \ + $(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \ + chmod $(VARFILEPERM) perm record logfile xlogfile ) true; $(POSTINSTALL) # and a reminder @echo You may also want to reinstall the man pages via the doc Makefile. diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index c470dc6e0..b31032efb 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 unixmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 unixmain.c $NHDT-Date: 1427074144 2015/03/23 01:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */ /* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -324,7 +324,7 @@ process_options(argc, argv) int argc; char *argv[]; { - int i; + int i, l; /* * Process options. @@ -332,11 +332,25 @@ char *argv[]; while(argc > 1 && argv[1][0] == '-'){ argv++; argc--; + l = (int)strlen(*argv); + /* must supply at least 4 chars to match "-XXXgraphics" */ + if (l < 4) l = 4; + switch(argv[0][1]){ case 'D': - wizard = TRUE, discover = FALSE; + case 'd': + if ((argv[0][1] == 'D' && !argv[0][2]) + || !strcmpi(*argv, "-debug")) { + wizard = TRUE, discover = FALSE; + } else if (!strncmpi(*argv, "-DECgraphics", l)) { + load_symset("DECGraphics", PRIMARY); + switch_symbols(TRUE); + } else { + raw_printf("Unknown option: %s", *argv); + } break; case 'X': + discover = TRUE, wizard = FALSE; break; #ifdef NEWS @@ -356,17 +370,12 @@ char *argv[]; break; case 'I': case 'i': - if (!strncmpi(argv[0]+1, "IBM", 3)) { + if (!strncmpi(*argv, "-IBMgraphics", l)) { load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); - } - break; - /* case 'D': */ - case 'd': - if (!strncmpi(argv[0]+1, "DEC", 3)) { - load_symset("DECGraphics", PRIMARY); - switch_symbols(TRUE); + } else { + raw_printf("Unknown option: %s", *argv); } break; case 'p': /* profession (role) */ @@ -648,20 +657,4 @@ get_unix_pw() return pw; } -#ifdef SYSCF_FILE -void -assure_syscf_file(){ - /* All we really care about is the end result - can we read the file? - * So just check that directly. */ - int fd; - fd = open(SYSCF_FILE, O_RDONLY); - if(fd >= 0){ - /* readable */ - close(fd); - return; - } - raw_printf("Unable to open SYSCF_FILE.\n"); - exit(EXIT_FAILURE); -} -#endif /*unixmain.c*/ diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 847aa3797..a1dfdbcd8 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1,4 +1,4 @@ -# NetHack 3.5 Makefile.msc $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +# NetHack 3.5 Makefile.msc $NHDT-Date: 1426967393 2015/03/21 19:49:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */ # Copyright (c) NetHack PC Development Team 1993-2015 # #============================================================================== @@ -13,8 +13,10 @@ # #============================================================================== # This is used for building two versions of NetHack: +# # A tty port utilizing the Win32 Console I/O subsystem, Console # NetHack; +# # A Win32 native port built on the Windows API, Graphical NetHack or # NetHackW. # @@ -77,6 +79,13 @@ TARGET_CPU=x86 GAMEDIR = ..\binary # Game directory +# +#--------------------------------------------------------------- +# 4. Do you want debug information in the executable? +# + +DEBUGINFO = Y + # This marks the end of the BUILD DECISIONS section. #============================================================================== # @@ -109,7 +118,7 @@ DOC = ..\doc # NetHack documentation files UTIL = ..\util # Utility source SRC = ..\src # Main source SSYS = ..\sys\share # Shared system files -NTSYS = ..\sys\winnt # NT Win32 specific files +MSWSYS= ..\sys\winnt # mswin specific files TTY = ..\win\tty # window port files (tty) WIN32 = ..\win\win32 # window port files (Win32) WSHR = ..\win\share # Tile support files @@ -142,7 +151,7 @@ TARGET_CPU=x86 # -Zd - generate only public symbols and line numbers for debugging # -GS - enable security checks # -ccommon=-c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c +ccommon=-c $(CDBFLAG) -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c lflags=/INCREMENTAL:NO /NOLOGO !IF "$(TARGET_CPU)" == "x86" @@ -186,38 +195,11 @@ guilibs = $(winlibs) # Exe File Info. #========================================== -# Yacc/Lex ... if you got 'em. # -# If you have yacc and lex programs (or work-alike such as bison -# and flex), comment out the upper two macros and uncomment -# the lower two. -# - -DO_YACC = YACC_MSG -DO_LEX = LEX_MSG -#DO_YACC = YACC_ACT -#DO_LEX = LEX_ACT - -# - Specify your yacc and lex programs (or work-alikes) here. - -#YACC = bison -y -YACC = byacc -#YACC = yacc - -#LEX = lex -LEX = flex - -# -# - Specify your flex skeleton file (if needed). -# - -FLEXSKEL = -#FLEXSKEL = -S../tools/flex.ske - -YTABC = y_tab.c -YTABH = y_tab.h -LEXYYC = lexyy.c - +# For the level compiler bits, +# we just defer to win\win32\dgnstuff.mak +# and win\win32\levstuff.mak +# # # Optional high-quality BSD random number generation routines # (see pcconf.h). Set to nothing if not used. @@ -226,18 +208,6 @@ LEXYYC = lexyy.c RANDOM = $(OBJ)\random.o #RANDOM = -# -# Uncomment the next 2 lines _ONLY_ if you DO NOT want any -# debug capability in the object files, or in the NetHack executable. -# Comment them if you want debug capability. - -#ldebug = -#cdebug = - -# -# Compiler and Linker flags -# - PRECOMPHEAD = N # set to Y if you want to use precomp. headers # @@ -301,10 +271,20 @@ DLBFLG = #========================================== #========================================== -PDBFILE= /PDB:"$(O)$(GAME).PDB" -MAPFILE= /MAP:"$(O)$(GAME).MAP" INCLDIR= /I..\include +!IF "$(DEBUGINFO)" == "Y" +CDBGFLAG=-Zi +LDBGFLAG=/debug +cdebug = -Zi -Od +ldebug = /DEBUG +!ELSE +CDBGFLAG= +LDBGFLAG= +ldebug = +cdebug = +!ENDIF + !IF ("$(ldebug)" != "") !IF ("$(ldebug)" != "/RELEASE") ldebug = /DEBUG @@ -341,14 +321,14 @@ LIBS= user32.lib winmm.lib $(ZLIB) !IF ("$(GRAPHICAL)"=="Y") cflagsGame = $(cdebug) $(cflags2) $(guiflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(guilibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(guilibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ELSE cflagsGame = $(cdebug) $(cflags2) $(conflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(conlibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(conlibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ENDIF @@ -387,10 +367,10 @@ DLB = # Rules for files in sys\winnt #========================================== -{$(NTSYS)}.c{$(OBJ)}.o: +{$(MSWSYS)}.c{$(OBJ)}.o: @$(CC) $(cflagsUtil) -Fo$@ $< -{$(NTSYS)}.h{$(INCL)}.h: +{$(MSWSYS)}.h{$(INCL)}.h: @copy $< $@ #========================================== @@ -435,7 +415,7 @@ DLB = # referenced later on in the Makefile. # -DEFFILE = $(NTSYS)\$(GAME).def +DEFFILE = $(MSWSYS)\$(GAME).def # # Shorten up the location for some files @@ -451,19 +431,20 @@ U = $(UTIL)^\ MAKESRC = $(U)makedefs.c -SPLEVSRC = $(U)lev_yacc.c $(U)lev_$(LEX).c $(U)lev_main.c $(U)panic.c - -DGNCOMPSRC = $(U)dgn_yacc.c $(U)dgn_$(LEX).c $(U)dgn_main.c - MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o -SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o \ +#SPLEVOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ +# $(O)alloc.o $(O)decl.o $(O)drawing.o \ +# $(O)monst.o $(O)objects.o $(O)panic.o + +SPLEVOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ $(O)alloc.o $(O)decl.o $(O)drawing.o \ $(O)monst.o $(O)objects.o $(O)panic.o -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o \ +DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_lex.o $(O)dgn_main.o \ $(O)alloc.o $(O)panic.o + RECOVOBJS = $(O)recover.o TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt @@ -619,15 +600,16 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ copy $(DAT)\*.lev $(GAMEDIR) if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile ! ENDIF + if not exist $(GAMEDIR)\sysconf copy $(MSWSYS)\sysconf $(GAMEDIR) if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR) if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt @if exist $(O)$(GAME).PDB copy $(O)$(GAME).pdb $(GAMEDIR)\$(GAME).pdb @if exist $(GAMEDIR)\$(GAME).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAME).pdb to conserve space - -copy $(NTSYS)\defaults.nh $(GAMEDIR)\defaults.nh + -copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh echo install done > $@ -# copy $(NTSYS)\winnt.hlp $(GAMEDIR) +# copy $(MSWSYS)\winnt.hlp $(GAMEDIR) recover: $(U)recover.exe if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR) @@ -686,8 +668,8 @@ $(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \ $(WIN32)\splash.bmp @$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc !ELSE -$(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico - @$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc +$(NHRES): $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico + @$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc !ENDIF #========================================== @@ -840,6 +822,14 @@ $(INCL)\vis_tab.h: $(U)makedefs.exe $(SRC)\vis_tab.c: $(U)makedefs.exe $(U)makedefs -z +$(DAT)\engrave: $(DAT)\engrave.txt $(U)makedefs.exe + ..\util\makedefs -s +$(DAT)\epitaph: $(DAT)\epitaph.txt $(U)makedefs.exe + ..\util\makedefs -s +$(DAT)\bogusmon: $(DAT)\bogusmon.txt $(U)makedefs.exe + ..\util\makedefs -s + + #========================================== # uudecode utility and uuencoded targets #========================================== @@ -850,12 +840,12 @@ $(U)uudecode.exe: $(O)uudecode.o $(O)uudecode.o: $(SSYS)\uudecode.c @$(CC) $(cflagsUtil) /D_CRT_SECURE_NO_DEPRECATE -Fo$@ $(SSYS)\uudecode.c -$(NTSYS)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu - chdir $(NTSYS) +$(MSWSYS)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu + chdir $(MSWSYS) ..\..\util\uudecode.exe nhico.uu chdir ..\..\src -$(WIN32)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu +$(WIN32)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu chdir $(WIN32) ..\..\util\uudecode.exe ../../sys/winnt/nhico.uu chdir ..\..\src @@ -890,71 +880,55 @@ $(WIN32)\splash.bmp: $(U)uudecode.exe $(WIN32)\splash.uu ..\..\util\uudecode.exe splash.uu chdir ..\..\src -#========================================== +#================================================= # Level Compiler Stuff -#========================================== +#================================================= +# +# defer to the steps in ..\win\win32\levstuff.mak +# -LEVCFLAGS=-c -nologo -DWINVER=0x0400 -DWIN32 -D_WIN32 \ - -D_MT -MT -I..\include -nologo -Z7 -Od -DDLB +$(U)lev_yacc.c $(INCL)\lev_comp.h: $(U)lev_comp.y + nmake -nologo -f ..\win\win32\levstuff.mak default + +LEVCFLAGS=-c -nologo -DWIN32 -D_WIN32 -I$(INCL) -nologo -Z7 -Od -DDLB + +$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c + +$(O)lev_lex.o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \ + $(U)lev_lex.c + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_lex.c + +$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c $(U)levcomp.exe: $(SPLEVOBJS) @echo Linking $@... - @$(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk + echo $(link) + echo $(lflagsUtil) + $(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk $(SPLEVOBJS:^ =^ ) << -$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c - -$(O)lev_$(LEX).o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \ - $(U)lev_$(LEX).c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_$(LEX).c - -$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c - - -$(U)lev_yacc.c $(INCL)\lev_comp.h : $(U)lev_comp.y -! IF "$(DO_YACC)"=="YACC_ACT" - chdir $(UTIL) - $(YACC) -d lev_comp.y - copy $(YTABC) lev_yacc.c - copy $(YTABH) $(INCL)\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir $(SRC) -! ELSE - @echo $(U)lev_comp.y has changed. - @echo To update $(U)lev_yacc.c and $(INCL)\lev_comp.h run $(YACC). - @echo --- - @echo For now, we will copy the prebuilt lev_yacc.c and - @echo lev_comp.h from $(SSYS) into $(UTIL) and use them. - @copy $(SSYS)\lev_yacc.c $(U)lev_yacc.c >nul - @copy $(SSYS)\lev_comp.h $(INCL)\lev_comp.h >nul - @echo /**/ >>$(U)lev_yacc.c - @echo /**/ >>$(INCL)\lev_comp.h -! ENDIF - -$(U)lev_$(LEX).c: $(U)lev_comp.l -! IF "$(DO_LEX)"=="LEX_ACT" - chdir $(UTIL) - $(LEX) $(FLEXSKEL) lev_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir $(SRC) -! ELSE - @echo $(U)lev_comp.l has changed. To update $@ run $(LEX). - @echo --- - @echo For now, we will copy the prebuilt lev_lex.c - @echo from $(SSYS) into $(UTIL) and use it. - @copy $(SSYS)\lev_lex.c $@ >nul - @echo /**/ >>$@ -! ENDIF - -#========================================== +#================================================= # Dungeon Compiler Stuff -#========================================== +#================================================= +# +# defer to the steps in ..\win\win32\dgnstuff.mak +# +$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y + nmake -nologo -f ..\win\win32\dgnstuff.mak default + +$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c + +$(O)dgn_lex.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ + $(U)dgn_lex.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_lex.c + +$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c $(U)dgncomp.exe: $(DGNCOMPOBJS) @echo Linking $@... @@ -963,56 +937,9 @@ $(U)dgncomp.exe: $(DGNCOMPOBJS) ) << -$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c - -$(O)dgn_$(LEX).o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ - $(U)dgn_$(LEX).c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_$(LEX).c - -$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c - -$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y -! IF "$(DO_YACC)"=="YACC_ACT" - chdir $(UTIL) - $(YACC) -d dgn_comp.y - copy $(YTABC) dgn_yacc.c - copy $(YTABH) $(INCL)\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir $(SRC) -! ELSE - @echo $(U)dgn_comp.y has changed. To update dgn_yacc.c and - @echo $(INCL)\dgn_comp.h run $(YACC). - @echo --- - @echo For now, we will copy the prebuilt $(U)dgn_yacc.c and - @echo dgn_comp.h from $(SSYS) into $(UTIL) and use them. - @copy $(SSYS)\dgn_yacc.c $(U)dgn_yacc.c >nul - @copy $(SSYS)\dgn_comp.h $(INCL)\dgn_comp.h >nul - @echo /**/ >>$(U)dgn_yacc.c - @echo /**/ >>$(INCL)\dgn_comp.h -! ENDIF - -$(U)dgn_$(LEX).c: $(U)dgn_comp.l -! IF "$(DO_LEX)"=="LEX_ACT" - chdir $(UTIL) - $(LEX) $(FLEXSKEL) dgn_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir $(SRC) -! ELSE - @echo $(U)dgn_comp.l has changed. To update $@ run $(LEX). - @echo --- - @echo For now, we will copy the prebuilt dgn_lex.c - @echo from $(SSYS) into $(UTIL) and use it. - @copy $(SSYS)\dgn_lex.c $@ >nul - @echo /**/ >>$@ -! ENDIF - -#========================================== +#================================================= # Create directory for holding object files -#========================================== +#================================================= $(O)obj.tag: @if not exist $(OBJ)\*.* echo creating directory $(OBJ) @@ -1050,11 +977,11 @@ envchk: #========================================== #=========================================== -# Header files NOT distributed in ..\include +# Header files NOT distributed in $(INCL) #=========================================== -$(INCL)\win32api.h: $(NTSYS)\win32api.h - copy $(NTSYS)\win32api.h $@ +$(INCL)\win32api.h: $(MSWSYS)\win32api.h + copy $(MSWSYS)\win32api.h $@ #========================================== @@ -1075,13 +1002,13 @@ $(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h $(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h @$(CC) $(cflagsUtil) /Fo$@ $(UTIL)\dlb_main.c -$(DAT)\porthelp: $(NTSYS)\porthelp - @copy $(NTSYS)\porthelp $@ >nul +$(DAT)\porthelp: $(MSWSYS)\porthelp + @copy $(MSWSYS)\porthelp $@ >nul nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ $(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \ $(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \ - $(DAT)\license $(O)sp_lev.tag + $(DAT)\license $(DAT)\engrave $(DAT)\epitaph $(DAT)\bogusmon $(O)sp_lev.tag cd $(DAT) echo data >dlb.lst echo oracles >>dlb.lst @@ -1091,6 +1018,9 @@ nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ if exist porthelp echo porthelp >>dlb.lst echo quest.dat >>dlb.lst echo rumors >>dlb.lst + echo engrave >>dlb.lst + echo epitaph >>dlb.lst + echo bogusmon >>dlb.lst echo help >>dlb.lst echo hh >>dlb.lst echo cmdhelp >>dlb.lst @@ -1238,6 +1168,9 @@ spotless: clean if exist $(U)*.map del $(U)*.map if exist $(DAT)\data del $(DAT)\data if exist $(DAT)\rumors del $(DAT)\rumors + if exist $(DAT)\engrave del $(DAT)\engrave + if exist $(DAT)\epitaph del $(DAT)\epitaph + if exist $(DAT)\bogusmon del $(DAT)\bogusmon if exist $(DAT)\???-fil?.lev del $(DAT)\???-fil?.lev if exist $(DAT)\???-goal.lev del $(DAT)\???-goal.lev if exist $(DAT)\???-loca.lev del $(DAT)\???-loca.lev @@ -1321,6 +1254,14 @@ clean: if exist $(O)sp_lev.tag del $(O)sp_lev.tag if exist $(O)uudecode.MAP del $(O)uudecode.MAP if exist $(O)uudecode.PDB del $(O)uudecode.PDB + rem + rem defer to the steps in ..\win\win32\levstuff.mak + rem + nmake -nologo -f ..\win\win32\levstuff.mak clean + rem + rem defer to the steps in ..\win\win32\dgnstuff.mak + rem + nmake -nologo -f ..\win\win32\dgnstuff.mak clean ! IF ("$(WINPFLAG)"!="") if exist $(TILEBMP16) del $(TILEBMP16) @@ -1357,14 +1298,14 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def # NT dependencies # -$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c - @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c -$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c - @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nhkeys.c -$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c - @$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\winnt.c -$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c - @$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\ntsound.c +$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nttty.c + @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c +$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nhkeys.c + @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nhkeys.c +$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(MSWSYS)\winnt.c + @$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\winnt.c +$(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c + @$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\ntsound.c # # util dependencies diff --git a/sys/winnt/sysconf b/sys/winnt/sysconf new file mode 100644 index 000000000..67c0b814d --- /dev/null +++ b/sys/winnt/sysconf @@ -0,0 +1,78 @@ +# +# NetHack 3.5 sysconf $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ +# NetHack 3.5 sysconf $Date: 2012/01/27 20:15:31 $ $Revision: 1.6 $ +# +# Sample sysconf file. +# The sysconf file is only used if NetHack is compiled with SYSCF defined. +# This file uses the same syntax as nethack.cf. + +# Which users can use WIZARD (debugging) mode (the -D flag). +# A value of * allows anyone to enter debugging mode. +WIZARDS=* + +# Users allowed to use the ! (shell escape) command or to suspend the game. +# Uses the same syntax as the WIZARDS option above. +#SHELLERS= + +# Show debugging information originating from these source files. +# Use '*' for all, or list source files separated by spaces. +# Only available if game has been compiled with DEBUG. +#DEBUGFILES=* + +# Limit the number of simultaneous games (see also nethack.sh). +#MAXPLAYERS=10 + +# If not null, added to string "To get local support, " in the support +# information help. +#SUPPORT=call Izchak at extension 42. + +# Uncomment the next line to disable the SEDUCE option. +#SEDUCE=0 + +# Record (high score) file options. +# CAUTION: changing these after people have started playing games can +# lead to lost high scores! +# Maximum entries for one person. +#PERSMAX=10 +# Maximum entries in the record file. +#ENTRYMAX=100 +# Minimum points to get an entry. +#POINTSMIN=1 +# Determine identity of "person" in the score file with name (0) or +# numeric (1) user id. +#PERS_IS_UID=1 + +# Maximum number of score file entries to use for random statue names +#MAX_STATUENAME_RANK=10 + +# *** LOCATIONS *** +# IMPORTANT: If you change any of these locations, the directories they +# point at must exist. NetHack will not create them for you. +# +# HACKDIR is the default location for everything. +# Note: On Windows HACKDIR defaults to the location +# of the NetHack.exe or NetHackw.exe file so +# setting HACKDIR below to override that is +# not usually necessary or recommended. +#HACKDIR=c:\games\nethack +# +# The location that users can adjust their config file startup options +#CONFIGDIR=c:\games\nethack +# +# The location that level files in progress are stored (default=HACKDIR, writeable) +#LEVELDIR=c:\nethack\levels +# +# The location where saved games are kept (default=HACKDIR, writeable) +#SAVEDIR=c:\nethack\save +# +# The location that bones files are kept (default=HACKDIR, writeable) +#BONESDIR=c:\nethack\save +# +# The location that file synchronization locks are stored (default=HACKDIR, writeable) +#LOCKDIR=c:\nethack\levels +# +# The location that a record of game aborts and self-diagnosed game problems +# is kept (default=HACKDIR, writeable) +#TROUBLEDIR=c:\nethack\trouble + + diff --git a/util/lev_main.c b/util/lev_main.c index 8e785c598..2268c9fc3 100644 --- a/util/lev_main.c +++ b/util/lev_main.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 lev_main.c $NHDT-Date: 1427161270 2015/03/24 01:41:10 $ $NHDT-Branch: paxed-new_lev_comp-B $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.5 lev_main.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 lev_main.c $Date: 2012/01/12 04:48:12 $ $Revision: 1.20 $ */ /* SCCS Id: @(#)lev_main.c 3.5 2007/01/17 */ /* Copyright (c) 1989 by Jean-Christophe Collet */ diff --git a/util/makedefs.c b/util/makedefs.c index f4ca9febb..8555178e1 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -169,6 +169,7 @@ static char *FDECL(bannerc_string, (char *,const char *)); static char *FDECL(xcrypt, (const char *)); static unsigned long FDECL(read_rumors_file, (const char *,int *,long *,unsigned long)); +static void FDECL(do_rnd_access_file, (const char *)); static boolean FDECL(d_filter, (char *)); static boolean FDECL(h_filter, (char *)); static boolean FDECL(ranged_attk,(struct permonst*)); @@ -213,7 +214,7 @@ extern unsigned _stklen = STKSIZ; int main(void) { - const char *def_options = "odemvpqrhz"; + const char *def_options = "odemvpqrshz"; char buf[100]; int len; @@ -329,6 +330,11 @@ char *options; case 'r': case 'R': do_rumors(); break; + case 's': + case 'S': do_rnd_access_file(EPITAPHFILE); + do_rnd_access_file(ENGRAVEFILE); + do_rnd_access_file(BOGUSMONFILE); + break; case 'h': case 'H': do_oracles(); break; @@ -870,6 +876,44 @@ unsigned long old_rumor_offset; return rumor_offset; } + +void +do_rnd_access_file(fname) +const char *fname; +{ + Sprintf(filename, DATA_IN_TEMPLATE, fname); + Strcat(filename, ".txt"); + if (!(ifp = fopen(filename, RDTMODE))) { + perror(filename); + exit(EXIT_FAILURE); + } + filename[0]='\0'; +#ifdef FILE_PREFIX + Strcat(filename, file_prefix); +#endif + Sprintf(eos(filename), DATA_TEMPLATE, fname); + if (!(ofp = fopen(filename, WRTMODE))) { + perror(filename); + exit(EXIT_FAILURE); + } + Fprintf(ofp,"%s",Dont_Edit_Data); + + tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE); + grep0(ifp, tfp); + ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE); + + while (fgets(in_line, sizeof in_line, ifp) != 0) { + if (in_line[0] == '#') continue; /* discard comments */ + if (in_line[0] == '\n') continue; /* and empty lines */ + (void) fputs(xcrypt(in_line), ofp); + } + Fclose(ifp); + Fclose(ofp); + + delete_file(DATA_TEMPLATE, "grep.tmp"); + return; +} + void do_rumors() {