summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-10-21 07:40:27 +0000
committermarkm <markm@FreeBSD.org>2002-10-21 07:40:27 +0000
commite41bd31debce476e2f6ae864651c7380bea2cdbb (patch)
treeb90261e8ce260fee190d0f359aa2884ddf2510de /games
parent1cdc4d3dd3997f7f78a4a0ff9c52006837b0b5c4 (diff)
downloadFreeBSD-src-e41bd31debce476e2f6ae864651c7380bea2cdbb.zip
FreeBSD-src-e41bd31debce476e2f6ae864651c7380bea2cdbb.tar.gz
Deorbit complete. We dont build these anymore, so into the attic they go.
Diffstat (limited to 'games')
-rw-r--r--games/adventure/Makefile20
-rw-r--r--games/adventure/adventure.658
-rw-r--r--games/adventure/crc.c140
-rw-r--r--games/adventure/done.c146
-rw-r--r--games/adventure/glorkz1815
-rw-r--r--games/adventure/hdr.h221
-rw-r--r--games/adventure/init.c226
-rw-r--r--games/adventure/io.c557
-rw-r--r--games/adventure/main.c586
-rw-r--r--games/adventure/save.c195
-rw-r--r--games/adventure/setup.c122
-rw-r--r--games/adventure/subr.c862
-rw-r--r--games/adventure/vocab.c178
-rw-r--r--games/adventure/wizard.c156
-rw-r--r--games/arithmetic/Makefile8
-rw-r--r--games/arithmetic/arithmetic.6104
-rw-r--r--games/arithmetic/arithmetic.c393
-rw-r--r--games/atc/BUGS4
-rw-r--r--games/atc/Makefile17
-rw-r--r--games/atc/atc.6589
-rw-r--r--games/atc/def.h82
-rw-r--r--games/atc/extern.c79
-rw-r--r--games/atc/extern.h63
-rw-r--r--games/atc/games/Game_List5
-rw-r--r--games/atc/games/Killer21
-rw-r--r--games/atc/games/crossover14
-rw-r--r--games/atc/games/default21
-rw-r--r--games/atc/games/easy15
-rw-r--r--games/atc/games/game_222
-rw-r--r--games/atc/grammar.y390
-rw-r--r--games/atc/graphics.c425
-rw-r--r--games/atc/include.h86
-rw-r--r--games/atc/input.c670
-rw-r--r--games/atc/lex.l69
-rw-r--r--games/atc/list.c120
-rw-r--r--games/atc/log.c297
-rw-r--r--games/atc/main.c338
-rw-r--r--games/atc/pathnames.h39
-rw-r--r--games/atc/struct.h113
-rw-r--r--games/atc/tunable.c60
-rw-r--r--games/atc/tunable.h48
-rw-r--r--games/atc/update.c421
-rw-r--r--games/backgammon/Makefile5
-rw-r--r--games/backgammon/backgammon/Makefile15
-rw-r--r--games/backgammon/backgammon/backgammon.6198
-rw-r--r--games/backgammon/backgammon/extra.c257
-rw-r--r--games/backgammon/backgammon/main.c571
-rw-r--r--games/backgammon/backgammon/move.c556
-rw-r--r--games/backgammon/backgammon/text.c137
-rw-r--r--games/backgammon/backgammon/version.c45
-rw-r--r--games/backgammon/common_source/allow.c113
-rw-r--r--games/backgammon/common_source/back.h127
-rw-r--r--games/backgammon/common_source/board.c181
-rw-r--r--games/backgammon/common_source/check.c162
-rw-r--r--games/backgammon/common_source/fancy.c752
-rw-r--r--games/backgammon/common_source/init.c103
-rw-r--r--games/backgammon/common_source/odds.c117
-rw-r--r--games/backgammon/common_source/one.c173
-rw-r--r--games/backgammon/common_source/save.c186
-rw-r--r--games/backgammon/common_source/subs.c483
-rw-r--r--games/backgammon/common_source/table.c312
-rw-r--r--games/backgammon/teachgammon/Makefile15
-rw-r--r--games/backgammon/teachgammon/data.c319
-rw-r--r--games/backgammon/teachgammon/teach.c178
-rw-r--r--games/backgammon/teachgammon/ttext1.c188
-rw-r--r--games/backgammon/teachgammon/ttext2.c199
-rw-r--r--games/backgammon/teachgammon/tutor.c161
-rw-r--r--games/backgammon/teachgammon/tutor.h63
-rw-r--r--games/battlestar/Makefile20
-rw-r--r--games/battlestar/battlestar.6165
-rw-r--r--games/battlestar/battlestar.c102
-rw-r--r--games/battlestar/com1.c262
-rw-r--r--games/battlestar/com2.c307
-rw-r--r--games/battlestar/com3.c321
-rw-r--r--games/battlestar/com4.c390
-rw-r--r--games/battlestar/com5.c349
-rw-r--r--games/battlestar/com6.c238
-rw-r--r--games/battlestar/com7.c274
-rw-r--r--games/battlestar/cypher.c436
-rw-r--r--games/battlestar/dayfile.c1209
-rw-r--r--games/battlestar/dayobjs.c142
-rw-r--r--games/battlestar/externs.h361
-rw-r--r--games/battlestar/fly.c307
-rw-r--r--games/battlestar/getcom.c103
-rw-r--r--games/battlestar/globals.c223
-rw-r--r--games/battlestar/init.c145
-rw-r--r--games/battlestar/misc.c68
-rw-r--r--games/battlestar/nightfile.c1181
-rw-r--r--games/battlestar/nightobjs.c104
-rw-r--r--games/battlestar/parse.c113
-rw-r--r--games/battlestar/pathnames.h36
-rw-r--r--games/battlestar/room.c234
-rw-r--r--games/battlestar/save.c183
-rw-r--r--games/battlestar/words.c210
-rw-r--r--games/bs/Makefile9
-rw-r--r--games/bs/bs.643
-rw-r--r--games/bs/bs.c1246
-rw-r--r--games/canfield/Makefile5
-rw-r--r--games/canfield/canfield/Makefile18
-rw-r--r--games/canfield/canfield/canfield.6118
-rw-r--r--games/canfield/canfield/canfield.c1810
-rw-r--r--games/canfield/canfield/pathnames.h37
-rw-r--r--games/canfield/cfscores/Makefile8
-rw-r--r--games/canfield/cfscores/cfscores.c160
-rw-r--r--games/cribbage/Makefile19
-rw-r--r--games/cribbage/cards.c151
-rw-r--r--games/cribbage/crib.c633
-rw-r--r--games/cribbage/cribbage.6130
-rw-r--r--games/cribbage/cribbage.h116
-rw-r--r--games/cribbage/cribbage.n226
-rw-r--r--games/cribbage/cribcur.h57
-rw-r--r--games/cribbage/deck.h86
-rw-r--r--games/cribbage/extern.c72
-rw-r--r--games/cribbage/instr.c90
-rw-r--r--games/cribbage/io.c604
-rw-r--r--games/cribbage/pathnames.h38
-rw-r--r--games/cribbage/score.c373
-rw-r--r--games/cribbage/support.c362
-rw-r--r--games/dm/Makefile10
-rw-r--r--games/dm/dm.8110
-rw-r--r--games/dm/dm.c357
-rw-r--r--games/dm/dm.conf.5100
-rw-r--r--games/dm/pathnames.h39
-rw-r--r--games/fish/Makefile9
-rw-r--r--games/fish/fish.685
-rw-r--r--games/fish/fish.c466
-rw-r--r--games/fish/fish.instr29
-rw-r--r--games/fish/pathnames.h37
-rw-r--r--games/hack/COPYRIGHT6
-rw-r--r--games/hack/Makefile46
-rw-r--r--games/hack/Makequest196
-rw-r--r--games/hack/OWNER2
-rw-r--r--games/hack/Original_READ_ME61
-rw-r--r--games/hack/READ_ME92
-rw-r--r--games/hack/alloc.c48
-rw-r--r--games/hack/config.h140
-rw-r--r--games/hack/data232
-rw-r--r--games/hack/date.h2
-rw-r--r--games/hack/def.edog.h12
-rw-r--r--games/hack/def.eshk.h24
-rw-r--r--games/hack/def.flag.h42
-rw-r--r--games/hack/def.func_tab.h16
-rw-r--r--games/hack/def.gen.h15
-rw-r--r--games/hack/def.gold.h12
-rw-r--r--games/hack/def.mkroom.h26
-rw-r--r--games/hack/def.monst.h61
-rw-r--r--games/hack/def.obj.h48
-rw-r--r--games/hack/def.objclass.h60
-rw-r--r--games/hack/def.objects.h288
-rw-r--r--games/hack/def.permonst.h25
-rw-r--r--games/hack/def.rm.h53
-rw-r--r--games/hack/def.trap.h27
-rw-r--r--games/hack/def.wseg.h14
-rw-r--r--games/hack/hack.6152
-rw-r--r--games/hack/hack.Decl.c44
-rw-r--r--games/hack/hack.apply.c440
-rw-r--r--games/hack/hack.bones.c96
-rw-r--r--games/hack/hack.c801
-rw-r--r--games/hack/hack.cmd.c303
-rw-r--r--games/hack/hack.do.c489
-rw-r--r--games/hack/hack.do_name.c292
-rw-r--r--games/hack/hack.do_wear.c337
-rw-r--r--games/hack/hack.dog.c416
-rw-r--r--games/hack/hack.eat.c462
-rw-r--r--games/hack/hack.end.c643
-rw-r--r--games/hack/hack.engrave.c307
-rw-r--r--games/hack/hack.fight.c359
-rw-r--r--games/hack/hack.fix113
-rw-r--r--games/hack/hack.h161
-rw-r--r--games/hack/hack.invent.c864
-rw-r--r--games/hack/hack.ioctl.c57
-rw-r--r--games/hack/hack.lev.c286
-rw-r--r--games/hack/hack.main.c502
-rw-r--r--games/hack/hack.makemon.c199
-rw-r--r--games/hack/hack.mfndpos.h12
-rw-r--r--games/hack/hack.mhitu.c364
-rw-r--r--games/hack/hack.mklev.c744
-rw-r--r--games/hack/hack.mkmaze.c137
-rw-r--r--games/hack/hack.mkobj.c151
-rw-r--r--games/hack/hack.mkshop.c275
-rw-r--r--games/hack/hack.mon.c854
-rw-r--r--games/hack/hack.monst.c80
-rw-r--r--games/hack/hack.o_init.c162
-rw-r--r--games/hack/hack.objnam.c550
-rw-r--r--games/hack/hack.options.c204
-rw-r--r--games/hack/hack.pager.c408
-rw-r--r--games/hack/hack.potion.c387
-rw-r--r--games/hack/hack.pri.c661
-rw-r--r--games/hack/hack.read.c541
-rw-r--r--games/hack/hack.rip.c82
-rw-r--r--games/hack/hack.rumors.c64
-rw-r--r--games/hack/hack.save.c239
-rw-r--r--games/hack/hack.search.c134
-rw-r--r--games/hack/hack.sh14
-rw-r--r--games/hack/hack.shk.c988
-rw-r--r--games/hack/hack.shknam.c141
-rw-r--r--games/hack/hack.steal.c204
-rw-r--r--games/hack/hack.termcap.c280
-rw-r--r--games/hack/hack.timeout.c63
-rw-r--r--games/hack/hack.topl.c193
-rw-r--r--games/hack/hack.track.c39
-rw-r--r--games/hack/hack.trap.c451
-rw-r--r--games/hack/hack.tty.c346
-rw-r--r--games/hack/hack.u_init.c358
-rw-r--r--games/hack/hack.unix.c390
-rw-r--r--games/hack/hack.vault.c260
-rw-r--r--games/hack/hack.version.c16
-rw-r--r--games/hack/hack.wield.c100
-rw-r--r--games/hack/hack.wizard.c192
-rw-r--r--games/hack/hack.worm.c184
-rw-r--r--games/hack/hack.worn.c66
-rw-r--r--games/hack/hack.zap.c643
-rw-r--r--games/hack/help132
-rw-r--r--games/hack/hh55
-rw-r--r--games/hack/makedefs.c226
-rw-r--r--games/hack/pathnames.h39
-rw-r--r--games/hack/rnd.c33
-rw-r--r--games/hack/rumors505
-rw-r--r--games/hangman/Makefile14
-rw-r--r--games/hangman/endgame.c90
-rw-r--r--games/hangman/extern.c78
-rw-r--r--games/hangman/getguess.c114
-rw-r--r--games/hangman/getword.c80
-rw-r--r--games/hangman/hangman.651
-rw-r--r--games/hangman/hangman.h92
-rw-r--r--games/hangman/main.c84
-rw-r--r--games/hangman/pathnames.h36
-rw-r--r--games/hangman/playgame.c65
-rw-r--r--games/hangman/prdata.c63
-rw-r--r--games/hangman/prman.c60
-rw-r--r--games/hangman/prword.c54
-rw-r--r--games/hangman/setup.c78
-rw-r--r--games/larn/COPYRIGHT6
-rw-r--r--games/larn/Fixed.Bugs216
-rw-r--r--games/larn/Makefile79
-rw-r--r--games/larn/OWNER3
-rw-r--r--games/larn/README148
-rw-r--r--games/larn/bill.c157
-rw-r--r--games/larn/config.c47
-rw-r--r--games/larn/create.c464
-rw-r--r--games/larn/data.c652
-rw-r--r--games/larn/datfiles/larn.help140
-rw-r--r--games/larn/datfiles/larnmaze288
-rw-r--r--games/larn/datfiles/larnopts12
-rw-r--r--games/larn/diag.c314
-rw-r--r--games/larn/display.c435
-rw-r--r--games/larn/fortune.c91
-rw-r--r--games/larn/global.c622
-rw-r--r--games/larn/header.h442
-rw-r--r--games/larn/help.c88
-rw-r--r--games/larn/holidays66
-rw-r--r--games/larn/io.c920
-rw-r--r--games/larn/larn.6159
-rw-r--r--games/larn/main.c883
-rw-r--r--games/larn/monster.c1394
-rw-r--r--games/larn/moreobj.c373
-rw-r--r--games/larn/movem.c313
-rw-r--r--games/larn/nap.c121
-rw-r--r--games/larn/object.c808
-rw-r--r--games/larn/pathnames.h41
-rw-r--r--games/larn/regen.c93
-rw-r--r--games/larn/savelev.c48
-rw-r--r--games/larn/scores.c654
-rw-r--r--games/larn/signal.c151
-rw-r--r--games/larn/store.c695
-rw-r--r--games/larn/tok.c221
-rw-r--r--games/mille/Makefile13
-rw-r--r--games/mille/comp.c483
-rw-r--r--games/mille/end.c158
-rw-r--r--games/mille/extern.c177
-rw-r--r--games/mille/init.c258
-rw-r--r--games/mille/mille.6378
-rw-r--r--games/mille/mille.c172
-rw-r--r--games/mille/mille.h269
-rw-r--r--games/mille/misc.c263
-rw-r--r--games/mille/move.c576
-rw-r--r--games/mille/print.c177
-rw-r--r--games/mille/roll.c60
-rw-r--r--games/mille/save.c179
-rw-r--r--games/mille/types.c82
-rw-r--r--games/mille/varpush.c93
-rw-r--r--games/phantasia/COPYRIGHT24
-rw-r--r--games/phantasia/Makefile41
-rw-r--r--games/phantasia/OWNER6
-rw-r--r--games/phantasia/README82
-rw-r--r--games/phantasia/fight.c1693
-rw-r--r--games/phantasia/gamesupport.c725
-rw-r--r--games/phantasia/include.h18
-rw-r--r--games/phantasia/interplayer.c1211
-rw-r--r--games/phantasia/io.c439
-rw-r--r--games/phantasia/macros.h16
-rw-r--r--games/phantasia/main.c1303
-rw-r--r--games/phantasia/map.c160
-rw-r--r--games/phantasia/misc.c1708
-rw-r--r--games/phantasia/monsters.asc100
-rw-r--r--games/phantasia/pathnames.h52
-rw-r--r--games/phantasia/phantasia.61225
-rw-r--r--games/phantasia/phantdefs.h139
-rw-r--r--games/phantasia/phantglobs.c113
-rw-r--r--games/phantasia/phantglobs.h85
-rw-r--r--games/phantasia/phantstruct.h124
-rw-r--r--games/phantasia/setup.c268
-rw-r--r--games/piano/Makefile9
-rw-r--r--games/piano/README12
-rw-r--r--games/piano/piano.662
-rw-r--r--games/piano/piano.c167
-rw-r--r--games/pig/Makefile7
-rw-r--r--games/pig/pig.649
-rw-r--r--games/pig/pig.c131
-rw-r--r--games/quiz/Makefile16
-rw-r--r--games/quiz/datfiles/africa43
-rw-r--r--games/quiz/datfiles/america27
-rw-r--r--games/quiz/datfiles/areas124
-rw-r--r--games/quiz/datfiles/arith45
-rw-r--r--games/quiz/datfiles/asia41
-rw-r--r--games/quiz/datfiles/babies21
-rw-r--r--games/quiz/datfiles/bard228
-rw-r--r--games/quiz/datfiles/chinese12
-rw-r--r--games/quiz/datfiles/collectives105
-rw-r--r--games/quiz/datfiles/ed84
-rw-r--r--games/quiz/datfiles/elements103
-rw-r--r--games/quiz/datfiles/europe44
-rw-r--r--games/quiz/datfiles/flowers45
-rw-r--r--games/quiz/datfiles/greek7
-rw-r--r--games/quiz/datfiles/inca12
-rw-r--r--games/quiz/datfiles/index32
-rw-r--r--games/quiz/datfiles/latin157
-rw-r--r--games/quiz/datfiles/locomotive11
-rw-r--r--games/quiz/datfiles/midearth10
-rw-r--r--games/quiz/datfiles/morse26
-rw-r--r--games/quiz/datfiles/mult99
-rw-r--r--games/quiz/datfiles/murders25
-rw-r--r--games/quiz/datfiles/poetry184
-rw-r--r--games/quiz/datfiles/posneg50
-rw-r--r--games/quiz/datfiles/pres38
-rw-r--r--games/quiz/datfiles/province14
-rw-r--r--games/quiz/datfiles/seq-easy14
-rw-r--r--games/quiz/datfiles/seq-hard15
-rw-r--r--games/quiz/datfiles/sexes26
-rw-r--r--games/quiz/datfiles/sov42
-rw-r--r--games/quiz/datfiles/spell2
-rw-r--r--games/quiz/datfiles/state50
-rw-r--r--games/quiz/datfiles/trek19
-rw-r--r--games/quiz/datfiles/ucc127
-rw-r--r--games/quiz/pathnames.h37
-rw-r--r--games/quiz/quiz.6120
-rw-r--r--games/quiz/quiz.c384
-rw-r--r--games/quiz/quiz.h65
-rw-r--r--games/quiz/rxp.c318
-rw-r--r--games/rain/Makefile9
-rw-r--r--games/rain/rain.657
-rw-r--r--games/rain/rain.c148
-rw-r--r--games/robots/Makefile19
-rw-r--r--games/robots/extern.c79
-rw-r--r--games/robots/flush_in.c55
-rw-r--r--games/robots/init_field.c122
-rw-r--r--games/robots/main.c196
-rw-r--r--games/robots/make_level.c93
-rw-r--r--games/robots/move.c305
-rw-r--r--games/robots/move_robs.c156
-rw-r--r--games/robots/pathnames.h36
-rw-r--r--games/robots/play_level.c119
-rw-r--r--games/robots/query.c65
-rw-r--r--games/robots/rnd_pos.c71
-rw-r--r--games/robots/robots.6142
-rw-r--r--games/robots/robots.h107
-rw-r--r--games/robots/score.c189
-rw-r--r--games/rogue/CHANGES53
-rw-r--r--games/rogue/Makefile20
-rw-r--r--games/rogue/USD.doc/Makefile10
-rw-r--r--games/rogue/USD.doc/rogue.me836
-rw-r--r--games/rogue/hit.c460
-rw-r--r--games/rogue/init.c346
-rw-r--r--games/rogue/inventory.c778
-rw-r--r--games/rogue/level.c885
-rw-r--r--games/rogue/machdep.c555
-rw-r--r--games/rogue/main.c89
-rw-r--r--games/rogue/message.c385
-rw-r--r--games/rogue/monster.c882
-rw-r--r--games/rogue/move.c651
-rw-r--r--games/rogue/object.c789
-rw-r--r--games/rogue/pack.c579
-rw-r--r--games/rogue/pathnames.h36
-rw-r--r--games/rogue/play.c302
-rw-r--r--games/rogue/random.c147
-rw-r--r--games/rogue/ring.c340
-rw-r--r--games/rogue/rogue.6115
-rw-r--r--games/rogue/rogue.h474
-rw-r--r--games/rogue/room.c658
-rw-r--r--games/rogue/save.c445
-rw-r--r--games/rogue/score.c588
-rw-r--r--games/rogue/spec_hit.c538
-rw-r--r--games/rogue/throw.c326
-rw-r--r--games/rogue/trap.c287
-rw-r--r--games/rogue/use.c622
-rw-r--r--games/rogue/zap.c410
-rw-r--r--games/sail/Makefile19
-rw-r--r--games/sail/assorted.c278
-rw-r--r--games/sail/dr_1.c468
-rw-r--r--games/sail/dr_2.c280
-rw-r--r--games/sail/dr_3.c350
-rw-r--r--games/sail/dr_4.c69
-rw-r--r--games/sail/dr_5.c97
-rw-r--r--games/sail/dr_main.c112
-rw-r--r--games/sail/driver.h38
-rw-r--r--games/sail/externs.h310
-rw-r--r--games/sail/game.c91
-rw-r--r--games/sail/globals.c511
-rw-r--r--games/sail/lo_main.c95
-rw-r--r--games/sail/machdep.h46
-rw-r--r--games/sail/main.c112
-rw-r--r--games/sail/misc.c237
-rw-r--r--games/sail/parties.c80
-rw-r--r--games/sail/pathnames.h36
-rw-r--r--games/sail/pl_1.c139
-rw-r--r--games/sail/pl_2.c158
-rw-r--r--games/sail/pl_3.c280
-rw-r--r--games/sail/pl_4.c133
-rw-r--r--games/sail/pl_5.c259
-rw-r--r--games/sail/pl_6.c200
-rw-r--r--games/sail/pl_7.c473
-rw-r--r--games/sail/pl_main.c249
-rw-r--r--games/sail/player.h123
-rw-r--r--games/sail/sail.6897
-rw-r--r--games/sail/sync.c429
-rw-r--r--games/sail/version.c42
-rw-r--r--games/snake/Makefile5
-rw-r--r--games/snake/snake/Makefile23
-rw-r--r--games/snake/snake/move.c693
-rw-r--r--games/snake/snake/pathnames.h37
-rw-r--r--games/snake/snake/snake.6113
-rw-r--r--games/snake/snake/snake.c902
-rw-r--r--games/snake/snake/snake.h83
-rw-r--r--games/snake/snscore/Makefile8
-rw-r--r--games/snake/snscore/snscore.c125
-rw-r--r--games/trek/DOC/read_me.nr252
-rw-r--r--games/trek/DOC/things10
-rw-r--r--games/trek/DOC/trekmanual.nr896
-rw-r--r--games/trek/Makefile18
-rw-r--r--games/trek/USD.doc/Makefile10
-rw-r--r--games/trek/USD.doc/spell.ok72
-rw-r--r--games/trek/USD.doc/trek.me950
-rw-r--r--games/trek/abandon.c161
-rw-r--r--games/trek/attack.c192
-rw-r--r--games/trek/autover.c81
-rw-r--r--games/trek/capture.c132
-rw-r--r--games/trek/cgetc.c48
-rw-r--r--games/trek/check_out.c74
-rw-r--r--games/trek/checkcond.c108
-rw-r--r--games/trek/compkl.c116
-rw-r--r--games/trek/computer.c347
-rw-r--r--games/trek/damage.c95
-rw-r--r--games/trek/damaged.c71
-rw-r--r--games/trek/dcrept.c103
-rw-r--r--games/trek/destruct.c114
-rw-r--r--games/trek/dock.c148
-rw-r--r--games/trek/dumpgame.c167
-rw-r--r--games/trek/dumpme.c92
-rw-r--r--games/trek/dumpssradio.c89
-rw-r--r--games/trek/events.c467
-rw-r--r--games/trek/externs.c102
-rw-r--r--games/trek/getcodi.c72
-rw-r--r--games/trek/getpar.c301
-rw-r--r--games/trek/getpar.h45
-rw-r--r--games/trek/help.c161
-rw-r--r--games/trek/impulse.c84
-rw-r--r--games/trek/initquad.c156
-rw-r--r--games/trek/kill.c231
-rw-r--r--games/trek/klmove.c186
-rw-r--r--games/trek/lose.c89
-rw-r--r--games/trek/lrscan.c111
-rw-r--r--games/trek/main.c241
-rw-r--r--games/trek/move.c237
-rw-r--r--games/trek/nova.c145
-rw-r--r--games/trek/out.c60
-rw-r--r--games/trek/phaser.c373
-rw-r--r--games/trek/play.c114
-rw-r--r--games/trek/ram.c105
-rw-r--r--games/trek/ranf.c59
-rw-r--r--games/trek/rest.c84
-rw-r--r--games/trek/schedule.c177
-rw-r--r--games/trek/score.c108
-rw-r--r--games/trek/setup.c308
-rw-r--r--games/trek/setwarp.c68
-rw-r--r--games/trek/shield.c147
-rw-r--r--games/trek/snova.c162
-rw-r--r--games/trek/srscan.c194
-rw-r--r--games/trek/systemname.c71
-rw-r--r--games/trek/torped.c251
-rw-r--r--games/trek/trek.691
-rw-r--r--games/trek/trek.h382
-rw-r--r--games/trek/utility.c161
-rw-r--r--games/trek/visual.c105
-rw-r--r--games/trek/warp.c186
-rw-r--r--games/trek/win.c93
-rw-r--r--games/wargames/Makefile8
-rw-r--r--games/wargames/wargames.651
-rw-r--r--games/wargames/wargames.c46
-rw-r--r--games/worm/Makefile10
-rw-r--r--games/worm/worm.666
-rw-r--r--games/worm/worm.c332
-rw-r--r--games/worms/Makefile9
-rw-r--r--games/worms/worms.667
-rw-r--r--games/worms/worms.c344
-rw-r--r--games/wump/Makefile9
-rw-r--r--games/wump/pathnames.h37
-rw-r--r--games/wump/wump.6111
-rw-r--r--games/wump/wump.c859
-rw-r--r--games/wump/wump.info41
509 files changed, 0 insertions, 115054 deletions
diff --git a/games/adventure/Makefile b/games/adventure/Makefile
deleted file mode 100644
index b5a1b72..0000000
--- a/games/adventure/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/12/93
-# $FreeBSD$
-
-PROG= adventure
-SRCS= main.c init.c done.c save.c subr.c vocab.c wizard.c io.c data.c crc.c
-MAN= adventure.6
-HIDEGAME=hidegame
-CLEANFILES=data.c setup setup.o
-
-WARNS?= 2
-
-build-tools: setup
-
-data.c: glorkz setup
- ./setup ${.CURDIR}/glorkz > data.c
-
-setup: setup.o
- ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
-
-.include <bsd.prog.mk>
diff --git a/games/adventure/adventure.6 b/games/adventure/adventure.6
deleted file mode 100644
index a673585..0000000
--- a/games/adventure/adventure.6
+++ /dev/null
@@ -1,58 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" The game adventure was originally written in Fortran by Will Crowther
-.\" and Don Woods. It was later translated to C and enhanced by Jim
-.\" Gillogly. This code is derived from software contributed to Berkeley
-.\" by Jim Gillogly at The Rand Corporation.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)adventure.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt ADVENTURE 6
-.Os
-.Sh NAME
-.Nm adventure
-.Nd an exploration game
-.Sh SYNOPSIS
-.Nm
-.Op saved-file
-.Sh DESCRIPTION
-The object of the game is to locate and explore Colossal Cave, find the
-treasures hidden there, and bring them back to the building with you.
-The program is self-descriptive to a point, but part of the game is to
-discover its rules.
-.Pp
-To terminate a game, enter
-.Dq quit ;
-to save a game for later resumption, enter
-.Dq suspend .
diff --git a/games/adventure/crc.c b/games/adventure/crc.c
deleted file mode 100644
index 3c48d86..0000000
--- a/games/adventure/crc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * James W. Williams of the University of Maryland.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93";
-static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include "hdr.h"
-
-const u_long crctab[] = {
- 0x7fffffff,
- 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e,
- 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d,
- 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0,
- 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63,
- 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa,
- 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75,
- 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180,
- 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87,
- 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5,
- 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
- 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b,
- 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea,
- 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541,
- 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc,
- 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f,
- 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e,
- 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c,
- 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b,
- 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2,
- 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671,
- 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8,
- 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767,
- 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
- 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795,
- 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b,
- 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82,
- 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d,
- 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8,
- 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff,
- 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee,
- 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d,
- 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c,
- 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02,
- 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/*
- * crc --
- * Compute a POSIX.2 checksum. This routine modified by Jim Gillogly
- * to work on sequential data rather than on a file. Initial call to
- * crc_start initializes the sum, and subsequent calls to crc update
- * it.
- */
-
-u_long crcval;
-u_int step;
-
-void
-crc_start(void)
-{
- crcval = step = 0;
-}
-
-/* Process nr bytes at a time; ptr points to them */
-u_long
-crc(const char *ptr, size_t nr)
-{
- int i;
- const char *p;
-
- while (nr > 0)
- for (p = ptr; nr--; ++p)
- {
- if (!(i = crcval >> 24 ^ *p))
- {
- i = step++;
- if (step >= sizeof(crctab)/sizeof(crctab[0]))
- step = 0;
- }
- crcval = (crcval << 8) ^ crctab[i];
- }
- return crcval & 0xffffffff; /* Mask to 32 bits. */
-}
diff --git a/games/adventure/done.c b/games/adventure/done.c
deleted file mode 100644
index 61c2dec..0000000
--- a/games/adventure/done.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: termination routines */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "hdr.h"
-
-int
-score(void) /* sort of like 20000 */
-{ int scor,i;
- mxscor=scor=0;
- for (i=50; i<=maxtrs; i++)
- { if (ptext[i].txtlen==0) continue;
- k=12;
- if (i==chest) k=14;
- if (i>chest) k=16;
- if (prop[i]>=0) scor += 2;
- if (place[i]==3&&prop[i]==0) scor += k-2;
- mxscor += k;
- }
- scor += (maxdie-numdie)*10;
- mxscor += maxdie*10;
- if (!(scorng||gaveup)) scor += 4;
- mxscor += 4;
- if (dflag!=0) scor += 25;
- mxscor += 25;
- if (closng) scor += 25;
- mxscor += 25;
- if (closed)
- { if (bonus==0) scor += 10;
- if (bonus==135) scor += 25;
- if (bonus==134) scor += 30;
- if (bonus==133) scor += 45;
- }
- mxscor += 45;
- if (place[magzin]==108) scor++;
- mxscor++;
- scor += 2;
- mxscor += 2;
- for (i=1; i<=hntmax; i++)
- if (hinted[i]) scor -= hints[i][2];
- return(scor);
-}
-
-/* entry=1 means goto 13000 */ /* game is over */
-/* entry=2 means goto 20000 */ /* 3=19000 */
-void
-done(int entry)
-{ int i,sc;
- if (entry==1) mspeak(1);
- if (entry==3) rspeak(136);
- printf("\n\n\nYou scored %d out of a ",(sc=score()));
- printf("possible %d using %d turns.\n",mxscor,turns);
- for (i=1; i<=clsses; i++)
- if (cval[i]>=sc)
- { speak(&ctext[i]);
- if (i==clsses-1)
- { printf("To achieve the next higher rating");
- printf(" would be a neat trick!\n\n");
- printf("Congratulations!!\n");
- exit(0);
- }
- k=cval[i]+1-sc;
- printf("To achieve the next higher rating, you need");
- printf(" %d more point",k);
- if (k==1) printf(".\n");
- else printf("s.\n");
- exit(0);
- }
- printf("You just went off my scale!!!\n");
- exit(0);
-}
-
-
-void
-die(int entry) /* label 90 */
-{ int i;
- if (entry != 99)
- { rspeak(23);
- oldlc2=loc;
- }
- if (closng) /* 99 */
- { rspeak(131);
- numdie++;
- done(2);
- }
- yea=yes(81+numdie*2,82+numdie*2,54);
- numdie++;
- if (numdie==maxdie || !yea) done(2);
- place[water]=0;
- place[oil]=0;
- if (toting(lamp)) prop[lamp]=0;
- for (i=100; i>=1; i--)
- { if (!toting(i)) continue;
- k=oldlc2;
- if (i==lamp) k=1;
- drop(i,k);
- }
- loc=3;
- oldloc=loc;
-}
diff --git a/games/adventure/glorkz b/games/adventure/glorkz
deleted file mode 100644
index c65c8fd..0000000
--- a/games/adventure/glorkz
+++ /dev/null
@@ -1,1815 +0,0 @@
-1
-1 You are standing at the end of a road before a small brick building.
-1 Around you is a forest. A small stream flows out of the building and
-1 down a gully.
-2 You have walked up a hill, still in the forest. The road slopes back
-2 down the other side of the hill. There is a building in the distance.
-3 You are inside a building, a well house for a large spring.
-4 You are in a valley in the forest beside a stream tumbling along a
-4 rocky bed.
-5 You are in open forest, with a deep valley to one side.
-6 You are in open forest near both a valley and a road.
-7 At your feet all the water of the stream splashes into a 2-inch slit
-7 in the rock. Downstream the streambed is bare rock.
-8 You are in a 20-foot depression floored with bare dirt. Set into the
-8 dirt is a strong steel grate mounted in concrete. A dry streambed
-8 leads into the depression.
-9 You are in a small chamber beneath a 3x3 steel grate to the surface.
-9 A low crawl over cobbles leads inward to the west.
-10 You are crawling over cobbles in a low passage. There is a dim light
-10 at the east end of the passage.
-11 You are in a debris room filled with stuff washed in from the surface.
-11 A low wide passage with cobbles becomes plugged with mud and debris
-11 here, but an awkward canyon leads upward and west. A note on the wall
-11 says "Magic word XYZZY".
-12 You are in an awkward sloping east/west canyon.
-13 You are in a splendid chamber thirty feet high. The walls are frozen
-13 rivers of orange stone. An awkward canyon and a good passage exit
-13 from east and west sides of the chamber.
-14 At your feet is a small pit breathing traces of white mist. An east
-14 passage ends here except for a small crack leading on.
-15 You are at one end of a vast hall stretching forward out of sight to
-15 the west. There are openings to either side. Nearby, a wide stone
-15 staircase leads downward. The hall is filled with wisps of white mist
-15 swaying to and fro almost as if alive. A cold wind blows up the
-15 staircase. There is a passage at the top of a dome behind you.
-16 The crack is far too small for you to follow.
-17 You are on the east bank of a fissure slicing clear across the hall.
-17 The mist is quite thick here, and the fissure is too wide to jump.
-18 This is a low room with a crude note on the wall. The note says,
-18 "You won't get it up the steps".
-19 You are in the Hall of the Mountain King, with passages off in all
-19 directions.
-20 You are at the bottom of the pit with a broken neck.
-21 You didn't make it.
-22 The dome is unclimbable.
-23 You are at the west end of the Twopit Room. There is a large hole in
-23 the wall above the pit at this end of the room.
-24 You are at the bottom of the eastern pit in the Twopit Room. There is
-24 a small pool of oil in one corner of the pit.
-25 You are at the bottom of the western pit in the Twopit Room. There is
-25 a large hole in the wall about 25 feet above you.
-26 You clamber up the plant and scurry through the hole at the top.
-27 You are on the west side of the fissure in the Hall of Mists.
-28 You are in a low N/S passage at a hole in the floor. The hole goes
-28 down to an E/W passage.
-29 You are in the south side chamber.
-30 You are in the west side chamber of the Hall of the Mountain King.
-30 A passage continues west and up here.
-31 >$<
-32 You can't get by the snake.
-33 You are in a large room, with a passage to the south, a passage to the
-33 west, and a wall of broken rock to the east. There is a large "Y2" on
-33 a rock in the room's center.
-34 You are in a jumble of rock, with cracks everywhere.
-35 You're at a low window overlooking a huge pit, which extends up out of
-35 sight. A floor is indistinctly visible over 50 feet below. Traces of
-35 white mist cover the floor of the pit, becoming thicker to the right.
-35 Marks in the dust around the window would seem to indicate that
-35 someone has been here recently. Directly across the pit from you and
-35 25 feet away there is a similar window looking into a lighted room. A
-35 shadowy figure can be seen there peering back at you.
-36 You are in a dirty broken passage. To the east is a crawl. To the
-36 west is a large passage. Above you is a hole to another passage.
-37 You are on the brink of a small clean climbable pit. A crawl leads
-37 west.
-38 You are in the bottom of a small pit with a little stream, which
-38 enters and exits through tiny slits.
-39 You are in a large room full of dusty rocks. There is a big hole in
-39 the floor. There are cracks everywhere, and a passage leading east.
-40 You have crawled through a very low wide passage parallel to and north
-40 of the Hall of Mists.
-41 You are at the west end of Hall of Mists. A low wide crawl continues
-41 west and another goes north. To the south is a little passage 6 feet
-41 off the floor.
-42 You are in a maze of twisty little passages, all alike.
-43 You are in a maze of twisty little passages, all alike.
-44 You are in a maze of twisty little passages, all alike.
-45 You are in a maze of twisty little passages, all alike.
-46 Dead end
-47 Dead end
-48 Dead end
-49 You are in a maze of twisty little passages, all alike.
-50 You are in a maze of twisty little passages, all alike.
-51 You are in a maze of twisty little passages, all alike.
-52 You are in a maze of twisty little passages, all alike.
-53 You are in a maze of twisty little passages, all alike.
-54 Dead end
-55 You are in a maze of twisty little passages, all alike.
-56 Dead end
-57 You are on the brink of a thirty foot pit with a massive orange column
-57 down one wall. You could climb down here but you could not get back
-57 up. The maze continues at this level.
-58 Dead end
-59 You have crawled through a very low wide passage parallel to and north
-59 of the Hall of Mists.
-60 You are at the east end of a very long hall apparently without side
-60 chambers. To the east a low wide crawl slants up. To the north a
-60 round two foot hole slants down.
-61 You are at the west end of a very long featureless hall. The hall
-61 joins up with a narrow north/south passage.
-62 You are at a crossover of a high N/S passage and a low E/W one.
-63 Dead end
-64 You are at a complex junction. A low hands and knees passage from the
-64 north joins a higher crawl from the east to make a walking passage
-64 going west. There is also a large room above. The air is damp here.
-65 You are in Bedquilt, a long east/west passage with holes everywhere.
-65 To explore at random select north, south, up, or down.
-66 You are in a room whose walls resemble Swiss cheese. Obvious passages
-66 go west, east, NE, and NW. Part of the room is occupied by a large
-66 bedrock block.
-67 You are at the east end of the Twopit Room. The floor here is
-67 littered with thin rock slabs, which make it easy to descend the pits.
-67 There is a path here bypassing the pits to connect passages from east
-67 and west. There are holes all over, but the only big one is on the
-67 wall directly over the west pit where you can't get to it.
-68 You are in a large low circular chamber whose floor is an immense slab
-68 fallen from the ceiling (Slab Room). East and west there once were
-68 large passages, but they are now filled with boulders. Low small
-68 passages go north and south, and the south one quickly bends west
-68 around the boulders.
-69 You are in a secret N/S canyon above a large room.
-70 You are in a secret N/S canyon above a sizable passage.
-71 You are in a secret canyon at a junction of three canyons, bearing
-71 north, south, and SE. The north one is as tall as the other two
-71 combined.
-72 You are in a large low room. Crawls lead north, SE, and SW.
-73 Dead end crawl.
-74 You are in a secret canyon which here runs e/w. It crosses over a
-74 very tight canyon 15 feet below. If you go down you may not be able
-74 to get back up.
-75 You are at a wide place in a very tight N/S canyon.
-76 The canyon here becomes too tight to go further south.
-77 You are in a tall E/W canyon. A low tight crawl goes 3 feet north and
-77 seems to open up.
-78 The canyon runs into a mass of boulders -- dead end.
-79 The stream flows out through a pair of 1 foot diameter sewer pipes.
-79 It would be advisable to use the exit.
-80 You are in a maze of twisty little passages, all alike.
-81 Dead end
-82 Dead end
-83 You are in a maze of twisty little passages, all alike.
-84 You are in a maze of twisty little passages, all alike.
-85 Dead end
-86 Dead end
-87 You are in a maze of twisty little passages, all alike.
-88 You are in a long, narrow corridor stretching out of sight to the
-88 west. At the eastern end is a hole through which you can see a
-88 profusion of leaves.
-89 There is nothing here to climb. Use "up" or "out" to leave the pit.
-90 You have climbed up the plant and out of the pit.
-91 You are at the top of a steep incline above a large room. You could
-91 climb down here, but you would not be able to climb up. There is a
-91 passage leading back to the north.
-92 You are in the Giant Room. The ceiling here is too high up for your
-92 lamp to show it. Cavernous passages lead east, north, and south. On
-92 the west wall is scrawled the inscription, "Fee fie foe foo" [sic].
-93 The passage here is blocked by a recent cave-in.
-94 You are at one end of an immense north/south passage.
-95 You are in a magnificent cavern with a rushing stream, which cascades
-95 over a sparkling waterfall into a roaring whirlpool which disappears
-95 through a hole in the floor. Passages exit to the south and west.
-96 You are in the Soft Room. The walls are covered with heavy curtains,
-96 the floor with a thick pile carpet. Moss covers the ceiling.
-97 This is the Oriental Room. Ancient oriental cave drawings cover the
-97 walls. A gently sloping passage leads upward to the north, another
-97 passage leads SE, and a hands and knees crawl leads west.
-98 You are following a wide path around the outer edge of a large cavern.
-98 Far below, through a heavy white mist, strange splashing noises can be
-98 heard. The mist rises up through a fissure in the ceiling. The path
-98 exits to the south and west.
-99 You are in an alcove. A small NW path seems to widen after a short
-99 distance. An extremely tight tunnel leads east. It looks like a very
-99 tight squeeze. An eerie light can be seen at the other end.
-100 You're in a small chamber lit by an eerie green light. An extremely
-100 narrow tunnel exits to the west. A dark corridor leads ne.
-101 You're in the Dark-Room. A corridor leading south is the only exit.
-102 You are in an arched hall. A coral passage once continued up and east
-102 from here, but is now blocked by debris. The air smells of sea water.
-103 You're in a large room carved out of sedimentary rock. The floor and
-103 walls are littered with bits of shells embedded in the stone. A
-103 shallow passage proceeds downward, and a somewhat steeper one leads
-103 up. A low hands and knees passage enters from the south.
-104 You are in a long sloping corridor with ragged sharp walls.
-105 You are in a cul-de-sac about eight feet across.
-106 You are in an anteroom leading to a large passage to the east. Small
-106 passages go west and up. The remnants of recent digging are evident.
-106 A sign in midair here says "Cave under construction beyond this point.
-106 Proceed at own risk. [Witt construction company]"
-107 You are in a maze of twisty little passages, all different.
-108 You are at Witt's End. Passages lead off in *all* directions.
-109 You are in a north/south canyon about 25 feet across. The floor is
-109 covered by white mist seeping in from the north. The walls extend
-109 upward for well over 100 feet. Suspended from some unseen point far
-109 above you, an enormous two-sided mirror is hanging parallel to and
-109 midway between the canyon walls. (The mirror is obviously provided
-109 for the use of the dwarves, who as you know, are extremely vain.) A
-109 small window can be seen in either wall, some fifty feet up.
-110 You're at a low window overlooking a huge pit, which extends up out of
-110 sight. A floor is indistinctly visible over 50 feet below. Traces of
-110 white mist cover the floor of the pit, becoming thicker to the left.
-110 Marks in the dust around the window would seem to indicate that
-110 someone has been here recently. Directly across the pit from you and
-110 25 feet away there is a similar window looking into a lighted room. A
-110 shadowy figure can be seen there peering back at you.
-111 A large stalactite extends from the roof and almost reaches the floor
-111 below. You could climb down it, and jump from it to the floor, but
-111 having done so you would be unable to reach it to climb back up.
-112 You are in a little maze of twisting passages, all different.
-113 You are at the edge of a large underground reservoir. An opaque cloud
-113 of white mist fills the room and rises rapidly upward. The lake is
-113 fed by a stream, which tumbles out of a hole in the wall about 10 feet
-113 overhead and splashes noisily into the water somewhere within the
-113 mist. The only passage goes back toward the south.
-114 Dead end
-115 You are at the northeast end of an immense room, even larger than the
-115 Giant Room. It appears to be a repository for the "Adventure"
-115 program. Massive torches far overhead bathe the room with smoky
-115 yellow light. Scattered about you can be seen a pile of bottles (all
-115 of them empty), a nursery of young beanstalks murmuring quietly, a bed
-115 of oysters, a bundle of black rods with rusty stars on their ends, and
-115 a collection of brass lanterns. Off to one side a great many dwarves
-115 are sleeping on the floor, snoring loudly. A sign nearby reads: "Do
-115 not disturb the dwarves!" An immense mirror is hanging against one
-115 wall, and stretches to the other end of the room, where various other
-115 sundry objects can be glimpsed dimly in the distance.
-116 You are at the southwest end of the Repository. To one side is a pit
-116 full of fierce green snakes. On the other side is a row of small
-116 wicker cages, each of which contains a little sulking bird. In one
-116 corner is a bundle of black rods with rusty marks on their ends. A
-116 large number of velvet pillows are scattered about on the floor. A
-116 vast mirror stretches off to the northeast. At your feet is a large
-116 steel grate, next to which is a sign which reads, "Treasure Vault.
-116 Keys in Main Office."
-117 You are on one side of a large, deep chasm. A heavy white mist rising
-117 up from below obscures all view of the far side. A SW path leads away
-117 from the chasm into a winding corridor.
-118 You are in a long winding corridor sloping out of sight in both
-118 directions.
-119 You are in a secret canyon which exits to the north and east.
-120 You are in a secret canyon which exits to the north and east.
-121 You are in a secret canyon which exits to the north and east.
-122 You are on the far side of the chasm. A ne path leads away from the
-122 chasm on this side.
-123 You're in a long east/west corridor. A faint rumbling noise can be
-123 heard in the distance.
-124 The path forks here. The left fork leads northeast. A dull rumbling
-124 seems to get louder in that direction. The right fork leads southeast
-124 down a gentle slope. The main corridor enters from the west.
-125 The walls are quite warm here. From the north can be heard a steady
-125 roar, so loud that the entire cave seems to be trembling. Another
-125 passage leads south, and a low crawl goes east.
-126 You are on the edge of a breath-taking view. Far below you is an
-126 active volcano, from which great gouts of molten lava come surging
-126 out, cascading back down into the depths. The glowing rock fills the
-126 farthest reaches of the cavern with a blood-red glare, giving every-
-126 thing an eerie, macabre appearance. The air is filled with flickering
-126 sparks of ash and a heavy smell of brimstone. The walls are hot to
-126 the touch, and the thundering of the volcano drowns out all other
-126 sounds. Embedded in the jagged roof far overhead are myriad twisted
-126 formations composed of pure white alabaster, which scatter the murky
-126 light into sinister apparitions upon the walls. To one side is a deep
-126 gorge, filled with a bizarre chaos of tortured rock which seems to
-126 have been crafted by the devil himself. An immense river of fire
-126 crashes out from the depths of the volcano, burns its way through the
-126 gorge, and plummets into a bottomless pit far off to your left. To
-126 the right, an immense geyser of blistering steam erupts continuously
-126 from a barren island in the center of a sulfurous lake, which bubbles
-126 ominously. The far right wall is aflame with an incandescence of its
-126 own, which lends an additional infernal splendor to the already
-126 hellish scene. A dark, foreboding passage exits to the south.
-127 You are in a small chamber filled with large boulders. The walls are
-127 very warm, causing the air in the room to be almost stifling from the
-127 heat. The only exit is a crawl heading west, through which is coming
-127 a low rumbling.
-128 You are walking along a gently sloping north/south passage lined with
-128 oddly shaped limestone formations.
-129 You are standing at the entrance to a large, barren room. A sign
-129 posted above the entrance reads: "Caution! Bear in room!"
-130 You are inside a barren room. The center of the room is completely
-130 empty except for some dust. Marks in the dust lead away toward the
-130 far end of the room. The only exit is the way you came in.
-131 You are in a maze of twisting little passages, all different.
-132 You are in a little maze of twisty passages, all different.
-133 You are in a twisting maze of little passages, all different.
-134 You are in a twisting little maze of passages, all different.
-135 You are in a twisty little maze of passages, all different.
-136 You are in a twisty maze of little passages, all different.
-137 You are in a little twisty maze of passages, all different.
-138 You are in a maze of little twisting passages, all different.
-139 You are in a maze of little twisty passages, all different.
-140 Dead end
--1 End
-2
-1 You're at end of road again.
-2 You're at hill in road.
-3 You're inside building.
-4 You're in valley.
-5 You're in forest.
-6 You're in forest.
-7 You're at slit in streambed.
-8 You're outside grate.
-9 You're below the grate.
-10 You're in Cobble Crawl.
-11 You're in Debris Room.
-13 You're in Bird Chamber.
-14 You're at top of small pit.
-15 You're in Hall of Mists.
-17 You're on east bank of fissure.
-18 You're in Nugget of Gold Room.
-19 You're in Hall of Mt King.
-23 You're at west end of Twopit Room.
-24 You're in east pit.
-25 You're in west pit.
-33 You're at "Y2".
-35 You're at window on pit.
-36 You're in dirty passage.
-39 You're in Dusty Rock room.
-41 You're at west end of Hall of Mists.
-57 You're at brink of pit.
-60 You're at east end of Long Hall.
-61 You're at west end of Long Hall.
-64 You're at Complex Junction.
-66 You're in Swiss Cheese room.
-67 You're at east end of Twopit Room.
-68 You're in Slab Room.
-71 You're at junction of three secret canyons.
-74 You're in secret E/W canyon above tight canyon.
-88 You're in narrow corridor.
-91 You're at steep incline above large room.
-92 You're in Giant Room.
-95 You're in cavern with waterfall.
-96 You're in Soft Room.
-97 You're in Oriental Room.
-98 You're in Misty Cavern.
-99 You're in Alcove.
-100 You're in Plover Room.
-101 You're in Dark-Room.
-102 You're in Arched Hall.
-103 You're in Shell Room.
-106 You're in Anteroom.
-108 You're at Witt's End.
-109 You're in Mirror Canyon.
-110 You're at window on pit.
-111 You're at top of stalactite.
-113 You're at Reservoir.
-115 You're at NE end.
-116 You're at SW end.
-117 You're on SW side of chasm.
-118 You're in sloping corridor.
-122 You're on NE side of chasm.
-123 You're in corridor.
-124 You're at fork in path.
-125 You're at junction with warm walls.
-126 You're at Breath-taking View.
-127 You're in Chamber of Boulders.
-128 You're in limestone passage.
-129 You're in front of barren room.
-130 You're in Barren Room.
--1
-3
-1 2 2 44 29
-1 3 3 12 19 43
-1 4 5 13 14 46 30
-1 5 6 45 43
-1 8 63
-2 1 2 12 7 43 45 30
-2 5 6 45 46
-3 1 3 11 32 44
-3 11 62
-3 33 65
-3 79 5 14
-4 1 4 12 45
-4 5 6 43 44 29
-4 7 5 46 30
-4 8 63
-5 4 9 43 30
-5 50005 6 7 45
-5 6 6
-5 5 44 46
-6 1 2 45
-6 4 9 43 44 30
-6 5 6 46
-7 1 12
-7 4 4 45
-7 5 6 43 44
-7 8 5 15 16 46
-7 595 60 14 30
-8 5 6 43 44 46
-8 1 12
-8 7 4 13 45
-8 303009 3 19 30
-8 593 3
-9 303008 11 29
-9 593 11
-9 10 17 18 19 44
-9 14 31
-9 11 51
-10 9 11 20 21 43
-10 11 19 22 44 51
-10 14 31
-11 303008 63
-11 9 64
-11 10 17 18 23 24 43
-11 12 25 19 29 44
-11 3 62
-11 14 31
-12 303008 63
-12 9 64
-12 11 30 43 51
-12 13 19 29 44
-12 14 31
-13 303008 63
-13 9 64
-13 11 51
-13 12 25 43
-13 14 23 31 44
-14 303008 63
-14 9 64
-14 11 51
-14 13 23 43
-14 150020 30 31 34
-14 15 30
-14 16 33 44
-15 18 36 46
-15 17 7 38 44
-15 19 10 30 45
-15 150022 29 31 34 35 23 43
-15 14 29
-15 34 55
-16 14 1
-17 15 38 43
-17 312596 39
-17 412021 7
-17 412597 41 42 44 69
-17 27 41
-18 15 38 11 45
-19 15 10 29 43
-19 311028 45 36
-19 311029 46 37
-19 311030 44 7
-19 32 45
-19 35074 49
-19 211032 49
-19 74 66
-20 0 1
-21 0 1
-22 15 1
-23 67 43 42
-23 68 44 61
-23 25 30 31
-23 648 52
-24 67 29 11
-25 23 29 11
-25 724031 56
-25 26 56
-26 88 1
-27 312596 39
-27 412021 7
-27 412597 41 42 43 69
-27 17 41
-27 40 45
-27 41 44
-28 19 38 11 46
-28 33 45 55
-28 36 30 52
-29 19 38 11 45
-30 19 38 11 43
-30 62 44 29
-31 524089 1
-31 90 1
-32 19 1
-33 3 65
-33 28 46
-33 34 43 53 54
-33 35 44
-33 159302 71
-33 100 71
-34 33 30 55
-34 15 29
-35 33 43 55
-35 20 39
-36 37 43 17
-36 28 29 52
-36 39 44
-36 65 70
-37 36 44 17
-37 38 30 31 56
-38 37 56 29 11
-38 595 60 14 30 4 5
-39 36 43 23
-39 64 30 52 58
-39 65 70
-40 41 1
-41 42 46 29 23 56
-41 27 43
-41 59 45
-41 60 44 17
-42 41 29
-42 42 45
-42 43 43
-42 45 46
-42 80 44
-43 42 44
-43 44 46
-43 45 43
-44 43 43
-44 48 30
-44 50 46
-44 82 45
-45 42 44
-45 43 45
-45 46 43
-45 47 46
-45 87 29 30
-46 45 44 11
-47 45 43 11
-48 44 29 11
-49 50 43
-49 51 44
-50 44 43
-50 49 44
-50 51 30
-50 52 46
-51 49 44
-51 50 29
-51 52 43
-51 53 46
-52 50 44
-52 51 43
-52 52 46
-52 53 29
-52 55 45
-52 86 30
-53 51 44
-53 52 45
-53 54 46
-54 53 44 11
-55 52 44
-55 55 45
-55 56 30
-55 57 43
-56 55 29 11
-57 13 30 56
-57 55 44
-57 58 46
-57 83 45
-57 84 43
-58 57 43 11
-59 27 1
-60 41 43 29 17
-60 61 44
-60 62 45 30 52
-61 60 43
-61 62 45
-61 100107 46
-62 60 44
-62 63 45
-62 30 43
-62 61 46
-63 62 46 11
-64 39 29 56 59
-64 65 44 70
-64 103 45 74
-64 106 43
-65 64 43
-65 66 44
-65 80556 46
-65 68 61
-65 80556 29
-65 50070 29
-65 39 29
-65 60556 45
-65 75072 45
-65 71 45
-65 80556 30
-65 106 30
-66 65 47
-66 67 44
-66 80556 46
-66 77 25
-66 96 43
-66 50556 50
-66 97 72
-67 66 43
-67 23 44 42
-67 24 30 31
-68 23 46
-68 69 29 56
-68 65 45
-69 68 30 61
-69 331120 46
-69 119 46
-69 109 45
-69 113 75
-70 71 45
-70 65 30 23
-70 111 46
-71 65 48
-71 70 46
-71 110 45
-72 65 70
-72 118 49
-72 73 45
-72 97 48 72
-73 72 46 17 11
-74 19 43
-74 331120 44
-74 121 44
-74 75 30
-75 76 46
-75 77 45
-76 75 45
-77 75 43
-77 78 44
-77 66 45 17
-78 77 46
-79 3 1
-80 42 45
-80 80 44
-80 80 46
-80 81 43
-81 80 44 11
-82 44 46 11
-83 57 46
-83 84 43
-83 85 44
-84 57 45
-84 83 44
-84 114 50
-85 83 43 11
-86 52 29 11
-87 45 29 30
-88 25 30 56 43
-88 20 39
-88 92 44 27
-89 25 1
-90 23 1
-91 95 45 73 23
-91 72 30 56
-92 88 46
-92 93 43
-92 94 45
-93 92 46 27 11
-94 92 46 27 23
-94 309095 45 3 73
-94 611 45
-95 94 46 11
-95 92 27
-95 91 44
-96 66 44 11
-97 66 48
-97 72 44 17
-97 98 29 45 73
-98 97 46 72
-98 99 44
-99 98 50 73
-99 301 43 23
-99 100 43
-100 301 44 23 11
-100 99 44
-100 159302 71
-100 33 71
-100 101 47 22
-101 100 46 71 11
-102 103 30 74 11
-103 102 29 38
-103 104 30
-103 114618 46
-103 115619 46
-103 64 46
-104 103 29 74
-104 105 30
-105 104 29 11
-105 103 74
-106 64 29
-106 65 44
-106 108 43
-107 131 46
-107 132 49
-107 133 47
-107 134 48
-107 135 29
-107 136 50
-107 137 43
-107 138 44
-107 139 45
-107 61 30
-108 95556 43 45 46 47 48 49 50 29 30
-108 106 43
-108 626 44
-109 69 46
-109 113 45 75
-110 71 44
-110 20 39
-111 70 45
-111 40050 30 39 56
-111 50053 30
-111 45 30
-112 131 49
-112 132 45
-112 133 43
-112 134 50
-112 135 48
-112 136 47
-112 137 44
-112 138 30
-112 139 29
-112 140 46
-113 109 46 11 109
-114 84 48
-115 116 49
-116 115 47
-116 593 30
-117 118 49
-117 233660 41 42 69 47
-117 332661 41
-117 303 41
-117 332021 39
-117 596 39
-118 72 30
-118 117 29
-119 69 45 11
-119 653 43 7
-120 69 45
-120 74 43
-121 74 43 11
-121 653 45 7
-122 123 47
-122 233660 41 42 69 49
-122 303 41
-122 596 39
-122 124 77
-122 126 28
-122 129 40
-123 122 44
-123 124 43 77
-123 126 28
-123 129 40
-124 123 44
-124 125 47 36
-124 128 48 37 30
-124 126 28
-124 129 40
-125 124 46 77
-125 126 45 28
-125 127 43 17
-126 125 46 23 11
-126 124 77
-126 610 30 39
-127 125 44 11 17
-127 124 77
-127 126 28
-128 124 45 29 77
-128 129 46 30 40
-128 126 28
-129 128 44 29
-129 124 77
-129 130 43 19 40 3
-129 126 28
-130 129 44 11
-130 124 77
-130 126 28
-131 107 44
-131 132 48
-131 133 50
-131 134 49
-131 135 47
-131 136 29
-131 137 30
-131 138 45
-131 139 46
-131 112 43
-132 107 50
-132 131 29
-132 133 45
-132 134 46
-132 135 44
-132 136 49
-132 137 47
-132 138 43
-132 139 30
-132 112 48
-133 107 29
-133 131 30
-133 132 44
-133 134 47
-133 135 49
-133 136 43
-133 137 45
-133 138 50
-133 139 48
-133 112 46
-134 107 47
-134 131 45
-134 132 50
-134 133 48
-134 135 43
-134 136 30
-134 137 46
-134 138 29
-134 139 44
-134 112 49
-135 107 45
-135 131 48
-135 132 30
-135 133 46
-135 134 43
-135 136 44
-135 137 49
-135 138 47
-135 139 50
-135 112 29
-136 107 43
-136 131 44
-136 132 29
-136 133 49
-136 134 30
-136 135 46
-136 137 50
-136 138 48
-136 139 47
-136 112 45
-137 107 48
-137 131 47
-137 132 46
-137 133 30
-137 134 29
-137 135 50
-137 136 45
-137 138 49
-137 139 43
-137 112 44
-138 107 30
-138 131 43
-138 132 47
-138 133 29
-138 134 44
-138 135 45
-138 136 46
-138 137 48
-138 139 49
-138 112 50
-139 107 49
-139 131 50
-139 132 43
-139 133 44
-139 134 45
-139 135 30
-139 136 48
-139 137 29
-139 138 46
-139 112 47
-140 112 45 11
--1
-4
-2 road
-2 hill
-3 enter
-4 upstr
-5 downs
-6 fores
-7 forwa
-7 conti
-7 onwar
-8 back
-8 retur
-8 retre
-9 valle
-10 stair
-11 out
-11 outsi
-11 exit
-11 leave
-12 build
-12 house
-13 gully
-14 strea
-15 rock
-16 bed
-17 crawl
-18 cobbl
-19 inwar
-19 insid
-19 in
-20 surfa
-21 null
-21 nowhe
-22 dark
-23 passa
-23 tunne
-24 low
-25 canyo
-26 awkwa
-27 giant
-28 view
-29 upwar
-29 up
-29 u
-29 above
-29 ascen
-30 d
-30 downw
-30 down
-30 desce
-31 pit
-32 outdo
-33 crack
-34 steps
-35 dome
-36 left
-37 right
-38 hall
-39 jump
-40 barre
-41 over
-42 acros
-43 east
-43 e
-44 west
-44 w
-45 north
-45 n
-46 south
-46 s
-47 ne
-48 se
-49 sw
-50 nw
-51 debri
-52 hole
-53 wall
-54 broke
-55 y2
-56 climb
-57 look
-57 exami
-57 touch
-57 descr
-58 floor
-59 room
-60 slit
-61 slab
-61 slabr
-62 xyzzy
-63 depre
-64 entra
-65 plugh
-66 secre
-67 cave
-69 cross
-70 bedqu
-71 plove
-72 orien
-73 caver
-74 shell
-75 reser
-76 main
-76 offic
-77 fork
-1001 keys
-1001 key
-1002 lamp
-1002 headl
-1002 lante
-1003 grate
-1004 cage
-1005 wand
-1005 rod
-1006 wand
-1006 rod (must be next object after "real" rod)
-1007 steps
-1008 bird
-1009 door
-1010 pillo
-1010 velve
-1011 snake
-1012 fissu
-1013 table
-1014 clam
-1015 oyste
-1016 magaz
-1016 issue
-1016 spelu
-1016 "spel
-1017 dwarf
-1017 dwarv
-1018 knife
-1018 knive
-1019 food
-1019 ratio
-1020 bottl
-1020 jar
-1021 water
-1021 h2o
-1022 oil
-1023 mirro
-1024 plant
-1024 beans
-1025 plant (must be next object after "real" plant)
-1026 stala
-1027 shado
-1027 figur
-1028 axe
-1029 drawi
-1030 pirat
-1031 drago
-1032 chasm
-1033 troll
-1034 troll (must be next object after "real" troll)
-1035 bear
-1036 messa
-1037 volca
-1037 geyse (same as volcano)
-1038 machi
-1038 vendi
-1039 batte
-1040 carpe
-1040 moss
-1050 gold
-1050 nugge
-1051 diamo
-1052 silve
-1052 bars
-1053 jewel
-1054 coins
-1055 chest
-1055 box
-1055 treas
-1056 eggs
-1056 egg
-1056 nest
-1057 tride
-1058 vase
-1058 ming
-1058 shard
-1058 potte
-1059 emera
-1060 plati
-1060 pyram
-1061 pearl
-1062 rug
-1062 persi
-1063 spice
-1064 chain
-2001 carry
-2001 take
-2001 keep
-2001 catch
-2001 steal
-2001 captu
-2001 get
-2001 tote
-2002 drop
-2002 relea
-2002 free
-2002 disca
-2002 dump
-2003 say
-2003 chant
-2003 sing
-2003 utter
-2003 mumbl
-2004 unloc
-2004 open
-2005 nothi
-2006 lock
-2006 close
-2007 light
-2007 on
-2008 extin
-2008 off
-2009 wave
-2009 shake
-2009 swing
-2010 calm
-2010 placa
-2010 tame
-2011 walk
-2011 run
-2011 trave
-2011 go
-2011 proce
-2011 conti
-2011 explo
-2011 goto
-2011 follo
-2011 turn
-2012 attac
-2012 kill
-2012 slay
-2012 fight
-2012 hit
-2012 strik
-2013 pour
-2014 eat
-2014 devou
-2015 drink
-2016 rub
-2017 throw
-2017 toss
-2018 quit
-2019 find
-2019 where
-2020 inven
-2020 inv
-2021 feed
-2022 fill
-2023 blast
-2023 deton
-2023 ignit
-2023 blowu
-2024 score
-2025 fee
-2025 fie
-2025 foe
-2025 foo
-2025 fum
-2026 brief
-2027 read
-2027 perus
-2028 break
-2028 shatt
-2028 smash
-2029 wake
-2029 distu
-2030 suspe
-2030 pause
-2030 save
-2031 hours
-3001 fee
-3002 fie
-3003 foe
-3004 foo
-3005 fum
-3050 sesam
-3050 opens
-3050 abra
-3050 abrac
-3050 shaza
-3050 hocus
-3050 pocus
-3051 help
-3051 ?
-3064 tree
-3064 trees
-3066 dig
-3066 excav
-3068 lost
-3069 mist
-3079 fuck
-3139 stop
-3142 info
-3142 infor
-3147 swim
--1
-5
-1 Set of keys
-000 There are some keys on the ground here.
-2 Brass lantern
-000 There is a shiny brass lamp nearby.
-100 There is a lamp shining nearby.
-3 *Grate
-000 The grate is locked.
-100 The grate is open.
-4 Wicker cage
-000 There is a small wicker cage discarded nearby.
-5 Black rod
-000 A three foot black rod with a rusty star on an end lies nearby.
-6 Black rod
-000 A three foot black rod with a rusty mark on an end lies nearby.
-7 *Steps
-000 Rough stone steps lead down the pit.
-100 Rough stone steps lead up the dome.
-8 Little bird in cage
-000 A cheerful little bird is sitting here singing.
-100 There is a little bird in the cage.
-9 *Rusty door
-000 The way north is barred by a massive, rusty, iron door.
-100 The way north leads through a massive, rusty, iron door.
-10 Velvet pillow
-000 A small velvet pillow lies on the floor.
-11 *Snake
-000 A huge green fierce snake bars the way!
-100 >$< (Chased away)
-12 *Fissure
-000 >$<
-100 A crystal bridge now spans the fissure.
-200 The crystal bridge has vanished!
-13 *Stone tablet
-000 A massive stone tablet embedded in the wall reads:
-000 "Congratulations on bringing light into the Dark-Room!"
-14 Giant clam >grunt!<
-000 There is an enormous clam here with its shell tightly closed.
-15 Giant oyster >groan!<
-000 There is an enormous oyster here with its shell tightly closed.
-100 Interesting. There seems to be something written on the underside of
-100 The oyster.
-16 "Spelunker Today"
-000 There are a few recent issues of "Spelunker Today" magazine here.
-19 Tasty food
-000 There is food here.
-20 Small bottle
-000 There is a bottle of water here.
-100 There is an empty bottle here.
-200 There is a bottle of oil here.
-21 Water in the bottle
-22 Oil in the bottle
-23 *Mirror
-000 >$<
-24 *Plant
-000 There is a tiny little plant in the pit, murmuring "Water, water, ..."
-100 The plant spurts into furious growth for a few seconds.
-200 There is a 12-foot-tall beanstalk stretching up out of the pit,
-200 bellowing "WATER!! WATER!!"
-300 The plant grows explosively, almost filling the bottom of the pit.
-400 There is a gigantic beanstalk stretching all the way up to the hole.
-500 You've over-watered the plant! It's shriveling up! It's, it's...
-25 *Phony plant (seen in twopit room only when tall enough)
-000 >$<
-100 The top of a 12-foot-tall beanstalk is poking out of the west pit.
-200 There is a huge beanstalk growing out of the west pit up to the hole.
-26 *Stalactite
-000 >$<
-27 *Shadowy figure
-000 The shadowy figure seems to be trying to attract your attention.
-28 Dwarf's axe
-000 There is a little axe here.
-100 There is a little axe lying beside the bear.
-29 *Cave drawings
-000 >$<
-30 *Pirate
-000 >$<
-31 *Dragon
-000 A huge green fierce dragon bars the way!
-100 Congratulations! You have just vanquished a dragon with your bare
-100 hands! (Unbelievable, isn't it?)
-200 The body of a huge green dead dragon is lying off to one side.
-32 *Chasm
-000 A rickety wooden bridge extends across the chasm, vanishing into the
-000 mist. A sign posted on the bridge reads, "Stop! Pay troll!"
-100 The wreckage of a bridge (and a dead bear) can be seen at the bottom
-100 of the chasm.
-33 *Troll
-000 A burly troll stands by the bridge and insists you throw him a
-000 treasure before you may cross.
-100 The troll steps out from beneath the bridge and blocks your way.
-200 >$< (Chased away)
-34 *Phony troll
-000 The troll is nowhere to be seen.
-35 >$< (Bear uses rtext 141)
-000 There is a ferocious cave bear eying you from the far end of the room!
-100 There is a gentle cave bear sitting placidly in one corner.
-200 There is a contented-looking bear wandering about nearby.
-300 >$< (Dead)
-36 *Message in second maze
-000 There is a message scrawled in the dust in a flowery script, reading:
-000 "This is not the maze where the pirate leaves his treasure chest."
-37 *Volcano and/or geyser
-000 >$<
-38 *Vending machine
-000 There is a massive vending machine here. The instructions on it read:
-000 "Drop coins here to receive fresh batteries."
-39 Batteries
-000 There are fresh batteries here.
-100 Some worn-out batteries have been discarded nearby.
-40 *Carpet and/or moss
-000 >$<
-50 Large gold nugget
-000 There is a large sparkling nugget of gold here!
-51 Several diamonds
-000 There are diamonds here!
-52 Bars of silver
-000 There are bars of silver here!
-53 Precious jewelry
-000 There is precious jewelry here!
-54 Rare coins
-000 There are many coins here!
-55 Treasure chest
-000 The pirate's treasure chest is here!
-56 Golden eggs
-000 There is a large nest here, full of golden eggs!
-100 The nest of golden eggs has vanished!
-200 Done!
-57 Jeweled trident
-000 There is a jewel-encrusted trident here!
-58 Ming vase
-000 There is a delicate, precious, Ming vase here!
-100 The vase is now resting, delicately, on a velvet pillow.
-200 The floor is littered with worthless shards of pottery.
-300 The Ming vase drops with a delicate crash.
-59 Egg-sized emerald
-000 There is an emerald here the size of a plover's egg!
-60 Platinum pyramid
-000 There is a platinum pyramid here, 8 inches on a side!
-61 Glistening pearl
-000 Off to one side lies a glistening pearl!
-62 Persian rug
-000 There is a Persian rug spread out on the floor!
-100 The dragon is sprawled out on a Persian rug!!
-63 Rare spices
-000 There are rare spices here!
-64 Golden chain
-000 There is a golden chain lying in a heap on the floor!
-100 The bear is locked to the wall with a golden chain!
-200 There is a golden chain locked to the wall!
--1
-6
-1 Somewhere nearby is Colossal Cave, where others have found fortunes in
-1 treasure and gold, though it is rumored that some who enter are never
-1 seen again. Magic is said to work in the cave. I will be your eyes
-1 and hands. Direct me with commands of 1 or 2 words. I should warn
-1 you that I look at only the first five letters of each word, so you'll
-1 have to enter "northeast" as "ne" to distinguish it from "north".
-1 (Should you get stuck, type "help" for some general hints. For
-1 information on how to end your adventure, etc., type "info".)
-1 - - -
-1 This program was originally developed by Will Crowther. Most of the
-1 features of the current program were added by Don Woods. Address
-1 complaints about the UNIX version to Jim Gillogly (jim@rand.org).
-2 A little dwarf with a big knife blocks your way.
-3 A little dwarf just walked around a corner, saw you, threw a little
-3 axe at you (which missed), cursed, and ran away.
-4 There is a threatening little dwarf in the room with you!
-5 One sharp nasty knife is thrown at you!
-6 None of them hit you!
-7 One of them gets you!
-8 A hollow voice says "Plugh".
-9 There is no way to go that direction.
-10 I am unsure how you are facing. Use compass points or nearby objects.
-11 I don't know in from out here. Use compass points or name something
-11 in the general direction you want to go.
-12 I don't know how to apply that word here.
-13 I don't understand that!
-14 I'm game. Would you care to explain how?
-15 Sorry, but I am not allowed to give more detail. I will repeat the
-15 long description of your location.
-16 It is now pitch dark. If you proceed you will likely fall into a pit.
-17 If you prefer, simply type w rather than west.
-18 Are you trying to catch the bird?
-19 The bird is frightened right now and you cannot catch it no matter
-19 what you try. Perhaps you might try later.
-20 Are you trying to somehow deal with the snake?
-21 You can't kill the snake, or drive it away, or avoid it, or anything
-21 like that. There is a way to get by, but you don't have the necessary
-21 resources right now.
-22 Do you really want to quit now?
-23 You fell into a pit and broke every bone in your body!
-24 You are already carrying it!
-25 You can't be serious!
-26 The bird was unafraid when you entered, but as you approach it becomes
-26 disturbed and you cannot catch it.
-27 You can catch the bird, but you cannot carry it.
-28 There is nothing here with a lock!
-29 You aren't carrying it!
-30 The little bird attacks the green snake, and in an astounding flurry
-30 drives the snake away.
-31 You have no keys!
-32 It has no lock.
-33 I don't know how to lock or unlock such a thing.
-34 It was already locked.
-35 The grate is now locked.
-36 The grate is now unlocked.
-37 It was already unlocked.
-38 You have no source of light.
-39 Your lamp is now on.
-40 Your lamp is now off.
-41 There is no way to get past the bear to unlock the chain, which is
-41 probably just as well.
-42 Nothing happens.
-43 Where?
-44 There is nothing here to attack.
-45 The little bird is now dead. Its body disappears.
-46 Attacking the snake both doesn't work and is very dangerous.
-47 You killed a little dwarf.
-48 You attack a little dwarf, but he dodges out of the way.
-49 With what? Your bare hands?
-50 Good try, but that is an old worn-out magic word.
-51 I know of places, actions, and things. Most of my vocabulary
-51 describes places and is used to move you there. To move, try words
-51 like forest, building, downstream, enter, east, west, north, south,
-51 up, or down. I know about a few special objects, like a black rod
-51 hidden in the cave. These objects can be manipulated using some of
-51 the action words that I know. Usually you will need to give both the
-51 object and action words (in either order), but sometimes I can infer
-51 the object from the verb alone. Some objects also imply verbs; in
-51 particular, "inventory" implies "take inventory", which causes me to
-51 give you a list of what you're carrying. The objects have side
-51 effects; for instance, the rod scares the bird. Usually people having
-51 trouble moving just need to try a few more words. Usually people
-51 trying unsuccessfully to manipulate an object are attempting something
-51 beyond their (or my!) capabilities and should try a completely
-51 different tack. To speed the game you can sometimes move long
-51 distances with a single word. For example, "building" usually gets
-51 you to the building from anywhere above ground except when lost in the
-51 forest. Also, note that cave passages turn a lot, and that leaving a
-51 room to the north does not guarantee entering the next from the south.
-51 Good luck!
-52 It misses!
-53 It gets you!
-54 OK
-55 You can't unlock the keys.
-56 You have crawled around in some little holes and wound up back in the
-56 main passage.
-57 I don't know where the cave is, but hereabouts no stream can run on
-57 the surface for long. I would try the stream.
-58 I need more detailed instructions to do that.
-59 I can only tell you what you see as you move about and manipulate
-59 things. I cannot tell you where remote things are.
-60 I don't know that word.
-61 What?
-62 Are you trying to get into the cave?
-63 The grate is very solid and has a hardened steel lock. You cannot
-63 enter without a key, and there are no keys nearby. I would recommend
-63 looking elsewhere for the keys.
-64 The trees of the forest are large hardwood oak and maple, with an
-64 occasional grove of pine or spruce. There is quite a bit of under-
-64 growth, largely birch and ash saplings plus nondescript bushes of
-64 various sorts. This time of year visibility is quite restricted by
-64 all the leaves, but travel is quite easy if you detour around the
-64 spruce and berry bushes.
-65 Welcome to Adventure!! Would you like instructions?
-66 Digging without a shovel is quite impractical. Even with a shovel
-66 progress is unlikely.
-67 Blasting requires dynamite.
-68 I'm as confused as you are.
-69 Mist is a white vapor, usually water, seen from time to time in
-69 caverns. It can be found anywhere but is frequently a sign of a deep
-69 pit leading down to water.
-70 Your feet are now wet.
-71 I think I just lost my appetite.
-72 Thank you, it was delicious!
-73 You have taken a drink from the stream. The water tastes strongly of
-73 minerals, but is not unpleasant. It is extremely cold.
-74 The bottle of water is now empty.
-75 Rubbing the electric lamp is not particularly rewarding. Anyway,
-75 nothing exciting happens.
-76 Peculiar. Nothing unexpected happens.
-77 Your bottle is empty and the ground is wet.
-78 You can't pour that.
-79 Watch it!
-80 Which way?
-81 Oh dear, you seem to have gotten yourself killed. I might be able to
-81 help you out, but I've never really done this before. Do you want me
-81 to try to reincarnate you?
-82 All right. But don't blame me if something goes wr......
-82 --- Poof!! ---
-82 You are engulfed in a cloud of orange smoke. Coughing and gasping,
-82 you emerge from the smoke and find....
-83 You clumsy oaf, you've done it again! I don't know how long I can
-83 keep this up. Do you want me to try reincarnating you again?
-84 Okay, now where did I put my orange smoke?.... >poof!<
-84 Everything disappears in a dense cloud of orange smoke.
-85 Now you've really done it! I'm out of orange smoke! You don't expect
-85 me to do a decent reincarnation without any orange smoke, do you?
-86 Okay, if you're so smart, do it yourself! I'm leaving!
-90 >>> Messages 81 thru 90 are reserved for "obituaries". <<<
-91 Sorry, but I no longer seem to remember how it was you got here.
-92 You can't carry anything more. You'll have to drop something first.
-93 You can't go through a locked steel grate!
-94 I believe what you want is right here with you.
-95 You don't fit through a two-inch slit!
-96 I respectfully suggest you go across the bridge instead of jumping.
-97 There is no way across the fissure.
-98 You're not carrying anything.
-99 You are currently holding the following:
-100 It's not hungry (it's merely pinin' for the fjords). Besides, you
-100 have no bird seed.
-101 The snake has now devoured your bird.
-102 There's nothing here it wants to eat (except perhaps you).
-103 You fool, dwarves eat only coal! Now you've made him *really* mad!!
-104 You have nothing in which to carry it.
-105 Your bottle is already full.
-106 There is nothing here with which to fill the bottle.
-107 Your bottle is now full of water.
-108 Your bottle is now full of oil.
-109 You can't fill that.
-110 Don't be ridiculous!
-111 The door is extremely rusty and refuses to open.
-112 The plant indignantly shakes the oil off its leaves and asks, "water?"
-113 The hinges are quite thoroughly rusted now and won't budge.
-114 The oil has freed up the hinges so that the door will now move,
-114 although it requires some effort.
-115 The plant has exceptionally deep roots and cannot be pulled free.
-116 The dwarves' knives vanish as they strike the walls of the cave.
-117 Something you're carrying won't fit through the tunnel with you.
-117 You'd best take inventory and drop something.
-118 You can't fit this five-foot clam through that little passage!
-119 You can't fit this five-foot oyster through that little passage!
-120 I advise you to put down the clam before opening it. >strain!<
-121 I advise you to put down the oyster before opening it. >wrench!<
-122 You don't have anything strong enough to open the clam.
-123 You don't have anything strong enough to open the oyster.
-124 A glistening pearl falls out of the clam and rolls away. Goodness,
-124 this must really be an oyster. (I never was very good at identifying
-124 bivalves.) Whatever it is, it has now snapped shut again.
-125 The oyster creaks open, revealing nothing but oyster inside. It
-125 promptly snaps shut again.
-126 You have crawled around in some little holes and found your way
-126 blocked by a recent cave-in. You are now back in the main passage.
-127 There are faint rustling noises from the darkness behind you.
-128 Out from the shadows behind you pounces a bearded pirate! "Har, har,"
-128 he chortles, "I'll just take all this booty and hide it away with me
-128 chest deep in the maze!" He snatches your treasure and vanishes into
-128 the gloom.
-129 A sepulchral voice reverberating through the cave, says, "Cave closing
-129 soon. All adventurers exit immediately through Main Office."
-130 A mysterious recorded voice groans into life and announces:
-130 "This exit is closed. Please leave via Main Office."
-131 It looks as though you're dead. Well, seeing as how it's so close to
-131 closing time anyway, I think we'll just call it a day.
-132 The sepulchral voice intones, "The cave is now closed." As the echoes
-132 fade, there is a blinding flash of light (and a small puff of orange
-132 smoke). . . . As your eyes refocus, you look around and find...
-133 There is a loud explosion, and a twenty-foot hole appears in the far
-133 wall, burying the dwarves in the rubble. You march through the hole
-133 and find yourself in the Main Office, where a cheering band of
-133 friendly elves carry the conquering adventurer off into the sunset.
-134 There is a loud explosion, and a twenty-foot hole appears in the far
-134 wall, burying the snakes in the rubble. A river of molten lava pours
-134 in through the hole, destroying everything in its path, including you!
-135 There is a loud explosion, and you are suddenly splashed across the
-135 walls of the room.
-136 The resulting ruckus has awakened the dwarves. There are now several
-136 threatening little dwarves in the room with you! Most of them throw
-136 knives at you! All of them get you!
-137 Oh, leave the poor unhappy bird alone.
-138 I dare say whatever you want is around here somewhere.
-139 I don't know the word "stop". Use "quit" if you want to give up.
-140 You can't get there from here.
-141 You are being followed by a very large, tame bear.
-142 If you want to end your adventure early, say "quit". To suspend your
-142 adventure such that you can continue later, say "suspend" (or "pause"
-142 or "save"). To see what hours the cave is normally open, say "hours".
-142 To see how well you're doing, say "score". To get full credit for a
-142 treasure, you must have left it safely in the building, though you get
-142 partial credit just for locating it. You lose points for getting
-142 killed, or for quitting, though the former costs you more. There are
-142 also points based on how much (if any) of the cave you've managed to
-142 explore; in particular, there is a large bonus just for getting in (to
-142 distinguish the beginners from the rest of the pack), and there are
-142 other ways to determine whether you've been through some of the more
-142 harrowing sections. If you think you've found all the treasures, just
-142 keep exploring for a while. If nothing interesting happens, you
-142 haven't found them all yet. If something interesting *does* happen,
-142 it means you're getting a bonus and have an opportunity to garner many
-142 more points in the Master's Section. I may occasionally offer hints
-142 if you seem to be having trouble. If I do, I'll warn you in advance
-142 how much it will affect your score to accept the hints. Finally, to
-142 save paper, you may specify "brief", which tells me never to repeat
-142 the full description of a place unless you explicitly ask me to.
-143 Do you indeed wish to quit now?
-144 There is nothing here with which to fill the vase.
-145 The sudden change in temperature has delicately shattered the vase.
-146 It is beyond your power to do that.
-147 I don't know how.
-148 It is too far up for you to reach.
-149 You killed a little dwarf. The body vanishes in a cloud of greasy
-149 black smoke.
-150 The shell is very strong and is impervious to attack.
-151 What's the matter, can't you read? Now you'd best start over.
-152 The axe bounces harmlessly off the dragon's thick scales.
-153 The dragon looks rather nasty. You'd best not try to get by.
-154 The little bird attacks the green dragon, and in an astounding flurry
-154 gets burnt to a cinder. The ashes blow away.
-155 On what?
-156 Okay, from now on I'll only describe a place in full the first time
-156 you come to it. To get the full description, say "look".
-157 Trolls are close relatives with the rocks and have skin as tough as
-157 that of a rhinoceros. The troll fends off your blows effortlessly.
-158 The troll deftly catches the axe, examines it carefully, and tosses it
-158 back, declaring, "Good workmanship, but it's not valuable enough."
-159 The troll catches your treasure and scurries away out of sight.
-160 The troll refuses to let you cross.
-161 There is no longer any way across the chasm.
-162 Just as you reach the other side, the bridge buckles beneath the
-162 weight of the bear, which was still following you around. You
-162 scrabble desperately for support, but as the bridge collapses you
-162 stumble back and fall into the chasm.
-163 The bear lumbers toward the troll, who lets out a startled shriek and
-163 scurries away. The bear soon gives up the pursuit and wanders back.
-164 The axe misses and lands near the bear where you can't get at it.
-165 With what? Your bare hands? Against *his* bear hands??
-166 The bear is confused; he only wants to be your friend.
-167 For crying out loud, the poor thing is already dead!
-168 The bear eagerly wolfs down your food, after which he seems to calm
-168 down considerably and even becomes rather friendly.
-169 The bear is still chained to the wall.
-170 The chain is still locked.
-171 The chain is now unlocked.
-172 The chain is now locked.
-173 There is nothing here to which the chain can be locked.
-174 There is nothing here to eat.
-175 Do you want the hint?
-176 Do you need help getting out of the maze?
-177 You can make the passages look less alike by dropping things.
-178 Are you trying to explore beyond the Plover Room?
-179 There is a way to explore that region without having to worry about
-179 falling into a pit. None of the objects available is immediately
-179 useful in discovering the secret.
-180 Do you need help getting out of here?
-181 Don't go west.
-182 Gluttony is not one of the troll's vices. Avarice, however, is.
-183 Your lamp is getting dim. You'd best start wrapping this up, unless
-183 You can find some fresh batteries. I seem to recall there's a vending
-183 machine in the maze. Bring some coins with you.
-184 Your lamp has run out of power.
-185 There's not much point in wandering around out here, and you can't
-185 explore the cave without a lamp. So let's just call it a day.
-186 There are faint rustling noises from the darkness behind you. As you
-186 turn toward them, the beam of your lamp falls across a bearded pirate.
-186 He is carrying a large chest. "Shiver me timbers!" he cries, "I've
-186 been spotted! I'd best hie meself off to the maze to hide me chest!"
-186 With that, he vanishes into the gloom.
-187 Your lamp is getting dim. You'd best go back for those batteries.
-188 Your lamp is getting dim. I'm taking the liberty of replacing the
-188 batteries.
-189 Your lamp is getting dim, and you're out of spare batteries. You'd
-189 best start wrapping this up.
-190 I'm afraid the magazine is written in Dwarvish.
-191 "This is not the maze where the pirate leaves his treasure chest."
-192 Hmmm, this looks like a clue, which means it'll cost you 10 points to
-192 read it. Should I go ahead and read it anyway?
-193 It says, "there is something strange about this place, such that one
-193 of the words I've always known now has a new effect."
-194 It says the same thing it did before.
-195 I'm afraid I don't understand.
-196 "Congratulations on bringing light into the Dark-Room!"
-197 You strike the mirror a resounding blow, whereupon it shatters into a
-197 myriad tiny fragments.
-198 You have taken the vase and hurled it delicately to the ground.
-199 You prod the nearest dwarf, who wakes up grumpily, takes one look at
-199 you, curses, and grabs for his axe.
-200 Is this acceptable?
-201 There's no point in suspending a demonstration game.
-202 You awaken only to discover your bits have been dissolving while you
-202 slept. You disappear in a cloud of greasy black smoke.
--1
-7
-1 3
-2 3
-3 8 9
-4 10
-5 11
-6 0
-7 14 15
-8 13
-9 94 -1
-10 96
-11 19 -1
-12 17 27
-13 101 -1
-14 103
-15 0
-16 106
-17 0 -1
-18 0
-19 3
-20 3
-21 0
-22 0
-23 109 -1
-24 25 -1
-25 23 67
-26 111 -1
-27 35 110
-28 0
-29 97 -1
-30 0 -1
-31 119 121
-32 117 122
-33 117 122
-34 0 0
-35 130 -1
-36 0 -1
-37 126 -1
-38 140 -1
-39 0
-40 96 -1
-50 18
-51 27
-52 28
-53 29
-54 30
-55 0
-56 92
-57 95
-58 97
-59 100
-60 101
-61 0
-62 119 121
-63 127
-64 130 -1
--1
-8
-1 24
-2 29
-3 0
-4 33
-5 0
-6 33
-7 38
-8 38
-9 42
-10 14
-11 43
-12 110
-13 29
-14 110
-15 73
-16 75
-17 29
-18 13
-19 59
-20 59
-21 174
-22 109
-23 67
-24 13
-25 147
-26 155
-27 195
-28 146
-29 110
-30 13
-31 13
--1
-9
-0 1 2 3 4 5 6 7 8 9 10
-0 100 115 116 126
-2 1 3 4 7 38 95 113 24
-1 24
-3 46 47 48 54 56 58 82 85 86
-3 122 123 124 125 126 127 128 129 130
-4 8
-5 13
-6 19
-7 42 43 44 45 46 47 48 49 50 51
-7 52 53 54 55 56 80 81 82 86 87
-8 99 100 101
-9 108
--1
-10
-35 You are obviously a rank amateur. Better luck next time.
-100 Your score qualifies you as a Novice class Adventurer.
-130 You have achieved the rating: "Experienced Adventurer".
-200 You may now consider yourself a "Seasoned Adventurer".
-250 You have reached "Junior Master" status.
-300 Your score puts you in Master Adventurer Class C.
-330 Your score puts you in Master Adventurer Class B.
-349 Your score puts you in Master Adventurer Class A.
-9999 All of Adventuredom gives tribute to you, Adventurer Grandmaster!
--1
-11
-2 9999 10 0 0
-3 9999 5 0 0
-4 4 2 62 63
-5 5 2 18 19
-6 8 2 20 21
-7 75 4 176 177
-8 25 5 178 179
-9 20 3 180 181
--1
-12
-1 A large cloud of green smoke appears in front of you. It clears away
-1 to reveal a tall wizard, clothed in grey. He fixes you with a steely
-1 glare and declares, "This adventure has lasted too long." With that
-1 he makes a single pass over you with his hands, and everything around
-1 you fades away into a grey nothingness.
-2 Even wizards have to wait longer than that!
-3 I'm terribly sorry, but Colossal Cave is closed. Our hours are:
-4 Only wizards are permitted within the cave right now.
-5 We do allow visitors to make short explorations during our off hours.
-5 Would you like to do that?
-6 Colossal Cave is open to regular adventurers at the following hours:
-7 Very well.
-8 Only a wizard may continue an adventure this soon.
-9 I suggest you resume your adventure at a later time.
-10 Do you wish to see the hours?
-11 Do you wish to change the hours?
-12 New magic word (null to leave unchanged):
-13 New magic number (null to leave unchanged):
-14 Do you wish to change the message of the day?
-15 Okay. You can save this version now.
-16 Are you a wizard?
-17 Prove it! Say the magic word!
-18 That is not what I thought it was. Do you know what I thought it was?
-19 Oh dear, you really *are* a wizard! Sorry to have bothered you . . .
-20 Foo, you are nothing but a charlatan!
-21 New hours specified by defining "prime time". Give only the hour
-21 (E.g. 14, not 14:00 or 2pm). Enter a negative number after last pair.
-22 New hours for Colossal Cave:
-23 Limit lines to 70 chars. End with null line.
-24 Line too long, retype:
-25 Not enough room for another line. Ending message here.
-26 Do you wish to (re)schedule the next holiday?
-27 To begin how many days from today?
-28 To last how many days (zero if no holiday)?
-29 To be called what (up to 20 characters)?
-30 Too small! Assuming minimum value (45 minutes).
-31 Break out of this and save your core-image.
-32 Be sure to save your core-image...
--1
-0
- glorkz 8.1 93/05/31
diff --git a/games/adventure/hdr.h b/games/adventure/hdr.h
deleted file mode 100644
index 6f6f8df..0000000
--- a/games/adventure/hdr.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hdr.h 8.1 (Berkeley) 5/31/93
- */
-
-/* ADVENTURE -- Jim Gillogly, Jul 1977
- * This program is a re-write of ADVENT, written in FORTRAN mostly by
- * Don Woods of SAIL. In most places it is as nearly identical to the
- * original as possible given the language and word-size differences.
- * A few places, such as the message arrays and travel arrays were changed
- * to reflect the smaller core size and word size. The labels of the
- * original are reflected in this version, so that the comments of the
- * fortran are still applicable here.
- *
- * The data file distributed with the fortran source is assumed to be called
- * "glorkz" in the directory where the program is first run.
- *
- * $FreeBSD$
- */
-
-/* hdr.h: included by c advent files */
-#include <sys/types.h>
-#include <signal.h>
-
-int datfd; /* message file descriptor */
-volatile sig_atomic_t delhit;
-int yea;
-extern char data_file[]; /* Virtual data file */
-
-#define TAB 011
-#define LF 012
-#define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0)
-#define FLUSHLF while (next()!=LF)
-
-int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
-char *wd1,*wd2; /* the complete words */
-int verb,obj,spk;
-extern int blklin;
-int saved,savet,mxscor,latncy;
-
-#define SHORT 50 /* How short is a demo game? */
-
-#define MAXSTR 20 /* max length of user's words */
-
-#define HTSIZE 512 /* max number of vocab words */
-struct hashtab /* hash table for vocabulary */
-{ int val; /* word type &index (ktab) */
- char *atab; /* pointer to actual string */
-} voc[HTSIZE];
-
-#define SEED 1815622 /* "Encryption" seed */
-
-struct text
-#ifdef OLDSTUFF
-{ int seekadr; /* DATFILE must be < 2**16 */
-#endif /* !OLDSTUFF */
-{ char *seekadr; /* Msg start in virtual disk */
- int txtlen; /* length of msg starting here */
-};
-
-#define RTXSIZ 205
-struct text rtext[RTXSIZ]; /* random text messages */
-
-#define MAGSIZ 35
-struct text mtext[MAGSIZ]; /* magic messages */
-
-int clsses;
-#define CLSMAX 12
-struct text ctext[CLSMAX]; /* classes of adventurer */
-int cval[CLSMAX];
-
-struct text ptext[101]; /* object descriptions */
-
-#define LOCSIZ 141 /* number of locations */
-struct text ltext[LOCSIZ]; /* long loc description */
-struct text stext[LOCSIZ]; /* short loc descriptions */
-
-struct travlist /* direcs & conditions of travel*/
-{ struct travlist *next; /* ptr to next list entry */
- int conditions; /* m in writeup (newloc / 1000) */
- int tloc; /* n in writeup (newloc % 1000) */
- int tverb; /* the verb that takes you there*/
-} *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/
-
-int atloc[LOCSIZ];
-
-int plac[101]; /* initial object placement */
-int fixd[101],fixed[101]; /* location fixed? */
-
-int actspk[35]; /* rtext msg for verb <n> */
-
-int cond[LOCSIZ]; /* various condition bits */
-
-extern int setbit[16]; /* bit defn masks 1,2,4,... */
-
-int hntmax;
-int hints[20][5]; /* info on hints */
-int hinted[20],hintlc[20];
-
-int place[101], prop[101],linkx[201];
-int abb[LOCSIZ];
-
-int maxtrs,tally,tally2; /* treasure values */
-
-#define FALSE 0
-#define TRUE 1
-
-int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */
- bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin,
- dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon,
- chasm,troll,troll2,bear,messag,vend,batter,
- nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
- spices,
- back,look,cave,null,entrnc,dprssn,
- enter, stream, pour,
- say,lock,throw,find,invent;
-
-int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */
- odloc[7],dflag,daltlc;
-
-int tk[21],stick,dtotal,attack;
-int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters */
- abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2,
- closng,panic,closed,scorng;
-
-int demo,limit;
-
-int at (int objj);
-int bug (int n);
-void carry (int, int);
-void caveclose (void);
-void checkhints (void);
-void ciao (void);
-void closing (void);
-u_long crc (const char *ptr, size_t nr);
-void crc_start (void);
-int dark (void);
-void datime (int *d, int *t);
-char *decr (const unsigned char, const unsigned char, const unsigned char,
- const unsigned char, const unsigned char);
-void die (int entry);
-void done (int entry);
-void drop (int object,int where);
-void dstroy (int);
-int fdwarf (void);
-int forced (int locc);
-void getin (char **wrd1, char **wrd2);
-int here (int objj);
-void init (void);
-void juggle (int);
-int liq (void);
-int liqloc (int locc);
-int march (void);
-void move (int, int);
-void mspeak (int);
-int pct (int n);
-void poof (void);
-void pspeak (int m, int skip);
-int put (int, int, int);
-int ran (int range);
-void rdata (void);
-int restore (const char *infile);
-void rspeak (int);
-int save (const char *);
-int score (void);
-void speak (const struct text *);
-int Start (void);
-void startup (void);
-int toting (int objj);
-void trapdel (int sig);
-int trdrop (void);
-int trfeed (void);
-int trfill (void);
-int trkill (void);
-int tropen (void);
-int trsay (void);
-int trtake (void);
-int trtoss (void);
-int vocab (const char *,int,int);
-int yes (int x, int y, int z);
-int yesm (int x, int y, int z);
-
-/* We need to get a little tricky to avoid strings */
-#define DECR(a,b,c,d,e) decr(a+'+',b+'-',c+'#',d+'&',e+'%')
-
-gid_t egid;
diff --git a/games/adventure/init.c b/games/adventure/init.c
deleted file mode 100644
index d46218b..0000000
--- a/games/adventure/init.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: data initialization */
-
-#include <sys/types.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "hdr.h"
-
-int blklin = TRUE;
-
-int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
- 010000,020000,040000,0100000};
-
-static void linkdata (void);
-
-void
-init(void) /* everything for 1st time run */
-{
- rdata(); /* read data from orig. file */
- linkdata();
- poof();
-}
-
-char *
-decr(const unsigned char a, const unsigned char b, const unsigned char c,
- const unsigned char d, const unsigned char e)
-{
- static char buf[6];
-
- buf[0] = a-'+';
- buf[1] = b-'-';
- buf[2] = c-'#';
- buf[3] = d-'&';
- buf[4] = e-'%';
- buf[5] = 0;
- return buf;
-}
-
-static void
-linkdata(void) /* secondary data manipulation */
-{ int i,j;
-
- /* array linkages */
- for (i=1; i<=LOCSIZ; i++)
- if (ltext[i].seekadr!=0 && travel[i] != 0)
- if ((travel[i]->tverb)==1) cond[i]=2;
- for (j=100; j>0; j--)
- if (fixd[j]>0)
- { drop(j+100,fixd[j]);
- drop(j,plac[j]);
- }
- for (j=100; j>0; j--)
- { fixed[j]=fixd[j];
- if (plac[j]!=0 && fixd[j]<=0) drop(j,plac[j]);
- }
-
- maxtrs=79;
- tally=0;
- tally2=0;
-
- for (i=50; i<=maxtrs; i++)
- { if (ptext[i].seekadr!=0) prop[i] = -1;
- tally -= prop[i];
- }
-
- /* define mnemonics */
- keys = vocab(DECR('k','e','y','s','\0'), 1, 0);
- lamp = vocab(DECR('l','a','m','p','\0'), 1, 0);
- grate = vocab(DECR('g','r','a','t','e'), 1, 0);
- cage = vocab(DECR('c','a','g','e','\0'),1, 0);
- rod = vocab(DECR('r','o','d','\0','\0'),1, 0);
- rod2=rod+1;
- steps=vocab(DECR('s','t','e','p','s'),1, 0);
- bird = vocab(DECR('b','i','r','d','\0'),1, 0);
- door = vocab(DECR('d','o','o','r','\0'),1, 0);
- pillow= vocab(DECR('p','i','l','l','o'), 1, 0);
- snake = vocab(DECR('s','n','a','k','e'), 1, 0);
- fissur= vocab(DECR('f','i','s','s','u'), 1, 0);
- tablet= vocab(DECR('t','a','b','l','e'), 1, 0);
- clam = vocab(DECR('c','l','a','m','\0'),1, 0);
- oyster= vocab(DECR('o','y','s','t','e'), 1, 0);
- magzin= vocab(DECR('m','a','g','a','z'), 1, 0);
- dwarf = vocab(DECR('d','w','a','r','f'), 1, 0);
- knife = vocab(DECR('k','n','i','f','e'), 1, 0);
- food = vocab(DECR('f','o','o','d','\0'),1, 0);
- bottle= vocab(DECR('b','o','t','t','l'), 1, 0);
- water = vocab(DECR('w','a','t','e','r'), 1, 0);
- oil = vocab(DECR('o','i','l','\0','\0'),1, 0);
- plant = vocab(DECR('p','l','a','n','t'), 1, 0);
- plant2=plant+1;
- axe = vocab(DECR('a','x','e','\0','\0'), 1, 0);
- mirror= vocab(DECR('m','i','r','r','o'), 1, 0);
- dragon= vocab(DECR('d','r','a','g','o'), 1, 0);
- chasm = vocab(DECR('c','h','a','s','m'), 1, 0);
- troll = vocab(DECR('t','r','o','l','l'), 1, 0);
- troll2=troll+1;
- bear = vocab(DECR('b','e','a','r','\0'),1, 0);
- messag= vocab(DECR('m','e','s','s','a'), 1, 0);
- vend = vocab(DECR('v','e','n','d','i'), 1, 0);
- batter= vocab(DECR('b','a','t','t','e'), 1, 0);
-
- nugget= vocab(DECR('g','o','l','d','\0'),1, 0);
- coins = vocab(DECR('c','o','i','n','s'), 1, 0);
- chest = vocab(DECR('c','h','e','s','t'), 1, 0);
- eggs = vocab(DECR('e','g','g','s','\0'),1, 0);
- tridnt= vocab(DECR('t','r','i','d','e'), 1, 0);
- vase = vocab(DECR('v','a','s','e','\0'),1, 0);
- emrald= vocab(DECR('e','m','e','r','a'), 1, 0);
- pyram = vocab(DECR('p','y','r','a','m'), 1, 0);
- pearl = vocab(DECR('p','e','a','r','l'), 1, 0);
- rug = vocab(DECR('r','u','g','\0','\0'),1, 0);
- chain = vocab(DECR('c','h','a','i','n'), 1, 0);
-
- back = vocab(DECR('b','a','c','k','\0'),0, 0);
- look = vocab(DECR('l','o','o','k','\0'),0, 0);
- cave = vocab(DECR('c','a','v','e','\0'),0, 0);
- null = vocab(DECR('n','u','l','l','\0'),0, 0);
- entrnc= vocab(DECR('e','n','t','r','a'), 0, 0);
- dprssn= vocab(DECR('d','e','p','r','e'), 0, 0);
- enter = vocab(DECR('e','n','t','e','r'), 0, 0);
-
- pour = vocab(DECR('p','o','u','r','\0'), 2, 0);
- say = vocab(DECR('s','a','y','\0','\0'),2, 0);
- lock = vocab(DECR('l','o','c','k','\0'),2, 0);
- throw = vocab(DECR('t','h','r','o','w'), 2, 0);
- find = vocab(DECR('f','i','n','d','\0'),2, 0);
- invent= vocab(DECR('i','n','v','e','n'), 2, 0);
-
- /* initialize dwarves */
- chloc=114;
- chloc2=140;
- for (i=1; i<=6; i++)
- dseen[i]=FALSE;
- dflag=0;
- dloc[1]=19;
- dloc[2]=27;
- dloc[3]=33;
- dloc[4]=44;
- dloc[5]=64;
- dloc[6]=chloc;
- daltlc=18;
-
- /* random flags & ctrs */
- turns=0;
- lmwarn=FALSE;
- iwest=0;
- knfloc=0;
- detail=0;
- abbnum=5;
- for (i=0; i<=4; i++)
- if (rtext[2*i+81].seekadr!=0) maxdie=i+1;
- numdie=holdng=dkill=foobar=bonus=0;
- clock1=30;
- clock2=50;
- saved=0;
- closng=panic=closed=scorng=FALSE;
-}
-
-
-
-void
-trapdel(int sig) /* come here if he hits a del */
-{
- sig = 0;
- delhit = 1; /* main checks, treats as QUIT */
- signal(2,trapdel); /* catch subsequent DELs */
-}
-
-
-void
-startup(void)
-{
- demo=Start();
- srandomdev();
- hinted[3]=yes(65,1,0);
- newloc=1;
- delhit = 0;
- limit=330;
- if (hinted[3]) limit=1000; /* better batteries if instrucs */
-}
diff --git a/games/adventure/io.c b/games/adventure/io.c
deleted file mode 100644
index 04f17ee..0000000
--- a/games/adventure/io.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: file i/o and user i/o */
-
-#include "hdr.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <err.h>
-
-static int next (void);
-static int rnum (void);
-static void rdesc (int);
-static void rdflt (void);
-static void rhints (void);
-static void rliq (void);
-static void rlocs (void);
-static void rtrav (void);
-static void rvoc (void);
-#ifdef DEBUG
-static void twrite (int);
-#endif
-
-/* get command from user */
-/* no prompt, usually */
-void
-getin(char **wrd1, char **wrd2)
-{ char *s;
- static char wd1buf[MAXSTR],wd2buf[MAXSTR];
- int first, numch;
-
- *wrd1=wd1buf; /* return ptr to internal string*/
- *wrd2=wd2buf;
- wd2buf[0]=0; /* in case it isn't set here */
- for (s=wd1buf, first=1, numch=0;;)
- { if ((*s=getchar())>='A' && *s <='Z') *s = *s - ('A' -'a');
- /* convert to upper case */
- switch(*s) /* start reading from user */
- { case '\n':
- *s=0;
- return;
- case ' ':
- if (s==wd1buf||s==wd2buf) /* initial blank */
- continue;
- *s=0;
- if (first) /* finished 1st wd; start 2nd */
- { first=numch=0;
- s=wd2buf;
- break;
- }
- else /* finished 2nd word */
- { FLUSHLINE;
- *s=0;
- return;
- }
- case EOF:
- printf("user closed input stream, quitting...\n");
- exit(0);
- default:
- if (++numch>=MAXSTR) /* string too long */
- { printf("Give me a break!!\n");
- wd1buf[0]=wd2buf[0]=0;
- FLUSHLINE;
- return;
- }
- s++;
- }
- }
-}
-
-int
-yes(int x, int y, int z) /* confirm with rspeak */
-{ int result;
- int ch;
-
- result = FALSE;
- for (;;)
- { rspeak(x); /* tell him what we want*/
- if ((ch=getchar())=='y')
- result=TRUE;
- else if (ch=='n') result=FALSE;
- else if (ch == EOF) {
- printf("user closed input stream, quitting...\n");
- exit(0);
- }
- FLUSHLINE;
- if (ch=='y'|| ch=='n') break;
- printf("Please answer the question.\n");
- }
- if (result==TRUE) rspeak(y);
- if (result==FALSE) rspeak(z);
- return(result);
-}
-
-int
-yesm(int x, int y, int z) /* confirm with mspeak */
-{ int result;
- int ch;
-
- result = FALSE;
- for (;;)
- { mspeak(x); /* tell him what we want*/
- if ((ch=getchar())=='y')
- result=TRUE;
- else if (ch=='n') result=FALSE;
- else if (ch == EOF) {
- printf("user closed input stream, quitting...\n");
- exit(0);
- }
- FLUSHLINE;
- if (ch=='y'|| ch=='n') break;
- printf("Please answer the question.\n");
- }
- if (result==TRUE) mspeak(y);
- if (result==FALSE) mspeak(z);
- return(result);
-}
-
-/* FILE *inbuf,*outbuf; */
-
-char *inptr; /* Pointer into virtual disk */
-
-int outsw = 0; /* putting stuff to data file? */
-
-const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
-const char *tape = iotape; /* pointer to encryption tape */
-
-static int
-next(void) /* next virtual char, bump adr */
-{
- int ch;
-
- ch=(*inptr ^ random()) & 0xFF; /* Decrypt input data */
- if (outsw) /* putting data in tmp file */
- { if (*tape==0) tape=iotape; /* rewind encryption tape */
- *inptr = ch ^ *tape++; /* re-encrypt and replace value */
- }
- inptr++;
- return(ch);
-}
-
-char breakch; /* tell which char ended rnum */
-
-void
-rdata(void) /* "read" data from virtual file*/
-{ int sect;
- char ch;
-
- inptr = data_file; /* Pointer to virtual data file */
- srandom(SEED); /* which is lightly encrypted. */
-
- clsses=1;
- for (;;) /* read data sections */
- { sect=next()-'0'; /* 1st digit of section number */
-#ifdef VERBOSE
- printf("Section %c",sect+'0');
-#endif
- if ((ch=next())!=LF) /* is there a second digit? */
- {
- FLUSHLF;
-#ifdef VERBOSE
- putchar(ch);
-#endif
- sect=10*sect+ch-'0';
- }
-#ifdef VERBOSE
- putchar('\n');
-#endif
- switch(sect)
- { case 0: /* finished reading database */
- return;
- case 1: /* long form descriptions */
- rdesc(1);
- break;
- case 2: /* short form descriptions */
- rdesc(2);
- break;
- case 3: /* travel table */
- rtrav(); break;
- case 4: /* vocabulary */
- rvoc();
- break;
- case 5: /* object descriptions */
- rdesc(5);
- break;
- case 6: /* arbitrary messages */
- rdesc(6);
- break;
- case 7: /* object locations */
- rlocs(); break;
- case 8: /* action defaults */
- rdflt(); break;
- case 9: /* liquid assets */
- rliq(); break;
- case 10: /* class messages */
- rdesc(10);
- break;
- case 11: /* hints */
- rhints(); break;
- case 12: /* magic messages */
- rdesc(12);
- break;
- default:
- printf("Invalid data section number: %d\n",sect);
- for (;;) putchar(next());
- }
- if (breakch!=LF) /* routines return after "-1" */
- FLUSHLF;
- }
-}
-
-char nbf[12];
-
-
-static int
-rnum(void) /* read initial location num */
-{ char *s;
- tape = iotape; /* restart encryption tape */
- for (s=nbf,*s=0;; s++)
- if ((*s=next())==TAB || *s=='\n' || *s==LF)
- break;
- breakch= *s; /* save char for rtrav() */
- *s=0; /* got the number as ascii */
- if (nbf[0]=='-') return(-1); /* end of data */
- return(atoi(nbf)); /* convert it to integer */
-}
-
-char *seekhere;
-
-static void
-rdesc(int sect) /* read description-format msgs */
-{
- int locc;
- char *seekstart, *maystart;
-
- seekhere = inptr; /* Where are we in virtual file?*/
- outsw=1; /* these msgs go into tmp file */
- for (oldloc= -1, seekstart=seekhere;;)
- { maystart=inptr; /* maybe starting new entry */
- if ((locc=rnum())!=oldloc && oldloc>=0 /* finished msg */
- && ! (sect==5 && (locc==0 || locc>=100)))/* unless sect 5*/
- { switch(sect) /* now put it into right table */
- { case 1: /* long descriptions */
- ltext[oldloc].seekadr=seekhere;
- ltext[oldloc].txtlen=maystart-seekstart;
- break;
- case 2: /* short descriptions */
- stext[oldloc].seekadr=seekhere;
- stext[oldloc].txtlen=maystart-seekstart;
- break;
- case 5: /* object descriptions */
- ptext[oldloc].seekadr=seekhere;
- ptext[oldloc].txtlen=maystart-seekstart;
- break;
- case 6: /* random messages */
- if (oldloc>RTXSIZ)
- { errx(1, "Too many random msgs");
- }
- rtext[oldloc].seekadr=seekhere;
- rtext[oldloc].txtlen=maystart-seekstart;
- break;
- case 10: /* class messages */
- ctext[clsses].seekadr=seekhere;
- ctext[clsses].txtlen=maystart-seekstart;
- cval[clsses++]=oldloc;
- break;
- case 12: /* magic messages */
- if (oldloc>MAGSIZ)
- { errx(1, "Too many magic msgs");
- }
- mtext[oldloc].seekadr=seekhere;
- mtext[oldloc].txtlen=maystart-seekstart;
- break;
- default:
- errx(1, "rdesc called with bad section");
- }
- seekhere += maystart-seekstart;
- }
- if (locc<0)
- { outsw=0; /* turn off output */
- seekhere += 3; /* -1<delimiter> */
- return;
- }
- if (sect!=5 || (locc>0 && locc<100))
- { if (oldloc!=locc)/* starting a new message */
- seekstart=maystart;
- oldloc=locc;
- }
- FLUSHLF; /* scan the line */
- }
-}
-
-
-static void
-rtrav(void) /* read travel table */
-{ int locc;
- struct travlist *t;
- char *s;
- char buf[12];
- int len,m,n,entries;
-
- entries = 0;
- t = NULL;
- for (oldloc= -1;;) /* get another line */
- { if ((locc=rnum())!=oldloc && oldloc>=0) /* end of entry */
- {
- t->next = 0; /* terminate the old entry */
-#if DEBUG
- printf("%d:%d entries\n",oldloc,entries);
- twrite(oldloc);
-#endif
- }
- if (locc== -1) return;
- if (locc!=oldloc) /* getting a new entry */
- { t=travel[locc]=(struct travlist *) malloc(sizeof (struct travlist));
- /* printf("New travel list for %d\n",locc); */
- if (t == NULL)
- errx(1, "Out of memory!");
- entries=0;
- oldloc=locc;
- }
- s = buf;
- for (;; s++) /* get the newloc number /ASCII */
- if ((*s=next())==TAB || *s==LF) break;
- *s=0;
- len=strlen(buf); /* quad long number handling */
- /* printf("Newloc: %s (%d chars)\n",buf,len); */
- if (len<4) /* no "m" conditions */
- { m=0;
- n=atoi(buf); /* newloc mod 1000 = newloc */
- }
- else /* a long integer */
- { n=atoi(buf+len-3);
- buf[len-3]=0; /* terminate newloc/1000 */
- m=atoi(buf);
- }
- while (breakch!=LF) /* only do one line at a time */
- { if (entries++) {
- t=t->next=(struct travlist *) malloc(sizeof (struct travlist));
- if (t == NULL)
- errx(1, "Out of memory!");
- }
- t->tverb=rnum();/* get verb from the file */
- t->tloc=n; /* table entry mod 1000 */
- t->conditions=m;/* table entry / 1000 */
- /* printf("entry %d for %d\n",entries,locc); */
- }
- }
-}
-
-#ifdef DEBUG
-
-static void
-twrite(int loq) /* travel options from this loc */
-{ struct travlist *t;
- printf("If");
- speak(&ltext[loq]);
- printf("then\n");
- for (t=travel[loq]; t!=0; t=t->next)
- { printf("verb %d takes you to ",t->tverb);
- if (t->tloc<=300)
- speak(&ltext[t->tloc]);
- else if (t->tloc<=500)
- printf("special code %d\n",t->tloc-300);
- else
- rspeak(t->tloc-500);
- printf("under conditions %d\n",t->conditions);
- }
-}
-
-#endif /* DEBUG */
-
-static void
-rvoc(void)
-{ char *s; /* read the vocabulary */
- int rv_index;
- char buf[6];
- for (;;)
- { rv_index=rnum();
- if (rv_index<0) break;
- for (s=buf,*s=0;; s++) /* get the word */
- if ((*s=next())==TAB || *s=='\n' || *s==LF
- || *s==' ') break;
- /* terminate word with newline, LF, tab, blank */
- if (*s!='\n' && *s!=LF) FLUSHLF; /* can be comments */
- *s=0;
- /* printf("\"%s\"=%d\n",buf,index);*/
- vocab(buf,-2,rv_index);
- }
-}
-
-
-static void
-rlocs(void) /* initial object locations */
-{ for (;;)
- { if ((obj=rnum())<0) break;
- plac[obj]=rnum(); /* initial loc for this obj */
- if (breakch==TAB) /* there's another entry */
- fixd[obj]=rnum();
- else fixd[obj]=0;
- }
-}
-
-static void
-rdflt(void) /* default verb messages */
-{ for (;;)
- { if ((verb=rnum())<0) break;
- actspk[verb]=rnum();
- }
-}
-
-static void
-rliq(void) /* liquid assets &c: cond bits */
-{ int bitnum;
- for (;;) /* read new bit list */
- { if ((bitnum=rnum())<0) break;
- for (;;) /* read locs for bits */
- { cond[rnum()] |= setbit[bitnum];
- if (breakch==LF) break;
- }
- }
-}
-
-static void
-rhints(void)
-{ int hintnum,i;
- hntmax=0;
- for (;;)
- { if ((hintnum=rnum())<0) break;
- for (i=1; i<5; i++)
- hints[hintnum][i]=rnum();
- if (hintnum>hntmax) hntmax=hintnum;
- }
-}
-
-
-void
-rspeak(int msg)
-{ if (msg!=0) speak(&rtext[msg]);
-}
-
-
-void
-mspeak(int msg)
-{ if (msg!=0) speak(&mtext[msg]);
-}
-
-/* read, decrypt, and print a message (not ptext) */
-/* msg is a pointer to seek address and length of mess */
-void
-speak(const struct text *msg)
-{
- char *s, nonfirst;
-
- s = msg->seekadr;
- nonfirst=0;
- while (s - msg->seekadr < msg->txtlen) /* read a line at a time */
- { tape=iotape; /* restart decryption tape */
- while ((*s++ ^ *tape++) != TAB); /* read past loc num */
- /* assume tape is longer than location number */
- /* plus the lookahead put together */
- if ((*s ^ *tape) == '>' &&
- (*(s+1) ^ *(tape+1)) == '$' &&
- (*(s+2) ^ *(tape+2)) == '<') break;
- if (blklin && !nonfirst++) putchar('\n');
- do
- { if (*tape == 0) tape = iotape;/* rewind decryp tape */
- putchar(*s ^ *tape);
- } while ((*s++ ^ *tape++) != LF); /* better end with LF */
- }
-}
-
-/* read, decrypt an print a ptext message */
-/* msg is the number of all the p msgs for this place */
-/* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
-void
-pspeak(int m, int skip)
-{
- char *s,nonfirst;
- char *numst, ps_save;
- struct text *msg;
- char *tbuf;
-
- msg = &ptext[m];
- if ((tbuf = malloc((unsigned int)(msg->txtlen + 1))) == 0)
- errx(1, "Out of memory!");
- memcpy(tbuf, msg->seekadr, (size_t)msg->txtlen + 1); /* Room to null */
- s = tbuf;
-
- nonfirst=0;
- while (s - tbuf < msg->txtlen) /* read line at a time */
- { tape=iotape; /* restart decryption tape */
- for (numst=s; (*s^= *tape++)!=TAB; s++); /* get number */
-
- ps_save = *s; /* Temporarily trash the string (cringe) */
- *s++ = 0; /* decrypting number within the string */
-
- if (atoi(numst) != 100 * skip && skip >= 0)
- { while ((*s++^*tape++)!=LF) /* flush the line */
- if (*tape==0) tape=iotape;
- continue;
- }
- if ((*s^*tape)=='>' && (*(s+1)^*(tape+1))=='$' &&
- (*(s+2)^*(tape+2))=='<') break;
- if (blklin && ! nonfirst++) putchar('\n');
- do
- { if (*tape==0) tape=iotape;
- putchar(*s^*tape);
- } while ((*s++^*tape++)!=LF); /* better end with LF */
- if (skip<0) break;
- }
- free(tbuf);
-}
diff --git a/games/adventure/main.c b/games/adventure/main.c
deleted file mode 100644
index 5b67d7b..0000000
--- a/games/adventure/main.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: main program */
-
-#include <sys/file.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "hdr.h"
-
-
-int
-main(int argc, char **argv)
-{
- int i;
- int rval,ll;
- struct text *kk;
-
- /* revoke */
- setgid(getgid());
-
- init(); /* Initialize everything */
- signal(SIGINT,trapdel);
-
- if (argc > 1) /* Restore file specified */
- { /* Restart is label 8305 (Fortran) */
- i = restore(argv[1]); /* See what we've got */
- switch(i)
- {
- case 0: /* The restore worked fine */
- yea=Start();
- k=null;
- unlink(argv[1]);/* Don't re-use the save */
- goto l8; /* Get where we're going */
- case 1: /* Couldn't open it */
- exit(1); /* So give up */
- case 2: /* Oops -- file was altered */
- rspeak(202); /* You dissolve */
- exit(1); /* File could be non-adventure */
- } /* So don't unlink it. */
- }
-
- startup(); /* prepare for a user */
-
- for (;;) /* main command loop (label 2) */
- { if (newloc<9 && newloc!=0 && closng)
- { rspeak(130); /* if closing leave only by */
- newloc=loc; /* main office */
- if (!panic) clock2=15;
- panic=TRUE;
- }
-
- rval=fdwarf(); /* dwarf stuff */
- if (rval==99) die(99);
-
- l2000: if (loc==0) die(99); /* label 2000 */
- kk = &stext[loc];
- if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
- kk = &ltext[loc];
- if (!forced(loc) && dark())
- { if (wzdark && pct(35))
- { die(90);
- goto l2000;
- }
- kk = &rtext[16];
- }
- if (toting(bear)) rspeak(141); /* 2001 */
- speak(kk);
- k=1;
- if (forced(loc))
- goto l8;
- if (loc==33 && pct(25)&&!closng) rspeak(8);
- if (!dark())
- { abb[loc]++;
- for (i=atloc[loc]; i!=0; i=linkx[i]) /*2004 */
- { obj=i;
- if (obj>100) obj -= 100;
- if (obj==steps && toting(nugget)) continue;
- if (prop[obj]<0)
- { if (closed) continue;
- prop[obj]=0;
- if (obj==rug||obj==chain)
- prop[obj]=1;
- tally--;
- if (tally==tally2 && tally != 0)
- if (limit>35) limit=35;
- }
- ll = prop[obj]; /* 2006 */
- if (obj==steps && loc==fixed[steps])
- ll = 1;
- pspeak(obj, ll);
- } /* 2008 */
- goto l2012;
- l2009: k=54; /* 2009 */
- l2010: spk=k;
- l2011: rspeak(spk);
- }
- l2012: verb=0; /* 2012 */
- obj=0;
- l2600: checkhints(); /* to 2600-2602 */
- if (closed)
- { if (prop[oyster]<0 && toting(oyster))
- pspeak(oyster,1);
- for (i=1; i<100; i++)
- if (toting(i)&&prop[i]<0) /*2604 */
- prop[i] = -1-prop[i];
- }
- wzdark=dark(); /* 2605 */
- if (knfloc>0 && knfloc!=loc) knfloc=1;
- getin(&wd1,&wd2);
- if (delhit) /* user typed a DEL */
- { delhit=0; /* reset counter */
- strcpy(wd1,"quit"); /* pretend he's quitting*/
- *wd2=0;
- }
- l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */
- /* should check here for "magic mode" */
- turns++;
- if (demo && turns>=SHORT) done(1); /* to 13000 */
-
- if (verb==say && *wd2!=0) verb=0;
- if (verb==say)
- goto l4090;
- if (tally==0 && loc>=15 && loc!=33) clock1--;
- if (clock1==0)
- { closing(); /* to 10000 */
- goto l19999;
- }
- if (clock1<0) clock2--;
- if (clock2==0)
- { caveclose(); /* to 11000 */
- continue; /* back to 2 */
- }
- if (prop[lamp]==1) limit--;
- if (limit<=30 && here(batter) && prop[batter]==0
- && here(lamp))
- { rspeak(188); /* 12000 */
- prop[batter]=1;
- if (toting(batter)) drop(batter,loc);
- limit=limit+2500;
- lmwarn=FALSE;
- goto l19999;
- }
- if (limit==0)
- { limit = -1; /* 12400 */
- prop[lamp]=0;
- rspeak(184);
- goto l19999;
- }
- if (limit<0&&loc<=8)
- { rspeak(185); /* 12600 */
- gaveup=TRUE;
- done(2); /* to 20000 */
- }
- if (limit<=30)
- { if (lmwarn|| !here(lamp)) goto l19999; /*12200*/
- lmwarn=TRUE;
- spk=187;
- if (place[batter]==0) spk=183;
- if (prop[batter]==1) spk=189;
- rspeak(spk);
- }
- l19999: k=43;
- if (liqloc(loc)==water) k=70;
- if (!strncmp(wd1,"enter",5) &&
- (!strncmp(wd2,"strea",5)||!strncmp(wd2,"water",5)))
- goto l2010;
- if (!strncmp(wd1,"enter",5) && *wd2!=0) goto l2800;
- if ((strncmp(wd1,"water",5)&&strncmp(wd1,"oil",3))
- || (strncmp(wd2,"plant",5)&&strncmp(wd2,"door",4)))
- goto l2610;
- if (at(vocab(wd2,1,0))) strcpy(wd2,"pour");
-
- l2610: if (!strncmp(wd1,"west",4))
- if (++iwest==10) rspeak(17);
- l2630: i=vocab(wd1,-1,0);
- if (i== -1)
- { spk=60; /* 3000 */
- if (pct(20)) spk=61;
- if (pct(20)) spk=13;
- rspeak(spk);
- goto l2600;
- }
- k=i%1000;
- kq=i/1000+1;
- switch(kq)
- { case 1: goto l8;
- case 2: goto l5000;
- case 3: goto l4000;
- case 4: goto l2010;
- default:
- bug(22);
- }
-
- l8:
- switch(march())
- { case 2: continue; /* i.e. goto l2 */
- case 99:
- die(99);
- goto l2000;
- default: bug(110);
- }
-
- l2800: strcpy(wd1,wd2);
- *wd2=0;
- goto l2610;
-
- l4000: verb=k;
- spk=actspk[verb];
- if (*wd2!=0 && verb!=say) goto l2800;
- if (verb==say) obj= *wd2;
- if (obj!=0) goto l4090;
- switch(verb)
- { case 1: /* take = 8010 */
- if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000;
- for (i=1; i<=5; i++)
- if (dloc[i]==loc&&dflag>=2) goto l8000;
- obj=atloc[loc];
- goto l9010;
- case 2: case 3: case 9: /* 8000 : drop,say,wave */
- case 10: case 16: case 17: /* calm,rub,toss */
- case 19: case 21: case 28: /* find,feed,break */
- case 29: /* wake */
- l8000: printf("%s what?\n",wd1);
- obj=0;
- goto l2600;
- case 4: case 6: /* 8040 open,lock */
- spk=28;
- if (here(clam)) obj=clam;
- if (here(oyster)) obj=oyster;
- if (at(door)) obj=door;
- if (at(grate)) obj=grate;
- if (obj!=0 && here(chain)) goto l8000;
- if (here(chain)) obj=chain;
- if (obj==0) goto l2011;
- goto l9040;
- case 5: goto l2009; /* nothing */
- case 7: goto l9070; /* on */
- case 8: goto l9080; /* off */
- case 11: goto l8000; /* walk */
- case 12: goto l9120; /* kill */
- case 13: goto l9130; /* pour */
- case 14: /* eat: 8140 */
- if (!here(food)) goto l8000;
- l8142: dstroy(food);
- spk=72;
- goto l2011;
- case 15: goto l9150; /* drink */
- case 18: /* quit: 8180 */
- gaveup=yes(22,54,54);
- if (gaveup) done(2); /* 8185 */
- goto l2012;
- case 20: /* invent=8200 */
- spk=98;
- for (i=1; i<=100; i++)
- { if (i!=bear && toting(i))
- { if (spk==98) rspeak(99);
- blklin=FALSE;
- pspeak(i,-1);
- blklin=TRUE;
- spk=0;
- }
- }
- if (toting(bear)) spk=141;
- goto l2011;
- case 22: goto l9220; /* fill */
- case 23: goto l9230; /* blast */
- case 24: /* score: 8240 */
- scorng=TRUE;
- printf("If you were to quit now, you would score");
- printf(" %d out of a possible ",score());
- printf("%d.",mxscor);
- scorng=FALSE;
- gaveup=yes(143,54,54);
- if (gaveup) done(2);
- goto l2012;
- case 25: /* foo: 8250 */
- k=vocab(wd1,3,0);
- spk=42;
- if (foobar==1-k) goto l8252;
- if (foobar!=0) spk=151;
- goto l2011;
- l8252: foobar=k;
- if (k!=4) goto l2009;
- foobar=0;
- if (place[eggs]==plac[eggs]
- ||(toting(eggs)&&loc==plac[eggs])) goto l2011;
- if (place[eggs]==0&&place[troll]==0&&prop[troll]==0)
- prop[troll]=1;
- k=2;
- if (here(eggs)) k=1;
- if (loc==plac[eggs]) k=0;
- move(eggs,plac[eggs]);
- pspeak(eggs,k);
- goto l2012;
- case 26: /* brief=8260 */
- spk=156;
- abbnum=10000;
- detail=3;
- goto l2011;
- case 27: /* read=8270 */
- if (here(magzin)) obj=magzin;
- if (here(tablet)) obj=obj*100+tablet;
- if (here(messag)) obj=obj*100+messag;
- if (closed&&toting(oyster)) obj=oyster;
- if (obj>100||obj==0||dark()) goto l8000;
- goto l9270;
- case 30: /* suspend=8300 */
- spk=201;
- if (demo) goto l2011;
- printf("I can suspend your adventure for you so");
- printf(" you can resume later, but\n");
- printf("you will have to wait at least");
- printf(" %d minutes before continuing.",latncy);
- if (!yes(200,54,54)) goto l2012;
- datime(&saved,&savet);
- ciao(); /* Do we quit? */
- continue; /* Maybe not */
- case 31: /* hours=8310 */
- printf("Colossal cave is closed 9am-5pm Mon ");
- printf("through Fri except holidays.\n");
- goto l2012;
- default: bug(23);
- }
-
- l4090:
- switch(verb)
- { case 1: /* take = 9010 */
- l9010: switch(trtake())
- { case 2011: goto l2011;
- case 9220: goto l9220;
- case 2009: goto l2009;
- case 2012: goto l2012;
- default: bug(102);
- }
- l9020: case 2: /* drop = 9020 */
- switch(trdrop())
- { case 2011: goto l2011;
- case 19000: done(3);
- case 2012: goto l2012;
- default: bug(105);
- }
- case 3:
- switch(trsay())
- { case 2012: goto l2012;
- case 2630: goto l2630;
- default: bug(107);
- }
- l9040: case 4: case 6: /* open, close */
- switch(tropen())
- { case 2011: goto l2011;
- case 2010: goto l2010;
- default: bug(106);
- }
- case 5: goto l2009; /* nothing */
- case 7: /* on 9070 */
- l9070: if (!here(lamp)) goto l2011;
- spk=184;
- if (limit<0) goto l2011;
- prop[lamp]=1;
- rspeak(39);
- if (wzdark) goto l2000;
- goto l2012;
-
- case 8: /* off */
- l9080: if (!here(lamp)) goto l2011;
- prop[lamp]=0;
- rspeak(40);
- if (dark()) rspeak(16);
- goto l2012;
-
- case 9: /* wave */
- if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
- spk=29;
- if (obj!=rod||!at(fissur)||!toting(obj)||closng)
- goto l2011;
- prop[fissur]=1-prop[fissur];
- pspeak(fissur,2-prop[fissur]);
- goto l2012;
- case 10: case 11: case 18: /* calm, walk, quit */
- case 24: case 25: case 26: /* score, foo, brief */
- case 30: case 31: /* suspend, hours */
- goto l2011;
- l9120: case 12: /* kill */
- switch(trkill())
- { case 8000: goto l8000;
- case 8: goto l8;
- case 2011: goto l2011;
- case 2608: goto l2608;
- case 19000: done(3);
- default: bug(112);
- }
- l9130: case 13: /* pour */
- if (obj==bottle||obj==0) obj=liq();
- if (obj==0) goto l8000;
- if (!toting(obj)) goto l2011;
- spk=78;
- if (obj!=oil&&obj!=water) goto l2011;
- prop[bottle]=1;
- place[obj]=0;
- spk=77;
- if (!(at(plant)||at(door))) goto l2011;
- if (at(door))
- { prop[door]=0; /* 9132 */
- if (obj==oil) prop[door]=1;
- spk=113+prop[door];
- goto l2011;
- }
- spk=112;
- if (obj!=water) goto l2011;
- pspeak(plant,prop[plant]+1);
- prop[plant]=(prop[plant]+2)% 6;
- prop[plant2]=prop[plant]/2;
- k=null;
- goto l8;
- case 14: /* 9140 - eat */
- if (obj==food) goto l8142;
- if (obj==bird||obj==snake||obj==clam||obj==oyster
- ||obj==dwarf||obj==dragon||obj==troll
- ||obj==bear) spk=71;
- goto l2011;
- l9150: case 15: /* 9150 - drink */
- if (obj==0&&liqloc(loc)!=water&&(liq()!=water
- ||!here(bottle))) goto l8000;
- if (obj!=0&&obj!=water) spk=110;
- if (spk==110||liq()!=water||!here(bottle))
- goto l2011;
- prop[bottle]=1;
- place[water]=0;
- spk=74;
- goto l2011;
- case 16: /* 9160: rub */
- if (obj!=lamp) spk=76;
- goto l2011;
- case 17: /* 9170: throw */
- switch(trtoss())
- { case 2011: goto l2011;
- case 9020: goto l9020;
- case 9120: goto l9120;
- case 8: goto l8;
- case 9210: goto l9210;
- default: bug(113);
- }
- case 19: case 20: /* 9190: find, invent */
- if (at(obj)||(liq()==obj&&at(bottle))
- ||k==liqloc(loc)) spk=94;
- for (i=1; i<=5; i++)
- if (dloc[i]==loc&&dflag>=2&&obj==dwarf)
- spk=94;
- if (closed) spk=138;
- if (toting(obj)) spk=24;
- goto l2011;
- l9210: case 21: /* feed */
- switch(trfeed())
- { case 2011: goto l2011;
- default: bug(114);
- }
- l9220: case 22: /* fill */
- switch(trfill())
- { case 2011: goto l2011;
- case 8000: goto l8000;
- case 9020: goto l9020;
- default: bug(115);
- }
- l9230: case 23: /* blast */
- if (prop[rod2]<0||!closed) goto l2011;
- bonus=133;
- if (loc==115) bonus=134;
- if (here(rod2)) bonus=135;
- rspeak(bonus);
- done(2);
- l9270: case 27: /* read */
- if (dark()) goto l5190;
- if (obj==magzin) spk=190;
- if (obj==tablet) spk=196;
- if (obj==messag) spk=191;
- if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194;
- if (obj!=oyster||hinted[2]||!toting(oyster)
- ||!closed) goto l2011;
- hinted[2]=yes(192,193,54);
- goto l2012;
- case 28: /* break */
- if (obj==mirror) spk=148;
- if (obj==vase&&prop[vase]==0)
- { spk=198;
- if (toting(vase)) drop(vase,loc);
- prop[vase]=2;
- fixed[vase]= -1;
- goto l2011;
- }
- if (obj!=mirror||!closed) goto l2011;
- rspeak(197);
- done(3);
-
- case 29: /* wake */
- if (obj!=dwarf||!closed) goto l2011;
- rspeak(199);
- done(3);
-
- default: bug(24);
- }
-
- l5000:
- obj=k;
- if (fixed[k]!=loc && !here(k)) goto l5100;
- l5010: if (*wd2!=0) goto l2800;
- if (verb!=0) goto l4090;
- printf("What do you want to do with the %s?\n",wd1);
- goto l2600;
- l5100: if (k!=grate) goto l5110;
- if (loc==1||loc==4||loc==7) k=dprssn;
- if (loc>9&&loc<15) k=entrnc;
- if (k!=grate) goto l8;
- l5110: if (k!=dwarf) goto l5120;
- for (i=1; i<=5; i++)
- if (dloc[i]==loc&&dflag>=2) goto l5010;
- l5120: if ((liq()==k&&here(bottle))||k==liqloc(loc)) goto l5010;
- if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130;
- obj=plant2;
- goto l5010;
- l5130: if (obj!=knife||knfloc!=loc) goto l5140;
- knfloc = -1;
- spk=116;
- goto l2011;
- l5140: if (obj!=rod||!here(rod2)) goto l5190;
- obj=rod2;
- goto l5010;
- l5190: if ((verb==find||verb==invent)&&*wd2==0) goto l5010;
- printf("I see no %s here\n",wd1);
- goto l2012;
- }
-}
diff --git a/games/adventure/save.c b/games/adventure/save.c
deleted file mode 100644
index 234ce63..0000000
--- a/games/adventure/save.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include "hdr.h"
-
-struct savestruct
-{
- void *address;
- size_t width;
-};
-
-struct savestruct save_array[] =
-{
- {&abbnum, sizeof(abbnum)},
- {&attack, sizeof(attack)},
- {&blklin, sizeof(blklin)},
- {&bonus, sizeof(bonus)},
- {&chloc, sizeof(chloc)},
- {&chloc2, sizeof(chloc2)},
- {&clock1, sizeof(clock1)},
- {&clock2, sizeof(clock2)},
- {&closed, sizeof(closed)},
- {&closng, sizeof(closng)},
- {&daltlc, sizeof(daltlc)},
- {&demo, sizeof(demo)},
- {&detail, sizeof(detail)},
- {&dflag, sizeof(dflag)},
- {&dkill, sizeof(dkill)},
- {&dtotal, sizeof(dtotal)},
- {&foobar, sizeof(foobar)},
- {&gaveup, sizeof(gaveup)},
- {&holdng, sizeof(holdng)},
- {&iwest, sizeof(iwest)},
- {&k, sizeof(k)},
- {&k2, sizeof(k2)},
- {&knfloc, sizeof(knfloc)},
- {&kq, sizeof(kq)},
- {&latncy, sizeof(latncy)},
- {&limit, sizeof(limit)},
- {&lmwarn, sizeof(lmwarn)},
- {&loc, sizeof(loc)},
- {&maxdie, sizeof(maxdie)},
- {&mxscor, sizeof(mxscor)},
- {&newloc, sizeof(newloc)},
- {&numdie, sizeof(numdie)},
- {&obj, sizeof(obj)},
- {&oldlc2, sizeof(oldlc2)},
- {&oldloc, sizeof(oldloc)},
- {&panic, sizeof(panic)},
- {&saved, sizeof(saved)},
- {&savet, sizeof(savet)},
- {&scorng, sizeof(scorng)},
- {&spk, sizeof(spk)},
- {&stick, sizeof(stick)},
- {&tally, sizeof(tally)},
- {&tally2, sizeof(tally2)},
- {&tkk, sizeof(tkk)},
- {&turns, sizeof(turns)},
- {&verb, sizeof(verb)},
- {&wd1, sizeof(wd1)},
- {&wd2, sizeof(wd2)},
- {&wzdark, sizeof(wzdark)},
- {&yea, sizeof(yea)},
- {atloc, sizeof(atloc)},
- {dloc, sizeof(dloc)},
- {dseen, sizeof(dseen)},
- {fixed, sizeof(fixed)},
- {hinted, sizeof(hinted)},
- {linkx, sizeof(linkx)},
- {odloc, sizeof(odloc)},
- {place, sizeof(place)},
- {prop, sizeof(prop)},
- {tk, sizeof(tk)},
-
- {NULL, 0}
-};
-
-/* Two passes on data: first to get checksum, second */
-/* to output the data using checksum to start random #s */
-int
-save(const char *outfile)
-{
- FILE *out;
- struct savestruct *p;
- char *s;
- unsigned long sum;
- size_t i;
-
- crc_start();
- for (p = save_array; p->address != NULL; p++)
- sum = crc(p->address, p->width);
- srandom(sum);
-
- if ((out = fopen(outfile, "wb")) == NULL)
- {
- fprintf(stderr,
- "Hmm. The name \"%s\" appears to be magically blocked.\n",
- outfile);
- return 1;
- }
-
- fwrite(&sum, sizeof(sum), 1, out); /* Here's the random() key */
- for (p = save_array; p->address != NULL; p++)
- {
- for (s = p->address, i = 0; i < p->width; i++, s++)
- *s = (*s ^ random()) & 0xFF; /* Lightly encrypt */
- fwrite(p->address, p->width, 1, out);
- }
- fclose(out);
- return 0;
-}
-
-int
-restore(const char *infile)
-{
- FILE *in;
- struct savestruct *p;
- char *s;
- unsigned long sum, cksum;
- size_t i;
-
- cksum = 0;
- if ((in = fopen(infile, "rb")) == NULL)
- {
- fprintf(stderr,
- "Hmm. The file \"%s\" appears to be magically blocked.\n",
- infile);
- return 1;
- }
-
- fread(&sum, sizeof(sum), 1, in); /* Get the seed */
- srandom(sum);
- for (p = save_array; p->address != NULL; p++)
- {
- fread(p->address, p->width, 1, in);
- for (s = p->address, i = 0; i < p->width; i++, s++)
- *s = (*s ^ random()) & 0xFF; /* Lightly decrypt */
- }
- fclose(in);
-
- crc_start(); /* See if she cheated */
- for (p = save_array; p->address != NULL; p++)
- cksum = crc(p->address, p->width);
- if (sum != cksum) /* Tsk tsk */
- return 2; /* Altered the file */
- /* We successfully restored, so this really was a save file */
- /* Get rid of the file, but don't bother checking that we did */
- return 0;
-}
diff --git a/games/adventure/setup.c b/games/adventure/setup.c
deleted file mode 100644
index 587de58..0000000
--- a/games/adventure/setup.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Setup: keep the structure of the original Adventure port, but use an
- * internal copy of the data file, serving as a sort of virtual disk. It's
- * lightly encrypted to prevent casual snooping of the executable.
- *
- * Also do appropriate things to tabs so that bogus editors will do the right
- * thing with the data file.
- *
- */
-
-#define SIG1 " * Jim Gillogly"
-#define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <err.h>
-#include "hdr.h" /* SEED lives in there; keep them coordinated. */
-
-#define USAGE "usage: setup file > data.c (file is typically glorkz)"
-
-#define YES 1
-#define NO 0
-
-#define LINE 10 /* How many values do we get on a line? */
-
-int
-main(int argc, char **argv)
-{
- FILE *infile;
- int c, count, linestart;
-
- if (argc != 2) errx(1, USAGE);
-
- if ((infile = fopen(argv[1], "r")) == NULL)
- err(1, "Can't read file %s", argv[1]);
- puts("/*\n * data.c: created by setup from the ascii data file.");
- puts(SIG1);
- puts(SIG2);
- puts(" */");
- printf("\n\nunsigned char data_file[] =\n{");
- srandom(SEED);
- count = 0;
- linestart = YES;
-
- while ((c = getc(infile)) != EOF)
- {
- if (linestart && c == ' ') /* Convert first spaces to tab */
- {
- if (count++ % LINE == 0)
- printf("\n\t");
- printf("0x%02lx,", ('\t' ^ random()) & 0xFF);
- while ((c = getc(infile)) == ' ' && c != EOF);
- /* Drop the non-whitespace character through */
- linestart = NO;
- }
- switch(c)
- {
- case '\t':
- linestart = NO; /* Don't need to convert spaces */
- break;
- case '\n':
- linestart = YES; /* Ready to convert spaces again */
- break;
- }
- if (count++ % LINE == 0)
- printf("\n\t");
- printf("0x%02lx,", (c ^ random()) & 0xFF);
- }
- puts("\n\t0\n};");
- fclose(infile);
- exit(0);
-}
diff --git a/games/adventure/subr.c b/games/adventure/subr.c
deleted file mode 100644
index ea41cdd..0000000
--- a/games/adventure/subr.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: subroutines from main */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "hdr.h"
-
-static void badmove (void);
-static int bitset (int,int);
-static int dropper (void);
-static int liq2 (int);
-static int mback (void);
-static int specials (void);
-static int trbridge (void);
-
-/* Statement functions */
-int
-toting(int objj)
-{ if (place[objj] == -1) return(TRUE);
- else return(FALSE);
-}
-
-int
-here(int objj)
-{ if (place[objj]==loc || toting(objj)) return(TRUE);
- else return(FALSE);
-}
-
-int
-at(int objj)
-{ if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
- else return (FALSE);
-}
-
-static int
-liq2(int pbotl)
-{ return((1-pbotl)*water+(pbotl/2)*(water+oil));
-}
-
-int
-liq(void)
-{ int i;
- i=prop[bottle];
- if (i>-1-i) return(liq2(i));
- else return(liq2(-1-i));
-}
-
-int
-liqloc(int locc)
-{ int i,j,l;
- i=cond[locc]/2;
- j=((i*2)%8)-5;
- l=cond[locc]/4;
- l=l%2;
- return(liq2(j*l+1));
-}
-
-static int
-bitset(int l, int n)
-{ if (cond[l] & setbit[n]) return(TRUE);
- return(FALSE);
-}
-
-int
-forced(int locc)
-{ if (cond[locc]==2) return(TRUE);
- return(FALSE);
-}
-
-int
-dark(void)
-{ if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
- return(TRUE);
- return(FALSE);
-}
-
-int
-pct(int n)
-{ if (ran(100)<n) return(TRUE);
- return(FALSE);
-}
-
-
-int
-fdwarf(void) /* 71 */
-{ int i,j;
- struct travlist *kk;
-
- if (newloc!=loc&&!forced(loc)&&!bitset(loc,3))
- { for (i=1; i<=5; i++)
- { if (odloc[i]!=newloc||!dseen[i]) continue;
- newloc=loc;
- rspeak(2);
- break;
- }
- }
- loc=newloc; /* 74 */
- if (loc==0||forced(loc)||bitset(newloc,3)) return(2000);
- if (dflag==0)
- { if (loc>=15) dflag=1;
- return(2000);
- }
- if (dflag==1) /* 6000 */
- { if (loc<15||pct(95)) return(2000);
- dflag=2;
- for (i=1; i<=2; i++)
- { j=1+ran(5);
- if (pct(50)&&saved== -1) dloc[j]=0; /* 6001 */
- }
- for (i=1; i<=5; i++)
- { if (dloc[i]==loc) dloc[i]=daltlc;
- odloc[i]=dloc[i]; /* 6002 */
- }
- rspeak(3);
- drop(axe,loc);
- return(2000);
- }
- dtotal=attack=stick=0; /* 6010 */
- for (i=1; i<=6; i++) /* loop to 6030 */
- { if (dloc[i]==0) continue;
- j=1;
- for (kk=travel[dloc[i]]; kk!=0; kk=kk->next)
- { newloc=kk->tloc;
- if (newloc>300||newloc<15||newloc==odloc[i]
- ||(j>1&&newloc==tk[j-1])||j>=20
- ||newloc==dloc[i]||forced(newloc)
- ||(i==6&&bitset(newloc,3))
- ||kk->conditions==100) continue;
- tk[j++]=newloc;
- }
- tk[j]=odloc[i]; /* 6016 */
- if (j>=2) j--;
- j=1+ran(j);
- odloc[i]=dloc[i];
- dloc[i]=tk[j];
- dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc);
- if (!dseen[i]) continue; /* i.e. goto 6030 */
- dloc[i]=loc;
- if (i==6) /* pirate's spotted him */
- { if (loc==chloc||prop[chest]>=0) continue;
- k=0;
- for (j=50; j<=maxtrs; j++) /* loop to 6020 */
- { if (j==pyram&&(loc==plac[pyram]
- || loc==plac[emrald])) goto l6020;
- if (toting(j)) goto l6022;
- l6020: if (here(j)) k=1;
- } /* 6020 */
- if (tally==tally2+1 && k==0 && place[chest]==0
- &&here(lamp) && prop[lamp]==1) goto l6025;
- if (odloc[6]!=dloc[6]&&pct(20))
- rspeak(127);
- continue; /* to 6030 */
- l6022: rspeak(128);
- if (place[messag]==0) move(chest,chloc);
- move(messag,chloc2);
- for (j=50; j<=maxtrs; j++) /* loop to 6023 */
- { if (j==pyram && (loc==plac[pyram]
- || loc==plac[emrald])) continue;
- if (at(j)&&fixed[j]==0) carry(j,loc);
- if (toting(j)) drop(j,chloc);
- }
- l6024: dloc[6]=odloc[6]=chloc;
- dseen[6]=FALSE;
- continue;
- l6025: rspeak(186);
- move(chest,chloc);
- move(messag,chloc2);
- goto l6024;
- }
- dtotal++; /* 6027 */
- if (odloc[i]!=dloc[i]) continue;
- attack++;
- if (knfloc>=0) knfloc=loc;
- if (ran(1000)<95*(dflag-2)) stick++;
- } /* 6030 */
- if (dtotal==0) return(2000);
- if (dtotal!=1)
- { printf("There are %d threatening little dwarves ",dtotal);
- printf("in the room with you.\n");
- }
- else rspeak(4);
- if (attack==0) return(2000);
- if (dflag==2) dflag=3;
- if (saved!= -1) dflag=20;
- if (attack!=1)
- { printf("%d of them throw knives at you!\n",attack);
- k=6;
- l82: if (stick<=1) /* 82 */
- { rspeak(k+stick);
- if (stick==0) return(2000);
- }
- else
- printf("%d of them get you!\n",stick); /* 83 */
- oldlc2=loc;
- return(99);
- }
- rspeak(5);
- k=52;
- goto l82;
-}
-
-
-int
-march(void) /* label 8 */
-{ int ll1,ll2;
-
- if ((tkk=travel[newloc=loc])==0) bug(26);
- if (k==null) return(2);
- if (k==cave) /* 40 */
- { if (loc<8) rspeak(57);
- if (loc>=8) rspeak(58);
- return(2);
- }
- if (k==look) /* 30 */
- { if (detail++<3) rspeak(15);
- wzdark=FALSE;
- abb[loc]=0;
- return(2);
- }
- if (k==back) /* 20 */
- { switch(mback())
- { case 2: return(2);
- case 9: goto l9;
- default: bug(100);
- }
- }
- oldlc2=oldloc;
- oldloc=loc;
-l9:
- for (; tkk!=0; tkk=tkk->next)
- if (tkk->tverb==1 || tkk->tverb==k) break;
- if (tkk==0)
- { badmove();
- return(2);
- }
-l11: ll1=tkk->conditions; /* 11 */
- ll2=tkk->tloc;
- newloc=ll1; /* newloc=conditions */
- k=newloc%100; /* k used for prob */
- if (newloc<=300)
- { if (newloc<=100) /* 13 */
- { if (newloc!=0&&!pct(newloc)) goto l12; /* 14 */
- l16: newloc=ll2; /* newloc=location */
- if (newloc<=300) return(2);
- if (newloc<=500)
- switch(specials())/* to 30000 */
- { case 2: return(2);
- case 12: goto l12;
- case 99: return(99);
- default: bug(101);
- }
- rspeak(newloc-500);
- newloc=loc;
- return(2);
- }
- if (toting(k)||(newloc>200&&at(k))) goto l16;
- goto l12;
- }
- if (prop[k]!=(newloc/100)-3) goto l16; /* newloc still conditions*/
-l12: /* alternative to probability move */
- for (; tkk!=0; tkk=tkk->next)
- if (tkk->tloc!=ll2 || tkk->conditions!=ll1) break;
- if (tkk==0) bug(25);
- goto l11;
-}
-
-
-
-static int
-mback(void) /* 20 */
-{ struct travlist *tk2,*j;
- int ll;
- if (forced(k=oldloc)) k=oldlc2; /* k=location */
- oldlc2=oldloc;
- oldloc=loc;
- tk2=0;
- if (k==loc)
- { rspeak(91);
- return(2);
- }
- for (; tkk!=0; tkk=tkk->next) /* 21 */
- { ll=tkk->tloc;
- if (ll==k)
- { k=tkk->tverb; /* k back to verb */
- tkk=travel[loc];
- return(9);
- }
- if (ll<=300)
- { j=travel[loc];
- if (forced(ll) && k==j->tloc) tk2=tkk;
- }
- }
- tkk=tk2; /* 23 */
- if (tkk!=0)
- { k=tkk->tverb;
- tkk=travel[loc];
- return(9);
- }
- rspeak(140);
- return(2);
-}
-
-
-static int
-specials(void) /* 30000 */
-{ switch(newloc -= 300)
- { case 1: /* 30100 */
- newloc = 99+100-loc;
- if (holdng==0||(holdng==1&&toting(emrald))) return(2);
- newloc=loc;
- rspeak(117);
- return(2);
- case 2: /* 30200 */
- drop(emrald,loc);
- return(12);
- case 3: /* to 30300 */
- return(trbridge());
- default: bug(29);
- }
- /* NOTREACHED */
- return(-1);
-}
-
-
-static int
-trbridge(void) /* 30300 */
-{ if (prop[troll]==1)
- { pspeak(troll,1);
- prop[troll]=0;
- move(troll2,0);
- move(troll2+100,0);
- move(troll,plac[troll]);
- move(troll+100,fixd[troll]);
- juggle(chasm);
- newloc=loc;
- return(2);
- }
- newloc=plac[troll]+fixd[troll]-loc; /* 30310 */
- if (prop[troll]==0) prop[troll]=1;
- if (!toting(bear)) return(2);
- rspeak(162);
- prop[chasm]=1;
- prop[troll]=2;
- drop(bear,newloc);
- fixed[bear] = -1;
- prop[bear]=3;
- if (prop[spices]<0) tally2++;
- oldlc2=newloc;
- return(99);
-}
-
-
-static void
-badmove(void) /* 20 */
-{ spk=12;
- if (k>=43 && k<=50) spk=9;
- if (k==29||k==30) spk=9;
- if (k==7||k==36||k==37) spk=10;
- if (k==11||k==19) spk=11;
- if (verb==find||verb==invent) spk=59;
- if (k==62||k==65) spk=42;
- if (k==17) spk=80;
- rspeak(spk);
-}
-
-int
-bug(int n)
-{ printf("Please tell jim@rand.org that fatal bug %d happened.\n",n);
- exit(1);
-}
-
-
-void
-checkhints(void) /* 2600 &c */
-{ int hint;
- for (hint=4; hint<=hntmax; hint++)
- { if (hinted[hint]) continue;
- if (!bitset(loc,hint)) hintlc[hint]= -1;
- hintlc[hint]++;
- if (hintlc[hint]<hints[hint][1]) continue;
- switch(hint)
- { case 4: /* 40400 */
- if (prop[grate]==0&&!here(keys)) goto l40010;
- goto l40020;
- case 5: /* 40500 */
- if (here(bird)&&toting(rod)&&obj==bird) goto l40010;
- continue; /* i.e. goto l40030 */
- case 6: /* 40600 */
- if (here(snake)&&!here(bird)) goto l40010;
- goto l40020;
- case 7: /* 40700 */
- if (atloc[loc]==0&&atloc[oldloc]==0
- && atloc[oldlc2]==0&&holdng>1) goto l40010;
- goto l40020;
- case 8: /* 40800 */
- if (prop[emrald]!= -1&&prop[pyram]== -1) goto l40010;
- goto l40020;
- case 9:
- goto l40010; /* 40900 */
- default: bug(27);
- }
- l40010: hintlc[hint]=0;
- if (!yes(hints[hint][3],0,54)) continue;
- printf("I am prepared to give you a hint, but it will ");
- printf("cost you %d points.\n",hints[hint][2]);
- hinted[hint]=yes(175,hints[hint][4],54);
- l40020: hintlc[hint]=0;
- }
-}
-
-
-int
-trsay(void) /* 9030 */
-{ int i;
- if (*wd2!=0) strcpy(wd1,wd2);
- i=vocab(wd1,-1,0);
- if (i==62||i==65||i==71||i==2025)
- { *wd2=0;
- obj=0;
- return(2630);
- }
- printf("\nOkay, \"%s\".\n",wd2);
- return(2012);
-}
-
-
-int
-trtake(void) /* 9010 */
-{
- if (toting(obj)) return(2011); /* 9010 */
- spk=25;
- if (obj==plant&&prop[plant]<=0) spk=115;
- if (obj==bear&&prop[bear]==1) spk=169;
- if (obj==chain&&prop[bear]!=0) spk=170;
- if (fixed[obj]!=0) return(2011);
- if (obj==water||obj==oil)
- { if (here(bottle)&&liq()==obj)
- { obj=bottle;
- goto l9017;
- }
- obj=bottle;
- if (toting(bottle)&&prop[bottle]==1)
- return(9220);
- if (prop[bottle]!=1) spk=105;
- if (!toting(bottle)) spk=104;
- return(2011);
- }
-l9017: if (holdng>=7)
- { rspeak(92);
- return(2012);
- }
- if (obj==bird)
- { if (prop[bird]!=0) goto l9014;
- if (toting(rod))
- { rspeak(26);
- return(2012);
- }
- if (!toting(cage)) /* 9013 */
- { rspeak(27);
- return(2012);
- }
- prop[bird]=1; /* 9015 */
- }
-l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0)
- carry(bird+cage-obj,loc);
- carry(obj,loc);
- k=liq();
- if (obj==bottle && k!=0) place[k] = -1;
- return(2009);
-}
-
-
-static int
-dropper(void) /* 9021 */
-{ k=liq();
- if (k==obj) obj=bottle;
- if (obj==bottle&&k!=0) place[k]=0;
- if (obj==cage&&prop[bird]!=0) drop(bird,loc);
- if (obj==bird) prop[bird]=0;
- drop(obj,loc);
- return(2012);
-}
-
-int
-trdrop(void) /* 9020 */
-{
- if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
- if (!toting(obj)) return(2011);
- if (obj==bird&&here(snake))
- { rspeak(30);
- if (closed) return(19000);
- dstroy(snake);
- prop[snake]=1;
- return(dropper());
- }
- if (obj==coins&&here(vend)) /* 9024 */
- { dstroy(coins);
- drop(batter,loc);
- pspeak(batter,0);
- return(2012);
- }
- if (obj==bird&&at(dragon)&&prop[dragon]==0) /* 9025 */
- { rspeak(154);
- dstroy(bird);
- prop[bird]=0;
- if (place[snake]==plac[snake]) tally2--;
- return(2012);
- }
- if (obj==bear&&at(troll)) /* 9026 */
- { rspeak(163);
- move(troll,0);
- move(troll+100,0);
- move(troll2,plac[troll]);
- move(troll2+100,fixd[troll]);
- juggle(chasm);
- prop[troll]=2;
- return(dropper());
- }
- if (obj!=vase||loc==plac[pillow]) /* 9027 */
- { rspeak(54);
- return(dropper());
- }
- prop[vase]=2; /* 9028 */
- if (at(pillow)) prop[vase]=0;
- pspeak(vase,prop[vase]+1);
- if (prop[vase]!=0) fixed[vase] = -1;
- return(dropper());
-}
-
-
-int
-tropen(void) /* 9040 */
-{ if (obj==clam||obj==oyster)
- { k=0; /* 9046 */
- if (obj==oyster) k=1;
- spk=124+k;
- if (toting(obj)) spk=120+k;
- if (!toting(tridnt)) spk=122+k;
- if (verb==lock) spk=61;
- if (spk!=124) return(2011);
- dstroy(clam);
- drop(oyster,loc);
- drop(pearl,105);
- return(2011);
- }
- if (obj==door) spk=111;
- if (obj==door&&prop[door]==1) spk=54;
- if (obj==cage) spk=32;
- if (obj==keys) spk=55;
- if (obj==grate||obj==chain) spk=31;
- if (spk!=31||!here(keys)) return(2011);
- if (obj==chain)
- { if (verb==lock)
- { spk=172; /* 9049: lock */
- if (prop[chain]!=0) spk=34;
- if (loc!=plac[chain]) spk=173;
- if (spk!=172) return(2011);
- prop[chain]=2;
- if (toting(chain)) drop(chain,loc);
- fixed[chain]= -1;
- return(2011);
- }
- spk=171;
- if (prop[bear]==0) spk=41;
- if (prop[chain]==0) spk=37;
- if (spk!=171) return(2011);
- prop[chain]=0;
- fixed[chain]=0;
- if (prop[bear]!=3) prop[bear]=2;
- fixed[bear]=2-prop[bear];
- return(2011);
- }
- if (closng)
- { k=130;
- if (!panic) clock2=15;
- panic=TRUE;
- return(2010);
- }
- k=34+prop[grate]; /* 9043 */
- prop[grate]=1;
- if (verb==lock) prop[grate]=0;
- k=k+2*prop[grate];
- return(2010);
-}
-
-
-int
-trkill(void) /* 9120 */
-{ int i;
- for (i=1; i<=5; i++)
- if (dloc[i]==loc&&dflag>=2) break;
- if (i==6) i=0;
- if (obj==0) /* 9122 */
- { if (i!=0) obj=dwarf;
- if (here(snake)) obj=obj*100+snake;
- if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon;
- if (at(troll)) obj=obj*100+troll;
- if (here(bear)&&prop[bear]==0) obj=obj*100+bear;
- if (obj>100) return(8000);
- if (obj==0)
- { if (here(bird)&&verb!=throw) obj=bird;
- if (here(clam)||here(oyster)) obj=100*obj+clam;
- if (obj>100) return(8000);
- }
- }
- if (obj==bird) /* 9124 */
- { spk=137;
- if (closed) return(2011);
- dstroy(bird);
- prop[bird]=0;
- if (place[snake]==plac[snake]) tally2++;
- spk=45;
- }
- if (obj==0) spk=44; /* 9125 */
- if (obj==clam||obj==oyster) spk=150;
- if (obj==snake) spk=46;
- if (obj==dwarf) spk=49;
- if (obj==dwarf&&closed) return(19000);
- if (obj==dragon) spk=147;
- if (obj==troll) spk=157;
- if (obj==bear) spk=165+(prop[bear]+1)/2;
- if (obj!=dragon||prop[dragon]!=0) return(2011);
- rspeak(49);
- verb=0;
- obj=0;
- getin(&wd1,&wd2);
- if (strncmp(wd1,"y",1)&&strncmp(wd1,"yes",3)) return(2608);
- pspeak(dragon,1);
- prop[dragon]=2;
- prop[rug]=0;
- k=(plac[dragon]+fixd[dragon])/2;
- move(dragon+100,-1);
- move(rug+100,0);
- move(dragon,k);
- move(rug,k);
- for (obj=1; obj<=100; obj++)
- if (place[obj]==plac[dragon]||place[obj]==fixd[dragon])
- move(obj,k);
- loc=k;
- k=null;
- return(8);
-}
-
-
-int
-trtoss(void) /* 9170: throw */
-{ int i;
- if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
- if (!toting(obj)) return(2011);
- if (obj>=50&&obj<=maxtrs&&at(troll))
- { spk=159; /* 9178 */
- drop(obj,0);
- move(troll,0);
- move(troll+100,0);
- drop(troll2,plac[troll]);
- drop(troll2+100,fixd[troll]);
- juggle(chasm);
- return(2011);
- }
- if (obj==food&&here(bear))
- { obj=bear; /* 9177 */
- return(9210);
- }
- if (obj!=axe) return(9020);
- for (i=1; i<=5; i++)
- { if (dloc[i]==loc)
- { spk=48; /* 9172 */
- if (ran(3)==0||saved!= -1)
- l9175: { rspeak(spk);
- drop(axe,loc);
- k=null;
- return(8);
- }
- dseen[i]=FALSE;
- dloc[i]=0;
- spk=47;
- dkill++;
- if (dkill==1) spk=149;
- goto l9175;
- }
- }
- spk=152;
- if (at(dragon)&&prop[dragon]==0)
- goto l9175;
- spk=158;
- if (at(troll)) goto l9175;
- if (here(bear)&&prop[bear]==0)
- { spk=164;
- drop(axe,loc);
- fixed[axe]= -1;
- prop[axe]=1;
- juggle(bear);
- return(2011);
- }
- obj=0;
- return(9120);
-}
-
-
-int
-trfeed(void) /* 9210 */
-{ if (obj==bird)
- { spk=100;
- return(2011);
- }
- if (obj==snake||obj==dragon||obj==troll)
- { spk=102;
- if (obj==dragon&&prop[dragon]!=0) spk=110;
- if (obj==troll) spk=182;
- if (obj!=snake||closed||!here(bird)) return(2011);
- spk=101;
- dstroy(bird);
- prop[bird]=0;
- tally2++;
- return(2011);
- }
- if (obj==dwarf)
- { if (!here(food)) return(2011);
- spk=103;
- dflag++;
- return(2011);
- }
- if (obj==bear)
- { if (prop[bear]==0) spk=102;
- if (prop[bear]==3) spk=110;
- if (!here(food)) return(2011);
- dstroy(food);
- prop[bear]=1;
- fixed[axe]=0;
- prop[axe]=0;
- spk=168;
- return(2011);
- }
- spk=14;
- return(2011);
-}
-
-
-int
-trfill(void) /* 9220 */
-{ if (obj==vase)
- { spk=29;
- if (liqloc(loc)==0) spk=144;
- if (liqloc(loc)==0||!toting(vase)) return(2011);
- rspeak(145);
- prop[vase]=2;
- fixed[vase]= -1;
- return(9020); /* advent/10 goes to 9024 */
- }
- if (obj!=0&&obj!=bottle) return(2011);
- if (obj==0&&!here(bottle)) return(8000);
- spk=107;
- if (liqloc(loc)==0) spk=106;
- if (liq()!=0) spk=105;
- if (spk!=107) return(2011);
- prop[bottle]=((cond[loc]%4)/2)*2;
- k=liq();
- if (toting(bottle)) place[k]= -1;
- if (k==oil) spk=108;
- return(2011);
-}
-
-
-void
-closing(void) /* 10000 */
-{ int i;
-
- prop[grate]=prop[fissur]=0;
- for (i=1; i<=6; i++)
- { dseen[i]=FALSE;
- dloc[i]=0;
- }
- move(troll,0);
- move(troll+100,0);
- move(troll2,plac[troll]);
- move(troll2+100,fixd[troll]);
- juggle(chasm);
- if(prop[bear]!=3) dstroy(bear);
- prop[chain]=0;
- fixed[chain]=0;
- prop[axe]=0;
- fixed[axe]=0;
- rspeak(129);
- clock1 = -1;
- closng=TRUE;
-}
-
-
-void
-caveclose(void) /* 11000 */
-{ int i;
- prop[bottle]=put(bottle,115,1);
- prop[plant]=put(plant,115,0);
- prop[oyster]=put(oyster,115,0);
- prop[lamp]=put(lamp,115,0);
- prop[rod]=put(rod,115,0);
- prop[dwarf]=put(dwarf,115,0);
- loc=115;
- oldloc=115;
- newloc=115;
-
- put(grate,116,0);
- prop[snake]=put(snake,116,1);
- prop[bird]=put(bird,116,1);
- prop[cage]=put(cage,116,0);
- prop[rod2]=put(rod2,116,0);
- prop[pillow]=put(pillow,116,0);
-
- prop[mirror]=put(mirror,115,0);
- fixed[mirror]=116;
-
- for (i=1; i<=100; i++)
- if (toting(i)) dstroy(i);
- rspeak(132);
- closed=TRUE;
-}
diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c
deleted file mode 100644
index f16d3c5..0000000
--- a/games/adventure/vocab.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: data structure routines */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <err.h>
-#include "hdr.h"
-
-void
-dstroy(int object)
-{ move(object,0);
-}
-
-void
-juggle(int object)
-{ int i,j;
-
- i=place[object];
- j=fixed[object];
- move(object,i);
- move(object+100,j);
-}
-
-
-void
-move(int object, int where)
-{ int from;
-
- if (object<=100)
- from=place[object];
- else
- from=fixed[object-100];
- if (from>0 && from<=300) carry(object,from);
- drop(object,where);
-}
-
-
-int
-put(int object, int where, int pval)
-{ move(object,where);
- return(-1-pval);
-}
-
-void
-carry(int object, int where)
-{ int temp;
-
- if (object<=100)
- { if (place[object]== -1) return;
- place[object] = -1;
- holdng++;
- }
- if (atloc[where]==object)
- { atloc[where]=linkx[object];
- return;
- }
- for (temp=atloc[where]; linkx[temp]!=object; temp=linkx[temp]);
- linkx[temp]=linkx[object];
-}
-
-
-void
-drop(int object, int where)
-{ if (object>100) fixed[object-100]=where;
- else
- { if (place[object]== -1) holdng--;
- place[object]=where;
- }
- if (where<=0) return;
- linkx[object]=atloc[where];
- atloc[where]=object;
-}
-
-/* vocab(): look up or store a word */
-/* type: -2 for store, -1 for user word, >=0 for canned lookup*/
-/* store: used for storing only */
-int
-vocab(const char *word, int type, int value)
-{ int adr;
- const char *s;
- char *t;
- int hash, i;
- struct hashtab *h;
-
- for (hash=0,s=word,i=0; i<5 &&*s; i++) /* some kind of hash */
- hash += *s++; /* add all chars in the word */
- hash = (hash*3719)&077777; /* pulled that one out of a hat */
- hash %= HTSIZE; /* put it into range of table */
-
- for(adr=hash;; adr++) /* look for entry in table */
- { if (adr==HTSIZE) adr=0; /* wrap around */
- h = &voc[adr]; /* point at the entry */
- switch(type)
- { case -2: /* fill in entry */
- if (h->val) /* already got an entry? */
- goto exitloop2;
- h->val=value;
- h->atab=malloc(strlen(word)+1);
- if (h->atab == NULL)
- errx(1, "Out of memory!");
- for (s=word,t=h->atab; *s;)
- *t++ = *s++ ^ '=';
- *t=0^'=';
- /* encrypt slightly to thwart core reader */
- /* printf("Stored \"%s\" (%d ch) as entry %d\n", */
- /* word, strlen(word)+1, adr); */
- return(0); /* entry unused */
- case -1: /* looking up user word */
- if (h->val==0) return(-1); /* not found */
- for (s=word, t=h->atab;*t ^ '=';)
- if ((*s++ ^ '=') != *t++)
- goto exitloop2;
- if ((*s ^ '=') != *t && s-word<5) goto exitloop2;
- /* the word matched o.k. */
- return(h->val);
- default: /* looking up known word */
- if (h->val==0)
- { errx(1, "Unable to find %s in vocab", word);
- }
- for (s=word, t=h->atab;*t ^ '=';)
- if ((*s++ ^ '=') != *t++) goto exitloop2;
- /* the word matched o.k. */
- if (h->val/1000 != type) continue;
- return(h->val%1000);
- }
-
- exitloop2: /* hashed entry does not match */
- if (adr+1==hash || (adr==HTSIZE && hash==0))
- { errx(1, "Hash table overflow");
- }
- }
-}
diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c
deleted file mode 100644
index 93c54a3..0000000
--- a/games/adventure/wizard.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The game adventure was originally written in Fortran by Will Crowther
- * and Don Woods. It was later translated to C and enhanced by Jim
- * Gillogly. This code is derived from software contributed to Berkeley
- * by Jim Gillogly at The Rand Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Re-coding of advent in C: privileged operations */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/cdefs.h>
-#include "hdr.h"
-
-static int wizard (void);
-
-void
-datime(int *d, int *t)
-{ struct tm *tptr;
- time_t tvec;
-
- time(&tvec);
- tptr=localtime(&tvec);
- /* day since 1977 */
- *d = (tptr->tm_yday + 365 * (tptr->tm_year - 77)
- + (tptr->tm_year - 77) / 4 - (tptr->tm_year - 1) / 100
- + (tptr->tm_year + 299) / 400);
- /* bug: this will overflow in the year 2066 AD (with 16 bit int) */
- /* it will be attributed to Wm the C's millenial celebration */
- /* and minutes since midnite */
- *t=tptr->tm_hour*60+tptr->tm_min;
-}
-
-
-char magic[6];
-
-void
-poof(void)
-{
- strcpy(magic, DECR('d','w','a','r','f'));
- latncy = 45;
-}
-
-int
-Start(void)
-{ int d,t,delay;
-
- datime(&d,&t);
- delay=(d-saved)*1440+(t-savet); /* good for about a month */
-
- if (delay >= latncy)
- { saved = -1;
- return(FALSE);
- }
- printf("This adventure was suspended a mere %d minute%s ago.",
- delay, delay == 1? "" : "s");
- if (delay <= latncy/3)
- { mspeak(2);
- exit(0);
- }
- mspeak(8);
- if (!wizard())
- { mspeak(9);
- exit(0);
- }
- saved = -1;
- return(FALSE);
-}
-
-static int
-wizard(void) /* not as complex as advent/10 (for now) */
-{
- char *word,*x;
- if (!yesm(16,0,7)) return(FALSE);
- mspeak(17);
- getin(&word,&x);
- if (strncmp(word,magic,5))
- { mspeak(20);
- return(FALSE);
- }
- mspeak(19);
- return(TRUE);
-}
-
-void
-ciao(void)
-{ char *c;
- char fname[80];
-
- printf("What would you like to call the saved version?\n");
- /* XXX - should use fgetln to avoid arbitrary limit */
- for (c = fname; c < fname + sizeof fname - 1; c++) {
- int ch;
- ch = getchar();
- if (ch == '\n' || ch == EOF)
- break;
- *c = ch;
- }
- *c=0;
- if (save(fname) != 0) return; /* Save failed */
- printf("To resume, say \"adventure %s\".\n", fname);
- printf("\"With these rooms I might now have been familiarly acquainted.\"\n");
- exit(0);
-}
-
-
-int
-ran(int range)
-{
- int i;
-
- i = random() % range;
- return(i);
-}
diff --git a/games/arithmetic/Makefile b/games/arithmetic/Makefile
deleted file mode 100644
index f02d43d..0000000
--- a/games/arithmetic/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= arithmetic
-MAN= arithmetic.6
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/arithmetic/arithmetic.6 b/games/arithmetic/arithmetic.6
deleted file mode 100644
index 1b8ccae..0000000
--- a/games/arithmetic/arithmetic.6
+++ /dev/null
@@ -1,104 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Eamonn McManus of Trinity College Dublin.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)arithmetic.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH ARITHMETIC 6 "May 31, 1993"
-.UC 4
-.SH NAME
-arithmetic \- quiz on simple arithmetic
-.SH SYNOPSIS
-.B arithmetic
-.B [
-\-o +\-x/
-.B ]
-.B [
-\-r range
-.B ]
-.SH DESCRIPTION
-.I Arithmetic
-asks you to solve problems in simple arithmetic.
-Each question must be answered correctly before going on to the next.
-After every 20 problems, it prints the score so far and the time taken.
-You can quit at any time by typing the interrupt or end-of-file character.
-.PP
-The options are as follows:
-.TP
-\-o
-By default,
-.I arithmetic
-asks questions on addition of numbers from 0 to 10, and corresponding
-subtraction.
-By supplying one or more of the characters
-.BR +\-x/ ,
-you can ask for problems in addition, subtraction, multiplication, and
-division, respectively.
-If you give one of these characters more than once, that kind of problem
-will be asked correspondingly more often.
-.TP
-\-r
-If a
-.I range
-is supplied,
-.I arithmetic
-selects the numbers in its problems in the following way.
-For addition and multiplication, the numbers to be added or multiplied
-are between 0 and
-.IR range ,
-inclusive.
-For subtraction and division, both the required result and the number to
-divide by or subtract will be between 0 and
-.IR range .
-(Of course,
-.I arithmetic
-will not ask you to divide by 0.) The default
-.I range
-is 10.
-.PP
-When you get a problem wrong,
-.I arithmetic
-will remember the numbers involved, and will tend to select those numbers
-more often than others, in problems of the same sort.
-Eventually it will forgive and forget.
-.PP
-.I Arithmetic
-cannot be persuaded to tell you the right answer.
-You must work it out for yourself.
-.SH DIAGNOSTICS
-``What?'' if you get a question wrong.
-``Right!'' if you get it right.
-``Please type a number.'' if arithmetic doesn't understand what you typed.
-.SH "SEE ALSO"
-bc(1), dc(1)
diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c
deleted file mode 100644
index 68cd045..0000000
--- a/games/arithmetic/arithmetic.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Eamonn McManus of Trinity College Dublin.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * By Eamonn McManus, Trinity College Dublin <emcmanus@cs.tcd.ie>.
- *
- * The operation of this program mimics that of the standard Unix game
- * `arithmetic'. I've made it as close as I could manage without examining
- * the source code. The principal differences are:
- *
- * The method of biasing towards numbers that had wrong answers in the past
- * is different; original `arithmetic' seems to retain the bias forever,
- * whereas this program lets the bias gradually decay as it is used.
- *
- * Original `arithmetic' delays for some period (3 seconds?) after printing
- * the score. I saw no reason for this delay, so I scrapped it.
- *
- * There is no longer a limitation on the maximum range that can be supplied
- * to the program. The original program required it to be less than 100.
- * Anomalous results may occur with this program if ranges big enough to
- * allow overflow are given.
- *
- * I have obviously not attempted to duplicate bugs in the original. It
- * would go into an infinite loop if invoked as `arithmetic / 0'. It also
- * did not recognise an EOF in its input, and would continue trying to read
- * after it. It did not check that the input was a valid number, treating any
- * garbage as 0. Finally, it did not flush stdout after printing its prompt,
- * so in the unlikely event that stdout was not a terminal, it would not work
- * properly.
- */
-
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-
-const char keylist[] = "+-x/";
-const char defaultkeys[] = "+-";
-const char *keys = defaultkeys;
-int nkeys = sizeof(defaultkeys) - 1;
-int rangemax = 10;
-int nright, nwrong;
-time_t qtime;
-#define NQUESTS 20
-
-static void usage(void);
-int getrandom(int, int, int);
-void intr(int);
-int opnum(int);
-void penalise(int, int, int);
-int problem(void);
-void showstats(void);
-
-/*
- * Select keys from +-x/ to be asked addition, subtraction, multiplication,
- * and division problems. More than one key may be given. The default is
- * +-. Specify a range to confine the operands to 0 - range. Default upper
- * bound is 10. After every NQUESTS questions, statistics on the performance
- * so far are printed.
- */
-int
-main(int argc, char **argv)
-{
- int ch, cnt;
-
- /* Revoke setgid privileges */
- setgid(getgid());
-
- while ((ch = getopt(argc, argv, "r:o:")) != -1)
- switch(ch) {
- case 'o': {
- const char *p;
-
- for (p = keys = optarg; *p; ++p)
- if (!index(keylist, *p)) {
- (void)fprintf(stderr,
- "arithmetic: unknown key.\n");
- exit(1);
- }
- nkeys = p - optarg;
- break;
- }
- case 'r':
- if ((rangemax = atoi(optarg)) <= 0) {
- (void)fprintf(stderr,
- "arithmetic: invalid range.\n");
- exit(1);
- }
- break;
- case '?':
- default:
- usage();
- }
- if (argc -= optind)
- usage();
-
- /* Seed the random-number generator. */
- srandomdev();
-
- (void)signal(SIGINT, intr);
-
- /* Now ask the questions. */
- for (;;) {
- for (cnt = NQUESTS; cnt--;)
- if (problem() == EOF)
- exit(0);
- showstats();
- }
- /* NOTREACHED */
-}
-
-/* Handle interrupt character. Print score and exit. */
-void
-intr(int sig)
-{
- sig = 0;
- showstats();
- exit(0);
-}
-
-/* Print score. Original `arithmetic' had a delay after printing it. */
-void
-showstats(void)
-{
- if (nright + nwrong > 0) {
- (void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
- nright, nwrong, (int)(100L * nright / (nright + nwrong)));
- if (nright > 0)
- (void)printf("\nTotal time %ld seconds; %.1f seconds per problem\n\n",
- (long)qtime, (float)qtime / nright);
- }
- (void)printf("\n");
-}
-
-/*
- * Pick a problem and ask it. Keeps asking the same problem until supplied
- * with the correct answer, or until EOF or interrupt is typed. Problems are
- * selected such that the right operand and either the left operand (for +, x)
- * or the correct result (for -, /) are in the range 0 to rangemax. Each wrong
- * answer causes the numbers in the problem to be penalised, so that they are
- * more likely to appear in subsequent problems.
- */
-int
-problem(void)
-{
- char *p;
- time_t start, finish;
- int left, op, right, result;
- char line[80];
-
- left = 0;
- right = 0;
- result = 0;
- op = keys[random() % nkeys];
- if (op != '/')
- right = getrandom(rangemax + 1, op, 1);
-retry:
- /* Get the operands. */
- switch (op) {
- case '+':
- left = getrandom(rangemax + 1, op, 0);
- result = left + right;
- break;
- case '-':
- result = getrandom(rangemax + 1, op, 0);
- left = right + result;
- break;
- case 'x':
- left = getrandom(rangemax + 1, op, 0);
- result = left * right;
- break;
- case '/':
- right = getrandom(rangemax, op, 1) + 1;
- result = getrandom(rangemax + 1, op, 0);
- left = right * result + random() % right;
- break;
- }
-
- /*
- * A very big maxrange could cause negative values to pop
- * up, owing to overflow.
- */
- if (result < 0 || left < 0)
- goto retry;
-
- (void)printf("%d %c %d = ", left, op, right);
- (void)fflush(stdout);
- (void)time(&start);
-
- /*
- * Keep looping until the correct answer is given, or until EOF or
- * interrupt is typed.
- */
- for (;;) {
- if (!fgets(line, sizeof(line), stdin)) {
- (void)printf("\n");
- return(EOF);
- }
- for (p = line; *p && isspace(*p); ++p);
- if (!isdigit(*p)) {
- (void)printf("Please type a number.\n");
- continue;
- }
- if (atoi(p) == result) {
- (void)printf("Right!\n");
- ++nright;
- break;
- }
- /* Wrong answer; penalise and ask again. */
- (void)printf("What?\n");
- ++nwrong;
- penalise(right, op, 1);
- if (op == 'x' || op == '+')
- penalise(left, op, 0);
- else
- penalise(result, op, 0);
- }
-
- /*
- * Accumulate the time taken. Obviously rounding errors happen here;
- * however they should cancel out, because some of the time you are
- * charged for a partially elapsed second at the start, and some of
- * the time you are not charged for a partially elapsed second at the
- * end.
- */
- (void)time(&finish);
- qtime += finish - start;
- return(0);
-}
-
-/*
- * Here is the code for accumulating penalties against the numbers for which
- * a wrong answer was given. The right operand and either the left operand
- * (for +, x) or the result (for -, /) are stored in a list for the particular
- * operation, and each becomes more likely to appear again in that operation.
- * Initially, each number is charged a penalty of WRONGPENALTY, giving it that
- * many extra chances of appearing. Each time it is selected because of this,
- * its penalty is decreased by one; it is removed when it reaches 0.
- *
- * The penalty[] array gives the sum of all penalties in the list for
- * each operation and each operand. The penlist[] array has the lists of
- * penalties themselves.
- */
-
-int penalty[sizeof(keylist) - 1][2];
-struct penalty {
- int value, penalty; /* Penalised value and its penalty. */
- struct penalty *next;
-} *penlist[sizeof(keylist) - 1][2];
-
-#define WRONGPENALTY 5 /* Perhaps this should depend on maxrange. */
-
-/*
- * Add a penalty for the number `value' to the list for operation `op',
- * operand number `operand' (0 or 1). If we run out of memory, we just
- * forget about the penalty (how likely is this, anyway?).
- */
-void
-penalise(int value, int op, int operand)
-{
- struct penalty *p;
-
- op = opnum(op);
- if ((p = (struct penalty *)malloc((u_int)sizeof(*p))) == NULL)
- return;
- p->next = penlist[op][operand];
- penlist[op][operand] = p;
- penalty[op][operand] += p->penalty = WRONGPENALTY;
- p->value = value;
-}
-
-/*
- * Select a random value from 0 to maxval - 1 for operand `operand' (0 or 1)
- * of operation `op'. The random number we generate is either used directly
- * as a value, or represents a position in the penalty list. If the latter,
- * we find the corresponding value and return that, decreasing its penalty.
- */
-int
-getrandom(int maxval, int op, int operand)
-{
- int value;
- struct penalty **pp, *p;
-
- op = opnum(op);
- value = random() % (maxval + penalty[op][operand]);
-
- /*
- * 0 to maxval - 1 is a number to be used directly; bigger values
- * are positions to be located in the penalty list.
- */
- if (value < maxval)
- return(value);
- value -= maxval;
-
- /*
- * Find the penalty at position `value'; decrement its penalty and
- * delete it if it reaches 0; return the corresponding value.
- */
- for (pp = &penlist[op][operand]; (p = *pp) != NULL; pp = &p->next) {
- if (p->penalty > value) {
- value = p->value;
- penalty[op][operand]--;
- if (--(p->penalty) <= 0) {
- p = p->next;
- (void)free((char *)*pp);
- *pp = p;
- }
- return(value);
- }
- value -= p->penalty;
- }
- /*
- * We can only get here if the value from the penalty[] array doesn't
- * correspond to the actual sum of penalties in the list. Provide an
- * obscure message.
- */
- (void)fprintf(stderr, "arithmetic: bug: inconsistent penalties\n");
- exit(1);
- /* NOTREACHED */
-}
-
-/* Return an index for the character op, which is one of [+-x/]. */
-int
-opnum(int op)
-{
- char *p;
-
- if (op == 0 || (p = index(keylist, op)) == NULL) {
- (void)fprintf(stderr,
- "arithmetic: bug: op %c not in keylist %s\n", op, keylist);
- exit(1);
- }
- return(p - keylist);
-}
-
-/* Print usage message and quit. */
-static void
-usage(void)
-{
- (void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n");
- exit(1);
-}
diff --git a/games/atc/BUGS b/games/atc/BUGS
deleted file mode 100644
index 7d2af29..0000000
--- a/games/atc/BUGS
+++ /dev/null
@@ -1,4 +0,0 @@
-log restarts if interrupted
-Still refreshes after exit
-Should ^Z be disabled?
-does not exit after hup
diff --git a/games/atc/Makefile b/games/atc/Makefile
deleted file mode 100644
index ee086e4..0000000
--- a/games/atc/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= atc
-CFLAGS+=-DBSD -I${.CURDIR} -I.
-SRCS= extern.c grammar.y graphics.c input.c lex.l list.c log.c \
- main.c tunable.c update.c y.tab.h
-MAN= atc.6
-DPADD= ${LIBL} ${LIBM} ${LIBCURSES}
-LDADD= -ll -lm -lcurses
-FILES= Game_List Killer crossover default easy game_2
-FILESDIR= ${SHAREDIR}/games/atc
-HIDEGAME=hidegame
-
-.PATH: ${.CURDIR}/games
-
-.include <bsd.prog.mk>
diff --git a/games/atc/atc.6 b/games/atc/atc.6
deleted file mode 100644
index 8251371..0000000
--- a/games/atc/atc.6
+++ /dev/null
@@ -1,589 +0,0 @@
-.\" Copyright (c) 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Ed James.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)atc.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-. \" XP - exdented paragraph
-.de XP
-.RT
-.if \\n(1T .sp \\n(PDu
-.ne 1.1
-.if !\\n(IP .nr IP +1
-.in +\\n(I\\n(IRu
-.ti -\\n(I\\n(IRu
-..
-.\" Copyright (c) 1986 Ed James. All rights reserved.
-.\"
-.TH ATC 6 "May 31, 1993"
-.UC
-.SH NAME
-atc \- air traffic controller game
-.SH SYNOPSIS
-.B atc
--[u?lstp] [-[gf] game_name] [-r random seed]
-.SH DESCRIPTION
-.LP
-.I Atc
-lets you try your hand at the nerve wracking duties of the air traffic
-controller without endangering the lives of millions of
-travelers each year.
-Your responsibilities require you to direct the flight of jets
-and prop planes into and out of the flight arena and airports.
-The speed (update time) and frequency of the planes depend on the
-difficulty of the chosen arena.
-.SH OPTIONS
-.LP
-.TP 8
-.B \-u
-Print the usage line and exit.
-.TP
-.B \-?
-Same as
-.B \-u.
-.TP
-.B \-l
-Print a list of available games and exit.
-The first game name printed is the default game.
-.TP
-.B \-s
-Print the score list (formerly the Top Ten list).
-.TP
-.B \-t
-Same as
-.B \-s.
-.TP
-.B \-p
-Print the path to the special directory where
-.I atc
-expects to find its private files. This is used during the
-installation of the program.
-.TP
-.B "\-g game"
-Play the named game. If the game listed is not one of the
-ones printed from the
-.B \-l
-option, the default game is played.
-.TP
-.B "\-f game"
-Same as
-.B \-g.
-.TP
-.B "\-r seed"
-Set the random seed. The purpose of this flag is questionable.
-.SH GOALS
-.LP
-Your goal in
-.I atc
-is to keep the game going as long as possible.
-There is no winning state, except to beat the times of other players.
-You will need to: launch planes at airports (by instructing them to
-increase their altitude); land planes at airports (by instructing them to
-go to altitude zero when exactly over the airport); and maneuver planes
-out of exit points.
-.LP
-Several things will cause the end of the game.
-Each plane has a destination (see information area), and
-sending a plane to the wrong destination is an error.
-Planes can run out of fuel, or can collide. Collision is defined as
-adjacency in any of the three dimensions. A plane leaving the arena
-in any other way than through its destination exit is an error as well.
-.LP
-Scores are sorted in order of the number of planes safe. The other
-statistics are provided merely for fun. There is no penalty for
-taking longer than another player (except in the case of ties).
-.LP
-Suspending a game is not permitted. If you get a talk message, tough.
-When was the last time an Air Traffic Controller got called away to
-the phone?
-.SH "THE DISPLAY"
-.LP
-Depending on the terminal you run
-.I atc
-on, the screen will be divided into 4 areas.
-It should be stressed that the terminal driver portion of the
-game was designed to be reconfigurable, so the display format can vary
-depending the version you are playing. The descriptions here are based
-on the ASCII version
-of the game. The game rules and input format, however,
-should remain consistent.
-Control-L redraws the screen, should it become muddled.
-.SS RADAR
-.IP
-The first screen area is the radar display, showing the relative locations
-of the planes, airports, standard entry/exit points, radar
-beacons, and "lines" which simply serve to aid you in guiding
-the planes.
-.IP
-Planes are shown as a single letter with an altitude. If
-the numerical altitude is a single digit, then it represents
-thousands of feet.
-Some distinction is made between the prop
-planes and the jets. On ASCII terminals, prop planes are
-represented by a upper case letter, jets by a lower case letter.
-.IP
-Airports are shown as a number and some indication of the direction
-planes must be going to land at the airport.
-On ASCII terminals, this is one of '^', '>', '<', and 'v', to indicate
-north (0 degrees), east (90), west (270) and south (180), respectively.
-The planes will also
-take off in this direction.
-.IP
-Beacons are represented as circles or asterisks and a number.
-Their purpose is to offer a place of easy reference to the plane pilots.
-See 'the delay command' under the input section of this manual.
-.IP
-Entry/exit points are displayed as numbers along the border of the
-radar screen. Planes will enter the arena from these points without
-warning. These points have a direction associated with them, and
-planes will always enter the arena from this direction. On the
-ASCII version of
-.I atc,
-this direction is not displayed. It will become apparent
-what this direction is as the game progresses.
-.IP
-Incoming planes will always enter at the same altitude: 7000 feet.
-For a plane to successfully depart through an entry/exit point,
-it must be flying at 9000 feet.
-It is not necessary for the planes to be flying in any particular
-direction when they leave the arena (yet).
-.SS "INFORMATION AREA"
-.IP
-The second area of the display is the information area, which lists
-the time (number of updates since start), and the number of planes you
-have directed safely out of the arena.
-Below this is a list of planes currently in the air, followed by a
-blank line, and then a list of planes on the ground (at airports).
-Each line lists the plane name and its current altitude,
-an optional asterisk indicating low fuel, the plane's destination,
-and the plane's current command. Changing altitude is not considered
-to be a command and is therefore not displayed. The following are
-some possible information lines:
-.IP
- B4*A0: Circle @ b1
-.br
- g7 E4: 225
-.IP
-The first example shows a prop plane named 'B' that is flying at 4000
-feet. It is low on fuel (note the '*'). It's destination is
-Airport #0.
-The next command it expects
-to do is circle when it reaches Beacon #1.
-The second example shows a jet named 'g' at 7000 feet, destined for
-Exit #4. It is just now executing a turn to 225 degrees (South-West).
-.SS "INPUT AREA"
-.IP
-The third area of the display is the input area. It is here that
-your input is reflected. See the INPUT heading of this manual
-for more details.
-.SS "AUTHOR AREA"
-.IP
-This area is used simply to give credit where credit is due. :-)
-.SH INPUT
-.LP
-A command completion interface is built into
-the game. At any time, typing '?' will list possible input characters.
-Typing a backspace (your erase character) backs up, erasing the last part
-of the command. When a command is complete, a return enters it, and
-any semantic checking is done at that time. If no errors are detected,
-the command is sent to the appropriate plane. If an error is discovered
-during the check, the offending statement will be underscored and a
-(hopefully) descriptive message will be printed under it.
-.LP
-The command syntax is broken into two parts:
-.I "Immediate Only"
-and
-.I Delayable
-commands.
-.I "Immediate Only"
-commands happen on the next
-update.
-.I Delayable
-commands also happen on the next update unless they
-are followed by an optional predicate called the
-.I Delay
-command.
-.LP
-In the following tables, the syntax
-.B [0\-9]
-means any single digit, and
-.B <dir>
-refers to the keys around the 's' key, namely ``wedcxzaq''.
-In absolute references, 'q' refers to North-West or 315 degrees, and 'w'
-refers to North, or 0 degrees.
-In relative references, 'q' refers to -45 degrees or 45 degrees left, and 'w'
-refers to 0 degrees, or no change in direction.
-.LP
-All commands start with a plane letter. This indicates the recipient
-of the command. Case is ignored.
-.SS "IMMEDIATE ONLY COMMANDS"
-.RS
-.B "\- a Altitude:"
-.RS
-Affect a plane's altitude (and take off).
-.RE
-.RS
-.B "\- [0\-9] Number:"
-.RS
-Go to the given altitude (thousands of feet).
-.RE
-.B "\- c/+ Climb:"
-.RS
-Relative altitude change.
-.RE
-.RS
-.B "\- [0\-9] Number:"
-.RS
-Difference in thousands of feet.
-.RE
-.RE
-.B "\- d/\- Descend:"
-.RS
-Relative altitude change.
-.RE
-.RS
-.B "\- [0\-9] Number:"
-.RS
-Difference in thousands of feet.
-.RE
-.RE
-.RE
-.B "\- m Mark:"
-.RS
-Display in highlighted mode. Command is displayed normally.
-.RE
-.B "\- i Ignore:"
-.RS
-Do not display highlighted. Command is displayed as a
-line of dashes if there is no command.
-.RE
-.B "\- u Unmark:"
-.RS
-Same as ignore, but if a delayed command is processed,
-the plane will become marked. This is useful if you want
-to forget about a plane during part, but not all, of its
-journey.
-.RE
-.RE
-.SS "DELAYABLE COMMANDS"
-.RS
-.B "\- c Circle:"
-.RS
-Have the plane circle.
-.RE
-.B "\- t Turn:"
-.RS
-Change direction.
-.RE
-.RS
-.B "\- l Left:"
-.RS
-Turn counterclockwise (45 degrees by default).
-.RE
-.RS
-.B "\- <dir> Direction:"
-.RS
-Turn ccw the given number of degrees.
-Zero degrees is no turn. A ccw turn
-of -45 degrees is 45 cw.
-.RE
-.RE
-.B "\- r Right:"
-.RS
-Turn clockwise (45 degrees by default).
-.RE
-.RS
-.B "\- <dir> Direction:"
-.RS
-Same as turn left <dir>.
-.RE
-.RE
-.B "\- L Left 90:"
-.RS
-Turn counterclockwise 90 degrees.
-.RE
-.B "\- R Right 90:"
-.RS
-Turn clockwise 90 degrees.
-.RE
-.B "\- <dir> Direction:"
-.RS
-Turn to the absolute compass heading given.
-The shortest turn will be taken.
-.RE
-.B "\- t Towards:"
-.RS
-Turn towards a beacon, airport or exit. The turn is
-just an estimate.
-.RE
-.RS
-.B "\- b/* Beacon:"
-.RS
-Turn towards the beacon.
-.RE
-.RS
-.B "\- [0-9] Number:"
-.RS
-The beacon number.
-.RE
-.RE
-.B "\- e Exit:"
-.RS
-Turn towards the exit.
-.RE
-.RS
-.B "\- [0-9] Number:"
-.RS
-The exit number.
-.RE
-.RE
-.B "\- a Airport:"
-.RS
-Turn towards the airport.
-.RE
-.RS
-.B "\- [0-9] Number:"
-.RS
-The airport number.
-.RE
-.RE
-.RE
-.RE
-.RE
-.SS THE DELAY COMMAND
-.LP
-The
-.B Delay
-(a/@)
-command may be appended to any
-.B Delayable
-command. It allows the controller to instruct a plane to do an action
-when the plane reaches a particular beacon (or other objects in future
-versions).
-.sp
-.RS
-.B "\- a/@ At:"
-.RS
-Do the given delayable command when the plane reaches the given beacon.
-.RE
-.RS
-.B "\- b/* Beacon:"
-.RS
-This is redundant to allow for expansion.
-.RE
-.RS
-.B "\- [0-9] Number:"
-.RS
-The beacon number.
-.RE
-.RE
-.RE
-.RE
-.SS "MARKING, UNMARKING AND IGNORING"
-.LP
-Planes are
-.B marked
-when they enter the arena. This means they are displayed in highlighted
-mode on the radar display. A plane may also be either
-.B unmarked
-or
-.B ignored.
-An
-.B unmarked
-plane is drawn in unhighlighted mode, and a line of dashes is displayed in
-the command field of the information area. The plane will remain this
-way until a mark command has been issued. Any other command will be issued,
-but the command line will return to a line of dashes when the command
-is completed.
-.LP
-An
-.B ignored
-plane is treated the same as an unmarked plane, except that it will
-automatically switch to
-.B marked
-status when a delayed command has been processed. This is useful if
-you want to forget about a plane for a while, but its flight path has
-not yet been completely set.
-.LP
-As with all of the commands, marking, unmarking and ignoring will take effect
-at the beginning of the next update. Do not be surprised if the plane does
-not immediately switch to unhighlighted mode.
-.SS EXAMPLES
-.RS
-.TP 16
-atlab1
-a: turn left at beacon #1
-.TP 16
-cc
-C: circle
-.TP 16
-gtte4ab2
-g: turn towards exit #4 at beacon #2
-.TP 16
-ma+2
-m: altitude: climb 2000 feet
-.TP 16
-stq
-S: turn to 315
-.TP 16
-xi
-x: ignore
-.RE
-.SH "OTHER INFORMATION"
-.LP
-Jets move every update; prop planes move every other update.
-.LP
-All planes turn a most 90 degrees per movement.
-.LP
-Planes enter at 7000 feet and leave at 9000 feet.
-.LP
-Planes flying at an altitude of 0 crash if they are not over an airport.
-.LP
-Planes waiting at airports can only be told to take off (climb in altitude).
-.SH "NEW GAMES"
-.LP
-The
-.B Game_List
-file lists the currently available play fields. New field description
-file names must be placed in this file to be 'playable'. If a player
-specifies a game not in this file, his score will not be logged.
-.LP
-The game field description files are broken into two parts. The first
-part is the definition section. Here, the four tunable game parameters
-must be set. These variables are set with the syntax:
-.IP
-variable = number;
-.LP
-Variable may be one of:
-.B update,
-indicating the number of seconds between forced updates;
-.B newplane,
-indicating (about) the number of updates between new plane entries;
-.B width,
-indicating the width of the play field; and
-.B height,
-indicating the height of the play field.
-.LP
-The second part of the field description files describes the locations
-of the exits, the beacons, the airports and the lines.
-The syntax is as follows:
-.IP
-beacon: (x y) ... ;
-.br
-airport: (x y direction) ... ;
-.br
-exit: (x y direction) ... ;
-.br
-line: [ (x1 y1) (x2 y2) ] ... ;
-.LP
-For beacons, a simple x, y coordinate pair is used (enclosed in parenthesis).
-Airports and exits require a third value, a direction, which is one
-of
-.B wedcxzaq.
-For airports, this is the direction that planes must be going to take
-off and land, and for exits, this is the direction that planes will going
-when they
-.B enter
-the arena. This may not seem intuitive, but as there is no restriction on
-direction of exit, this is appropriate.
-Lines are slightly different, since they need two coordinate pairs to
-specify the line endpoints. These endpoints must be enclosed in
-square brackets.
-.LP
-All statements are semi-colon (;) terminated. Multiple item statements
-accumulate. Each definition must occur exactly once, before any
-item statements. Comments begin with a hash (#) symbol
-and terminate with a newline.
-The coordinates are between zero and width-1 and height-1
-inclusive. All of the exit coordinates must lie on the borders, and
-all of the beacons and airports must lie inside of the borders.
-Line endpoints may be anywhere within the field, so long as
-the lines are horizontal, vertical or
-.B "exactly diagonal."
-.SS "FIELD FILE EXAMPLE"
-.RS
-.sp
-.nf
-.ta \w'airport:\ \ \ 'u
-# This is the default game.
-
-update = 5;
-newplane = 5;
-width = 30;
-height = 21;
-
-exit: ( 12 0 x ) ( 29 0 z ) ( 29 7 a ) ( 29 17 a )
- ( 9 20 e ) ( 0 13 d ) ( 0 7 d ) ( 0 0 c ) ;
-
-beacon: ( 12 7 ) ( 12 17 ) ;
-
-airport: ( 20 15 w ) ( 20 18 d ) ;
-
-line: [ ( 1 1 ) ( 6 6 ) ]
- [ ( 12 1 ) ( 12 6 ) ]
- [ ( 13 7 ) ( 28 7 ) ]
- [ ( 28 1 ) ( 13 16 ) ]
- [ ( 1 13 ) ( 11 13 ) ]
- [ ( 12 8 ) ( 12 16 ) ]
- [ ( 11 18 ) ( 10 19 ) ]
- [ ( 13 17 ) ( 28 17 ) ]
- [ ( 1 7 ) ( 11 7 ) ] ;
-.DT
-.fi
-.RE
-.SH FILES
-.LP
-Files are kept in a special directory. See the OPTIONS for a way to
-print this path out.
-.TP \w'/usr/share/games/atc/Game_List\ \ \ 'u
-/var/games/atc_score
-Where the scores are kept.
-.TP
-/usr/share/games/atc/Game_List
-The list of playable games.
-.SH AUTHOR
-.LP
-Ed James, UC Berkeley: edjames@ucbvax.berkeley.edu, ucbvax!edjames
-.LP
-This game is based on someone's description of the overall flavor
-of a game written for some unknown PC many years ago, maybe.
-.SH BUGS
-.LP
-The screen sometimes refreshes after you have quit.
-.LP
-Yet Another Curses Bug was discovered during the development of this game.
-If your curses library clrtobot.o is version 5.1 or earlier,
-you will have erase problems with the backspace operator in the input
-window.
-
diff --git a/games/atc/def.h b/games/atc/def.h
deleted file mode 100644
index 99e3190..0000000
--- a/games/atc/def.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)def.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#define AUTHOR_STR "ATC - by Ed James"
-
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
-#define LOWFUEL 15
-
-#define REALLOC 10
-
-#define SGN(x) ((x < 0) ? -1 : ((x > 0) ? 1 : 0))
-#define ABS(x) ((x < 0) ? -(x) : (x))
-#define DIR_FROM_DXDY(dx,dy) ((int) (atan2((double)(dy), (double)(dx)) \
- * MAXDIR / (2 * PI) + 2.5 + MAXDIR) % MAXDIR)
-
-#define MAXDIR 8
-
-#define D_LEFT 1
-#define D_RIGHT 2
-#define D_UP 3
-#define D_DOWN 4
-
-#define T_NODEST 0
-#define T_BEACON 1
-#define T_EXIT 2
-#define T_AIRPORT 3
-
-#define S_NONE 0
-#define S_GONE 1
-#define S_MARKED 2
-#define S_UNMARKED 3
-#define S_IGNORED 4
-
-#define INPUT_LINES 3
-#define PLANE_COLS 20
diff --git a/games/atc/extern.c b/games/atc/extern.c
deleted file mode 100644
index 2976b0c..0000000
--- a/games/atc/extern.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "include.h"
-
-char GAMES[] = "Game_List";
-
-int clck, safe_planes, start_time, test_mode;
-
-const char *file;
-
-FILE *filein, *fileout;
-
-C_SCREEN screen, *sp = &screen;
-
-LIST air, ground;
-
-struct sgttyb tty_start, tty_new;
-
-DISPLACEMENT displacement[MAXDIR] = {
- { 0, -1 },
- { 1, -1 },
- { 1, 0 },
- { 1, 1 },
- { 0, 1 },
- { -1, 1 },
- { -1, 0 },
- { -1, -1 }
-};
diff --git a/games/atc/extern.h b/games/atc/extern.h
deleted file mode 100644
index 4072873..0000000
--- a/games/atc/extern.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)extern.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-extern char GAMES[];
-extern const char *file;
-
-extern int clck, safe_planes, start_time, test_mode;
-
-extern FILE *filein, *fileout;
-
-extern C_SCREEN screen, *sp;
-
-extern LIST air, ground;
-
-extern struct sgttyb tty_start, tty_new;
-
-extern DISPLACEMENT displacement[MAXDIR];
-
-extern PLANE *findplane(), *newplane();
diff --git a/games/atc/games/Game_List b/games/atc/games/Game_List
deleted file mode 100644
index 0117385..0000000
--- a/games/atc/games/Game_List
+++ /dev/null
@@ -1,5 +0,0 @@
-default
-easy
-crossover
-Killer
-game_2
diff --git a/games/atc/games/Killer b/games/atc/games/Killer
deleted file mode 100644
index f15d060..0000000
--- a/games/atc/games/Killer
+++ /dev/null
@@ -1,21 +0,0 @@
-update = 1;
-newplane = 4;
-width = 30;
-height = 21;
-
-exit: ( 29 7 a ) ( 29 17 a )
- ( 0 7 d ) ( 0 0 c ) ;
-
-beacon: ( 12 7 ) ( 12 17 ) ( 14 10 ) ( 20 15 ) ;
-
-airport: ( 20 18 d ) ;
-
-line: [ ( 1 1 ) ( 6 6 ) ]
- [ ( 12 1 ) ( 12 6 ) ]
- [ ( 13 7 ) ( 28 7 ) ]
- [ ( 28 1 ) ( 13 16 ) ]
- [ ( 1 13 ) ( 11 13 ) ]
- [ ( 12 8 ) ( 12 16 ) ]
- [ ( 11 18 ) ( 10 19 ) ]
- [ ( 13 17 ) ( 28 17 ) ]
- [ ( 1 7 ) ( 11 7 ) ] ;
diff --git a/games/atc/games/crossover b/games/atc/games/crossover
deleted file mode 100644
index d2689ff..0000000
--- a/games/atc/games/crossover
+++ /dev/null
@@ -1,14 +0,0 @@
-update = 5;
-newplane = 5;
-width = 29;
-height = 21;
-
-exit: ( 0 0 c ) ( 8 0 c ) ( 20 0 z ) ( 28 0 z )
- ( 28 20 q ) ( 20 20 q ) ( 8 20 e ) ( 0 20 e );
-
-beacon: ( 14 6 ) ( 18 10 ) ( 14 14 ) ( 10 10 );
-
-line: [ ( 0 0 ) ( 20 20 ) ]
- [ ( 8 0 ) ( 28 20 ) ]
- [ ( 20 0 ) ( 0 20 ) ]
- [ ( 28 0 ) ( 8 20 ) ];
diff --git a/games/atc/games/default b/games/atc/games/default
deleted file mode 100644
index e19ef9d..0000000
--- a/games/atc/games/default
+++ /dev/null
@@ -1,21 +0,0 @@
-update = 5;
-newplane = 10;
-width = 30;
-height = 21;
-
-exit: ( 12 0 x ) ( 29 0 z ) ( 29 7 a ) ( 29 17 a )
- ( 9 20 e ) ( 0 13 d ) ( 0 7 d ) ( 0 0 c ) ;
-
-beacon: ( 12 7 ) ( 12 17 ) ;
-
-airport: ( 20 15 w ) ( 20 18 d ) ;
-
-line: [ ( 1 1 ) ( 6 6 ) ]
- [ ( 12 1 ) ( 12 6 ) ]
- [ ( 13 7 ) ( 28 7 ) ]
- [ ( 28 1 ) ( 13 16 ) ]
- [ ( 1 13 ) ( 11 13 ) ]
- [ ( 12 8 ) ( 12 16 ) ]
- [ ( 11 18 ) ( 10 19 ) ]
- [ ( 13 17 ) ( 28 17 ) ]
- [ ( 1 7 ) ( 11 7 ) ] ;
diff --git a/games/atc/games/easy b/games/atc/games/easy
deleted file mode 100644
index 4ab8eac..0000000
--- a/games/atc/games/easy
+++ /dev/null
@@ -1,15 +0,0 @@
-update = 7;
-newplane = 12;
-width = 15;
-height = 15;
-
-exit: ( 7 0 x ) ( 14 0 z ) ( 12 14 q ) ( 0 14 e ) ;
-
-beacon: ( 12 7 ) ;
-
-airport: ( 7 8 w ) ;
-
-line: [ ( 1 1 ) ( 6 6 ) ]
- [ ( 7 9 ) ( 12 14 ) ]
- [ ( 7 0 ) ( 7 14 ) ]
- [ ( 1 7 ) ( 11 7 ) ] ;
diff --git a/games/atc/games/game_2 b/games/atc/games/game_2
deleted file mode 100644
index 5788c8a..0000000
--- a/games/atc/games/game_2
+++ /dev/null
@@ -1,22 +0,0 @@
-update = 5;
-newplane = 8;
-width = 30;
-height = 21;
-
-exit: ( 12 0 x ) ( 29 0 z ) ( 29 6 a ) ( 29 13 a )
- ( 9 20 e ) ( 0 13 d ) ( 0 6 d ) ( 0 0 c ) ;
-
-beacon: ( 12 17 ) ( 23 6 ) ( 23 13 ) ( 25 17 )
- ( 12 6 ) ( 12 13 ) ( 6 6 ) ;
-
-airport: ( 18 17 d ) ;
-
-line: [ ( 1 1 ) ( 16 16 ) ]
- [ ( 1 6 ) ( 28 6 ) ]
- [ ( 12 1 ) ( 12 17 ) ]
- [ ( 10 19 ) ( 28 1 ) ]
- [ ( 13 17 ) ( 17 17 ) ]
- [ ( 1 13 ) ( 28 13 ) ]
- [ ( 19 17 ) ( 24 17 ) ]
- [ ( 19 17 ) ( 22 14 ) ]
- [ ( 26 16 ) ( 28 14 ) ] ;
diff --git a/games/atc/grammar.y b/games/atc/grammar.y
deleted file mode 100644
index 6a2694a..0000000
--- a/games/atc/grammar.y
+++ /dev/null
@@ -1,390 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-%token <ival> HeightOp
-%token <ival> WidthOp
-%token <ival> UpdateOp
-%token <ival> NewplaneOp
-%token <cval> DirOp
-%token <ival> ConstOp
-%token <ival> LineOp
-%token <ival> AirportOp
-%token <ival> BeaconOp
-%token <ival> ExitOp
-%union {
- int ival;
- char cval;
-}
-
-%{
-#include "include.h"
-
-#ifndef lint
-static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93";
-#endif /* not lint */
-
-int errors = 0;
-int line = 1;
-%}
-
-%%
-file:
- bunch_of_defs { if (checkdefs() < 0) return (errors); } bunch_of_lines
- {
- if (sp->num_exits + sp->num_airports < 2)
- yyerror("Need at least 2 airports and/or exits.");
- return (errors);
- }
- ;
-
-bunch_of_defs:
- def bunch_of_defs
- | def
- ;
-
-def:
- udef
- | ndef
- | wdef
- | hdef
- ;
-
-udef:
- UpdateOp '=' ConstOp ';'
- {
- if (sp->update_secs != 0)
- return (yyerror("Redefinition of 'update'."));
- else if ($3 < 1)
- return (yyerror("'update' is too small."));
- else
- sp->update_secs = $3;
- }
- ;
-
-ndef:
- NewplaneOp '=' ConstOp ';'
- {
- if (sp->newplane_time != 0)
- return (yyerror("Redefinition of 'newplane'."));
- else if ($3 < 1)
- return (yyerror("'newplane' is too small."));
- else
- sp->newplane_time = $3;
- }
- ;
-
-hdef:
- HeightOp '=' ConstOp ';'
- {
- if (sp->height != 0)
- return (yyerror("Redefinition of 'height'."));
- else if ($3 < 3)
- return (yyerror("'height' is too small."));
- else
- sp->height = $3;
- }
- ;
-
-wdef:
- WidthOp '=' ConstOp ';'
- {
- if (sp->height != 0)
- return (yyerror("Redefinition of 'width'."));
- else if ($3 < 3)
- return (yyerror("'width' is too small."));
- else
- sp->width = $3;
- }
- ;
-
-bunch_of_lines:
- line bunch_of_lines
- {}
- | line
- {}
- ;
-
-line:
- BeaconOp ':' Bpoint_list ';'
- {}
- | ExitOp ':' Epoint_list ';'
- {}
- | LineOp ':' Lline_list ';'
- {}
- | AirportOp ':' Apoint_list ';'
- {}
- ;
-
-Bpoint_list:
- Bpoint Bpoint_list
- {}
- | Bpoint
- {}
- ;
-
-Bpoint:
- '(' ConstOp ConstOp ')'
- {
- if (sp->num_beacons % REALLOC == 0) {
- if (sp->beacon == NULL)
- sp->beacon = (BEACON *) malloc((sp->num_beacons
- + REALLOC) * sizeof (BEACON));
- else
- sp->beacon = (BEACON *) realloc(sp->beacon,
- (sp->num_beacons + REALLOC) *
- sizeof (BEACON));
- if (sp->beacon == NULL)
- return (yyerror("No memory available."));
- }
- sp->beacon[sp->num_beacons].x = $2;
- sp->beacon[sp->num_beacons].y = $3;
- check_point($2, $3);
- sp->num_beacons++;
- }
- ;
-
-Epoint_list:
- Epoint Epoint_list
- {}
- | Epoint
- {}
- ;
-
-Epoint:
- '(' ConstOp ConstOp DirOp ')'
- {
- int dir;
-
- if (sp->num_exits % REALLOC == 0) {
- if (sp->exit == NULL)
- sp->exit = (EXIT *) malloc((sp->num_exits +
- REALLOC) * sizeof (EXIT));
- else
- sp->exit = (EXIT *) realloc(sp->exit,
- (sp->num_exits + REALLOC) *
- sizeof (EXIT));
- if (sp->exit == NULL)
- return (yyerror("No memory available."));
- }
- dir = dir_no($4);
- sp->exit[sp->num_exits].x = $2;
- sp->exit[sp->num_exits].y = $3;
- sp->exit[sp->num_exits].dir = dir;
- check_edge($2, $3);
- check_edir($2, $3, dir);
- sp->num_exits++;
- }
- ;
-
-Apoint_list:
- Apoint Apoint_list
- {}
- | Apoint
- {}
- ;
-
-Apoint:
- '(' ConstOp ConstOp DirOp ')'
- {
- int dir;
-
- if (sp->num_airports % REALLOC == 0) {
- if (sp->airport == NULL)
- sp->airport=(AIRPORT *)malloc((sp->num_airports
- + REALLOC) * sizeof(AIRPORT));
- else
- sp->airport = (AIRPORT *) realloc(sp->airport,
- (sp->num_airports + REALLOC) *
- sizeof(AIRPORT));
- if (sp->airport == NULL)
- return (yyerror("No memory available."));
- }
- dir = dir_no($4);
- sp->airport[sp->num_airports].x = $2;
- sp->airport[sp->num_airports].y = $3;
- sp->airport[sp->num_airports].dir = dir;
- check_point($2, $3);
- check_adir($2, $3, dir);
- sp->num_airports++;
- }
- ;
-
-Lline_list:
- Lline Lline_list
- {}
- | Lline
- {}
- ;
-
-Lline:
- '[' '(' ConstOp ConstOp ')' '(' ConstOp ConstOp ')' ']'
- {
- if (sp->num_lines % REALLOC == 0) {
- if (sp->line == NULL)
- sp->line = (LINE *) malloc((sp->num_lines +
- REALLOC) * sizeof (LINE));
- else
- sp->line = (LINE *) realloc(sp->line,
- (sp->num_lines + REALLOC) *
- sizeof (LINE));
- if (sp->line == NULL)
- return (yyerror("No memory available."));
- }
- sp->line[sp->num_lines].p1.x = $3;
- sp->line[sp->num_lines].p1.y = $4;
- sp->line[sp->num_lines].p2.x = $7;
- sp->line[sp->num_lines].p2.y = $8;
- check_line($3, $4, $7, $8);
- sp->num_lines++;
- }
- ;
-%%
-
-check_edge(x, y)
-{
- if (!(x == 0) && !(x == sp->width - 1) &&
- !(y == 0) && !(y == sp->height - 1))
- yyerror("edge value not on edge.");
-}
-
-check_point(x, y)
-{
- if (x < 1 || x >= sp->width - 1)
- yyerror("X value out of range.");
- if (y < 1 || y >= sp->height - 1)
- yyerror("Y value out of range.");
-}
-
-check_linepoint(x, y)
-{
- if (x < 0 || x >= sp->width)
- yyerror("X value out of range.");
- if (y < 0 || y >= sp->height)
- yyerror("Y value out of range.");
-}
-
-check_line(x1, y1, x2, y2)
-{
- int d1, d2;
-
- check_linepoint(x1, y1);
- check_linepoint(x2, y2);
-
- d1 = ABS(x2 - x1);
- d2 = ABS(y2 - y1);
-
- if (!(d1 == d2) && !(d1 == 0) && !(d2 == 0))
- yyerror("Bad line endpoints.");
-}
-
-yyerror(s)
- char *s;
-{
- fprintf(stderr, "\"%s\": line %d: %s\n", file, line, s);
- errors++;
-
- return (errors);
-}
-
-check_edir(x, y, dir)
-{
- int bad = 0;
-
- if (x == sp->width - 1)
- x = 2;
- else if (x != 0)
- x = 1;
- if (y == sp->height - 1)
- y = 2;
- else if (y != 0)
- y = 1;
-
- switch (x * 10 + y) {
- case 00: if (dir != 3) bad++; break;
- case 01: if (dir < 1 || dir > 3) bad++; break;
- case 02: if (dir != 1) bad++; break;
- case 10: if (dir < 3 || dir > 5) bad++; break;
- case 11: break;
- case 12: if (dir > 1 && dir < 7) bad++; break;
- case 20: if (dir != 5) bad++; break;
- case 21: if (dir < 5) bad++; break;
- case 22: if (dir != 7) bad++; break;
- default:
- yyerror("Unknown value in checkdir! Get help!");
- break;
- }
- if (bad)
- yyerror("Bad direction for entrance at exit.");
-}
-
-check_adir(x, y, dir)
-{
-}
-
-checkdefs()
-{
- int err = 0;
-
- if (sp->width == 0) {
- yyerror("'width' undefined.");
- err++;
- }
- if (sp->height == 0) {
- yyerror("'height' undefined.");
- err++;
- }
- if (sp->update_secs == 0) {
- yyerror("'update' undefined.");
- err++;
- }
- if (sp->newplane_time == 0) {
- yyerror("'newplane' undefined.");
- err++;
- }
- if (err)
- return (-1);
- else
- return (0);
-}
diff --git a/games/atc/graphics.c b/games/atc/graphics.c
deleted file mode 100644
index 8b521a3..0000000
--- a/games/atc/graphics.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "include.h"
-#ifdef SYSV
-#include <errno.h>
-#endif
-
-#define C_TOPBOTTOM '-'
-#define C_LEFTRIGHT '|'
-#define C_AIRPORT '='
-#define C_LINE '+'
-#define C_BACKROUND '.'
-#define C_BEACON '*'
-#define C_CREDIT '*'
-
-WINDOW *radar, *cleanradar, *credit, *input, *planes;
-
-getAChar()
-{
-#ifdef BSD
- return (getchar());
-#endif
-#ifdef SYSV
- int c;
-
- while ((c = getchar()) == -1 && errno == EINTR) ;
- return(c);
-#endif
-}
-
-erase_all()
-{
- PLANE *pp;
-
- for (pp = air.head; pp != NULL; pp = pp->next) {
- wmove(cleanradar, pp->ypos, pp->xpos * 2);
- wmove(radar, pp->ypos, pp->xpos * 2);
- waddch(radar, winch(cleanradar));
- wmove(cleanradar, pp->ypos, pp->xpos * 2 + 1);
- wmove(radar, pp->ypos, pp->xpos * 2 + 1);
- waddch(radar, winch(cleanradar));
- }
-}
-
-draw_all()
-{
- PLANE *pp;
-
- for (pp = air.head; pp != NULL; pp = pp->next) {
- if (pp->status == S_MARKED)
- wstandout(radar);
- wmove(radar, pp->ypos, pp->xpos * 2);
- waddch(radar, name(pp));
- waddch(radar, '0' + pp->altitude);
- if (pp->status == S_MARKED)
- wstandend(radar);
- }
- wrefresh(radar);
- planewin();
- wrefresh(input); /* return cursor */
- fflush(stdout);
-}
-
-init_gr()
-{
- static char buffer[BUFSIZ];
-
- initscr();
- setbuf(stdout, buffer);
- input = newwin(INPUT_LINES, COLS - PLANE_COLS, LINES - INPUT_LINES, 0);
- credit = newwin(INPUT_LINES, PLANE_COLS, LINES - INPUT_LINES,
- COLS - PLANE_COLS);
- planes = newwin(LINES - INPUT_LINES, PLANE_COLS, 0, COLS - PLANE_COLS);
-}
-
-setup_screen(scp)
- const C_SCREEN *scp;
-{
- int i, j;
- char str[3];
- const char *airstr;
-
- str[2] = '\0';
-
- if (radar != NULL)
- delwin(radar);
- radar = newwin(scp->height, scp->width * 2, 0, 0);
-
- if (cleanradar != NULL)
- delwin(cleanradar);
- cleanradar = newwin(scp->height, scp->width * 2, 0, 0);
-
- /* minus one here to prevent a scroll */
- for (i = 0; i < PLANE_COLS - 1; i++) {
- wmove(credit, 0, i);
- waddch(credit, C_CREDIT);
- wmove(credit, INPUT_LINES - 1, i);
- waddch(credit, C_CREDIT);
- }
- wmove(credit, INPUT_LINES / 2, 1);
- waddstr(credit, AUTHOR_STR);
-
- for (i = 1; i < scp->height - 1; i++) {
- for (j = 1; j < scp->width - 1; j++) {
- wmove(radar, i, j * 2);
- waddch(radar, C_BACKROUND);
- }
- }
-
- /*
- * Draw the lines first, since people like to draw lines
- * through beacons and exit points.
- */
- str[0] = C_LINE;
- for (i = 0; i < scp->num_lines; i++) {
- str[1] = ' ';
- draw_line(radar, scp->line[i].p1.x, scp->line[i].p1.y,
- scp->line[i].p2.x, scp->line[i].p2.y, str);
- }
-
- str[0] = C_TOPBOTTOM;
- str[1] = C_TOPBOTTOM;
- wmove(radar, 0, 0);
- for (i = 0; i < scp->width - 1; i++)
- waddstr(radar, str);
- waddch(radar, C_TOPBOTTOM);
-
- str[0] = C_TOPBOTTOM;
- str[1] = C_TOPBOTTOM;
- wmove(radar, scp->height - 1, 0);
- for (i = 0; i < scp->width - 1; i++)
- waddstr(radar, str);
- waddch(radar, C_TOPBOTTOM);
-
- for (i = 1; i < scp->height - 1; i++) {
- wmove(radar, i, 0);
- waddch(radar, C_LEFTRIGHT);
- wmove(radar, i, (scp->width - 1) * 2);
- waddch(radar, C_LEFTRIGHT);
- }
-
- str[0] = C_BEACON;
- for (i = 0; i < scp->num_beacons; i++) {
- str[1] = '0' + i;
- wmove(radar, scp->beacon[i].y, scp->beacon[i].x * 2);
- waddstr(radar, str);
- }
-
- for (i = 0; i < scp->num_exits; i++) {
- wmove(radar, scp->exit[i].y, scp->exit[i].x * 2);
- waddch(radar, '0' + i);
- }
-
- airstr = "^?>?v?<?";
- for (i = 0; i < scp->num_airports; i++) {
- str[0] = airstr[scp->airport[i].dir];
- str[1] = '0' + i;
- wmove(radar, scp->airport[i].y, scp->airport[i].x * 2);
- waddstr(radar, str);
- }
-
- overwrite(radar, cleanradar);
- wrefresh(radar);
- wrefresh(credit);
- fflush(stdout);
-}
-
-draw_line(w, x, y, lx, ly, s)
- WINDOW *w;
- int x, y, lx, ly;
- const char *s;
-{
- int dx, dy;
-
- dx = SGN(lx - x);
- dy = SGN(ly - y);
- for (;;) {
- wmove(w, y, x * 2);
- waddstr(w, s);
- if (x == lx && y == ly)
- break;
- x += dx;
- y += dy;
- }
-}
-
-ioclrtoeol(pos)
-{
- wmove(input, 0, pos);
- wclrtoeol(input);
- wrefresh(input);
- fflush(stdout);
-}
-
-iomove(pos)
-{
- wmove(input, 0, pos);
- wrefresh(input);
- fflush(stdout);
-}
-
-ioaddstr(pos, str)
- const char *str;
-{
- wmove(input, 0, pos);
- waddstr(input, str);
- wrefresh(input);
- fflush(stdout);
-}
-
-ioclrtobot()
-{
- wclrtobot(input);
- wrefresh(input);
- fflush(stdout);
-}
-
-ioerror(pos, len, str)
- const char *str;
-{
- int i;
-
- wmove(input, 1, pos);
- for (i = 0; i < len; i++)
- waddch(input, '^');
- wmove(input, 2, 0);
- waddstr(input, str);
- wrefresh(input);
- fflush(stdout);
-}
-
-quit()
-{
- int c, y, x;
-#ifdef BSD
- struct itimerval itv;
-#endif
-
- getyx(input, y, x);
- wmove(input, 2, 0);
- waddstr(input, "Really quit? (y/n) ");
- wclrtobot(input);
- wrefresh(input);
- fflush(stdout);
-
- c = getchar();
- if (c == EOF || c == 'y') {
- /* disable timer */
-#ifdef BSD
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- alarm(0);
-#endif
- fflush(stdout);
- clear();
- refresh();
- endwin();
- log_score(0);
- exit(0);
- }
- wmove(input, 2, 0);
- wclrtobot(input);
- wmove(input, y, x);
- wrefresh(input);
- fflush(stdout);
- return;
-}
-
-planewin()
-{
- PLANE *pp;
- char *command();
- int warning = 0;
-
-#ifdef BSD
- wclear(planes);
-#endif
-
- wmove(planes, 0,0);
-
-#ifdef SYSV
- wclrtobot(planes);
-#endif
- wprintw(planes, "Time: %-4d Safe: %d", clck, safe_planes);
- wmove(planes, 2, 0);
-
- waddstr(planes, "pl dt comm");
- for (pp = air.head; pp != NULL; pp = pp->next) {
- if (waddch(planes, '\n') == ERR) {
- warning++;
- break;
- }
- waddstr(planes, command(pp));
- }
- waddch(planes, '\n');
- for (pp = ground.head; pp != NULL; pp = pp->next) {
- if (waddch(planes, '\n') == ERR) {
- warning++;
- break;
- }
- waddstr(planes, command(pp));
- }
- if (warning) {
- wmove(planes, LINES - INPUT_LINES - 1, 0);
- waddstr(planes, "---- more ----");
- wclrtoeol(planes);
- }
- wrefresh(planes);
- fflush(stdout);
-}
-
-loser(p, s)
- const PLANE *p;
- const char *s;
-{
- int c;
-#ifdef BSD
- struct itimerval itv;
-#endif
-
- /* disable timer */
-#ifdef BSD
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- alarm(0);
-#endif
-
- wmove(input, 0, 0);
- wclrtobot(input);
- wprintw(input, "Plane '%c' %s\n\nHit space for top players list...",
- name(p), s);
- wrefresh(input);
- fflush(stdout);
- while ((c = getchar()) != EOF && c != ' ')
- ;
- clear(); /* move to top of screen */
- refresh();
- endwin();
- log_score(0);
- exit(0);
-}
-
-redraw()
-{
- clear();
- refresh();
-
- touchwin(radar);
- wrefresh(radar);
- touchwin(planes);
- wrefresh(planes);
- touchwin(credit);
- wrefresh(credit);
-
- /* refresh input last to get cursor in right place */
- touchwin(input);
- wrefresh(input);
- fflush(stdout);
-}
-
-
-done_screen()
-{
- clear();
- refresh();
- endwin(); /* clean up curses */
-}
diff --git a/games/atc/include.h b/games/atc/include.h
deleted file mode 100644
index bef7e05..0000000
--- a/games/atc/include.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)include.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <pwd.h>
-
-#ifdef BSD
-#include <sgtty.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#endif
-
-#ifdef SYSV
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/utsname.h>
-#endif
-
-#include <signal.h>
-#include <math.h>
-
-#include <curses.h>
-
-#ifdef SYSV
-#define index strchr
-#define rindex strrchr
-#define bcopy(a,b,c) memcpy((b), (a), (c))
-#define bzero(a,b) memset((a), '\0', (b))
-#define srandom srand
-#define random rand
-#define sgttyb termio
-#define sg_erase c_cc[2]
-#define sg_kill c_cc[3]
-#endif
-
-#include "def.h"
-#include "struct.h"
-#include "extern.h"
-#include "tunable.h"
diff --git a/games/atc/input.c b/games/atc/input.c
deleted file mode 100644
index b6f1889..0000000
--- a/games/atc/input.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdlib.h>
-#include <string.h>
-#include "include.h"
-#include "pathnames.h"
-
-#define MAXRULES 6
-#define MAXDEPTH 15
-
-#define RETTOKEN '\r'
-#ifdef SYSV
-#define CRTOKEN '\r'
-#endif
-#define REDRAWTOKEN '\014' /* CTRL(L) */
-#define SHELLTOKEN '!'
-#define HELPTOKEN '?'
-#define ALPHATOKEN 256
-#define NUMTOKEN 257
-
-typedef struct {
- int token;
- int to_state;
- const char *str;
- const char *(*func)();
-} RULE;
-
-typedef struct {
- int num_rules;
- RULE *rule;
-} STATE;
-
-typedef struct {
- char str[20];
- int state;
- int rule;
- int ch;
- int pos;
-} STACK;
-
-#define T_RULE stack[level].rule
-#define T_STATE stack[level].state
-#define T_STR stack[level].str
-#define T_POS stack[level].pos
-#define T_CH stack[level].ch
-
-#define NUMELS(a) (sizeof (a) / sizeof (*(a)))
-
-#define NUMSTATES NUMELS(st)
-
-const char *setplane(), *circle(), *left(), *right(), *Left(), *Right(),
- *beacon(), *ex_it(), *climb(), *descend(), *setalt(), *setrelalt(),
- *benum(), *to_dir(), *rel_dir(), *delayb(), *mark(), *unmark(),
- *airport(), *turn(), *ignore();
-
-RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane},
- { RETTOKEN, -1, "", NULL },
-#ifdef SYSV
- { CRTOKEN, -1, "", NULL },
-#endif
- { HELPTOKEN, 12, " [a-z]<ret>", NULL }},
- state1[] = { { 't', 2, " turn", turn },
- { 'a', 3, " altitude:", NULL },
- { 'c', 4, " circle", circle },
- { 'm', 7, " mark", mark },
- { 'u', 7, " unmark", unmark },
- { 'i', 7, " ignore", ignore },
- { HELPTOKEN, 12, " tacmui", NULL }},
- state2[] = { { 'l', 6, " left", left },
- { 'r', 6, " right", right },
- { 'L', 4, " left 90", Left },
- { 'R', 4, " right 90", Right },
- { 't', 11, " towards", NULL },
- { 'w', 4, " to 0", to_dir },
- { 'e', 4, " to 45", to_dir },
- { 'd', 4, " to 90", to_dir },
- { 'c', 4, " to 135", to_dir },
- { 'x', 4, " to 180", to_dir },
- { 'z', 4, " to 225", to_dir },
- { 'a', 4, " to 270", to_dir },
- { 'q', 4, " to 315", to_dir },
- { HELPTOKEN, 12, " lrLRt<dir>", NULL }},
- state3[] = { { '+', 10, " climb", climb },
- { 'c', 10, " climb", climb },
- { '-', 10, " descend", descend },
- { 'd', 10, " descend", descend },
- { NUMTOKEN, 7, " %c000 feet", setalt },
- { HELPTOKEN, 12, " +-cd[0-9]", NULL }},
- state4[] = { { '@', 9, " at", NULL },
- { 'a', 9, " at", NULL },
- { RETTOKEN, -1, "", NULL },
-#ifdef SYSV
- { CRTOKEN, -1, "", NULL },
-#endif
- { HELPTOKEN, 12, " @a<ret>", NULL }},
- state5[] = { { NUMTOKEN, 7, "%c", delayb },
- { HELPTOKEN, 12, " [0-9]", NULL }},
- state6[] = { { '@', 9, " at", NULL },
- { 'a', 9, " at", NULL },
- { 'w', 4, " 0", rel_dir },
- { 'e', 4, " 45", rel_dir },
- { 'd', 4, " 90", rel_dir },
- { 'c', 4, " 135", rel_dir },
- { 'x', 4, " 180", rel_dir },
- { 'z', 4, " 225", rel_dir },
- { 'a', 4, " 270", rel_dir },
- { 'q', 4, " 315", rel_dir },
- { RETTOKEN, -1, "", NULL },
-#ifdef SYSV
- { CRTOKEN, -1, "", NULL },
-#endif
- { HELPTOKEN, 12, " @a<dir><ret>",NULL }},
- state7[] = { { RETTOKEN, -1, "", NULL },
-#ifdef SYSV
- { CRTOKEN, -1, "", NULL },
-#endif
- { HELPTOKEN, 12, " <ret>", NULL }},
- state8[] = { { NUMTOKEN, 4, "%c", benum },
- { HELPTOKEN, 12, " [0-9]", NULL }},
- state9[] = { { 'b', 5, " beacon #", NULL },
- { '*', 5, " beacon #", NULL },
- { HELPTOKEN, 12, " b*", NULL }},
- state10[] = { { NUMTOKEN, 7, " %c000 ft", setrelalt},
- { HELPTOKEN, 12, " [0-9]", NULL }},
- state11[] = { { 'b', 8, " beacon #", beacon },
- { '*', 8, " beacon #", beacon },
- { 'e', 8, " exit #", ex_it },
- { 'a', 8, " airport #", airport },
- { HELPTOKEN, 12, " b*ea", NULL }},
- state12[] = { { -1, -1, "", NULL }};
-
-#define DEF_STATE(s) { NUMELS(s), (s) }
-
-STATE st[] = {
- DEF_STATE(state0), DEF_STATE(state1), DEF_STATE(state2),
- DEF_STATE(state3), DEF_STATE(state4), DEF_STATE(state5),
- DEF_STATE(state6), DEF_STATE(state7), DEF_STATE(state8),
- DEF_STATE(state9), DEF_STATE(state10), DEF_STATE(state11),
- DEF_STATE(state12)
-};
-
-PLANE p;
-STACK stack[MAXDEPTH];
-int level;
-int tval;
-int dest_type, dest_no, dir;
-
-pop()
-{
- if (level == 0)
- return (-1);
- level--;
-
- ioclrtoeol(T_POS);
-
- strcpy(T_STR, "");
- T_RULE = -1;
- T_CH = -1;
- return (0);
-}
-
-rezero()
-{
- iomove(0);
-
- level = 0;
- T_STATE = 0;
- T_RULE = -1;
- T_CH = -1;
- T_POS = 0;
- strcpy(T_STR, "");
-}
-
-push(ruleno, ch)
-{
- int newstate, newpos;
-
- (void)sprintf(T_STR, st[T_STATE].rule[ruleno].str, tval);
- T_RULE = ruleno;
- T_CH = ch;
- newstate = st[T_STATE].rule[ruleno].to_state;
- newpos = T_POS + strlen(T_STR);
-
- ioaddstr(T_POS, T_STR);
-
- if (level == 0)
- ioclrtobot();
- level++;
- T_STATE = newstate;
- T_POS = newpos;
- T_RULE = -1;
- strcpy(T_STR, "");
-}
-
-getcommand()
-{
- int c, i, done;
- const char *s, *(*func)();
- PLANE *pp;
-
- rezero();
-
- do {
- c = gettoken();
- if (c == tty_new.sg_erase) {
- if (pop() < 0)
- noise();
- } else if (c == tty_new.sg_kill) {
- while (pop() >= 0)
- ;
- } else {
- done = 0;
- for (i = 0; i < st[T_STATE].num_rules; i++) {
- if (st[T_STATE].rule[i].token == c ||
- st[T_STATE].rule[i].token == tval) {
- push(i, (c >= ALPHATOKEN) ? tval : c);
- done = 1;
- break;
- }
- }
- if (!done)
- noise();
- }
- } while (T_STATE != -1);
-
- if (level == 1)
- return (1); /* forced update */
-
- dest_type = T_NODEST;
-
- for (i = 0; i < level; i++) {
- func = st[stack[i].state].rule[stack[i].rule].func;
- if (func != NULL)
- if ((s = (*func)(stack[i].ch)) != NULL) {
- ioerror(stack[i].pos, strlen(stack[i].str), s);
- return (-1);
- }
- }
-
- pp = findplane(p.plane_no);
- if (pp->new_altitude != p.new_altitude)
- pp->new_altitude = p.new_altitude;
- else if (pp->status != p.status)
- pp->status = p.status;
- else {
- pp->new_dir = p.new_dir;
- pp->delayd = p.delayd;
- pp->delayd_no = p.delayd_no;
- }
- return (0);
-}
-
-noise()
-{
- putchar('\07');
- fflush(stdout);
-}
-
-gettoken()
-{
- while ((tval = getAChar()) == REDRAWTOKEN || tval == SHELLTOKEN)
- {
- if (tval == SHELLTOKEN)
- {
-#ifdef BSD
- struct itimerval itv;
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- int aval;
- aval = alarm(0);
-#endif
- if (fork() == 0) /* child */
- {
- char *shell, *base;
-
- /* revoke */
- setgid(getgid());
- done_screen();
-
- /* run user's favorite shell */
- if ((shell = getenv("SHELL")) != NULL)
- {
- base = strrchr(shell, '/');
- if (base == NULL)
- base = shell;
- else
- base++;
- execl(shell, base, (char *)0);
- }
- else
- execl(_PATH_BSHELL, "sh", (char *)0);
-
- exit(0); /* oops */
- }
-
- wait(0);
-#ifdef BSD
- ioctl(fileno(stdin), TIOCSETP, &tty_new);
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 1;
- itv.it_interval.tv_sec = sp->update_secs;
- itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- ioctl(fileno(stdin), TCSETAW, &tty_new);
- alarm(aval);
-#endif
- }
- redraw();
- }
-
- if (isdigit(tval))
- return (NUMTOKEN);
- else if (isalpha(tval))
- return (ALPHATOKEN);
- else
- return (tval);
-}
-
-const char *
-setplane(c)
-{
- PLANE *pp;
-
- pp = findplane(number(c));
- if (pp == NULL)
- return ("Unknown Plane");
- bcopy(pp, &p, sizeof (p));
- p.delayd = 0;
- return (NULL);
-}
-
-const char *
-turn(c)
-{
- if (p.altitude == 0)
- return ("Planes at airports may not change direction");
- return (NULL);
-}
-
-const char *
-circle(c)
-{
- if (p.altitude == 0)
- return ("Planes cannot circle on the ground");
- p.new_dir = MAXDIR;
- return (NULL);
-}
-
-const char *
-left(c)
-{
- dir = D_LEFT;
- p.new_dir = p.dir - 1;
- if (p.new_dir < 0)
- p.new_dir += MAXDIR;
- return (NULL);
-}
-
-const char *
-right(c)
-{
- dir = D_RIGHT;
- p.new_dir = p.dir + 1;
- if (p.new_dir >= MAXDIR)
- p.new_dir -= MAXDIR;
- return (NULL);
-}
-
-const char *
-Left(c)
-{
- p.new_dir = p.dir - 2;
- if (p.new_dir < 0)
- p.new_dir += MAXDIR;
- return (NULL);
-}
-
-const char *
-Right(c)
-{
- p.new_dir = p.dir + 2;
- if (p.new_dir >= MAXDIR)
- p.new_dir -= MAXDIR;
- return (NULL);
-}
-
-const char *
-delayb(c)
-{
- int xdiff, ydiff;
-
- c -= '0';
-
- if (c >= sp->num_beacons)
- return ("Unknown beacon");
- xdiff = sp->beacon[c].x - p.xpos;
- xdiff = SGN(xdiff);
- ydiff = sp->beacon[c].y - p.ypos;
- ydiff = SGN(ydiff);
- if (xdiff != displacement[p.dir].dx || ydiff != displacement[p.dir].dy)
- return ("Beacon is not in flight path");
- p.delayd = 1;
- p.delayd_no = c;
-
- if (dest_type != T_NODEST) {
- switch (dest_type) {
- case T_BEACON:
- xdiff = sp->beacon[dest_no].x - sp->beacon[c].x;
- ydiff = sp->beacon[dest_no].y - sp->beacon[c].y;
- break;
- case T_EXIT:
- xdiff = sp->exit[dest_no].x - sp->beacon[c].x;
- ydiff = sp->exit[dest_no].y - sp->beacon[c].y;
- break;
- case T_AIRPORT:
- xdiff = sp->airport[dest_no].x - sp->beacon[c].x;
- ydiff = sp->airport[dest_no].y - sp->beacon[c].y;
- break;
- default:
- return ("Bad case in delayb! Get help!");
- break;
- }
- if (xdiff == 0 && ydiff == 0)
- return ("Would already be there");
- p.new_dir = DIR_FROM_DXDY(xdiff, ydiff);
- if (p.new_dir == p.dir)
- return ("Already going in that direction");
- }
- return (NULL);
-}
-
-const char *
-beacon(c)
-{
- dest_type = T_BEACON;
- return (NULL);
-}
-
-const char *
-ex_it(c)
-{
- dest_type = T_EXIT;
- return (NULL);
-}
-
-const char *
-airport(c)
-{
- dest_type = T_AIRPORT;
- return (NULL);
-}
-
-const char *
-climb(c)
-{
- dir = D_UP;
- return (NULL);
-}
-
-const char *
-descend(c)
-{
- dir = D_DOWN;
- return (NULL);
-}
-
-const char *
-setalt(c)
-{
- if ((p.altitude == c - '0') && (p.new_altitude == p.altitude))
- return ("Already at that altitude");
- p.new_altitude = c - '0';
- return (NULL);
-}
-
-const char *
-setrelalt(c)
-{
- if (c == 0)
- return ("altitude not changed");
-
- switch (dir) {
- case D_UP:
- p.new_altitude = p.altitude + c - '0';
- break;
- case D_DOWN:
- p.new_altitude = p.altitude - (c - '0');
- break;
- default:
- return ("Unknown case in setrelalt! Get help!");
- break;
- }
- if (p.new_altitude < 0)
- return ("Altitude would be too low");
- else if (p.new_altitude > 9)
- return ("Altitude would be too high");
- return (NULL);
-}
-
-const char *
-benum(c)
-{
- dest_no = c -= '0';
-
- switch (dest_type) {
- case T_BEACON:
- if (c >= sp->num_beacons)
- return ("Unknown beacon");
- p.new_dir = DIR_FROM_DXDY(sp->beacon[c].x - p.xpos,
- sp->beacon[c].y - p.ypos);
- break;
- case T_EXIT:
- if (c >= sp->num_exits)
- return ("Unknown exit");
- p.new_dir = DIR_FROM_DXDY(sp->exit[c].x - p.xpos,
- sp->exit[c].y - p.ypos);
- break;
- case T_AIRPORT:
- if (c >= sp->num_airports)
- return ("Unknown airport");
- p.new_dir = DIR_FROM_DXDY(sp->airport[c].x - p.xpos,
- sp->airport[c].y - p.ypos);
- break;
- default:
- return ("Unknown case in benum! Get help!");
- break;
- }
- return (NULL);
-}
-
-const char *
-to_dir(c)
-{
- p.new_dir = dir_no(c);
- return (NULL);
-}
-
-const char *
-rel_dir(c)
-{
- int angle;
-
- angle = dir_no(c);
- switch (dir) {
- case D_LEFT:
- p.new_dir = p.dir - angle;
- if (p.new_dir < 0)
- p.new_dir += MAXDIR;
- break;
- case D_RIGHT:
- p.new_dir = p.dir + angle;
- if (p.new_dir >= MAXDIR)
- p.new_dir -= MAXDIR;
- break;
- default:
- return ("Bizarre direction in rel_dir! Get help!");
- break;
- }
- return (NULL);
-}
-
-const char *
-mark(c)
-{
- if (p.altitude == 0)
- return ("Cannot mark planes on the ground");
- if (p.status == S_MARKED)
- return ("Already marked");
- p.status = S_MARKED;
- return (NULL);
-}
-
-const char *
-unmark(c)
-{
- if (p.altitude == 0)
- return ("Cannot unmark planes on the ground");
- if (p.status == S_UNMARKED)
- return ("Already unmarked");
- p.status = S_UNMARKED;
- return (NULL);
-}
-
-const char *
-ignore(c)
-{
- if (p.altitude == 0)
- return ("Cannot ignore planes on the ground");
- if (p.status == S_IGNORED)
- return ("Already ignored");
- p.status = S_IGNORED;
- return (NULL);
-}
-
-dir_no(ch)
- char ch;
-{
- int dir;
-
- switch (ch) {
- case 'w': dir = 0; break;
- case 'e': dir = 1; break;
- case 'd': dir = 2; break;
- case 'c': dir = 3; break;
- case 'x': dir = 4; break;
- case 'z': dir = 5; break;
- case 'a': dir = 6; break;
- case 'q': dir = 7; break;
- default:
- fprintf(stderr, "bad character in dir_no\n");
- break;
- }
- return (dir);
-}
diff --git a/games/atc/lex.l b/games/atc/lex.l
deleted file mode 100644
index 0092a29..0000000
--- a/games/atc/lex.l
+++ /dev/null
@@ -1,69 +0,0 @@
-%{
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 5/31/93";
-#endif /* not lint */
-
-#include "y.tab.h"
-extern int line;
-
-%}
-%%
-[0-9]+ { yylval.ival = atoi(yytext); return(ConstOp); }
-height { return(HeightOp); }
-width { return(WidthOp); }
-newplane { return(NewplaneOp); }
-update { return(UpdateOp); }
-airport { return(AirportOp); }
-line { return(LineOp); }
-exit { return(ExitOp); }
-beacon { return(BeaconOp); }
-[wedcxzaq] { yylval.cval = *yytext; return (DirOp); }
-[ \t]+ { }
-#[^\n]*\n { line++; }
-\n { line++; }
-. { return *yytext; }
diff --git a/games/atc/list.c b/games/atc/list.c
deleted file mode 100644
index af5788f..0000000
--- a/games/atc/list.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)list.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdlib.h>
-#include "include.h"
-
-PLANE *
-newplane()
-{
- return ((PLANE *) calloc(1, sizeof (PLANE)));
-}
-
-append(l, p)
- LIST *l;
- PLANE *p;
-{
- PLANE *q = NULL, *r = NULL;
-
- if (l->head == NULL) {
- p->next = p->prev = NULL;
- l->head = l->tail = p;
- } else {
- q = l -> head;
-
- while (q != NULL && q->plane_no < p->plane_no) {
- r = q;
- q = q -> next;
- }
-
- if (q) {
- if (r) {
- p->prev = r;
- r->next = p;
- p->next = q;
- q->prev = p;
- } else {
- p->next = q;
- p->prev = NULL;
- q->prev = p;
- l->head = p;
- }
- } else {
- l->tail->next = p;
- p->next = NULL;
- p->prev = l->tail;
- l->tail = p;
- }
- }
-}
-
-delete(l, p)
- LIST *l;
- PLANE *p;
-{
- if (l->head == NULL)
- loser(p, "deleted a non-existant plane! Get help!");
-
- if (l->head == p && l->tail == p)
- l->head = l->tail = NULL;
- else if (l->head == p) {
- l->head = p->next;
- l->head->prev = NULL;
- } else if (l->tail == p) {
- l->tail = p->prev;
- l->tail->next = NULL;
- } else {
- p->prev->next = p->next;
- p->next->prev = p->prev;
- }
-}
diff --git a/games/atc/log.c b/games/atc/log.c
deleted file mode 100644
index 471b9ec..0000000
--- a/games/atc/log.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "include.h"
-#include "pathnames.h"
-
-#ifdef SYSV
-#include <sys/utsname.h>
-#endif
-
-static FILE *score_fp;
-
-int
-compar(va, vb)
- const void *va, *vb;
-{
- const SCORE *a, *b;
-
- a = (const SCORE *)va;
- b = (const SCORE *)vb;
-
- if (b->planes == a->planes)
- return (b->time - a->time);
- else
- return (b->planes - a->planes);
-}
-
-#define SECAMIN 60
-#define MINAHOUR 60
-#define HOURADAY 24
-#define SECAHOUR (SECAMIN * MINAHOUR)
-#define SECADAY (SECAHOUR * HOURADAY)
-#define DAY(t) ((t) / SECADAY)
-#define HOUR(t) (((t) % SECADAY) / SECAHOUR)
-#define MIN(t) (((t) % SECAHOUR) / SECAMIN)
-#define SEC(t) ((t) % SECAMIN)
-
-const char *
-timestr(t)
-{
- static char s[80];
-
- if (DAY(t) > 0)
- (void)sprintf(s, "%dd+%02dhrs", DAY(t), HOUR(t));
- else if (HOUR(t) > 0)
- (void)sprintf(s, "%d:%02d:%02d", HOUR(t), MIN(t), SEC(t));
- else if (MIN(t) > 0)
- (void)sprintf(s, "%d:%02d", MIN(t), SEC(t));
- else if (SEC(t) > 0)
- (void)sprintf(s, ":%02d", SEC(t));
- else
- *s = '\0';
-
- return (s);
-}
-
-void
-open_score_file()
-{
- mode_t old_mask;
- int score_fd;
- int flags;
-
- old_mask = umask(0);
- score_fd = open(_PATH_SCORE, O_CREAT|O_RDWR, 0664);
- umask(old_mask);
- if (score_fd < 0) {
- warn("open %s", _PATH_SCORE);
- return;
- }
- /* Set the close-on-exec flag. If this fails for any reason, quit
- * rather than leave the score file open to tampering. */
- flags = fcntl(score_fd, F_GETFD);
- if (flags < 0)
- err(1, "fcntl F_GETFD");
- flags |= FD_CLOEXEC;
- if (fcntl(score_fd, F_SETFD, flags) == -1)
- err(1, "fcntl F_SETFD");
- /*
- * This is done to take advantage of stdio, while still
- * allowing a O_CREAT during the open(2) of the log file.
- */
- score_fp = fdopen(score_fd, "r+");
- if (score_fp == NULL) {
- warn("fdopen %s", _PATH_SCORE);
- return;
- }
-}
-
-int
-log_score(list_em)
- int list_em;
-{
- int i, num_scores = 0, good, changed = 0, found = 0;
- struct passwd *pw;
- char *cp;
- SCORE score[100], thisscore;
-#ifdef SYSV
- struct utsname name;
-#endif
-
- if (score_fp == NULL) {
- warnx("no score file available");
- return (-1);
- }
-
-#ifdef BSD
- if (flock(fileno(score_fp), LOCK_EX) < 0)
-#endif
-#ifdef SYSV
- while (lockf(fileno(score_fp), F_LOCK, 1) < 0)
-#endif
- {
- warn("flock %s", _PATH_SCORE);
- return (-1);
- }
- for (;;) {
- good = fscanf(score_fp, SCORE_SCANF_FMT,
- score[num_scores].name,
- score[num_scores].host,
- score[num_scores].game,
- &score[num_scores].planes,
- &score[num_scores].time,
- &score[num_scores].real_time);
- if (good != 6 || ++num_scores >= NUM_SCORES)
- break;
- }
- if (!test_mode && !list_em) {
- if ((pw = (struct passwd *) getpwuid(getuid())) == NULL) {
- fprintf(stderr,
- "getpwuid failed for uid %d. Who are you?\n",
- (int)getuid());
- return (-1);
- }
- strcpy(thisscore.name, pw->pw_name);
-#ifdef BSD
- if (gethostname(thisscore.host, sizeof (thisscore.host)) < 0) {
- perror("gethostname");
- return (-1);
- }
-#endif
-#ifdef SYSV
- uname(&name);
- strcpy(thisscore.host, name.nodename);
-#endif
-
- cp = rindex(file, '/');
- if (cp == NULL) {
- fprintf(stderr, "log: where's the '/' in %s?\n", file);
- return (-1);
- }
- cp++;
- strcpy(thisscore.game, cp);
-
- thisscore.time = clck;
- thisscore.planes = safe_planes;
- thisscore.real_time = time(0) - start_time;
-
- for (i = 0; i < num_scores; i++) {
- if (strcmp(thisscore.name, score[i].name) == 0 &&
- strcmp(thisscore.host, score[i].host) == 0 &&
- strcmp(thisscore.game, score[i].game) == 0) {
- if (thisscore.time > score[i].time) {
- score[i].time = thisscore.time;
- score[i].planes = thisscore.planes;
- score[i].real_time =
- thisscore.real_time;
- changed++;
- }
- found++;
- break;
- }
- }
- if (!found) {
- for (i = 0; i < num_scores; i++) {
- if (thisscore.time > score[i].time) {
- if (num_scores < NUM_SCORES)
- num_scores++;
- bcopy(&score[i],
- &score[num_scores - 1],
- sizeof (score[i]));
- bcopy(&thisscore, &score[i],
- sizeof (score[i]));
- changed++;
- break;
- }
- }
- }
- if (!found && !changed && num_scores < NUM_SCORES) {
- bcopy(&thisscore, &score[num_scores],
- sizeof (score[num_scores]));
- num_scores++;
- changed++;
- }
-
- if (changed) {
- if (found)
- puts("You beat your previous score!");
- else
- puts("You made the top players list!");
- qsort(score, num_scores, sizeof (*score), compar);
- rewind(score_fp);
- for (i = 0; i < num_scores; i++)
- fprintf(score_fp, "%s %s %s %d %d %d\n",
- score[i].name, score[i].host,
- score[i].game, score[i].planes,
- score[i].time, score[i].real_time);
- fflush(score_fp);
- if (ferror(score_fp))
- warn("error writing %s", _PATH_SCORE);
- /* It is just possible that updating an entry could
- * have reduced the length of the file, so we
- * truncate it. The lseek is required for stream/fd
- * synchronisation by POSIX.1. */
- lseek(fileno(score_fp), 0, SEEK_END);
- ftruncate(fileno(score_fp), ftell(score_fp));
- } else {
- if (found)
- puts("You didn't beat your previous score.");
- else
- puts("You didn't make the top players list.");
- }
- putchar('\n');
- }
-#ifdef BSD
- flock(fileno(score_fp), LOCK_UN);
-#endif
-#ifdef SYSV
- /* lock will evaporate upon close */
-#endif
- fclose(score_fp);
- printf("%2s: %-8s %-8s %-18s %4s %9s %4s\n", "#", "name", "host",
- "game", "time", "real time", "planes safe");
- puts("-------------------------------------------------------------------------------");
- for (i = 0; i < num_scores; i++) {
- cp = index(score[i].host, '.');
- if (cp != NULL)
- *cp = '\0';
- printf("%2d: %-8s %-8s %-18s %4d %9s %4d\n", i + 1,
- score[i].name, score[i].host, score[i].game,
- score[i].time, timestr(score[i].real_time),
- score[i].planes);
- }
- putchar('\n');
- return (0);
-}
diff --git a/games/atc/main.c b/games/atc/main.c
deleted file mode 100644
index 6a10ca6..0000000
--- a/games/atc/main.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "include.h"
-#include "pathnames.h"
-
-main(ac, av)
- int ac;
- char *av[];
-{
- int seed = 0;
- int f_usage = 0, f_list = 0, f_showscore = 0;
- int f_printpath = 0;
- const char *file = NULL;
- char *name, *ptr;
-#ifdef BSD
- struct itimerval itv;
-#endif
- extern const char *default_game(), *okay_game();
- extern void log_score(), quit(), update();
-
- /* Open the score file then revoke setgid privileges */
- open_score_file();
- setregid(getgid(), getgid());
-
- start_time = time(0);
-
- name = *av++;
- while (*av) {
-#ifndef SAVEDASH
- if (**av == '-')
- *++*av;
- else
- break;
-#endif
- ptr = *av++;
- while (*ptr) {
- switch (*ptr) {
- case '?':
- case 'u':
- f_usage++;
- break;
- case 'l':
- f_list++;
- break;
- case 's':
- case 't':
- f_showscore++;
- break;
- case 'p':
- f_printpath++;
- break;
- case 'r':
- srandom(atoi(*av));
- seed = 1;
- av++;
- break;
- case 'f':
- case 'g':
- file = *av;
- av++;
- break;
- default:
- fprintf(stderr, "Unknown option '%c'\n", *ptr);
- f_usage++;
- break;
- }
- ptr++;
- }
- }
- if (!seed)
- srandomdev();
-
- if (f_usage)
- fprintf(stderr,
- "usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n",
- name);
- if (f_showscore)
- log_score(1);
- if (f_list)
- list_games();
- if (f_printpath) {
- char buf[100];
-
- strcpy(buf, _PATH_GAMES);
- buf[strlen(buf) - 1] = '\0';
- puts(buf);
- }
-
- if (f_usage || f_showscore || f_list || f_printpath)
- exit(0);
-
- if (file == NULL)
- file = default_game();
- else
- file = okay_game(file);
-
- if (file == NULL || read_file(file) < 0)
- exit(1);
-
- init_gr();
- setup_screen(sp);
-
- addplane();
-
- signal(SIGINT, quit);
- signal(SIGQUIT, quit);
-#ifdef BSD
- signal(SIGTSTP, SIG_IGN);
- signal(SIGSTOP, SIG_IGN);
-#endif
- signal(SIGHUP, log_score);
- signal(SIGTERM, log_score);
-
-#ifdef BSD
- ioctl(fileno(stdin), TIOCGETP, &tty_start);
- bcopy(&tty_start, &tty_new, sizeof(tty_new));
- tty_new.sg_flags |= CBREAK;
- tty_new.sg_flags &= ~ECHO;
- ioctl(fileno(stdin), TIOCSETP, &tty_new);
-#endif
-
-#ifdef SYSV
- ioctl(fileno(stdin), TCGETA, &tty_start);
- bcopy(&tty_start, &tty_new, sizeof(tty_new));
- tty_new.c_lflag &= ~ICANON;
- tty_new.c_lflag &= ~ECHO;
- tty_new.c_cc[VMIN] = 1;
- tty_new.c_cc[VTIME] = 0;
- ioctl(fileno(stdin), TCSETAW, &tty_new);
-#endif
-
- signal(SIGALRM, update);
-
-#ifdef BSD
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 1;
- itv.it_interval.tv_sec = sp->update_secs;
- itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- alarm(sp->update_secs);
-#endif
-
- for (;;) {
- if (getcommand() != 1)
- planewin();
- else {
-#ifdef BSD
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- alarm(0);
-#endif
-
- update();
-
-#ifdef BSD
- itv.it_value.tv_sec = sp->update_secs;
- itv.it_value.tv_usec = 0;
- itv.it_interval.tv_sec = sp->update_secs;
- itv.it_interval.tv_usec = 0;
- setitimer(ITIMER_REAL, &itv, NULL);
-#endif
-#ifdef SYSV
- alarm(sp->update_secs);
-#endif
- }
- }
-}
-
-read_file(s)
- const char *s;
-{
- extern FILE *yyin;
- int retval;
-
- file = s;
- yyin = fopen(s, "r");
- if (yyin == NULL) {
- perror(s);
- return (-1);
- }
- retval = yyparse();
- fclose(yyin);
-
- if (retval != 0)
- return (-1);
- else
- return (0);
-}
-
-const char *
-default_game()
-{
- FILE *fp;
- static char file[256];
- char line[256], games[256];
-
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
-
- if ((fp = fopen(games, "r")) == NULL) {
- perror(games);
- return (NULL);
- }
- if (fgets(line, sizeof(line), fp) == NULL) {
- fprintf(stderr, "%s: no default game available\n", games);
- return (NULL);
- }
- fclose(fp);
- line[strlen(line) - 1] = '\0';
- strcpy(file, _PATH_GAMES);
- strcat(file, line);
- return (file);
-}
-
-const char *
-okay_game(s)
- char *s;
-{
- FILE *fp;
- static char file[256];
- const char *ret = NULL;
- char line[256], games[256];
-
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
-
- if ((fp = fopen(games, "r")) == NULL) {
- perror(games);
- return (NULL);
- }
- while (fgets(line, sizeof(line), fp) != NULL) {
- line[strlen(line) - 1] = '\0';
- if (strcmp(s, line) == 0) {
- strcpy(file, _PATH_GAMES);
- strcat(file, line);
- ret = file;
- break;
- }
- }
- fclose(fp);
- if (ret == NULL) {
- test_mode = 1;
- ret = s;
- fprintf(stderr, "%s: %s: game not found\n", games, s);
- fprintf(stderr, "Your score will not be logged.\n");
- sleep(2); /* give the guy time to read it */
- }
- return (ret);
-}
-
-list_games()
-{
- FILE *fp;
- char line[256], games[256];
- int num_games = 0;
-
- strcpy(games, _PATH_GAMES);
- strcat(games, GAMES);
-
- if ((fp = fopen(games, "r")) == NULL) {
- perror(games);
- return (-1);
- }
- puts("available games:");
- while (fgets(line, sizeof(line), fp) != NULL) {
- printf(" %s", line);
- num_games++;
- }
- fclose(fp);
- if (num_games == 0) {
- fprintf(stderr, "%s: no games available\n", games);
- return (-1);
- }
- return (0);
-}
diff --git a/games/atc/pathnames.h b/games/atc/pathnames.h
deleted file mode 100644
index e2ee4f8..0000000
--- a/games/atc/pathnames.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#include <paths.h>
-
-#define _PATH_GAMES "/usr/share/games/atc/"
-#define _PATH_SCORE "/var/games/atc_score"
diff --git a/games/atc/struct.h b/games/atc/struct.h
deleted file mode 100644
index 6034557..0000000
--- a/games/atc/struct.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)struct.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-typedef struct {
- int x, y;
- int dir; /* used only sometimes */
-} SCREEN_POS;
-
-typedef struct {
- SCREEN_POS p1, p2;
-} LINE;
-
-typedef SCREEN_POS EXIT;
-typedef SCREEN_POS BEACON;
-typedef SCREEN_POS AIRPORT;
-
-typedef struct {
- int width, height;
- int update_secs;
- int newplane_time;
- int num_exits;
- int num_lines;
- int num_beacons;
- int num_airports;
- EXIT *exit;
- LINE *line;
- BEACON *beacon;
- AIRPORT *airport;
-} C_SCREEN;
-
-typedef struct plane {
- struct plane *next, *prev;
- int status;
- int plane_no;
- int plane_type;
- int orig_no;
- int orig_type;
- int dest_no;
- int dest_type;
- int altitude;
- int new_altitude;
- int dir;
- int new_dir;
- int fuel;
- int xpos;
- int ypos;
- int delayd;
- int delayd_no;
-} PLANE;
-
-typedef struct {
- PLANE *head, *tail;
-} LIST;
-
-typedef struct {
- char name[10];
- char host[256];
- char game[256];
- int planes;
- int time;
- int real_time;
-} SCORE;
-
-#define SCORE_SCANF_FMT "%9s %255s %255s %d %d %d"
-
-typedef struct displacement {
- int dx;
- int dy;
-} DISPLACEMENT;
diff --git a/games/atc/tunable.c b/games/atc/tunable.c
deleted file mode 100644
index 7c71059..0000000
--- a/games/atc/tunable.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)tunable.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * NUM_SCORES - Number of scores that are kept track of.
- * Keep this greater than 0, but less than 100.
- * 4 lines are printed above the score, one below + your prompt, so
- * to prevent scrolling: 6 + NUM_SCORES <= 24 (lines on an average terminal).
- */
-int NUM_SCORES = 18;
diff --git a/games/atc/tunable.h b/games/atc/tunable.h
deleted file mode 100644
index d2cb932..0000000
--- a/games/atc/tunable.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tunable.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-extern int NUM_SCORES;
diff --git a/games/atc/update.c b/games/atc/update.c
deleted file mode 100644
index f7d898f..0000000
--- a/games/atc/update.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ed James.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
- *
- * Copy permission is hereby granted provided that this notice is
- * retained on all partial or complete copies.
- *
- * For more info on this and all of my stuff, mail edjames@berkeley.edu.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "include.h"
-
-char name();
-
-update()
-{
- int i, dir_diff, mask, unclean;
- PLANE *pp, *p1, *p2, *p;
-
-#ifdef BSD
- mask = sigblock(sigmask(SIGINT));
-#endif
-#ifdef SYSV
- alarm(0);
- signal(SIGALRM, update);
-#endif
-
- clck++;
-
- erase_all();
-
- /* put some planes in the air */
- do {
- unclean = 0;
- for (pp = ground.head; pp != NULL; pp = pp->next) {
- if (pp->new_altitude > 0) {
- delete(&ground, pp);
- append(&air, pp);
- unclean = 1;
- break;
- }
- }
- } while (unclean);
-
- /* do altitude change and basic movement */
- for (pp = air.head; pp != NULL; pp = pp->next) {
- /* type 0 only move every other turn */
- if (pp->plane_type == 0 && clck & 1)
- continue;
-
- pp->fuel--;
- if (pp->fuel < 0)
- loser(pp, "ran out of fuel.");
-
- pp->altitude += SGN(pp->new_altitude - pp->altitude);
-
- if (!pp->delayd) {
- dir_diff = pp->new_dir - pp->dir;
- /*
- * Allow for circle commands
- */
- if (pp->new_dir >= 0 && pp->new_dir < MAXDIR) {
- if (dir_diff > MAXDIR/2)
- dir_diff -= MAXDIR;
- else if (dir_diff < -(MAXDIR/2))
- dir_diff += MAXDIR;
- }
- if (dir_diff > 2)
- dir_diff = 2;
- else if (dir_diff < -2)
- dir_diff = -2;
- pp->dir += dir_diff;
- if (pp->dir >= MAXDIR)
- pp->dir -= MAXDIR;
- else if (pp->dir < 0)
- pp->dir += MAXDIR;
- }
- pp->xpos += displacement[pp->dir].dx;
- pp->ypos += displacement[pp->dir].dy;
-
- if (pp->delayd && pp->xpos == sp->beacon[pp->delayd_no].x &&
- pp->ypos == sp->beacon[pp->delayd_no].y) {
- pp->delayd = 0;
- if (pp->status == S_UNMARKED)
- pp->status = S_MARKED;
- }
-
- switch (pp->dest_type) {
- case T_AIRPORT:
- if (pp->xpos == sp->airport[pp->dest_no].x &&
- pp->ypos == sp->airport[pp->dest_no].y &&
- pp->altitude == 0) {
- if (pp->dir != sp->airport[pp->dest_no].dir)
- loser(pp, "landed in the wrong direction.");
- else {
- pp->status = S_GONE;
- continue;
- }
- }
- break;
- case T_EXIT:
- if (pp->xpos == sp->exit[pp->dest_no].x &&
- pp->ypos == sp->exit[pp->dest_no].y) {
- if (pp->altitude != 9)
- loser(pp, "exited at the wrong altitude.");
- else {
- pp->status = S_GONE;
- continue;
- }
- }
- break;
- default:
- loser(pp, "has a bizarre destination, get help!");
- }
- if (pp->altitude > 9)
- /* "this is impossible" */
- loser(pp, "exceded flight ceiling.");
- if (pp->altitude <= 0) {
- for (i = 0; i < sp->num_airports; i++)
- if (pp->xpos == sp->airport[i].x &&
- pp->ypos == sp->airport[i].y) {
- if (pp->dest_type == T_AIRPORT)
- loser(pp,
- "landed at the wrong airport.");
- else
- loser(pp,
- "landed instead of exited.");
- }
- loser(pp, "crashed on the ground.");
- }
- if (pp->xpos < 1 || pp->xpos >= sp->width - 1 ||
- pp->ypos < 1 || pp->ypos >= sp->height - 1) {
- for (i = 0; i < sp->num_exits; i++)
- if (pp->xpos == sp->exit[i].x &&
- pp->ypos == sp->exit[i].y) {
- if (pp->dest_type == T_EXIT)
- loser(pp,
- "exited via the wrong exit.");
- else
- loser(pp,
- "exited instead of landed.");
- }
- loser(pp, "illegally left the flight arena.");
- }
- }
-
- /*
- * Traverse the list once, deleting the planes that are gone.
- */
- for (pp = air.head; pp != NULL; pp = p2) {
- p2 = pp->next;
- if (pp->status == S_GONE) {
- safe_planes++;
- delete(&air, pp);
- }
- }
-
- draw_all();
-
- for (p1 = air.head; p1 != NULL; p1 = p1->next)
- for (p2 = p1->next; p2 != NULL; p2 = p2->next)
- if (too_close(p1, p2, 1)) {
- static char buf[80];
-
- (void)sprintf(buf, "collided with plane '%c'.",
- name(p2));
- loser(p1, buf);
- }
- /*
- * Check every other update. Actually, only add on even updates.
- * Otherwise, prop jobs show up *on* entrance. Remember that
- * we don't update props on odd updates.
- */
- if ((random() % sp->newplane_time) == 0)
- addplane();
-
-#ifdef BSD
- sigsetmask(mask);
-#endif
-#ifdef SYSV
- alarm(sp->update_secs);
-#endif
-}
-
-const char *
-command(pp)
- const PLANE *pp;
-{
- static char buf[50], *bp, *comm_start;
- char *index();
-
- buf[0] = '\0';
- bp = buf;
- (void)sprintf(bp, "%c%d%c%c%d: ", name(pp), pp->altitude,
- (pp->fuel < LOWFUEL) ? '*' : ' ',
- (pp->dest_type == T_AIRPORT) ? 'A' : 'E', pp->dest_no);
-
- comm_start = bp = index(buf, '\0');
- if (pp->altitude == 0)
- (void)sprintf(bp, "Holding @ A%d", pp->orig_no);
- else if (pp->new_dir >= MAXDIR || pp->new_dir < 0)
- strcpy(bp, "Circle");
- else if (pp->new_dir != pp->dir)
- (void)sprintf(bp, "%d", dir_deg(pp->new_dir));
-
- bp = index(buf, '\0');
- if (pp->delayd)
- (void)sprintf(bp, " @ B%d", pp->delayd_no);
-
- bp = index(buf, '\0');
- if (*comm_start == '\0' &&
- (pp->status == S_UNMARKED || pp->status == S_IGNORED))
- strcpy(bp, "---------");
- return (buf);
-}
-
-/* char */
-char
-name(p)
- const PLANE *p;
-{
- if (p->plane_type == 0)
- return ('A' + p->plane_no);
- else
- return ('a' + p->plane_no);
-}
-
-number(l)
-{
- if (l < 'a' && l > 'z' && l < 'A' && l > 'Z')
- return (-1);
- else if (l >= 'a' && l <= 'z')
- return (l - 'a');
- else
- return (l - 'A');
-}
-
-next_plane()
-{
- static int last_plane = -1;
- PLANE *pp;
- int found, start_plane = last_plane;
-
- do {
- found = 0;
- last_plane++;
- if (last_plane >= 26)
- last_plane = 0;
- for (pp = air.head; pp != NULL; pp = pp->next)
- if (pp->plane_no == last_plane) {
- found++;
- break;
- }
- if (!found)
- for (pp = ground.head; pp != NULL; pp = pp->next)
- if (pp->plane_no == last_plane) {
- found++;
- break;
- }
- } while (found && last_plane != start_plane);
- if (last_plane == start_plane)
- return (-1);
- return (last_plane);
-}
-
-addplane()
-{
- PLANE p, *pp, *p1;
- int i, num_starts, close, rnd, rnd2, pnum;
-
- bzero(&p, sizeof (p));
-
- p.status = S_MARKED;
- p.plane_type = random() % 2;
-
- num_starts = sp->num_exits + sp->num_airports;
- rnd = random() % num_starts;
-
- if (rnd < sp->num_exits) {
- p.dest_type = T_EXIT;
- p.dest_no = rnd;
- } else {
- p.dest_type = T_AIRPORT;
- p.dest_no = rnd - sp->num_exits;
- }
-
- /* loop until we get a plane not near another */
- for (i = 0; i < num_starts; i++) {
- /* loop till we get a different start point */
- while ((rnd2 = random() % num_starts) == rnd)
- ;
- if (rnd2 < sp->num_exits) {
- p.orig_type = T_EXIT;
- p.orig_no = rnd2;
- p.xpos = sp->exit[rnd2].x;
- p.ypos = sp->exit[rnd2].y;
- p.new_dir = p.dir = sp->exit[rnd2].dir;
- p.altitude = p.new_altitude = 7;
- close = 0;
- for (p1 = air.head; p1 != NULL; p1 = p1->next)
- if (too_close(p1, &p, 4)) {
- close++;
- break;
- }
- if (close)
- continue;
- } else {
- p.orig_type = T_AIRPORT;
- p.orig_no = rnd2 - sp->num_exits;
- p.xpos = sp->airport[p.orig_no].x;
- p.ypos = sp->airport[p.orig_no].y;
- p.new_dir = p.dir = sp->airport[p.orig_no].dir;
- p.altitude = p.new_altitude = 0;
- }
- p.fuel = sp->width + sp->height;
- break;
- }
- if (i >= num_starts)
- return (-1);
- pnum = next_plane();
- if (pnum < 0)
- return (-1);
- p.plane_no = pnum;
-
- pp = newplane();
- bcopy(&p, pp, sizeof (p));
-
- if (pp->orig_type == T_AIRPORT)
- append(&ground, pp);
- else
- append(&air, pp);
-
- return (pp->dest_type);
-}
-
-PLANE *
-findplane(n)
- int n;
-{
- PLANE *pp;
-
- for (pp = air.head; pp != NULL; pp = pp->next)
- if (pp->plane_no == n)
- return (pp);
- for (pp = ground.head; pp != NULL; pp = pp->next)
- if (pp->plane_no == n)
- return (pp);
- return (NULL);
-}
-
-int
-too_close(p1, p2, dist)
- const PLANE *p1, *p2;
- int dist;
-{
- if (ABS(p1->altitude - p2->altitude) <= dist &&
- ABS(p1->xpos - p2->xpos) <= dist && ABS(p1->ypos - p2->ypos) <= dist)
- return (1);
- else
- return (0);
-}
-
-dir_deg(d)
-{
- switch (d) {
- case 0: return (0);
- case 1: return (45);
- case 2: return (90);
- case 3: return (135);
- case 4: return (180);
- case 5: return (225);
- case 6: return (270);
- case 7: return (315);
- default:
- return (-1);
- }
-}
diff --git a/games/backgammon/Makefile b/games/backgammon/Makefile
deleted file mode 100644
index 5384677..0000000
--- a/games/backgammon/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-SUBDIR= backgammon teachgammon
-
-.include <bsd.subdir.mk>
diff --git a/games/backgammon/backgammon/Makefile b/games/backgammon/backgammon/Makefile
deleted file mode 100644
index 8277c09..0000000
--- a/games/backgammon/backgammon/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= backgammon
-CFLAGS+=-DV7 -I${.CURDIR}/../common_source
-SRCS= allow.c board.c check.c extra.c fancy.c init.c main.c move.c \
- odds.c one.c save.c subs.c table.c text.c version.c
-MAN= backgammon.6
-DPADD= ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD= -ltermcap -lcompat
-.PATH: ${.CURDIR}/../common_source
-HIDEGAME=hidegame
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/backgammon/backgammon/backgammon.6 b/games/backgammon/backgammon/backgammon.6
deleted file mode 100644
index 007c267..0000000
--- a/games/backgammon/backgammon/backgammon.6
+++ /dev/null
@@ -1,198 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)backgammon.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH BACKGAMMON 6 "May 31, 1993"
-.UC 5
-.SH NAME
-backgammon \- the game of backgammon
-.SH SYNOPSIS
-.B backgammon
-[ -h n r w b pr pw pb t\c
-.I term
-s\c
-.I file
-]
-.SH DESCRIPTION
-This program lets you play backgammon against the computer
-or against a "friend".
-All commands only are one letter,
-so you don't need to type a carriage return,
-except at the end of a move.
-The program is mostly self documenting,
-so that a question mark (?) will usually get some help.
-If you answer `y' when the program asks if you want the rules,
-you will get text explaining the rules of the game,
-some hints on strategy,
-instruction on how to use the program,
-and a tutorial consisting of a practice game against the computer.
-A description of how to use the program can be
-obtained by answering `y' when it asks if you want instructions.
-.PP
-The possible arguments for backgammon
-(most are unnecessary but some are very convenient)
-consist of:
-.ne 11
-.PP
-.na
-.TP 8
-.B -h
-Get a description of possible arguments and exit
-.TP 8
-.B -n
-don't ask for rules or instructions
-.TP 8
-.B -r
-player is red (implies -n)
-.TP 8
-.B -w
-player is white (implies -n)
-.TP 8
-.B -b
-two players, red and white (implies -n)
-.TP 8
-.B -pr
-print the board before red's turn
-.TP 8
-.B -pw
-print the board before white's turn
-.TP 8
-.B -pb
-print the board before both player's turn
-.TP 8
-.B -t\fIterm
-terminal is type
-.IR term ,
-uses /etc/termcap
-.TP 8
-.B -s\fIfile
-recover previously saved game from
-.IR file .
-.ad
-.PP
-.PP
-If
-.IR term
-has capabilities for direct cursor movement (see
-.IR termcap (5))
-.IR backgammon
-``fixes'' the board after each move,
-so the board does not need to be reprinted,
-unless the screen suffers some horrendous malady.
-Also, any `-p' option will be ignored.
-(The `-t' option is not necessary unless the terminal type does not match
-the entry in the /etc/termcap data base.)
-.SH QUICK\ REFERENCE
-When the program prompts by typing only your color,
-type a space or carriage return to roll, or
-.ne 5
-.PP
-.na
-.TP 8
-.B d
-to double
-.TP 8
-.B p
-to print the board
-.TP 8
-.B q
-to quit
-.TP 8
-.B s
-to save the game for later
-.PP
-.ad
-When the program prompts with 'Move:', type
-.ne 4
-.PP
-.na
-.TP 8
-.B p
-to print the board
-.TP 8
-.B q
-to quit
-.TP 8
-.B s
-to save the game
-.ad
-.PP
-or a
-.IR move ,
-which is a sequence of
-.ne 4
-.PP
-.na
-.TP 8
-.B s-f
-move from
-.BR s
-to
-.BR f
-.TP 8
-.B s/r
-move one man on
-.BR s
-the roll
-.BR r
-.ad
-.PP
-separated by commas or spaces and ending with a newline.
-Available abbreviations are
-.ne 4
-.PP
-.na
-.TP 10
-.B s-f1-f2
-means
-.BR s-f1,f1-f2
-.TP 10
-.B s/r1r2
-means
-.BR s/r1,s/r2
-.ad
-.PP
-Use `b' for bar and `h' for home,
-or 0 or 25 as appropriate.
-.SH AUTHOR
-Alan Char
-.SH FILES
-.TP 25
-/usr/games/teachgammon
-\- rules and tutorial
-.br
-.TP 25
-/etc/termcap
-\- terminal capabilities
-.SH BUGS
-The program's strategy needs much work.
diff --git a/games/backgammon/backgammon/extra.c b/games/backgammon/backgammon/extra.c
deleted file mode 100644
index 0b2406e01..0000000
--- a/games/backgammon/backgammon/extra.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extra.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-#ifdef DEBUG
-#include <stdio.h>
-FILE *trace;
-#endif
-
-/*
- * dble()
- * Have the current player double and ask opponent to accept.
- */
-
-dble () {
- int resp; /* response to y/n */
-
- for (;;) {
- writel (" doubles."); /* indicate double */
-
- if (cturn == -pnum) { /* see if computer accepts */
- if (dblgood()) { /* guess not */
- writel (" Declined.\n");
- nexturn();
- cturn *= -2; /* indicate loss */
- return;
- } else { /* computer accepts */
- writel (" Accepted.\n");
- gvalue *= 2; /* double game value */
- dlast = cturn;
- if (tflag)
- gwrite();
- return;
- }
- }
-
- /* ask if player accepts */
- writel (" Does ");
- writel (cturn == 1? color[2]: color[3]);
- writel (" accept?");
-
- /* get response from yorn,
- * a "2" means he said "p"
- * for print board. */
- if ((resp = yorn ('R')) == 2) {
- writel (" Reprint.\n");
- buflush();
- wrboard();
- writel (*Colorptr);
- continue;
- }
-
- /* check response */
- if (resp) {
- /* accepted */
- gvalue *= 2;
- dlast = cturn;
- if (tflag)
- gwrite();
- return;
- }
-
- nexturn (); /* declined */
- cturn *= -2;
- return;
- }
-}
-
-/*
- * dblgood ()
- * Returns 1 if the computer would double in this position. This
- * is not an exact science. The computer will decline a double that he
- * would have made. Accumulated judgments are kept in the variable n,
- * which is in "pips", i.e., the position of each man summed over all
- * men, with opponent's totals negative. Thus, n should have a positive
- * value of 7 for each move ahead, or a negative value of 7 for each one
- * behind.
- */
-
-dblgood () {
- int n; /* accumulated judgment */
- int OFFC = *offptr; /* no. of computer's men off */
- int OFFO = *offopp; /* no. of player's men off */
-
-#ifdef DEBUG
- int i;
- if (trace == NULL)
- trace = fopen ("bgtrace","w");
-#endif
-
- /* get real pip value */
- n = eval()*cturn;
-#ifdef DEBUG
- fputs ("\nDoubles:\nBoard: ",trace);
- for (i = 0; i < 26; i++)
- fprintf (trace," %d",board[i]);
- fprintf (trace,"\n\tpip = %d, ",n);
-#endif
-
- /* below adjusts pip value
- * according to position
- * judgments */
-
- /* check men moving off
- * board */
- if (OFFC > -15 || OFFO > -15) {
- if (OFFC < 0 && OFFO < 0) {
- OFFC += 15;
- OFFO += 15;
- n +=((OFFC-OFFO)*7)/2;
- } else if (OFFC < 0) {
- OFFC += 15;
- n -= OFFO*7/2;
- } else if (OFFO < 0) {
- OFFO += 15;
- n += OFFC*7/2;
- }
- if (OFFC < 8 && OFFO > 8)
- n -= 7;
- if (OFFC < 10 && OFFO > 10)
- n -= 7;
- if (OFFC < 12 && OFFO > 12)
- n -= 7;
- if (OFFO < 8 && OFFC > 8)
- n += 7;
- if (OFFO < 10 && OFFC > 10)
- n += 7;
- if (OFFO < 12 && OFFC > 12)
- n += 7;
- n += ((OFFC-OFFO)*7)/2;
- }
-
-#ifdef DEBUG
- fprintf (trace,"off = %d, ",n);
-#endif
-
- /* see if men are trapped */
- n -= freemen(bar);
- n += freemen(home);
- n += trapped(home,-cturn);
- n -= trapped(bar,cturn);
-
-#ifdef DEBUG
- fprintf (trace,"free = %d\n",n);
- fprintf (trace,"\tOFFC = %d, OFFO = %d\n",OFFC,OFFO);
- fflush (trace);
-#endif
-
- /* double if 2-3 moves ahead */
- if (n > 10+rnum(7))
- return(1);
- return (0);
-}
-
-freemen (b)
-int b;
-
-{
- int i, inc, lim;
-
- odds(0,0,0);
- if (board[b] == 0)
- return (0);
- inc = (b == 0? 1: -1);
- lim = (b == 0? 7: 18);
- for (i = b+inc; i != lim; i += inc)
- if (board[i]*inc < -1)
- odds(abs(b-i),0,abs(board[b]));
- if (abs(board[b]) == 1)
- return ((36-count())/5);
- return (count()/5);
-}
-
-trapped (n,inc)
-int n, inc;
-
-{
- int i, j, k;
- int c, l, ct;
-
- ct = 0;
- l = n+7*inc;
- for (i = n+inc; i != l; i += inc) {
- odds (0,0,0);
- c = abs(i-l);
- if (board[i]*inc > 0) {
- for (j = c; j < 13; j++)
- if (board[i+inc*j]*inc < -1) {
- if (j < 7)
- odds (j,0,1);
- for (k = 1; k < 7 && k < j; k++)
- if (j-k < 7)
- odds (k,j-k,1);
- }
- ct += abs(board[i])*(36-count());
- }
- }
- return (ct/5);
-}
-
-eval () {
-
- int i, j;
-
- for (j = i = 0; i < 26; i++)
- j += (board[i] >= 0 ? i*board[i] : (25-i)*board[i]);
-
- if (off[1] >= 0)
- j += 25*off[1];
- else
- j += 25*(off[1]+15);
-
- if (off[0] >= 0)
- j -= 25*off[0];
- else
- j -= 25*(off[0]+15);
- return (j);
-}
diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c
deleted file mode 100644
index fc2110f..0000000
--- a/games/backgammon/backgammon/main.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <termcap.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include "back.h"
-
-#define MVPAUSE 5 /* time to sleep when stuck */
-#define MAXUSERS 35 /* maximum number of users */
-
-extern const char *const instr[]; /* text of instructions */
-extern const char *const message[]; /* update message */
-
-const char *helpm[] = { /* help message */
- "Enter a space or newline to roll, or",
- " R to reprint the board\tD to double",
- " S to save the game\tQ to quit",
- 0
-};
-
-const char *contin[] = { /* pause message */
- "(Type a newline to continue.)",
- "",
- 0
-};
-
-static const char rules[] = "\nDo you want the rules of the game?";
-static const char noteach[] = "Teachgammon not available!\n\007";
-static const char need[] = "Do you need instructions for this program?";
-static const char askcol[] =
- "Enter 'r' to play red, 'w' to play white, 'b' to play both:";
-static const char rollr[] = "Red rolls a ";
-static const char rollw[] = ". White rolls a ";
-static const char rstart[] = ". Red starts.\n";
-static const char wstart[] = ". White starts.\n";
-static const char toobad1[] = "Too bad, ";
-static const char unable[] = " is unable to use that roll.\n";
-static const char toobad2[] = ". Too bad, ";
-static const char cantmv[] = " can't move.\n";
-static const char bgammon[] = "Backgammon! ";
-static const char gammon[] = "Gammon! ";
-static const char again[] = ".\nWould you like to play again?";
-static const char svpromt[] = "Would you like to save this game?";
-
-static const char password[] = "losfurng";
-static char pbuf[10];
-
-main (argc,argv)
-int argc;
-char **argv;
-
-{
- int i; /* non-descript index */
- int l; /* non-descript index */
- char c; /* non-descript character storage */
-
- /* revoke privs */
- setgid(getgid());
-
- /* initialization */
- bflag = 2; /* default no board */
- acnt = 1; /* Nuber of args */
- signal (SIGINT,getout); /* trap interrupts */
- if (gtty (0,&tty) == -1) /* get old tty mode */
- errexit ("backgammon(gtty)");
- old = tty.sg_flags;
-#ifdef V7
- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */
-#else
- raw = ((noech = old & ~ECHO) | RAW); /* set up modes */
-#endif
- ospeed = tty.sg_ospeed; /* for termlib */
-
- /* get terminal
- * capabilities, and
- * decide if it can
- * cursor address */
- tflag = getcaps (getenv ("TERM"));
- /* use whole screen
- * for text */
- if (tflag)
- begscr = 0;
- srandomdev();
-
- getarg (argc, argv);
- args[acnt] = NULL;
- if (tflag) { /* clear screen */
- noech &= ~(CRMOD|XTABS);
- raw &= ~(CRMOD|XTABS);
- clear();
- }
- fixtty (raw); /* go into raw mode */
-
- /* check if restored
- * game and save flag
- * for later */
- if (rfl = rflag) {
- text (message); /* print message */
- text (contin);
- wrboard(); /* print board */
- /* if new game, pretend
- * to be a non-restored
- * game */
- if (cturn == 0)
- rflag = 0;
- } else {
- rscore = wscore = 0; /* zero score */
- text (message); /* update message
- * without pausing */
-
- if (aflag) { /* print rules */
- writel (rules);
- if (yorn(0)) {
-
- fixtty (old); /* restore tty */
- args[0] = strdup ("teachgammon");
- execv (TEACH,args);
-
- tflag = 0; /* error! */
- writel (noteach);
- exit(1);
- } else { /* if not rules, then
- * instructions */
- writel (need);
- if (yorn(0)) { /* print instructions */
- clear();
- text (instr);
- }
- }
- }
-
- for (i = 0; i < acnt; i++)
- free (args[i]);
-
- init(); /* initialize board */
-
- if (pnum == 2) { /* ask for color(s) */
- writec ('\n');
- writel (askcol);
- while (pnum == 2) {
- c = readc();
- switch (c) {
-
- case 'R': /* red */
- pnum = -1;
- break;
-
- case 'W': /* white */
- pnum = 1;
- break;
-
- case 'B': /* both */
- pnum = 0;
- break;
-
- case 'P':
- if (iroll)
- break;
- if (tflag)
- curmove (curr,0);
- else
- writec ('\n');
- writel ("Password:");
- signal (SIGALRM,getout);
- cflag = 1;
- alarm (10);
- for (i = 0; i < 10; i++) {
- pbuf[i] = readc();
- if (pbuf[i] == '\n')
- break;
- }
- if (i == 10)
- while (readc() != '\n');
- alarm (0);
- cflag = 0;
- if (i < 10)
- pbuf[i] = '\0';
- for (i = 0; i < 9; i++)
- if (pbuf[i] != password[i])
- getout();
- iroll = 1;
- if (tflag)
- curmove (curr,0);
- else
- writec ('\n');
- writel (askcol);
- break;
-
- default: /* error */
- writec ('\007');
- }
- }
- } else if (!aflag)
- /* pause to read
- * message */
- text (contin);
-
- wrboard(); /* print board */
-
- if (tflag)
- curmove (18,0);
- else
- writec ('\n');
- }
- /* limit text to bottom
- * of screen */
- if (tflag)
- begscr = 17;
-
- for (;;) { /* begin game! */
- /* initial roll if
- * needed */
- if ((! rflag) || raflag)
- roll();
-
- /* perform ritual of
- * first roll */
- if (! rflag) {
- if (tflag)
- curmove (17,0);
- while (D0 == D1) /* no doubles */
- roll();
-
- /* print rolls */
- writel (rollr);
- writec (D0+'0');
- writel (rollw);
- writec (D1+'0');
-
- /* winner goes first */
- if (D0 > D1) {
- writel (rstart);
- cturn = 1;
- } else {
- writel (wstart);
- cturn = -1;
- }
- }
-
- /* initalize variables
- * according to whose
- * turn it is */
-
- if (cturn == 1) { /* red */
- home = 25;
- bar = 0;
- inptr = &in[1];
- inopp = &in[0];
- offptr = &off[1];
- offopp = &off[0];
- Colorptr = &color[1];
- colorptr = &color[3];
- colen = 3;
- } else { /* white */
- home = 0;
- bar = 25;
- inptr = &in[0];
- inopp = &in[1];
- offptr = &off[0];
- offopp = &off[1];
- Colorptr = &color[0];
- colorptr = &color[2];
- colen = 5;
- }
-
- /* do first move
- * (special case) */
- if (! (rflag && raflag)) {
- if (cturn == pnum) /* computer's move */
- move (0);
- else { /* player's move */
- mvlim = movallow();
- /* reprint roll */
- if (tflag)
- curmove (cturn == -1? 18: 19,0);
- proll();
- getmove(); /* get player's move */
- }
- }
- if (tflag) {
- curmove (17,0);
- cline();
- begscr = 18;
- }
-
- /* no longer any diff-
- * erence between normal
- * game and recovered
- * game. */
- rflag = 0;
-
- /* move as long as it's
- * someone's turn */
- while (cturn == 1 || cturn == -1) {
-
- /* board maintainence */
- if (tflag)
- refresh(); /* fix board */
- else
- /* redo board if -p */
- if (cturn == bflag || bflag == 0)
- wrboard();
-
- /* do computer's move */
- if (cturn == pnum) {
- move (1);
-
- /* see if double
- * refused */
- if (cturn == -2 || cturn == 2)
- break;
-
- /* check for winning
- * move */
- if (*offopp == 15) {
- cturn *= -2;
- break;
- }
- continue;
-
- }
-
- /* (player's move) */
-
- /* clean screen if
- * safe */
- if (tflag && hflag) {
- curmove (20,0);
- clend ();
- hflag = 1;
- }
-
- /* if allowed, give him
- * a chance to double */
- if (dlast != cturn && gvalue < 64) {
- if (tflag)
- curmove (cturn == -1? 18: 19,0);
- writel (*Colorptr);
- c = readc();
-
- /* character cases */
- switch (c) {
-
- /* reprint board */
- case 'R':
- wrboard();
- break;
-
- /* save game */
- case 'S':
- raflag = 1;
- save (1);
- break;
-
- /* quit */
- case 'Q':
- quit();
- break;
-
- /* double */
- case 'D':
- dble();
- break;
-
- /* roll */
- case ' ':
- case '\n':
- roll();
- writel (" rolls ");
- writec (D0+'0');
- writec (' ');
- writec (D1+'0');
- writel (". ");
-
- /* see if he can move */
- if ( (mvlim = movallow()) == 0) {
-
- /* can't move */
- writel (toobad1);
- writel (*colorptr);
- writel (unable);
- if (tflag) {
- if (pnum) {
- buflush();
- sleep (MVPAUSE);
- }
- }
- nexturn();
- break;
- }
-
- /* get move */
- getmove();
-
- /* okay to clean
- * screen */
- hflag = 1;
- break;
-
- /* invalid character */
- default:
-
- /* print help message */
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- text (helpm);
- if (tflag)
- curmove (cturn == -1? 18: 19,0);
- else
- writec ('\n');
-
- /* don't erase */
- hflag = 0;
- }
- } else { /* couldn't double */
-
- /* print roll */
- roll();
- if (tflag)
- curmove (cturn == -1? 18: 19,0);
- proll ();
-
- /* can he move? */
- if ((mvlim = movallow()) == 0) {
-
- /* he can't */
- writel (toobad2);
- writel (*colorptr);
- writel (cantmv);
- buflush();
- sleep (MVPAUSE);
- nexturn();
- continue;
- }
-
- /* get move */
- getmove();
- }
- }
-
- /* don't worry about who
- * won if quit */
- if (cturn == 0)
- break;
-
- /* fix cturn = winner */
- cturn /= -2;
-
- /* final board pos. */
- if (tflag)
- refresh();
-
- /* backgammon? */
- mflag = 0;
- l = bar+7*cturn;
- for (i = bar; i != l; i += cturn)
- if (board[i]*cturn) mflag++;
-
- /* compute game value */
- if (tflag)
- curmove (20,0);
- if (*offopp == 15) {
- if (mflag) {
- writel (bgammon);
- gvalue *= 3;
- }
- else if (*offptr <= 0) {
- writel (gammon);
- gvalue *= 2;
- }
- }
-
- /* report situation */
- if (cturn == -1) {
- writel ("Red wins ");
- rscore += gvalue;
- } else {
- writel ("White wins ");
- wscore += gvalue;
- }
- wrint (gvalue);
- writel (" point");
- if (gvalue > 1)
- writec ('s');
- writel (".\n");
-
- /* write score */
- wrscore();
-
- /* see if he wants
- * another game */
- writel (again);
- if ((i = yorn ('S')) == 0)
- break;
-
- init();
- if (i == 2) {
- writel (" Save.\n");
- cturn = 0;
- save (0);
- }
-
- /* yes, reset game */
- wrboard();
- }
-
- /* give him a chance to save if game was recovered */
- if (rfl && cturn) {
- writel (svpromt);
- if (yorn (0)) {
- /* re-initialize for
- * recovery */
- init();
- cturn = 0;
- save(0);
- }
- }
-
- /* leave peacefully */
- getout ();
-}
diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c
deleted file mode 100644
index 8b85dad..0000000
--- a/games/backgammon/backgammon/move.c
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdlib.h>
-#include "back.h"
-
-#ifdef DEBUG
-#include <stdio.h>
-FILE *trace;
-static char tests[20];
-#endif
-
-struct BOARD { /* structure of game position */
- int b_board[26]; /* board position */
- int b_in[2]; /* men in */
- int b_off[2]; /* men off */
- int b_st[4], b_fn[4]; /* moves */
-
- struct BOARD *b_next; /* forward queue pointer */
-};
-
-struct BOARD *freeq = 0;
-struct BOARD *checkq = 0;
-struct BOARD *bsave();
-struct BOARD *nextfree();
-
- /* these variables are values for the
- * candidate move */
-static int ch; /* chance of being hit */
-static int op; /* computer's open men */
-static int pt; /* comp's protected points */
-static int em; /* farthest man back */
-static int frc; /* chance to free comp's men */
-static int frp; /* chance to free pl's men */
-
- /* these values are the values for the
- * move chosen (so far) */
-static int chance; /* chance of being hit */
-static int openmen; /* computer's open men */
-static int points; /* comp's protected points */
-static int endman; /* farthest man back */
-static int barmen; /* men on bar */
-static int menin; /* men in inner table */
-static int menoff; /* men off board */
-static int oldfrc; /* chance to free comp's men */
-static int oldfrp; /* chance to free pl's men */
-
-static int cp[5]; /* candidate start position */
-static int cg[5]; /* candidate finish position */
-
-static int race; /* game reduced to a race */
-
-move (okay)
-int okay; /* zero if first move */
-{
- int i; /* index */
- int l; /* last man */
-
- if (okay) {
- /* see if comp should double */
- if (gvalue < 64 && dlast != cturn && dblgood()) {
- writel (*Colorptr);
- dble(); /* double */
- /* return if declined */
- if (cturn != 1 && cturn != -1)
- return;
- }
- roll();
- }
-
- race = 0;
- for (i = 0; i < 26; i++) {
- if (board[i] < 0)
- l = i;
- }
- for (i = 0; i < l; i++) {
- if (board[i] > 0)
- break;
- }
- if (i == l)
- race = 1;
-
- /* print roll */
- if (tflag)
- curmove (cturn == -1? 18: 19,0);
- writel (*Colorptr);
- writel (" rolls ");
- writec (D0+'0');
- writec (' ');
- writec (D1+'0');
- /* make tty interruptable
- * while thinking */
- if (tflag)
- cline();
- fixtty (noech);
-
- /* find out how many moves */
- mvlim = movallow();
- if (mvlim == 0) {
- writel (" but cannot use it.\n");
- nexturn();
- fixtty (raw);
- return;
- }
-
- /* initialize */
- for (i = 0; i < 4; i++)
- cp[i] = cg[i] = 0;
-
- /* strategize */
- trymove (0,0);
- pickmove();
-
- /* print move */
- writel (" and moves ");
- for (i = 0; i < mvlim; i++) {
- if (i > 0)
- writec (',');
- wrint (p[i] = cp[i]);
- writec ('-');
- wrint (g[i] = cg[i]);
- makmove (i);
- }
- writec ('.');
-
- /* print blots hit */
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- for (i = 0; i < mvlim; i++)
- if (h[i])
- wrhit(g[i]);
- /* get ready for next move */
- nexturn();
- if (!okay) {
- buflush();
- sleep (3);
- }
- fixtty (raw); /* no more tty interrupt */
-}
-
-trymove (mvnum,swapped)
-int mvnum; /* number of move (rel zero) */
-int swapped; /* see if swapped also tested */
-
-{
- int pos; /* position on board */
- int rval; /* value of roll */
-
- /* if recursed through all dice
- * values, compare move */
- if (mvnum == mvlim) {
- binsert (bsave());
- return;
- }
-
- /* make sure dice in always
- * same order */
- if (d0 == swapped)
- swap;
- /* choose value for this move */
- rval = dice[mvnum != 0];
-
- /* find all legitimate moves */
- for (pos = bar; pos != home; pos += cturn) {
- /* fix order of dice */
- if (d0 == swapped)
- swap;
- /* break if stuck on bar */
- if (board[bar] != 0 && pos != bar)
- break;
- /* on to next if not occupied */
- if (board[pos]*cturn <= 0)
- continue;
- /* set up arrays for move */
- p[mvnum] = pos;
- g[mvnum] = pos+rval*cturn;
- if (g[mvnum]*cturn >= home) {
- if (*offptr < 0)
- break;
- g[mvnum] = home;
- }
- /* try to move */
- if (makmove (mvnum))
- continue;
- else
- trymove (mvnum+1,2);
- /* undo move to try another */
- backone (mvnum);
- }
-
- /* swap dice and try again */
- if ((!swapped) && D0 != D1)
- trymove (0,1);
-}
-
-struct BOARD *
-bsave () {
- int i; /* index */
- struct BOARD *now; /* current position */
-
- now = nextfree (); /* get free BOARD */
-
- /* store position */
- for (i = 0; i < 26; i++)
- now->b_board[i] = board[i];
- now->b_in[0] = in[0];
- now->b_in[1] = in[1];
- now->b_off[0] = off[0];
- now->b_off[1] = off[1];
- for (i = 0; i < mvlim; i++) {
- now->b_st[i] = p[i];
- now->b_fn[i] = g[i];
- }
- return (now);
-}
-
-binsert (new)
-struct BOARD *new; /* item to insert */
-{
- struct BOARD *p = checkq; /* queue pointer */
- int result; /* comparison result */
-
- if (p == 0) { /* check if queue empty */
- checkq = p = new;
- p->b_next = 0;
- return;
- }
-
- result = bcomp (new,p); /* compare to first element */
- if (result < 0) { /* insert in front */
- new->b_next = p;
- checkq = new;
- return;
- }
- if (result == 0) { /* duplicate entry */
- mvcheck (p,new);
- makefree (new);
- return;
- }
-
- while (p->b_next != 0) { /* traverse queue */
- result = bcomp (new,p->b_next);
- if (result < 0) { /* found place */
- new->b_next = p->b_next;
- p->b_next = new;
- return;
- }
- if (result == 0) { /* duplicate entry */
- mvcheck (p->b_next,new);
- makefree (new);
- return;
- }
- p = p->b_next;
- }
- /* place at end of queue */
- p->b_next = new;
- new->b_next = 0;
-}
-
-bcomp (a,b)
-struct BOARD *a;
-struct BOARD *b;
-{
- int *aloc = a->b_board; /* pointer to board a */
- int *bloc = b->b_board; /* pointer to board b */
- int i; /* index */
- int result; /* comparison result */
-
- for (i = 0; i < 26; i++) { /* compare boards */
- result = cturn*(aloc[i]-bloc[i]);
- if (result)
- return (result); /* found inequality */
- }
- return (0); /* same position */
-}
-
-mvcheck (incumbent,candidate)
-struct BOARD *incumbent;
-struct BOARD *candidate;
-{
- int i;
- int result;
-
- for (i = 0; i < mvlim; i++) {
- result = cturn*(candidate->b_st[i]-incumbent->b_st[i]);
- if (result > 0)
- return;
- if (result < 0)
- break;
- }
- if (i == mvlim)
- return;
- for (i = 0; i < mvlim; i++) {
- incumbent->b_st[i] = candidate->b_st[i];
- incumbent->b_fn[i] = candidate->b_fn[i];
- }
-}
-
-makefree (dead)
-struct BOARD *dead; /* dead position */
-{
- dead->b_next = freeq; /* add to freeq */
- freeq = dead;
-}
-
-struct BOARD *
-nextfree () {
- struct BOARD *new;
-
- if (freeq == 0) {
- new = (struct BOARD *)calloc (1,sizeof (struct BOARD));
- if (new == 0) {
- writel ("\nOut of memory\n");
- getout();
- }
- new->b_next = 0;
- } else {
- new = freeq;
- freeq = freeq->b_next;
- }
- return (new);
-}
-
-pickmove () {
- /* current game position */
- struct BOARD *now = bsave();
- struct BOARD *next; /* next move */
-
-#ifdef DEBUG
- if (trace == NULL)
- trace = fopen ("bgtrace","w");
- fprintf (trace,"\nRoll: %d %d%s\n",D0,D1,race? " (race)": "");
- fflush (trace);
-#endif
- do { /* compare moves */
- boardcopy (checkq);
- next = checkq->b_next;
- makefree (checkq);
- checkq = next;
- movcmp();
- } while (checkq != 0);
-
- boardcopy (now);
-}
-
-boardcopy (s)
-struct BOARD *s; /* game situation */
-{
- int i; /* index */
-
- for (i = 0; i < 26; i++)
- board[i] = s->b_board[i];
- for (i = 0; i < 2; i++) {
- in[i] = s->b_in[i];
- off[i] = s->b_off[i];
- }
- for (i = 0; i < mvlim; i++) {
- p[i] = s->b_st[i];
- g[i] = s->b_fn[i];
- }
-}
-
-movcmp () {
- int i;
- int c;
-
-#ifdef DEBUG
- if (trace == NULL)
- trace = fopen ("bgtrace","w");
-#endif
-
- odds (0,0,0);
- if (!race) {
- ch = op = pt = 0;
- for (i = 1; i < 25; i++) {
- if (board[i] == cturn)
- ch = canhit (i,1);
- op += abs (bar-i);
- }
- for (i = bar+cturn; i != home; i += cturn)
- if (board[i]*cturn > 1)
- pt += abs(bar-i);
- frc = freemen (bar)+trapped (bar,cturn);
- frp = freemen (home)+trapped (home,-cturn);
- }
- for (em = bar; em != home; em += cturn)
- if (board[em]*cturn > 0)
- break;
- em = abs(home-em);
-#ifdef DEBUG
- fputs ("Board: ",trace);
- for (i = 0; i < 26; i++)
- fprintf (trace, " %d",board[i]);
- if (race)
- fprintf (trace,"\n\tem = %d\n",em);
- else
- fprintf (trace,
- "\n\tch = %d, pt = %d, em = %d, frc = %d, frp = %d\n",
- ch,pt,em,frc,frp);
- fputs ("\tMove: ",trace);
- for (i = 0; i < mvlim; i++)
- fprintf (trace," %d-%d",p[i],g[i]);
- fputs ("\n",trace);
- fflush (trace);
- strcpy (tests,"");
-#endif
- if ((cp[0] == 0 && cg[0] == 0) || movegood()) {
-#ifdef DEBUG
- fprintf (trace,"\t[%s] ... wins.\n",tests);
- fflush (trace);
-#endif
- for (i = 0; i < mvlim; i++) {
- cp[i] = p[i];
- cg[i] = g[i];
- }
- if (!race) {
- chance = ch;
- openmen = op;
- points = pt;
- endman = em;
- barmen = abs(board[home]);
- oldfrc = frc;
- oldfrp = frp;
- }
- menin = *inptr;
- menoff = *offptr;
- }
-#ifdef DEBUG
- else {
- fprintf (trace,"\t[%s] ... loses.\n",tests);
- fflush (trace);
- }
-#endif
-}
-
-movegood () {
- int n;
-
- if (*offptr == 15)
- return (1);
- if (menoff == 15)
- return (0);
- if (race) {
-#ifdef DEBUG
- strcat (tests,"o");
-#endif
- if (*offptr-menoff)
- return (*offptr > menoff);
-#ifdef DEBUG
- strcat (tests,"e");
-#endif
- if (endman-em)
- return (endman > em);
-#ifdef DEBUG
- strcat (tests,"i");
-#endif
- if (menin == 15)
- return (0);
- if (*inptr == 15)
- return (1);
-#ifdef DEBUG
- strcat (tests,"i");
-#endif
- if (*inptr-menin)
- return (*inptr > menin);
- return (rnum(2));
- } else {
- n = barmen-abs(board[home]);
-#ifdef DEBUG
- strcat (tests,"c");
-#endif
- if (abs(chance-ch)+25*n > rnum(150))
- return (n? (n < 0): (ch < chance));
-#ifdef DEBUG
- strcat (tests,"o");
-#endif
- if (*offptr-menoff)
- return (*offptr > menoff);
-#ifdef DEBUG
- strcat (tests,"o");
-#endif
- if (abs(openmen-op) > 7+rnum(12))
- return (openmen > op);
-#ifdef DEBUG
- strcat (tests,"b");
-#endif
- if (n)
- return (n < 0);
-#ifdef DEBUG
- strcat (tests,"e");
-#endif
- if (abs(endman-em) > rnum(2))
- return (endman > em);
-#ifdef DEBUG
- strcat (tests,"f");
-#endif
- if (abs(frc-oldfrc) > rnum(2))
- return (frc < oldfrc);
-#ifdef DEBUG
- strcat (tests,"p");
-#endif
- if (abs(n = pt-points) > rnum(4))
- return (n > 0);
-#ifdef DEBUG
- strcat (tests,"i");
-#endif
- if (*inptr-menin)
- return (*inptr > menin);
-#ifdef DEBUG
- strcat (tests,"f");
-#endif
- if (abs(frp-oldfrp) > rnum(2))
- return (frp > oldfrp);
- return (rnum(2));
- }
-}
diff --git a/games/backgammon/backgammon/text.c b/games/backgammon/backgammon/text.c
deleted file mode 100644
index 740367c..0000000
--- a/games/backgammon/backgammon/text.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)text.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-const char *const instr[] = {
- " If you did not notice by now, this program reacts to things as",
- "soon as you type them, without waiting for a newline. This means that",
- "the special characters RUBOUT, ESC, and CONTROL-D, will not perform",
- "their special functions during most of this program. The program",
- "should usually stop when a RUBOUT is typed, but occasionally it will",
- "ignore RUBOUTs until it is waiting for input.\n",
- " These instructions are presented in small chunks designed not to",
- "roll off the top of your screen. When the characters '-->' are print-",
- "ed, no more data will be printed until a space or newline is typed.",
- "In this way, you can finish one section before continuing to another.",
- "Like this:",
- "",
- " The two sides are colored 'red' and 'white.' The computer may play",
- "one side, or if there are two players, the computer can merely act as",
- "a gamekeeper, letting the players make the moves. Once you tell the",
- "computer what color(s) you want to play, the decision remains in ef-",
- "fect until you quit the program, even if you play more than one game,",
- "since the program keeps a running score.\n",
- " The program will prompt for a move in one of two ways. If the",
- "player has the opportunity to double, then merely his color will be",
- "typed out. The player can now do one of several things. He can dou-",
- "ble by typing a 'd', he can roll by typing a space (' ') or newline,",
- "or if he is not sure, he can reprint the board by typing a 'r'.\n",
- " If the player cannot double, his roll will be thrust in front of",
- "him, followed by the request 'Move:', asking for a move but not giving",
- "him the chance to double. He can still ask for the board by typing",
- "'r'. In either of these two states, the player can quit by typing 'q'",
- "or save the game by typing 's'. In either case, the player will be",
- "asked to verify, in case there was some error. The program then ends",
- "immediately, after first saving the file if so requested.",
- "",
- " A player can move one of his men using two forms of input. The",
- "first form is <s>-<f>, where <s> is the starting position, and <f> is",
- "the finishing position of the player's man. For example, if white",
- "wanted to move a piece from position 13 to position 8, his move could",
- "be entered as 13-8. The second form is <s>/<r> where <s> is the",
- "starting position, an <r> is the roll actually made. Hence, white",
- "could have entered as 13/5 instead of 13-8.\n",
- " A player must move each roll of the dice separately. For example,",
- "if a player rolled 4 3, and wanted to move from 13 to 6, he could",
- "enter it as 13/4,9/3 or 13/3,10/4 or 13-10,10-6 or 13-9,9-6, but not",
- "13-6. The last two entries can be shortened to 13-10-6 and 13-9-6.",
- "If you want to move more than one piece from the same position, such",
- "as 13-10,13-9, you can abbreviate this using the <s>/<r> format as by",
- "entering more than one <r>, or 13/34. A player can use both forms for",
- "the same roll, e.g. 13/3,13-9, and separates individual moves by ei-",
- "ther a comma or a space. The letter 'b' represents the bar, and the",
- "letter 'h' represents a player's home. You could also enter the",
- "number that would be in the position of the bar, 25 or 0 as appropri-",
- "ate. Use a newline at the end of your moves for a turn.",
- "",
- " As you type in your move, if a character does not make sense under",
- "the above constrictions, a bell will sound instead of the character,",
- "and it will be ignored. You may kill lines and erase characters as",
- "you would normally, but don't be surprised if they look different than",
- "usual. Also, if you have entered one or more of your rolls, and you",
- "wish to see what the move looks like so far, type a 'r' to see what it",
- "looks like. This cannot be done in the middle of a move (e.g., after",
- "a '-' or '/'). After the printing board, the program will go back to",
- "inputting your move and you can backspace or kill just as if you had",
- "just typed in your input.\n",
- " Now you should be ready to begin the game. Good luck!",
- "",
- 0};
-
-
-int
-text (t)
-const char *const *t;
-
-{
- int i;
- const char *s, *a;
-
- fixtty (noech);
- while (*t != 0) {
- s = a = *t;
- for (i = 0; *a != '\0'; i--)
- a++;
- if (i) {
- writel (s);
- writec ('\n');
- } else {
- writel ("-->");
- fixtty (raw);
- while ((i = readc()) != ' ' && i != '\n');
- fixtty (noech);
- clear();
- }
- t++;
- }
- fixtty (raw);
-}
diff --git a/games/backgammon/backgammon/version.c b/games/backgammon/backgammon/version.c
deleted file mode 100644
index 12016e0..0000000
--- a/games/backgammon/backgammon/version.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1980, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-const char *const message[] = {
- "Last updated on Saturday, January 11, 1986.",
- 0
-};
diff --git a/games/backgammon/common_source/allow.c b/games/backgammon/common_source/allow.c
deleted file mode 100644
index 7c9f593..0000000
--- a/games/backgammon/common_source/allow.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)allow.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-movallow () {
-
- int i, m, iold;
- int r;
-
- if (d0)
- swap;
- m = (D0 == D1? 4: 2);
- for (i = 0; i < 4; i++)
- p[i] = bar;
- i = iold = 0;
- while (i < m) {
- if (*offptr == 15)
- break;
- h[i] = 0;
- if (board[bar]) {
- if (i == 1 || m == 4)
- g[i] = bar+cturn*D1;
- else
- g[i] = bar+cturn*D0;
- if (r = makmove(i)) {
- if (d0 || m == 4)
- break;
- swap;
- movback (i);
- if (i > iold)
- iold = i;
- for (i = 0; i < 4; i++)
- p[i] = bar;
- i = 0;
- } else
- i++;
- continue;
- }
- if ((p[i] += cturn) == home) {
- if (i > iold)
- iold = i;
- if (m == 2 && i) {
- movback(i);
- p[i--] = bar;
- if (p[i] != bar)
- continue;
- else
- break;
- }
- if (d0 || m == 4)
- break;
- swap;
- movback (i);
- for (i = 0; i < 4; i++)
- p[i] = bar;
- i = 0;
- continue;
- }
- if (i == 1 || m == 4)
- g[i] = p[i]+cturn*D1;
- else
- g[i] = p[i]+cturn*D0;
- if (g[i]*cturn > home) {
- if (*offptr >= 0)
- g[i] = home;
- else
- continue;
- }
- if (board[p[i]]*cturn > 0 && (r = makmove(i)) == 0)
- i++;
- }
- movback (i);
- return (iold > i? iold: i);
-}
diff --git a/games/backgammon/common_source/back.h b/games/backgammon/common_source/back.h
deleted file mode 100644
index 88ca933..0000000
--- a/games/backgammon/common_source/back.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)back.h 8.1 (Berkeley) 5/31/93
- */
-
-#include <sgtty.h>
-
-#define rnum(r) (random()%r)
-#define D0 dice[0]
-#define D1 dice[1]
-#define swap {D0 ^= D1; D1 ^= D0; D0 ^= D1; d0 = 1-d0;}
-
-/*
- *
- * Some numerical conventions:
- *
- * Arrays have white's value in [0], red in [1].
- * Numeric values which are one color or the other use
- * -1 for white, 1 for red.
- * Hence, white will be negative values, red positive one.
- * This makes a lot of sense since white is going in decending
- * order around the board, and red is ascending.
- *
- */
-
-extern const char EXEC[]; /* object for main program */
-extern const char TEACH[];/* object for tutorial program */
-
-extern int pnum; /* color of player:
- -1 = white
- 1 = red
- 0 = both
- 2 = not yet init'ed */
-extern char *args[16]; /* args passed to teachgammon and back */
-extern int acnt; /* number of args */
-extern int aflag; /* flag to ask for rules or instructions */
-extern int bflag; /* flag for automatic board printing */
-extern int cflag; /* case conversion flag */
-extern int hflag; /* flag for cleaning screen */
-extern int mflag; /* backgammon flag */
-extern int raflag; /* 'roll again' flag for recovered game */
-extern int rflag; /* recovered game flag */
-extern int tflag; /* cursor addressing flag */
-extern int rfl; /* saved value of rflag */
-extern int iroll; /* special flag for inputting rolls */
-extern int board[26]; /* board: negative values are white,
- positive are red */
-extern int dice[2]; /* value of dice */
-extern int mvlim; /* 'move limit': max. number of moves */
-extern int mvl; /* working copy of mvlim */
-extern int p[5]; /* starting position of moves */
-extern int g[5]; /* ending position of moves (goals) */
-extern int h[4]; /* flag for each move if a man was hit */
-extern int cturn; /* whose turn it currently is:
- -1 = white
- 1 = red
- 0 = just quitted
- -2 = white just lost
- 2 = red just lost */
-extern int d0; /* flag if dice have been reversed from
- original position */
-extern int table[6][6]; /* odds table for possible rolls */
-extern int rscore; /* red's score */
-extern int wscore; /* white's score */
-extern int gvalue; /* value of game (64 max.) */
-extern int dlast; /* who doubled last (0 = neither) */
-extern int bar; /* position of bar for current player */
-extern int home; /* position of home for current player */
-extern int off[2]; /* number of men off board */
-extern int *offptr; /* pointer to off for current player */
-extern int *offopp; /* pointer to off for opponent */
-extern int in[2]; /* number of men in inner table */
-extern int *inptr; /* pointer to in for current player */
-extern int *inopp; /* pointer to in for opponent */
-
-extern int ncin; /* number of characters in cin */
-extern char cin[100]; /* input line of current move
- (used for reconstructing input after
- a backspace) */
-
-extern const char *const color[];
- /* colors as strings */
-extern const char *const *colorptr; /* color of current player */
-extern const char *const *Colorptr; /* color of current player, capitalized */
-extern int colen; /* length of color of current player */
-
-extern struct sgttyb tty; /* tty information buffer */
-extern int old; /* original tty status */
-extern int noech; /* original tty status without echo */
-extern int raw; /* raw tty status, no echo */
-
-extern int curr; /* row position of cursor */
-extern int curc; /* column position of cursor */
-extern int begscr; /* 'beginning' of screen
- (not including board) */
-
-void getout(); /* function to exit backgammon cleanly */
diff --git a/games/backgammon/common_source/board.c b/games/backgammon/common_source/board.c
deleted file mode 100644
index 792b042..0000000
--- a/games/backgammon/common_source/board.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "back.h"
-
-static int i, j, k;
-static char ln[60];
-
-wrboard () {
- int l;
- static const char bl[] =
- "| | | |\n";
- static const char sv[] =
- "| | | | \n";
-
- fixtty (noech);
- clear();
-
- if (tflag) {
- fboard();
- goto lastline;
- }
-
- writel ("_____________________________________________________\n");
- writel (bl);
- strcpy (ln,bl);
- for (j = 1; j < 50; j += 4) {
- k = j/4+(j > 24? 12: 13);
- ln[j+1] = k%10+'0';
- ln[j] = k/10+'0';
- if (j == 21)
- j += 4;
- }
- writel (ln);
- for (i = 0; i < 5; i++) {
- strcpy (ln,sv);
- for (j = 1; j < 50; j += 4) {
- k = j/4+(j > 24? 12: 13);
- wrbsub ();
- if (j == 21)
- j += 4;
- }
- if (-board[25] > i)
- ln[26] = 'w';
- if (-board[25] > i+5)
- ln[25] = 'w';
- if (-board[25] > i+10)
- ln[27] = 'w';
- l = 53;
- if (off[1] > i || (off[1] < 0 && off[1]+15 > i)) {
- ln[54] = 'r';
- l = 55;
- }
- if (off[1] > i+5 || (off[1] < 0 && off[1]+15 > i+5)) {
- ln[55] = 'r';
- l = 56;
- }
- if (off[1] > i+10 || (off[1] < 0 && off[1]+15 > i+10)) {
- ln[56] = 'r';
- l = 57;
- }
- ln[l++] = '\n';
- ln[l] = '\0';
- writel (ln);
- }
- strcpy (ln,bl);
- ln[25] = 'B';
- ln[26] = 'A';
- ln[27] = 'R';
- writel (ln);
- strcpy (ln,sv);
- for (i = 4; i > -1; i--) {
- for (j = 1; j < 50; j += 4) {
- k = ((j > 24? 53: 49)-j)/4;
- wrbsub();
- if (j == 21)
- j += 4;
- }
- if (board[0] > i)
- ln[26] = 'r';
- if (board[0] > i+5)
- ln[25] = 'r';
- if (board[0] > i+10)
- ln[27] = 'r';
- l = 53;
- if (off[0] > i || (off[0] < 0 && off[0]+15 > i)) {
- ln[54] = 'w';
- l = 55;
- }
- if (off[0] > i+5 || (off[0] < 0 && off[0]+15 > i+5)) {
- ln[55] = 'w';
- l = 56;
- }
- if (off[0] > i+10 || (off[0] < 0 && off[0]+15 > i+10)) {
- ln[56] = 'w';
- l = 57;
- }
- ln[l++] = '\n';
- ln[l] = '\0';
- writel (ln);
- }
- strcpy (ln,bl);
- for (j = 1; j < 50; j += 4) {
- k = ((j > 24? 53: 49)-j)/4;
- ln[j+1] = k%10+'0';
- if (k > 9)
- ln[j] = k/10+'0';
- if (j == 21)
- j += 4;
- }
- writel (ln);
- writel ("|_______________________|___|_______________________|\n");
-
-lastline:
- gwrite ();
- if (tflag)
- curmove (18,0);
- else {
- writec ('\n');
- writec ('\n');
- }
- fixtty(raw);
-}
-
-wrbsub () {
- int m;
- char d;
-
- if (board[k] > 0) {
- m = board[k];
- d = 'r';
- } else {
- m = -board[k];
- d = 'w';
- }
- if (m>i)
- ln[j+1] = d;
- if (m>i+5)
- ln[j] = d;
- if (m>i+10)
- ln[j+2] = d;
-}
diff --git a/games/backgammon/common_source/check.c b/games/backgammon/common_source/check.c
deleted file mode 100644
index 70b9c62..0000000
--- a/games/backgammon/common_source/check.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-getmove () {
- int i, c;
-
- c = 0;
- for (;;) {
- i = checkmove(c);
-
- switch (i) {
- case -1:
- if (movokay(mvlim)) {
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- for (i = 0; i < mvlim; i++)
- if (h[i])
- wrhit(g[i]);
- nexturn();
- if (*offopp == 15)
- cturn *= -2;
- if (tflag && pnum)
- bflag = pnum;
- return;
- }
-
- case -4:
- case 0:
- if (tflag)
- refresh();
- if (i != 0 && i != -4)
- break;
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- writel (*Colorptr);
- if (i == -4)
- writel (" must make ");
- else
- writel (" can only make ");
- writec (mvlim+'0');
- writel (" move");
- if (mvlim > 1)
- writec ('s');
- writec ('.');
- writec ('\n');
- break;
-
- case -3:
- if (quit())
- return;
- }
-
- if (! tflag)
- proll ();
- else {
- curmove (cturn == -1? 18: 19,39);
- cline ();
- c = -1;
- }
- }
-}
-
-movokay (mv)
-int mv;
-
-{
- int i, m;
-
- if (d0)
- swap;
-
- for (i = 0; i < mv; i++) {
-
- if (p[i] == g[i]) {
- moverr (i);
- curmove (20,0);
- writel ("Attempt to move to same location.\n");
- return (0);
- }
-
- if (cturn*(g[i]-p[i]) < 0) {
- moverr (i);
- curmove (20,0);
- writel ("Backwards move.\n");
- return (0);
- }
-
- if (abs(board[bar]) && p[i] != bar) {
- moverr (i);
- curmove (20,0);
- writel ("Men still on bar.\n");
- return (0);
- }
-
- if ( (m = makmove(i)) ) {
- moverr (i);
- switch (m) {
-
- case 1:
- writel ("Move not rolled.\n");
- break;
-
- case 2:
- writel ("Bad starting position.\n");
- break;
-
- case 3:
- writel ("Destination occupied.\n");
- break;
-
- case 4:
- writel ("Can't remove men yet.\n");
- }
- return (0);
- }
- }
- return (1);
-}
diff --git a/games/backgammon/common_source/fancy.c b/games/backgammon/common_source/fancy.c
deleted file mode 100644
index e4aad24..0000000
--- a/games/backgammon/common_source/fancy.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdlib.h>
-#include <string.h>
-#include <termcap.h>
-#include "back.h"
-
-char PC; /* padding character */
-char *BC; /* backspace sequence */
-char *CD; /* clear to end of screen sequence */
-char *CE; /* clear to end of line sequence */
-char *CL; /* clear screen sequence */
-char *CM; /* cursor movement instructions */
-char *HO; /* home cursor sequence */
-char *MC; /* column cursor movement map */
-char *ML; /* row cursor movement map */
-char *ND; /* forward cursor sequence */
-char *UP; /* up cursor sequence */
-
-int lHO; /* length of HO */
-int lBC; /* length of BC */
-int lND; /* length of ND */
-int lUP; /* length of UP */
-int CO; /* number of columns */
-int LI; /* number of lines */
-int *linect; /* array of lengths of lines on screen
- (the actual screen is not stored) */
-
- /* two letter codes */
-char tcap[] = "bccdceclcmhomcmlndup";
- /* corresponding strings */
-char **tstr[] = { &BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP };
-
-int buffnum; /* pointer to output buffer */
-
-char tbuf[1024]; /* buffer for decoded termcap entries */
-
-int oldb[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-int oldr;
-int oldw;
- /* "real" cursor positions, so
- * it knows when to reposition.
- * These are -1 if curr and curc
- * are accurate */
-int realr;
-int realc;
-
-int addbuf(int);
-
-fboard () {
- int i, j, l;
-
- curmove (0,0); /* do top line */
- for (i = 0; i < 53; i++)
- fancyc ('_');
-
- curmove (15,0); /* do botttom line */
- for (i = 0; i < 53; i++)
- fancyc ('_');
-
- l = 1; /* do vertical lines */
- for (i = 52; i > -1; i -= 28) {
- curmove ( (l == 1? 1: 15) ,i);
- fancyc ('|');
- for (j = 0; j < 14; j++) {
- curmove (curr+l,curc-1);
- fancyc ('|');
- }
- if (i == 24)
- i += 32;
- l = -l; /* alternate directions */
- }
-
- curmove (2,1); /* label positions 13-18 */
- for (i = 13; i < 18; i++) {
- fancyc ('1');
- fancyc ((i % 10)+'0');
- curmove (curr,curc+2);
- }
- fancyc ('1');
- fancyc ('8');
-
- curmove (2,29); /* label positions 19-24 */
- fancyc ('1');
- fancyc ('9');
- for (i = 20; i < 25; i++) {
- curmove (curr,curc+2);
- fancyc ('2');
- fancyc ((i % 10)+'0');
- }
-
- curmove (14,1); /* label positions 12-7 */
- fancyc ('1');
- fancyc ('2');
- for (i = 11; i > 6; i--) {
- curmove (curr,curc+2);
- fancyc (i > 9? '1': ' ');
- fancyc ((i % 10)+'0');
- }
-
- curmove (14,30); /* label positions 6-1 */
- fancyc ('6');
- for (i = 5; i > 0; i--) {
- curmove (curr,curc+3);
- fancyc (i+'0');
- }
-
- for (i = 12; i > 6; i--) /* print positions 12-7 */
- if (board[i])
- bsect (board[i],13,1+4*(12-i),-1);
-
- if (board[0]) /* print red men on bar */
- bsect (board[0],13,25,-1);
-
- for (i = 6; i > 0; i--) /* print positions 6-1 */
- if (board[i])
- bsect (board[i],13,29+4*(6-i),-1);
-
- l = (off[1] < 0? off[1]+15: off[1]); /* print white's home */
- bsect (l,3,54,1);
-
- curmove (8,25); /* print the word BAR */
- fancyc ('B');
- fancyc ('A');
- fancyc ('R');
-
- for (i = 13; i < 19; i++) /* print positions 13-18 */
- if (board[i])
- bsect (board[i],3,1+4*(i-13),1);
-
- if (board[25]) /* print white's men on bar */
- bsect (board[25],3,25,1);
-
- for (i = 19; i < 25; i++) /* print positions 19-24 */
- if (board[i])
- bsect (board[i],3,29+4*(i-19),1);
-
- l = (off[0] < 0? off[0]+15: off[0]); /* print red's home */
- bsect (-l,13,54,-1);
-
- for (i = 0; i < 26; i++) /* save board position
- * for refresh later */
- oldb[i] = board[i];
- oldr = (off[1] < 0? off[1]+15: off[1]);
- oldw = -(off[0] < 0? off[0]+15: off[0]);
-}
-
-/*
- * bsect (b,rpos,cpos,cnext)
- * Print the contents of a board position. "b" has the value of the
- * position, "rpos" is the row to start printing, "cpos" is the column to
- * start printing, and "cnext" is positive if the position starts at the top
- * and negative if it starts at the bottom. The value of "cpos" is checked
- * to see if the position is a player's home, since those are printed
- * differently.
- */
-
-bsect (b,rpos,cpos,cnext)
-int b; /* contents of position */
-int rpos; /* row of position */
-int cpos; /* column of position */
-int cnext; /* direction of position */
-
-{
- int j; /* index */
- int n; /* number of men on position */
- int bct; /* counter */
- int k; /* index */
- char pc; /* color of men on position */
-
- n = abs(b); /* initialize n and pc */
- pc = (b > 0? 'r': 'w');
-
- if (n < 6 && cpos < 54) /* position cursor at start */
- curmove (rpos,cpos+1);
- else
- curmove (rpos,cpos);
-
- for (j = 0; j < 5; j++) { /* print position row by row */
-
- for (k = 0; k < 15; k += 5) /* print men */
- if (n > j+k)
- fancyc (pc);
-
- if (j < 4) { /* figure how far to
- * back up for next
- * row */
- if (n < 6) { /* stop if none left */
- if (j+1 == n)
- break;
- bct = 1; /* single column */
- } else {
- if (n < 11) { /* two columns */
- if (cpos == 54) { /* home pos */
- if (j+5 >= n)
- bct = 1;
- else
- bct = 2;
- }
- if (cpos < 54) { /* not home */
- if (j+6 >= n)
- bct = 1;
- else
- bct = 2;
- }
- } else { /* three columns */
- if (j+10 >= n)
- bct = 2;
- else
- bct = 3;
- }
- }
- curmove (curr+cnext,curc-bct); /* reposition cursor */
- }
- }
-}
-
-refresh() {
- int i, r, c;
-
- r = curr; /* save current position */
- c = curc;
-
- for (i = 12; i > 6; i--) /* fix positions 12-7 */
- if (board[i] != oldb[i]) {
- fixpos (oldb[i],board[i],13,1+(12-i)*4,-1);
- oldb[i] = board[i];
- }
-
- if (board[0] != oldb[0]) { /* fix red men on bar */
- fixpos (oldb[0],board[0],13,25,-1);
- oldb[0] = board[0];
- }
-
- for (i = 6; i > 0; i--) /* fix positions 6-1 */
- if (board[i] != oldb[i]) {
- fixpos (oldb[i],board[i],13,29+(6-i)*4,-1);
- oldb[i] = board[i];
- }
-
- i = -(off[0] < 0? off[0]+15: off[0]); /* fix white's home */
- if (oldw != i) {
- fixpos (oldw,i,13,54,-1);
- oldw = i;
- }
-
- for (i = 13; i < 19; i++) /* fix positions 13-18 */
- if (board[i] != oldb[i]) {
- fixpos (oldb[i],board[i],3,1+(i-13)*4,1);
- oldb[i] = board[i];
- }
-
- if (board[25] != oldb[25]) { /* fix white men on bar */
- fixpos (oldb[25],board[25],3,25,1);
- oldb[25] = board[25];
- }
-
- for (i = 19; i < 25; i++) /* fix positions 19-24 */
- if (board[i] != oldb[i]) {
- fixpos (oldb[i],board[i],3,29+(i-19)*4,1);
- oldb[i] = board[i];
- }
-
- i = (off[1] < 0? off[1]+15: off[1]); /* fix red's home */
- if (oldr != i) {
- fixpos (oldr,i,3,54,1);
- oldr = i;
- }
-
- curmove (r,c); /* return to saved position */
- newpos();
- buflush();
-}
-
-fixpos (old,new,r,c,inc)
-int old, new, r, c, inc;
-
-{
- int o, n, nv;
- int ov, nc;
- char col;
-
- if (old*new >= 0) {
- ov = abs(old);
- nv = abs(new);
- col = (old+new > 0? 'r': 'w');
- o = (ov-1)/5;
- n = (nv-1)/5;
- if (o == n) {
- if (o == 2)
- nc = c+2;
- if (o == 1)
- nc = c < 54? c: c+1;
- if (o == 0)
- nc = c < 54? c+1: c;
- if (ov > nv)
- fixcol (r+inc*(nv-n*5),nc,abs(ov-nv),' ',inc);
- else
- fixcol (r+inc*(ov-o*5),nc,abs(ov-nv),col,inc);
- return;
- } else {
- if (c < 54) {
- if (o+n == 1) {
- if (n) {
- fixcol (r,c,abs(nv-5),col,inc);
- if (ov != 5)
- fixcol (r+inc*ov,c+1,abs(ov-5),col,inc);
- } else {
- fixcol (r,c,abs(ov-5),' ',inc);
- if (nv != 5)
- fixcol (r+inc*nv,c+1,abs(nv-5),' ',inc);
- }
- return;
- }
- if (n == 2) {
- if (ov != 10)
- fixcol (r+inc*(ov-5),c,abs(ov-10),col,inc);
- fixcol (r,c+2,abs(nv-10),col,inc);
- } else {
- if (nv != 10)
- fixcol (r+inc*(nv-5),c,abs(nv-10),' ',inc);
- fixcol (r,c+2,abs(ov-10),' ',inc);
- }
- return;
- }
- if (n > o) {
- fixcol (r+inc*(ov%5),c+o,abs(5*n-ov),col,inc);
- if (nv != 5*n)
- fixcol (r,c+n,abs(5*n-nv),col,inc);
- } else {
- fixcol (r+inc*(nv%5),c+n,abs(5*n-nv),' ',inc);
- if (ov != 5*o)
- fixcol (r,c+o,abs(5*o-ov),' ',inc);
- }
- return;
- }
- }
- nv = abs(new);
- fixcol (r,c+1,nv,new > 0? 'r': 'w',inc);
- if (abs(old) <= abs(new))
- return;
- fixcol (r+inc*new,c+1,abs(old+new),' ',inc);
-}
-
-fixcol (r,c,l,ch,inc)
-int l, ch, r, c, inc;
-
-{
- int i;
-
- curmove (r,c);
- fancyc (ch);
- for (i = 1; i < l; i++) {
- curmove (curr+inc,curc-1);
- fancyc (ch);
- }
-}
-
-curmove (r,c)
-int r, c;
-
-{
- if (curr == r && curc == c)
- return;
- if (realr == -1) {
- realr = curr;
- realc = curc;
- }
- curr = r;
- curc = c;
-}
-
-newpos () {
- int r; /* destination row */
- int c; /* destination column */
- int mode = -1; /* mode of movement */
-
- int count = 1000; /* character count */
- int i; /* index */
- int j; /* index */
- int n; /* temporary variable */
- char *m; /* string containing CM movement */
-
-
- if (realr == -1) /* see if already there */
- return;
-
- r = curr; /* set current and dest. positions */
- c = curc;
- curr = realr;
- curc = realc;
-
- /* double check position */
- if (curr == r && curc == c) {
- realr = realc = -1;
- return;
- }
-
- if (CM) { /* try CM to get there */
- mode = 0;
- m = (char *)tgoto (CM,c,r);
- count = strlen (m);
- }
-
- /* try HO and local movement */
- if (HO && (n = r+c*lND+lHO) < count) {
- mode = 1;
- count = n;
- }
-
- /* try various LF combinations */
- if (r >= curr) {
- /* CR, LF, and ND */
- if ((n = (r-curr)+c*lND+1) < count) {
- mode = 2;
- count = n;
- }
- /* LF, ND */
- if (c >= curc && (n = (r-curr)+(c-curc)*lND) < count) {
- mode = 3;
- count = n;
- }
- /* LF, BS */
- if (c < curc && (n = (r-curr)+(curc-c)*lBC) < count) {
- mode = 4;
- count = n;
- }
- }
-
- /* try corresponding UP combinations */
- if (r < curr) {
- /* CR, UP, and ND */
- if ((n = (curr-r)*lUP+c*lND+1) < count) {
- mode = 5;
- count = n;
- }
- /* UP and ND */
- if (c >= curc && (n = (curr-r)*lUP+(c-curc)*lND) < count) {
- mode = 6;
- count = n;
- }
- /* UP and BS */
- if (c < curc && (n = (curr-r)*lUP+(curc-c)*lBC) < count) {
- mode = 7;
- count = n;
- }
- }
-
- /* space over */
- if (curr == r && c > curc && linect[r] < curc && c-curc < count)
- mode = 8;
-
- switch (mode) {
-
- case -1: /* error! */
- write (2,"\r\nInternal cursor error.\r\n",26);
- getout();
-
- /* direct cursor motion */
- case 0:
- tputs (m,abs(curr-r),addbuf);
- break;
-
- /* relative to "home" */
- case 1:
- tputs (HO,r,addbuf);
- for (i = 0; i < r; i++)
- addbuf ('\012');
- for (i = 0; i < c; i++)
- tputs (ND,1,addbuf);
- break;
-
- /* CR and down and over */
- case 2:
- addbuf ('\015');
- for (i = 0; i < r-curr; i++)
- addbuf ('\012');
- for (i = 0; i < c; i++)
- tputs (ND,1,addbuf);
- break;
-
- /* down and over */
- case 3:
- for (i = 0; i < r-curr; i++)
- addbuf ('\012');
- for (i = 0; i < c-curc; i++)
- tputs (ND,1,addbuf);
- break;
-
- /* down and back */
- case 4:
- for (i = 0; i < r-curr; i++)
- addbuf ('\012');
- for (i = 0; i < curc-c; i++)
- addbuf ('\010');
- break;
-
- /* CR and up and over */
- case 5:
- addbuf ('\015');
- for (i = 0; i < curr-r; i++)
- tputs (UP,1,addbuf);
- for (i = 0; i < c; i++)
- tputs (ND,1,addbuf);
- break;
-
- /* up and over */
- case 6:
- for (i = 0; i < curr-r; i++)
- tputs (UP,1,addbuf);
- for (i = 0; i < c-curc; i++)
- tputs (ND,1,addbuf);
- break;
-
- /* up and back */
- case 7:
- for (i = 0; i < curr-r; i++)
- tputs (UP,1,addbuf);
- for (i = 0; i < curc-c; i++) {
- if (BC)
- tputs (BC,1,addbuf);
- else
- addbuf ('\010');
- }
- break;
-
- /* safe space */
- case 8:
- for (i = 0; i < c-curc; i++)
- addbuf (' ');
- }
-
- /* fix positions */
- curr = r;
- curc = c;
- realr = -1;
- realc = -1;
-}
-
-clear () {
- int i;
-
- /* double space if can't clear */
- if (CL == 0) {
- writel ("\n\n");
- return;
- }
-
- curr = curc = 0; /* fix position markers */
- realr = realc = -1;
- for (i = 0; i < 24; i++) /* clear line counts */
- linect[i] = -1;
- buffnum = -1; /* ignore leftover buffer contents */
- tputs (CL,CO,addbuf); /* put CL in buffer */
-}
-
-
-fancyc (c)
-char c; /* character to output */
-{
- int sp; /* counts spaces in a tab */
-
- if (c == '\007') { /* bells go in blindly */
- addbuf (c);
- return;
- }
-
- /* process tabs, use spaces if the
- * the tab should be erasing things,
- * otherwise use cursor movement
- * routines. Note this does not use
- * hardware tabs at all. */
- if (c == '\t') {
- sp = (curc+8) & (~ 7); /* compute spaces */
- /* check line length */
- if (linect[curr] >= curc || sp < 4) {
- for (; sp > curc; sp--)
- addbuf (' ');
- curc = sp; /* fix curc */
- } else
- curmove (curr,sp);
- return;
- }
-
- /* do newline be calling newline */
- if (c == '\n') {
- newline();
- return;
- }
-
- /* ignore any other control chars */
- if (c < ' ')
- return;
-
- /* if an erasing space or non-space,
- * just add it to buffer. Otherwise
- * use cursor movement routine, so that
- * multiple spaces will be grouped
- * together */
- if (c > ' ' || linect[curr] >= curc) {
- newpos (); /* make sure position correct */
- addbuf (c); /* add character to buffer */
- /* fix line length */
- if (c == ' ' && linect[curr] == curc)
- linect[curr]--;
- else if (linect[curr] < curc)
- linect[curr] = curc;
- curc++; /* fix curc */
- } else
- /* use cursor movement routine */
- curmove (curr,curc+1);
-}
-
-clend() {
- int i;
- char *s;
-
-
- if (CD) {
- tputs (CD,CO-curr,addbuf);
- for (i = curr; i < LI; i++)
- linect[i] = -1;
- return;
- }
-
- curmove (i = curr,0);
- cline();
- while (curr < LI-1) {
- curmove (curr+1,0);
- if (linect[curr] > -1)
- cline ();
- }
- curmove (i,0);
-}
-
-cline () {
- int i;
- int c;
- char *s;
-
- if (curc > linect[curr])
- return;
- newpos ();
- if (CE) {
- tputs (CE,1,addbuf);
- linect[curr] = curc-1;
- } else {
- c = curc-1;
- while (linect[curr] > c) {
- addbuf (' ');
- curc++;
- linect[curr]--;
- }
- curmove (curr,c+1);
- }
-}
-
-newline () {
- cline();
- if (curr == LI-1)
- curmove (begscr,0);
- else
- curmove (curr+1,0);
-}
-
-int
-getcaps (s)
-const char *s;
-
-{
- char *code; /* two letter code */
- char ***cap; /* pointer to cap string */
- char *bufp; /* pointer to cap buffer */
- char tentry[1024]; /* temporary uncoded caps buffer */
-
- tgetent (tentry, (char *)s); /* get uncoded termcap entry */
-
- LI = tgetnum ("li"); /* get number of lines */
- if (LI == -1)
- LI = 12;
- CO = tgetnum ("co"); /* get number of columns */
- if (CO == -1)
- CO = 65;
-
- bufp = tbuf; /* get padding character */
- tgetstr ("pc",&bufp);
- if (bufp != tbuf)
- PC = *tbuf;
- else
- PC = 0;
-
- bufp = tbuf; /* get string entries */
- cap = tstr;
- for (code = tcap; *code; code += 2)
- **cap++ = (char *)tgetstr (code,&bufp);
-
- /* get pertinent lengths */
- if (HO)
- lHO = strlen (HO);
- if (BC)
- lBC = strlen (BC);
- else
- lBC = 1;
- if (UP)
- lUP = strlen (UP);
- if (ND)
- lND = strlen (ND);
- if (LI < 24 || CO < 72 || !(CL && UP && ND))
- return (0);
- linect = (int *)calloc (LI+1,sizeof(int));
- return (1);
-}
diff --git a/games/backgammon/common_source/init.c b/games/backgammon/common_source/init.c
deleted file mode 100644
index 24ee2a0..0000000
--- a/games/backgammon/common_source/init.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/cdefs.h>
-#include <termios.h>
-
-/*
- * variable initialization.
- */
-
- /* name of executable object programs */
-const char EXEC[] = "/usr/games/backgammon";
-const char TEACH[] = "/usr/games/teachgammon";
-
-int pnum = 2; /* color of player:
- -1 = white
- 1 = red
- 0 = both
- 2 = not yet init'ed */
-int acnt = 1; /* number of args */
-int aflag = 1; /* flag to ask for rules or instructions */
-int bflag = 0; /* flag for automatic board printing */
-int cflag = 0; /* case conversion flag */
-int hflag = 1; /* flag for cleaning screen */
-int mflag = 0; /* backgammon flag */
-int raflag = 0; /* 'roll again' flag for recovered game */
-int rflag = 0; /* recovered game flag */
-int tflag = 0; /* cursor addressing flag */
-int iroll = 0; /* special flag for inputting rolls */
-int rfl = 0;
-
-const char *const color[] = {"White","Red","white","red"};
-
-const char *const *Colorptr;
-const char *const *colorptr;
-int *inopp;
-int *inptr;
-int *offopp;
-int *offptr;
-char args[100];
-int bar;
-int begscr;
-int board[26];
-char cin[100];
-int colen;
-int cturn;
-int curc;
-int curr;
-int d0;
-int dice[2];
-int dlast;
-int g[5];
-int gvalue;
-int h[4];
-int home;
-int in[2];
-int mvl;
-int mvlim;
-int ncin;
-int off[2];
-int p[5];
-int rscore;
-int table[6][6];
-int wscore;
-struct termios tty, old, noech, raw;
diff --git a/games/backgammon/common_source/odds.c b/games/backgammon/common_source/odds.c
deleted file mode 100644
index f840376..0000000
--- a/games/backgammon/common_source/odds.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)odds.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-odds (r1,r2,val)
-int r1;
-int r2, val;
-{
- int i, j;
-
- if (r1 == 0) {
- for (i = 0; i < 6; i++)
- for (j = 0; j < 6; j++)
- table[i][j] = 0;
- return;
- } else {
- r1--;
- if (r2-- == 0)
- for (i = 0; i < 6; i++) {
- table[i][r1] += val;
- table[r1][i] += val;
- }
- else {
- table[r2][r1] += val;
- table[r1][r2] += val;
- }
- }
-}
-
-count () {
- int i;
- int j;
- int total;
-
- total = 0;
- for (i = 0; i < 6; i++)
- for (j = 0; j < 6; j++)
- total += table[i][j];
- return (total);
-}
-
-canhit (i,c)
-int i, c;
-
-{
- int j, k, b;
- int a, d, diff, place, addon, menstuck;
-
- if (c == 0)
- odds (0,0,0);
- if (board[i] > 0) {
- a = -1;
- b = 25;
- } else {
- a = 1;
- b = 0;
- }
- place = abs (25-b-i);
- menstuck = abs (board[b]);
- for (j = b; j != i; j += a) {
- if (board[j]*a > 0) {
- diff = abs(j-i);
- addon = place+((board[j]*a > 2 || j == b)? 5: 0);
- if ((j == b && menstuck == 1) &&
- (j != b && menstuck == 0))
- for (k = 1; k < diff; k++)
- if (k < 7 && diff-k < 7 &&
- (board[i+a*k]*a >= 0 ||
- board[i+a*(diff-k)] >= 0))
- odds (k,diff-k,addon);
- if ((j == b || menstuck < 2) && diff < 7)
- odds (diff,0,addon);
- }
- if (j == b && menstuck > 1)
- break;
- }
- return (count());
-}
diff --git a/games/backgammon/common_source/one.c b/games/backgammon/common_source/one.c
deleted file mode 100644
index e94c183..0000000
--- a/games/backgammon/common_source/one.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)one.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-makmove (i)
-int i;
-
-{
- int n, d;
- int max;
-
- d = d0;
- n = abs(g[i]-p[i]);
- max = (*offptr < 0? 7: last());
- if (board[p[i]]*cturn <= 0)
- return (checkd(d)+2);
- if (g[i] != home && board[g[i]]*cturn < -1)
- return (checkd(d)+3);
- if (i || D0 == D1) {
- if (n == max? D1 < n: D1 != n)
- return (checkd(d)+1);
- } else {
- if (n == max? D0 < n && D1 < n: D0 != n && D1 != n)
- return (checkd(d)+1);
- if (n == max? D0 < n: D0 != n) {
- if (d0)
- return (checkd(d)+1);
- swap;
- }
- }
- if (g[i] == home && *offptr < 0)
- return (checkd(d)+4);
- h[i] = 0;
- board[p[i]] -= cturn;
- if (g[i] != home) {
- if (board[g[i]] == -cturn) {
- board[home] -= cturn;
- board[g[i]] = 0;
- h[i] = 1;
- if (abs(bar-g[i]) < 7) {
- (*inopp)--;
- if (*offopp >= 0)
- *offopp -= 15;
- }
- }
- board[g[i]] += cturn;
- if (abs(home-g[i]) < 7 && abs(home-p[i]) > 6) {
- (*inptr)++;
- if (*inptr+*offptr == 0)
- *offptr += 15;
- }
- } else {
- (*offptr)++;
- (*inptr)--;
- }
- return (0);
-}
-
-moverr (i)
-int i;
-
-{
- int j;
-
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- writel ("Error: ");
- for (j = 0; j <= i; j++) {
- wrint (p[j]);
- writec ('-');
- wrint (g[j]);
- if (j < i)
- writec (',');
- }
- writel ("... ");
- movback (i);
-}
-
-
-checkd (d)
-int d;
-
-{
- if (d0 != d)
- swap;
- return (0);
-}
-
-last () {
- int i;
-
- for (i = home-6*cturn; i != home; i += cturn)
- if (board[i]*cturn > 0)
- return (abs(home-i));
-}
-
-movback (i)
-int i;
-
-{
- int j;
-
- for (j = i-1; j >= 0; j--)
- backone(j);
-}
-
-backone (i)
-int i;
-
-{
- board[p[i]] += cturn;
- if (g[i] != home) {
- board[g[i]] -= cturn;
- if (abs(g[i]-home) < 7 && abs(p[i]-home) > 6) {
- (*inptr)--;
- if (*inptr+*offptr < 15 && *offptr >= 0)
- *offptr -= 15;
- }
- } else {
- (*offptr)--;
- (*inptr)++;
- }
- if (h[i]) {
- board[home] += cturn;
- board[g[i]] = -cturn;
- if (abs(bar-g[i]) < 7) {
- (*inopp)++;
- if (*inopp+*offopp == 0)
- *offopp += 15;
- }
- }
-}
diff --git a/games/backgammon/common_source/save.c b/games/backgammon/common_source/save.c
deleted file mode 100644
index fe3475d..0000000
--- a/games/backgammon/common_source/save.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <fcntl.h>
-#include <errno.h>
-#include "back.h"
-
-static const char confirm[] = "Are you sure you want to leave now?";
-static const char prompt[] = "Enter a file name: ";
-static const char exist1[] = "The file '";
-static const char exist2[] =
- "' already exists.\nAre you sure you want to use this file?";
-static const char cantuse[] = "\nCan't use ";
-static const char saved[] = "This game has been saved on the file '";
-static const char type[] = "'.\nType \"backgammon ";
-static const char rec[] = "\" to recover your game.\n\n";
-static const char cantrec[] = "Can't recover file: ";
-
-save (n)
-int n;
-
-{
- int fdesc;
- char *fs;
- char fname[50];
-
- if (n) {
- if (tflag) {
- curmove (20,0);
- clend();
- } else
- writec ('\n');
- writel (confirm);
- if (! yorn(0))
- return;
- }
- cflag = 1;
- for (;;) {
- writel (prompt);
- fs = fname;
- while ((*fs = readc()) != '\n') {
- if (*fs == tty.sg_erase) {
- if (fs > fname) {
- fs--;
- if (tflag)
- curmove (curr,curc-1);
- else
- writec (*fs);
- } else
- writec ('\007');
- continue;
- }
- writec (*fs++);
- }
- *fs = '\0';
- if ((fdesc = open(fname,O_RDWR)) == -1 && errno == ENOENT) {
- if ((fdesc = creat (fname,0600)) != -1)
- break;
- }
- if (fdesc != -1) {
- if (tflag) {
- curmove (18,0);
- clend();
- } else
- writec ('\n');
- writel (exist1);
- writel (fname);
- writel (exist2);
- cflag = 0;
- close (fdesc);
- if (yorn (0)) {
- unlink (fname);
- fdesc = creat (fname,0700);
- break;
- } else {
- cflag = 1;
- continue;
- }
- }
- writel (cantuse);
- writel (fname);
- writel (".\n");
- close (fdesc);
- cflag = 1;
- }
- write (fdesc,board,sizeof board);
- write (fdesc,off,sizeof off);
- write (fdesc,in,sizeof in);
- write (fdesc,dice,sizeof dice);
- write (fdesc,&cturn,sizeof cturn);
- write (fdesc,&dlast,sizeof dlast);
- write (fdesc,&pnum,sizeof pnum);
- write (fdesc,&rscore,sizeof rscore);
- write (fdesc,&wscore,sizeof wscore);
- write (fdesc,&gvalue,sizeof gvalue);
- write (fdesc,&raflag,sizeof raflag);
- close (fdesc);
- if (tflag)
- curmove (18,0);
- writel (saved);
- writel (fname);
- writel (type);
- writel (fname);
- writel (rec);
- if (tflag)
- clend();
- getout ();
-}
-
-int
-recover (s)
-const char *s;
-
-{
- int i;
- int fdesc;
-
- if ((fdesc = open (s,O_RDONLY)) == -1)
- norec (s);
- read (fdesc,board,sizeof board);
- read (fdesc,off,sizeof off);
- read (fdesc,in,sizeof in);
- read (fdesc,dice,sizeof dice);
- read (fdesc,&cturn,sizeof cturn);
- read (fdesc,&dlast,sizeof dlast);
- read (fdesc,&pnum,sizeof pnum);
- read (fdesc,&rscore,sizeof rscore);
- read (fdesc,&wscore,sizeof wscore);
- read (fdesc,&gvalue,sizeof gvalue);
- read (fdesc,&raflag,sizeof raflag);
- close (fdesc);
- rflag = 1;
-}
-
-int
-norec (s)
-const char *s;
-
-{
- const char *c;
-
- tflag = 0;
- writel (cantrec);
- c = s;
- while (*c != '\0')
- writec (*c++);
- getout ();
-}
diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c
deleted file mode 100644
index 3a1c599..0000000
--- a/games/backgammon/common_source/subs.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "back.h"
-
-int buffnum;
-char outbuff[BUFSIZ];
-
-static const char plred[] = "Player is red, computer is white.";
-static const char plwhite[] = "Player is white, computer is red.";
-static const char nocomp[] = "(No computer play.)";
-
-const char *const descr[] = {
- "usage: backgammon [-h n r w b pr pw pb tterm sfile]\n",
- "\t-h\tgets this list\n\t-n\tdon't ask for rules or instructions",
- "\t-r\tplayer is red (implies -n)\n\t-w\tplayer is white (implies -n)",
- "\t-b\ttwo players, red and white (implies -n)",
- "\t-pr\tprint the board before red's turn",
- "\t-pw\tprint the board before white's turn",
- "\t-pb\tprint the board before both player's turn",
- "\t-tterm\tterminal is a term",
- "\t-sfile\trecover saved game from file",
- 0
-};
-
-errexit (s)
-char *s;
-{
- write (2,"\n",1);
- perror (s);
- getout();
-}
-
-int addbuf (c)
-int c;
-
-{
- buffnum++;
- if (buffnum == BUFSIZ) {
- if (write(1,outbuff,BUFSIZ) != BUFSIZ)
- errexit ("addbuf (write):");
- buffnum = 0;
- }
- outbuff[buffnum] = c;
- return (0);
-}
-
-buflush () {
- if (buffnum < 0)
- return;
- buffnum++;
- if (write (1,outbuff,buffnum) != buffnum)
- errexit ("buflush (write):");
- buffnum = -1;
-}
-
-readc () {
- char c;
-
- if (tflag) {
- cline();
- newpos();
- }
- buflush();
- if (read(0,&c,1) != 1)
- errexit ("readc");
-#ifdef WHY_IS_THIS_HARDWIRED_IN_HERE
- if (c == '\177')
- getout();
-#endif
- if (c == '\033' || c == '\015')
- return ('\n');
- if (cflag)
- return (c);
- if (c == '\014')
- return ('R');
- if (c >= 'a' && c <= 'z')
- return (c & 0137);
- return (c);
-}
-
-writec (c)
-char c;
-{
- if (tflag)
- fancyc (c);
- else
- addbuf (c);
-}
-
-void
-writel (l)
-const char *l;
-{
-#ifdef DEBUG
- const char *s;
-
- if (trace == NULL)
- trace = fopen ("bgtrace","w");
-
- fprintf (trace,"writel: \"");
- for (s = l; *s; s++) {
- if (*s < ' ' || *s == '\177')
- fprintf (trace,"^%c",(*s)^0100);
- else
- putc (*s,trace);
- }
- fprintf (trace,"\"\n");
- fflush (trace);
-#endif
-
- while (*l)
- writec (*l++);
-}
-
-proll () {
- if (d0)
- swap;
- if (cturn == 1)
- writel ("Red's roll: ");
- else
- writel ("White's roll: ");
- writec (D0+'0');
- writec ('\040');
- writec (D1+'0');
- if (tflag)
- cline();
-}
-
-wrint (n)
-int n;
-{
- int i, j, t;
-
- for (i = 4; i > 0; i--) {
- t = 1;
- for (j = 0; j<i; j++)
- t *= 10;
- if (n > t-1)
- writec ((n/t)%10+'0');
- }
- writec (n%10+'0');
-}
-
-gwrite() {
- int r, c;
-
- if (tflag) {
- r = curr;
- c = curc;
- curmove (16,0);
- }
-
- if (gvalue > 1) {
- writel ("Game value: ");
- wrint (gvalue);
- writel (". ");
- if (dlast == -1)
- writel (color[0]);
- else
- writel (color[1]);
- writel (" doubled last.");
- } else {
- switch (pnum) {
- case -1: /* player is red */
- writel (plred);
- break;
- case 0: /* player is both colors */
- writel (nocomp);
- break;
- case 1: /* player is white */
- writel (plwhite);
- }
- }
-
- if (rscore || wscore) {
- writel (" ");
- wrscore();
- }
-
- if (tflag) {
- cline();
- curmove (r,c);
- }
-}
-
-quit () {
- int i;
-
- if (tflag) {
- curmove (20,0);
- clend();
- } else
- writec ('\n');
- writel ("Are you sure you want to quit?");
- if (yorn (0)) {
- if (rfl) {
- writel ("Would you like to save this game?");
- if (yorn(0))
- save(0);
- }
- cturn = 0;
- return (1);
- }
- return (0);
-}
-
-yorn (special)
-char special; /* special response */
-{
- char c;
- int i;
-
- i = 1;
- while ( (c = readc()) != 'Y' && c != 'N') {
- if (special && c == special)
- return (2);
- if (i) {
- if (special) {
- writel (" (Y, N, or ");
- writec (special);
- writec (')');
- } else
- writel (" (Y or N)");
- i = 0;
- } else
- writec ('\007');
- }
- if (c == 'Y')
- writel (" Yes.\n");
- else
- writel (" No.\n");
- if (tflag)
- buflush();
- return (c == 'Y');
-}
-
-wrhit (i)
-int i;
-{
- writel ("Blot hit on ");
- wrint (i);
- writec ('.');
- writec ('\n');
-}
-
-nexturn () {
- int c;
-
- cturn = -cturn;
- c = cturn/abs(cturn);
- home = bar;
- bar = 25-bar;
- offptr += c;
- offopp -= c;
- inptr += c;
- inopp -= c;
- Colorptr += c;
- colorptr += c;
-}
-
-getarg (argc, argv)
-int argc;
-char **argv;
-
-{
- char ch;
- extern int optind;
- extern char *optarg;
- int i;
-
- /* process arguments here. dashes are ignored, nbrw are ignored
- if the game is being recovered */
-
- while ((ch = getopt (argc, argv, "nbrwp:t:s:h")) != -1) {
- switch (ch) {
-
- /* don't ask if rules or instructions needed */
- case 'n':
- if (rflag)
- break;
- aflag = 0;
- args[acnt++] = strdup ("-n");
- break;
-
- /* player is both red and white */
- case 'b':
- if (rflag)
- break;
- pnum = 0;
- aflag = 0;
- args[acnt++] = strdup ("-b");
- break;
-
- /* player is red */
- case 'r':
- if (rflag)
- break;
- pnum = -1;
- aflag = 0;
- args[acnt++] = strdup ("-r");
- break;
-
- /* player is white */
- case 'w':
- if (rflag)
- break;
- pnum = 1;
- aflag = 0;
- args[acnt++] = strdup ("-w");
- break;
-
- /* print board after move according to following character */
- case 'p':
- if (optarg[0] != 'r' && optarg[0] != 'w' && optarg[0] != 'b')
- break;
- args[acnt] = strdup ("-p ");
- args[acnt++][2] = optarg[0];
- if (optarg[0] == 'r')
- bflag = 1;
- if (optarg[0] == 'w')
- bflag = -1;
- if (optarg[0] == 'b')
- bflag = 0;
- break;
-
- case 't':
- tflag = getcaps (optarg);
- break;
-
- case 's':
- /* recover file */
- recover (optarg);
- break;
- case 'h':
- for (i = 0; descr[i] != 0; i++)
- puts (descr[i]);
- getout();
- }
- }
- argc -= optind;
- argv += optind;
- if ( argc && argv[0][0] != '\0' )
- recover(argv[0]);
-}
-
-init () {
- int i;
- for (i = 0; i < 26;)
- board[i++] = 0;
- board[1] = 2;
- board[6] = board[13] = -5;
- board[8] = -3;
- board[12] = board[19] = 5;
- board[17] = 3;
- board[24] = -2;
- off[0] = off[1] = -15;
- in[0] = in[1] = 5;
- gvalue = 1;
- dlast = 0;
-}
-
-wrscore () {
- writel ("Score: ");
- writel (color[1]);
- writec (' ');
- wrint (rscore);
- writel (", ");
- writel (color[0]);
- writec (' ');
- wrint (wscore);
-}
-
-fixtty (mode)
-int mode;
-{
- if (tflag)
- newpos();
- buflush();
- tty.sg_flags = mode;
- if (stty (0,&tty) < 0)
- errexit("fixtty");
-}
-
-void
-getout () {
- /* go to bottom of screen */
- if (tflag) {
- curmove (23,0);
- cline();
- } else
- writec ('\n');
-
- /* fix terminal status */
- fixtty (old);
- exit(0);
-}
-roll () {
- char c;
- int row;
- int col;
-
- if (iroll) {
- if (tflag) {
- row = curr;
- col = curc;
- curmove (17,0);
- } else
- writec ('\n');
- writel ("ROLL: ");
- c = readc();
- if (c != '\n') {
- while (c < '1' || c > '6')
- c = readc();
- D0 = c-'0';
- writec (' ');
- writec (c);
- c = readc();
- while (c < '1' || c > '6')
- c = readc();
- D1 = c-'0';
- writec (' ');
- writec (c);
- if (tflag) {
- curmove (17,0);
- cline();
- curmove (row,col);
- } else
- writec ('\n');
- return;
- }
- if (tflag) {
- curmove (17,0);
- cline();
- curmove (row,col);
- } else
- writec ('\n');
- }
- D0 = rnum(6)+1;
- D1 = rnum(6)+1;
- d0 = 0;
-}
diff --git a/games/backgammon/common_source/table.c b/games/backgammon/common_source/table.c
deleted file mode 100644
index 572cba3..0000000
--- a/games/backgammon/common_source/table.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-const char *const help2[] = {
- " Enter moves as <s>-<f> or <s>/<r> where <s> is the starting",
- "position, <f> is the finishing position, and <r> is the roll.",
- "Remember, each die roll must be moved separately.",
- 0
-};
-
-struct state {
- char ch;
- int fcode;
- int newst;
-};
-
-static const struct state atmata[] = {
-
- 'R', 1, 0, '?', 7, 0, 'Q', 0, -3, 'B', 8, 25,
- '9', 2, 25, '8', 2, 25, '7', 2, 25, '6', 2, 25,
- '5', 2, 25, '4', 2, 25, '3', 2, 25, '2', 2, 19,
- '1', 2, 15, '0', 2, 25, '.', 0, 0, '9', 2, 25,
- '8', 2, 25, '7', 2, 25, '6', 2, 25, '5', 2, 25,
-
- '4', 2, 25, '3', 2, 25, '2', 2, 25, '1', 2, 25,
- '0', 2, 25, '/', 0, 32, '-', 0, 39, '.', 0, 0,
- '/', 5, 32, ' ', 6, 3, ',', 6, 3, '\n', 0, -1,
- '6', 3, 28, '5', 3, 28, '4', 3, 28, '3', 3, 28,
- '2', 3, 28, '1', 3, 28, '.', 0, 0, 'H', 9, 61,
-
- '9', 4, 61, '8', 4, 61, '7', 4, 61, '6', 4, 61,
- '5', 4, 61, '4', 4, 61, '3', 4, 61, '2', 4, 53,
- '1', 4, 51, '0', 4, 61, '.', 0, 0, '9', 4, 61,
- '8', 4, 61, '7', 4, 61, '6', 4, 61, '5', 4, 61,
- '4', 4, 61, '3', 4, 61, '2', 4, 61, '1', 4, 61,
-
- '0', 4, 61, ' ', 6, 3, ',', 6, 3, '-', 5, 39,
- '\n', 0, -1, '.', 0, 0
-};
-
-checkmove (ist)
-
-int ist;
-
-{
- int j, n;
- char c;
- char a;
-
-domove:
- if (ist == 0) {
- if (tflag)
- curmove (curr,32);
- else
- writel ("\t\t");
- writel ("Move: ");
- }
- ist = mvl = ncin = 0;
- for (j = 0; j < 5; j++)
- p[j] = g[j] = -1;
-
-dochar:
- c = readc();
-
- if (c == 'S') {
- raflag = 0;
- save (1);
- if (tflag) {
- curmove (cturn == -1? 18: 19,39);
- ist = -1;
- goto domove;
- } else {
- proll ();
- ist = 0;
- goto domove;
- }
- }
-
- if (c == tty.sg_erase && ncin > 0) {
- if (tflag)
- curmove (curr,curc-1);
- else {
- if (tty.sg_erase == '\010')
- writel ("\010 \010");
- else
- writec (cin[ncin-1]);
- }
- ncin--;
- n = rsetbrd();
- if (n == 0) {
- n = -1;
- if (tflag)
- refresh();
- }
- if ((ist = n) > 0)
- goto dochar;
- goto domove;
- }
-
- if (c == tty.sg_kill && ncin > 0) {
- if (tflag) {
- refresh();
- curmove (curr,39);
- ist = -1;
- goto domove;
- } else if (tty.sg_erase == '\010') {
- for (j = 0; j < ncin; j++)
- writel ("\010 \010");
- ist = -1;
- goto domove;
- } else {
- writec ('\\');
- writec ('\n');
- proll ();
- ist = 0;
- goto domove;
- }
- }
-
- n = dotable(c,ist);
- if (n >= 0) {
- cin[ncin++] = c;
- if (n > 2)
- if ((! tflag) || c != '\n')
- writec (c);
- ist = n;
- if (n)
- goto dochar;
- else
- goto domove;
- }
-
- if (n == -1 && mvl >= mvlim)
- return(0);
- if (n == -1 && mvl < mvlim-1)
- return(-4);
-
- if (n == -6) {
- if (! tflag) {
- if (movokay(mvl+1)) {
- wrboard();
- movback (mvl+1);
- }
- proll ();
- writel ("\t\tMove: ");
- for (j = 0; j < ncin;)
- writec (cin[j++]);
- } else {
- if (movokay(mvl+1)) {
- refresh();
- movback (mvl+1);
- } else
- curmove (cturn == -1? 18:19,ncin+39);
- }
- ist = n = rsetbrd();
- goto dochar;
- }
-
- if (n != -5)
- return(n);
- writec ('\007');
- goto dochar;
-}
-
-dotable (c,i)
-char c;
-int i;
-
-{
- int a, j;
- int test;
-
- test = (c == 'R');
-
- while ( (a = atmata[i].ch) != '.') {
- if (a == c || (test && a == '\n')) {
- switch (atmata[i].fcode) {
-
- case 1:
- wrboard();
- if (tflag) {
- curmove (cturn == -1? 18: 19,0);
- proll ();
- writel ("\t\t");
- } else
- proll ();
- break;
-
- case 2:
- if (p[mvl] == -1)
- p[mvl] = c-'0';
- else
- p[mvl] = p[mvl]*10+c-'0';
- break;
-
- case 3:
- if (g[mvl] != -1) {
- if (mvl < mvlim)
- mvl++;
- p[mvl] = p[mvl-1];
- }
- g[mvl] = p[mvl]+cturn*(c-'0');
- if (g[mvl] < 0)
- g[mvl] = 0;
- if (g[mvl] > 25)
- g[mvl] = 25;
- break;
-
- case 4:
- if (g[mvl] == -1)
- g[mvl] = c-'0';
- else
- g[mvl] = g[mvl]*10+c-'0';
- break;
-
- case 5:
- if (mvl < mvlim)
- mvl++;
- p[mvl] = g[mvl-1];
- break;
-
- case 6:
- if (mvl < mvlim)
- mvl++;
- break;
-
- case 7:
- if (tflag)
- curmove (20,0);
- else
- writec ('\n');
- text (help2);
- if (tflag) {
- curmove (cturn == -1? 18: 19,39);
- } else {
- writec ('\n');
- proll();
- writel ("\t\tMove: ");
- }
- break;
-
- case 8:
- p[mvl] = bar;
- break;
-
- case 9:
- g[mvl] = home;
- }
-
- if (! test || a != '\n')
- return (atmata[i].newst);
- else
- return (-6);
- }
-
- i++;
- }
-
- return (-5);
-}
-
-rsetbrd () {
- int i, j, n;
-
- n = 0;
- mvl = 0;
- for (i = 0; i < 4; i++)
- p[i] = g[i] = -1;
- for (j = 0; j < ncin; j++)
- n = dotable (cin[j],n);
- return (n);
-}
diff --git a/games/backgammon/teachgammon/Makefile b/games/backgammon/teachgammon/Makefile
deleted file mode 100644
index 56ceb88..0000000
--- a/games/backgammon/teachgammon/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= teachgammon
-CFLAGS+=-DV7 -I${.CURDIR}/../common_source
-SRCS= allow.c board.c check.c data.c fancy.c init.c odds.c one.c save.c \
- subs.c table.c teach.c ttext1.c ttext2.c tutor.c
-DPADD= ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD= -ltermcap -lcompat
-HIDEGAME=hidegame
-NOMAN= noman
-
-.PATH: ${.CURDIR}/../common_source
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/backgammon/teachgammon/data.c b/games/backgammon/teachgammon/data.c
deleted file mode 100644
index 4f9151a..0000000
--- a/games/backgammon/teachgammon/data.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "tutor.h"
-
-int maxmoves = 23;
-
-const char *const text0[] = {
- "To start the game, I roll a 3, and you roll a 1. This means",
- "that I get to start first. I move 8-5,6-5 since this makes a",
- "new point and helps to trap your back men on 1. You should be",
- "able to do a similar move with your roll.",
- 0
-};
-
-const char *const text1[] = {
- "Now you shall see a move using doubles. I just rolled double",
- "5's. I will move two men from position 13 to position 3. The",
- "notation for this is 13-8,13-8,8-3,8-3. You will also roll dou-",
- "bles, but you will be able to make a much stronger move.",
- 0
-};
-
-const char *const text2[] = {
- "Excellent! As you can see, you are beginning to develop a wall",
- "which is trapping my men on position 24. Also, moving your back",
- "men forward not only improves your board position safely, but it",
- "thwarts my effort to make a wall.",
- "",
- "My roll now is 5 6. Normally, I would use that roll to move from",
- "position 24 to position 13 (24-18-13), but your new point prevents",
- "that. Instead, I am forced to move from 13 to 2, where my man is",
- "open but cannot be hit.",
- 0
-};
-
-const char *const text3[] = {
- "As you can see, although you left a man open, it is a rela-",
- "tively safe move to an advantageous position, which might help",
- "you make a point later. Only two rolls (4 5 or 5 4) will allow",
- "me to hit you. With an unprecedented amount of luck, I happen",
- "to roll a 4 5 and hit you as just mentioned.",
- 0
-};
-
-const char *const text4[] = {
- "You're pretty lucky yourself, you know. I follow by rolling 2 3",
- "and moving 25-22,24-22, forming a new point.",
- 0
-};
-
-const char *const text5[] = {
- "Not a spectacular move, but a safe one. I follow by rolling 6 1.",
- "I decide to use this roll to move 22-16,16-15. It leaves me with",
- "one man still open, but the blot is farther back on the board, and",
- "would suffer less of a loss by being hit.",
- 0
-};
-
-const char *const text6[] = {
- "By moving your two men from 17 to 20, you lessen my chance of",
- "getting my man off the board. In fact, the odds are 5 to 4",
- "against me getting off. I roll with the odds and helplessly",
- "receive a 3 5.",
- 0
-};
-
-const char *const text7[] = {
- "Note that the blot on 7 cannot be hit unless I get off the bar",
- "and have a 1 or a 6 left over, and doing so will leave two of",
- "my men open. Also, the blot on 16 cannot be hit at all! With",
- "a sigh of frustration, I roll double 6's and remain immobile.",
- 0
-};
-
-const char *const text8[] = {
- "See, you did not get hit and, you got to 'cover up' your open men.",
- "Quite an accomplishment. Finally, I get off the bar by rolling",
- "6 2 and moving 25-23,23-17.",
- 0
-};
-
-const char *const text9[] = {
- "My venture off the bar did not last long. However, I got lucky",
- "and rolled double 1's, allowing me to move 25-24,24-23,15-14,15-14.",
- 0
-};
-
-const char *const text10[] = {
- "You are improving your position greatly and safely, and are well",
- "on the way to winning the game. I roll a 6 2 and squeak past",
- "your back man. Now the game becomes a race to the finish.",
- 0
-};
-
-const char *const text11[] = {
- "Now that it is merely a race, you are trying to get as many men",
- "as possible into the inner table, so you can start removing them.",
- "I roll a 3 4 and move my two men farthest back to position 11",
- "(15-11,14-11).",
- 0
-};
-
-const char *const text12[] = {
- "The race is still on, and you have seem to be doing all right.",
- "I roll 6 1 and move 14-8,13-12.",
- 0
-};
-
-const char *const text13[] = {
- "Notice that you get to remove men the instant you have all of",
- "them at your inner table, even if it is the middle of a turn.",
- "I roll 1 2 and move 13-11,12-11.",
- 0
-};
-
-const char *const text14[] = {
- "Although you could have removed a man, this move illustrates two",
- "points: 1) You never have to remove men, and 2) You should try",
- "to spread out your men on your inner table. Since you have one",
- "man on each position, you should be able to remove at least two",
- "men next turn. I roll 2 5 and move 8-6,11-6.",
- 0
-};
-
-const char *const text15[] = {
- "This time you were able to remove men. I roll 3 4 and move",
- "11-7,11-8. The race continues.",
- 0
-};
-
-const char *const text16[] = {
- "More holes are opening up in your inner table, but you are",
- "still very much ahead. If we were doubling, you would have",
- "doubled long ago. I roll 2 6 and move 8-6,11-5.",
- 0
-};
-
-const char *const text17[] = {
- "It pays to spread out your men. I roll 3 5 and move 7-4,8-3.",
- 0
-};
-
-const char *const text18[] = {
- "You can only remove some men, but you spread out more and",
- "more, in order to be able to remove men more efficiently.",
- "I roll double 3's, which help, but not that much. I move",
- "8-5,3-0,3-0,3-0.",
- 0
-};
-
-const char *const text19[] = {
- "I roll 1 4 and move 5-4,4-0.",
- 0
-};
-
-const char *const text20[] = {
- "You are now nicely spread out to win a game. I roll 5 6 and",
- "move 5-0,6-0.",
- 0
-};
-
-const char *const text21[] = {
- "Any minute now. Just a few short steps from victory. I roll",
- "2 4 and move 6-4,4-0.",
- 0
-};
-
-const char *const text22[] = {
- "It looks pretty hopeless for me, but I play on, rolling 1 3 and",
- "moving 4-3,3-0.",
- 0
-};
-
-const char *const text23[] = {
- "Congratulations! You just won a game of backgammon against the",
- "computer! You will now be able to play a game, but remember,",
- "when you start playing, that doubling will be enabled, which",
- "will add another factor to the game... Good luck!!",
- "",
- 0
-};
-
-const struct situatn test[] = {
- {
- {0,2,0,0,0,0,-5,0,-3,0,0,0,5,-5,0,0,0,3,0,5,0,0,0,0,-2,0},
- 3, 1, {8,6,0,0}, {5,5,0,0}, 4, 2, text0
- },
- {
- {0,2,0,0,0,-2,-4,0,-2,0,0,0,5,-5,0,0,0,2,0,4,0,2,0,0,-2,0},
- 5, 5, {13,13,8,8}, {8,8,3,3}, 6, 6, text1
- },
- {
- {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-3,0,0,0,2,2,4,0,2,0,0,-2,0},
- 6, 5, {13,8,0,0}, {8,2,0,0}, 1, 2, text2
- },
- {
- {0,0,-1,-2,0,-2,-4,2,-2,0,0,0,2,-2,0,1,0,2,2,4,0,2,0,0,-2,0},
- 4, 5, {24,20,0,0}, {20,15,0,0}, 2, 5, text3
- },
- {
- {0,0,0,-2,0,-2,-4,3,-2,0,0,0,2,-2,0,-1,0,2,2,4,0,2,0,0,-1,-1},
- 2, 3, {25,24,0,0}, {22,22,0,0}, 4, 1, text4
- },
- {
- {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-1,0,2,2,4,0,2,-2,0,0,0},
- 6, 1, {22,16,0,0}, {16,15,0,0}, 3, 3, text5
- },
- {
- {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-2,0,0,2,2,2,2,2,0,0,-1},
- 3, 5, {0,0,0,0}, {0,0,0,0}, 5, 4, text6
- },
- {
- {0,0,0,-2,0,-2,-4,1,-2,0,0,0,3,-2,0,-2,1,0,2,2,2,2,2,0,0,-1},
- 6, 6, {0,0,0,0}, {0,0,0,0}, 3, 6, text7
- },
- {
- {0,0,0,-2,0,-2,-4,0,-2,0,0,0,3,-2,0,-2,2,0,2,2,2,2,2,0,0,-1},
- 2, 6, {25,23,0,0}, {23,17,0,0}, 5, 1, text8
- },
- {
- {0,0,0,-2,0,-2,-4,0,-2,0,0,0,2,-2,0,-2,2,0,3,2,2,2,2,0,0,-1},
- 1, 1, {25,24,15,15}, {24,23,14,14}, 4, 6, text9
- },
- {
- {0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,0,3,0,4,2,2,2,2,-1,0,0},
- 6, 2, {23,17,0,0}, {17,15,0,0}, 1, 3, text10
- },
- {
- {0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,-1,2,0,3,4,2,2,2,0,0,0},
- 4, 3, {15,14,0,0}, {11,11,0,0}, 5, 3, text11
- },
- {
- {0,0,0,-2,0,-2,-4,0,-2,0,0,-2,0,-2,-1,0,0,0,3,5,2,3,2,0,0,0},
- 6, 1, {14,13,0,0}, {8,12,0,0}, 4, 4, text12
- },
- {
- {0,0,0,-2,0,-2,-4,0,-3,0,0,-2,-1,-1,0,0,0,0,0,5,2,2,5,0,0,0},
- 2, 1, {13,12,0,0}, {11,11,0,0}, 2, 1, text13
- },
- {
- {0,0,0,-2,0,-2,-4,0,-3,0,0,-4,0,0,0,0,0,0,0,5,2,2,3,1,1,0},
- 2, 5, {8,11,0,0}, {6,6,0,0}, 6, 3, text14
- },
- {
- {0,0,0,-2,0,-2,-6,0,-2,0,0,-3,0,0,0,0,0,0,0,4,2,2,2,1,1,0},
- 4, 3, {11,11,0,0}, {7,8,0,0}, 2, 5, text15
- },
- {
- {0,0,0,-2,0,-2,-6,-1,-3,0,0,-1,0,0,0,0,0,0,0,4,1,2,2,0,1,0},
- 2, 6, {8,11,0,0}, {6,5,0,0}, 6, 1, text16
- },
- {
- {0,0,0,-2,0,-3,-7,-1,-2,0,0,0,0,0,0,0,0,0,0,3,1,2,2,0,0,0},
- 5, 3, {8,7,0,0}, {3,4,0,0}, 5, 2, text17
- },
- {
- {0,0,0,-3,-1,-3,-7,0,-1,0,0,0,0,0,0,0,0,0,0,3,0,1,2,1,0,0},
- 3, 3, {8,3,3,3}, {5,0,0,0}, 1, 6, text18
- },
- {
- {0,0,0,0,-1,-4,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,0,0},
- 1, 4, {4,5,0,0}, {0,4,0,0}, 2, 3, text19
- },
- {
- {0,0,0,0,-1,-3,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0},
- 5, 6, {6,5,0,0}, {0,0,0,0}, 1, 4, text20
- },
- {
- {0,0,0,0,-1,-2,-6,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0},
- 2, 4, {4,6,0,0}, {0,4,0,0}, 6, 2, text21
- },
- {
- {0,0,0,0,-1,-2,-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0},
- 3, 1, {4,3,0,0}, {3,0,0,0}, 4, 3, text22
- },
- {
- {0,0,0,0,0,-2,-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- 0, 0, {0,0,0,0}, {0,0,0,0}, 0, 0, text23
- }
-};
diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c
deleted file mode 100644
index f8dc85e..0000000
--- a/games/backgammon/teachgammon/teach.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include <sys/types.h>
-#include <termcap.h>
-#include <unistd.h>
-#include <signal.h>
-#include "back.h"
-
-extern char *hello[];
-extern char *list[];
-extern char *intro1[];
-extern char *intro2[];
-extern char *moves[];
-extern char *remove[];
-extern char *hits[];
-extern char *endgame[];
-extern char *doubl[];
-extern char *stragy[];
-extern char *prog[];
-extern char *lastch[];
-
-const char *const helpm[] = {
- "\nEnter a space or newline to roll, or",
- " b to display the board",
- " d to double",
- " q to quit\n",
- 0
-};
-
-const char *const contin[] = {
- "",
- 0
-};
-
-main (argc,argv)
-int argc;
-char **argv;
-
-{
- int i;
-
- /* revoke privs */
- setgid(getgid());
-
- acnt = 1;
- signal (SIGINT,getout);
- if (gtty (0,&tty) == -1) /* get old tty mode */
- errexit ("teachgammon(gtty)");
- old = tty.sg_flags;
-#ifdef V7
- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */
-#else
- raw = ((noech = old & ~ECHO) | RAW); /* set up modes */
-#endif
- ospeed = tty.sg_ospeed; /* for termlib */
- tflag = getcaps (getenv ("TERM"));
- getarg (argc, argv);
- if (tflag) {
- noech &= ~(CRMOD|XTABS);
- raw &= ~(CRMOD|XTABS);
- clear();
- }
- text (hello);
- text (list);
- i = text (contin);
- if (i == 0)
- i = 2;
- init();
- while (i)
- switch (i) {
-
- case 1:
- leave();
-
- case 2:
- if (i = text(intro1))
- break;
- wrboard();
- if (i = text(intro2))
- break;
-
- case 3:
- if (i = text(moves))
- break;
-
- case 4:
- if (i = text(remove))
- break;
-
- case 5:
- if (i = text(hits))
- break;
-
- case 6:
- if (i = text(endgame))
- break;
-
- case 7:
- if (i = text(doubl))
- break;
-
- case 8:
- if (i = text(stragy))
- break;
-
- case 9:
- if (i = text(prog))
- break;
-
- case 10:
- if (i = text(lastch))
- break;
- }
- tutor();
-}
-
-leave() {
- int i;
- if (tflag)
- clear();
- else
- writec ('\n');
- fixtty(old);
- args[0] = strdup("backgammon");
- args[acnt++] = strdup("-n");
- args[acnt] = 0;
- execv (EXEC,args);
- for (i = 0; i < acnt; i++)
- free (args[i]);
- writel ("Help! Backgammon program is missing\007!!\n");
- exit (-1);
-}
diff --git a/games/backgammon/teachgammon/ttext1.c b/games/backgammon/teachgammon/ttext1.c
deleted file mode 100644
index 89cb306..0000000
--- a/games/backgammon/teachgammon/ttext1.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)ttext1.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-const char *opts = " QIMRHEDSPT";
-const char *prompt = "-->";
-
-const char *const list[] = {
- "\n\n\tI\tIntroduction to Backgammon",
- "\tM\tMoves and Points",
- "\tR\tRemoving Men from the Board",
- "\tH\tHitting Blots",
- "\tE\tEnding the Game and Scoring",
- "\tD\tDoubling",
- "\tS\tStrategy",
- "\tP\tThe Program and How to Use It",
- "\nalso, you can type:",
- "\t?\tto get this list",
- "\tQ\tto go start playing",
- "\tT\tto go straight to the tutorial",
- 0
-};
-
-const char *const hello[] = {
- "\n\032 These rules consist of text describing how to play Backgammon",
- "followed by a tutorial session where you play a practice game",
- "against the computer. When using this program, think carefuly",
- "before typing, since it reacts as soon as you type something. In",
- "addition, the program presents text output, such as these rules,",
- "in small blocks that will not roll off the top of the screen.",
- "Frequently, you will see the characters '-->' indicating that the",
- "program is waiting for you to finish reading, and will continue",
- "printing when you type a space or newline. Also, the rules are",
- "divided into sections, and although you should read them in or-",
- "der, you can go directly to any of them by typing one of the fol-",
- "lowing letters:",
- "(Remember to hit a space or a newline to continue.)",
- "",
- 0
-};
-
-const char *const intro1[] = {
- "\nIntroduction:",
- "\n Backgammon is a game involving the skill of two players and",
- "the luck of two dice. There are two players, red and white, and",
- "each player gets fifteen men. The object of the game is to re-",
- "move all your men from the board before the opponent does. The",
- "board consists of twenty-four positions, a 'bar' and a 'home' for",
- "each player. It looks like this:",
- "",
- 0};
-
-const char *const intro2[] = {
- "",
- "\n Although not indicated on the board, the players' homes are",
- "located just to the right of the board. A player's men are placed",
- "there when they are removed from the board. The board you just",
- "saw was in it's initial position. All games start with the board",
- "looking like this. Notice that red's pieces are represented by the",
- "letter 'r' and white's pieces are represented by the letter 'w'.",
- "Also, a position may have zero or more pieces on it, e.g. posi-",
- "tion 12 has five red pieces on it, while position 11 does not",
- "have any pieces of either color.",
- "",
- 0};
-
-const char *const moves[] = {
- "\nMoves and Points:",
- "\n Moves are made along the positions on the board according to",
- "their numbers. Red moves in the positive direction (clockwise",
- "from 1 to 24), and white moves in the negative direction (coun-",
- "terclockwise from 24 to 1).",
- "\n A turn consists of rolling the dice, and moving the number of",
- "positions indicated on each die. The two numbers can be used to",
- "move one man the sum of the two rolls, or two men the number on",
- "each individual die. For example, if red rolled 6 3 at the start",
- "of the game, he might move a man from 1 to 7 to 10, using both",
- "dice for one man, or he might move two men from position 12, one",
- "to 15 and one to 18. (Red did not have to choose two men start-",
- "ing from the same position.) In addition, doubles are treated",
- "specially in backgammon. When a player rolls doubles, he gets to",
- "move as if he had four dice instead of two. For instance, if you",
- "rolled double 2's, you could move one man eight positions, four",
- "men two positions each, or any permutation in between.",
- "",
- "\n However, there are certain limitations, called 'points.' A",
- "player has a point when he has two or more men on the same posi-",
- "tion. This gives him custody of that position, and his opponent",
- "cannot place his men there, even if passing through on the way to",
- "another position. When a player has six points in a row, it is",
- "called a 'wall,' since any of his opponent's men behind the wall",
- "cannot pass it and are trapped, at least for the moment. Notice",
- "that this could mean that a player could not use part or all of",
- "his roll. However, he must use as much of his roll as possible.",
- "",
- 0};
-
-const char *const remove[] = {
- "\nRemoving Men from the Board:",
- "\n The most important part of the game is removing men, since",
- "that is how you win the game. Once a man is removed, he stays",
- "off the board for the duration of the game. However, a player",
- "cannot remove men until all his men are on his 'inner table,' or",
- "the last six positions of the board (19-24 for red, 6-1 for",
- "white).",
- "\n To get off the board, a player must roll the exact number to",
- "get his man one position past the last position on the board, or",
- "his 'home.' Hence, if red wanted to remove a man from position",
- "23, he would have to roll a 2, anything else would be used for",
- "another man, or for another purpose. However, there is one ex-",
- "ception. If the player rolling has no men far enough to move the",
- "roll made, he may move his farthest man off the board. For exam-",
- "ple, if red's farthest man back was on position 21, he could re-",
- "move men from that position if he rolled a 5 or a 6, as well as a",
- "4. Since he does not have men on 20 (where he could use a 5) or",
- "on 19 (where he could use a 6), he can use these rolls for posi-",
- "tion 21. A player never has to remove men, but he must make as",
- "many moves as possible.",
- "",
- 0};
-
-const char *const hits[] = {
- "\nHitting Blots:",
- "\n Although two men on a position form an impenetrable point, a",
- "lone man is not so secure. Such a man is called a 'blot' and has",
- "the potential of getting hit by an opposing man. When a player's",
- "blot is hit, he is placed on the bar, and the first thing that",
- "player must do is move the man off the bar. Such moves are",
- "counted as if the bar is one position behind the first position",
- "on the board. Thus if red has a man on the bar and rolls 2 3, he",
- "must move the man on the bar to position 2 or 3 before moving any",
- "other man. If white had points on positions 2 and 3, then red",
- "would forfeit his turn. Being on the bar is a very bad position,",
- "for often a player can lose many turns trying to move off the",
- "bar, as well as being set back the full distance of the board.",
- "",
- 0};
-
-const char *const endgame[] = {
- "\nEnding the Game and Scoring:",
- "\n Winning a game usually wins one point, the normal value of a",
- "game. However, if the losing player has not removed any men yet,",
- "then the winning player wins double the game value, called a",
- "'gammon.' If the losing player has a player on the bar or on the",
- "winner's inner table, then the winner gets triple the game value,",
- "which is called a 'backgammon.' (So that's where the name comes",
- "from!)",
- "",
- 0};
diff --git a/games/backgammon/teachgammon/ttext2.c b/games/backgammon/teachgammon/ttext2.c
deleted file mode 100644
index d64659ef..0000000
--- a/games/backgammon/teachgammon/ttext2.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-
-extern const char *const list[];
-char *prompt, *opts;
-
-const char *const doubl[] = {
- "\nDoubling:",
- "\n If a player thinks he is in a good position, he may double the",
- "value of the game. However, his opponent may not accept the pro-",
- "posal and forfeit the game before the price gets too high. A",
- "player must double before he rolls, and once his double has been",
- "accepted, he cannot double again, until his opponent has doubled.",
- "Thus, unless the game swings back and forth in advantage between",
- "the two players a great deal, the value of the game should be",
- "low. At any rate, the value of the game will never go above 64,",
- "or six doubles. However, if a player wins a backgammon at 64",
- "points, he wins 192 points!",
- "",
- 0};
-
-const char *const stragy[] = {
- "\nStrategy:",
- "\n Some general hints when playing: Try not to leave men open",
- "unless absolutely necessary. Also, it is good to make as many",
- "points as possible. Often, two men from different positions can",
- "be brought together to form a new point. Although walls (six",
- "points in a row) are difficult to form, many points nestled close-",
- "ly together produce a formidable barrier. Also, while it is good",
- "to move back men forward, doing so lessens the opportunity for you",
- "to hit men. Finally, remember that once the two player's have",
- "passed each other on the board, there is no chance of either team",
- "being hit, so the game reduces to a race off the board. Addi-",
- "tional hints on strategy are presented in the practice game.",
- "",
- 0};
-
-const char *const prog[] = {
- "\nThe Program and How It Works:",
- "\n A general rule of thumb is when you don't know what to do,",
- "type a question mark, and you should get some help. When it is",
- "your turn, only your color will be printed out, with nothing",
- "after it. You may double by typing a 'd', but if you type a",
- "space or newline, you will get your roll. (Remember, you must",
- "double before you roll.) Also, typing a 'r' will reprint the",
- "board, and a 'q' will quit the game. The program will type",
- "'Move:' when it wants your move, and you may indicate each die's",
- "move with <s>-<f>, where <s> is the starting position and <f> is",
- "the finishing position, or <s>/<r> where <r> is the roll made.",
- "<s>-<f1>-<f2> is short for <s>-<f1>,<f1>-<f2> and <s>/<r1><r2> is",
- "short for <s>/<r1>,<s>/<r2>. Moves may be separated by a comma",
- "or a space.",
- "",
- "\n While typing, any input which does not make sense will not be",
- "echoed, and a bell will sound instead. Also, backspacing and",
- "killing lines will echo differently than normal. You may examine",
- "the board by typing a 'r' if you have made a partial move, or be-",
- "fore you type a newline, to see what the board looks like. You",
- "must end your move with a newline. If you cannot double, your",
- "roll will always be printed, and you will not be given the oppor-",
- "tunity to double. Home and bar are represented by the appropri-",
- "ate number, 0 or 25 as the case may be, or by the letters 'h' or",
- "'b' as appropriate. You may also type 'r' or 'q' when the program",
- "types 'Move:', which has the same effect as above. Finally, you",
- "will get to decide if you want to play red or white (or both if you",
- "want to play a friend) at the beginning of the session, and you",
- "will not get to change your mind later, since the computer keeps",
- "score.",
- "",
- 0};
-
-const char *const lastch[] = {
- "\nTutorial (Practice Game):",
- "\n This tutorial, for simplicity's sake, will let you play one",
- "predetermined game. All the rolls have been pre-arranged, and",
- "only one response will let you advance to the next move.",
- "Although a given roll will may have several legal moves, the tu-",
- "torial will only accept one (not including the same moves in a",
- "different order), claiming that that move is 'best.' Obviously,",
- "a subjective statement. At any rate, be patient with it and have",
- "fun learning about backgammon. Also, to speed things up a lit-",
- "tle, doubling will not take place in the tutorial, so you will",
- "never get that opportunity, and quitting only leaves the tutori-",
- "al, not the game. You will still be able to play backgammon",
- "after quitting.",
- "\n This is your last chance to look over the rules before the tu-",
- "torial starts.",
- "",
- 0};
-
-int
-text (txt)
-const char *const *txt;
-
-{
- const char *const *begin;
- const char *a;
- char b;
- const char *c;
- int i;
-
- fixtty (noech);
- begin = txt;
- while (*txt) {
- a = *(txt++);
- if (*a != '\0') {
- c = a;
- for (i = 0; *(c++) != '\0'; i--);
- writel (a);
- writec ('\n');
- } else {
- fixtty (raw);
- writel (prompt);
- for (;;) {
- if ((b = readc()) == '?') {
- if (tflag) {
- if (begscr) {
- curmove (18,0);
- clend();
- } else
- clear();
- } else
- writec ('\n');
- text (list);
- writel (prompt);
- continue;
- }
- i = 0;
- if (b == '\n')
- break;
- while (i < 11) {
- if (b == opts[i])
- break;
- i++;
- }
- if (i == 11)
- writec ('\007');
- else
- break;
- }
- if (tflag) {
- if (begscr) {
- curmove (18,0);
- clend();
- } else
- clear();
- } else
- writec ('\n');
- if (i)
- return(i);
- fixtty (noech);
- if (tflag)
- curmove (curr,0);
- begin = txt;
- }
- }
- fixtty (raw);
- return (0);
-}
diff --git a/games/backgammon/teachgammon/tutor.c b/games/backgammon/teachgammon/tutor.c
deleted file mode 100644
index 68124ce..0000000
--- a/games/backgammon/teachgammon/tutor.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)tutor.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "back.h"
-#include "tutor.h"
-
-extern int maxmoves;
-extern const char *const finis[];
-
-extern const struct situatn test[];
-
-static const char better[] = "That is a legal move, but there is a better one.\n";
-
-void
-tutor () {
- int i, j;
-
- i = 0;
- begscr = 18;
- cturn = -1;
- home = 0;
- bar = 25;
- inptr = &in[0];
- inopp = &in[1];
- offptr = &off[0];
- offopp = &off[1];
- Colorptr = &color[0];
- colorptr = &color[2];
- colen = 5;
- wrboard();
-
- while (1) {
- if (! brdeq(test[i].brd,board)) {
- if (tflag && curr == 23)
- curmove (18,0);
- writel (better);
- nexturn();
- movback (mvlim);
- if (tflag) {
- refresh();
- clrest ();
- }
- if ((! tflag) || curr == 19) {
- proll();
- writec ('\t');
- }
- else
- curmove (curr > 19? curr-2: curr+4,25);
- getmove();
- if (cturn == 0)
- leave();
- continue;
- }
- if (tflag)
- curmove (18,0);
- text (*test[i].com);
- if (! tflag)
- writec ('\n');
- if (i == maxmoves)
- break;
- D0 = test[i].roll1;
- D1 = test[i].roll2;
- d0 = 0;
- mvlim = 0;
- for (j = 0; j < 4; j++) {
- if (test[i].mp[j] == test[i].mg[j])
- break;
- p[j] = test[i].mp[j];
- g[j] = test[i].mg[j];
- mvlim++;
- }
- if (mvlim)
- for (j = 0; j < mvlim; j++)
- if (makmove(j))
- writel ("AARGH!!!\n");
- if (tflag)
- refresh();
- nexturn();
- D0 = test[i].new1;
- D1 = test[i].new2;
- d0 = 0;
- i++;
- mvlim = movallow();
- if (mvlim) {
- if (tflag)
- clrest();
- proll();
- writec('\t');
- getmove();
- if (tflag)
- refresh();
- if (cturn == 0)
- leave();
- }
- }
- leave();
-}
-
-clrest () {
- int r, c, j;
-
- r = curr;
- c = curc;
- for (j = r+1; j < 24; j++) {
- curmove (j,0);
- cline();
- }
- curmove (r,c);
-}
-
-int
-brdeq (b1,b2)
-const int *b1, *b2;
-
-{
- const int *e;
-
- e = b1+26;
- while (b1 < e)
- if (*b1++ != *b2++)
- return(0);
- return(1);
-}
diff --git a/games/backgammon/teachgammon/tutor.h b/games/backgammon/teachgammon/tutor.h
deleted file mode 100644
index 8b20e33..0000000
--- a/games/backgammon/teachgammon/tutor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tutor.h 8.1 (Berkeley) 5/31/93
- */
-
-struct situatn {
- int brd[26];
- int roll1;
- int roll2;
- int mp[4];
- int mg[4];
- int new1;
- int new2;
- const char *const (*com[8]);
-};
-
-extern const char *const doubl[];
-extern const char *const endgame[];
-extern const char *const finis[];
-extern const char *const hello[];
-extern const char *const hits[];
-extern const char *const intro1[];
-extern const char *const intro2[];
-extern const char *const lastch[];
-extern const char *const list[];
-extern int maxmoves;
-extern const char *const moves[];
-extern const char *const opts;
-extern const char *const prog[];
-extern const char *const prompt;
-extern const char *const removepiece[];
-extern const char *const stragy[];
-extern const struct situatn test[];
diff --git a/games/battlestar/Makefile b/games/battlestar/Makefile
deleted file mode 100644
index d4f8631..0000000
--- a/games/battlestar/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= battlestar
-SRCS= battlestar.c com1.c com2.c com3.c com4.c com5.c com6.c com7.c \
- init.c cypher.c getcom.c parse.c room.c save.c fly.c misc.c \
- globals.c dayfile.c nightfile.c dayobjs.c nightobjs.c words.c
-MAN= battlestar.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-#CFLAGS+= -Wall -W
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/battlestar.log)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/battlestar.log
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/battlestar/battlestar.6 b/games/battlestar/battlestar.6
deleted file mode 100644
index 72f71bf..0000000
--- a/games/battlestar/battlestar.6
+++ /dev/null
@@ -1,165 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)battlestar.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH BATTLESTAR 6 "May 31, 1993
-.UC 6
-.SH NAME
-battlestar \- a tropical adventure game
-.SH SYNOPSIS
-.B battlestar
-[
-.B -r (recover a saved game)
-]
-.br
-.fi
-.SH DESCRIPTION
-.I Battlestar
-is an adventure game in the classic style. However, it's slightly less
-of a
-puzzle and more a game of exploration. There are a few magical words
-in the game, but on the whole, simple English
-should suffice to make one's desires understandable to the parser.
-.SH "THE SETTING"
-In the days before the darkness came, when battlestars ruled the
-heavens...
-.br
-.nf
-
- Three He made and gave them to His daughters,
- Beautiful nymphs, the goddesses of the waters.
- One to bring good luck and simple feats of wonder,
- Two to wash the lands and churn the waves asunder,
- Three to rule the world and purge the skies with thunder.
-
-.fi
-.PP
-In those times great wizards were known and their powers were beyond
-belief. They could take any object from thin air, and, uttering the
-word `su' could disappear.
-.PP
-In those times men were known for their lust of gold and desire to
-wear fine weapons. Swords and coats of mail were fashioned that could
-withstand a laser blast.
-.PP
-But when the darkness fell, the rightful reigns were toppled. Swords
-and helms and heads of state went rolling across the grass. The entire
-fleet of battlestars was reduced to a single ship.
-.SH "SAMPLE COMMANDS"
-.nf
-
- take --- take an object
- drop --- drop an object
-
- wear --- wear an object you are holding
- draw --- carry an object you are wearing
-
- puton --- take an object and wear it
- take off -- draw an object and drop it
-
- throw <object> <direction>
-
- ! <shell esc>
-
-.fi
-.SH "IMPLIED OBJECTS"
-.nf
-
- >-: take watermelon
- watermelon:
- Taken.
- >-: eat
- watermelon:
- Eaten.
- >-: take knife and sword and apple, drop all
- knife:
- Taken.
- broadsword:
- Taken.
- apple:
- Taken.
- knife:
- Dropped.
- broadsword:
- Dropped.
- apple:
- Dropped.
- >-: get
- knife:
- Taken.
-
-.fi
-.PP
-Notice that the "shadow" of the next word stays around if you
-want to take advantage of it. That is, saying "take knife" and then
-"drop"
-will drop the knife you just took.
-.SH "SCORE & INVEN"
-The two commands "score" and "inven" will print out your current status
-in
-the game.
-.SH "SAVING A GAME"
-The command "save" will save your game in a file called "Bstar." You
-can
-recover a saved game by using the "-r" option when you start up the
-game.
-.SH DIRECTIONS
-The compass directions N, S, E, and W can be used if you have a compass.
-If you don't have a compass, you'll have to say R, L, A, or B, which
-stand for
-Right, Left, Ahead, and Back. Directions printed in room descriptions
-are
-always printed in R, L, A, & B relative directions.
-.SH HISTORY
-I wrote Battlestar in 1979 in order to experiment with the niceties of
-the C Language.
-Most interesting things that happen in the game are hardwired into the
-code, so don't
-send me any hate mail about it! Instead, enjoy art for art's sake!
-.SH AUTHOR
-David Riggle
-.SH "INSPIRATION & ASSISTANCE"
-Chris Guthrie
-.br
-Peter Da Silva
-.br
-Kevin Brown
-.br
-Edward Wang
-.br
-Ken Arnold & Company
-.SH BUGS
-Countless.
-.SH "FAN MAIL"
-Send to edward%ucbarpa@Berkeley.arpa, chris%ucbcory@berkeley.arpa,
-riggle.pa@xerox.arpa.
diff --git a/games/battlestar/battlestar.c b/games/battlestar/battlestar.c
deleted file mode 100644
index e4b9735..0000000
--- a/games/battlestar/battlestar.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)battlestar.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Battlestar - a stellar-tropical adventure game
- *
- * Originally written by His Lordship, Admiral David W. Horatio Riggle,
- * on the Cory PDP-11/70, University of California, Berkeley.
- */
-
-#include "externs.h"
-
-int
-main(argc,argv)
-int argc;
-char **argv;
-{
- char mainbuf[LINELENGTH];
- char *next;
-
- open_score_file();
-
- /* revoke privs. */
- setgid(getgid());
-
- initialize(argc < 2 || strcmp(argv[1], "-r"));
-start:
- news();
- beenthere[position]++;
- if (notes[LAUNCHED])
- crash(); /* decrements fuel & crash */
- if (matchlight) {
- puts("Your match splutters out.");
- matchlight = 0;
- }
- if (!notes[CANTSEE] || testbit(inven,LAMPON) ||
- testbit(location[position].objects, LAMPON)) {
- writedes();
- printobjs();
- } else
- puts("It's too dark to see anything in here!");
- whichway(location[position]);
-run:
- next = getcom(mainbuf, sizeof mainbuf, ">-: ",
- "Please type in something.");
- for (wordcount = 0; next && wordcount < 20; wordcount++)
- next = getword(next, words[wordcount], -1);
- parse();
- switch (cypher()) {
- case -1:
- goto run;
- case 0:
- goto start;
- default:
- exit(1); /* Shouldn't happen */
- }
- exit(1);
-}
diff --git a/games/battlestar/com1.c b/games/battlestar/com1.c
deleted file mode 100644
index 4e054f2..0000000
--- a/games/battlestar/com1.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com1.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-void convert(int);
-
-int
-battlestar_move(thataway, token)
-int thataway, token;
-{
- wordnumber++;
- if ((!notes[CANTMOVE] && !notes[LAUNCHED]) ||
- ((testbit(location[position].objects, LAND) || fuel > 0) &&
- notes[LAUNCHED]))
- if (thataway) {
- position = thataway;
- newway(token);
- gtime++;
- }
- else {
- puts("You can't go this way.");
- newway(token);
- whichway(location[position]);
- return(0);
- }
- else if (notes[CANTMOVE] && !notes[LAUNCHED])
- puts("You aren't able to move; you better drop something.");
- else
- puts("You are out of fuel; now you will rot in space forever!");
- return(1);
-}
-
-void
-convert(tothis) /* Converts day to night and vice versa. */
-int tothis; /* Day objects are permanent. Night objects are added*/
-{ /* at dusk, and subtracted at dawn. */
- const struct objs *p;
- int i, j;
-
- if (tothis == TONIGHT) {
- for (i = 1; i <= NUMOFROOMS; i++)
- for (j = 0; j < NUMOFWORDS; j++)
- nightfile[i].objects[j] = dayfile[i].objects[j];
- for (p = nightobjs; p->room != 0; p++)
- setbit(nightfile[p->room].objects, p->obj);
- location = nightfile;
- } else {
- for (i = 1; i <= NUMOFROOMS; i++)
- for (j = 0; j < NUMOFWORDS; j++)
- dayfile[i].objects[j] = nightfile[i].objects[j];
- for (p = nightobjs; p->room != 0; p++)
- clearbit(dayfile[p->room].objects, p->obj);
- location = dayfile;
- }
-}
-
-void
-news()
-{
- int n;
- int hurt;
-
- if (gtime > 30 && position < 32){
- puts("An explosion of shuddering magnitude splinters bulkheads and");
- puts("ruptures the battlestar's hull. You are sucked out into the");
- puts("frozen void of space and killed.");
- die(0);
- }
- if (gtime > 20 && position < 32)
- puts("Explosions rock the battlestar.");
- if (gtime > snooze){
- puts("You drop from exhaustion...");
- zzz();
- }
- if (gtime > snooze - 5)
- puts("You're getting tired.");
- if (gtime > (rythmn + CYCLE)) {
- if (location == nightfile) {
- convert(TODAY);
- if (OUTSIDE && gtime - rythmn - CYCLE < 10) {
- puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
- puts("You awake from a misty dream-world into stark reality.");
- puts("It is day.");
- }
- } else {
- convert(TONIGHT);
- clearbit(location[POOLS].objects, BATHGOD);
- if (OUTSIDE && gtime - rythmn - CYCLE < 10) {
- puts("The dying sun sinks into the ocean, leaving a blood stained sunset.");
- puts("The sky slowly fades from orange to violet to black. A few stars");
- puts("flicker on, and it is night.");
- puts("The world seems completly different at night.");
- }
- }
- rythmn = gtime - gtime % CYCLE;
- }
- if (!wiz && !tempwiz)
- if ((testbit(inven,TALISMAN) || testbit(wear,TALISMAN)) && (testbit(inven,MEDALION) || testbit(wear,MEDALION)) && (testbit(inven,AMULET) || testbit(wear,AMULET))){
- tempwiz = 1;
- puts("The three amulets glow and reenforce each other in power.\nYou are now a wizard.");
- }
- if (testbit(location[position].objects,ELF)){
- printf("%s\n",objdes[ELF]);
- fight(ELF,rnd(30));
- }
- if (testbit(location[position].objects,DARK)){
- printf("%s\n",objdes[DARK]);
- fight(DARK,100);
- }
- if (testbit(location[position].objects,WOODSMAN)){
- printf("%s\n",objdes[WOODSMAN]);
- fight(WOODSMAN,50);
- }
- switch(position){
-
- case 267:
- case 257: /* entering a cave */
- case 274:
- case 246:
- notes[CANTSEE] = 1;
- break;
- case 160:
- case 216: /* leaving a cave */
- case 230:
- case 231:
- case 232:
- notes[CANTSEE] = 0;
- break;
- }
- if (testbit(location[position].objects, GIRL))
- meetgirl = 1;
- if (meetgirl && CYCLE * 1.5 - gtime < 10){
- setbit(location[GARDEN].objects,GIRLTALK);
- setbit(location[GARDEN].objects,LAMPON);
- setbit(location[GARDEN].objects,ROPE);
- }
- if (position == DOCK && (beenthere[position] || gtime > CYCLE)){
- clearbit(location[DOCK].objects, GIRL);
- clearbit(location[DOCK].objects,MAN);
- }
- if (meetgirl && gtime - CYCLE * 1.5 > 10){
- clearbit(location[GARDEN].objects,GIRLTALK);
- clearbit(location[GARDEN].objects,LAMPON);
- clearbit(location[GARDEN].objects,ROPE);
- meetgirl = 0;
- }
- if (testbit(location[position].objects,CYLON)){
- puts("Oh my God, you're being shot at by an alien spacecraft!");
- printf("The targeting computer says we have %d seconds to attack!\n",gclock);
- fflush(stdout);
- sleep(1);
- if (!visual()){
- hurt = rnd(NUMOFINJURIES);
- injuries[hurt] = 1;
- puts("Laser blasts sear the cockpit, and the alien veers off in a victory roll.");
- puts("The viper shudders under a terrible explosion.");
- printf("I'm afraid you have suffered %s.\n", ouch[hurt]);
- }
- else
- clearbit(location[position].objects,CYLON);
- }
- if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){
- puts("I'm afraid you have suffered fatal injuries.");
- die(0);
- }
- for (n=0; n < NUMOFINJURIES; n++)
- if (injuries[n] == 1){
- injuries[n] = 2;
- if (WEIGHT > 5)
- WEIGHT -= 5;
- else
- WEIGHT = 0;
- }
- if (injuries[ARM] == 2){
- CUMBER -= 5;
- injuries[ARM]++;
- }
- if (injuries[RIBS] == 2){
- CUMBER -= 2;
- injuries[RIBS]++;
- }
- if (injuries[SPINE] == 2){
- WEIGHT = 0;
- injuries[SPINE]++;
- }
- if (carrying > WEIGHT || encumber > CUMBER)
- notes[CANTMOVE] = 1;
- else
- notes[CANTMOVE] = 0;
-}
-
-void
-crash()
-{
- int hurt1,hurt2;
-
- fuel--;
- if (!location[position].flyhere || (testbit(location[position].objects,LAND) && fuel <= 0)){
- if (!location[position].flyhere)
- puts("You're flying too low. We're going to crash!");
- else{
- puts("You're out of fuel. We'll have to crash land!");
- if (!location[position].down){
- puts("Your viper strikes the ground and explodes into firey fragments.");
- puts("Thick black smoke billows up from the wreckage.");
- die(0);
- }
- position = location[position].down;
- }
- notes[LAUNCHED] = 0;
- setbit(location[position].objects,CRASH);
- gtime += rnd(CYCLE/4);
- puts("The viper explodes into the ground and you lose consciousness...");
- zzz();
- hurt1 = rnd(NUMOFINJURIES - 2) + 2;
- hurt2 = rnd(NUMOFINJURIES - 2) + 2;
- injuries[hurt1] = 1;
- injuries[hurt2] = 1;
- injuries[0] = 1; /* abrasions */
- injuries[1] = 1; /* lacerations */
- printf("I'm afraid you have suffered %s and %s.\n",ouch[hurt1],ouch[hurt2]);
- }
-}
diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c
deleted file mode 100644
index d41d6037..0000000
--- a/games/battlestar/com2.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com2.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-int
-wearit() /* synonyms = {sheathe, sheath} */
-{
- int n;
- int firstnumber, value;
-
- firstnumber = wordnumber;
- while(wordtype[++wordnumber] == ADJS);
- while(wordnumber <= wordcount){
- value = wordvalue[wordnumber];
- if (value == -1) {
- puts("Wear what?");
- return (firstnumber);
- }
- for (n=0; objsht[value][n]; n++);
- switch(value){
- default:
- printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
- return(firstnumber);
-
- case KNIFE:
- /* case SHIRT: */
- case ROBE:
- case LEVIS: /* wearable things */
- case SWORD:
- case MAIL:
- case HELM:
- case SHOES:
- case PAJAMAS:
- case COMPASS:
- case LASER:
- case AMULET:
- case TALISMAN:
- case MEDALION:
- case ROPE:
- case RING:
- case BRACELET:
- case GRENADE:
-
- if (testbit(inven,value)){
- clearbit(inven,value);
- setbit(wear,value);
- carrying -= objwt[value];
- encumber -= objcumber[value];
- gtime++;
- printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]);
- }
- else if (testbit(wear,value))
- printf("You are already wearing the %s.\n", objsht[value]);
- else
- printf("You aren't holding the %s.\n", objsht[value]);
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(firstnumber);
- } /* end switch */
- } /* end while */
- puts("Don't be ridiculous.");
- return(firstnumber);
-}
-
-int
-put() /* synonyms = {buckle, strap, tie} */
-{
- if (wordvalue[wordnumber + 1] == ON){
- wordvalue[++wordnumber] = PUTON;
- return(cypher());
- }
- if (wordvalue[wordnumber + 1] == DOWN){
- wordvalue[++wordnumber] = DROP;
- return(cypher());
- }
- puts("I don't understand what you want to put.");
- return(-1);
-
-}
-
-int
-draw() /* synonyms = {pull, carry} */
-{
- return(take(wear));
-}
-
-int
-use()
-{
- while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
- if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){
- puts("The amulet begins to glow.");
- if (testbit(inven,MEDALION)){
- puts("The medallion comes to life too.");
- if (position == 114){
- location[position].down = 160;
- whichway(location[position]);
- puts("The waves subside and it is possible to descend to the sea cave now.");
- gtime++;
- return(-1);
- }
- }
- puts("A light mist falls over your eyes and the sound of purling water trickles in");
- puts("your ears. When the mist lifts you are standing beside a cool stream.");
- if (position == 229)
- position = 224;
- else
- position = 229;
- gtime++;
- notes[CANTSEE] = 0;
- return(0);
- }
- else if (position == FINAL)
- puts("The amulet won't work in here.");
- else if (wordvalue[wordnumber] == COMPASS && testbit(inven,COMPASS))
- printf("Your compass points %s.\n",truedirec(NORTH,'-'));
- else if (wordvalue[wordnumber] == COMPASS)
- puts("You aren't holding the compass.");
- else if (wordvalue[wordnumber] == AMULET)
- puts("You aren't holding the amulet.");
- else
- puts("There is no apparent use.");
- return(-1);
-}
-
-void
-murder()
-{
- int n;
-
- for (n=0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven,n)) && n < NUMOFOBJECTS; n++);
- if (n == NUMOFOBJECTS)
- puts("You don't have suitable weapons to kill.");
- else {
- printf("Your %s should do the trick.\n",objsht[n]);
- while (wordtype[++wordnumber] == ADJS);
- switch(wordvalue[wordnumber]){
-
- case NORMGOD:
- if (testbit(location[position].objects,BATHGOD)){
- puts("The goddess's head slices off. Her corpse floats in the water.");
- clearbit(location[position].objects,BATHGOD);
- setbit(location[position].objects,DEADGOD);
- power += 5;
- notes[JINXED]++;
- } else if (testbit(location[position].objects,NORMGOD)){
- puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
- clearbit(location[position].objects,NORMGOD);
- setbit(location[position].objects,DEADGOD);
- power += 5;
- notes[JINXED]++;
- if (wintime)
- live();
- } else puts("I dont see her anywhere.");
- break;
- case TIMER:
- if (testbit(location[position].objects,TIMER)){
- puts("The old man offers no resistance.");
- clearbit(location[position].objects,TIMER);
- setbit(location[position].objects,DEADTIME);
- power++;
- notes[JINXED]++;
- } else puts("Who?");
- break;
- case NATIVE:
- if (testbit(location[position].objects,NATIVE)){
- puts("The girl screams as you cut her body to shreds. She is dead.");
- clearbit(location[position].objects,NATIVE);
- setbit(location[position].objects,DEADNATIVE);
- power += 5;
- notes[JINXED]++;
- } else puts("What girl?");
- break;
- case MAN:
- if (testbit(location[position].objects,MAN)){
- puts("You strike him to the ground, and he coughs up blood.");
- puts("Your fantasy is over.");
- die(0);
- }
- case -1:
- puts("Kill what?");
- break;
-
- default:
- if (wordtype[wordnumber] != NOUNS)
- puts("Kill what?");
- else
- printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]);
- }
- }
-}
-
-void
-ravage()
-{
- while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
- if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
- gtime++;
- switch(wordvalue[wordnumber]){
- case NORMGOD:
- puts("You attack the goddess, and she screams as you beat her. She falls down");
- puts("crying and tries to hold her torn and bloodied dress around her.");
- power += 5;
- pleasure += 8;
- ego -= 10;
- wordnumber--;
- godready = -30000;
- murder();
- bs_win = -30000;
- break;
- case NATIVE:
- puts("The girl tries to run, but you catch her and throw her down. Her face is");
- puts("bleeding, and she screams as you tear off her clothes.");
- power += 3;
- pleasure += 5;
- ego -= 10;
- wordnumber--;
- murder();
- if (rnd(100) < 50){
- puts("Her screams have attracted attention. I think we are surrounded.");
- setbit(location[ahead].objects,WOODSMAN);
- setbit(location[ahead].objects,DEADWOOD);
- setbit(location[ahead].objects,MALLET);
- setbit(location[back].objects,WOODSMAN);
- setbit(location[back].objects,DEADWOOD);
- setbit(location[back].objects,MALLET);
- setbit(location[left].objects,WOODSMAN);
- setbit(location[left].objects,DEADWOOD);
- setbit(location[left].objects,MALLET);
- setbit(location[right].objects,WOODSMAN);
- setbit(location[right].objects,DEADWOOD);
- setbit(location[right].objects,MALLET);
- }
- break;
- default:
- puts("You are perverted.");
- }
- }
- else
- puts("Who?");
-}
-
-int
-follow()
-{
- if (followfight == gtime){
- puts("The Dark Lord leaps away and runs down secret tunnels and corridors.");
- puts("You chase him through the darkness and splash in pools of water.");
- puts("You have cornered him. His laser sword extends as he steps forward.");
- position = FINAL;
- fight(DARK,75);
- setbit(location[position].objects,TALISMAN);
- setbit(location[position].objects,AMULET);
- return(0);
- }
- else if (followgod == gtime){
- puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
- puts("She sits down on a throne.");
- position = 268;
- setbit(location[position].objects,NORMGOD);
- notes[CANTSEE] = 1;
- return(0);
- }
- else
- puts("There is no one to follow.");
- return(-1);
-}
diff --git a/games/battlestar/com3.c b/games/battlestar/com3.c
deleted file mode 100644
index 22f8e0d..0000000
--- a/games/battlestar/com3.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com3.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-void
-dig()
-{
- if (testbit(inven,SHOVEL)){
- puts("OK");
- gtime++;
- switch(position){
- case 144: /* copse near beach */
- if (!notes[DUG]){
- setbit(location[position].objects,DEADWOOD);
- setbit(location[position].objects,COMPASS);
- setbit(location[position].objects,KNIFE);
- setbit(location[position].objects,MACE);
- notes[DUG] = 1;
- }
- break;
-
- default:
- puts("Nothing happens.");
- }
- }
- else
- puts("You don't have a shovel.");
-}
-
-int
-jump()
-{
- int n;
-
- switch(position){
- default:
- puts("Nothing happens.");
- return(-1);
-
- case 242:
- position = 133;
- break;
- case 214:
- case 215:
- case 162:
- case 159:
- position = 145;
- break;
- case 232:
- position = 275;
- break;
- case 3:
- position = 1;
- break;
- case 172:
- position = 201;
- }
- puts("Ahhhhhhh...");
- injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1;
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(inven,n)){
- clearbit(inven,n);
- setbit(location[position].objects,n);
- }
- carrying = 0;
- encumber = 0;
- return(0);
-}
-
-void
-bury()
-{
- int value;
-
- if (testbit(inven,SHOVEL)){
- while(wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount);
- value = wordvalue[wordnumber];
- if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects,value) || value == BODY))
- switch(value){
- case BODY:
- wordtype[wordnumber] = OBJECT;
- if (testbit(inven,MAID) || testbit(location[position].objects,MAID))
- value = MAID;
- if (testbit(inven,DEADWOOD) || testbit(location[position].objects,DEADWOOD))
- value = DEADWOOD;
- if (testbit(inven,DEADGOD) || testbit(location[position].objects,DEADGOD))
- value = DEADGOD;
- if (testbit(inven,DEADTIME) || testbit(location[position].objects,DEADTIME))
- value = DEADTIME;
- if (testbit(inven,DEADNATIVE) || testbit(location[position].objects,DEADNATIVE))
- value = DEADNATIVE;
- break;
-
- case NATIVE:
- case NORMGOD:
- puts("She screams as you wrestle her into the hole.");
- case TIMER:
- power += 7;
- ego -= 10;
- case AMULET:
- case MEDALION:
- case TALISMAN:
- wordtype[wordnumber] = OBJECT;
- break;
-
- default:
- puts("Wha..?");
- }
- if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven,value) || testbit(location[position].objects,value))){
- puts("Buried.");
- if (testbit(inven,value)){
- clearbit(inven,value);
- carrying -= objwt[value];
- encumber -= objcumber[value];
- }
- clearbit(location[position].objects,value);
- switch(value){
- case MAID:
- case DEADWOOD:
- case DEADNATIVE:
- case DEADTIME:
- case DEADGOD:
- ego += 2;
- printf("The %s should rest easier now.\n",objsht[value]);
- }
- }
- else
- puts("It doesn't seem to work.");
- }
- else
- puts("You aren't holding a shovel.");
-}
-
-void
-drink()
-{
- int n;
-
- if (testbit(inven,POTION)){
- puts("The cool liquid runs down your throat but turns to fire and you choke.");
- puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
- puts("asleep.");
- clearbit(inven, POTION);
- WEIGHT = MAXWEIGHT;
- CUMBER = MAXCUMBER;
- for (n=0; n < NUMOFINJURIES; n++)
- injuries[n] = 0;
- gtime++;
- zzz();
- }
- else
- puts("I'm not thirsty.");
-}
-
-int
-shoot()
-{
- int firstnumber, value;
- int n;
-
- firstnumber = wordnumber;
- if (!testbit(inven,LASER))
- puts("You aren't holding a blaster.");
- else {
- while(wordtype[++wordnumber] == ADJS);
- while(wordnumber<=wordcount && wordtype[wordnumber] == OBJECT){
- value = wordvalue[wordnumber];
- printf("%s:\n", objsht[value]);
- for (n=0; objsht[value][n]; n++);
- if (testbit(location[position].objects,value)){
- clearbit(location[position].objects,value);
- gtime++;
- printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s."));
- if (value == BOMB)
- die(0);
- }
- else
- printf("I dont see any %s around here.\n", objsht[value]);
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(firstnumber);
- }
- /* special cases with their own return()'s */
-
- if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS){
- gtime++;
- switch(wordvalue[wordnumber]){
-
- case DOOR:
- switch(position){
- case 189:
- case 231:
- puts("The door is unhinged.");
- location[189].north = 231;
- location[231].south = 189;
- whichway(location[position]);
- break;
- case 30:
- puts("The wooden door splinters.");
- location[30].west = 25;
- whichway(location[position]);
- break;
- case 31:
- puts("The laser blast has no effect on the door.");
- break;
- case 20:
- puts("The blast hits the door and it explodes into flame. The magnesium burns");
- puts("so rapidly that we have no chance to escape.");
- die(0);
- default:
- puts("Nothing happens.");
- }
- break;
-
- case NORMGOD:
- if (testbit(location[position].objects,BATHGOD)){
- puts("The goddess is hit in the chest and splashes back against the rocks.");
- puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
- puts("pools and then off downstream.");
- clearbit(location[position].objects,BATHGOD);
- setbit(location[180].objects,DEADGOD);
- power += 5;
- ego -= 10;
- notes[JINXED]++;
- } else if (testbit(location[position].objects,NORMGOD)){
- puts("The blast catches the goddess in the stomach, knocking her to the ground.");
- puts("She writhes in the dirt as the agony of death taunts her.");
- puts("She has stopped moving.");
- clearbit(location[position].objects,NORMGOD);
- setbit(location[position].objects,DEADGOD);
- power += 5;
- ego -= 10;
- notes[JINXED]++;
- if (wintime)
- live();
- break;
- } else
- puts("I don't see any goddess around here.");
- break;
-
- case TIMER:
- if (testbit(location[position].objects,TIMER)){
- puts("The old man slumps over the bar.");
- power++;
- ego -= 2;
- notes[JINXED]++;
- clearbit(location[position].objects,TIMER);
- setbit(location[position].objects,DEADTIME);
- }
- else puts("What old timer?");
- break;
- case MAN:
- if (testbit(location[position].objects,MAN)){
- puts("The man falls to the ground with blood pouring all over his white suit.");
- puts("Your fantasy is over.");
- die(0);
- }
- else puts("What man?");
- break;
- case NATIVE:
- if (testbit(location[position].objects,NATIVE)){
- puts("The girl is blown backwards several feet and lies in a pool of blood.");
- clearbit(location[position].objects,NATIVE);
- setbit(location[position].objects,DEADNATIVE);
- power += 5;
- ego -= 2;
- notes[JINXED]++;
- } else puts("There is no girl here.");
- break;
- case -1:
- puts("Shoot what?");
- break;
-
- default:
- printf("You can't shoot the %s.\n",objsht[wordvalue[wordnumber]]);
- }
- }
- else puts("You must be a looney.");
- }
- return(firstnumber);
-}
diff --git a/games/battlestar/com4.c b/games/battlestar/com4.c
deleted file mode 100644
index 9453248..0000000
--- a/games/battlestar/com4.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com4.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "externs.h"
-
-int
-take(from)
-unsigned int from[];
-{
- int firstnumber, heavy, bulky, value;
- int n;
-
- firstnumber = wordnumber;
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == OFF){
- wordnumber++;
- wordvalue[wordnumber] = TAKEOFF;
- return(cypher());
- }
- else {
- while(wordtype[++wordnumber] == ADJS);
- while(wordnumber<=wordcount && wordtype[wordnumber] == OBJECT){
- value = wordvalue[wordnumber];
- printf("%s:\n", objsht[value]);
- for (n=0; objsht[value][n]; n++);
- heavy = (carrying + objwt[value]) <= WEIGHT;
- bulky = (encumber + objcumber[value]) <= CUMBER;
- if ((testbit(from,value) || wiz || tempwiz) && heavy && bulky && !testbit(inven,value)){
- setbit(inven,value);
- carrying += objwt[value];
- encumber += objcumber[value];
- gtime++;
- if (testbit(from,value))
- printf("Taken.\n");
- else
- printf("Zap! Taken from thin air.\n");
- clearbit(from,value);
- if (value == MEDALION)
- bs_win--;
- }
- else if (testbit(inven,value))
- printf("You're already holding%s%s.\n", (objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
- else if (!heavy)
- printf("The %s %s too heavy.\n", objsht[value],(objsht[value][n-1] == 's' ? "are" : "is"));
- else if (!bulky)
- printf("The %s %s too cumbersome to hold.\n", objsht[value],(objsht[value][n-1] == 's' ? "are" : "is"));
- else
- printf("I dont see any %s around here.\n", objsht[value]);
- if (wordnumber < wordcount -1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(firstnumber);
- }
- }
- /* special cases with their own return()'s */
-
- if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS)
- switch(wordvalue[wordnumber]){
-
- case SWORD:
- if (testbit(from, SWORD)){
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- if (testbit(from, TWO_HANDED)){
- wordvalue[wordnumber] = TWO_HANDED;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- wordvalue[wordnumber] = BROAD;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
-
- case BODY:
- if (testbit(from,MAID)){
- wordvalue[wordnumber] = MAID;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- else if (testbit(from,DEADWOOD)){
- wordvalue[wordnumber] = DEADWOOD;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- else if (testbit(from,DEADNATIVE)){
- wordvalue[wordnumber] = DEADNATIVE;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- else if (testbit(from,DEADGOD)){
- wordvalue[wordnumber] = DEADGOD;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- else {
- wordvalue[wordnumber] = DEADTIME;
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
- }
- break;
-
- case AMULET:
- if (testbit(location[position].objects,AMULET)){
- puts("The amulet is warm to the touch, and its beauty catches your breath.");
- puts("A mist falls over your eyes, but then it is gone. Sounds seem clearer");
- puts("and sharper but far away as if in a dream. The sound of purling water reaches");
- puts("you from afar. The mist falls again, and your heart leaps in horror. The gold");
- puts("freezes your hands and fathomless darkness engulfs your soul.");
- }
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
-
- case MEDALION:
- if (testbit(location[position].objects, MEDALION)){
- puts("The medallion is warm, and it rekindles your spirit with the warmth of life.");
- puts("Your amulet begins to glow as the medallion is brought near to it, and together\nthey radiate.");
- }
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
-
- case TALISMAN:
- if (testbit(location[position].objects,TALISMAN)){
- puts("The talisman is cold to the touch, and it sends a chill down your spine.");
- }
- wordtype[wordnumber--] = OBJECT;
- return(take(from));
-
- case NORMGOD:
- if (testbit(location[position].objects,BATHGOD) && (testbit(wear,AMULET) || testbit(inven,AMULET))){
- puts("She offers a delicate hand, and you help her out of the sparkling springs.");
- puts("Water droplets like liquid silver bedew her golden skin, but when they part");
- puts("from her, they fall as teardrops. She wraps a single cloth around her and");
- puts("ties it at the waist. Around her neck hangs a golden amulet.");
- puts("She bids you to follow her.");
- pleasure++;
- followgod = gtime;
- clearbit(location[position].objects,BATHGOD);
- } else if (!testbit(location[position].objects,BATHGOD))
- puts("You're in no position to take her.");
- else
- puts("She moves away from you.");
- break;
-
- default:
- puts("It doesn't seem to work.");
- }
- else
- puts("You've got to be kidding.");
- return(firstnumber);
-}
-
-int
-throw(name)
- const char *name;
-{
- int n;
- int deposit = 0;
- int first, value;
-
- first = wordnumber;
- if (drop(name) != -1){
- switch(wordvalue[wordnumber]){
-
- case AHEAD:
- deposit = ahead;
- break;
-
- case BACK:
- deposit = back;
- break;
-
- case LEFT:
- deposit = left;
- break;
-
- case RIGHT:
- deposit = right;
- break;
-
- case UP:
- deposit = location[position].up * (location[position].access || position == FINAL);
- break;
-
- case DOWN:
- deposit = location[position].down;
- break;
- }
- wordnumber = first;
- while (wordtype[++wordnumber] == ADJS);
- while (wordnumber <= wordcount){
- value = wordvalue[wordnumber];
- if (deposit && testbit(location[position].objects,value)){
- clearbit(location[position].objects,value);
- if (value != GRENADE)
- setbit(location[deposit].objects,value);
- else{
- puts("A thundering explosion nearby sends up a cloud of smoke and shrapnel.");
- for (n = 0; n < NUMOFWORDS; n ++)
- location[deposit].objects[n] = 0;
- setbit(location[deposit].objects,CHAR);
- }
- if (value == ROPE && position == FINAL)
- location[position].access = 1;
- switch(deposit){
- case 189:
- case 231:
- puts("The stone door is unhinged.");
- location[189].north = 231;
- location[231].south = 189;
- break;
- case 30:
- puts("The wooden door is blown open.");
- location[30].west = 25;
- break;
- case 31:
- puts("The door is not damaged.");
- }
- }
- else if (value == GRENADE && testbit(location[position].objects,value)){
- puts("You are blown into shreds when your grenade explodes.");
- die(0);
- }
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(first);
- }
- return(first);
- }
- return(first);
-}
-
-int
-drop(name)
-const char *name;
-{
-
- int firstnumber, value;
-
- firstnumber = wordnumber;
- while (wordtype[++wordnumber] == ADJS)
- ;
- while (wordnumber<=wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
- value = wordvalue[wordnumber];
- printf("%s:\n", objsht[value]);
- if (testbit(inven,value)){
- clearbit(inven,value);
- carrying -= objwt[value];
- encumber -= objcumber[value];
- if (value == BOMB){
- puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
- die(0);
- }
- if (value != AMULET && value != MEDALION && value != TALISMAN)
- setbit(location[position].objects,value);
- else
- tempwiz = 0;
- gtime++;
- if (*name == 'K')
- puts("Drop kicked.");
- else
- printf("%s.\n", name);
- }
- else {
- if (*name != 'K') {
- printf("You aren't holding the %s.\n", objsht[value]);
- if (testbit(location[position].objects,value)) {
- if (*name == 'T')
- puts("Kicked instead.");
- else if (*name == 'G')
- puts("Given anyway.");
- }
- } else
- puts("Kicked.");
- }
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(firstnumber);
- }
- puts("Do what?");
- return(-1);
-}
-
-int
-takeoff()
-{
- wordnumber = take(wear);
- return(drop("Dropped"));
-}
-
-int
-puton()
-{
- wordnumber = take(location[position].objects);
- return(wearit());
-}
-
-int
-eat()
-{
- int firstnumber, value;
-
- firstnumber = wordnumber;
- while(wordtype[++wordnumber] == ADJS);
- while(wordnumber <= wordcount){
- value = wordvalue[wordnumber];
- switch(value){
-
- case -1:
- puts("Eat what?");
- return(firstnumber);
-
- default:
- printf("You can't eat%s%s!\n",
- wordtype[wordnumber] == OBJECT &&
- objsht[value]
- [strlen(objsht[value]) - 1] == 's' ?
- " " : " a ",
- words[wordnumber]);
- return(firstnumber);
-
- case PAPAYAS:
- case PINEAPPLE:
- case KIWI:
- case COCONUTS: /* eatable things */
- case MANGO:
-
- printf("%s:\n",objsht[value]);
- if (testbit(inven,value) && gtime > ate - CYCLE && testbit(inven,KNIFE)){
- clearbit(inven,value);
- carrying -= objwt[value];
- encumber -= objcumber[value];
- ate = max(gtime,ate) + CYCLE/3;
- snooze += CYCLE/10;
- gtime++;
- puts("Eaten. You can explore a little longer now.");
- }
- else if (gtime < ate - CYCLE)
- puts("You're stuffed.");
- else if (!testbit(inven,KNIFE))
- puts("You need a knife.");
- else
- printf("You aren't holding the %s.\n", objsht[value]);
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
- wordnumber++;
- else
- return(firstnumber);
- } /* end switch */
- } /* end while */
- return(firstnumber);
-}
diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c
deleted file mode 100644
index 873cf3e..0000000
--- a/games/battlestar/com5.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com5.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-void
-kiss()
-{
- while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
- if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
- pleasure++;
- printf("Kissed.\n");
- switch (wordvalue[wordnumber]){
- case NORMGOD:
- switch(godready++){
- case 0:
- puts("She squirms and avoids your advances.");
- break;
- case 1:
- puts("She is coming around; she didn't fight it as much.");
- break;
- case 2:
- puts("She's begining to like it.");
- break;
- default:
- puts("She's gone limp.");
-
- }
- break;
- case NATIVE:
- puts("The lips are warm and her body robust. She pulls you down to the ground.");
- break;
- case TIMER:
- puts("The old man blushes.");
- break;
- case MAN:
- puts("The dwarf punches you in the kneecap.");
- break;
- default:
- pleasure--;
- }
- }
- else puts("I'd prefer not to.");
-}
-
-void
-love()
-{
- int n;
-
- while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
- if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
- if (wordvalue[wordnumber] == NORMGOD && !loved) {
- if (godready >= 2){
- puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet.");
- puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
- power++;
- pleasure += 15;
- ego++;
- if (card(injuries, NUMOFINJURIES)){
- puts("Her kisses revive you; your wounds are healed.\n");
- for (n=0; n < NUMOFINJURIES; n++)
- injuries[n] = 0;
- WEIGHT = MAXWEIGHT;
- CUMBER = MAXCUMBER;
- }
- printf("Goddess:\n");
- if (!loved)
- setbit(location[position].objects,MEDALION);
- loved = 1;
- gtime += 10;
- zzz();
- }
- else {
- puts("You wish!");
- return;
- }
- }
- if (wordvalue[wordnumber] == NATIVE){
- puts("The girl is easy prey. She peels off her sarong and indulges you.");
- power++;
- pleasure += 5;
- printf("Girl:\n");
- gtime += 10;
- zzz();
- }
- printf("Loved.\n");
- }
- else puts("I't doesn't seem to work.");
-}
-
-int
-zzz()
-{
- int oldtime;
- int n;
-
- oldtime = gtime;
- if ((snooze - gtime) < (0.75 * CYCLE)){
- gtime += 0.75 * CYCLE - (snooze - gtime);
- printf("<zzz>");
- for (n = 0; n < gtime - oldtime; n++)
- printf(".");
- printf("\n");
- snooze += 3 * (gtime - oldtime);
- if (notes[LAUNCHED]){
- fuel -= (gtime - oldtime);
- if (location[position].down){
- position = location[position].down;
- crash();
- }
- else
- notes[LAUNCHED] = 0;
- }
- if (OUTSIDE && rnd(100) < 50){
- puts("You are awakened abruptly by the sound of someone nearby.");
- switch(rnd(4)){
- case 0:
- if (ucard(inven)){
- n = rnd(NUMOFOBJECTS);
- while(!testbit(inven,n))
- n = rnd(NUMOFOBJECTS);
- clearbit(inven,n);
- if (n != AMULET && n != MEDALION && n != TALISMAN)
- setbit(location[position].objects,n);
- carrying -= objwt[n];
- encumber -= objcumber[n];
- }
- puts("A fiendish little Elf is stealing your treasures!");
- fight(ELF,10);
- break;
- case 1:
- setbit(location[position].objects,DEADWOOD);
- break;
- case 2:
- setbit(location[position].objects,HALBERD);
- break;
- default:
- break;
- }
- }
- }
- else
- return(0);
- return(1);
-}
-
-void
-chime()
-{
- if ((gtime / CYCLE + 1) % 2 && OUTSIDE)
- switch((gtime % CYCLE)/(CYCLE / 7)){
- case 0:
- puts("It is just after sunrise.");
- break;
- case 1:
- puts("It is early morning.");
- break;
- case 2:
- puts("It is late morning.");
- break;
- case 3:
- puts("It is near noon.");
- break;
- case 4:
- puts("It is early afternoon.");
- break;
- case 5:
- puts("It is late afternoon.");
- break;
- case 6:
- puts("It is near sunset.");
- break;
- }
- else if (OUTSIDE)
- switch((gtime % CYCLE)/(CYCLE / 7)){
- case 0:
- puts("It is just after sunset.");
- break;
- case 1:
- puts("It is early evening.");
- break;
- case 2:
- puts("The evening is getting old.");
- break;
- case 3:
- puts("It is near midnight.");
- break;
- case 4:
- puts("These are the wee hours of the morning.");
- break;
- case 5:
- puts("The night is waning.");
- break;
- case 6:
- puts("It is almost morning.");
- break;
- }
- else
- puts("I can't tell the time in here.");
-}
-
-int
-give()
-{
- int obj = -1, result = -1, person = 0, firstnumber;
- int last1 = 0, last2 = 0;
-
- firstnumber = wordnumber;
- while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
- if (wordnumber <= wordcount){
- obj = wordvalue[wordnumber];
- if (obj == EVERYTHING)
- wordtype[wordnumber] = -1;
- last1 = wordnumber;
- }
- wordnumber = firstnumber;
- while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
- if (wordtype[wordnumber] == NOUNS){
- person = wordvalue[wordnumber];
- last2 = wordnumber;
- }
- /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
- * plain `give'. However, detecting this case is liable to detect
- * `give foo' as well, which would give a confusing error. We
- * need to make sure the -1 value can cause no problems if it arises.
- * If in the below we get to the drop("Given") then drop will look
- * at word 0 for an object to give, and fail, which is OK; then
- * result will be -1 and we get to the end, where wordnumber gets
- * set to something more sensible. If we get to "I don't think
- * that is possible" then again wordnumber is set to something
- * sensible. The wordnumber we leave with still isn't right if
- * you include words the game doesn't know in your command, but
- * that's no worse than what other commands than give do in
- * the same place. */
- wordnumber = last1 - 1;
- if (person && testbit(location[position].objects,person))
- if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
- puts("The goddess won't look at you.");
- else
- result = drop("Given");
- else {
- puts("I don't think that is possible.");
- wordnumber = max(last1, last2) + 1;
- return(0);
- }
- if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
- clearbit(location[position].objects,obj);
- gtime++;
- ego++;
- switch(person){
- case NATIVE:
- puts("She accepts it shyly.");
- ego += 2;
- break;
- case NORMGOD:
- if (obj == RING || obj == BRACELET){
- puts("She takes the charm and puts it on. A little kiss on the cheek is");
- puts("your reward.");
- ego += 5;
- godready += 3;
- }
- if (obj == AMULET || obj == MEDALION || obj == TALISMAN){
- bs_win++;
- ego += 5;
- power -= 5;
- if (bs_win >= 3){
- puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
- puts("and restored the goddess to her thrown. The entire island celebrates with");
- puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
- puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus.");
- puts("\nBut, as the year wears on and autumn comes along, you become restless and");
- puts("yearn for adventure. The goddess, too, realizes that the marriage can't last.");
- puts("She becomes bored and takes several more natives as husbands. One evening,");
- puts("after having been out drinking with the girls, she kicks the throne particularly");
- puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
- clearbit(location[position].objects,MEDALION);
- wintime = gtime;
- }
- }
- break;
- case TIMER:
- if (obj == COINS){
- puts("He fingers the coins for a moment and then looks up agape. `Kind you are and");
- puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n");
- printf( "+-----------------------------------------------------------------------------+\n");
- printf( "| xxxxxxxx\\ |\n");
- printf( "| xxxxx\\ CLIFFS |\n");
- printf( "| FOREST xxx\\ |\n");
- printf( "| \\\\ x\\ OCEAN |\n");
- printf( "| || x\\ |\n");
- printf( "| || ROAD x\\ |\n");
- printf( "| || x\\ |\n");
- printf( "| SECRET || ......... |\n");
- printf( "| - + - || ........ |\n");
- printf( "| ENTRANCE || ... BEACH |\n");
- printf( "| || ... E |\n");
- printf( "| || ... | |\n");
- printf( "| // ... N <-- + --- S |\n");
- printf( "| PALM GROVE // ... | |\n");
- printf( "| // ... W |\n");
- printf( "+-----------------------------------------------------------------------------+\n");
- puts("\n`This map shows a secret entrance to the catacombs.");
- puts("You will know when you arrive because I left an old pair of shoes there.'");
- }
- break;
- }
- }
- wordnumber = max(last1,last2) + 1;
- return(firstnumber);
-}
diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c
deleted file mode 100644
index d016443..0000000
--- a/games/battlestar/com6.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com6.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <signal.h>
-#include "externs.h"
-#include "pathnames.h"
-
-static void post(unsigned int ch);
-
-int
-launch()
-{
- if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
- if (fuel > 4){
- clearbit(location[position].objects,VIPER);
- position = location[position].up;
- notes[LAUNCHED] = 1;
- gtime++;
- fuel -= 4;
- puts("You climb into the viper and prepare for launch.");
- puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
- return(1);
- }
- else
- puts("Not enough fuel to launch.");
- }
- else
- puts("Can't launch.");
- return(0);
-}
-
-int
-land()
-{
- if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
- notes[LAUNCHED] = 0;
- position = location[position].down;
- setbit(location[position].objects,VIPER);
- fuel -= 2;
- gtime++;
- puts("You are down.");
- return(1);
- }
- else
- puts("You can't land here.");
- return(0);
-}
-
-void
-die(sig) /* endgame */
- int sig;
-{
- sig = 0;
- printf("bye.\nYour rating was %s.\n", rate());
- post(' ');
- exit(0);
-}
-
-void
-live()
-{
- puts("\nYou win!");
- post('!');
- exit(0);
-}
-
-#include <sys/time.h>
-
-static FILE *score_fp;
-
-void
-open_score_file()
-{
- if ((score_fp = fopen(_PATH_SCORE,"a")) == NULL)
- perror(_PATH_SCORE);
-}
-
-static void
-post(ch)
-unsigned int ch;
-{
- struct timeval tv;
- char *date;
- time_t tvsec;
- int s;
-
- if (score_fp == NULL)
- return;
-
- s = sigblock(sigmask(SIGINT));
-
- gettimeofday(&tv, (struct timezone *)0); /* can't call time */
- tvsec = (time_t) tv.tv_sec;
- date = ctime(&tvsec);
- date[24] = '\0';
-
- fprintf(score_fp, "%s %8s %c%20s", date, uname, ch, rate());
- if (wiz)
- fprintf(score_fp, " wizard\n");
- else if (tempwiz)
- fprintf(score_fp, " WIZARD!\n");
- else
- fprintf(score_fp, "\n");
-
- sigsetmask(s);
-}
-
-const char *
-rate()
-{
- int score;
-
- score = max(max(pleasure,power),ego);
- if (score == pleasure){
- if (score < 5)
- return("novice");
- else if (score < 20)
- return("junior voyeur");
- else if (score < 35)
- return("Don Juan");
- else return("Marquis De Sade");
- }
- else if (score == power){
- if (score < 5)
- return("serf");
- else if (score < 8)
- return("Samurai");
- else if (score < 13)
- return("Klingon");
- else if (score < 22)
- return("Darth Vader");
- else return("Sauron the Great");
- }
- else{
- if (score < 5)
- return("Polyanna");
- else if (score < 10)
- return("philanthropist");
- else if (score < 20)
- return("Tattoo");
- else return("Mr. Roarke");
- }
-}
-
-int
-drive()
-{
- if (testbit(location[position].objects,CAR)){
- puts("You hop in the car and turn the key. There is a perceptible grating noise,");
- puts("and an explosion knocks you unconscious...");
- clearbit(location[position].objects,CAR);
- setbit(location[position].objects,CRASH);
- injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
- gtime += 15;
- zzz();
- return(0);
- }
- else
- puts("There is nothing to drive here.");
- return(-1);
-}
-
-int
-ride()
-{
- if (testbit(location[position].objects,HORSE)){
- puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
- puts("forward through bush and fern. You are thrown and the horse gallups off.");
- clearbit(location[position].objects,HORSE);
- while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
- setbit(location[position].objects,HORSE);
- if (location[position].north)
- position = location[position].north;
- else if (location[position].south)
- position = location[position].south;
- else if (location[position].east)
- position = location[position].east;
- else
- position = location[position].west;
- return(0);
- }
- else puts("There is no horse here.");
- return(-1);
-}
-
-void
-light() /* synonyms = {strike, smoke} */
-{ /* for matches, cigars */
- if (testbit(inven,MATCHES) && matchcount){
- puts("Your match splutters to life.");
- gtime++;
- matchlight = 1;
- matchcount--;
- if (position == 217){
- puts("The whole bungalow explodes with an intense blast.");
- die(0);
- }
- }
- else puts("You're out of matches.");
-}
diff --git a/games/battlestar/com7.c b/games/battlestar/com7.c
deleted file mode 100644
index 9c509ff..0000000
--- a/games/battlestar/com7.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)com7.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-int
-fight(enemy,strength)
-int enemy,strength;
-{
- int lifeline = 0;
- int hurt;
- char auxbuf[LINELENGTH];
- char *next;
- int i;
- int exhaustion = 0;
-
-fighton:
- gtime++;
- snooze -= 5;
- if (snooze > gtime)
- exhaustion = CYCLE/(snooze - gtime);
- else {
- puts("You collapse exhausted, and he pulverizes your skull.");
- die(0);
- }
- if (snooze - gtime < 20)
- puts("You look tired! I hope you're able to fight.");
- next = getcom(auxbuf, LINELENGTH, "<fight!>-: ", 0);
- for (i=0; next && i < 10; i++)
- next = getword(next, words[i], -1);
- parse();
- switch(wordvalue[wordnumber]){
-
- case KILL:
- case SMITE:
- if (testbit(inven,TWO_HANDED))
- hurt = rnd(70) - 2 * card(injuries,NUMOFINJURIES) - ucard(wear) - exhaustion;
- else if (testbit(inven,SWORD) || testbit(inven, BROAD))
- hurt = rnd(50)%(WEIGHT-carrying)-card(injuries,NUMOFINJURIES)-encumber - exhaustion;
- else if (testbit(inven,KNIFE) || testbit(inven,MALLET) || testbit(inven,CHAIN) || testbit(inven,MACE) || testbit(inven,HALBERD))
- hurt = rnd(15) - card(injuries,NUMOFINJURIES) - exhaustion;
- else
- hurt = rnd(7) - encumber;
- if (hurt < 5)
- switch(rnd(3)){
-
- case 0:
- puts("You swung wide and missed.");
- break;
- case 1:
- puts("He checked your blow. CLASH! CLANG!");
- break;
- case 2:
- puts("His filthy tunic hangs by one less thread.");
- break;
- }
- else if (hurt < 10){
- switch(rnd(3)){
- case 0:
- puts("He's bleeding.");
- break;
- case 1:
- puts("A trickle of blood runs down his face.");
- break;
- case 2:
- puts("A huge purple bruise is forming on the side of his face.");
- break;
- }
- lifeline++;
- }
- else if (hurt < 20){
- switch(rnd(3)){
- case 0:
- puts("He staggers back quavering.");
- break;
- case 1:
- puts("He jumps back with his hand over the wound.");
- break;
- case 2:
- puts("His shirt falls open with a swath across the chest.");
- break;
- }
- lifeline += 5;
- }
- else if (hurt < 30){
- switch(rnd(3)){
- case 0:
- printf("A bloody gash opens up on his %s side.\n",(rnd(2) ? "left" : "right"));
- break;
- case 1:
- puts("The steel bites home and scrapes along his ribs.");
- break;
- case 2:
- puts("You pierce him, and his breath hisses through clenched teeth.");
- break;
- }
- lifeline += 10;
- }
- else if (hurt < 40){
- switch(rnd(3)){
- case 0:
- puts("You smite him to the ground.");
- if (strength - lifeline > 20)
- puts("But in a flurry of steel he regains his feet!");
- break;
- case 1:
- puts("The force of your blow sends him to his knees.");
- puts("His arm swings lifeless at his side.");
- break;
- case 2:
- puts("Clutching his blood drenched shirt, he collapses stunned.");
- break;
- }
- lifeline += 20;
- }
- else {
- switch(rnd(3)){
- case 0:
- puts("His ribs crack under your powerful swing, flooding his lungs with blood.");
- break;
- case 1:
- puts("You shatter his upheld arm in a spray of blood. The blade continues deep");
- puts("into his back, severing the spinal cord.");
- lifeline += 25;
- break;
- case 2:
- puts("With a mighty lunge the steel slides in, and gasping, he falls to the ground.");
- lifeline += 25;
- break;
- }
- lifeline += 30;
- }
- break;
-
- case BACK:
- if (enemy == DARK && lifeline > strength * 0.33){
- puts("He throws you back against the rock and pummels your face.");
- if (testbit(inven,AMULET) || testbit(wear,AMULET)){
- printf("Lifting the amulet from you, ");
- if (testbit(inven,MEDALION) || testbit(wear,MEDALION)){
- puts("his power grows and the walls of\nthe earth tremble.");
- puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse.");
- puts("The planet is consumed by darkness.");
- die(0);
- }
- if (testbit(inven,AMULET)){
- clearbit(inven,AMULET);
- carrying -= objwt[AMULET];
- encumber -= objcumber[AMULET];
- }
- else
- clearbit(wear,AMULET);
- puts("he flees down the dark caverns.");
- clearbit(location[position].objects,DARK);
- injuries[SKULL] = 1;
- followfight = gtime;
- return (0);
- }
- else{
- puts("I'm afraid you have been killed.");
- die(0);
- }
- }
- else{
- puts("You escape stunned and disoriented from the fight.");
- puts("A victorious bellow echoes from the battlescene.");
- if (back && position != back)
- battlestar_move(back,BACK);
- else if (ahead &&position != ahead)
- battlestar_move(ahead,AHEAD);
- else if (left && position != left)
- battlestar_move(left,LEFT);
- else if (right && position != right)
- battlestar_move(right,RIGHT);
- else
- battlestar_move(location[position].down,
- AHEAD);
- return(0);
- }
-
- case SHOOT:
- if (testbit(inven,LASER)){
- if (strength - lifeline <= 50){
- printf("The %s took a direct hit!\n",objsht[enemy]);
- lifeline += 50;
- }
- else {
- puts("With his bare hand he deflects the laser blast and whips the pistol from you!");
- clearbit(inven,LASER);
- setbit(location[position].objects,LASER);
- carrying -= objwt[LASER];
- encumber -= objcumber[LASER];
- }
- }
- else
- puts("Unfortunately, you don't have a blaster handy.");
- break;
-
- case DROP:
- case DRAW:
- cypher();
- gtime--;
- break;
-
- default:
- puts("You don't have a chance, he is too quick.");
- break;
-
- }
- if (lifeline >= strength){
- printf("You have killed the %s.\n", objsht[enemy]);
- if (enemy == ELF || enemy == DARK)
- puts("A watery black smoke consumes his body and then vanishes with a peal of thunder!");
- clearbit(location[position].objects,enemy);
- power += 2;
- notes[JINXED]++;
- return(0);
- }
- puts("He attacks...");
- /* some embellisments */
- hurt = rnd(NUMOFINJURIES) - (testbit(inven,SHIELD) != 0) - (testbit(wear,MAIL) != 0) - (testbit(wear,HELM) != 0);
- hurt += (testbit(wear,AMULET) != 0) + (testbit(wear,MEDALION) != 0) + (testbit(wear,TALISMAN) != 0);
- hurt = hurt < 0 ? 0 : hurt;
- hurt = hurt >= NUMOFINJURIES ? NUMOFINJURIES -1 : hurt;
- if (!injuries[hurt]){
- injuries[hurt] = 1;
- printf("I'm afraid you have suffered %s.\n", ouch[hurt]);
- }
- else
- puts("You emerge unscathed.");
- if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){
- puts("I'm afraid you have suffered fatal injuries.");
- die(0);
- }
- goto fighton;
-}
diff --git a/games/battlestar/cypher.c b/games/battlestar/cypher.c
deleted file mode 100644
index e61c938..0000000
--- a/games/battlestar/cypher.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cypher.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-int
-cypher()
-{
- int n;
- int junk;
- int lflag = -1;
- char buffer[10];
-
- while (wordtype[wordnumber] == ADJS)
- wordnumber++;
- while (wordnumber <= wordcount) {
- switch(wordvalue[wordnumber]) {
-
- case UP:
- if (location[position].access || wiz || tempwiz) {
- if (!location[position].access)
- puts("Zap! A gust of wind lifts you up.");
- if (!battlestar_move(location[position].up, AHEAD))
- return(-1);
- } else {
- puts("There is no way up");
- return(-1);
- }
- lflag = 0;
- break;
-
- case DOWN:
- if (!battlestar_move(location[position].down,
- AHEAD))
- return(-1);
- lflag = 0;
- break;
-
- case LEFT:
- if (!battlestar_move(left, LEFT))
- return(-1);
- lflag = 0;
- break;
-
- case RIGHT:
- if (!battlestar_move(right, RIGHT))
- return(-1);
- lflag = 0;
- break;
-
- case AHEAD:
- if (!battlestar_move(ahead, AHEAD))
- return(-1);
- lflag = 0;
- break;
-
- case BACK:
- if (!battlestar_move(back, BACK))
- return(-1);
- lflag = 0;
- break;
-
- case SHOOT:
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && objsht[n]){
- wordvalue[wordnumber+1] = n;
- wordnumber = shoot();
- }
- wordnumber++;
- wordnumber++;
- }
- else
- shoot();
- break;
-
- case TAKE:
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && objsht[n]){
- wordvalue[wordnumber+1] = n;
- wordnumber = take(location[position].objects);
- }
- wordnumber++;
- wordnumber++;
- }
- else
- take(location[position].objects);
- break;
-
- case DROP:
-
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(inven,n)){
- wordvalue[wordnumber+1] = n;
- wordnumber = drop("Dropped");
- }
- wordnumber++;
- wordnumber++;
- }
- else
- drop("Dropped");
- break;
-
-
- case KICK:
- case THROW:
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if ((testbit(inven,n) ||
- testbit(location[position].objects, n)) && objsht[n]){
- wordvalue[wordnumber+1] = n;
- wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
- }
- wordnumber += 2;
- } else
- throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
- break;
-
- case TAKEOFF:
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(wear,n)){
- wordvalue[wordnumber+1] = n;
- wordnumber = takeoff();
- }
- wordnumber += 2;
- }
- else
- takeoff();
- break;
-
-
- case DRAW:
-
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(wear,n)){
- wordvalue[wordnumber+1] = n;
- wordnumber = draw();
- }
- wordnumber += 2;
- }
- else
- draw();
- break;
-
-
- case PUTON:
-
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && objsht[n]){
- wordvalue[wordnumber+1] = n;
- wordnumber = puton();
- }
- wordnumber += 2;
- }
- else
- puton();
- break;
-
- case WEARIT:
-
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(inven,n)){
- wordvalue[wordnumber+1] = n;
- wordnumber = wearit();
- }
- wordnumber += 2;
- }
- else
- wearit();
- break;
-
-
- case EAT:
-
- if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(inven,n)){
- wordvalue[wordnumber+1] = n;
- wordnumber = eat();
- }
- wordnumber += 2;
- }
- else
- eat();
- break;
-
-
- case PUT:
- put();
- break;
-
-
- case INVEN:
- if (ucard(inven)){
- puts("You are holding:\n");
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(inven,n))
- printf("\t%s\n", objsht[n]);
- printf("\n= %d kilogram%s (%d%%)\n", carrying, (carrying == 1 ? "." : "s."),(WEIGHT ? carrying*100/WEIGHT : -1));
- printf("Your arms are %d%% full.\n",encumber*100/CUMBER);
- }
- else
- puts("You aren't carrying anything.");
-
- if (ucard(wear)){
- puts("\nYou are wearing:\n");
- for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(wear,n))
- printf("\t%s\n", objsht[n]);
- }
- else
- puts("\nYou are stark naked.");
- if (card(injuries,NUMOFINJURIES)){
- puts("\nYou have suffered:\n");
- for (n=0; n < NUMOFINJURIES; n++)
- if (injuries[n])
- printf("\t%s\n",ouch[n]);
- printf("\nYou can still carry up to %d kilogram%s\n",WEIGHT,(WEIGHT == 1 ? "." : "s."));
- }
- else
- puts("\nYou are in perfect health.");
- break;
-
- case USE:
- lflag = use();
- break;
-
- case LOOK:
- if (!notes[CANTSEE] || testbit(inven,LAMPON) || testbit(location[position].objects,LAMPON) || matchlight){
- beenthere[position] = 2;
- writedes();
- printobjs();
- if (matchlight){
- puts("\nYour match splutters out.");
- matchlight = 0;
- }
- } else
- puts("I can't see anything.");
- return(-1);
- break;
-
- case SU:
- if (wiz || tempwiz){
- printf("\nRoom (was %d) = ", position);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d", &position);
- printf("Time (was %d) = ",gtime);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d", &gtime);
- printf("Fuel (was %d) = ",fuel);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d", &fuel);
- printf("Torps (was %d) = ",torps);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d", &torps);
- printf("CUMBER (was %d) = ",CUMBER);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d", &CUMBER);
- printf("WEIGHT (was %d) = ",WEIGHT);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d",&WEIGHT);
- printf("Clock (was %d) = ",gclock);
- fgets(buffer,10,stdin);
- if (*buffer != '\n')
- sscanf(buffer,"%d",&gclock);
- printf("Wizard (was %d, %d) = ",wiz, tempwiz);
- fgets(buffer,10,stdin);
- if (*buffer != '\n'){
- sscanf(buffer,"%d",&junk);
- if (!junk)
- tempwiz = wiz = 0;
- }
- printf("\nDONE.\n");
- return(0);
- }
- else
- puts("You aren't a wizard.");
- break;
-
- case SCORE:
- printf("\tPLEASURE\tPOWER\t\tEGO\n");
- printf("\t%3d\t\t%3d\t\t%3d\n\n",pleasure,power,ego);
- printf("This gives you the rating of %s in %d turns.\n",rate(),gtime);
- printf("You have visited %d out of %d rooms this run (%d%%).\n",card(beenthere,NUMOFROOMS),NUMOFROOMS,card(beenthere,NUMOFROOMS)*100/NUMOFROOMS);
- break;
-
- case KNIFE:
- case KILL:
- murder();
- break;
-
- case UNDRESS:
- case RAVAGE:
- ravage();
- break;
-
- case SAVE:
- save();
- break;
-
- case FOLLOW:
- lflag = follow();
- break;
-
- case GIVE:
- give();
- break;
-
- case KISS:
- kiss();
- break;
-
- case LOVE:
- love();
- break;
-
- case RIDE:
- lflag = ride();
- break;
-
- case DRIVE:
- lflag = drive();
- break;
-
- case LIGHT:
- light();
- break;
-
- case LAUNCH:
- if (!launch())
- return(-1);
- else
- lflag = 0;
- break;
-
- case LANDIT:
- if (!land())
- return(-1);
- else
- lflag = 0;
- break;
-
- case TIME:
- chime();
- break;
-
- case SLEEP:
- zzz();
- break;
-
- case DIG:
- dig();
- break;
-
- case JUMP:
- lflag = jump();
- break;
-
- case BURY:
- bury();
- break;
-
- case SWIM:
- puts("Surf's up!");
- break;
-
- case DRINK:
- drink();
- break;
-
- case QUIT:
- die(0);
-
- default:
- puts("How's that?");
- return(-1);
- break;
-
-
- }
- if (wordnumber < wordcount && *words[wordnumber++] == ',')
- continue;
- else return(lflag);
- }
- return(lflag);
-}
diff --git a/games/battlestar/dayfile.c b/games/battlestar/dayfile.c
deleted file mode 100644
index fca5995..0000000
--- a/games/battlestar/dayfile.c
+++ /dev/null
@@ -1,1209 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dayfile.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-struct room dayfile[] = {
- { 0 },
- { "You are in the main hangar.",
- { 5, 2, 9, 3, 3, 1, 0, 0 },
-"This is a huge bay where many fighters and cargo craft lie. Alarms are \n\
-sounding and fighter pilots are running to their ships. Above is a gallery\n\
-overlooking the bay. The scream of turbo engines is coming from +. The rest\n\
-of the hangar is +. There is an exit +.*\n" },
- { "This is the landing bay.",
- { 1, 0, 10, 0, 0, 0, 0, 0 },
-"Ships are landing here, some heavily damaged. Enemy fighters continually\n\
-strafe this vulnerable port. The main hangar is +, *\n\
-There is an exit +.*\n" },
- { "You are in the gallery.",
- { 4, 0, 0, 0, 0, 0, 1, 0 },
-"From here a view of the entire landing bay reveals that our battlestar\n\
-is near destruction. Fires are spreading out of control and laser blasts\n\
-lick at the shadows. The control room is +. ***\n" },
- { "You are in the control room.",
- { 0, 3, 0, 0, 0, 0, 5, 0 },
-"Several frantic technicians are flipping switches wildly but otherwise\n\
-this room seems fairly deserted. A weapons locker has been left open.\n\
-A staircase leads down. * There is a way -. ** \n" },
- { "This is the launch room.",
- { 6, 1, 7, 0, 4, 1, 0, 0 },
-"From the launch tubes here fighters blast off into space. Only one is left,\n\
-and it is guarded by two fierce men. A staircase leads up from here.\n\
-There is a cluttered workbench +. From the main hangar come sounds of great\n\
-explosions. The main hangar is +. The viper launch tubes are to the -.*\n" },
- { "You are at the workbench.",
- { 0, 5, 7, 0, 0, 0, 0, 0 },
-"Strange and unwieldy tools are arranged here including a lunch box \n\
-and pneumatic wrenches and turbo sprocket rockets.*\n\
-The launch room is +. The remaining viper is +.*\n" },
- { "You are in the viper launch tube.",
- { 0, 5, 0, 5, 32, 0, 0, 0 },
-"The two guards are eyeing you warily! ****\n" },
- { "This is a walk in closet.",
- { 22, 0, 0, 0, 0, 0, 0, 0 },
-"A wardrobe of immense magnitude greets the eye. Furs and robes of kings\n\
-hang on rack after rack. Silken gowns, capes woven with spun gold, and \n\
-delicate synthetic fabrics are stowed here. The bedroom is +.***\n" },
- { "You are in a wide hallway leading to the main hangar.",
- { 0, 0, 11, 1, 0, 0, 0, 0 },
-"The walls and ceiling here have been blasted through in several places.\n\
-It looks as if quite a battle has been fought for possession of the landing bay\n\
-Gaping corpses litter the floor.** The hallway continues +.\n\
-The main hangar is +.\n" },
- { "You are in a wide hallway leading to the landing bay.",
- { 0, 0, 12, 2, 0, 0, 0, 0 },
-"Most of the men and supplies needed in the main hangar come through this\n\
-corridor, but the wounded are forced to use it too. It very dank and\n\
-crowded here, and the floor is slippery with blood.**\n\
-The hallway continues -. The landing bay is +.\n" },
- { "The hallway is very congested with rubble here.",
- { 0, 0, 0, 9, 13, 1, 0, 0 },
-"It is too choked with broken steel girders and other debris to continue\n\
-on much farther. Above, the ceiling has caved in and it is possible to \n\
-climb up. There is not much chance to go -, -, or -.\n\
-But the hallway seems clearer +.\n" },
- { "A wide hallway and a more narrow walkway meet here.",
- { 14, 15, 0, 10, 0, 0, 0, 0 },
-"The intersection is crowded with the many wounded who have come up\n\
-the wide hallway and continued +. The walkway is less crowded +.\n\
-The wide hallway goes *-.\n" },
- { "You are in what was once an elegant stateroom.",
- { 16, 0, 0, 0, 0, 0, 11, 0 },
-"Whoever lived in this stateroom, he and his female companion\n\
-were mercilessly slain in their sleep. Clothes, trinkets and personal\n\
-belongings are scattered all across the floor. Through a hole in the\n\
-collapsed floor I can see a hallway below. A door is +.***\n" },
- { "You're at the entrance to the sick bay.",
- { 17, 12, 18, 0, 0, 0, 0, 0 },
-"The wounded are entering the sick bay in loudly moaning files.\n\
-The walkway continues - and +. A doctor is motioning for you to \n\
-come to the -. *\n" },
- { "You're in the walkway.",
- { 12, 19, 0, 0, 0, 0, 0, 0 },
-"Most of the men and supplies were coming from the armory. The walkway\n\
-continues -. The armory is +.**\n" },
- { "These are the executive suites of the battlestar.",
- { 20, 13, 21, 22, 23, 1, 24, 0 },
-"Luxurious staterooms carpeted with crushed velvet and adorned with beaten\n\
-gold open onto this parlor. A wide staircase with ivory banisters leads\n\
-up or down. This parlor leads into a hallway +. The bridal suite is +.\n\
-Other rooms lie - and +.\n" },
- { "You're in a long dimly lit hallway.",
- { 0, 14, 25, 0, 0, 0, 0, 0 },
-"This part of the walkway is deserted. There is a dead end +. The\n\
-entrance to the sickbay is +. The walkway turns sharply -.*\n" },
- { "This is the sick bay.",
- { 0, 0, 0, 14, 0, 0, 0, 0 },
-"Sinister nurses with long needles and pitiful aim probe the depths of suffering\n\
-here. Only the mortally wounded receive medical attention on a battlestar,\n\
-but afterwards they are thrown into the incinerators along with the rest.**\n\
-Nothing but death and suffering +. The walkway is +.\n" },
- { "You're in the armory.",
- { 15, 26, 0, 0, 0, 0, 0, 0 },
-"An armed guard is stationed here 365 sectars a yarn to protect the magazine.\n\
-The walkway is +. The magazine is +.**\n" },
- { "The hallway ends here at the presidential suite.",
- { 27, 16, 0, 0, 0, 0, 0, 0 },
-"The door to this suite is made from solid magnesium, and the entryway is\n\
-inlaid with diamonds and fire opals. The door is ajar +. The hallway\n\
-goes -.**\n" },
- { "This is the maid's utility room.",
- { 0, 0, 0, 16, 0, 0, 0, 0 },
-"What a gruesome sight! The maid has been brutally drowned in a bucket of\n\
-Pine Sol and repeatedly stabbed in the back with a knife.***\n\
-The hallway is +.\n" },
- { "This is a luxurious stateroom.",
- { 0, 8, 16, 0, 0, 0, 0, 0 },
-"The floor is carpeted with a soft animal fur and the great wooden furniture\n\
-is inlaid with strips of platinum and gold. Electronic equipment built\n\
-into the walls and ceiling is flashing wildly. The floor shudders and\n\
-the sounds of dull explosions rumble though the room. From a window in\n\
-the wall + comes a view of darkest space. There is a small adjoining\n\
-room +, and a doorway +.*\n" },
- { "You are at the entrance to the dining hall.",
- { 0, 0, 28, 0, 0, 0, 16, 0 },
-"A wide staircase with ebony banisters leads down here.**\n\
-The dining hall is to the -.*\n" },
- { "This was once the first class lounge.",
- { 0, 0, 29, 0, 16, 1, 0, 0 },
-"There is much rubble and destruction here that was not apparent elsewhere.\n\
-The walls and ceilings have broken in in some places. A staircase with\n\
-red coral banisters leads up. It is impossible to go - or -.\n\
-It seems a little clearer +.*\n" },
- { "You are in a narrow stairwell.",
- { 0, 17, 0, 0, 30, 1, 0, 0 },
-"These dusty and decrepit stairs lead up. There is no way -. The\n\
-hallway turns sharply -.**\n" },
- { "You are in the magazine.",
- { 19, 0, 0, 0, 0, 0, 0, 0 },
-"Rows and rows of neatly stacked ammunition for laser pistols and grenade\n\
-launchers are here. The armory is +.***\n" },
- { "You're in the presidential suite.",
- { 0, 20, 0, 0, 0, 0, 0, 0 },
-"Apparently the president has been assassinated. A scorched figure lies\n\
-face downward on the carpet clutching his chest.*\n\
-The hallway leads -.**\n" },
- { "You are in the dining hall.",
- { 0, 30, 31, 23, 0, 0, 0, 0 },
-"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\
-dignitaries sit slumped over their breakfast cereal. I suppose the news\n\
-of the cylon attack killed them. There is a strange chill in this room. I\n\
-would not linger here. * The kitchen is +. Entrances + and +.\n" },
- { "The debris is very thick here.",
- { 0, 11, 0, 24, 0, 0, 0, 0 },
-"Broken furniture, fallen girders, and other rubble block the way.\n\
-There is not much chance to continue -, -, or -.\n\
-It would be best to go -.\n" },
- { "You are in the kitchen.",
- { 28, 0, 0, 0, 0, 0, 0, 0 },
-"This room is full of shining stainless steel and burnished bronze cookware. An \n\
-assortment of tropical fruits and vegetables as well as fine meats and cheeses \n\
-lies on a sterling platter. The chef, unfortunately, has been skewered like a \n\
-side of beef. The dining room is +. ** There is a locked door +.\n" },
- { "You are in an arched entry leading to the dining room.",
- { 0, 0, 0, 28, 0, 0, 0, 0 },
-"The door leading out is bolted shut from the outside and is very strong.***\n\
-The dining room is +.\n" },
- { "You are in space.",
- { 33, 34, 35, 36, 37, 1, 33, 1},
-"****\n" },
- { "You are in space.",
- { 38, 32, 39, 40, 41, 1, 42, 1},
-"****\n" },
- { "You are in space.",
- { 32, 44, 45, 46, 47, 1, 48, 1},
-"****\n" },
- { "You are in space.",
- { 40, 45, 49, 32, 50, 1, 51, 1},
-"****\n" },
- { "You are in space.",
- { 41, 46, 32, 52, 53, 1, 54, 1},
-"****\n" },
- { "You are in space.",
- { 42, 47, 50, 53, 55, 1, 32, 1},
-"****\n" },
- { "You are in space.",
- { 43, 48, 51, 54, 32, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 57, 33, 40, 41, 42, 1, 43, 1},
-"****\n" },
- { "You are in space.",
- { 39, 35, 57, 33, 58, 1, 59, 1},
-"****\n" },
- { "You are in space.",
- { 39, 36, 33, 59, 60, 1, 61, 1},
-"****\n" },
- { "You are in space.",
- { 39, 37, 58, 60, 62, 1, 33, 1},
-"****\n" },
- { "You are in space.",
- { 39, 38, 59, 61, 33, 1, 63, 1},
-"****\n" },
- { "You are in space.",
- { 34, 64, 45, 46, 47, 1, 48, 1},
-"****\n" },
- { "You are in space.",
- { 35, 44, 49, 34, 50, 1, 51, 1},
-"****\n" },
- { "You are in space.",
- { 36, 44, 34, 52, 53, 1, 54, 1},
-"****\n" },
- { "You are in space.",
- { 37, 44, 50, 53, 55, 1, 34, 1},
-"****\n" },
- { "You are in space.",
- { 38, 44, 51, 54, 34, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 49, 49, 52, 35, 49, 1, 49, 1},
-"****\n" },
- { "You are in space.",
- { 58, 47, 49, 37, 55, 1, 35, 1},
-"****\n" },
- { "You are in space.",
- { 59, 48, 49, 38, 35, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 52, 52, 36, 49, 52, 1, 52, 1},
-"****\n" },
- { "You are in space.",
- { 60, 46, 37, 52, 55, 1, 36, 1},
-"****\n" },
- { "You are in space.",
- { 61, 48, 38, 52, 36, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 62, 55, 55, 55, 56, 1, 37, 1},
-"****\n" },
- { "You are in space.",
- { 56, 56, 56, 56, 38, 1, 55, 1},
-"****\n" },
- { "You are in space.",
- { 65, 39, 57, 57, 57, 1, 57, 1},
-"****\n" },
- { "You are in space.",
- { 39, 50, 49, 42, 62, 1, 40, 1},
-"****\n" },
- { "You are in space.",
- { 39, 51, 49, 43, 40, 1, 63, 1},
-"****\n" },
- { "You are in space.",
- { 39, 53, 43, 59, 62, 1, 41, 1},
-"****\n" },
- { "You are in space.",
- { 39, 54, 43, 59, 41, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 39, 55, 62, 62, 56, 1, 42, 1},
-"****\n" },
- { "You are in space.",
- { 39, 56, 35, 36, 43, 1, 55, 1},
-"****\n" },
- { "You are in space.",
- { 44, 66, 66, 66, 66, 1, 66, 1},
-"****\n" },
- { "You are in space.",
- { 67, 57, 67, 67, 67, 1, 67, 1},
-"****\n" },
- { "You are in space.",
- { 64, 68, 68, 68, 68, 1, 68, 1},
-"****\n" },
- { "You are orbiting a small blue planet.",
- { 67, 67, 67, 67, 65, 1, 69, 1},
-"****\n" },
- { "You are orbiting a tropical planet.",
- { 68, 68, 68, 68, 66, 1, 70, 1},
-"****\n" },
- { "You are flying through a dense fog.",
- { 69, 69, 69, 69, 69, 1, 69, 1},
-"A cold grey sea of mist is swirling around the windshield and water droplets\n\
-are spewing from the wingtips. Ominous shadows loom in the darkness and it\n\
-feels as if a trap is closing around us. I have lost all sense of direction.\n\
-****\n" },
- { "You are approaching an island.",
- { 71, 72, 73, 74, 68, 1, 0, 1},
-"Coconut palms, sword ferns, orchids, and other lush vegetation drape this\n\
-jagged island carved seemingly from pure emerald and set in a turquoise\n\
-sea. The land rises sharply +. There is a nice beach* +.*\n" },
- { "You are flying over a mountainous region.",
- { 75, 73, 76, 77, 68, 1, 0, 1},
-"Below is a magnificent canyon with deep gorges, high pinnacles and\n\
-waterfalls plummeting hundreds of feet into mist. Everything in sight\n\
-is carpeted with a tropical green.* The ocean is +.**\n" },
- { "You are flying over the ocean.",
- { 74, 78, 78, 78, 68, 1, 0, 1},
-"You bank over the water and your wingtips dip low to the green waves. The\n\
-sea is very shallow here and the white coral beds beneath us teem with \n\
-colorful fish.****\n" },
- { "You are flying over the beach.",
- { 71, 72, 79, 74, 68, 1, 80, 1},
-"A warm gentle surf caresses the white coral beach here. The land rises\n\
-sharply +.* The beach is lost in low cliffs and rocks +.*\n" },
- { "You are flying over a large lagoon.",
- { 81, 72, 73, 82, 68, 1, 0, 1},
-"Encircled by a coral reef, the palms and ferns in this sheltered spot\n\
-have grown down to the water's very brink which winds tortuously inland.\n\
-There looks like a small village +.***\n" },
- { "You are flying over a gently sloping plane.",
- { 83, 71, 84, 85, 68, 1, 0, 1},
-"This is where several alluvial fans and ancient lava flows have run\n\
-together forming a fertile plane choked with vegetation. It would be\n\
-impossible to land safely here.* The terrain is more rugged +.**\n" },
- { "You are flying through a gorge.",
- { 0, 0, 86, 71, 68, 1, 102, 1},
-"This narrow, steep sided canyon is lined with waving ferns. The floor is of\n\
-light gravel with many freshets pouring from the walls and running along it.\n\
-The gorge leads to the sea** +, and to a tumultuous origin +.\n" },
- { "You are flying over a plantation.",
- { 85, 81, 71, 88, 68, 1, 89, 1},
-"Rows of palms, papayas, mangoes, kiwi, as well as smaller fields of sugar\n\
-cane and pineapple are growing here. It might be possible to land here, but\n\
-I wouldn't advise it.* There looks like two small settlements + \n\
-and *+.\n" },
- { "You are over the ocean.",
- { 72, 78, 79, 74, 68, 1, 0, 1},
-"The deep green swells foam and roll into the shore **+*.\n" },
- { "You are flying along the coast.",
- { 86, 72, 90, 73, 68, 1, 91, 1},
-"The coastline here is very rocky with little or no sand. The surf in some\n\
-places is violent and explodes in a shower of sparkling spray.\n\
-There is a winding road below which closely follows the shore. ****\n" },
- { "This is a beautiful coral beach.",
- { 106, 0, 107, 108, 73, 0, 0, 0 },
-"Fine silver sand kissed lightly by warm tropical waters stretches at least\n\
-30 meters here from the ocean to under gently swaying palms +.***\n" },
- { "You are flying over a small fishing village.",
- { 77, 74, 71, 82, 68, 1, 92, 1},
-"A few thatched huts a short distance from the water and row of more modern\n\
-bungalows on either side of a dirt road are all that is here. The road\n\
-continues on ***+.\n" },
- { "You are flying over a clearing.",
- { 88, 72, 74, 87, 68, 1, 93, 1},
-"There is a dock here (big enough for a seaplane) leading to a grassy\n\
-meadow and a road. Some people are having a party down there. Below is\n\
-a good landing site. ****\n" },
- { "You are flying over the shore.",
- { 94, 75, 95, 96, 68, 1, 0, 1},
-"Rocky lava flows or coarse sandy beaches are all that is here except for\n\
-sparse herbs and weeds.****\n" },
- { "You are flying in a wide valley.",
- { 95, 97, 86, 75, 68, 1, 98, 1},
-"This is a shallow valley yet the floor is obscured by a thick mist.\n\
-The valley opens to the sea +. The mist grows thicker +.**\n" },
- { "You are flying near the shore.",
- { 96, 77, 75, 99, 68, 1, 0, 1},
-"Very tall palm trees growing in neatly planted rows march off from the \n\
-water here towards the hills and down to the flat lands *+.*\n\
-There is a nice beach +.\n" },
- { "You are flying around the very tip of the island.",
- { 95, 79, 90, 84, 68, 1, 0, 1},
-"There is no beach here for sheer cliffs rise several hundred feet\n\
-to a tree covered summit. Far below, the blue sea gnaws voraciously at\n\
-the roots of these cliffs. The island bends around +** and +.\n" },
- { "You are flying along the coastline.",
- { 99, 82, 88, 100, 68, 1, 101, 1},
-"There is a narrow strip of sand here lined with ferns and shrubs, but very\n\
-few trees. The beach is barley wide enough to land on. The beach continues\n\
-on -.* There are some buildings +.*\n" },
- { "You are flying over several cottages and buildings",
- { 99, 82, 77, 87, 68, 1, 103, 1},
-"The grounds here are landscaped with palm trees, ferns, orchids, and beds of\n\
-flowering plumeria and antheriums. Directly below is a small ornate white\n\
-house with a belltower, a lush green lawn, and a spurting fountain.\n\
-Small dirt roads go + and +.**\n" },
- { "You are in a field of sugar cane.",
- { 109, 110, 111, 112, 77, 0, 0, 0 },
-"These strong, thick canes give little shelter but many cuts and scrapes.\n\
-There are some large trees ***+.\n" },
- { "You are flying over the ocean.",
- { 95, 78, 90, 86, 68, 1, 0, 1},
-"The water is a placid turquoise and so clear that fish and sharks\n\
-many fathoms below are clearly visible.****\n" },
- { "You are on the coast road.",
- { 113, 114, 115, 116, 79, 0, 0, 0 },
-"The road winds close to the shore here and the sound of crashing surf is\n\
-deafening.* The water is +. The road continues - and -.\n" },
- { "You are on the main street of the village.",
- { 117, 118, 119, 120, 81, 0, 0, 0 },
-"Thatched roofs and outrigger canoes, palm trees and vacation bungalows, and\n\
-comely natives in a tropical paradise all make this a fantasy come true.\n\
-There is an open bungalow +.* The road continues - and -.\n" },
- { "You are at the sea plane dock.",
- { 121, 122, 123, 124, 82, 0, 0, 0 },
-"Native girls with skin of gold, clad only in fragrant leis and lavalavas,\n\
-line the dockside to greet you. A couple of ukulele plucking islanders and a\n\
-keyboard player are adding appropriate music. A road crosses the clearing \n\
-+*. There are some tables set up +.*\n" },
- { "You are flying over the ocean.",
- { 94, 83, 95, 96, 68, 1, 0, 1},
-"Sea weeds and kelp surge in the waves off shore here. The ocean becomes \n\
-much deeper +.***\n" },
- { "You are flying along the coast.",
- { 94, 84, 86, 83, 68, 1, 0, 1},
-"The land is very low here with a river running into the sea +. There\n\
-is a wide valley opening up +. The very tip of the island is +.*\n" },
- { "You are flying along the coast.",
- { 94, 85, 83, 99, 68, 1, 0, 1},
-"There are some secluded sandy stretches of beach here, but too many rocky\n\
-outcroppings of lava to land. There is a nicer beach ***+.\n" },
- { "You are lost in a sea of fog.",
- { 97, 104, 97, 97, 97, 1, 0, 1},
-"What have you gotten us into?\n\
-I can't see a thing! ****\n" },
- { "You are on a gravel wash.",
- { 125, 126, 127, 128, 84, 0, 0, 0 },
-"The sound of cascading water is the background for a diluted chorus of \n\
-gurgling, splashing, and enchantingly delicate singing. Great billows\n\
-of steam are rising *+.**\n" },
- { "You are flying over a wide beach.",
- { 96, 88, 85, 87, 68, 1, 105, 1},
-"Unlike the leeward beaches, few coconut palms grow here but a well groomed\n\
-lawn and garden with traipsing stone walks leads down to the sand.*\n\
-There are some buildings +. Some trees are growing +.*\n" },
- { "You are flying over the ocean.",
- { 100, 100, 87, 100, 68, 1, 0, 1},
-"The sea is a perfectly clear blue with a white sandy bottom. No coral\n\
-grows underwater here, but the force of the waves is broken by the steep\n\
-incline.****\n" },
- { "You are on a narrow strip of sand.",
- { 129, 130, 131, 0, 87, 0, 0, 0 },
-"Rather coarse sand makes this beach very steep and only a few meters wide.\n\
-A fresh ocean breeze is rustling the ferns **+.*\n" },
- { "This is Fern Canyon.",
- { 0, 0, 132, 133, 76, 0, 0, 0 },
-"Delicate waving ferns flourish here, suckled by warm water dripping from \n\
-every fissure and crevice in the solid rock walls.\n\
-The canyon winds **-, and -.\n" },
- { "This is the front lawn.",
- { 134, 135, 136, 137, 88, 0, 0, 0 },
-"There is a small fountain here where the driveway meets the lawn.\n\
-Across the driveway, +, is an ornate white house with and elegant \n\
-woodworking. The bargeboards are carved with fylfots, the ancient \n\
-symbols of luck. Even a bell tower has been built here.* There is a \n\
-road + which turns into the driveway.*\n" },
- { "You have just crossed the crest of a mountain.",
- { 97, 79, 86, 71, 68, 1, 0, 1},
-"The fog vanished mysteriously as we flew over the crest.*\n\
-Far + I can see the ocean.**\n" },
- { "You are on a sandy beach.",
- { 138, 139, 140, 0, 99, 0, 0, 0 },
-"This is the only good beach on the weather side of the island. Fine coral\n\
-sand, a fresh sea breeze, and dramatic surf add to its appeal.**\n\
-Stone steps lead to the gardens +.*\n" },
- { "You are among palm trees near the shore.",
- { 141, 80, 142, 143, 73, 0, 0, 0 },
-"Arching coconut palms laden with fruit provide a canopy for the glistening\n\
-white sand and sparse grasses growing here. The forest grows denser +.\n\
-The ocean is +.**\n" },
- { "You are walking along the beach.",
- { 144, 0, 145, 80, 73, 0, 0, 0 },
-"The warm tropical waters nuzzle your ankles as you walk. Above is a fiercely\n\
-blue sky. The slope of the sand is so gentle that two hundred meters\n\
-offshore the water is only knee deep.** There are some rocks +.*\n" },
- { "You are walking along the beach.",
- { 146, 0, 80, 147, 73, 0, 0, 0 },
-"Many beautiful shells have been washed up here including bright yellow \n\
-cowries, chocolate colored murex, orange conchs, striped tritons and the\n\
-deadly cone shells.****\n" },
- { "You are in a papaya grove.",
- { 148, 89, 149, 150, 77, 0, 0, 0 },
-"Green slender trees no taller than three meters bulge with their\n\
-orange succulent fruit. There are some tall trees +.***\n" },
- { "You are in a field of pineapple.",
- { 89, 151, 152, 153, 77, 0, 0, 0 },
-"The sharp dagger like pineapple leaves can pierce the flesh and hold fast\n\
-a skewered victim with tiny barbs.* The field ends +.**\n" },
- { "You are in a field of kiwi plants.",
- { 149, 154, 155, 89, 77, 0, 0, 0 },
-"Round hairy fruit hang from staked vines here. There are some trees +\n\
-and +. The field ends in a dirt road +.*\n" },
- { "You are in a large grove of coconuts.",
- { 150, 153, 89, 156, 77, 0, 0, 0 },
-"These trees are much taller than any growing near the shore plus the fat,\n\
-juicy coconuts have been selectively cultivated. The grove continues\n\
-+, +, *and +.\n" },
- { "You are in the woods.",
- { 157, 91, 158, 116, 79, 0, 0, 0 },
-"Tropical undergrowth makes the going rough here. Sword ferns give no strong\n\
-foot hold and the dangling vines would gladly throttle one. Strange cackling\n\
-noises are coming from somewhere +.***\n" },
- { "You are at the shore.",
- { 91, 0, 159, 145, 79, 0, 0, 0 },
-"Explosions of surf jetting out of underwater tunnels here make it\n\
-impossible to climb down to a small cave entrance below. Only at rare\n\
-minus tides would it be possible to enter.*** The beach is better +.\n" },
- { "You are on the coast road.",
- { 158, 161, 162, 91, 79, 0, 0, 0 },
-"The road is beginning to turn inland.* I can hear the surf +. The road\n\
-continues +.*\n" },
- { "The road winds deeper into the trees.",
- { 163, 142, 91, 164, 79, 0, 0, 0 },
-"Only narrow sunbeams filter through the foliage above. The moist rich earth\n\
-has nurtured a myriad of trees, shrubs, and flowers to grow here. The\n\
-road continues - and *- from here.*\n" },
- { "This is the front porch of the bungalow.",
- { 165, 92, 0, 0, 81, 0, 0, 0 },
-"These wooden steps and porch are very bucolic. A little woven mat on the \n\
-doorstep reads \"Don't Tread on Me\". The open front door is +.\n\
-A stone walk leads to the main street +.**\n" },
- { "You are on a path leading to the lagoon.",
- { 92, 166, 167, 168, 81, 0, 0, 0 },
-"This path trampled fern, grass, sapling, and anything else that got in its\n\
-way.* The water is +.**\n" },
- { "This is a dirt road.",
- { 169, 118, 170, 92, 81, 0, 0, 0 },
-"**The road continues on - here for some distance. A village is +.\n" },
- { "You are on a dirt road.",
- { 171, 118, 92, 172, 81, 0, 0, 0 },
-"**There is a small village +. The road continues +.\n" },
- { "You are on a dirt road.",
- { 173, 93, 174, 175, 82, 0, 0, 0 },
-"The light tan soil of the road contrasts artistically with the lush green\n\
-vegetation and searing blue sky.* There is a clearing and many people +.\n\
-The road continues - and -.\n" },
- { "You are at the seaplane dock.",
- { 93, 0, 176, 177, 82, 0, 0, 0 },
-"Several muscular, bronze skinned men greet you warmly as you pass under\n\
-a thatched shelter above the dock here. Polynesian hospitality.\n\
-There is a clearing +.* A trail runs around the lagoon + and +.\n" },
- { "There are some tables on the lawn here.",
- { 121, 122, 123, 93, 82, 0, 0, 0 },
-"Hors d'oeuvres, canapes, mixed drinks, and various narcotic drugs along with\n\
-cartons of Di Gel fill the tables to overflowing. Several other guests are\n\
-conversing and talking excitedly****.\n" },
- { "You are nosing around in the bushes.",
- { 124, 124, 93, 124, 82, 0, 0, 0 },
-"There is little here but some old beer cans. You are making fools out of\n\
-us in front of the other guests.** It would be best to go -.*\n" },
- { "You are walking in a dry stream bed.",
- { 178, 98, 179, 0, 84, 0, 0, 0 },
-"The large cobblestones are difficult to walk on. No sunlight reaches\n\
-below a white canopy of fog seemingly generated from *+. A dirt path \n\
-along the wash is +. A high bank is impossible to climb +.\n" },
- { "You are at the thermal pools.",
- { 98, 0, 180, 181, 84, 0, 0, 0 },
-"Several steaming fumaroles and spluttering geysers drenched by icy mountain\n\
-waters from a nearby waterfall heat half a dozen natural pools to a\n\
-delicious 42 degrees. Enchantingly beautiful singing seems to flow from the\n\
-water itself as it tumbles down the falls.*** There is a mossy entrance\n\
-to a cave +.\n" },
- { "You are in the woods.",
- { 127, 180, 182, 98, 84, 0, 0, 0 },
-"Coniferous trees girded by wild huckleberries, elderberries, salmonberries\n\
-and thimbleberries enjoy a less tropical climate here in the high mountains.\n\
-*The sound of rushing water is coming from +.**\n" },
- { "You are on a dirt trail.",
- { 179, 181, 98, 0, 84, 0, 0, 0 },
-"The trail seems to start here and head -.** High cliffs border the \n\
-trail +.\n" },
- { "You are walking along the beach.",
- { 183, 101, 184, 0, 87, 0, 0, 0 },
-"A rather unnerving surf explodes onto the beach here and dashes itself into\n\
-spray on the steep incline. The beach continues + and +.**\n" },
- { "You are walking along the beach.",
- { 101, 185, 186, 0, 87, 0, 0, 0 },
-"This is not a very nice beach. The coarse sand hurts my feet.****\n" },
- { "You are walking through some ferns.",
- { 184, 186, 187, 101, 87, 0, 0, 0 },
-"This is a wide field growing only ferns and small shrubs.** The \n\
-ocean is *+.\n" },
- { "You are in a narrow canyon.",
- { 0, 0, 188, 102, 76, 0, 0, 0 },
-"The steep sides here squeeze a little freshet through a gauntlet like\n\
-series of riffles and pools.****\n" },
- { "The canyon is much wider here.",
- { 0, 0, 102, 189, 76, 0, 0, 0 },
-"The sheer rock walls rise 10 meters to the forest above. A slender \n\
-waterfall careens away from the face of the rock high above and showers\n\
-the gravel floor with sparkling raindrops.** The canyon continues -\n\
-and -.\n" },
- { "You are on the front porch of the cottage.",
- { 190, 103, 0, 0, 0, 0, 0, 0 },
-"Several giggling native girls came running down the steps as you approached\n\
-and headed on down the road. On the fern rimmed porch is a small table with\n\
-matching white wrought iron chairs cushioned with red velvet. The front\n\
-door leads -. The lawn and fountain are +.**\n" },
- { "You are in a palm grove.",
- { 103, 191, 192, 105, 88, 0, 0, 0 },
-"****\n" },
- { "You are on a dirt road.",
- { 193, 192, 245, 103, 88, 0, 0, 0 },
-"There is a large village +. The road cleaves a coconut plantation +.\n\
-A small dirt road goes -, and a drive way peals off +.\n" },
- { "You are in a field of small shrubs.",
- { 184, 186, 103, 187, 88, 0, 0, 0 },
-"**Pine and other coniferous saplings have been planted here. The rich brown\n\
-soil is well tilled and watered. Across a large lawn, there is a small\n\
-cottage +. I can feel a delicious sea breeze blowing from +.\n" },
- { "The beach is pretty rocky here.",
- { 194, 105, 195, 0, 96, 0, 0, 0 },
-"Dangerous surf and lava outcroppings make this a treacherous strand.\n\
-The beach is nicer* +.**\n" },
- { "The beach is almost 10 meters wide here.",
- { 105, 183, 196, 0, 99, 0, 0, 0 },
-"The sand has become more coarse and the beach steeper.* It gets \n\
-worse +.**\n" },
- { "You are in the gardens.",
- { 195, 196, 197, 105, 99, 0, 0, 0 },
-"Lush green lawns studded with palms and benches stretch as far as the eye\n\
-can see.** A path leads -. Stone steps lead down to the beach +.\n" },
- { "You are on the coast road.",
- { 198, 106, 163, 199, 73, 0, 0, 0 },
-"The forest is dense on either side and conceals the road from anyone\n\
-approaching it.** The road continues - and -.\n" },
- { "You are in the forest.",
- { 116, 107, 91, 106, 73, 0, 0, 0 },
-"There are trees and ferns all around.****\n" },
- { "You are in the forest.",
- { 199, 108, 106, 146, 73, 0, 0, 0 },
-"There are trees and ferns all around.****\n" },
- { "You are in a copse.",
- { 142, 107, 145, 80, 0, 0, 0, 0 },
-"This is a secret hidden thicket only noticeable from the beach. Someone\n\
-has been digging here recently.****\n" },
- { "You are at the tide pools.",
- { 91, 0, 114, 107, 79, 0, 0, 0 },
-"These rocks and pools are the home for many sea anemones and crustaceans.\n\
-**The surf is very rough +. There is a nice beach +.\n" },
- { "You are in the forest.",
- { 199, 108, 143, 0, 73, 0, 0, 0 },
-"This is a shallow depression sheltered from the wind by a thick growth of \n\
-thorny shrubs. It looks like someone has camped here. There is a fire pit\n\
-with some dry sticks and grass nearby.* The beach is +.* The thorny\n\
-shrubs block the way -.\n" },
- { "You are at the mouth of the lagoon.",
- { 200, 0, 108, 201, 74, 0, 0, 0 },
-"The beach ends here where the coral reef rises to form a wide lagoon\n\
-bending inland. A path winds around the lagoon to the -.*\n\
-The beach continues on -. Only water lies +.\n" },
- { "You are in a breadfruit grove.",
- { 202, 109, 203, 204, 77, 0, 0, 0 },
-"The tall trees bend leisurely in the breeze, holding many round breadfruits\n\
-close to their large serrated leaves. There are coconut palms +,\n\
-*+, and +.\n" },
- { "You are in a grove of mango trees.",
- { 203, 111, 205, 109, 77, 0, 0, 0 },
-"The juicy yellow red fruits are nearly ripe on the trees here. There are\n\
-some coconut palms +. There are some vines +. There is a road +.*\n" },
- { "You are in a grove of coconut palms.",
- { 204, 112, 109, 206, 77, 0, 0, 0 },
-"All I can see around us are palm trees.****\n" },
- { "You are in a coconut grove.",
- { 110, 207, 208, 209, 77, 0, 0, 0 },
-"There are countless trees here.****\n" },
- { "You are in a field of pineapple.",
- { 154, 208, 210, 110, 77, 0, 0, 0 },
-"The sharp leaves are cutting me to ribbons. There is a road **+.\n\
-More pineapple +.\n" },
- { "You are in a coconut grove.",
- { 112, 209, 110, 211, 77, 0, 0, 0 },
-"There is a field of pineapple **+.*\n" },
- { "You are on the edge of a kiwi and pineapple field.",
- { 111, 152, 155, 110, 77, 0, 0, 0 },
-"An irrigation ditch separates the two fields here. There is a road **+.*\n" },
- { "This is a dirt road.",
- { 205, 210, 212, 111, 77, 0, 0, 0 },
-"The road runs - and - here.**\n" },
- { "You are in a palm grove.",
- { 206, 211, 112, 213, 77, 0, 0, 0 },
-"There are palm trees all around us.****\n" },
- { "You are on the edge of a small clearing.",
- { 157, 113, 157, 157, 79, 0, 0, 0 },
-"The ground is rather marshy here and darting in and out of the many tussocks\n\
-is a flock of wild chicken like fowl.****\n" },
- { "You are in the woods.",
- { 158, 115, 215, 113, 79, 0, 0, 0 },
-"You have walked a long way and found only trees. ****\n" },
- { "You are walking along the shore.",
- { 115, 0, 214, 114, 86, 0, 0, 0 },
-"You are now about 10 meters above the surf on a gently rising cliffside.**\n\
-The land rises +. There is a beach far +.\n" },
- { "You are just inside the entrance to the sea cave.",
- { 246, 114, 0, 0, 114, 1, 0, 0 },
-"The sound of water dripping in darkness and the roar of the ocean just outside\n\
-create a very unwelcoming atmosphere inside this cave. Only on rare occasions\n\
-such as this is it possible to enter the forbidden catacombs... The cave\n\
-continues -.***\n" },
- { "You are in a secret nook beside the road.",
- { 115, 159, 162, 91, 79, 0, 0, 0 },
-"Hidden from all but the most stalwart snoopers are some old clothes, empty\n\
-beer cans and a trash baggie full of used Huggies and ordure. Lets get\n\
-back to the road +.***\n" },
- { "You are on the coast road.",
- { 215, 214, 0, 115, 86, 0, 0, 0 },
-"The road turns abruptly - here, avoiding the cliffs near the shore\n\
-+ and +.*\n" },
- { "You are on a dirt road.",
- { 216, 116, 113, 141, 79, 0, 0, 0 },
-"The roadside is choked with broad leaved plants fighting for every breath of\n\
-sunshine. The palm trees are taller than at the shore yet bend over the road \n\
-forming a canopy. The road continues *- and *-.\n" },
- { "You have discovered a hidden thicket near the road.",
- { 163, 142, 116, 106, 73, 0, 0, 0 },
-"Stuffed into a little bundle here is a bloody silken robe and many beer cans.\n\
-*Some droplets of blood and a major spill sparkle farther +.\n\
-The road is +.*\n" },
- { "You are in the living room.",
- { 0, 117, 217, 218, 0, 0, 0, 0 },
-"A decorative entry with fresh flowers and wall to wall carpeting leads into\n\
-the living room here where a couch and two chairs converse with an end table.\n\
-*The exit is +.* The bedroom is +.\n" },
- { "You are at the lagoon.",
- { 118, 0, 167, 168, 81, 0, 0, 0 },
-"There are several outrigger canoes pulled up on a small beach here and a\n\
-catch of colorful fish is drying in the sun. There are paths leading \n\
-off -*, -, and -.\n" },
- { "You are at the lagoon.",
- { 118, 0, 170, 166, 81, 0, 0, 0 },
-"This is a grassy little spot near the water. A sightly native girl is frolicking\n\
-in the water close to shore here.** The path continues - and -. \n" },
- { "You are at the lagoon.",
- { 118, 0, 166, 172, 81, 0, 0, 0 },
-"The path meanders through tussocks of grass, ferns, and thorny bushes here\n\
-and continues on **- and -.\n" },
- { "You are in the woods.",
- { 219, 119, 220, 92, 81, 0, 0, 0 },
-"There are plenty of ferns and thorny bushes here! ****\n" },
- { "You are on a dirt road.",
- { 220, 167, 199, 119, 74, 0, 0, 0 },
-"The road winds rather close to a large lagoon here and many sedges and tall\n\
-grasses line the shoulder *+. The road continues - and -.\n" },
- { "You are in the woods beside the road.",
- { 221, 120, 92, 222, 81, 0, 0, 0 },
-"The forest grows darker +. The road is +.**\n" },
- { "The road crosses the lagoon here.",
- { 222, 0, 120, 174, 81, 0, 0, 0 },
-"Coursing through the trees, the road at this point bridges a watery finger\n\
-of the lagoon.* The water is +. The road continues - and -.\n" },
- { "You are in a coconut palm grove.",
- { 223, 121, 224, 225, 82, 0, 0, 0 },
-"The tall palms are planted about 30 feet apart with a hardy deep green grass\n\
-filling the spaces in between. There are tire tracks through the grass. The\n\
-grove continues -. There is a road +.**\n" },
- { "You are walking along a dirt road.",
- { 224, 176, 172, 121, 82, 0, 0, 0 },
-"You are nearing the lagoon.** The road continues - and -.\n" },
- { "You are on a dirt road.",
- { 225, 177, 121, 226, 82, 0, 0, 0 },
-"The road turns abruptly - here, entering a grove of palm trees.* The road\n\
-also continues - toward the lagoon.*\n" },
- { "You are on a trail running around the lagoon.",
- { 172, 0, 0, 122, 82, 0, 0, 0 },
-"The dark waters brush the trail here and the path crosses a bridge +.\n\
-There is deep water + and +. The trail continues -.\n" },
- { "This is the mouth of the lagoon.",
- { 175, 0, 122, 227, 82, 0, 0, 0 },
-"The coral reef wraps around a natural bay here to create a wide lagoon which\n\
-winds tortuously inland.** A trail goes around the lagoon +. The beach\n\
-is +.\n" },
- { "You are in a dry stream bed.",
- { 0, 125, 0, 0, 84, 0, 0, 0 },
-"The dry wash drains over a tall precipice here into a turbid morass below. The\n\
-most noisome stench imaginable is wafting up to defile our nostrils. Above,\n\
-the lurid sun glows brown through a strange mist.* The only direction \n\
-I'm going is -.**\n" },
- { "You are on a dirt path along the wash.",
- { 0, 128, 125, 228, 84, 0, 0, 0 },
-"This path looks more like a deer trail. It scampers away ***+.\n" },
- { "The thermal pools flow into a stream here.",
- { 127, 0, 229, 126, 84, 0, 0, 0 },
-"The gurgling hot waters pour over boulders into a swiftly flowing\n\
-stream **+. The pools are +.\n" },
- { "You are at the entrance to a cave.",
- { 128, 230, 126, 0, 84, 0, 0, 0 },
-"A tall narrow fissure in the rock cliffs here has become a well traveled\n\
-passage way. A hoof beaten dirt path leads directly into it. A curl of\n\
-steam is trailing from a corner of the fissure's gaping mouth. The path\n\
-leads - and -. The pools are +.*\n" },
- { "You are in the woods.",
- { 182, 229, 182, 127, 84, 0, 0, 0 },
-"Wild berry bushes plump with fruit and thorns tangle your every effort to\n\
-proceed.* The sound of rushing water is +.**\n" },
- { "You are walking along the beach.",
- { 139, 129, 184, 0, 99, 0, 0, 0 },
-"Some dunes here progress inland and make it impossible to get very far in that\n\
-direction. The beach continues - and -.* The ocean is +.\n" },
- { "You are in the dunes.",
- { 183, 101, 184, 129, 87, 0, 0, 0 },
-"The endless rolling and pitching sand dunes are enough to make one very queasy!\n\
-The only way I'm going is ***+.\n" },
- { "This is a lousy beach.",
- { 130, 0, 0, 0, 87, 0, 0, 0 },
-"Volcanic and viciously sharp bitted grains of sand here bite like cold steel\n\
-into my tender feet. I refuse to continue on. Let's get out of here. The\n\
-beach is better +.***\n" },
- { "You are in a field of sparse ferns.",
- { 131, 185, 187, 130, 87, 0, 0, 0 },
-"The lava rock outcroppings here will support few plants. There is more \n\
-vegetation +. There is a nice beach +.* The ocean is +.\n" },
- { "You are in the woods.",
- { 131, 131, 137, 131, 87, 0, 0, 0 },
-"Young trees and tall shrubs grow densely together at this distance from the \n\
-shore.** The trees grow thicker +.*\n" },
- { "The canyon is no wider than a foot here.",
- { 0, 0, 0, 132, 0, 0, 0, 0 },
-"The freshet is gushing through the narrow trough, but the canyon has grown\n\
-too narrow to follow it any farther.*** I guess we'll have to go -.\n" },
- { "You are in a narrow part of the canyon.",
- { 0, 0, 133, 232, 76, 0, 0, 0 },
-"The two sheer sides are no more than a few meters apart here. There is a stone\n\
-door in the wall +. The gravelly floor runs with tiny rivulets seeping \n\
-from the ground itself.* The canyon continues - and -.\n" },
- { "You are in the drawing room.",
- { 0, 134, 0, 0, 0, 0, 0, 0 },
-"Exquisitely decorated with plants and antique furniture of superb\n\
-craftsmanship, the parlor reflects its owners impeccable taste. The tropical\n\
-sun is streaming in through open shutters *+. There doesn't seem \n\
-to be anybody around. A large immaculate oaken desk is visible in the\n\
-study and it even has a old fashioned telephone to complete the decor.**\n" },
- { "You are in a palm grove.",
- { 135, 191, 233, 191, 88, 0, 0, 0 },
-"Grassy rows of palms stretch as far as I can see.** There is a road +.*\n" },
- { "You are on a dirt road.",
- { 136, 233, 234, 135, 88, 0, 0, 0 },
-"The road winds through a coconut palm grove here. It continues on - \n\
-and -.**\n" },
- { "The road leads to several large buildings here.",
- { 235, 136, 236, 237, 88, 0, 0, 0 },
-"There is a clubhouse +,* a large barn and stable +, and a garage of \n\
-similar construct to the barn +.\n" },
- { "This part of the beach is impassable.",
- { 0, 138, 0, 0, 96, 0, 0, 0 },
-"The huge rocks and thunderous surf here would pound our frail bodies to pulp\n\
-in an instant.* The only direction I'm going is -.**\n" },
- { "You are in the gardens.",
- { 195, 140, 197, 138, 96, 0, 0, 0 },
-"So much green grass is a pleasure to the eyes.****\n" },
- { "You are in the gardens.",
- { 140, 183, 197, 139, 99, 0, 0, 0 },
-"Beautiful flowers and shrubs surround a little goldfish pond.****\n" },
- { "You are on a stone walk in the garden.",
- { 195, 196, 238, 140, 99, 0, 0, 0 },
-"The walk leads to a road **+.*\n" },
- { "You are in the forest near the road.",
- { 198, 141, 216, 198, 73, 0, 0, 0 },
-"There are many thorny bushes here!****\n" },
- { "You are at a fork in the road.",
- { 239, 146, 141, 170, 73, 0, 0, 0 },
-"Two roads come together in the forest here. One runs -,* the other \n\
-runs - and -.\n" },
- { "You are on a dirt path around the lagoon.",
- { 170, 147, 146, 0, 74, 0, 0, 0 },
-"The still waters reflect bending palms and a cloudless sky. It looks like\n\
-the path runs into a clearing +. The path continues -.**\n" },
- { "You are drowning in the lagoon.",
- { 201, 201, 147, 201, 74, 0, 0, 0 },
-"I suggest you get out before you become waterlogged.****\n" },
- { "You are in a coconut palm grove.",
- { 202, 148, 203, 204, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a palm grove.",
- { 202, 149, 205, 148, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a palm grove.",
- { 202, 150, 148, 206, 77, 0, 0, 0 },
-"****\n" },
- { "You are on a dirt road.",
- { 203, 155, 212, 149, 77, 0, 0, 0 },
-"*This road ends here at a palm grove but continues on - for quite\n\
-some way.**\n" },
- { "You are in a coconut palm grove.",
- { 204, 156, 150, 213, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a coconut grove.",
- { 151, 219, 208, 209, 77, 0, 0, 0 },
-"*The grove ends +.**\n" },
- { "You are in a coconut grove.",
- { 152, 207, 239, 151, 77, 0, 0, 0 },
-"**There is a dirt road +.*\n" },
- { "You are in a coconut grove.",
- { 153, 207, 151, 211, 77, 0, 0, 0 },
-"****\n" },
- { "This is a dirt road.",
- { 205, 239, 212, 154, 77, 0, 0, 0 },
-"The road continues - and -.**\n" },
- { "You are in a coconut grove.",
- { 153, 209, 153, 213, 77, 0, 0, 0 },
-"****\n" },
- { "You are in the woods near the road.",
- { 205, 210, 212, 155, 77, 0, 0, 0 },
-"There are many thorny bushes here!****\n" },
- { "You are in a coconut grove.",
- { 213, 213, 156, 234, 88, 0, 0, 0 },
-"***The grove ends in a clearing +.\n" },
- { "You are walking along some high cliffs.",
- { 162, 0, 0, 159, 86, 0, 0, 0 },
-"The island bends sharply + here with high cliffs -\n\
-and -. The cliffs are lower +.\n" },
- { "You are at the coast road turn around.",
- { 0, 162, 0, 158, 90, 0, 0, 0 },
-"The coast road ends here in a lookout with a view of 100 kilometers of blue\n\
-sea and 100 meters of rugged cliff. Far below the waves crash against rocks.\n\
-****\n" },
- { "You are in the woods near the road.",
- { 216, 163, 216, 198, 79, 0, 257, 0 },
-"These thorny bushes are killing me.****\n" },
- { "You are in the kitchen.",
- { 0, 0, 0, 165, 0, 0, 0, 0 },
-"A small gas stove and a refrigerator are all the only appliances here. The\n\
-gas oven has been left on and the whole room is reeking with natural gas.\n\
-One spark from a match and.... The door out is ***+.\n" },
- { "You are in the bedroom.",
- { 0, 0, 165, 0, 0, 0, 0, 0 },
-"A soft feather comforter on top of layers of Answer blankets make this a very\n\
-luxurious place to sleep indeed. There are also some end tables and a dresser\n\
-here.** The living room is +.*\n" },
- { "You are in the woods.",
- { 207, 169, 220, 221, 81, 0, 0, 0 },
-"There seems to be a clearing +.***\n" },
- { "You are in the woods near the road.",
- { 219, 170, 239, 169, 81, 0, 0, 0 },
-"*As far as I can tell, there are two roads + and +.*\n" },
- { "You are in the woods.",
- { 207, 171, 219, 222, 81, 0, 0, 0 },
-"The forest is clearer +.***\n" },
- { "You are on the lagoon's inland finger.",
- { 0, 172, 171, 172, 81, 0, 0, 0 },
-"It is impossible to follow the lagoon any farther inland because of sharp\n\
-and very painful sedges.* The road is +.**\n" },
- { "You are in a grassy coconut grove.",
- { 240, 173, 224, 241, 82, 0, 0, 0 },
-"The tall palms provide a perfect canopy for the lush green grass.***\n\
-There is a road +.\n" },
- { "You are near the lagoon's inland finger.",
- { 0, 174, 0, 173, 82, 0, 0, 0 },
-"Very sharp sedges make it impossible to follow the lagoon any farther inland.\n\
-*There is a road +.**\n" },
- { "You are on a dirt road.",
- { 241, 175, 173, 226, 82, 0, 0, 0 },
-"The road winds through a coconut grove here and continues - and -.**\n" },
- { "You are in the woods near the road.",
- { 226, 226, 175, 226, 82, 0, 0, 0 },
-"**The road is +.*\n" },
- { "This is a beach?",
- { 227, 227, 177, 0, 82, 0, 0, 0 },
-"Hard jagged rocks that pierce with every footstep hardly comprise a beach.**\n\
-Let's go -.*\n" },
- { "The trail is lost in the woods here.",
- { 241, 241, 179, 241, 84, 0, 0, 0 },
-"I suppose the animals that use this trail all depart in different directions\n\
-when they get this far into the woods.** The trail goes -.*\n" },
- { "You are on the bank of a stream.",
- { 182, 0, 242, 180, 84, 0, 0, 0 },
-"The stream falls over several small boulders here and continues on **-.*\n" },
- { "You are just inside the cave.",
- { 181, 267, 0, 0, 0, 0, 0, 0 },
-"A steamy hot breath is belching from the depths of the earth within.* The\n\
-cave continues -.**\n" },
- { "You are just inside the cave entrance.",
- { 274, 0, 0, 0, 0, 0, 0, 0 },
-"The air is hot and sticky inside. The cave continues -. There is a \n\
-stone door in the wall +. A wooden sign in the dust reads in old elven\n\
-runes, \"GSRF KDIRE NLVEMP!\".**\n" },
- { "You are at the edge of a huge chasm.",
- { 0, 0, 189, 0, 76, 0, 0, 0 },
-"Several hundred feet down I can see the glimmer of placid water. The\n\
-rivulets drain over the edge and trickle down into the depths. It is \n\
-impossible to climb down without a rope.** The canyon continues -.*\n" },
- { "You are on a dirt road.",
- { 192, 241, 240, 191, 88, 0, 0, 0 },
-"The road winds through a coconut grove here. The road continues on -\n\
-and -.**\n" },
- { "You are in a coconut palm grove near the road.",
- { 193, 233, 213, 192, 88, 0, 0, 0 },
-"***The road is +.\n" },
- { "You are at the clubhouse.",
- { 0, 193, 0, 0, 0, 0, 0, 0 },
-"The clubhouse is built over the most inland part of the lagoon. Tropical\n\
-bananas and fragrant frangipani grow along the grassy shore. Walking across\n\
-the short wooden bridge, we enter. Along one wall is a bar with only a few\n\
-people seated at it. The restaurant and dance floor are closed off with\n\
-a 2 inch nylon rope. ****\n" },
- { "You are in the stables.",
- { 0, 0, 0, 193, 0, 0, 0, 0 },
-"Neighing horses snacking on hay and oats fill the stalls on both sides of\n\
-the barn. It is rather warm in here but that is not the most offensive\n\
-part. The old boards of the barn part just enough to let in dust laden\n\
-shafts of light. Flies swarm overhead and strafe the ground for dung.\n\
-My nose is beginning to itch. ****\n" },
- { "You are in the old garage.",
- { 0, 0, 193, 0, 0, 0, 0, 0 },
-"This is an old wooden building of the same vintage as the stables. Beneath\n\
-a sagging roof stand gardening tools and greasy rags. Parked in the center\n\
-is an underpowered Plymouth Volare' with a red and white striped golf cart\n\
-roof. ****\n" },
- { "You are on a dirt road.",
- { 197, 197, 243, 197, 85, 0, 0, 0 },
-"The road leads to a beautiful formal garden laced with stone walks and tropical\n\
-flowers and trees.** The road continues -. A walk leads -.\n" },
- { "You are on a dirt road.",
- { 210, 199, 198, 220, 73, 0, 0, 0 },
-"The road runs - and -.**\n" },
- { "You are in a coconut grove near the road.",
- { 234, 223, 234, 233, 88, 0, 0, 0 },
-"***The road is +.\n" },
- { "You are on a dirt road.",
- { 233, 225, 223, 226, 82, 0, 0, 0 },
-"The road continues - and -.**\n" },
- { "The stream plummets over a cliff here.",
- { 182, 0, 0, 229, 84, 0, 0, 0 },
-"Falling 10 agonizing meters into spray, only droplets of the stream are\n\
-left to dance off the floor below. I thought I saw a sparkle of gold\n\
-at the bottom of the falls, but now it is gone. There is no way down,\n\
-even with a strong rope. ****\n" },
- { "You are on a dirt road.",
- { 0, 0, 244, 238, 85, 0, 0, 0 },
-"**The road continues - and -.\n" },
- { "You are on a dirt road.",
- { 0, 245, 0, 243, 88, 0, 0, 0 },
-"*The road continues -* and -.\n" },
- { "You are on a dirt road.",
- { 244, 234, 213, 136, 88, 0, 0, 0 },
-"The road goes -* and *-.\n" },
- { "You are in a low passage.",
- { 247, 160, 0, 0, 0, 0, 0, 0 },
-"The passage is partially flooded here and it may be hazardous to proceed.\n\
-Water is surging from the tunnel and heading out to sea. Strange moaning\n\
-noises rise above the rushing of the water. They are as thin as a whispering\n\
-wind yet penetrate to my very soul. I think we have come too far...\n\
-The passage continues -.***\n" },
- { "The walls are very close together here.",
- { 248, 0, 0, 0, 0, 0, 0, 0 },
-"I can barely squeeze through the jagged opening. Slimy sea weeds provide\n\
-no footing at all. This tunnel seems to be an ancient lava tube. There is\n\
-a large room -.***\n" },
- { "You are in the cathedral room.",
- { 249, 251, 249, 251, 0, 0, 0, 0 },
-"Your light casts ghostly shadows on the walls but cannot pierce the \n\
-engulfing darkness overhead. The sound of water dripping echoes in the void.\n\
-*I can see no passages leading out of this room. We have definitely\n\
-come too far.*** \n" },
- { "You are walking through a very round tunnel.",
- { 252, 0, 0, 0, 252, 1, 0, 0 },
-"The round walls of this tunnel are amazingly smooth to the touch. A little\n\
-trickle of water flows down the center. The tunnel climbs steadily +.\n\
-The cave is beginning to flood again! Let's get out of here! ***\n" },
- { "You are in the cathedral anteroom.",
- { 0, 0, 0, 248, 253, 1, 0, 0 },
-"This small chamber with a flat stone floor is to one side of the cathedral \n\
-room. We appear to be at the bottom of a tall narrow shaft. There are many \n\
-puddles of water here. A staircase hewn from solid rock and black lava \n\
-leads up.*** The cathedral room is +.\n" },
- { "You are in a wide chamber.",
- { 0, 0, 248, 254, 0, 0, 0, 0 },
-"Water is sprinkling from the ceiling here. A shallow pool populated by a \n\
-myriad of blind white creatures sparkles in your light. Tiny shrimp and\n\
-crabs scurry away, frightened by the blinding rays.** The cave \n\
-continues - and -.\n" },
- { "You are at the top of a sloping passage.",
- { 0, 0, 255, 256, 257, 1, 0, 0 },
-"There is much algae growing here, both green and brown specimens. \n\
-Water from an underground sea surges and splashes against the slope of\n\
-the rock. The walls glisten with shiny minerals. High above, light\n\
-filters in through a narrow shaft.** A hallway here runs -\n\
-and -.\n" },
- { "You are in an elaborately tiled room.",
- { 0, 0, 258, 0, 0, 0, 250, 0 },
-"Large colorful tiles plate the floor and walls. The ceiling is a mosaic\n\
-of gems set in gold. Hopefully it is only our footsteps that are echoing in\n\
-this hollow chamber.** The room continues -. A stone staircase\n\
-leads down.*\n" },
- { "You are at a dead end.",
- { 0, 0, 251, 0, 0, 0, 0, 0 },
-"The walls here are alive with dark mussels. They click their shells menacingly\n\
-if we disturb them. ** The only exit is +.*\n" },
- { "The tunnel is very low here.",
- { 0, 0, 259, 252, 0, 0, 0, 0 },
-"I practically have to crawl on my knees to pass through this opening. The\n\
-air is stiflingly damp, but I can't hear any sounds of water dripping.**\n\
-The crawlspace continues -. The tunnel seems wider +.\n" },
- { "This is the supply room.",
- { 0, 0, 252, 0, 0, 0, 0, 0 },
-"Picks and shovels line the walls here, as well as hard hats, boxes of\n\
-dynamite, and a cartload of very high grade gold and silver ore.** \n\
-A tunnel leads off +.*\n" },
- { "You have found a secret entrance to the catacombs.",
- { 0, 0, 0, 0, 216, 1, 252, 0 },
-"I have a sickening feeling that we should not have entered the catacombs.\n\
-Below is a wet, seaweed covered floor. Above is a way out. ****\n" },
- { "You are in the catacombs.",
- { 0, 0, 260, 253, 0, 0, 0, 0 },
-"Ornate tombs and piles of treasure line the walls. Long spears with many\n\
-blades, fine swords and coats of mail, heaps of coins, jewelry, pottery, \n\
-and golden statues are tribute of past kings and queens.** The catacombs\n\
-continue - and -.\n" },
- { "You are crawling on your stomach.",
- { 0, 0, 261, 255, 0, 0, 0, 0 },
-"The passage is quite narrow and jagged, but the rock is no longer lava.\n\
-It appears to be a form of granite.** The crawlspace continues -, \n\
-but I would just as soon go -.\n" },
- { "You are in the Sepulcher.",
- { 0, 0, 0, 258, 0, 0, 0, 0 },
-"A single tomb is here. Encrusted with diamonds and opals, and secured with \n\
-straps of a very hard, untarnished silver, this tomb must be of a great king.\n\
-Vases overflowing with gold coins stand nearby. A line of verse on the wall\n\
-reads, \"Three he made and gave them to his daughters.\"****\n" },
- { "The passage is wider here.",
- { 0, 0, 0, 259, 0, 0, 0, 0 },
-"You are at the top of a flooded shaft. About a meter below the edge,\n\
-dark water rises and falls to the rhythm of the sea. A ladder goes\n\
-down into water here.*** A small crawlspace goes -.\n" },
- { "You are at the bottom of a ladder.",
- { 0, 0, 0, 0, 261, 1, 263, 0 },
-"This is a narrow platform to rest on before we continue either up or down this\n\
-rickety wooden ladder.****\n" },
- { "You are standing in several inches of water.",
- { 264, 0, 265, 266, 262, 1, 0, 0 },
-"This seems to be a working mine. Many different tunnels wander off following\n\
-glowing veins of precious metal. The floor is flooded here since we must\n\
-be nearly at sea level. A ladder leads up. ****\n" },
- { "The tunnel here is blocked by broken rocks.",
- { 0, 263, 0, 0, 0, 0, 0, 0 },
-"The way is blocked, but if you had some dynamite, we might be able to blast our\n\
-way through.* The passage goes -.**\n" },
- { "The tunnel is too flooded to proceed.",
- { 0, 0, 0, 263, 0, 0, 0, 0 },
-"Hidden shafts could swallow us if we tried to continue on down this tunnel.\n\
-The flooding is already up to my waist. Large crystals overhead shimmer\n\
-rainbows of reflected light.*** Let's go -.\n" },
- { "The mine is less flooded here.",
- { 0, 0, 263, 0, 0, 0, 0, 0 },
-"A meandering gold laden vein of quartz and blooming crystals of diamonds\n\
-and topaz burst from the walls of the cave. A passage goes -.***\n" },
- { "You are inside the cave.",
- { 230, 268, 0, 0, 0, 0, 0, 0 },
-"A hot steam swirls around our heads, and the walls are warm to the touch.\n\
-The trail winds + and +.**\n" },
- { "You are in a rather large chamber.",
- { 267, 0, 0, 269, 0, 0, 269, 0 },
-"Beds of ferns and palm leaves make several cozy nests along the walls. In the\n\
-center of the room is a throne of gold and silver which pulls out into a bed\n\
-of enormous size.*** A passageway leads down to the -.\n" },
- { "You are walking along the edge of a huge abyss.",
- { 0, 0, 268, 0, 268, 1, 270, 0 },
-"Steam is rising in great clouds from the immeasurable depths. A very narrow\n\
-trail winds down.** There is a tunnel +.*\n" },
- { "You are on the edge of a huge abyss.",
- { 0, 0, 0, 0, 269, 1, 271, 0 },
-"The trail winds farther down.****\n" },
- { "You are winding your way along the abyss.",
- { 0, 0, 0, 0, 270, 1, 272, 0 },
-"The trail continues up and down.****\n" },
- { "You are on a wide shelf near the steamy abyss.",
- { 0, 273, 0, 0, 271, 1, 0, 0 },
-"The stifling hot cave seems even hotter to me, staring down into this misty \n\
-abyss. A trail winds up.* A passageway leads -.**\n" },
- { "You are in a wide tunnel leading to a fuming abyss.",
- { 272, 274, 0, 0, 0, 0, 0, 0 },
-"The passageway winds through many beautiful formations of crystals and\n\
-sparkling minerals. The tunnel continues - and -.**\n" },
- { "You are in a tunnel.",
- { 273, 231, 0, 0, 0, 0, 0, 0 },
-"It is very warm in here. The smell of steam and hot rocks permeates the place.\n\
-The cave continues - and -.**\n" },
- { "You are at the bottom of a pit.",
- { 0, 0, 0, 0, 232, 0, 0, 0 },
-"I can see daylight far up at the mouth of the pit. A cool draft wafts down.\n\
-There doesn't seem to be any way out, and I don't remember how we came in.\n\
-If you had a rope it might be possible to climb out. ****\n" },
-};
diff --git a/games/battlestar/dayobjs.c b/games/battlestar/dayobjs.c
deleted file mode 100644
index 801c65a..0000000
--- a/games/battlestar/dayobjs.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dayobjs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-const struct objs dayobjs[] = {
- { 236, HORSE },
- { 237, CAR },
- { 275, POT },
- { 275, BAR },
- { 275, BLOCK },
- { 260, COINS },
- { 266, DARK },
- { 235, TIMER },
- { 51, 51 },
- { 59, 51 },
- { 48, 51 },
- { 66, 52 },
- { 65, 52 },
- { 19, BOMB },
- { 167, NATIVE },
- { 21, KNIFE },
- { 30, KNIFE },
- { 30, CLEAVER },
- { 260, SWORD },
- { 70, LAND },
- { 71, LAND },
- { 72, LAND },
- { 73, LAND },
- { 74, LAND },
- { 75, LAND },
- { 76, LAND },
- { 77, LAND },
- { 78, LAND },
- { 79, LAND },
- { 81, LAND },
- { 82, LAND },
- { 83, LAND },
- { 84, LAND },
- { 85, LAND },
- { 86, LAND },
- { 87, LAND },
- { 88, LAND },
- { 90, LAND },
- { 95, LAND },
- { 96, LAND },
- { 97, LAND },
- { 99, LAND },
- { 100, LAND },
- { 104, LAND },
- { 172, WOODSMAN },
- { 172, DEADWOOD },
- { 172, MALLET },
- { 146, ELF },
- { 146, HALBERD },
- { 146, SHIELD },
- { 190, TWO_HANDED },
- { 190, POTION },
- { 142, BROAD },
- { 258, MAIL },
- { 258, HELM },
- { 21, MAID },
- { 7, VIPER },
- { 216, SHOES },
- { 64, CYLON },
- { 36, CYLON },
- { 49, CYLON },
- { 8, ROBE },
- { 13, AMULET },
- { 20, LASER },
- { 126, BATHGOD },
- { 26, GRENADE },
- { 256, GRENADE },
- { 237, CHAIN },
- { 237, COMPASS },
- { 218, LEVIS },
- { 164, MACE },
- { 137, SHOVEL },
- { 11, COINS },
- { 24, MATCHES },
- { 235, MATCHES },
- { 93, MAN },
- { 109, PAPAYAS },
- { 110, PINEAPPLE },
- { 152, PINEAPPLE },
- { 154, PINEAPPLE },
- { 111, KIWI },
- { 149, MANGO },
- { 112, COCONUTS },
- { 150, COCONUTS },
- { 151, COCONUTS },
- { 153, COCONUTS },
- { 192, COCONUTS },
- { 204, COCONUTS },
- { 207, COCONUTS },
- { 209, COCONUTS },
- { 213, COCONUTS },
- { 240, COCONUTS },
- { 218, RING },
- { 130, BRACELET },
- { 93, GIRL },
- { 268, LAMPON },
- { 0 , 0 }
-};
diff --git a/games/battlestar/externs.h b/games/battlestar/externs.h
deleted file mode 100644
index 0755e80..0000000
--- a/games/battlestar/externs.h
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)externs.h 8.1 (Berkeley) 5/31/93
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <sys/param.h>
-#include <sys/signal.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#define BITS (8)
-
-#define OUTSIDE (position > 68 && position < 246 && position != 218)
-#define rnd(x) (random() % (x))
-#define max(a,b) ((a) < (b) ? (b) : (a))
-#define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
-#ifndef setbit
-#define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
-#endif
-#define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
-
- /* well known rooms */
-#define FINAL 275
-#define GARDEN 197
-#define POOLS 126
-#define DOCK 93
-
- /* word types */
-#define VERB 0
-#define OBJECT 1
-#define NOUNS 2
-#define PREPS 3
-#define ADJS 4
-#define CONJ 5
-
- /* words numbers */
-#define KNIFE 0
-#define SWORD 1
-#define LAND 2
-#define WOODSMAN 3
-#define TWO_HANDED 4
-#define CLEAVER 5
-#define BROAD 6
-#define MAIL 7
-#define HELM 8
-#define SHIELD 9
-#define MAID 10
-#define BODY 10
-#define VIPER 11
-#define LAMPON 12
-#define SHOES 13
-#define CYLON 14
-#define PAJAMAS 15
-#define ROBE 16
-#define AMULET 17
-#define MEDALION 18
-#define TALISMAN 19
-#define DEADWOOD 20
-#define MALLET 21
-#define LASER 22
-#define BATHGOD 23
-#define NORMGOD 24
-#define GRENADE 25
-#define CHAIN 26
-#define ROPE 27
-#define LEVIS 28
-#define MACE 29
-#define SHOVEL 30
-#define HALBERD 31
-#define COMPASS 32
-#define CRASH 33
-#define ELF 34
-#define FOOT 35
-#define COINS 36
-#define MATCHES 37
-#define MAN 38
-#define PAPAYAS 39
-#define PINEAPPLE 40
-#define KIWI 41
-#define COCONUTS 42
-#define MANGO 43
-#define RING 44
-#define POTION 45
-#define BRACELET 46
-#define GIRL 47
-#define GIRLTALK 48
-#define DARK 49
-#define TIMER 50
-#define CHAR 53
-#define BOMB 54
-#define DEADGOD 55
-#define DEADTIME 56
-#define DEADNATIVE 57
-#define NATIVE 58
-#define HORSE 59
-#define CAR 60
-#define POT 61
-#define BAR 62
-#define BLOCK 63
-#define NUMOFOBJECTS 64
- /* non-objects below */
-#define UP 1000
-#define DOWN 1001
-#define AHEAD 1002
-#define BACK 1003
-#define RIGHT 1004
-#define LEFT 1005
-#define TAKE 1006
-#define USE 1007
-#define LOOK 1008
-#define QUIT 1009
-#define NORTH 1010
-#define SOUTH 1011
-#define EAST 1012
-#define WEST 1013
-#define SU 1014
-#define DROP 1015
-#define TAKEOFF 1016
-#define DRAW 1017
-#define PUTON 1018
-#define WEARIT 1019
-#define PUT 1020
-#define INVEN 1021
-#define EVERYTHING 1022
-#define AND 1023
-#define KILL 1024
-#define RAVAGE 1025
-#define UNDRESS 1026
-#define THROW 1027
-#define LAUNCH 1028
-#define LANDIT 1029
-#define LIGHT 1030
-#define FOLLOW 1031
-#define KISS 1032
-#define LOVE 1033
-#define GIVE 1034
-#define SMITE 1035
-#define SHOOT 1036
-#define ON 1037
-#define OFF 1038
-#define TIME 1039
-#define SLEEP 1040
-#define DIG 1041
-#define EAT 1042
-#define SWIM 1043
-#define DRINK 1044
-#define DOOR 1045
-#define SAVE 1046
-#define RIDE 1047
-#define DRIVE 1048
-#define SCORE 1049
-#define BURY 1050
-#define JUMP 1051
-#define KICK 1052
-
- /* injuries */
-#define ARM 6 /* broken arm */
-#define RIBS 7 /* broken ribs */
-#define SPINE 9 /* broken back */
-#define SKULL 11 /* fractured skull */
-#define INCISE 10 /* deep incisions */
-#define NECK 12 /* broken NECK */
-#define NUMOFINJURIES 13
-
- /* notes */
-#define CANTLAUNCH 0
-#define LAUNCHED 1
-#define CANTSEE 2
-#define CANTMOVE 3
-#define JINXED 4
-#define DUG 5
-#define NUMOFNOTES 6
-
- /* fundamental constants */
-#define NUMOFROOMS 275
-#define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
-#define LINELENGTH 81
-
-#define TODAY 0
-#define TONIGHT 1
-#define CYCLE 100
-
- /* initial variable values */
-#define TANKFULL 250
-#define TORPEDOES 10
-#define MAXWEIGHT 60
-#define MAXCUMBER 10
-
-struct room {
- const char *name;
- int link[8];
-#define north link[0]
-#define south link[1]
-#define east link[2]
-#define west link[3]
-#define up link[4]
-#define access link[5]
-#define down link[6]
-#define flyhere link[7]
- const char *desc;
- unsigned int objects[NUMOFWORDS];
-};
-extern struct room dayfile[];
-extern struct room nightfile[];
-struct room *location;
-
- /* object characteristics */
-extern const char *const objdes[NUMOFOBJECTS];
-extern const char *const objsht[NUMOFOBJECTS];
-extern const char *const ouch[NUMOFINJURIES];
-extern const int objwt[NUMOFOBJECTS];
-extern const int objcumber[NUMOFOBJECTS];
-
- /* current input line */
-#define NWORD 20 /* words per line */
-char words[NWORD][15];
-int wordvalue[NWORD];
-int wordtype[NWORD];
-int wordcount, wordnumber;
-
-
-int battlestar_move(int, int);
-void bury(void);
-int card(const char *, int);
-void chime(void);
-void crash(void);
-int cypher(void);
-void die(int);
-void dig(void);
-int draw(void);
-void drink(void);
-int drive(void);
-int drop(const char *name);
-int eat(void);
-int fight(int, int);
-int follow(void);
-char *getcom(char *, int, const char *, const char *);
-char *getword(char *, char *, int);
-int give(void);
-void initialize(int);
-int jump(void);
-void kiss(void);
-int land(void);
-int launch(void);
-void light(void);
-void live(void);
-void love(void);
-void murder(void);
-void news(void);
-void newway (int);
-void open_score_file(void);
-void parse(void);
-void printobjs(void);
-int put(void);
-int puton(void);
-void ravage(void);
-const char *rate(void);
-void restore(void);
-int ride(void);
-void save(void);
-int shoot(void);
-int take(unsigned int from[]);
-int takeoff(void);
-int throw(const char *name);
-const char *truedirec(int, unsigned int);
-int ucard(const unsigned int *);
-int use(void);
-int visual(void);
-int wearit(void);
-void whichway(struct room);
-void wordinit(void);
-void writedes(void);
-int zzz(void);
-
- /* state of the game */
-extern int gclock;
-int gtime;
-int position;
-int direction;
-int left, right, ahead, back;
-int fuel, torps;
-int carrying, encumber;
-int rythmn;
-extern int followfight;
-int ate;
-int snooze;
-int meetgirl;
-extern int followgod;
-int godready;
-extern int bs_win;
-int wintime;
-int wiz;
-int tempwiz;
-int matchlight;
-extern int matchcount;
-int loved;
-int pleasure, power, ego;
-extern int WEIGHT;
-extern int CUMBER;
-int notes[NUMOFNOTES];
-unsigned int inven[NUMOFWORDS];
-u_int wear[NUMOFWORDS];
-char beenthere[NUMOFROOMS+1];
-char injuries[NUMOFINJURIES];
-
-char uname[MAXLOGNAME];
-
-struct wlist {
- const char *string;
- int value, article;
- struct wlist *next;
-};
-#define HASHSIZE 256
-#define HASHMUL 81
-#define HASHMASK (HASHSIZE - 1)
-struct wlist *hashtab[HASHSIZE];
-extern struct wlist wlist[];
-
-struct objs {
- short room;
- short obj;
-};
-extern const struct objs dayobjs[];
-extern const struct objs nightobjs[];
-
-extern gid_t egid;
diff --git a/games/battlestar/fly.c b/games/battlestar/fly.c
deleted file mode 100644
index e204807..0000000
--- a/games/battlestar/fly.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)fly.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-#undef UP
-#include <curses.h>
-#include <string.h>
-
-#define abs(a) ((a) < 0 ? -(a) : (a))
-#define MIDR (LINES/2 - 1)
-#define MIDC (COLS/2 - 1)
-
-int row, column;
-int dr = 0, dc = 0;
-char destroyed;
-int gclock = 120; /* gtime for all the flights in the game */
-char cross = 0;
-sig_t oldsig;
-
-static void blast(void);
-static void endfly(void);
-static void moveenemy(int);
-static void notarget(void);
-static void succumb(int);
-static void screen(void);
-static void target(void);
-
-void
-succumb(sig)
- int sig;
-{
-
- sig = 0;
- if (oldsig == SIG_DFL) {
- endfly();
- exit(1);
- }
- if (oldsig != SIG_IGN) {
- endfly();
- (*oldsig)(SIGINT);
- }
-}
-
-int
-visual()
-{
-
- destroyed = 0;
- if(initscr() == NULL){
- puts("Whoops! No more memory...");
- return(0);
- }
- oldsig = signal(SIGINT, succumb);
- crmode();
- noecho();
- screen();
- row = rnd(LINES-3) + 1;
- column = rnd(COLS-2) + 1;
- moveenemy(0);
- for (;;) {
- switch(getchar()){
-
- case 'h':
- case 'r':
- dc = -1;
- fuel--;
- break;
-
- case 'H':
- case 'R':
- dc = -5;
- fuel -= 10;
- break;
-
- case 'l':
- dc = 1;
- fuel--;
- break;
-
- case 'L':
- dc = 5;
- fuel -= 10;
- break;
-
- case 'j':
- case 'u':
- dr = 1;
- fuel--;
- break;
-
- case 'J':
- case 'U':
- dr = 5;
- fuel -= 10;
- break;
-
- case 'k':
- case 'd':
- dr = -1;
- fuel--;
- break;
-
- case 'K':
- case 'D':
- dr = -5;
- fuel -= 10;
- break;
-
- case '+':
- if (cross){
- cross = 0;
- notarget();
- }
- else
- cross = 1;
- break;
-
- case ' ':
- case 'f':
- if (torps){
- torps -= 2;
- blast();
- if (row == MIDR && column - MIDC < 2 && MIDC - column < 2){
- destroyed = 1;
- alarm(0);
- }
- }
- else
- mvaddstr(0,0,"*** Out of torpedoes. ***");
- break;
-
- case 'q':
- endfly();
- return(0);
-
- default:
- mvaddstr(0,26,"Commands = r,R,l,L,u,U,d,D,f,+,q");
- continue;
-
- case EOF:
- break;
- }
- if (destroyed){
- endfly();
- return(1);
- }
- if (gclock <= 0){
- endfly();
- die(0);
- }
- }
- /* NOTREACHED */
- return(1);
-}
-
-void
-screen()
-{
- int r,c,n;
- int i;
-
- clear();
- i = rnd(100);
- for (n=0; n < i; n++){
- r = rnd(LINES-3) + 1;
- c = rnd(COLS);
- mvaddch(r, c, '.');
- }
- mvaddstr(LINES-1-1,21,"TORPEDOES FUEL TIME");
- refresh();
-}
-
-void
-target()
-{
- int n;
-
- move(MIDR,MIDC-10);
- addstr("------- + -------");
- for (n = MIDR-4; n < MIDR-1; n++){
- mvaddch(n,MIDC,'|');
- mvaddch(n+6,MIDC,'|');
- }
-}
-
-void
-notarget()
-{
- int n;
-
- move(MIDR,MIDC-10);
- addstr(" ");
- for (n = MIDR-4; n < MIDR-1; n++){
- mvaddch(n,MIDC,' ');
- mvaddch(n+6,MIDC,' ');
- }
-}
-
-void
-blast()
-{
- int n;
-
- alarm(0);
- move(LINES-1, 24);
- printw((char *)(uintptr_t)(const void *)"%3d", torps);
- for(n = LINES-1-2; n >= MIDR + 1; n--){
- mvaddch(n, MIDC+MIDR-n, '/');
- mvaddch(n, MIDC-MIDR+n, '\\');
- refresh();
- }
- mvaddch(MIDR,MIDC,'*');
- for(n = LINES-1-2; n >= MIDR + 1; n--){
- mvaddch(n, MIDC+MIDR-n, ' ');
- mvaddch(n, MIDC-MIDR+n, ' ');
- refresh();
- }
- alarm(1);
-}
-
-void
-moveenemy(int sig)
-{
- double d;
- int oldr, oldc;
-
- sig = 0;
- oldr = row;
- oldc = column;
- if (fuel > 0){
- if (row + dr <= LINES-3 && row + dr > 0)
- row += dr;
- if (column + dc < COLS-1 && column + dc > 0)
- column += dc;
- } else if (fuel < 0){
- fuel = 0;
- mvaddstr(0,60,"*** Out of fuel ***");
- }
- d = (double) ((row - MIDR)*(row - MIDR) + (column - MIDC)*(column - MIDC));
- if (d < 16){
- row += (rnd(9) - 4) % (4 - abs(row - MIDR));
- column += (rnd(9) - 4) % (4 - abs(column - MIDC));
- }
- gclock--;
- mvaddstr(oldr, oldc - 1, " ");
- if (cross)
- target();
- mvaddstr(row, column - 1, "/-\\");
- move(LINES-1, 24);
- printw((char *)(uintptr_t)(const void *)"%3d", torps);
- move(LINES-1, 42);
- printw((char *)(uintptr_t)(const void *)"%3d", fuel);
- move(LINES-1, 57);
- printw((char *)(uintptr_t)(const void *)"%3d", gclock);
- refresh();
- signal(SIGALRM, moveenemy);
- alarm(1);
-}
-
-void
-endfly()
-{
- alarm(0);
- signal(SIGALRM, SIG_DFL);
- mvcur(0,COLS-1,LINES-1,0);
- endwin();
- signal(SIGTSTP, SIG_DFL);
- signal(SIGINT, oldsig);
-}
diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c
deleted file mode 100644
index c815f2f..0000000
--- a/games/battlestar/getcom.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <ctype.h>
-#include "externs.h"
-
-char *
-getcom(buf, size, prompt, error)
- char *buf;
- int size;
- const char *prompt, *error;
-{
- for (;;) {
- fputs(prompt, stdout);
- if (fgets(buf, size, stdin) == 0) {
- clearerr(stdin);
- continue;
- }
- while (isspace(*buf))
- buf++;
- if (*buf)
- break;
- if (error)
- puts(error);
- }
- return (buf);
-}
-
-
-/*
- * shifts to UPPERCASE if flag > 0, lowercase if flag < 0,
- * and leaves it unchanged if flag = 0
- */
-char *
-getword(buf1, buf2, flag)
- char *buf1, *buf2;
- int flag;
-{
- while (isspace(*buf1))
- buf1++;
- if (*buf1 != ',') {
- if (!*buf1) {
- *buf2 = 0;
- return (0);
- }
- while (*buf1 && !isspace(*buf1) && *buf1 != ',')
- if (flag < 0)
- if (isupper(*buf1))
- *buf2++ = tolower(*buf1++);
- else
- *buf2++ = *buf1++;
- else if (flag > 0)
- if (islower(*buf1))
- *buf2++ = toupper(*buf1++);
- else
- *buf2++ = *buf1++;
- else
- *buf2++ = *buf1++;
- } else
- *buf2++ = *buf1++;
- *buf2 = 0;
- while (isspace(*buf1))
- buf1++;
- return (*buf1 ? buf1 : 0);
-}
diff --git a/games/battlestar/globals.c b/games/battlestar/globals.c
deleted file mode 100644
index 447c193..0000000
--- a/games/battlestar/globals.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)globals.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-int WEIGHT = MAXWEIGHT;
-int CUMBER = MAXCUMBER;
-
-const char *const objdes[NUMOFOBJECTS] = {
- "There is a knife here",
- "There is an exquisitely crafted sword and scabbard here.",
- 0, /* can land from here */
- "There is a fierce woodsman here brandishing a heavy mallet.",
- "There is an unwieldy two-handed sword here.",
- "There is a bloody meat cleaver here.",
- "A rusty broadsword is lying here.",
- "There is an ancient coat of finely woven mail here.",
- "There is a old dented helmet with an ostrich plume here.",
- "There is a shield of some native tribe here.",
- "The maid's body is lying here. She was murdered!",
- "There is a Viper ready for launch here.",
- "A kerosene lantern is burning luridly here.",
- "An old pair of shoes has been discarded here.",
- 0, /* cylon */
- "There is a pair of pajamas here.",
- "A kingly robe of royal purple and spun gold is draped here.",
- "There is a strange golden amulet on the floor here.",
- "A medallion of solid gold shimmers on the ground nearby.",
- "A talisman of gold is lying here.",
- "A dead woodsman has fallen here. He was savagely murdered.",
- "A heavy wooden mallet lies nearby.",
- "There is a laser pistol here.",
- "A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.",
- "The goddess is reclining on a bed of ferns and studying you intently.",
- "There is a grenade here",
- "There is a length of heavy chain here.",
- "There is a stout rope here.",
- "There is a pair of Levi's here.",
- "A bloody mace is lying on the ground here.",
- "There is a shovel here.",
- "A long, sharp halberd is propped up here.",
- "There is a compass here",
- "Wreckage and smoldering debris from a crash litter the ground here.",
- "A woodland Elf armed with a shield and deadly halberd lunges toward you!",
- "I think I hear footsteps behind us.",
- "There are a few coins here.",
- "There are some matches here.",
- "An unctuous man in a white suit and a dwarf are standing here.",
- "There are some ripe papayas here.",
- "There is a ripe pineapple here.",
- "There are some kiwi fruit here.",
- "There are some coconuts here.",
- "There is a ripe mango here.",
- "There is a sparkling diamond ring here.",
- "There is a colorful pink potion in a small crystal vial here.",
- "A gold bracelet is on the ground here.",
- "A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here. Meet me at midnight in the gardens.'",
- "The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'",
- "Out from the shadows a figure leaps! His black cape swirls around, and he\nholds a laser sword at your chest. 'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'",
- "An old timer with one eye missing and no money for a drink sits at the bar.",
- "You are flying through an asteroid field!",
- "A planet is nearby.",
- "The ground is charred here.",
- "There is a thermonuclear warhead here.",
- "The fragile, beautiful young goddess lies here. You murdered her horribly.",
- "The old timer is lying here. He is dead.",
- "The native girl's body is lying here.",
- "A native girl is sitting here.",
- "A gorgeous white stallion is standing here.",
- "The keys are in the ignition.",
- "A pot of pearls and jewels is sitting here.",
- "A bar of solid gold is here.",
- "There is a 10 kilogram diamond block here."
-
-};
-
-const char *const objsht[NUMOFOBJECTS] = {
- "knife",
- "fine sword",
- 0,
- "Woodsman",
- "two-handed sword",
- "meat cleaver",
- "broadsword",
- "coat of mail",
- "plumed helmet",
- "shield",
- "maid's body",
- "viper",
- "lantern",
- "shoes",
- 0,
- "pajamas",
- "robe",
- "amulet",
- "medallion",
- "talisman",
- "woodsman's body",
- "wooden mallet",
- "laser",
- 0,
- 0,
- "grenade",
- "chain",
- "rope",
- "levis",
- "mace",
- "shovel",
- "halberd",
- "compass",
- 0,
- "Elf",
- 0,
- "coins",
- "match book",
- 0,
- "papayas",
- "pineapple",
- "kiwi",
- "coconuts",
- "mango",
- "ring",
- "potion",
- "bracelet",
- 0,
- 0,
- "Dark Lord",
- 0,
- 0,
- 0,
- 0,
- "warhead",
- "goddess's body",
- "old timer's body",
- "girl's body",
- 0,
- "stallion",
- "car",
- "pot of jewels",
- "bar of gold",
- "diamond block"
-};
-
-const char *const ouch[NUMOFINJURIES] = {
- "some minor abrasions",
- "some minor lacerations",
- "a minor puncture wound",
- "a minor amputation",
- "a sprained wrist",
- "a fractured ankle and shattered kneecap",
- "a broken arm and dislocated shoulder",
- "a few broken ribs",
- "a broken leg and torn ligaments",
- "a broken back and ruptured spleen",
- "some deep incisions and a loss of blood",
- "a fractured skull and mashed face",
- "a broken neck"
-};
-
-const int objwt[NUMOFOBJECTS] = {
- 1, 5, 0, 10, 15, 2, 10, 10,
- 3, 5, 50, 2500, 2, 1, 100, 1,
- 2, 1, 1, 1, 60, 10, 5, 0,
- 50, 5, 15, 5, 1, 20, 10, 10,
- 0, 0, 0, 0, 1, 0, 0, 1,
- 1, 1, 2, 1, 0, 0, 0, 0,
- 0, 0, 100, 0, 0, 0, 55, 47,
- 50, 45, 45, 100, 2000, 30, 20, 10
-};
-
-const int objcumber[NUMOFOBJECTS] = {
- 1, 5, 0, 150, 10, 1, 5, 2,
- 2, 1, 5, 10, 1, 1, 10, 1,
- 1, 1, 1, 1, 7, 5, 4, 0,
- 0, 1, 1, 1, 1, 5, 4, 4,
- 1, 0, 0, 0, 1, 0, 0, 1,
- 1, 1, 3, 1, 0, 0, 1, 0,
- 0, 0, 10, 0, 0, 0, 7, 8,
- 10, 8, 8, 10, 10, 3, 1, 2
-};
-
-int bs_win = 1;
-int matchcount = 20;
-int followgod = -1;
-int followfight = -1;
diff --git a/games/battlestar/init.c b/games/battlestar/init.c
deleted file mode 100644
index 85ee6f2..0000000
--- a/games/battlestar/init.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <string.h>
-#include "externs.h"
-
-static int checkout(const char *);
-static void getutmp(char *);
-static int wizard(const char *);
-
-void
-initialize(startup)
- int startup;
-{
- const struct objs *p;
-
- puts("Version 4.2, fall 1984.");
- puts("First Adventure game written by His Lordship, the honorable");
- puts("Admiral D.W. Riggle\n");
- srandomdev();
- getutmp(uname);
- if (startup)
- location = dayfile;
- wiz = wizard(uname);
- wordinit();
- if (startup) {
- direction = NORTH;
- gtime = 0;
- snooze = CYCLE * 1.5;
- position = 22;
- setbit(wear, PAJAMAS);
- fuel = TANKFULL;
- torps = TORPEDOES;
- for (p = dayobjs; p->room != 0; p++)
- setbit(location[p->room].objects, p->obj);
- } else
- restore();
- signal(SIGINT, die);
-}
-
-void
-getutmp(battlestar_uname)
- char *battlestar_uname;
-{
- struct passwd *ptr;
-
- ptr = getpwuid(getuid());
- strcpy(battlestar_uname, ptr ? ptr->pw_name : "");
-}
-
-const char *const list[] = { /* hereditary wizards */
- "riggle",
- "chris",
- "edward",
- "comay",
- "yee",
- "dmr",
- "ken",
- 0
-};
-
-const char *const badguys[] = {
- "wnj",
- "root",
- "ted",
- 0
-};
-
-int
-wizard(battlestar_uname)
- const char *battlestar_uname;
-{
- char flag;
-
- if ((flag = checkout(battlestar_uname)) > 0)
- printf("You are the Great wizard %s.\n", battlestar_uname);
- return flag;
-}
-
-int
-checkout(battlestar_uname)
- const char *battlestar_uname;
-{
- const char *const *ptr;
-
- for (ptr = list; *ptr; ptr++)
- if (strcmp(*ptr, battlestar_uname) == 0)
- return 1;
- for (ptr = badguys; *ptr; ptr++)
- if (strcmp(*ptr, battlestar_uname) == 0) {
- printf("You are the Poor anti-wizard %s. Good Luck!\n",
- battlestar_uname);
- if (location != NULL) {
- CUMBER = 3;
- WEIGHT = 9; /* that'll get him! */
- gclock = 10;
- setbit(location[7].objects, WOODSMAN); /* viper room */
- setbit(location[20].objects, WOODSMAN); /* laser " */
- setbit(location[13].objects, DARK); /* amulet " */
- setbit(location[8].objects, ELF); /* closet */
- }
- return 0; /* anything else, Chris? */
- }
- return 0;
-}
diff --git a/games/battlestar/misc.c b/games/battlestar/misc.c
deleted file mode 100644
index e55e347..0000000
--- a/games/battlestar/misc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-int
-card(array, size) /* for beenthere, injuries */
- const char *array;
- int size;
-{
- const char *end = array + size;
- int i = 0;
-
- while (array < end)
- if (*array++)
- i++;
- return (i);
-}
-
-int
-ucard(array)
- const unsigned int *array;
-{
- int j = 0, n;
-
- for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(array, n))
- j++;
- return (j);
-}
diff --git a/games/battlestar/nightfile.c b/games/battlestar/nightfile.c
deleted file mode 100644
index 3d1ee17..0000000
--- a/games/battlestar/nightfile.c
+++ /dev/null
@@ -1,1181 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)nightfile.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-struct room nightfile[] = {
- { 0 },
- { "You are in the main hangar.",
- { 5, 2, 9, 3, 3, 1, 0, 0 },
-"This is a huge bay where many fighters and cargo craft lie. Alarms are \n\
-sounding and fighter pilots are running to their ships. Above is a gallery\n\
-overlooking the bay. The scream of turbo engines is coming from +. The rest\n\
-of the hangar is +. There is an exit +.*\n" },
- { "This is the landing bay.",
- { 1, 0, 10, 0, 0, 0, 0, 0 },
-"Ships are landing here, some heavily damaged. Enemy fighters continually\n\
-strafe this vulnerable port. The main hangar is +, *\n\
-There is an exit +.*\n" },
- { "You are in the gallery.",
- { 4, 0, 0, 0, 0, 0, 1, 0 },
-"From here a view of the entire landing bay reveals that our battlestar\n\
-is near destruction. Fires are spreading out of control and laser blasts\n\
-lick at the shadows. The control room is +. ***\n" },
- { "You are in the control room.",
- { 0, 3, 0, 0, 0, 0, 5, 0 },
-"Several frantic technicians are flipping switches wildly but otherwise\n\
-this room seems fairly deserted. A weapons locker has been left open.\n\
-A staircase leads down. * There is a way -. ** \n" },
- { "This is the launch room.",
- { 6, 1, 7, 0, 4, 1, 0, 0 },
-"From the launch tubes here fighters blast off into space. Only one is left,\n\
-and it is guarded by two fierce men. A staircase leads up from here.\n\
-There is a cluttered workbench +. From the main hangar come sounds of great\n\
-explosions. The main hangar is +. The viper launch tubes are to the -.*\n" },
- { "You are at the workbench.",
- { 0, 5, 7, 0, 0, 0, 0, 0 },
-"Strange and unwieldy tools are arranged here including a lunch box \n\
-and pneumatic wrenches and turbo sprocket rockets.*\n\
-The launch room is +. The remaining viper is +.*\n" },
- { "You are in the viper launch tube.",
- { 0, 5, 0, 5, 32, 0, 0, 0 },
-"The two guards are eyeing you warily! ****\n" },
- { "This is a walk in closet.",
- { 22, 0, 0, 0, 0, 0, 0, 0 },
-"A wardrobe of immense magnitude greets the eye. Furs and robes of kings\n\
-hang on rack after rack. Silken gowns, capes woven with spun gold, and \n\
-delicate synthetic fabrics are stowed here. The bedroom is +.***\n" },
- { "You are in a wide hallway leading to the main hangar.",
- { 0, 0, 11, 1, 0, 0, 0, 0 },
-"The walls and ceiling here have been blasted through in several places.\n\
-It looks as if quite a battle has been fought for possession of the landing bay\n\
-Gaping corpses litter the floor.** The hallway continues +.\n\
-The main hangar is +.\n" },
- { "You are in a wide hallway leading to the landing bay.",
- { 0, 0, 12, 2, 0, 0, 0, 0 },
-"Most of the men and supplies needed in the main hangar come through this\n\
-corridor, but the wounded are forced to use it too. It very dank and\n\
-crowded here, and the floor is slippery with blood.**\n\
-The hallway continues -. The landing bay is +.\n" },
- { "The hallway is very congested with rubble here.",
- { 0, 0, 0, 9, 13, 1, 0, 0 },
-"It is too choked with broken steel girders and other debris to continue\n\
-on much farther. Above, the ceiling has caved in and it is possible to \n\
-climb up. There is not much chance to go -, -, or -.\n\
-But the hallway seems clearer +.\n" },
- { "A wide hallway and a more narrow walkway meet here.",
- { 14, 15, 0, 10, 0, 0, 0, 0 },
-"The intersection is crowded with the many wounded who have come up\n\
-the wide hallway and continued +. The walkway is less crowded +.\n\
-The wide hallway goes *-.\n" },
- { "You are in what was once an elegant stateroom.",
- { 16, 0, 0, 0, 0, 0, 11, 0 },
-"Whoever lived in this stateroom, he and his female companion\n\
-were mercilessly slain in their sleep. Clothes, trinkets and personal\n\
-belongings are scattered all across the floor. Through a hole in the\n\
-collapsed floor I can see a hallway below. A door is +.***\n" },
- { "You're at the entrance to the sick bay.",
- { 17, 12, 18, 0, 0, 0, 0, 0 },
-"The wounded are entering the sick bay in loudly moaning files.\n\
-The walkway continues - and +. A doctor is motioning for you to \n\
-come to the -. *\n" },
- { "You're in the walkway.",
- { 12, 19, 0, 0, 0, 0, 0, 0 },
-"Most of the men and supplies were coming from the armory. The walkway\n\
-continues -. The armory is +.**\n" },
- { "These are the executive suites of the battlestar.",
- { 20, 13, 21, 22, 23, 1, 24, 0 },
-"Luxurious staterooms carpeted with crushed velvet and adorned with beaten\n\
-gold open onto this parlor. A wide staircase with ivory banisters leads\n\
-up or down. This parlor leads into a hallway +. The bridal suite is +.\n\
-Other rooms lie - and +.\n" },
- { "You're in a long dimly lit hallway.",
- { 0, 14, 25, 0, 0, 0, 0, 0 },
-"This part of the walkway is deserted. There is a dead end +. The\n\
-entrance to the sickbay is +. The walkway turns sharply -.*\n" },
- { "This is the sick bay.",
- { 0, 0, 0, 14, 0, 0, 0, 0 },
-"Sinister nurses with long needles and pitiful aim probe the depths of suffering\n\
-here. Only the mortally wounded receive medical attention on a battlestar,\n\
-but afterwards they are thrown into the incinerators along with the rest.**\n\
-Nothing but death and suffering +. The walkway is +.\n" },
- { "You're in the armory.",
- { 15, 26, 0, 0, 0, 0, 0, 0 },
-"An armed guard is stationed here 365 sectars a yarn to protect the magazine.\n\
-The walkway is +. The magazine is +.**\n" },
- { "The hallway ends here at the presidential suite.",
- { 27, 16, 0, 0, 0, 0, 0, 0 },
-"The door to this suite is made from solid magnesium, and the entryway is\n\
-inlaid with diamonds and fire opals. The door is ajar +. The hallway\n\
-goes -.**\n" },
- { "This is the maid's utility room.",
- { 0, 0, 0, 16, 0, 0, 0, 0 },
-"What a gruesome sight! The maid has been brutally drowned in a bucket of\n\
-Pine Sol and repeatedly stabbed in the back with a knife.***\n\
-The hallway is +.\n" },
- { "This is a luxurious stateroom.",
- { 0, 8, 16, 0, 0, 0, 0, 0 },
-"The floor is carpeted with a soft animal fur and the great wooden furniture\n\
-is inlaid with strips of platinum and gold. Electronic equipment built\n\
-into the walls and ceiling is flashing wildly. The floor shudders and\n\
-the sounds of dull explosions rumble though the room. From a window in\n\
-the wall + comes a view of darkest space. There is a small adjoining\n\
-room +, and a doorway +.*\n" },
- { "You are at the entrance to the dining hall.",
- { 0, 0, 28, 0, 0, 0, 16, 0 },
-"A wide staircase with ebony banisters leads down here.**\n\
-The dining hall is to the -.*\n" },
- { "This was once the first class lounge.",
- { 0, 0, 29, 0, 16, 1, 0, 0 },
-"There is much rubble and destruction here that was not apparent elsewhere.\n\
-The walls and ceilings have broken in in some places. A staircase with\n\
-red coral banisters leads up. It is impossible to go - or -.\n\
-It seems a little clearer +.*\n" },
- { "You are in a narrow stairwell.",
- { 0, 17, 0, 0, 30, 1, 0, 0 },
-"These dusty and decrepit stairs lead up. There is no way -. The\n\
-hallway turns sharply -.**\n" },
- { "You are in the magazine.",
- { 19, 0, 0, 0, 0, 0, 0, 0 },
-"Rows and rows of neatly stacked ammunition for laser pistols and grenade\n\
-launchers are here. The armory is +.***\n" },
- { "You're in the presidential suite.",
- { 0, 20, 0, 0, 0, 0, 0, 0 },
-"Apparently the president has been assassinated. A scorched figure lies\n\
-face downward on the carpet clutching his chest.*\n\
-The hallway leads -.**\n" },
- { "You are in the dining hall.",
- { 0, 30, 31, 23, 0, 0, 0, 0 },
-"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\
-dignitaries sit slumped over their breakfast cereal. I suppose the news\n\
-of the cylon attack killed them. There is a strange chill in this room. I\n\
-would not linger here. * The kitchen is +. Entrances + and +.\n" },
- { "The debris is very thick here.",
- { 0, 11, 0, 24, 0, 0, 0, 0 },
-"Broken furniture, fallen girders, and other rubble block the way.\n\
-There is not much chance to continue -, -, or -.\n\
-It would be best to go -.\n" },
- { "You are in the kitchen.",
- { 28, 0, 0, 0, 0, 0, 0, 0 },
-"This room is full of shining stainless steel and burnished bronze cookware. An \n\
-assortment of tropical fruits and vegetables as well as fine meats and cheeses \n\
-lies on a sterling platter. The chef, unfortunately, has been skewered like a \n\
-side of beef. The dining room is +. ** There is a locked door +.\n" },
- { "You are in an arched entry leading to the dining room.",
- { 0, 0, 0, 28, 0, 0, 0, 0 },
-"The door leading out is bolted shut from the outside and is very strong.***\n\
-The dining room is +.\n" },
- { "You are in space.",
- { 33, 34, 35, 36, 37, 1, 33, 1},
-"****\n" },
- { "You are in space.",
- { 38, 32, 39, 40, 41, 1, 42, 1},
-"****\n" },
- { "You are in space.",
- { 32, 44, 45, 46, 47, 1, 48, 1},
-"****\n" },
- { "You are in space.",
- { 40, 45, 49, 32, 50, 1, 51, 1},
-"****\n" },
- { "You are in space.",
- { 41, 46, 32, 52, 53, 1, 54, 1},
-"****\n" },
- { "You are in space.",
- { 42, 47, 50, 53, 55, 1, 32, 1},
-"****\n" },
- { "You are in space.",
- { 43, 48, 51, 54, 32, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 57, 33, 40, 41, 42, 1, 43, 1},
-"****\n" },
- { "You are in space.",
- { 39, 35, 57, 33, 58, 1, 59, 1},
-"****\n" },
- { "You are in space.",
- { 39, 36, 33, 59, 60, 1, 61, 1},
-"****\n" },
- { "You are in space.",
- { 39, 37, 58, 60, 62, 1, 33, 1},
-"****\n" },
- { "You are in space.",
- { 39, 38, 59, 61, 33, 1, 63, 1},
-"****\n" },
- { "You are in space.",
- { 34, 64, 45, 46, 47, 1, 48, 1},
-"****\n" },
- { "You are in space.",
- { 35, 44, 49, 34, 50, 1, 51, 1},
-"****\n" },
- { "You are in space.",
- { 36, 44, 34, 52, 53, 1, 54, 1},
-"****\n" },
- { "You are in space.",
- { 37, 44, 50, 53, 55, 1, 34, 1},
-"****\n" },
- { "You are in space.",
- { 38, 44, 51, 54, 34, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 49, 49, 52, 35, 49, 1, 49, 1},
-"****\n" },
- { "You are in space.",
- { 58, 47, 49, 37, 55, 1, 35, 1},
-"****\n" },
- { "You are in space.",
- { 59, 48, 49, 38, 35, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 52, 52, 36, 49, 52, 1, 52, 1},
-"****\n" },
- { "You are in space.",
- { 60, 46, 37, 52, 55, 1, 36, 1},
-"****\n" },
- { "You are in space.",
- { 61, 48, 38, 52, 36, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 62, 55, 55, 55, 56, 1, 37, 1},
-"****\n" },
- { "You are in space.",
- { 56, 56, 56, 56, 38, 1, 55, 1},
-"****\n" },
- { "You are in space.",
- { 65, 39, 57, 57, 57, 1, 57, 1},
-"****\n" },
- { "You are in space.",
- { 39, 50, 49, 42, 62, 1, 40, 1},
-"****\n" },
- { "You are in space.",
- { 39, 51, 49, 43, 40, 1, 63, 1},
-"****\n" },
- { "You are in space.",
- { 39, 53, 43, 59, 62, 1, 41, 1},
-"****\n" },
- { "You are in space.",
- { 39, 54, 43, 59, 41, 1, 56, 1},
-"****\n" },
- { "You are in space.",
- { 39, 55, 62, 62, 56, 1, 42, 1},
-"****\n" },
- { "You are in space.",
- { 39, 56, 35, 36, 43, 1, 55, 1},
-"****\n" },
- { "You are in space.",
- { 44, 66, 66, 66, 66, 1, 66, 1},
-"****\n" },
- { "You are in space.",
- { 67, 57, 67, 67, 67, 1, 67, 1},
-"****\n" },
- { "You are in space.",
- { 64, 68, 68, 68, 68, 1, 68, 1},
-"****\n" },
- { "You are orbiting a small blue planet.",
- { 67, 67, 67, 67, 65, 1, 69, 1},
-"****\n" },
- { "You are orbiting a tropical planet.",
- { 68, 68, 68, 68, 66, 1, 70, 1},
-"****\n" },
- { "You are flying through a dense fog.",
- { 69, 69, 69, 69, 69, 1, 69, 1},
-"A cold grey sea of mist is swirling around the windshield and water droplets\n\
-are spewing from the wingtips. Ominous shadows loom in the darkness and it\n\
-feels as if a trap is closing around us. I have lost all sense of direction.\n\
-****\n" },
- { "You are approaching an island.",
- { 71, 72, 73, 74, 68, 1, 0, 1},
-"Feather palms outlined by mellow moonlight and a silvery black ocean line\n\
-the perimeter of the island. Mighty mountains of emerald and amethyst rise\n\
-like jagged teeth from black gums. The land rises sharply +. The shore\n\
-line stretches on *+.*\n" },
- { "You are flying over a mountainous region.",
- { 75, 73, 76, 77, 68, 1, 0, 1},
-"Below is a shadow filled canyon with luminous waterfalls plummeting down beyond sight and looming spires and pinnacles. **The ocean is +.*\n" },
- { "You are flying over the ocean.",
- { 74, 78, 78, 78, 68, 1, 0, 1},
-"You bank over the water and your wingtips dip low to the green waves. The\n\
-sea is very shallow here and the white coral beds beneath us teem with \n\
-shadowy fish.****\n" },
- { "You are flying over the beach.",
- { 71, 72, 79, 74, 68, 1, 80, 1},
-"A warm gentle surf caresses the beach here. The land rises\n\
-sharply +.* The beach is lost in low cliffs +.*\n" },
- { "You are flying over a large lagoon.",
- { 81, 72, 73, 82, 68, 1, 0, 1},
-"The water's brink winds tortuously inland. There are some lights +.***\n" },
- { "You are flying over a gently sloping plane.",
- { 83, 71, 84, 85, 68, 1, 0, 1},
-"The ground appears to be choked with vegetation.* The terrain is more\n\
-rugged +.**\n" },
- { "You are flying through a gorge.",
- { 0, 0, 86, 71, 68, 1, 102, 1},
-"This is a narrow, steep sided canyon lined with plants. The stars above\n\
-glisten through the over hanging trees. The gorge leads to the\n\
-sea** +, and to a tumultuous origin +.\n" },
- { "You are flying over a plantation.",
- { 85, 81, 71, 88, 68, 1, 89, 1},
-"It might be possible to land here, but not in the dark.* There are some lights\n\
-+ and *+.\n" },
- { "You are over the ocean.",
- { 72, 78, 79, 74, 68, 1, 0, 1},
-"The deep green swells foam and roll into the shore **+*.\n" },
- { "You are flying along the coast.",
- { 86, 72, 90, 73, 68, 1, 91, 1},
-"The coastline here is very rocky. The surf in some places is violent\n\
-and explodes in a shower of sparkling, moonlit spray. ****\n" },
- { "This is a beautiful coral beach.",
- { 106, 0, 107, 108, 73, 0, 0, 0 },
-"Fine silver sand kissed lightly by warm tropical waters and illuminated\n\
-by a huge tropical moon stretches at least 30 meters inland.\n\
-Gently swaying palm trees are +.***\n" },
- { "You are flying over a small fishing village.",
- { 77, 74, 71, 82, 68, 1, 92, 1},
-"A few thatched huts lit with torches and bonfires line a road below.\n\
-The road continues on ***+.\n" },
- { "You are flying over a clearing.",
- { 88, 72, 74, 87, 68, 1, 93, 1},
-"There is a dock here (big enough for a seaplane) leading to a clearing.\n\
-The still waters of the lagoon reflects our orange turbo thrusters.****\n" },
- { "You are flying over the shore.",
- { 94, 75, 95, 96, 68, 1, 0, 1},
-"Rocky lava flows have overtaken the beach here.****\n" },
- { "You are flying in a wide valley.",
- { 95, 97, 86, 75, 68, 1, 98, 1},
-"This is a shallow valley yet the floor is obscured by a thick mist.\n\
-The valley opens into blackness +. The mist grows thicker +.**\n" },
- { "You are flying near the shore.",
- { 96, 77, 75, 99, 68, 1, 0, 1},
-"Very tall trees growing in neatly planted rows march off from the \n\
-water here towards the hills and down to the flat lands *+.**\n" },
- { "You are flying around the very tip of the island.",
- { 95, 79, 90, 84, 68, 1, 0, 1},
-"Sheer cliffs rise several hundred feet to a tree covered summit. Far below,\n\
-the grey sea gnaws voraciously at the roots of these cliffs. The island bends\n\
-around +** and +.\n" },
- { "You are flying along the coastline.",
- { 99, 82, 88, 100, 68, 1, 101, 1},
-"This is a narrow strip of sand lined with very few trees. The stars above\n\
-flicker through wisps of clouds. The beach continues on -.* There\n\
-are some lights +.*\n" },
- { "You are flying over several cottages and buildings",
- { 99, 82, 77, 87, 68, 1, 103, 1},
-"Directly below is small ornate house lit up with spot lights and decorative\n\
-bulbs. A bell tower and a spurting fountain are nearby. Small dirt roads go\n\
-+ and +.**\n" },
- { "You are in a field of sugar cane.",
- { 109, 110, 111, 112, 77, 0, 0, 0 },
-"These strong, thick canes give little shelter but many cuts and scrapes.\n\
-There are some large trees ***+.\n" },
- { "You are flying over the ocean.",
- { 95, 78, 90, 86, 68, 1, 0, 1},
-"The water is a placid ebony.****\n" },
- { "You are on the coast road.",
- { 113, 114, 115, 116, 79, 0, 0, 0 },
-"The road winds close to the shore here. The trees on either side press close\n\
-in the darkness and seem to be watching us.** The road continues -\n\
-and -.\n" },
- { "You are on the main street of the village.",
- { 117, 118, 119, 120, 81, 0, 0, 0 },
-"The natives are having a festive luau here. Beautiful dancers gyrate in the\n\
-torchlight to the rhythm of wooden drums. A suckling pig is sizzling in a\n\
-bed of coals and ti leaves are spread with poi and tropical fruits. Several\n\
-natives have come over to you and want you to join in the festivities.\n\
-There is a light burning in a bungalow +.***\n" },
- { "You are at the sea plane dock.",
- { 121, 122, 123, 124, 82, 0, 0, 0 },
-"The clearing is deserted. The grass is wet with the evening dew +.*\n\
-There is something set up +.*\n" },
- { "You are flying over the ocean.",
- { 94, 83, 95, 96, 68, 1, 0, 1},
-"The black waves surge off shore here. The ocean becomes much calmer +.***\n" },
- { "You are flying along the coast.",
- { 94, 84, 86, 83, 68, 1, 0, 1},
-"The land is very low here with a river running into the sea +. There\n\
-is a wide valley opening up +, but a strange mist is flowing out of it.\n\
-The very tip of the island is +.*\n" },
- { "You are flying along the coast.",
- { 94, 85, 83, 99, 68, 1, 0, 1},
-"The coast here is cluttered with rocky outcroppings.****\n" },
- { "You are lost in a sea of fog.",
- { 97, 104, 97, 97, 97, 1, 0, 1},
-"What have you gotten us into?\n\
-I can't see a thing! ****\n" },
- { "You are on a gravel wash.",
- { 125, 126, 127, 128, 84, 0, 0, 0 },
-"It is very dark here. A cool breeze is blowing from +. No moonlight can\n\
-reach below a thick canopy of fog above. The sound of cascading water is\n\
-coming from +.**\n" },
- { "You are flying over a wide beach.",
- { 96, 88, 85, 87, 68, 1, 105, 1},
-"There are some lighted buildings *+. Some trees are growing +.*\n" },
- { "You are flying over the ocean.",
- { 100, 100, 87, 100, 68, 1, 0, 1},
-"The black waves surge and splash against the rocky shore.****\n" },
- { "You are on a narrow strip of sand.",
- { 129, 130, 131, 0, 87, 0, 0, 0 },
-"Rather coarse sand makes this beach very steep and only a few meters wide.\n\
-A fresh ocean breeze is rustling the ferns **+.*\n" },
- { "This is Fern Canyon.",
- { 0, 0, 132, 133, 76, 0, 0, 0 },
-"Delicate waving ferns flourish here, suckled by warm water dripping from \n\
-every fissure and crevice in the solid rock walls. The stars above sparkle\n\
-through a thin mist. The canyon winds **-, and -.\n" },
- { "This is the front lawn.",
- { 134, 135, 136, 137, 88, 0, 0, 0 },
-"There is a small fountain lighted with green and yellow bulbs here where\n\
-the driveway meets the lawn. Across the driveway, +, is an ornate white\n\
-house lit with gas lamps. A bell tower here is awash in pale blue.* There\n\
-is a road + which turns into the driveway.*\n" },
- { "You have just crossed the crest of a mountain.",
- { 97, 79, 86, 71, 68, 1, 0, 1},
-"The fog vanished mysteriously as we flew over the crest.*\n\
-Far + I can see the ocean sparkling in the moonlight.**\n" },
- { "You are on a sandy beach.",
- { 138, 139, 140, 0, 99, 0, 0, 0 },
-"Fine coral sand, a fresh sea breeze, and dramatic surf add to this beach's\n\
-appeal.** Stone steps lead to a lighted path in the gardens +.*\n" },
- { "You are among palm trees near the shore.",
- { 141, 80, 142, 143, 73, 0, 0, 0 },
-"Arching coconut palms laden with fruit provide a canopy for the glistening\n\
-white sand and sparse, dew covered grasses growing here. The forest grows\n\
-denser +. Crickets are chirping loudly here. The ocean is +.**\n" },
- { "You are walking along the beach.",
- { 144, 0, 145, 80, 73, 0, 0, 0 },
-"The warm tropical waters nuzzle your ankles as you walk. Above is a gorgeous\n\
-starscape. The battlestar must be up there somewhere. The slope of the sand\n\
-is so gentle that the surf only slides up the sand.** There are some rocks\n\
-+.*\n" },
- { "You are walking along the beach.",
- { 146, 0, 80, 147, 73, 0, 0, 0 },
-"The tide is out very far tonight, and it is possible to explore hidden rocks\n\
-and caves not ordinarily accessible. Rich beds of seaweed have been exposed\n\
-to the cool night air.****\n" },
- { "You are in a papaya grove.",
- { 148, 89, 149, 150, 77, 0, 0, 0 },
-"Slender trees with their large seven lobed leaves bulge with succulent fruit.\n\
-There are some tall trees +.***\n" },
- { "You are in a field of pineapple.",
- { 89, 151, 152, 153, 77, 0, 0, 0 },
-"The sharp dagger like pineapple leaves can pierce the flesh and hold fast\n\
-a skewered victim with tiny barbs.* The field ends +.**\n" },
- { "You are in a field of kiwi plants.",
- { 149, 154, 155, 89, 77, 0, 0, 0 },
-"Round hairy fruit hang from staked vines here. There are some trees +\n\
-and +. The field ends in a road +.*\n" },
- { "You are in a large grove of coconuts.",
- { 150, 153, 89, 156, 77, 0, 0, 0 },
-"These trees are much taller than any growing near the shore and the shadows\n\
-are also deeper. It's hard to keep my sense of direction.****\n" },
- { "You are in the woods.",
- { 157, 91, 158, 116, 79, 0, 0, 0 },
-"Tropical undergrowth makes the going rough here. Sword ferns give no strong\n\
-foot hold and the dangling vines would gladly throttle one. The darkness is\n\
-so intense here that we stand in utter blackness.****\n" },
- { "You are at the shore.",
- { 91, 0, 159, 145, 79, 0, 160, 0 },
-"The low minus tide tonight might make it possible to climb down to a\n\
-small cave entrance below. Large rocks would usually churn the waves\n\
-asunder.*** The beach goes -.\n" },
- { "You are on the coast road.",
- { 158, 161, 162, 91, 79, 0, 0, 0 },
-"The road is beginning to turn slightly -. I can hear the surf +. The road\n\
-continues into the dark forest +.*\n" },
- { "The road winds deeper into the trees.",
- { 163, 142, 91, 164, 79, 0, 0, 0 },
-"Only narrow moonbeams filter through the dense foliage above. The moist rich\n\
-earth has nurtured a myriad of slugs, snakes, and spiders to grow here. The\n\
-road continues - and *- into the shadows.*\n" },
- { "This is the front porch of the bungalow.",
- { 165, 92, 0, 0, 81, 0, 0, 0 },
-"The veranda is lit by a small yellow bug light. The door leads -.\n\
-The stone walk down to the luau is lined with burning torches +. That\n\
-roast pig smells good.**\n" },
- { "You are on a path leading to the lagoon.",
- { 92, 166, 167, 168, 81, 0, 0, 0 },
-"This path winds through the underbrush and towards the lagoon *+. The\n\
-broad faced moon peeps though the branches above. The sound of drums echos\n\
-in the woods.**\n" },
- { "This is a dirt road.",
- { 169, 118, 170, 92, 81, 0, 0, 0 },
-"**The road continues on - here for some distance. A bonfire and party light\n\
-up the night sky +.\n" },
- { "You are on a dirt road.",
- { 171, 118, 92, 172, 81, 0, 0, 0 },
-"**There is a village +. A huge bonfire licks at the trees, and a celebration\n\
-of some sort is going on there. The smell of luscious cooking is tantalizing\n\
-my flared nostrils. The road continues +.\n" },
- { "You are on a dirt road.",
- { 173, 93, 174, 175, 82, 0, 0, 0 },
-"This is a wide grassy clearing bedewed with droplets of evening mist. The\n\
-trees alongside the road moan and whisper as we pass. They seem annoyed at\n\
-our presence. **The road continues - and -.\n" },
- { "You are at the seaplane dock.",
- { 93, 0, 176, 177, 82, 0, 0, 0 },
-"Not a living thing stirs the calm surface of the lagoon. The wooden planks\n\
-creak unnaturally as we tread on them. The dock reaches a clearing +.\n\
-A dark trail leads around the lagoon **+.\n" },
- { "There are some tables on the lawn here.",
- { 121, 122, 123, 93, 82, 0, 0, 0 },
-"Some tables are strewn on the wet lawn.****\n" },
- { "You are nosing around in the bushes.",
- { 124, 124, 93, 124, 82, 0, 0, 0 },
-"There is little here but some old beer cans. It is damp and dirty in here.\n\
-I think I stepped in something unpleasant. It would be best to go **-.*\n" },
- { "You are walking in a dry stream bed.",
- { 178, 98, 179, 0, 84, 0, 0, 0 },
-"The large cobblestones are difficult to walk on. No starlight reaches\n\
-below a black canopy of fog seemingly engulfing the whole island. A dirt\n\
-path along the wash is **+. The high bank is impossible to climb +.\n" },
- { "You are at the thermal pools.",
- { 98, 0, 180, 181, 84, 0, 0, 0 },
-"Odd spluttering and belching water splashes up around the rocks here.\n\
-A spectacular waterfall nearby tumbles down as a river of effervescent\n\
-bubbles. The air is quite warm and a cave entrance ***+ spews steam.\n" },
- { "You are in the woods.",
- { 127, 180, 182, 98, 84, 0, 0, 0 },
-"It is pitch black in the forest here and my pant leg is caught on something.\n\
-There may be poison oak here. What was that? A lantern just flickered by in\n\
-the dark! The sound of rushing water is coming from *+.**\n" },
- { "You are on a dirt trail.",
- { 179, 181, 98, 0, 84, 0, 0, 0 },
-"The trail seems to start here and head towards the forest +.** High, dark\n\
-cliffs border the trail +. Some crickets are chirping noisily.\n" },
- { "You are walking along the beach.",
- { 183, 101, 184, 0, 87, 0, 0, 0 },
-"The surf is rather tame tonight. The beach continues + and +.**\n" },
- { "You are walking along the beach.",
- { 101, 185, 186, 0, 87, 0, 0, 0 },
-"This is not a very nice beach. The coarse sand hurts my feet.****\n" },
- { "You are walking through some ferns.",
- { 184, 186, 187, 101, 87, 0, 0, 0 },
-"This is a wide field growing only ferns and small shrubs.** In the dark\n\
-it would be all to easy to stumble into a venomous snake. The ocean is\n\
-*+.\n" },
- { "You are in a narrow canyon.",
- { 0, 0, 188, 102, 76, 0, 0, 0 },
-"The steep sides here squeeze a little freshet through a gauntlet like\n\
-series of riffles and pools. The cool mountain air is refreshing.****\n" },
- { "The canyon is much wider here.",
- { 0, 0, 102, 189, 76, 0, 0, 0 },
-"The sheer rock walls rise 10 meters into darkness. A slender waterfall\n\
-careens away from the face of the rock high above and showers the gravel\n\
-floor with sparkling raindrops.** The canyon continues -\n\
-and -.\n" },
- { "You are on the front porch of the cottage.",
- { 190, 103, 0, 0, 0, 0, 0, 0 },
-"The veranda is deserted. A table and chair are the only things on the porch.\n\
-Inside the house is a parlor lighted with an elegant chandelier. The door\n\
-leads -. The lawn and fountain are +.**\n" },
- { "You are in a palm grove.",
- { 103, 191, 192, 105, 88, 0, 0, 0 },
-"Crickets are chirping in the cool night air.****\n" },
- { "You are on a dirt road.",
- { 193, 192, 245, 103, 88, 0, 0, 0 },
-"There are many bright lights +. The road cleaves the darkness +.\n\
-A small dirt road goes -, and a drive way peals off +.\n" },
- { "You are in a field of small shrubs.",
- { 184, 186, 103, 187, 88, 0, 0, 0 },
-"**Pine and other coniferous saplings are growing here. The rich brown\n\
-soil is well watered. Across a large lawn +, there is a small cottage lighted\n\
-with spot lights and gas lamps. A cool land breeze is blowing.*\n" },
- { "The beach is pretty rocky here.",
- { 194, 105, 195, 0, 96, 0, 0, 0 },
-"The tide is very low tonight. The beach is nicer *+.**\n" },
- { "The beach is almost 10 meters wide here.",
- { 105, 183, 196, 0, 99, 0, 0, 0 },
-"The sand has become more coarse and the beach steeper.****\n" },
- { "You are in the gardens.",
- { 195, 196, 197, 105, 99, 0, 0, 0 },
-"Shadowy expanses of lawn and leaf have been groomed and manicured here.\n\
-The night sky is glowing with a full moon.** A lighted path leads -.\n\
-Stone steps lead down to the beach +.\n" },
- { "You are on the coast road.",
- { 198, 106, 163, 199, 73, 0, 0, 0 },
-"The forest is dense on either side. The trees seem to be actually squeezing\n\
-together to keep us from passing. A feeling of enmity is in the air.**\n\
-The road continues - and -.\n" },
- { "You are in the forest.",
- { 116, 107, 91, 106, 73, 0, 0, 0 },
-"I suppose there are trees and ferns all around, but it is too dark to see.****\n" },
- { "You are in the forest.",
- { 199, 108, 106, 146, 73, 0, 0, 0 },
-"There are shadowy trees and ferns all around.****\n" },
- { "You are in a copse.",
- { 142, 107, 145, 80, 0, 0, 0, 0 },
-"This is a secret hidden thicket only noticeable from the beach. In the\n\
-moonlight, I can tell that someone has been digging here recently.****\n" },
- { "You are at the tide pools.",
- { 91, 0, 114, 107, 79, 0, 0, 0 },
-"These rocks and pools are the home for many sea anemones and crustaceans.\n\
-They are exposed because of the low tide. There is a beach ***+.\n" },
- { "You are in the forest.",
- { 199, 108, 143, 0, 73, 0, 0, 0 },
-"This is a shallow depression sheltered from the wind by a thick growth of \n\
-thorny shrubs. It looks like someone is camping here. There is a fire pit\n\
-with warm, crackling flames and coals here.* The beach is +.* The thorny\n\
-shrubs block the way -.\n" },
- { "You are at the mouth of the lagoon.",
- { 200, 0, 108, 201, 74, 0, 0, 0 },
-"The beach ends here where the coral reef rises to form a wide lagoon.\n\
-A path winds around the lagoon to the -.* The beach continues\n\
-on -. Only water lies +.\n" },
- { "You are in a breadfruit grove.",
- { 202, 109, 203, 204, 77, 0, 0, 0 },
-"The tall trees bend leisurely in the breeze, holding many round breadfruits\n\
-close to their large serrated leaves. There are coconut palms +,\n\
-*+, and +.\n" },
- { "You are in a grove of mango trees.",
- { 203, 111, 205, 109, 77, 0, 0, 0 },
-"The trees are not tall enough to obscure the view and the bright moonlight\n\
-makes it fairly easy to see.****\n" },
- { "You are in a grove of coconut palms.",
- { 204, 112, 109, 206, 77, 0, 0, 0 },
-"All I can see around us are trees and ominous shapes darting in and out of the\n\
-shadows.****\n" },
- { "You are in a coconut grove.",
- { 110, 207, 208, 209, 77, 0, 0, 0 },
-"There are countless trees here.****\n" },
- { "You are in a field of pineapple.",
- { 154, 208, 210, 110, 77, 0, 0, 0 },
-"The sharp leaves are cutting me to ribbons. There is a road **+.*\n" },
- { "You are in a coconut grove.",
- { 112, 209, 110, 211, 77, 0, 0, 0 },
-"There is a field of something **+.*\n" },
- { "You are on the edge of a kiwi and pineapple field.",
- { 111, 152, 155, 110, 77, 0, 0, 0 },
-"An irrigation ditch separates the two fields here. There is a road **+.*\n" },
- { "This is a dirt road.",
- { 205, 210, 212, 111, 77, 0, 0, 0 },
-"The road runs - and - here. It is very dark in the forest.**\n" },
- { "You are in a palm grove.",
- { 206, 211, 112, 213, 77, 0, 0, 0 },
-"There are trees all around us.****\n" },
- { "You are on the edge of a small clearing.",
- { 157, 113, 157, 157, 79, 0, 0, 0 },
-"The ground is rather marshy here and the darkness is intense. A swarm of\n\
-ravenous mosquitoes has descended upon you and has sent you quaking to your\n\
-knees.****\n" },
- { "You are in the woods.",
- { 158, 115, 215, 113, 79, 0, 0, 0 },
-"You have walked a long way and found only spider webs. ****\n" },
- { "You are walking along the shore.",
- { 115, 0, 214, 114, 86, 0, 0, 0 },
-"You are now about 10 meters above the surf on a gently rising cliffside.**\n\
-The land rises +. There is a beach far +.\n" },
- { "You are just inside the entrance to the sea cave.",
- { 246, 114, 0, 0, 114, 1, 0, 0 },
-"The sound of water dripping in darkness and the roar of the ocean just outside\n\
-create a very unwelcoming atmosphere inside this cave. Only on rare occasions\n\
-such as this is it possible to enter the forbidden catacombs... The cave\n\
-continues -.***\n" },
- { "You are in a secret nook beside the road.",
- { 115, 159, 162, 91, 79, 0, 0, 0 },
-"This little thicket is hidden from the road in the shadows of the forest.\n\
-From here we have a clear view of any traffic along the road. A great hollow\n\
-tree stuffed with something is nearby. The road is +.***\n" },
- { "You are on the coast road.",
- { 215, 214, 0, 115, 86, 0, 0, 0 },
-"The road turns abruptly - here, wandering deeper into the black forest.***\n" },
- { "You are on a dirt road.",
- { 216, 116, 113, 141, 79, 0, 0, 0 },
-"We are walking through a tunnel of unfriendly trees and shrubs. The tall\n\
-ones bend over the roadway and reach down with their branches to grab us.\n\
-Broad leafed plants at the roadside whisper in the darkness. Something\n\
-just darted across the road and into the bushes *+. Let's go *-.\n" },
- { "You have discovered a hidden thicket near the road.",
- { 163, 142, 116, 106, 73, 0, 0, 0 },
-"I would think it best to stay n the road. The forest seems very unfriendly\n\
-at night. The road is **+.*\n" },
- { "You are in the living room.",
- { 0, 117, 217, 218, 0, 0, 0, 0 },
-"A decorative entry with fresh flowers and wall to wall carpeting leads into\n\
-the living room here where a couch and two chairs converse with an end table.\n\
-*The exit is +.* The bedroom is +.\n" },
- { "You are at the lagoon.",
- { 118, 0, 167, 168, 81, 0, 0, 0 },
-"A small beach here is deserted except for some fishing nets. It is very\n\
-peaceful at the lagoon at night. The sound of native drums is carried on\n\
-the night breeze. There are paths leading off into darkness +,\n\
-*+, and +.\n" },
- { "You are at the lagoon.",
- { 118, 0, 170, 166, 81, 0, 0, 0 },
-"The grass near the water is moist with the refreshing evening dew. Far away,\n\
-drums reverberate in the forest.** The path continues + and +.\n" },
- { "You are at the lagoon.",
- { 118, 0, 166, 172, 81, 0, 0, 0 },
-"The path meanders through shadows of tussocks of grass, ferns, and thorny\n\
-bushes here and continues on **- and -.\n" },
- { "You are in the woods.",
- { 219, 119, 220, 92, 81, 0, 0, 0 },
-"There are plenty of ferns and thorny bushes here! Spider webs and probing\n\
-branches snare us as we stumble along in the pitch black night.****\n" },
- { "You are on a dirt road.",
- { 220, 167, 199, 119, 74, 0, 0, 0 },
-"The road winds rather close to a large lagoon here and many sedges and tall\n\
-loom in the darkness *+. The road continues - and -.\n" },
- { "You are in the woods beside the road.",
- { 221, 120, 92, 222, 81, 0, 0, 0 },
-"The forest grows darker +. The road is +.**\n" },
- { "The road crosses the lagoon here.",
- { 222, 0, 120, 174, 81, 0, 0, 0 },
-"Strange mists rising from the water engulf a rickety old enclosed bridge here.\n\
-Spider webs catch our hair as we pass through its rotting timbers. I felt\n\
-something drop on my neck. The road delves into the accursed forest\n\
-**+ and +.\n" },
- { "You are in a coconut palm grove.",
- { 223, 121, 224, 225, 82, 0, 0, 0 },
-"The tall palms are planted about 30 feet apart and the stary sky is clearly\n\
-visible above. A low growing grass carpets the ground all around. The grove\n\
-continues +.***\n" },
- { "You are walking along a dirt road.",
- { 224, 176, 172, 121, 82, 0, 0, 0 },
-"You are near misty patch of the roadway **+. The road continues -.\n" },
- { "You are on a dirt road.",
- { 225, 177, 121, 226, 82, 0, 0, 0 },
-"The road turns abruptly - here, splitting a grove of palm trees.* In the\n\
-starlight I can also discern that the road continues - toward the lagoon.*\n" },
- { "You are on a trail running around the lagoon.",
- { 172, 0, 0, 122, 82, 0, 0, 0 },
-"The dark waters brush the trail here and the path crosses an old bridge\n\
-+. There is deep water + and +. The trail continues -.\n" },
- { "This is the mouth of the lagoon.",
- { 175, 0, 122, 227, 82, 0, 0, 0 },
-"The coral reef wraps around a natural bay here to create a wide lagoon which\n\
-winds tortuously inland.** A trail goes around the lagoon +.\n\
-The beach is -.\n" },
- { "You are in a dry stream bed.",
- { 0, 125, 0, 0, 84, 0, 0, 0 },
-"The dry wash drains over a tall precipice here into a turbid morass below. The\n\
-most noisome stench imaginable is wafting up to defile our nostrils. Above,\n\
-the blackness is intense and a strange mist engulfs the island.* Let's go\n\
--.**\n" },
- { "You are on a dirt path along the wash.",
- { 0, 128, 125, 228, 84, 0, 0, 0 },
-"The trail winds along the gravel wash and delves into the forest ***+.\n" },
- { "The thermal pools flow into a stream here.",
- { 127, 0, 229, 126, 84, 0, 0, 0 },
-"The gurgling hot waters pour over boulders into a swiftly flowing\n\
-stream **+. The pools are +.\n" },
- { "You are at the entrance to a cave.",
- { 128, 230, 126, 0, 84, 0, 0, 0 },
-"A torch lights the entrance to the cave. Deep inside I can see shadows moving.\n\
-A path goes + from here. The entrance is +.**\n" },
- { "You are in the woods.",
- { 182, 229, 182, 127, 84, 0, 0, 0 },
-"Thorns tangle your every effort to proceed.* The sound of rushing water is\n\
-+.**\n" },
- { "You are walking along the beach.",
- { 139, 129, 184, 0, 99, 0, 0, 0 },
-"Some dunes here progress inland and make it impossible to get very far in that\n\
-direction. The beach continues - and -.* The ocean is +.\n" },
- { "You are in the dunes.",
- { 183, 101, 184, 129, 87, 0, 0, 0 },
-"The endless rolling and pitching sand dunes are enough to make one very queasy!\n\
-The sand is cool and the stars are bright at the ocean. The only way I'm going\n\
-is ***+.\n" },
- { "This is a lousy beach.",
- { 130, 0, 0, 0, 87, 0, 0, 0 },
-"Volcanic and viciously sharp bitted grains of sand here bite like cold steel\n\
-into my tender feet. I refuse to continue on. Let's get out of here. The\n\
-beach is better +.***\n" },
- { "You are in a field of sparse ferns.",
- { 131, 185, 187, 130, 87, 0, 0, 0 },
-"The lava rock outcroppings here will support few plants. There is more \n\
-vegetation +.** The ocean is +.\n" },
- { "You are in the woods.",
- { 131, 131, 137, 131, 87, 0, 0, 0 },
-"Young trees and tall shrubs grow densely together here.\n\
-They grow thicker **+.*\n" },
- { "The canyon is no wider than a foot here.",
- { 0, 0, 0, 132, 0, 0, 0, 0 },
-"The freshet is gushing through the narrow trough, but the canyon has grown\n\
-too narrow to follow it any farther.*** I guess we'll have to go -.\n" },
- { "You are in a narrow part of the canyon.",
- { 0, 0, 133, 232, 76, 0, 0, 0 },
-"The two sheer sides are no more than a few meters apart here. There is a stone\n\
-door in the wall +. The gravelly floor runs with tiny rivulets seeping \n\
-from the ground itself.* The canyon continues - and -.\n" },
- { "You are in the drawing room.",
- { 0, 134, 0, 0, 0, 0, 0, 0 },
-"Exquisitely decorated with plants and antique furniture of superb\n\
-craftsmanship, the parlor reflects its owners impeccable taste. The tropical\n\
-night air pours in through open shutters *+. There doesn't seem \n\
-to be anybody around. A large immaculate oaken desk is visible in the\n\
-study and it even has a old fashioned telephone to complete the decor.**\n" },
- { "You are in a palm grove.",
- { 135, 191, 233, 191, 88, 0, 0, 0 },
-"Grassy rows of dew covered palms stretch as far as I can see.**\n\
-There is a road +.*\n" },
- { "You are on a dirt road.",
- { 136, 233, 234, 135, 88, 0, 0, 0 },
-"The road winds through a coconut palm grove here. It continues on - \n\
-and -.**\n" },
- { "The road leads to several large buildings here.",
- { 235, 136, 236, 237, 88, 0, 0, 0 },
-"There is a lighted clubhouse +,* a large barn and stable +, and a\n\
-garage of similar construct to the barn +.\n" },
- { "This part of the beach is impassable.",
- { 0, 138, 0, 0, 96, 0, 0, 0 },
-"The see is calm tonight. The beach goes *-.**\n" },
- { "You are in the gardens.",
- { 195, 140, 197, 138, 96, 0, 0, 0 },
-"Dew beaded grass sparkles in the moonlight. Tiny lamps beside the path light\n\
-the way to the ocean ***+.\n" },
- { "You are in the gardens.",
- { 140, 183, 197, 139, 99, 0, 0, 0 },
-"Beautiful flowers and shrubs surround a lighted goldfish pond.****\n" },
- { "You are on a stone walk in the garden.",
- { 195, 196, 238, 140, 99, 0, 0, 0 },
-"The walk leads to a road **+.*\n" },
- { "You are in the forest near the road.",
- { 198, 141, 216, 198, 73, 0, 0, 0 },
-"There are many thorny bushes here!****\n" },
- { "You are at a fork in the road.",
- { 239, 146, 141, 170, 73, 0, 0, 0 },
-"Two roads come together in the darkness here. One runs -,* the other \n\
-runs - and -.\n" },
- { "You are on a dirt path around the lagoon.",
- { 170, 147, 146, 0, 74, 0, 0, 0 },
-"The still waters reflect bending palms and a stary sky. It looks like\n\
-the path runs into a clearing +. The path continues -.**\n" },
- { "You are drowning in the lagoon.",
- { 201, 201, 147, 201, 74, 0, 0, 0 },
-"I suggest you get out before you become waterlogged.****\n" },
- { "You are in a coconut palm grove.",
- { 202, 148, 203, 204, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a palm grove.",
- { 202, 149, 205, 148, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a palm grove.",
- { 202, 150, 148, 206, 77, 0, 0, 0 },
-"****\n" },
- { "You are on a dirt road.",
- { 203, 155, 212, 149, 77, 0, 0, 0 },
-"*This road ends here at a palm grove but continues on - for quite\n\
-some way.**\n" },
- { "You are in a coconut palm grove.",
- { 204, 156, 150, 213, 77, 0, 0, 0 },
-"****\n" },
- { "You are in a coconut grove.",
- { 151, 219, 208, 209, 77, 0, 0, 0 },
-"*The grove ends +.**\n" },
- { "You are in a coconut grove.",
- { 152, 207, 239, 151, 77, 0, 0, 0 },
-"**There is a dirt road +.*\n" },
- { "You are in a coconut grove.",
- { 153, 207, 151, 211, 77, 0, 0, 0 },
-"****\n" },
- { "This is a dirt road.",
- { 205, 239, 212, 154, 77, 0, 0, 0 },
-"The road continues - and -.**\n" },
- { "You are in a coconut grove.",
- { 153, 209, 153, 213, 77, 0, 0, 0 },
-"****\n" },
- { "You are in the woods near the road.",
- { 205, 210, 212, 155, 77, 0, 0, 0 },
-"There are many thorny bushes here!****\n" },
- { "You are in a coconut grove.",
- { 213, 213, 156, 234, 88, 0, 0, 0 },
-"***The grove ends in a clearing +.\n" },
- { "You are walking along some high cliffs.",
- { 162, 0, 0, 159, 86, 0, 0, 0 },
-"The island bends sharply + here with high cliffs -\n\
-and -. The cliffs are lower +.\n" },
- { "You are at the coast road turn around.",
- { 0, 162, 0, 158, 90, 0, 0, 0 },
-"The coast road ends here in a lookout with a view of the ocean.\n\
-Far below, the waves crash against the rocks.\n\
-****\n" },
- { "You are in the woods near the road.",
- { 216, 163, 216, 198, 79, 0, 257, 0 },
-"These thorny bushes are killing me.****\n" },
- { "You are in the kitchen.",
- { 0, 0, 0, 165, 0, 0, 0, 0 },
-"A small gas stove and a refrigerator are all the only appliances here. The\n\
-gas oven has been left on and the whole room is reeking with natural gas.\n\
-One spark from a match and.... The door out is ***+.\n" },
- { "You are in the bedroom.",
- { 0, 0, 165, 0, 0, 0, 0, 0 },
-"A soft feather comforter on top of layers of Answer blankets make this a very\n\
-luxurious place to sleep indeed. There are also some end tables and a dresser\n\
-here.** The living room is +.*\n" },
- { "You are in the woods.",
- { 207, 169, 220, 221, 81, 0, 0, 0 },
-"The darkness is intense, but there seems to be a clearing +.***\n" },
- { "You are in the woods near the road.",
- { 219, 170, 239, 169, 81, 0, 0, 0 },
-"*As far as I can tell, there are two roads + and +.*\n" },
- { "You are in the woods.",
- { 207, 171, 219, 222, 81, 0, 0, 0 },
-"The spider webs thin out and the forest is clearer +.***\n" },
- { "You are on the lagoon's inland finger.",
- { 0, 172, 171, 172, 81, 0, 0, 0 },
-"It is impossible to follow the lagoon any farther inland because of sharp\n\
-and very painful sedges.* The road is +.**\n" },
- { "You are in a grassy coconut grove.",
- { 240, 173, 224, 241, 82, 0, 0, 0 },
-"The tall palms provide a ghostly canopy for the sandy ground covering.****\n" },
- { "You are near the lagoon's inland finger.",
- { 0, 174, 0, 173, 82, 0, 0, 0 },
-"Very sharp sedges make it impossible to follow the lagoon any farther inland.\n\
-*There is a road +.**\n" },
- { "You are on a dirt road.",
- { 241, 175, 173, 226, 82, 0, 0, 0 },
-"The road winds through a coconut grove here and continues - and -.**\n" },
- { "You are in the woods near the road.",
- { 226, 226, 175, 226, 82, 0, 0, 0 },
-"**The road is +.*\n" },
- { "This is a beach?",
- { 227, 227, 177, 0, 82, 0, 0, 0 },
-"Hard jagged rocks that pierce with every footstep hardly comprise a beach.**\n\
-Let's go -.*\n" },
- { "The trail is lost in the woods here.",
- { 241, 241, 179, 241, 84, 0, 0, 0 },
-"The trail goes **-.*\n" },
- { "You are on the bank of a stream.",
- { 182, 0, 242, 180, 84, 0, 0, 0 },
-"The stream falls over several small boulders here and continues on **-.*\n" },
- { "You are just inside the cave.",
- { 181, 267, 0, 0, 0, 0, 0, 0 },
-"A steamy hot breath is belching from the depths of the earth within.* The\n\
-cave continues -.**\n" },
- { "You are just inside the cave entrance.",
- { 274, 0, 0, 0, 0, 0, 0, 0 },
-"The air is hot and sticky inside. The cave continues -. There is a \n\
-stone door in the wall +. A wooden sign in the dust warns in old elven\n\
-runes, \"GSRF KDIRE NLVEMP!\".**\n" },
- { "You are at the edge of a huge chasm.",
- { 0, 0, 189, 0, 76, 0, 0, 0 },
-"Several hundred feet down I can see the glimmer of placid water. The\n\
-rivulets drain over the edge and trickle down into the depths. It is \n\
-impossible to climb down.** The canyon continues -.*\n" },
- { "You are on a dirt road.",
- { 192, 241, 240, 191, 88, 0, 0, 0 },
-"The road winds through a coconut grove here. The road continues on into the\n\
-shadows - and -.**\n" },
- { "You are in a coconut palm grove near the road.",
- { 193, 233, 213, 192, 88, 0, 0, 0 },
-"***The road is +.\n" },
- { "You are at the clubhouse.",
- { 0, 193, 0, 0, 0, 0, 0, 0 },
-"The clubhouse is built over the most inland part of the lagoon. Tropical\n\
-bananas and fragrant frangipani grow along the grassy shore. Walking across\n\
-the short wooden bridge, we enter. Along one wall is a bar crowded with people.\n\
-The restaurant and disco dance floor are filled to capacity. A rock group\n\
-electrocutes itself to the satisfaction of the audience.****\n" },
- { "You are in the stables.",
- { 0, 0, 0, 193, 0, 0, 0, 0 },
-"Neighing horses snacking on hay and oats fill the stalls on both sides of\n\
-the barn. It is rather warm in here but that is not the most offensive\n\
-part.****\n" },
- { "You are in the old garage.",
- { 0, 0, 193, 0, 0, 0, 0, 0 },
-"This is an old wooden building of the same vintage as the stables. Beneath\n\
-a sagging roof stand gardening tools and greasy rags. Parked in the center\n\
-is an underpowered Plymouth Volare' with a red and white striped golf cart\n\
-roof. ****\n" },
- { "You are on a dirt road.",
- { 197, 197, 243, 197, 85, 0, 0, 0 },
-"The road leads to a formal garden laced with lighted stone walks and tropical\n\
-flowers and trees.** The road continues -. A walk leads -.\n" },
- { "You are on a dirt road.",
- { 210, 199, 198, 220, 73, 0, 0, 0 },
-"The road runs - and -.**\n" },
- { "You are in a coconut grove near the road.",
- { 234, 223, 234, 233, 88, 0, 0, 0 },
-"***The road is +.\n" },
- { "You are on a dirt road.",
- { 233, 225, 223, 226, 82, 0, 0, 0 },
-"The road continues - and -.**\n" },
- { "The stream plummets over a cliff here.",
- { 182, 0, 0, 229, 84, 0, 0, 0 },
-"Falling 10 agonizing meters into darkness, only droplets of the stream must\n\
-be left to dance off the floor below. There is no way down, even with a\n\
-strong rope. ****\n" },
- { "You are on a dirt road.",
- { 0, 0, 244, 238, 85, 0, 0, 0 },
-"**The road continues - and -.\n" },
- { "You are on a dirt road.",
- { 0, 245, 0, 243, 88, 0, 0, 0 },
-"*The road continues -* and -.\n" },
- { "You are on a dirt road.",
- { 244, 234, 213, 136, 88, 0, 0, 0 },
-"The road goes -* and *-.\n" },
- { "You are in a low passage.",
- { 247, 160, 0, 0, 0, 0, 0, 0 },
-"The ceiling here sparkles with iridescent gems and minerals. Colorful starfish\n\
-and sea anemones cling to the slippery walls and floor. The passage continues\n\
-+.***\n" },
- { "The walls are very close together here.",
- { 248, 246, 0, 0, 0, 0, 0, 0 },
-"I can barely squeeze through the jagged opening. Slimy sea weeds provide\n\
-no footing at all. This tunnel seems to be an ancient lava tube. There is\n\
-a large room +.***\n" },
- { "You are in the cathedral room.",
- { 249, 247, 250, 251, 0, 0, 0, 0 },
-"Your light casts ghostly shadows on the walls but cannot pierce the \n\
-engulfing darkness overhead. The sound of water dripping echoes in the void.\n\
-*I can see no passages leading out of this room.*** \n" },
- { "You are walking through a very round tunnel.",
- { 252, 248, 0, 0, 252, 1, 0, 0 },
-"The round walls of this tunnel are amazingly smooth to the touch. A little\n\
-trickle of water flows down the center. The tunnel climbs steadily +.\n\
-There is a large room +.**\n" },
- { "You are in the cathedral anteroom.",
- { 0, 0, 0, 248, 253, 1, 0, 0 },
-"This small chamber with a flat stone floor is to one side of the cathedral \n\
-room. We appear to be at the bottom of a tall narrow shaft. There are many \n\
-puddles of water here. A staircase hewn from solid rock and black lava \n\
-leads up.*** The cathedral room is -.\n" },
- { "You are in a wide chamber.",
- { 0, 0, 248, 254, 0, 0, 0, 0 },
-"Water is sprinkling from the ceiling here. A shallow pool populated by a \n\
-myriad of blind white creatures sparkles in your light. Tiny shrimp and\n\
-crabs scurry away, frightened by the blinding rays.** The cave \n\
-continues + and +.\n" },
- { "You are at the top of a sloping passage.",
- { 0, 249, 255, 256, 257, 1, 249, 0 },
-"There is much algae growing here, both green and brown specimens. I suspect\n\
-that we are near the high tide zone, but no light can get in here. The walls\n\
-glisten with shiny minerals.** A hallway here runs + and -.\n" },
- { "You are in an elaborately tiled room.",
- { 0, 0, 258, 0, 0, 0, 250, 0 },
-"Large colorful tiles plate the floor and walls. The ceiling is a mosaic\n\
-of gems set in gold. Hopefully it is only our footsteps that are echoing in\n\
-this hollow chamber.** The room continues -. A stone staircase leads\n\
-down.*\n" },
- { "You are at a dead end.",
- { 0, 0, 251, 0, 0, 0, 0, 0 },
-"The walls here are alive with dark mussels. They click their shells menacingly\n\
-if we disturb them.** The only exit is +.*\n" },
- { "The tunnel is very low here.",
- { 0, 0, 259, 252, 0, 0, 0, 0 },
-"You practically have to crawl on your knees to pass through this opening. The\n\
-air is stiflingly damp, but you can't hear any sounds of water dripping.**\n\
-The crawlspace continues -. The tunnel seems wider +.\n" },
- { "This is the supply room.",
- { 0, 0, 252, 0, 0, 0, 0, 0 },
-"Picks and shovels line the walls here, as well as hard hats, boxes of\n\
-dynamite, and a cartload of very high grade gold and silver ore.** \n\
-A tunnel leads off +.*\n" },
- { "You have found a secret entrance to the catacombs",
- { 0, 0, 0, 0, 216, 1, 252, 0 },
-"Below is a wet, seaweed covered floor. Above is a way out.****\n" },
- { "You are in the catacombs.",
- { 0, 0, 260, 253, 0, 0, 0, 0 },
-"Ornate tombs and piles of treasure line the walls. Long spears with many\n\
-blades, fine swords and coats of mail, heaps of coins, jewelry, pottery, \n\
-and golden statues are tribute past kings and queens.** The catacombs\n\
-continue - and -.\n" },
- { "You are crawling on your stomach.",
- { 0, 0, 261, 255, 0, 0, 0, 0 },
-"The passage is quite narrow and jagged, but the rock is no longer lava.\n\
-It appears to be a form of granite.** The crawlspace continues -, \n\
-but I would just as soon go -.\n" },
- { "You are in the Sepulcher.",
- { 0, 0, 0, 258, 0, 0, 0, 0 },
-"A single tomb is here. Encrusted with diamonds and opals, and secured with \n\
-straps of a very hard, untarnished silver, this tomb must be of a great king.\n\
-Vases overflowing with gold coins stand nearby. A line of verse on the wall\n\
-reads, \"Three he made and gave them to his daughters.\"****\n" },
- { "The passage is wider here.",
- { 0, 0, 0, 259, 0, 0, 262, 0 },
-"A ladder goes down into darkness here.*** A small crawlspace goes -.\n" },
- { "You are at the bottom of a ladder.",
- { 0, 0, 0, 0, 261, 1, 263, 0 },
-"This is a narrow platform to rest on before we continue either up or down this\n\
-rickety wooden ladder.****\n" },
- { "You are standing in several inches of water.",
- { 264, 0, 265, 266, 262, 1, 0, 0 },
-"This seems to be a working mine. Many different tunnels wander off following\n\
-glowing veins of precious metal. The floor is flooded here since we must\n\
-be nearly at sea level. A ladder leads up.****\n" },
- { "The tunnel here is blocked by broken rocks.",
- { 0, 263, 0, 0, 0, 0, 0, 0 },
-"The way is blocked, but if you had some dynamite, we might be able to blast our\n\
-way through.* The passage goes -.**\n" },
- { "The tunnel is too flooded to proceed.",
- { 0, 0, 0, 263, 0, 0, 0, 0 },
-"Hidden shafts could swallow us if we tried to continue on down this tunnel.\n\
-The flooding is already up to my waist. Large crystals overhead shimmer\n\
-rainbows of reflected light.*** Let's go -.\n" },
- { "The mine is less flooded here.",
- { 0, 0, 263, 0, 0, 0, 0, 0 },
-"A meandering gold laden vein of quartz and blooming crystals of diamonds\n\
-and topaz burst from the walls of the cave. A passage goes -.***\n" },
- { "You are inside the cave.",
- { 230, 268, 0, 0, 0, 0, 0, 0 },
-"A hot steam swirls around our heads, and the walls are warm to the touch.\n\
-The trail winds - and -.**\n" },
- { "You are in a rather large chamber.",
- { 267, 0, 0, 269, 0, 0, 269, 0 },
-"Beds of ferns and palm leaves make several cozy nests along the walls. In the\n\
-center of the room is a throne of gold and silver.*** A passageway leads\n\
-down and +.\n" },
- { "You are walking along the edge of a huge abyss.",
- { 0, 0, 268, 0, 268, 1, 270, 0 },
-"Steam is rising in great clouds from the immeasurable depths. A very narrow\n\
-trail winds down.** There is a tunnel -.*\n" },
- { "You are on the edge of a huge abyss.",
- { 0, 0, 0, 0, 269, 1, 271, 0 },
-"The trail winds farther down.****\n" },
- { "You are winding your way along the abyss.",
- { 0, 0, 0, 0, 270, 1, 272, 0 },
-"The trail continues up and down.****\n" },
- { "You are on a wide shelf near the steamy abyss.",
- { 0, 273, 0, 0, 271, 1, 0, 0 },
-"The stifling hot cave seems even hotter to me, staring down into this misty \n\
-abyss. A trail winds up.* A passageway leads -.**\n" },
- { "You are in a wide tunnel leading to a fuming abyss.",
- { 272, 274, 0, 0, 0, 0, 0, 0 },
-"The passageway winds through many beautiful formations of crystals and\n\
-sparkling minerals. The tunnel continues - and -.**\n" },
- { "You are in a tunnel.",
- { 273, 231, 0, 0, 0, 0, 0, 0 },
-"It is very warm in here. The smell of steam and hot rocks permeates the place.\n\
-The cave continues - and -.**\n" },
- { "You are at the bottom of a pit.",
- { 0, 0, 0, 0, 232, 0, 0, 0 },
-"At the top of the pit, a single star can be seen in the night sky. There\n\
-doesn't appear to be any way to get out without a rope. I don't remember\n\
-how we got here.****\n" },
-};
diff --git a/games/battlestar/nightobjs.c b/games/battlestar/nightobjs.c
deleted file mode 100644
index 20a3742..0000000
--- a/games/battlestar/nightobjs.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)nightobjs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-const struct objs nightobjs[] = {
- { 218, PAJAMAS },
- { 235, NATIVE },
- { 92, PAPAYAS },
- { 92, PINEAPPLE },
- { 92, KIWI },
- { 92, MANGO },
- { 92, NATIVE },
- { 92, MAN },
- { 181, LAMPON },
- { 236, LAMPON },
- { 92, LAMPON },
- { 216, WOODSMAN },
- { 216, DEADWOOD },
- { 216, MALLET },
- { 168, WOODSMAN },
- { 168, DEADWOOD },
- { 168, MALLET },
- { 170, WOODSMAN },
- { 170, DEADWOOD },
- { 170, MALLET },
- { 124, SHIELD },
- { 124, HALBERD },
- { 124, ELF },
- { 144, SHIELD },
- { 144, HALBERD },
- { 144, ELF },
- { 113, SHIELD },
- { 113, HALBERD },
- { 113, ELF },
- { 161, SHIELD },
- { 161, HALBERD },
- { 161, ELF },
- { 169, SHIELD },
- { 169, HALBERD },
- { 169, ELF },
- { 182, SHIELD },
- { 182, HALBERD },
- { 182, ELF },
- { 198, SHIELD },
- { 198, HALBERD },
- { 198, ELF },
- { 212, SHIELD },
- { 212, HALBERD },
- { 212, ELF },
- { 216, SHIELD },
- { 216, HALBERD },
- { 216, ELF },
- { 226, SHIELD },
- { 226, HALBERD },
- { 226, ELF },
- { 228, SHIELD },
- { 228, HALBERD },
- { 228, ELF },
- { 68, CYLON },
- { 144, SHOVEL },
- { 249, FOOT },
- { 250, FOOT },
- { 93, PAPAYAS },
- { 0, 0 }
-};
diff --git a/games/battlestar/parse.c b/games/battlestar/parse.c
deleted file mode 100644
index e705b63..0000000
--- a/games/battlestar/parse.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-static int hash (const char *);
-static void install(struct wlist *);
-struct wlist *lookup(const char *);
-
-void
-wordinit()
-{
- struct wlist *w;
-
- for (w = wlist; w->string; w++)
- install(w);
-}
-
-int
-hash(s)
- const char *s;
-{
- int hashval = 0;
-
- while (*s) {
- hashval += *s++;
- hashval *= HASHMUL;
- hashval &= HASHMASK;
- }
- return hashval;
-}
-
-struct wlist *
-lookup(s)
- const char *s;
-{
- struct wlist *wp;
-
- for (wp = hashtab[hash(s)]; wp != NULL; wp = wp->next)
- if (*s == *wp->string && strcmp(s, wp->string) == 0)
- return wp;
- return NULL;
-}
-
-void
-install(wp)
- struct wlist *wp;
-{
- int hashval;
-
- if (lookup(wp->string) == NULL) {
- hashval = hash(wp->string);
- wp->next = hashtab[hashval];
- hashtab[hashval] = wp;
- } else
- printf("Multiply defined %s.\n", wp->string);
-}
-
-void
-parse()
-{
- struct wlist *wp;
- int n;
-
- wordnumber = 0; /* for cypher */
- for (n = 0; n <= wordcount; n++) {
- if ((wp = lookup(words[n])) == NULL) {
- wordvalue[n] = -1;
- wordtype[n] = -1;
- } else {
- wordvalue[n] = wp -> value;
- wordtype[n] = wp -> article;
- }
- }
-}
diff --git a/games/battlestar/pathnames.h b/games/battlestar/pathnames.h
deleted file mode 100644
index 2590194..0000000
--- a/games/battlestar/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_SCORE "/var/games/battlestar.log"
diff --git a/games/battlestar/room.c b/games/battlestar/room.c
deleted file mode 100644
index 90f95e2..0000000
--- a/games/battlestar/room.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-void
-writedes()
-{
- int compass;
- const char *p;
- unsigned int c;
-
- printf("\n\t%s\n", location[position].name);
- if (beenthere[position] < 3) {
- compass = NORTH;
- for ((p = location[position].desc); (c = *p++);)
- if (c != '-' && c != '*' && c != '+')
- putchar((int)c);
- else {
- if (c != '*')
- printf("%s", truedirec(compass, c));
- compass++;
- }
- }
-}
-
-void
-printobjs()
-{
- unsigned int *p = location[position].objects;
- int n;
-
- printf("\n");
- for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(p, n) && objdes[n])
- puts(objdes[n]);
-}
-
-void
-whichway(here)
-struct room here;
-{
- switch(direction) {
-
- case NORTH:
- left = here.west;
- right = here.east;
- ahead = here.north;
- back = here.south;
- break;
-
- case SOUTH:
- left = here.east;
- right = here.west;
- ahead = here.south;
- back = here.north;
- break;
-
- case EAST:
- left = here.north;
- right = here.south;
- ahead = here.east;
- back = here.west;
- break;
-
- case WEST:
- left = here.south;
- right = here.north;
- ahead = here.west;
- back = here.east;
- break;
-
- }
-}
-
-const char *
-truedirec(way, option)
-int way;
-unsigned int option;
-{
- switch(way) {
-
- case NORTH:
- switch(direction) {
- case NORTH:
- return("ahead");
- case SOUTH:
- return(option == '+' ? "behind you" : "back");
- case EAST:
- return("left");
- case WEST:
- return("right");
- }
-
- case SOUTH:
- switch(direction) {
- case NORTH:
- return(option == '+' ? "behind you" : "back");
- case SOUTH:
- return("ahead");
- case EAST:
- return("right");
- case WEST:
- return("left");
- }
-
- case EAST:
- switch(direction) {
- case NORTH:
- return("right");
- case SOUTH:
- return("left");
- case EAST:
- return("ahead");
- case WEST:
- return(option == '+' ? "behind you" : "back");
- }
-
- case WEST:
- switch(direction) {
- case NORTH:
- return("left");
- case SOUTH:
- return("right");
- case EAST:
- return(option == '+' ? "behind you" : "back");
- case WEST:
- return("ahead");
- }
-
- default:
- printf("Error: room %d. More than four directions wanted.", position);
- return("!!");
- }
-}
-
-void
-newway(thisway)
-int thisway;
-{
- switch(direction){
-
- case NORTH:
- switch(thisway){
- case LEFT:
- direction = WEST;
- break;
- case RIGHT:
- direction = EAST;
- break;
- case BACK:
- direction = SOUTH;
- break;
- }
- break;
- case SOUTH:
- switch(thisway){
- case LEFT:
- direction = EAST;
- break;
- case RIGHT:
- direction = WEST;
- break;
- case BACK:
- direction = NORTH;
- break;
- }
- break;
- case EAST:
- switch(thisway){
- case LEFT:
- direction = NORTH;
- break;
- case RIGHT:
- direction = SOUTH;
- break;
- case BACK:
- direction = WEST;
- break;
- }
- break;
- case WEST:
- switch(thisway){
- case LEFT:
- direction = SOUTH;
- break;
- case RIGHT:
- direction = NORTH;
- break;
- case BACK:
- direction = EAST;
- break;
- }
- break;
- }
-}
diff --git a/games/battlestar/save.c b/games/battlestar/save.c
deleted file mode 100644
index f675b8c..0000000
--- a/games/battlestar/save.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h> /* MAXPATHLEN */
-#include <fcntl.h>
-#include <stdlib.h>
-#include <err.h>
-#include "externs.h"
-
-void
-restore()
-{
- char *home;
- char home1[MAXPATHLEN];
- int n;
- int tmp;
- FILE *fp;
-
- if ( (home = getenv("HOME")) != NULL)
- sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home);
- else return;
-
- if ((fp = fopen(home1, "r")) == 0) {
- perror(home1);
- return;
- }
- fread(&WEIGHT, sizeof WEIGHT, 1, fp);
- fread(&CUMBER, sizeof CUMBER, 1, fp);
- fread(&gclock, sizeof gclock, 1, fp);
- fread(&tmp, sizeof tmp, 1, fp);
- location = tmp ? dayfile : nightfile;
- for (n = 1; n <= NUMOFROOMS; n++) {
- fread(location[n].link, sizeof location[n].link, 1, fp);
- fread(location[n].objects, sizeof location[n].objects, 1, fp);
- }
- fread(inven, sizeof inven, 1, fp);
- fread(wear, sizeof wear, 1, fp);
- fread(injuries, sizeof injuries, 1, fp);
- fread(notes, sizeof notes, 1, fp);
- fread(&direction, sizeof direction, 1, fp);
- fread(&position, sizeof position, 1, fp);
- fread(&gtime, sizeof gtime, 1, fp);
- fread(&fuel, sizeof fuel, 1, fp);
- fread(&torps, sizeof torps, 1, fp);
- fread(&carrying, sizeof carrying, 1, fp);
- fread(&encumber, sizeof encumber, 1, fp);
- fread(&rythmn, sizeof rythmn, 1, fp);
- fread(&followfight, sizeof followfight, 1, fp);
- fread(&ate, sizeof ate, 1, fp);
- fread(&snooze, sizeof snooze, 1, fp);
- fread(&meetgirl, sizeof meetgirl, 1, fp);
- fread(&followgod, sizeof followgod, 1, fp);
- fread(&godready, sizeof godready, 1, fp);
- fread(&bs_win, sizeof bs_win, 1, fp);
- fread(&wintime, sizeof wintime, 1, fp);
- fread(&matchlight, sizeof matchlight, 1, fp);
- fread(&matchcount, sizeof matchcount, 1, fp);
- fread(&loved, sizeof loved, 1, fp);
- fread(&pleasure, sizeof pleasure, 1, fp);
- fread(&power, sizeof power, 1, fp);
- /* We must check the last read, to catch truncated save files. */
- if (fread(&ego, sizeof ego, 1, fp) < 1)
- errx(1, "save file %s too short", home1);
- fclose(fp);
-}
-
-void
-save()
-{
- struct stat sbuf;
- char *home;
- char home1[MAXPATHLEN];
- int n;
- int tmp, fd;
- FILE *fp;
-
- home = getenv("HOME");
- if (home == 0)
- return;
- sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home);
-
- /* Try to open the file safely. */
- if (stat(home1, &sbuf) < 0) {
- fd = open(home1, O_WRONLY|O_CREAT|O_EXCL, 0600);
- if (fd < 0) {
- fprintf(stderr, "Can't create %s\n", home1);
- return;
- }
- } else {
- if ((sbuf.st_mode & S_IFLNK) == S_IFLNK) {
- fprintf(stderr, "No symlinks!\n");
- return;
- }
-
- fd = open(home1, O_WRONLY|O_EXCL);
- if (fd < 0) {
- fprintf(stderr, "Can't open %s for writing\n", home1);
- return;
- }
- }
-
- if ((fp = fdopen(fd, "w")) == 0) {
- perror(home1);
- return;
- }
-
- printf("Saved in %s.\n", home1);
- fwrite(&WEIGHT, sizeof WEIGHT, 1, fp);
- fwrite(&CUMBER, sizeof CUMBER, 1, fp);
- fwrite(&gclock, sizeof gclock, 1, fp);
- tmp = location == dayfile;
- fwrite(&tmp, sizeof tmp, 1, fp);
- for (n = 1; n <= NUMOFROOMS; n++) {
- fwrite(location[n].link, sizeof location[n].link, 1, fp);
- fwrite(location[n].objects, sizeof location[n].objects, 1, fp);
- }
- fwrite(inven, sizeof inven, 1, fp);
- fwrite(wear, sizeof wear, 1, fp);
- fwrite(injuries, sizeof injuries, 1, fp);
- fwrite(notes, sizeof notes, 1, fp);
- fwrite(&direction, sizeof direction, 1, fp);
- fwrite(&position, sizeof position, 1, fp);
- fwrite(&gtime, sizeof gtime, 1, fp);
- fwrite(&fuel, sizeof fuel, 1, fp);
- fwrite(&torps, sizeof torps, 1, fp);
- fwrite(&carrying, sizeof carrying, 1, fp);
- fwrite(&encumber, sizeof encumber, 1, fp);
- fwrite(&rythmn, sizeof rythmn, 1, fp);
- fwrite(&followfight, sizeof followfight, 1, fp);
- fwrite(&ate, sizeof ate, 1, fp);
- fwrite(&snooze, sizeof snooze, 1, fp);
- fwrite(&meetgirl, sizeof meetgirl, 1, fp);
- fwrite(&followgod, sizeof followgod, 1, fp);
- fwrite(&godready, sizeof godready, 1, fp);
- fwrite(&bs_win, sizeof bs_win, 1, fp);
- fwrite(&wintime, sizeof wintime, 1, fp);
- fwrite(&matchlight, sizeof matchlight, 1, fp);
- fwrite(&matchcount, sizeof matchcount, 1, fp);
- fwrite(&loved, sizeof loved, 1, fp);
- fwrite(&pleasure, sizeof pleasure, 1, fp);
- fwrite(&power, sizeof power, 1, fp);
- fwrite(&ego, sizeof ego, 1, fp);
-}
diff --git a/games/battlestar/words.c b/games/battlestar/words.c
deleted file mode 100644
index 440936a..0000000
--- a/games/battlestar/words.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)words.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-struct wlist wlist[] = {
- { "knife", KNIFE, OBJECT },
- { "sword", SWORD, NOUNS },
- { "scabbard", SWORD, OBJECT },
- { "fine", SWORD, OBJECT },
- { "two-handed", TWO_HANDED, OBJECT },
- { "cleaver", CLEAVER, OBJECT },
- { "broadsword", BROAD, OBJECT },
- { "mail", MAIL, OBJECT },
- { "coat", MAIL, OBJECT },
- { "helmet", HELM, OBJECT },
- { "shield", SHIELD, OBJECT },
- { "maid", MAID, OBJECT },
- { "maid's", MAID, OBJECT },
- { "body", BODY, NOUNS },
- { "viper", VIPER, OBJECT },
- { "lamp", LAMPON, OBJECT },
- { "lantern", LAMPON, OBJECT },
- { "shoes", SHOES, OBJECT },
- { "pajamas", PAJAMAS, OBJECT },
- { "robe", ROBE, OBJECT },
- { "amulet", AMULET, NOUNS },
- { "medallion", MEDALION, NOUNS },
- { "talisman", TALISMAN, NOUNS },
- { "woodsman", DEADWOOD, OBJECT },
- { "woodsman's", DEADWOOD, OBJECT },
- { "mallet", MALLET, OBJECT },
- { "laser", LASER, OBJECT },
- { "pistol", LASER, OBJECT },
- { "blaster", LASER, OBJECT },
- { "gun", LASER, OBJECT },
- { "goddess", NORMGOD, NOUNS },
- { "grenade", GRENADE, OBJECT },
- { "chain", CHAIN, OBJECT },
- { "rope", ROPE, OBJECT },
- { "levis", LEVIS, OBJECT },
- { "pants", LEVIS, OBJECT },
- { "mace", MACE, OBJECT },
- { "shovel", SHOVEL, OBJECT },
- { "halberd", HALBERD, OBJECT },
- { "compass", COMPASS, OBJECT },
- { "elf", ELF, OBJECT },
- { "coins", COINS, OBJECT },
- { "matches", MATCHES, OBJECT },
- { "match", MATCHES, OBJECT },
- { "book", MATCHES, OBJECT },
- { "man", MAN, NOUNS },
- { "papayas", PAPAYAS, OBJECT },
- { "pineapple", PINEAPPLE, OBJECT },
- { "kiwi", KIWI, OBJECT },
- { "coconuts", COCONUTS, OBJECT },
- { "mango", MANGO, OBJECT },
- { "ring", RING, OBJECT },
- { "potion", POTION, OBJECT },
- { "bracelet", BRACELET, OBJECT },
- { "timer", TIMER, NOUNS },
- { "bomb", BOMB, OBJECT },
- { "warhead", BOMB, OBJECT },
- { "girl", NATIVE, NOUNS },
- { "native", NATIVE, NOUNS },
- { "horse", HORSE, OBJECT },
- { "stallion", HORSE, OBJECT },
- { "car", CAR, OBJECT },
- { "volare", CAR, OBJECT },
- { "pot", POT, OBJECT },
- { "jewels", POT, OBJECT },
- { "bar", BAR, OBJECT },
- { "diamond", BLOCK, OBJECT },
- { "block", BLOCK, OBJECT },
- { "up", UP, VERB },
- { "u", UP, VERB },
- { "down", DOWN, VERB },
- { "d", DOWN, VERB },
- { "ahead", AHEAD, VERB },
- { "a", AHEAD, VERB },
- { "back", BACK, VERB },
- { "b", BACK, VERB },
- { "right", RIGHT, VERB },
- { "r", RIGHT, VERB },
- { "left", LEFT, VERB },
- { "l", LEFT, VERB },
- { "take", TAKE, VERB },
- { "get", TAKE, VERB },
- { "use", USE, VERB },
- { "look", LOOK, VERB },
- { "lo", LOOK, VERB },
- { "quit", QUIT, VERB },
- { "q", QUIT, VERB },
- { "su", SU, VERB },
- { "drop", DROP, VERB },
- { "draw", DRAW, VERB },
- { "pull", DRAW, VERB },
- { "carry", DRAW, VERB },
- { "wear", WEARIT, VERB },
- { "sheathe", WEARIT, VERB },
- { "put", PUT, VERB },
- { "buckle", PUT, VERB },
- { "strap", PUT, VERB },
- { "tie", PUT, VERB },
- { "inven", INVEN, VERB },
- { "i", INVEN, VERB },
- { "everything", EVERYTHING, OBJECT },
- { "all", EVERYTHING, OBJECT },
- { "and", AND, CONJ },
- { "kill", KILL, VERB },
- { "fight", KILL, VERB },
- { "ravage", RAVAGE, VERB },
- { "rape", RAVAGE, VERB },
- { "undress", UNDRESS, VERB },
- { "throw", THROW, VERB },
- { "launch", LAUNCH, VERB },
- { "land", LANDIT, VERB },
- { "light", LIGHT, VERB },
- { "strike", LIGHT, VERB },
- { "follow", FOLLOW, VERB },
- { "chase", FOLLOW, VERB },
- { "kiss", KISS, VERB },
- { "love", LOVE, VERB },
- { "fuck", LOVE, VERB },
- { "give", GIVE, VERB },
- { "smite", SMITE, VERB },
- { "attack", SMITE, VERB },
- { "swing", SMITE, VERB },
- { "stab", SMITE, VERB },
- { "slice", SMITE, VERB },
- { "cut", SMITE, VERB },
- { "hack", SMITE, VERB },
- { "shoot", SHOOT, VERB },
- { "blast", SHOOT, VERB },
- { "on", ON, PREPS },
- { "off", OFF, PREPS },
- { "time", TIME, VERB },
- { "sleep", SLEEP, VERB },
- { "dig", DIG, VERB },
- { "eat", EAT, VERB },
- { "swim", SWIM, VERB },
- { "drink", DRINK, VERB },
- { "door", DOOR, NOUNS },
- { "save", SAVE, VERB },
- { "ride", RIDE, VERB },
- { "mount", RIDE, VERB },
- { "drive", DRIVE, VERB },
- { "start", DRIVE, VERB },
- { "score", SCORE, VERB },
- { "points", SCORE, VERB },
- { "bury", BURY, VERB },
- { "jump", JUMP, VERB },
- { "kick", KICK, VERB },
- { "kerosene", 0, ADJS },
- { "plumed", 0, ADJS },
- { "ancient", 0, ADJS },
- { "golden", 0, ADJS },
- { "gold", 0, ADJS },
- { "ostrich", 0, ADJS },
- { "rusty", 0, ADJS },
- { "old", 0, ADJS },
- { "dented", 0, ADJS },
- { "blue", 0, ADJS },
- { "purple", 0, ADJS },
- { "kingly", 0, ADJS },
- { "the", 0, ADJS },
- { "climb", 0, ADJS },
- { "move", 0, ADJS },
- { "make", 0, ADJS },
- { "to", 0, ADJS },
- { 0, 0, 0 }
-};
diff --git a/games/bs/Makefile b/games/bs/Makefile
deleted file mode 100644
index 5a6ca34..0000000
--- a/games/bs/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $FreeBSD$
-
-PROG= bs
-MAN= bs.6
-DPADD= ${LIBNCURSES}
-LDADD= -lncurses
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/bs/bs.6 b/games/bs/bs.6
deleted file mode 100644
index da52e28..0000000
--- a/games/bs/bs.6
+++ /dev/null
@@ -1,43 +0,0 @@
-.\" $FreeBSD$
-.TH BATTLESHIPS 6 "Aug 23, 1989"
-.SH NAME
-bs \- battleships game
-.SH SYNOPSIS
-bs [ -b | -s ] [ -c ]
-.SH DESCRIPTION
-This program allows you to play the familiar Battleships game against the
-computer on a 10x10 board. The interface is visual and largely
-self-explanatory; you place your ships and pick your shots by moving the
-cursor around the `sea' with the rogue/hack motion keys hjklyubn.
-.PP
-Note that when selecting a ship to place, you must type the capital letter
-(these are, after all, capital ships). During ship placement, the `r' command
-may be used to ignore the current position and randomly place your currently
-selected ship. The `R' command will place all remaining ships randomly. The ^L
-command (form feed, ASCII 12) will force a screen redraw).
-.PP
-The command-line arguments control game modes.
-
-.nf
- -b selects a `blitz' variant
- -s selects a `salvo' variant
- -c permits ships to be placed adjacently
-.fi
-
-The `blitz' variant allows a side to shoot for as long as it continues to
-score hits.
-.PP
-The `salvo' game allows a player one shot per turn for each of his/her ships
-still afloat. This puts a premium scoring hits early and knocking out some
-ships and also makes much harder the situation where you face a superior force
-with only your PT-boat.
-.PP
-Normally, ships must be separated by at least one square of open water. The
--c option disables this check and allows them to close-pack.
-.PP
-The algorithm the computer uses once it has found a ship to sink is provably
-optimal. The dispersion criterion for the random-fire algorithm may not be.
-.SH AUTHORS
-Originally written by one Bruce Holloway in 1986. Salvo mode added by Chuck A.
-DeGaul (cbosgd!cad). Visual user interface, `closepack' option, code rewrite
-and manual page by Eric S. Raymond <esr@snark.thyrsus.com> August 1989.
diff --git a/games/bs/bs.c b/games/bs/bs.c
deleted file mode 100644
index 4a16379..0000000
--- a/games/bs/bs.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/*
- * bs.c - original author: Bruce Holloway
- * salvo option by: Chuck A DeGaul
- * with improved user interface, autoconfiguration and code cleanup
- * by Eric S. Raymond <esr@snark.thyrsus.com>
- * v1.2 with color support and minor portability fixes, November 1990
- * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
- *
- * $FreeBSD$
- */
-
-#include <ncurses.h>
-#include <signal.h>
-#include <ctype.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-#include <string.h>
-
-#ifndef A_UNDERLINE /* BSD curses */
-#define beep() write(1,"\007",1);
-#define cbreak crmode
-#define saveterm savetty
-#define resetterm resetty
-#define nocbreak nocrmode
-#define strchr index
-#endif /* !A_UNDERLINE */
-
-
-/*
- * Constants for tuning the random-fire algorithm. It prefers moves that
- * diagonal-stripe the board with a stripe separation of srchstep. If
- * no such preferred moves are found, srchstep is decremented.
- */
-#define BEGINSTEP 3 /* initial value of srchstep */
-
-/* miscellaneous constants */
-#define SHIPTYPES 5
-#define OTHER (1-turn)
-#define PLAYER 0
-#define COMPUTER 1
-#define MARK_HIT 'H'
-#define MARK_MISS 'o'
-#define CTRLC '\003' /* used as terminate command */
-#define FF '\014' /* used as redraw command */
-
-/* coordinate handling */
-#define BWIDTH 10
-#define BDEPTH 10
-
-/* display symbols */
-#define SHOWHIT '*'
-#define SHOWSPLASH ' '
-#define IS_SHIP(c) isupper(c)
-
-/* how to position us on player board */
-#define PYBASE 3
-#define PXBASE 3
-#define PY(y) (PYBASE + (y))
-#define PX(x) (PXBASE + (x)*3)
-#define pgoto(y, x) (void)move(PY(y), PX(x))
-
-/* how to position us on cpu board */
-#define CYBASE 3
-#define CXBASE 48
-#define CY(y) (CYBASE + (y))
-#define CX(x) (CXBASE + (x)*3)
-#define cgoto(y, x) (void)move(CY(y), CX(x))
-
-#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH)
-
-/* other board locations */
-#define COLWIDTH 80
-#define PROMPTLINE 21 /* prompt line */
-#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */
-#define SXBASE 63
-#define MYBASE SYBASE - 1 /* diagram caption */
-#define MXBASE 64
-#define HYBASE SYBASE - 1 /* help area */
-#define HXBASE 0
-
-/* this will need to be changed if BWIDTH changes */
-static char numbers[] = " 0 1 2 3 4 5 6 7 8 9";
-
-static char carrier[] = "Aircraft Carrier";
-static char battle[] = "Battleship";
-static char sub[] = "Submarine";
-static char destroy[] = "Destroyer";
-static char ptboat[] = "PT Boat";
-
-static char name[40];
-static char dftname[] = "stranger";
-
-/* direction constants */
-enum directions { E, SE, S, SW, W, NW, N, NE };
-static int xincr[8] = {1, 1, 0, -1, -1, -1, 0, 1};
-static int yincr[8] = {0, 1, 1, 1, 0, -1, -1, -1};
-
-/* current ship position and direction */
-static int curx = (BWIDTH / 2);
-static int cury = (BDEPTH / 2);
-
-typedef struct
-{
- char *name; /* name of the ship type */
- unsigned int hits; /* how many times has this ship been hit? */
- char symbol; /* symbol for game purposes */
- char length; /* length of ship */
- char x, y; /* coordinates of ship start point */
- enum directions dir;/* direction of `bow' */
- bool placed; /* has it been placed on the board? */
-}
-ship_t;
-
-ship_t plyship[SHIPTYPES] =
-{
- { carrier, 0, 'A', 5},
- { battle, 0, 'B', 4},
- { destroy, 0, 'D', 3},
- { sub, 0, 'S', 3},
- { ptboat, 0, 'P', 2},
-};
-
-ship_t cpuship[SHIPTYPES] =
-{
- { carrier, 0, 'A', 5},
- { battle, 0, 'B', 4},
- { destroy, 0, 'D', 3},
- { sub, 0, 'S', 3},
- { ptboat, 0, 'P', 2},
-};
-
-/* "Hits" board, and main board. */
-static char hits[2][BWIDTH][BDEPTH], board[2][BWIDTH][BDEPTH];
-
-static int turn; /* 0=player, 1=computer */
-static int plywon=0, cpuwon=0; /* How many games has each won? */
-
-static int salvo, blitz, closepack;
-
-#define PR (void)addstr
-
-static bool checkplace(int, ship_t *, int);
-static int getcoord(int);
-int playagain(void);
-
-static void uninitgame(sig)
-/* end the game, either normally or due to signal */
-int sig;
-{
- clear();
- (void)refresh();
- (void)resetterm();
- (void)echo();
- (void)endwin();
- exit(0);
-}
-
-static void announceopts()
-/* announce which game options are enabled */
-{
- if (salvo || blitz || closepack)
- {
- (void) printw("Playing optional game (");
- if (salvo)
- (void) printw("salvo, ");
- else
- (void) printw("nosalvo, ");
- if (blitz)
- (void) printw("blitz ");
- else
- (void) printw("noblitz, ");
- if (closepack)
- (void) printw("closepack)");
- else
- (void) printw("noclosepack)");
- }
- else
- (void) printw(
- "Playing standard game (noblitz, nosalvo, noclosepack)");
-}
-
-static void intro()
-{
- char *tmpname;
-
- srandomdev();
-
- tmpname = getlogin();
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGIOT,uninitgame); /* for assert(3) */
- if(signal(SIGQUIT,SIG_IGN) != SIG_IGN)
- (void)signal(SIGQUIT,uninitgame);
-
- if(tmpname != '\0')
- {
- (void)strcpy(name,tmpname);
- name[0] = toupper(name[0]);
- }
- else
- (void)strcpy(name,dftname);
-
- (void)initscr();
-#ifdef KEY_MIN
- keypad(stdscr, TRUE);
-#endif /* KEY_MIN */
- (void)saveterm();
- (void)nonl();
- (void)cbreak();
- (void)noecho();
-
-#ifdef PENGUIN
- (void)clear();
- (void)mvaddstr(4,29,"Welcome to Battleship!");
- (void)move(8,0);
- PR(" \\\n");
- PR(" \\ \\ \\\n");
- PR(" \\ \\ \\ \\ \\_____________\n");
- PR(" \\ \\ \\_____________ \\ \\/ |\n");
- PR(" \\ \\/ \\ \\/ |\n");
- PR(" \\/ \\_____/ |__\n");
- PR(" ________________/ |\n");
- PR(" \\ S.S. Penguin |\n");
- PR(" \\ /\n");
- PR(" \\___________________________________________________/\n");
-
- (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh();
- (void) getch();
-#endif /* PENGUIN */
-
-#ifdef A_COLOR
- start_color();
-
- init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
- init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
- init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
- init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
- init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
- init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
- init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
- init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
-#endif /* A_COLOR */
-
-}
-
-/* VARARGS1 */
-static void prompt(n, f, s)
-/* print a message at the prompt line */
-int n;
-char *f, *s;
-{
- (void) move(PROMPTLINE + n, 0);
- (void) clrtoeol();
- (void) printw(f, s);
- (void) refresh();
-}
-
-static void error(s)
-char *s;
-{
- (void) move(PROMPTLINE + 2, 0);
- (void) clrtoeol();
- if (s)
- {
- (void) addstr(s);
- (void) beep();
- }
-}
-
-static void placeship(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
- int l;
-
- for(l = 0; l < ss->length; ++l)
- {
- int newx = ss->x + l * xincr[ss->dir];
- int newy = ss->y + l * yincr[ss->dir];
-
- board[b][newx][newy] = ss->symbol;
- if (vis)
- {
- pgoto(newy, newx);
- (void) addch((chtype)ss->symbol);
- }
- }
- ss->hits = 0;
-}
-
-static int rnd(n)
-int n;
-{
- return(random() % n);
-}
-
-static void randomplace(b, ss)
-/* generate a valid random ship placement into px,py */
-int b;
-ship_t *ss;
-{
- int bwidth = BWIDTH - ss->length;
- int bdepth = BDEPTH - ss->length;
-
- do {
- ss->y = rnd(bdepth);
- ss->x = rnd(bwidth);
- ss->dir = rnd(2) ? E : S;
- } while
- (!checkplace(b, ss, FALSE));
-}
-
-static void initgame()
-{
- int i, j, unplaced;
- ship_t *ss;
-
- (void) clear();
- (void) mvaddstr(0,35,"BATTLESHIPS");
- (void) move(PROMPTLINE + 2, 0);
- announceopts();
-
- bzero(board, sizeof(char) * BWIDTH * BDEPTH * 2);
- bzero(hits, sizeof(char) * BWIDTH * BDEPTH * 2);
- for (i = 0; i < SHIPTYPES; i++)
- {
- ss = cpuship + i;
- ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0;
- ss = plyship + i;
- ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0;
- }
-
- /* draw empty boards */
- (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board");
- (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers);
- for(i=0; i < BDEPTH; ++i)
- {
- (void) mvaddch(PYBASE + i, PXBASE - 3, i + 'A');
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_BLUE));
-#endif /* A_COLOR */
- (void) addch(' ');
- for (j = 0; j < BWIDTH; j++)
- (void) addstr(" . ");
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- (void) addch(' ');
- (void) addch(i + 'A');
- }
- (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers);
- (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board");
- (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers);
- for(i=0; i < BDEPTH; ++i)
- {
- (void) mvaddch(CYBASE + i, CXBASE - 3, i + 'A');
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_BLUE));
-#endif /* A_COLOR */
- (void) addch(' ');
- for (j = 0; j < BWIDTH; j++)
- (void) addstr(" . ");
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- (void) addch(' ');
- (void) addch(i + 'A');
- }
-
- (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers);
-
- (void) mvprintw(HYBASE, HXBASE,
- "To position your ships: move the cursor to a spot, then");
- (void) mvprintw(HYBASE+1,HXBASE,
- "type the first letter of a ship type to select it, then");
- (void) mvprintw(HYBASE+2,HXBASE,
- "type a direction ([hjkl] or [4862]), indicating how the");
- (void) mvprintw(HYBASE+3,HXBASE,
- "ship should be pointed. You may also type a ship letter");
- (void) mvprintw(HYBASE+4,HXBASE,
- "followed by `r' to position it randomly, or type `R' to");
- (void) mvprintw(HYBASE+5,HXBASE,
- "place all remaining ships randomly.");
-
- (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:");
- (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
- (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ ");
- (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6");
- (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ ");
- (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3");
-
- /* have the computer place ships */
- for(ss = cpuship; ss < cpuship + SHIPTYPES; ss++)
- {
- randomplace(COMPUTER, ss);
- placeship(COMPUTER, ss, FALSE);
- }
-
- ss = (ship_t *)NULL;
- do {
- char c, docked[SHIPTYPES + 2], *cp = docked;
-
- /* figure which ships still wait to be placed */
- *cp++ = 'R';
- for (i = 0; i < SHIPTYPES; i++)
- if (!plyship[i].placed)
- *cp++ = plyship[i].symbol;
- *cp = '\0';
-
- /* get a command letter */
- prompt(1, "Type one of [%s] to pick a ship.", docked+1);
- do {
- c = getcoord(PLAYER);
- } while
- (!strchr(docked, c));
-
- if (c == 'R')
- (void) ungetch('R');
- else
- {
- /* map that into the corresponding symbol */
- for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
- if (ss->symbol == c)
- break;
-
- prompt(1, "Type one of [hjklrR] to place your %s.", ss->name);
- pgoto(cury, curx);
- }
-
- do {
- c = getch();
- } while
- (!strchr("hjklrR", c) || c == FF);
-
- if (c == FF)
- {
- (void)clearok(stdscr, TRUE);
- (void)refresh();
- }
- else if (c == 'r')
- {
- prompt(1, "Random-placing your %s", ss->name);
- randomplace(PLAYER, ss);
- placeship(PLAYER, ss, TRUE);
- error((char *)NULL);
- ss->placed = TRUE;
- }
- else if (c == 'R')
- {
- prompt(1, "Placing the rest of your fleet at random...");
- for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
- if (!ss->placed)
- {
- randomplace(PLAYER, ss);
- placeship(PLAYER, ss, TRUE);
- ss->placed = TRUE;
- }
- error((char *)NULL);
- }
- else if (strchr("hjkl8462", c))
- {
- ss->x = curx;
- ss->y = cury;
-
- switch(c)
- {
- case 'k': case '8': ss->dir = N; break;
- case 'j': case '2': ss->dir = S; break;
- case 'h': case '4': ss->dir = W; break;
- case 'l': case '6': ss->dir = E; break;
- }
-
- if (checkplace(PLAYER, ss, TRUE))
- {
- placeship(PLAYER, ss, TRUE);
- error((char *)NULL);
- ss->placed = TRUE;
- }
- }
-
- for (unplaced = i = 0; i < SHIPTYPES; i++)
- unplaced += !plyship[i].placed;
- } while
- (unplaced);
-
- turn = rnd(2);
-
- (void) mvprintw(HYBASE, HXBASE,
- "To fire, move the cursor to your chosen aiming point ");
- (void) mvprintw(HYBASE+1, HXBASE,
- "and strike any key other than a motion key. ");
- (void) mvprintw(HYBASE+2, HXBASE,
- " ");
- (void) mvprintw(HYBASE+3, HXBASE,
- " ");
- (void) mvprintw(HYBASE+4, HXBASE,
- " ");
- (void) mvprintw(HYBASE+5, HXBASE,
- " ");
-
- (void) prompt(0, "Press any key to start...");
- (void) getch();
-}
-
-static int getcoord(atcpu)
-int atcpu;
-{
- int ny, nx, c;
-
- if (atcpu)
- cgoto(cury,curx);
- else
- pgoto(cury, curx);
- (void)refresh();
- for (;;)
- {
- if (atcpu)
- {
- (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury);
- cgoto(cury, curx);
- }
- else
- {
- (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury);
- pgoto(cury, curx);
- }
-
- switch(c = getch())
- {
- case 'k': case '8':
-#ifdef KEY_MIN
- case KEY_UP:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx;
- break;
- case 'j': case '2':
-#ifdef KEY_MIN
- case KEY_DOWN:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx;
- break;
- case 'h': case '4':
-#ifdef KEY_MIN
- case KEY_LEFT:
-#endif /* KEY_MIN */
- ny = cury; nx = curx+BWIDTH-1;
- break;
- case 'l': case '6':
-#ifdef KEY_MIN
- case KEY_RIGHT:
-#endif /* KEY_MIN */
- ny = cury; nx = curx+1;
- break;
- case 'y': case '7':
-#ifdef KEY_MIN
- case KEY_A1:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx+BWIDTH-1;
- break;
- case 'b': case '1':
-#ifdef KEY_MIN
- case KEY_C1:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx+BWIDTH-1;
- break;
- case 'u': case '9':
-#ifdef KEY_MIN
- case KEY_A3:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx+1;
- break;
- case 'n': case '3':
-#ifdef KEY_MIN
- case KEY_C3:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx+1;
- break;
- case FF:
- nx = curx; ny = cury;
- (void)clearok(stdscr, TRUE);
- (void)refresh();
- break;
- default:
- if (atcpu)
- (void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " ");
- else
- (void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " ");
- return(c);
- }
-
- curx = nx % BWIDTH;
- cury = ny % BDEPTH;
- }
-}
-
-static int collidecheck(b, y, x)
-/* is this location on the selected zboard adjacent to a ship? */
-int b;
-int y, x;
-{
- int collide;
-
- /* anything on the square */
- if ((collide = IS_SHIP(board[b][x][y])) != 0)
- return(collide);
-
- /* anything on the neighbors */
- if (!closepack)
- {
- int i;
-
- for (i = 0; i < 8; i++)
- {
- int xend, yend;
-
- yend = y + yincr[i];
- xend = x + xincr[i];
- if (ONBOARD(xend, yend))
- collide += IS_SHIP(board[b][xend][yend]);
- }
- }
- return(collide);
-}
-
-static bool checkplace(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
- int l, xend, yend;
-
- /* first, check for board edges */
- xend = ss->x + ss->length * xincr[ss->dir];
- yend = ss->y + ss->length * yincr[ss->dir];
- if (!ONBOARD(xend, yend))
- {
- if (vis)
- switch(rnd(3))
- {
- case 0:
- error("Ship is hanging from the edge of the world");
- break;
- case 1:
- error("Try fitting it on the board");
- break;
- case 2:
- error("Figure I won't find it if you put it there?");
- break;
- }
- return(0);
- }
-
- for(l = 0; l < ss->length; ++l)
- {
- if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir]))
- {
- if (vis)
- switch(rnd(3))
- {
- case 0:
- error("There's already a ship there");
- break;
- case 1:
- error("Collision alert! Aaaaaagh!");
- break;
- case 2:
- error("Er, Admiral, what about the other ship?");
- break;
- }
- return(FALSE);
- }
- }
- return(TRUE);
-}
-
-static int awinna()
-{
- int i, j;
- ship_t *ss;
-
- for(i=0; i<2; ++i)
- {
- ss = (i) ? cpuship : plyship;
- for(j=0; j < SHIPTYPES; ++j, ++ss)
- if(ss->length > ss->hits)
- break;
- if (j == SHIPTYPES)
- return(OTHER);
- }
- return(-1);
-}
-
-static ship_t *hitship(x, y)
-/* a hit on the targeted ship */
-int x, y;
-{
- ship_t *sb, *ss;
- char sym;
- int oldx, oldy;
-
- getyx(stdscr, oldy, oldx);
- sb = (turn) ? plyship : cpuship;
- if(!(sym = board[OTHER][x][y]))
- return((ship_t *)NULL);
- for(ss = sb; ss < sb + SHIPTYPES; ++ss)
- if(ss->symbol == sym)
- {
- if (++ss->hits < ss->length) /* still afloat? */
- return((ship_t *)NULL);
- else /* sunk! */
- {
- int i, j;
-
- if (!closepack)
- for (j = -1; j <= 1; j++)
- {
- int bx = ss->x + j * xincr[(ss->dir + 2) % 8];
- int by = ss->y + j * yincr[(ss->dir + 2) % 8];
-
- for (i = -1; i <= ss->length; ++i)
- {
- int x, y;
-
- x = bx + i * xincr[ss->dir];
- y = by + i * yincr[ss->dir];
- if (ONBOARD(x, y))
- {
- hits[turn][x][y] = MARK_MISS;
- if (turn % 2 == PLAYER)
- {
- cgoto(y, x);
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_GREEN));
-#endif /* A_COLOR */
- (void)addch(MARK_MISS);
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- }
- }
- }
- }
-
- for (i = 0; i < ss->length; ++i)
- {
- int x = ss->x + i * xincr[ss->dir];
- int y = ss->y + i * yincr[ss->dir];
-
- hits[turn][x][y] = ss->symbol;
- if (turn % 2 == PLAYER)
- {
- cgoto(y, x);
- (void) addch(ss->symbol);
- }
- }
-
- (void) move(oldy, oldx);
- return(ss);
- }
- }
- (void) move(oldy, oldx);
- return((ship_t *)NULL);
-}
-
-static int plyturn()
-{
- ship_t *ss;
- bool hit;
- char *m;
-
- m = NULL;
- prompt(1, "Where do you want to shoot? ");
- for (;;)
- {
- (void) getcoord(COMPUTER);
- if (hits[PLAYER][curx][cury])
- {
- prompt(1, "You shelled this spot already! Try again.");
- beep();
- }
- else
- break;
- }
- hit = IS_SHIP(board[COMPUTER][curx][cury]);
- hits[PLAYER][curx][cury] = hit ? MARK_HIT : MARK_MISS;
- cgoto(cury, curx);
-#ifdef A_COLOR
- if (has_colors()) {
- if (hit)
- attron(COLOR_PAIR(COLOR_RED));
- else
- attron(COLOR_PAIR(COLOR_GREEN));
- }
-#endif /* A_COLOR */
- (void) addch((chtype)hits[PLAYER][curx][cury]);
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
-
- prompt(1, "You %s.", hit ? "scored a hit" : "missed");
- if(hit && (ss = hitship(curx, cury)))
- {
- switch(rnd(5))
- {
- case 0:
- m = " You sank my %s!";
- break;
- case 1:
- m = " I have this sinking feeling about my %s....";
- break;
- case 2:
- m = " My %s has gone to Davy Jones's locker!";
- break;
- case 3:
- m = " Glub, glub -- my %s is headed for the bottom!";
- break;
- case 4:
- m = " You'll pick up survivors from my %s, I hope...!";
- break;
- }
- (void)printw(m, ss->name);
- (void)beep();
- return(awinna() == -1);
- }
- return(hit);
-}
-
-static int sgetc(s)
-char *s;
-{
- char *s1;
- int ch;
-
- (void)refresh();
- for(;;)
- {
- ch = getch();
- if (islower(ch))
- ch = toupper(ch);
- if (ch == CTRLC)
- uninitgame();
- for (s1=s; *s1 && ch != *s1; ++s1)
- continue;
- if (*s1)
- {
- (void) addch((chtype)ch);
- (void)refresh();
- return(ch);
- }
- }
-}
-
-
-static void randomfire(px, py)
-/* random-fire routine -- implements simple diagonal-striping strategy */
-int *px, *py;
-{
- static int turncount = 0;
- static int srchstep = BEGINSTEP;
- static int huntoffs; /* Offset on search strategy */
- int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs;
- int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref;
- int x, y, i;
-
- if (turncount++ == 0)
- huntoffs = rnd(srchstep);
-
- /* first, list all possible moves */
- nposs = npref = 0;
- for (x = 0; x < BWIDTH; x++)
- for (y = 0; y < BDEPTH; y++)
- if (!hits[COMPUTER][x][y])
- {
- xpossible[nposs] = x;
- ypossible[nposs] = y;
- nposs++;
- if (((x+huntoffs) % srchstep) != (y % srchstep))
- {
- xpreferred[npref] = x;
- ypreferred[npref] = y;
- npref++;
- }
- }
-
- if (npref)
- {
- i = rnd(npref);
-
- *px = xpreferred[i];
- *py = ypreferred[i];
- }
- else if (nposs)
- {
- i = rnd(nposs);
-
- *px = xpossible[i];
- *py = ypossible[i];
-
- if (srchstep > 1)
- --srchstep;
- }
- else
- {
- error("No moves possible?? Help!");
- exit(1);
- /*NOTREACHED*/
- }
-}
-
-#define S_MISS 0
-#define S_HIT 1
-#define S_SUNK -1
-
-static bool cpufire(x, y)
-/* fire away at given location */
-int x, y;
-{
- bool hit, sunk;
- ship_t *ss;
-
- ss = NULL;
- hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
- (void) mvprintw(PROMPTLINE, 0,
- "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss");
- ss = hitship(x, y);
- sunk = hit && ss;
- if (sunk)
- (void) printw(" I've sunk your %s", ss->name);
- (void)clrtoeol();
-
- pgoto(y, x);
-#ifdef A_COLOR
- if (has_colors()) {
- if (hit)
- attron(COLOR_PAIR(COLOR_RED));
- else
- attron(COLOR_PAIR(COLOR_GREEN));
- }
-#endif /* A_COLOR */
- (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH));
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
-
- return(hit ? (sunk ? S_SUNK : S_HIT) : S_MISS);
-}
-
-/*
- * This code implements a fairly irregular FSM, so please forgive the rampant
- * unstructuredness below. The five labels are states which need to be held
- * between computer turns.
- */
-static bool cputurn()
-{
-#define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y])
-#define RANDOM_FIRE 0
-#define RANDOM_HIT 1
-#define HUNT_DIRECT 2
-#define FIRST_PASS 3
-#define REVERSE_JUMP 4
-#define SECOND_PASS 5
- static int next = RANDOM_FIRE;
- static bool used[4];
- static ship_t ts;
- int navail, x, y, d, n, hit = S_MISS;
-
- switch(next)
- {
- case RANDOM_FIRE: /* last shot was random and missed */
- refire:
- randomfire(&x, &y);
- if (!(hit = cpufire(x, y)))
- next = RANDOM_FIRE;
- else
- {
- ts.x = x; ts.y = y;
- ts.hits = 1;
- next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT;
- }
- break;
-
- case RANDOM_HIT: /* last shot was random and hit */
- used[E/2] = used[S/2] = used[W/2] = used[N/2] = FALSE;
- /* FALLTHROUGH */
-
- case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */
- for (d = navail = 0; d < 4; d++)
- {
- x = ts.x + xincr[d*2]; y = ts.y + yincr[d*2];
- if (!used[d] && POSSIBLE(x, y))
- navail++;
- else
- used[d] = TRUE;
- }
- if (navail == 0) /* no valid places for shots adjacent... */
- goto refire; /* ...so we must random-fire */
- else
- {
- for (d = 0, n = rnd(navail) + 1; n; n--)
- while (used[d])
- d++;
-
- assert(d <= 4);
-
- used[d] = FALSE;
- x = ts.x + xincr[d*2];
- y = ts.y + yincr[d*2];
-
- assert(POSSIBLE(x, y));
-
- if (!(hit = cpufire(x, y)))
- next = HUNT_DIRECT;
- else
- {
- ts.x = x; ts.y = y; ts.dir = d*2; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
- }
- }
- break;
-
- case FIRST_PASS: /* we have a start and a direction now */
- x = ts.x + xincr[ts.dir];
- y = ts.y + yincr[ts.dir];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
- }
- else
- next = REVERSE_JUMP;
- break;
-
- case REVERSE_JUMP: /* nail down the ship's other end */
- d = ts.dir + 4;
- x = ts.x + ts.hits * xincr[d];
- y = ts.y + ts.hits * yincr[d];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.dir = d; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS;
- }
- else
- next = RANDOM_FIRE;
- break;
-
- case SECOND_PASS: /* kill squares not caught on first pass */
- x = ts.x + xincr[ts.dir];
- y = ts.y + yincr[ts.dir];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE: SECOND_PASS;
- break;
- }
- else
- next = RANDOM_FIRE;
- break;
- }
-
- /* check for continuation and/or winner */
- if (salvo)
- {
- (void)refresh();
- (void)sleep(1);
- }
- if (awinna() != -1)
- return(FALSE);
-
-#ifdef DEBUG
- (void) mvprintw(PROMPTLINE + 2, 0,
- "New state %d, x=%d, y=%d, d=%d",
- next, x, y, d);
-#endif /* DEBUG */
- return(hit);
-}
-
-int
-playagain()
-{
- int j;
- ship_t *ss;
-
- for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++)
- for(j = 0; j < ss->length; j++)
- {
- cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]);
- (void)addch((chtype)ss->symbol);
- }
-
- if(awinna())
- ++cpuwon;
- else
- ++plywon;
- j = 18 + strlen(name);
- if(plywon >= 10)
- ++j;
- if(cpuwon >= 10)
- ++j;
- (void) mvprintw(1,(COLWIDTH-j)/2,
- "%s: %d Computer: %d",name,plywon,cpuwon);
-
- prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? "
- : "Going to give me a chance for revenge, %s [yn]? ",name);
- return(sgetc("YN") == 'Y');
-}
-
-static void do_options(c,op)
-int c;
-char *op[];
-{
- int i;
-
- if (c > 1)
- {
- for (i=1; i<c; i++)
- {
- switch(op[i][0])
- {
- default:
- case '?':
- (void) fprintf(stderr, "usage: battle [-s | -b] [-c]\n");
- (void) fprintf(stderr, "\tWhere the options are:\n");
- (void) fprintf(stderr, "\t-s : play a salvo game\n");
- (void) fprintf(stderr, "\t-b : play a blitz game\n");
- (void) fprintf(stderr, "\t-c : ships may be adjacent\n");
- exit(1);
- break;
- case '-':
- switch(op[i][1])
- {
- case 'b':
- blitz = 1;
- if (salvo == 1)
- {
- (void) fprintf(stderr,
- "Bad Arg: -b and -s are mutually exclusive\n");
- exit(1);
- }
- break;
- case 's':
- salvo = 1;
- if (blitz == 1)
- {
- (void) fprintf(stderr,
- "Bad Arg: -s and -b are mutually exclusive\n");
- exit(1);
- }
- break;
- case 'c':
- closepack = 1;
- break;
- default:
- (void) fprintf(stderr,
- "Bad arg: type \"%s ?\" for usage message\n", op[0]);
- exit(1);
- }
- }
- }
- }
-}
-
-static int scount(who)
-int who;
-{
- int i, shots;
- ship_t *sp;
-
- if (who)
- sp = cpuship; /* count cpu shots */
- else
- sp = plyship; /* count player shots */
-
- for (i=0, shots = 0; i < SHIPTYPES; i++, sp++)
- {
- if (sp->hits >= sp->length)
- continue; /* dead ship */
- else
- shots++;
- }
- return(shots);
-}
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- /* revoke */
- setgid(getgid());
-
- do_options(argc, argv);
-
- intro();
- do {
- initgame();
- while(awinna() == -1)
- {
- if (!blitz)
- {
- if (!salvo)
- {
- if(turn)
- (void) cputurn();
- else
- (void) plyturn();
- }
- else
- {
- int i;
-
- i = scount(turn);
- while (i--)
- {
- if (turn)
- {
- if (cputurn() && awinna() != -1)
- i = 0;
- }
- else
- {
- if (plyturn() && awinna() != -1)
- i = 0;
- }
- }
- }
- }
- else
- while(turn ? cputurn() : plyturn())
- continue;
- turn = OTHER;
- }
- } while
- (playagain());
- uninitgame();
- /*NOTREACHED*/
- exit(0);
- /*NOTREACHED*/
-}
-
-/* bs.c ends here */
diff --git a/games/canfield/Makefile b/games/canfield/Makefile
deleted file mode 100644
index 98ccdca..0000000
--- a/games/canfield/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-SUBDIR= canfield cfscores
-
-.include <bsd.subdir.mk>
diff --git a/games/canfield/canfield/Makefile b/games/canfield/canfield/Makefile
deleted file mode 100644
index 421bb7c..0000000
--- a/games/canfield/canfield/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= canfield
-MAN= canfield.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-MLINKS= canfield.6 cfscores.6
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/cfscores)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/cfscores
-.endif
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/canfield/canfield/canfield.6 b/games/canfield/canfield/canfield.6
deleted file mode 100644
index 37de31b..0000000
--- a/games/canfield/canfield/canfield.6
+++ /dev/null
@@ -1,118 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)canfield.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH CANFIELD 6 "May 31, 1993"
-.UC 5
-.SH NAME
-canfield, cfscores \- the solitaire card game canfield
-.SH SYNOPSIS
-.B canfield
-.br
-.B cfscores
-.SH DESCRIPTION
-If you have never played solitaire before, it is recommended
-that you consult a solitaire instruction book. In
-Canfield, tableau cards may be built on each other downward
-in alternate colors. An entire pile must be moved as a unit
-in building. Top cards of the piles are available
-to be played on foundations, but never into empty spaces.
-.PP
-Spaces must be filled from the stock. The top card of
-the stock also is available to be played on foundations or
-built on tableau piles. After the stock is exhausted,
-tableau spaces may be filled from the talon and the player may
-keep them open until he wishes to use them.
-.PP
-Cards are dealt from the hand to the talon by threes
-and this repeats until there are no more cards in the hand
-or the player quits. To have cards dealt onto the talon the
-player types 'ht' for his move. Foundation base cards are
-also automatically moved to the foundation when they become
-available.
-.PP
-The command 'c' causes
-.I canfield
-to maintain card counting statistics
-on the bottom of the screen.
-When properly used this can greatly increase one's chances of
-winning.
-.PP
-The rules for betting are somewhat less strict than
-those used in the official version of the game.
-The initial deal costs $13.
-You may quit at this point or inspect the game.
-Inspection costs $13 and allows you to make as many
-moves as possible without moving any cards from your hand
-to the talon.
-(The initial deal places three cards on the talon;
-if all these cards are used,
-three more are made available.)
-Finally, if the game seems interesting,
-you must pay the final installment of $26.
-At this point you are
-credited at the rate of $5 for each card on the foundation;
-as the game progresses you are credited with $5 for each
-card that is moved to the foundation.
-Each run through the hand after the first costs $5.
-The card counting feature
-costs $1 for each unknown card that is identified.
-If the information is toggled on,
-you are only charged for cards
-that became visible since it was last turned on.
-Thus the maximum cost of information is $34.
-Playing time is charged at a rate of $1 per minute.
-.PP
-With no arguments, the program
-.I cfscores
-prints out the current status of your canfield account.
-If a user name is specified,
-it prints out the status of their canfield account.
-If the
-.B \-a
-flag is specified,
-it prints out the canfield accounts for all users that have
-played the game since the database was set up.
-.SH FILES
-/usr/games/canfield the game itself
-.br
-/usr/games/cfscores the database printer
-.br
-/var/games/cfscores the database of scores
-.SH BUGS
-It is impossible to cheat.
-.SH AUTHORS
-Originally written: Steve Levine
-.br
-Further random hacking by: Steve Feldman, Kirk McKusick,
-Mikey Olson, and Eric Allman.
diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c
deleted file mode 100644
index 4b27028..0000000
--- a/games/canfield/canfield/canfield.c
+++ /dev/null
@@ -1,1810 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * The canfield program
- *
- * Authors:
- * Originally written: Steve Levine
- * Converted to use curses and debugged: Steve Feldman
- * Card counting: Kirk McKusick and Mikey Olson
- * User interface cleanups: Eric Allman and Kirk McKusick
- * Betting by Kirk McKusick
- */
-
-#include <sys/types.h>
-
-#include <curses.h>
-#include <ctype.h>
-#include <signal.h>
-#include <termios.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "pathnames.h"
-
-#define decksize 52
-#define originrow 0
-#define origincol 0
-#define basecol 1
-#define boxcol 42
-#define tboxrow 2
-#define bboxrow 17
-#define movecol 43
-#define moverow 16
-#define msgcol 43
-#define msgrow 15
-#define titlecol 30
-#define titlerow 0
-#define sidecol 1
-#define ottlrow 6
-#define foundcol 11
-#define foundrow 3
-#define stockcol 2
-#define stockrow 8
-#define fttlcol 10
-#define fttlrow 1
-#define taloncol 2
-#define talonrow 13
-#define tabrow 8
-#define ctoprow 21
-#define cbotrow 23
-#define cinitcol 14
-#define cheightcol 1
-#define cwidthcol 4
-#define handstatrow 21
-#define handstatcol 7
-#define talonstatrow 22
-#define talonstatcol 7
-#define stockstatrow 23
-#define stockstatcol 7
-#define Ace 1
-#define Jack 11
-#define Queen 12
-#define King 13
-#define atabcol 11
-#define btabcol 18
-#define ctabcol 25
-#define dtabcol 32
-
-#define spades 's'
-#define clubs 'c'
-#define hearts 'h'
-#define diamonds 'd'
-#define black 'b'
-#define red 'r'
-
-#define stk 1
-#define tal 2
-#define tab 3
-#define INCRHAND(row, col) {\
- row -= cheightcol;\
- if (row < ctoprow) {\
- row = cbotrow;\
- col += cwidthcol;\
- }\
-}
-#define DECRHAND(row, col) {\
- row += cheightcol;\
- if (row > cbotrow) {\
- row = ctoprow;\
- col -= cwidthcol;\
- }\
-}
-
-
-struct cardtype {
- char suit;
- char color;
- bool visible;
- bool paid;
- int rank;
- struct cardtype *next;
-};
-
-#define NIL ((struct cardtype *) -1)
-
-struct cardtype *deck[decksize];
-struct cardtype cards[decksize];
-struct cardtype *bottom[4], *found[4], *tableau[4];
-struct cardtype *talon, *hand, *stock, *basecard;
-int length[4];
-int cardsoff, base, cinhand, taloncnt, stockcnt, timesthru;
-char suitmap[4] = {spades, clubs, hearts, diamonds};
-char colormap[4] = {black, black, red, red};
-char pilemap[4] = {atabcol, btabcol, ctabcol, dtabcol};
-char srcpile, destpile;
-int mtforigin, tempbase;
-int coldcol, cnewcol, coldrow, cnewrow;
-bool errmsg, done;
-bool mtfdone, Cflag = FALSE;
-#define INSTRUCTIONBOX 1
-#define BETTINGBOX 2
-#define NOBOX 3
-int status = INSTRUCTIONBOX;
-int uid;
-
-/*
- * Basic betting costs
- */
-#define costofhand 13
-#define costofinspection 13
-#define costofgame 26
-#define costofrunthroughhand 5
-#define costofinformation 1
-#define secondsperdollar 60
-#define maxtimecharge 3
-#define valuepercardup 5
-/*
- * Variables associated with betting
- */
-struct betinfo {
- long hand; /* cost of dealing hand */
- long inspection; /* cost of inspecting hand */
- long game; /* cost of buying game */
- long runs; /* cost of running through hands */
- long information; /* cost of information */
- long thinktime; /* cost of thinking time */
- long wins; /* total winnings */
- long worth; /* net worth after costs */
-};
-struct betinfo this, game, total;
-bool startedgame = FALSE, infullgame = FALSE;
-time_t acctstart;
-int dbfd = -1;
-
-void askquit(int);
-void cleanup(int);
-void cleanupboard(void);
-void clearabovemovebox(void);
-void clearbelowmovebox(void);
-void clearmsg(void);
-void clearstat(void);
-void destinerror(void);
-bool diffcolor(struct cardtype *, struct cardtype *);
-void dumberror(void);
-bool finish(void);
-void fndbase(struct cardtype **, int, int);
-void getcmd(int, int, char *);
-void initall(void);
-void initdeck(struct cardtype *[]);
-void initgame(void);
-void instruct(void);
-void makeboard(void);
-void movebox(void);
-void movecard(void);
-void movetofound(struct cardtype **, int);
-void movetotalon(void);
-bool notempty(struct cardtype *);
-void printbottombettingbox(void);
-void printbottominstructions(void);
-void printcard(int, int, struct cardtype *);
-void printrank(int, int, struct cardtype *, bool);
-void printtopbettingbox(void);
-void printtopinstructions(void);
-bool rankhigher(struct cardtype *, int);
-bool ranklower(struct cardtype *, struct cardtype *);
-void removecard(int, int);
-bool samesuit(struct cardtype *, int);
-void showcards(void);
-void showstat(void);
-void shuffle(struct cardtype *[]);
-void simpletableau(struct cardtype **, int);
-void startgame(void);
-void suspend(void);
-bool tabok(struct cardtype *, int);
-void tabprint(int, int);
-void tabtotab(int, int);
-void transit(struct cardtype **, struct cardtype **);
-void updatebettinginfo(void);
-void usedstock(void);
-void usedtalon(void);
-
-/*
- * The following procedures print the board onto the screen using the
- * addressible cursor. The end of these procedures will also be
- * separated from the rest of the program.
- *
- * procedure to set the move command box
- */
-void
-movebox()
-{
- switch (status) {
- case BETTINGBOX:
- printtopbettingbox();
- break;
- case NOBOX:
- clearabovemovebox();
- break;
- case INSTRUCTIONBOX:
- printtopinstructions();
- break;
- }
- move(moverow, boxcol);
- printw("| |");
- move(msgrow, boxcol);
- printw("| |");
- switch (status) {
- case BETTINGBOX:
- printbottombettingbox();
- break;
- case NOBOX:
- clearbelowmovebox();
- break;
- case INSTRUCTIONBOX:
- printbottominstructions();
- break;
- }
- refresh();
-}
-
-/*
- * print directions above move box
- */
-void
-printtopinstructions()
-{
- move(tboxrow, boxcol);
- printw("*----------------------------------*");
- move(tboxrow + 1, boxcol);
- printw("| MOVES |");
- move(tboxrow + 2, boxcol);
- printw("|s# = stock to tableau |");
- move(tboxrow + 3, boxcol);
- printw("|sf = stock to foundation |");
- move(tboxrow + 4, boxcol);
- printw("|t# = talon to tableau |");
- move(tboxrow + 5, boxcol);
- printw("|tf = talon to foundation |");
- move(tboxrow + 6, boxcol);
- printw("|## = tableau to tableau |");
- move(tboxrow + 7, boxcol);
- printw("|#f = tableau to foundation |");
- move(tboxrow + 8, boxcol);
- printw("|ht = hand to talon |");
- move(tboxrow + 9, boxcol);
- printw("|c = toggle card counting |");
- move(tboxrow + 10, boxcol);
- printw("|b = present betting information |");
- move(tboxrow + 11, boxcol);
- printw("|q = quit to end the game |");
- move(tboxrow + 12, boxcol);
- printw("|==================================|");
-}
-
-/*
- * Print the betting box.
- */
-void
-printtopbettingbox()
-{
-
- move(tboxrow, boxcol);
- printw("*----------------------------------*");
- move(tboxrow + 1, boxcol);
- printw("|Costs Hand Game Total |");
- move(tboxrow + 2, boxcol);
- printw("| Hands |");
- move(tboxrow + 3, boxcol);
- printw("| Inspections |");
- move(tboxrow + 4, boxcol);
- printw("| Games |");
- move(tboxrow + 5, boxcol);
- printw("| Runs |");
- move(tboxrow + 6, boxcol);
- printw("| Information |");
- move(tboxrow + 7, boxcol);
- printw("| Think time |");
- move(tboxrow + 8, boxcol);
- printw("|Total Costs |");
- move(tboxrow + 9, boxcol);
- printw("|Winnings |");
- move(tboxrow + 10, boxcol);
- printw("|Net Worth |");
- move(tboxrow + 11, boxcol);
- printw("|Return |");
- move(tboxrow + 12, boxcol);
- printw("|==================================|");
-}
-
-/*
- * clear info above move box
- */
-void
-clearabovemovebox()
-{
- int i;
-
- for (i = 0; i <= 11; i++) {
- move(tboxrow + i, boxcol);
- printw(" ");
- }
- move(tboxrow + 12, boxcol);
- printw("*----------------------------------*");
-}
-
-/*
- * print instructions below move box
- */
-void
-printbottominstructions()
-{
- move(bboxrow, boxcol);
- printw("|Replace # with the number of the |");
- move(bboxrow + 1, boxcol);
- printw("|tableau you want. |");
- move(bboxrow + 2, boxcol);
- printw("*----------------------------------*");
-}
-
-/*
- * print betting information below move box
- */
-void
-printbottombettingbox()
-{
- move(bboxrow, boxcol);
- printw("|x = toggle information box |");
- move(bboxrow + 1, boxcol);
- printw("|i = list playing instructions |");
- move(bboxrow + 2, boxcol);
- printw("*----------------------------------*");
-}
-
-/*
- * clear info below move box
- */
-void
-clearbelowmovebox()
-{
- int i;
-
- move(bboxrow, boxcol);
- printw("*----------------------------------*");
- for (i = 1; i <= 2; i++) {
- move(bboxrow + i, boxcol);
- printw(" ");
- }
-}
-
-/*
- * procedure to put the board on the screen using addressable cursor
- */
-void
-makeboard()
-{
- clear();
- refresh();
- move(titlerow, titlecol);
- printw("=-> CANFIELD <-=");
- move(fttlrow, fttlcol);
- printw("foundation");
- move(foundrow - 1, fttlcol);
- printw("=---= =---= =---= =---=");
- move(foundrow, fttlcol);
- printw("| | | | | | | |");
- move(foundrow + 1, fttlcol);
- printw("=---= =---= =---= =---=");
- move(ottlrow, sidecol);
- printw("stock tableau");
- move(stockrow - 1, sidecol);
- printw("=---=");
- move(stockrow, sidecol);
- printw("| |");
- move(stockrow + 1, sidecol);
- printw("=---=");
- move(talonrow - 2, sidecol);
- printw("talon");
- move(talonrow - 1, sidecol);
- printw("=---=");
- move(talonrow, sidecol);
- printw("| |");
- move(talonrow + 1, sidecol);
- printw("=---=");
- move(tabrow - 1, atabcol);
- printw("-1- -2- -3- -4-");
- movebox();
-}
-
-/*
- * clean up the board for another game
- */
-void
-cleanupboard()
-{
- int cnt, row, col;
- struct cardtype *ptr;
-
- col = 0;
- if (Cflag) {
- clearstat();
- for(ptr = stock, row = stockrow;
- ptr != NIL;
- ptr = ptr->next, row++) {
- move(row, sidecol);
- printw(" ");
- }
- move(row, sidecol);
- printw(" ");
- move(stockrow + 1, sidecol);
- printw("=---=");
- move(talonrow - 2, sidecol);
- printw("talon");
- move(talonrow - 1, sidecol);
- printw("=---=");
- move(talonrow + 1, sidecol);
- printw("=---=");
- }
- move(stockrow, sidecol);
- printw("| |");
- move(talonrow, sidecol);
- printw("| |");
- move(foundrow, fttlcol);
- printw("| | | | | | | |");
- for (cnt = 0; cnt < 4; cnt++) {
- switch(cnt) {
- case 0:
- col = atabcol;
- break;
- case 1:
- col = btabcol;
- break;
- case 2:
- col = ctabcol;
- break;
- case 3:
- col = dtabcol;
- break;
- }
- for(ptr = tableau[cnt], row = tabrow;
- ptr != NIL;
- ptr = ptr->next, row++)
- removecard(col, row);
- }
-}
-
-/*
- * procedure to create a deck of cards
- */
-void
-initdeck(deck)
- struct cardtype *deck[];
-{
- int i;
- int scnt;
- char s;
- int r;
-
- i = 0;
- for (scnt=0; scnt<4; scnt++) {
- s = suitmap[scnt];
- for (r=Ace; r<=King; r++) {
- deck[i] = &cards[i];
- cards[i].rank = r;
- cards[i].suit = s;
- cards[i].color = colormap[scnt];
- cards[i].next = NIL;
- i++;
- }
- }
-}
-
-/*
- * procedure to shuffle the deck
- */
-void
-shuffle(deck)
- struct cardtype *deck[];
-{
- int i,j;
- struct cardtype *temp;
-
- for (i=0; i<decksize; i++) {
- deck[i]->visible = FALSE;
- deck[i]->paid = FALSE;
- }
- for (i = decksize-1; i>=0; i--) {
- j = random() % decksize;
- if (i != j) {
- temp = deck[i];
- deck[i] = deck[j];
- deck[j] = temp;
- }
- }
-}
-
-/*
- * procedure to remove the card from the board
- */
-void
-removecard(a, b)
-{
- move(b, a);
- printw(" ");
-}
-
-/*
- * procedure to print the cards on the board
- */
-void
-printrank(a, b, cp, inverse)
- struct cardtype *cp;
- bool inverse;
-{
- move(b, a);
- if (cp->rank != 10)
- addch(' ');
- if (inverse)
- standout();
- switch (cp->rank) {
- case 2: case 3: case 4: case 5: case 6: case 7:
- case 8: case 9: case 10:
- printw("%d", cp->rank);
- break;
- case Ace:
- addch('A');
- break;
- case Jack:
- addch('J');
- break;
- case Queen:
- addch('Q');
- break;
- case King:
- addch('K');
- }
- if (inverse)
- standend();
-}
-
-/*
- * procedure to print out a card
- */
-void
-printcard(a, b, cp)
- int a,b;
- struct cardtype *cp;
-{
- if (cp == NIL)
- removecard(a, b);
- else if (cp->visible == FALSE) {
- move(b, a);
- printw(" ? ");
- } else {
- bool inverse = (cp->suit == 'd' || cp->suit == 'h');
-
- printrank(a, b, cp, inverse);
- if (inverse)
- standout();
- addch(cp->suit);
- if (inverse)
- standend();
- }
-}
-
-/*
- * procedure to move the top card from one location to the top
- * of another location. The pointers always point to the top
- * of the piles.
- */
-void
-transit(source, dest)
- struct cardtype **source, **dest;
-{
- struct cardtype *temp;
-
- temp = *source;
- *source = (*source)->next;
- temp->next = *dest;
- *dest = temp;
-}
-
-/*
- * Procedure to set the cards on the foundation base when available.
- * Note that it is only called on a foundation pile at the beginning of
- * the game, so the pile will have exactly one card in it.
- */
-void
-fndbase(cp, column, row)
- struct cardtype **cp;
-{
- bool nomore;
-
- if (*cp != NIL)
- do {
- if ((*cp)->rank == basecard->rank) {
- base++;
- printcard(pilemap[base], foundrow, *cp);
- if (*cp == tableau[0])
- length[0] = length[0] - 1;
- if (*cp == tableau[1])
- length[1] = length[1] - 1;
- if (*cp == tableau[2])
- length[2] = length[2] - 1;
- if (*cp == tableau[3])
- length[3] = length[3] - 1;
- transit(cp, &found[base]);
- if (cp == &talon)
- usedtalon();
- if (cp == &stock)
- usedstock();
- if (*cp != NIL) {
- printcard(column, row, *cp);
- nomore = FALSE;
- } else {
- removecard(column, row);
- nomore = TRUE;
- }
- cardsoff++;
- if (infullgame) {
- this.wins += valuepercardup;
- game.wins += valuepercardup;
- total.wins += valuepercardup;
- }
- } else
- nomore = TRUE;
- } while (nomore == FALSE);
-}
-
-/*
- * procedure to initialize the things necessary for the game
- */
-void
-initgame()
-{
- int i;
-
- for (i=0; i<18; i++) {
- deck[i]->visible = TRUE;
- deck[i]->paid = TRUE;
- }
- stockcnt = 13;
- stock = deck[12];
- for (i=12; i>=1; i--)
- deck[i]->next = deck[i - 1];
- deck[0]->next = NIL;
- found[0] = deck[13];
- deck[13]->next = NIL;
- for (i=1; i<4; i++)
- found[i] = NIL;
- basecard = found[0];
- for (i=14; i<18; i++) {
- tableau[i - 14] = deck[i];
- deck[i]->next = NIL;
- }
- for (i=0; i<4; i++) {
- bottom[i] = tableau[i];
- length[i] = tabrow;
- }
- hand = deck[18];
- for (i=18; i<decksize-1; i++)
- deck[i]->next = deck[i + 1];
- deck[decksize-1]->next = NIL;
- talon = NIL;
- base = 0;
- cinhand = 34;
- taloncnt = 0;
- timesthru = 0;
- cardsoff = 1;
- coldrow = ctoprow;
- coldcol = cinitcol;
- cnewrow = ctoprow;
- cnewcol = cinitcol + cwidthcol;
-}
-
-/*
- * procedure to print the beginning cards and to start each game
- */
-void
-startgame()
-{
- int j;
-
- shuffle(deck);
- initgame();
- this.hand = costofhand;
- game.hand += costofhand;
- total.hand += costofhand;
- this.inspection = 0;
- this.game = 0;
- this.runs = 0;
- this.information = 0;
- this.wins = 0;
- this.thinktime = 0;
- infullgame = FALSE;
- startedgame = FALSE;
- printcard(foundcol, foundrow, found[0]);
- printcard(stockcol, stockrow, stock);
- printcard(atabcol, tabrow, tableau[0]);
- printcard(btabcol, tabrow, tableau[1]);
- printcard(ctabcol, tabrow, tableau[2]);
- printcard(dtabcol, tabrow, tableau[3]);
- printcard(taloncol, talonrow, talon);
- move(foundrow - 2, basecol);
- printw("Base");
- move(foundrow - 1, basecol);
- printw("Rank");
- printrank(basecol, foundrow, found[0], 0);
- for (j=0; j<=3; j++)
- fndbase(&tableau[j], pilemap[j], tabrow);
- fndbase(&stock, stockcol, stockrow);
- showstat(); /* show card counting info to cheaters */
- movetotalon();
- updatebettinginfo();
-}
-
-/*
- * procedure to clear the message printed from an error
- */
-void
-clearmsg()
-{
- int i;
-
- if (errmsg == TRUE) {
- errmsg = FALSE;
- move(msgrow, msgcol);
- for (i=0; i<25; i++)
- addch(' ');
- refresh();
- }
-}
-
-/*
- * procedure to print an error message if the move is not listed
- */
-void
-dumberror()
-{
- errmsg = TRUE;
- move(msgrow, msgcol);
- printw("Not a proper move ");
-}
-
-/*
- * procedure to print an error message if the move is not possible
- */
-void
-destinerror()
-{
- errmsg = TRUE;
- move(msgrow, msgcol);
- printw("Error: Can't move there");
-}
-
-/*
- * function to see if the source has cards in it
- */
-bool
-notempty(cp)
-struct cardtype *cp;
-{
- if (cp == NIL) {
- errmsg = TRUE;
- move(msgrow, msgcol);
- printw("Error: no cards to move");
- return (FALSE);
- } else
- return (TRUE);
-}
-
-/*
- * function to see if the rank of one card is less than another
- */
-bool
-ranklower(cp1, cp2)
- struct cardtype *cp1, *cp2;
-{
- if (cp2->rank == Ace)
- if (cp1->rank == King)
- return (TRUE);
- else
- return (FALSE);
- else if (cp1->rank + 1 == cp2->rank)
- return (TRUE);
- else
- return (FALSE);
-}
-
-/*
- * function to check the cardcolor for moving to a tableau
- */
-bool
-diffcolor(cp1, cp2)
- struct cardtype *cp1, *cp2;
-{
- if (cp1->color == cp2->color)
- return (FALSE);
- else
- return (TRUE);
-}
-
-/*
- * function to see if the card can move to the tableau
- */
-bool
-tabok(cp, des)
- struct cardtype *cp;
-{
- if ((cp == stock) && (tableau[des] == NIL))
- return (TRUE);
- else if (tableau[des] == NIL)
- if (stock == NIL &&
- cp != bottom[0] && cp != bottom[1] &&
- cp != bottom[2] && cp != bottom[3])
- return (TRUE);
- else
- return (FALSE);
- else if (ranklower(cp, tableau[des]) && diffcolor(cp, tableau[des]))
- return (TRUE);
- else
- return (FALSE);
-}
-
-/*
- * procedure to turn the cards onto the talon from the deck
- */
-void
-movetotalon()
-{
- int i, fin;
-
- if (cinhand <= 3 && cinhand > 0) {
- move(msgrow, msgcol);
- printw("Hand is now empty ");
- }
- if (cinhand >= 3)
- fin = 3;
- else if (cinhand > 0)
- fin = cinhand;
- else if (talon != NIL) {
- timesthru++;
- errmsg = TRUE;
- move(msgrow, msgcol);
- if (timesthru != 4) {
- printw("Talon is now the new hand");
- this.runs += costofrunthroughhand;
- game.runs += costofrunthroughhand;
- total.runs += costofrunthroughhand;
- while (talon != NIL) {
- transit(&talon, &hand);
- cinhand++;
- }
- if (cinhand >= 3)
- fin = 3;
- else
- fin = cinhand;
- taloncnt = 0;
- coldrow = ctoprow;
- coldcol = cinitcol;
- cnewrow = ctoprow;
- cnewcol = cinitcol + cwidthcol;
- clearstat();
- showstat();
- } else {
- fin = 0;
- done = TRUE;
- printw("I believe you have lost");
- refresh();
- sleep(5);
- }
- } else {
- errmsg = TRUE;
- move(msgrow, msgcol);
- printw("Talon and hand are empty");
- fin = 0;
- }
- for (i=0; i<fin; i++) {
- transit(&hand, &talon);
- INCRHAND(cnewrow, cnewcol);
- INCRHAND(coldrow, coldcol);
- removecard(cnewcol, cnewrow);
- if (i == fin - 1)
- talon->visible = TRUE;
- if (Cflag) {
- if (talon->paid == FALSE && talon->visible == TRUE) {
- this.information += costofinformation;
- game.information += costofinformation;
- total.information += costofinformation;
- talon->paid = TRUE;
- }
- printcard(coldcol, coldrow, talon);
- }
- }
- if (fin != 0) {
- printcard(taloncol, talonrow, talon);
- cinhand -= fin;
- taloncnt += fin;
- if (Cflag) {
- move(handstatrow, handstatcol);
- printw("%3d", cinhand);
- move(talonstatrow, talonstatcol);
- printw("%3d", taloncnt);
- }
- fndbase(&talon, taloncol, talonrow);
- }
-}
-
-
-/*
- * procedure to print card counting info on screen
- */
-void
-showstat()
-{
- int row, col;
- struct cardtype *ptr;
-
- if (!Cflag)
- return;
- move(talonstatrow, talonstatcol - 7);
- printw("Talon: %3d", taloncnt);
- move(handstatrow, handstatcol - 7);
- printw("Hand: %3d", cinhand);
- move(stockstatrow, stockstatcol - 7);
- printw("Stock: %3d", stockcnt);
- for ( row = coldrow, col = coldcol, ptr = talon;
- ptr != NIL;
- ptr = ptr->next ) {
- if (ptr->paid == FALSE && ptr->visible == TRUE) {
- ptr->paid = TRUE;
- this.information += costofinformation;
- game.information += costofinformation;
- total.information += costofinformation;
- }
- printcard(col, row, ptr);
- DECRHAND(row, col);
- }
- for ( row = cnewrow, col = cnewcol, ptr = hand;
- ptr != NIL;
- ptr = ptr->next ) {
- if (ptr->paid == FALSE && ptr->visible == TRUE) {
- ptr->paid = TRUE;
- this.information += costofinformation;
- game.information += costofinformation;
- total.information += costofinformation;
- }
- INCRHAND(row, col);
- printcard(col, row, ptr);
- }
-}
-
-/*
- * procedure to clear card counting info from screen
- */
-void
-clearstat()
-{
- int row;
-
- move(talonstatrow, talonstatcol - 7);
- printw(" ");
- move(handstatrow, handstatcol - 7);
- printw(" ");
- move(stockstatrow, stockstatcol - 7);
- printw(" ");
- for ( row = ctoprow ; row <= cbotrow ; row++ ) {
- move(row, cinitcol);
- printw("%56s", " ");
- }
-}
-
-/*
- * procedure to update card counting base
- */
-void
-usedtalon()
-{
- removecard(coldcol, coldrow);
- DECRHAND(coldrow, coldcol);
- if (talon != NIL && (talon->visible == FALSE)) {
- talon->visible = TRUE;
- if (Cflag) {
- this.information += costofinformation;
- game.information += costofinformation;
- total.information += costofinformation;
- talon->paid = TRUE;
- printcard(coldcol, coldrow, talon);
- }
- }
- taloncnt--;
- if (Cflag) {
- move(talonstatrow, talonstatcol);
- printw("%3d", taloncnt);
- }
-}
-
-/*
- * procedure to update stock card counting base
- */
-void
-usedstock()
-{
- stockcnt--;
- if (Cflag) {
- move(stockstatrow, stockstatcol);
- printw("%3d", stockcnt);
- }
-}
-
-/*
- * let 'em know how they lost!
- */
-void
-showcards()
-{
- struct cardtype *ptr;
- int row;
-
- if (!Cflag || cardsoff == 52)
- return;
- for (ptr = talon; ptr != NIL; ptr = ptr->next) {
- ptr->visible = TRUE;
- ptr->paid = TRUE;
- }
- for (ptr = hand; ptr != NIL; ptr = ptr->next) {
- ptr->visible = TRUE;
- ptr->paid = TRUE;
- }
- showstat();
- move(stockrow + 1, sidecol);
- printw(" ");
- move(talonrow - 2, sidecol);
- printw(" ");
- move(talonrow - 1, sidecol);
- printw(" ");
- move(talonrow, sidecol);
- printw(" ");
- move(talonrow + 1, sidecol);
- printw(" ");
- for (ptr = stock, row = stockrow; ptr != NIL; ptr = ptr->next, row++) {
- move(row, stockcol - 1);
- printw("| |");
- printcard(stockcol, row, ptr);
- }
- if (stock == NIL) {
- move(row, stockcol - 1);
- printw("| |");
- row++;
- }
- move(handstatrow, handstatcol - 7);
- printw(" ");
- move(row, stockcol - 1);
- printw("=---=");
- if ( cardsoff == 52 )
- getcmd(moverow, movecol, "Hit return to exit");
-}
-
-/*
- * procedure to update the betting values
- */
-void
-updatebettinginfo()
-{
- long thiscosts, gamecosts, totalcosts;
- double thisreturn, gamereturn, totalreturn;
- time_t now;
- long dollars;
-
- time(&now);
- dollars = (now - acctstart) / secondsperdollar;
- if (dollars > 0) {
- acctstart += dollars * secondsperdollar;
- if (dollars > maxtimecharge)
- dollars = maxtimecharge;
- this.thinktime += dollars;
- game.thinktime += dollars;
- total.thinktime += dollars;
- }
- thiscosts = this.hand + this.inspection + this.game +
- this.runs + this.information + this.thinktime;
- gamecosts = game.hand + game.inspection + game.game +
- game.runs + game.information + game.thinktime;
- totalcosts = total.hand + total.inspection + total.game +
- total.runs + total.information + total.thinktime;
- this.worth = this.wins - thiscosts;
- game.worth = game.wins - gamecosts;
- total.worth = total.wins - totalcosts;
- thisreturn = ((double)this.wins / (double)thiscosts - 1.0) * 100.0;
- gamereturn = ((double)game.wins / (double)gamecosts - 1.0) * 100.0;
- totalreturn = ((double)total.wins / (double)totalcosts - 1.0) * 100.0;
- if (status != BETTINGBOX)
- return;
- move(tboxrow + 2, boxcol + 13);
- printw("%4d%8d%9d", this.hand, game.hand, total.hand);
- move(tboxrow + 3, boxcol + 13);
- printw("%4d%8d%9d", this.inspection, game.inspection, total.inspection);
- move(tboxrow + 4, boxcol + 13);
- printw("%4d%8d%9d", this.game, game.game, total.game);
- move(tboxrow + 5, boxcol + 13);
- printw("%4d%8d%9d", this.runs, game.runs, total.runs);
- move(tboxrow + 6, boxcol + 13);
- printw("%4d%8d%9d", this.information, game.information,
- total.information);
- move(tboxrow + 7, boxcol + 13);
- printw("%4d%8d%9d", this.thinktime, game.thinktime, total.thinktime);
- move(tboxrow + 8, boxcol + 13);
- printw("%4d%8d%9d", thiscosts, gamecosts, totalcosts);
- move(tboxrow + 9, boxcol + 13);
- printw("%4d%8d%9d", this.wins, game.wins, total.wins);
- move(tboxrow + 10, boxcol + 13);
- printw("%4d%8d%9d", this.worth, game.worth, total.worth);
- move(tboxrow + 11, boxcol + 13);
- printw("%4.0f%%%7.1f%%%8.1f%%", thisreturn, gamereturn, totalreturn);
-}
-
-/*
- * procedure to move a card from the stock or talon to the tableau
- */
-void
-simpletableau(cp, des)
-struct cardtype **cp;
-{
- int origin;
-
- if (notempty(*cp)) {
- if (tabok(*cp, des)) {
- if (*cp == stock)
- origin = stk;
- else
- origin = tal;
- if (tableau[des] == NIL)
- bottom[des] = *cp;
- transit(cp, &tableau[des]);
- length[des]++;
- printcard(pilemap[des], length[des], tableau[des]);
- timesthru = 0;
- if (origin == stk) {
- usedstock();
- printcard(stockcol, stockrow, stock);
- } else {
- usedtalon();
- printcard(taloncol, talonrow, talon);
- }
- } else
- destinerror();
- }
-}
-
-/*
- * print the tableau
- */
-void
-tabprint(sour, des)
-{
- int dlength, slength, i;
- struct cardtype *tempcard;
-
- for (i=tabrow; i<=length[sour]; i++)
- removecard(pilemap[sour], i);
- dlength = length[des] + 1;
- slength = length[sour];
- if (slength == tabrow)
- printcard(pilemap[des], dlength, tableau[sour]);
- else
- while (slength != tabrow - 1) {
- tempcard = tableau[sour];
- for (i=1; i<=slength-tabrow; i++)
- tempcard = tempcard->next;
- printcard(pilemap[des], dlength, tempcard);
- slength--;
- dlength++;
- }
-}
-
-/*
- * procedure to move from the tableau to the tableau
- */
-void
-tabtotab(sour, des)
- int sour, des;
-{
- struct cardtype *temp;
-
- if (notempty(tableau[sour])) {
- if (tabok(bottom[sour], des)) {
- tabprint(sour, des);
- temp = bottom[sour];
- bottom[sour] = NIL;
- if (bottom[des] == NIL)
- bottom[des] = temp;
- temp->next = tableau[des];
- tableau[des] = tableau[sour];
- tableau[sour] = NIL;
- length[des] = length[des] + (length[sour] - (tabrow - 1));
- length[sour] = tabrow - 1;
- timesthru = 0;
- } else
- destinerror();
- }
-}
-
-/*
- * functions to see if the card can go onto the foundation
- */
-bool
-rankhigher(cp, let)
- struct cardtype *cp;
-{
- if (found[let]->rank == King)
- if (cp->rank == Ace)
- return(TRUE);
- else
- return(FALSE);
- else if (cp->rank - 1 == found[let]->rank)
- return(TRUE);
- else
- return(FALSE);
-}
-
-/*
- * function to determine if two cards are the same suit
- */
-bool
-samesuit(cp, let)
- struct cardtype *cp;
-{
- if (cp->suit == found[let]->suit)
- return (TRUE);
- else
- return (FALSE);
-}
-
-/*
- * procedure to move a card to the correct foundation pile
- */
-void
-movetofound(cp, source)
- struct cardtype **cp;
-{
- tempbase = 0;
- mtfdone = FALSE;
- if (notempty(*cp)) {
- do {
- if (found[tempbase] != NIL)
- if (rankhigher(*cp, tempbase)
- && samesuit(*cp, tempbase)) {
- if (*cp == stock)
- mtforigin = stk;
- else if (*cp == talon)
- mtforigin = tal;
- else
- mtforigin = tab;
- transit(cp, &found[tempbase]);
- printcard(pilemap[tempbase],
- foundrow, found[tempbase]);
- timesthru = 0;
- if (mtforigin == stk) {
- usedstock();
- printcard(stockcol, stockrow, stock);
- } else if (mtforigin == tal) {
- usedtalon();
- printcard(taloncol, talonrow, talon);
- } else {
- removecard(pilemap[source], length[source]);
- length[source]--;
- }
- cardsoff++;
- if (infullgame) {
- this.wins += valuepercardup;
- game.wins += valuepercardup;
- total.wins += valuepercardup;
- }
- mtfdone = TRUE;
- } else
- tempbase++;
- else
- tempbase++;
- } while ((tempbase != 4) && !mtfdone);
- if (!mtfdone)
- destinerror();
- }
-}
-
-/*
- * procedure to get a command
- */
-void
-getcmd(row, col, cp)
- int row, col;
- char *cp;
-{
- char cmd[2], ch;
- int i;
-
- i = 0;
- move(row, col);
- printw("%-24s", cp);
- col += 1 + strlen(cp);
- move(row, col);
- refresh();
- do {
- ch = getch() & 0177;
- if (ch >= 'A' && ch <= 'Z')
- ch += ('a' - 'A');
- if (ch == '\f') {
- wrefresh(curscr);
- refresh();
- } else if (i >= 2 && ch != erasechar() && ch != killchar()) {
- if (ch != '\n' && ch != '\r' && ch != ' ')
- write(1, "\007", 1);
- } else if (ch == erasechar() && i > 0) {
- printw("\b \b");
- refresh();
- i--;
- } else if (ch == killchar() && i > 0) {
- while (i > 0) {
- printw("\b \b");
- i--;
- }
- refresh();
- } else if (ch == '\032') { /* Control-Z */
- suspend();
- move(row, col + i);
- refresh();
- } else if (isprint(ch)) {
- cmd[i++] = ch;
- addch(ch);
- refresh();
- }
- } while (ch != '\n' && ch != '\r' && ch != ' ');
- srcpile = cmd[0];
- destpile = cmd[1];
-}
-
-/*
- * Suspend the game (shell escape if no process control on system)
- */
-void
-suspend()
-{
-#ifndef SIGTSTP
- char *sh;
-#endif
-
- updatebettinginfo();
- move(21, 0);
- refresh();
- if (dbfd != -1) {
- lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET);
- write(dbfd, (char *)&total, sizeof(total));
- }
- kill(getpid(), SIGTSTP);
- raw();
- noecho();
-}
-
-/*
- * procedure to evaluate and make the specific moves
- */
-void
-movecard()
-{
- int source, dest;
- char osrcpile, odestpile;
-
- source = 0;
- dest = 0;
- done = FALSE;
- errmsg = FALSE;
- do {
- if (talon == NIL && hand != NIL)
- movetotalon();
- if (cardsoff == 52) {
- refresh();
- srcpile = 'q';
- } else if (!startedgame) {
- move(msgrow, msgcol);
- errmsg = TRUE;
- switch (34 - taloncnt - cinhand) {
- default:
- errmsg = FALSE;
- break;
- case 1:
- printw("One card used from talon ");
- break;
- case 2:
- printw("Two cards used from talon ");
- break;
- case 3:
- printw(">3< cards used from talon ");
- break;
- }
- getcmd(moverow, movecol, "Move:");
- } else
- getcmd(moverow, movecol, "Move:");
- clearmsg();
- if (srcpile >= '1' && srcpile <= '4')
- source = (int) (srcpile - '1');
- if (destpile >= '1' && destpile <= '4')
- dest = (int) (destpile - '1');
- if (!startedgame &&
- (srcpile == 't' || srcpile == 's' || srcpile == 'h' ||
- srcpile == '1' || srcpile == '2' || srcpile == '3' ||
- srcpile == '4')) {
- startedgame = TRUE;
- osrcpile = srcpile;
- odestpile = destpile;
- if (status != BETTINGBOX)
- srcpile = 'y';
- else do {
- getcmd(moverow, movecol, "Inspect game?");
- } while (srcpile != 'y' && srcpile != 'n');
- if (srcpile == 'n') {
- srcpile = 'q';
- } else {
- this.inspection += costofinspection;
- game.inspection += costofinspection;
- total.inspection += costofinspection;
- srcpile = osrcpile;
- destpile = odestpile;
- }
- }
- switch (srcpile) {
- case 't':
- if (destpile == 'f' || destpile == 'F')
- movetofound(&talon, source);
- else if (destpile >= '1' && destpile <= '4')
- simpletableau(&talon, dest);
- else
- dumberror();
- break;
- case 's':
- if (destpile == 'f' || destpile == 'F')
- movetofound(&stock, source);
- else if (destpile >= '1' && destpile <= '4')
- simpletableau(&stock, dest);
- else dumberror();
- break;
- case 'h':
- if (destpile != 't' && destpile != 'T') {
- dumberror();
- break;
- }
- if (infullgame) {
- movetotalon();
- break;
- }
- if (status == BETTINGBOX) {
- do {
- getcmd(moverow, movecol,
- "Buy game?");
- } while (srcpile != 'y' &&
- srcpile != 'n');
- if (srcpile == 'n') {
- showcards();
- done = TRUE;
- break;
- }
- }
- infullgame = TRUE;
- this.wins += valuepercardup * cardsoff;
- game.wins += valuepercardup * cardsoff;
- total.wins += valuepercardup * cardsoff;
- this.game += costofgame;
- game.game += costofgame;
- total.game += costofgame;
- movetotalon();
- break;
- case 'q':
- showcards();
- done = TRUE;
- break;
- case 'b':
- printtopbettingbox();
- printbottombettingbox();
- status = BETTINGBOX;
- break;
- case 'x':
- clearabovemovebox();
- clearbelowmovebox();
- status = NOBOX;
- break;
- case 'i':
- printtopinstructions();
- printbottominstructions();
- status = INSTRUCTIONBOX;
- break;
- case 'c':
- Cflag = !Cflag;
- if (Cflag)
- showstat();
- else
- clearstat();
- break;
- case '1': case '2': case '3': case '4':
- if (destpile == 'f' || destpile == 'F')
- movetofound(&tableau[source], source);
- else if (destpile >= '1' && destpile <= '4')
- tabtotab(source, dest);
- else dumberror();
- break;
- default:
- dumberror();
- }
- fndbase(&stock, stockcol, stockrow);
- fndbase(&talon, taloncol, talonrow);
- updatebettinginfo();
- } while (!done);
-}
-
-char *basicinstructions[] = {
- "Here are brief instuctions to the game of Canfield:\n\n",
- " If you have never played solitaire before, it is recom-\n",
- "mended that you consult a solitaire instruction book. In\n",
- "Canfield, tableau cards may be built on each other downward\n",
- "in alternate colors. An entire pile must be moved as a unit\n",
- "in building. Top cards of the piles are available to be able\n",
- "to be played on foundations, but never into empty spaces.\n\n",
- " Spaces must be filled from the stock. The top card of\n",
- "the stock also is available to be played on foundations or\n",
- "built on tableau piles. After the stock is exhausted, ta-\n",
- "bleau spaces may be filled from the talon and the player may\n",
- "keep them open until he wishes to use them.\n\n",
- " Cards are dealt from the hand to the talon by threes\n",
- "and this repeats until there are no more cards in the hand\n",
- "or the player quits. To have cards dealt onto the talon the\n",
- "player types 'ht' for his move. Foundation base cards are\n",
- "also automatically moved to the foundation when they become\n",
- "available.\n\n",
- "push any key when you are finished: ",
- 0 };
-
-char *bettinginstructions[] = {
- " The rules for betting are somewhat less strict than\n",
- "those used in the official version of the game. The initial\n",
- "deal costs $13. You may quit at this point or inspect the\n",
- "game. Inspection costs $13 and allows you to make as many\n",
- "moves as is possible without moving any cards from your hand\n",
- "to the talon. (the initial deal places three cards on the\n",
- "talon; if all these cards are used, three more are made\n",
- "available) Finally, if the game seems interesting, you must\n",
- "pay the final installment of $26. At this point you are\n",
- "credited at the rate of $5 for each card on the foundation;\n",
- "as the game progresses you are credited with $5 for each\n",
- "card that is moved to the foundation. Each run through the\n",
- "hand after the first costs $5. The card counting feature\n",
- "costs $1 for each unknown card that is identified. If the\n",
- "information is toggled on, you are only charged for cards\n",
- "that became visible since it was last turned on. Thus the\n",
- "maximum cost of information is $34. Playing time is charged\n",
- "at a rate of $1 per minute.\n\n",
- "push any key when you are finished: ",
- 0 };
-
-/*
- * procedure to printout instructions
- */
-void
-instruct()
-{
- char **cp;
-
- move(originrow, origincol);
- printw("This is the game of solitaire called Canfield. Do\n");
- printw("you want instructions for the game?");
- do {
- getcmd(originrow + 3, origincol, "y or n?");
- } while (srcpile != 'y' && srcpile != 'n');
- if (srcpile == 'n')
- return;
- clear();
- for (cp = basicinstructions; *cp != 0; cp++)
- printw(*cp);
- refresh();
- getch();
- clear();
- move(originrow, origincol);
- printw("Do you want instructions for betting?");
- do {
- getcmd(originrow + 2, origincol, "y or n?");
- } while (srcpile != 'y' && srcpile != 'n');
- if (srcpile == 'n')
- return;
- clear();
- for (cp = bettinginstructions; *cp != 0; cp++)
- printw(*cp);
- refresh();
- getch();
-}
-
-/*
- * procedure to initialize the game
- */
-void
-initall()
-{
- int i;
-
- if (dbfd < 0)
- return;
- srandomdev();
- time(&acctstart);
- initdeck(deck);
- uid = getuid();
-
- i = lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET);
- if (i < 0) {
- close(dbfd);
- dbfd = -1;
- return;
- }
- i = read(dbfd, (char *)&total, sizeof(total));
- if (i < 0) {
- close(dbfd);
- dbfd = -1;
- return;
- }
-}
-
-/*
- * procedure to end the game
- */
-bool
-finish()
-{
- int row, col;
-
- if (cardsoff == 52) {
- getcmd(moverow, movecol, "Hit return to exit");
- clear();
- refresh();
- move(originrow, origincol);
- printw("CONGRATULATIONS!\n");
- printw("You won the game. That is a feat to be proud of.\n");
- row = originrow + 5;
- col = origincol;
- } else {
- move(msgrow, msgcol);
- printw("You got %d card", cardsoff);
- if (cardsoff > 1)
- printw("s");
- printw(" off ");
- move(msgrow, msgcol);
- row = moverow;
- col = movecol;
- }
- do {
- getcmd(row, col, "Play again (y or n)?");
- } while (srcpile != 'y' && srcpile != 'n');
- errmsg = TRUE;
- clearmsg();
- if (srcpile == 'y')
- return (FALSE);
- else
- return (TRUE);
-}
-
-/*
- * procedure to clean up and exit
- */
-void
-cleanup(sig)
- int sig;
-{
-
- total.thinktime += 1;
- status = NOBOX;
- updatebettinginfo();
- if (dbfd != -1) {
- lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET);
- write(dbfd, (char *)&total, sizeof(total));
- close(dbfd);
- }
- clear();
- move(22,0);
- refresh();
- endwin();
- exit(0);
- /* NOTREACHED */
-}
-
-/*
- * Field an interrupt.
- */
-void
-askquit(sig)
- int sig;
-{
- move(msgrow, msgcol);
- printw("Really wish to quit? ");
- do {
- getcmd(moverow, movecol, "y or n?");
- } while (srcpile != 'y' && srcpile != 'n');
- clearmsg();
- if (srcpile == 'y')
- cleanup(0);
- signal(SIGINT, askquit);
-}
-
-/*
- * Can you tell that this used to be a Pascal program?
- */
-int
-main()
-{
- dbfd = open(_PATH_SCORE, O_RDWR);
-
- /* revoke */
- setgid(getgid());
-
-#ifdef MAXLOAD
- double vec[3];
-
- loadav(vec);
- if (vec[2] >= MAXLOAD) {
- puts("The system load is too high. Try again later.");
- exit(0);
- }
-#endif
- signal(SIGINT, askquit);
- signal(SIGHUP, cleanup);
- signal(SIGTERM, cleanup);
- initscr();
- raw();
- noecho();
- initall();
-
- instruct();
- makeboard();
- for (;;) {
- startgame();
- movecard();
- if (finish())
- break;
- if (cardsoff == 52)
- makeboard();
- else
- cleanupboard();
- }
- cleanup(0);
- /* NOTREACHED */
- exit (EXIT_FAILURE);
-}
diff --git a/games/canfield/canfield/pathnames.h b/games/canfield/canfield/pathnames.h
deleted file mode 100644
index e187698..0000000
--- a/games/canfield/canfield/pathnames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_SCORE "/var/games/cfscores"
-
diff --git a/games/canfield/cfscores/Makefile b/games/canfield/cfscores/Makefile
deleted file mode 100644
index 565b6c3..0000000
--- a/games/canfield/cfscores/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= cfscores
-CFLAGS+=-I${.CURDIR}/../canfield
-NOMAN= noman
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c
deleted file mode 100644
index c13b905..0000000
--- a/games/canfield/cfscores/cfscores.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include "pathnames.h"
-
-struct betinfo {
- long hand; /* cost of dealing hand */
- long inspection; /* cost of inspecting hand */
- long game; /* cost of buying game */
- long runs; /* cost of running through hands */
- long information; /* cost of information */
- long thinktime; /* cost of thinking time */
- long wins; /* total winnings */
- long worth; /* net worth after costs */
-};
-
-int dbfd;
-
-void printuser(struct passwd *, int);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- struct passwd *pw;
- int uid;
-
- if (argc > 2) {
- printf("usage: cfscores [user]\n");
- exit(1);
- }
- dbfd = open(_PATH_SCORE, O_RDONLY);
- if (dbfd < 0) {
- perror(_PATH_SCORE);
- exit(2);
- }
-
- setpwent();
- if (argc == 1) {
- uid = getuid();
- pw = getpwuid(uid);
- if (pw == 0) {
- printf("You are not listed in the password file?!?\n");
- exit(2);
- }
- printuser(pw, 1);
- exit(0);
- }
- if (strcmp(argv[1], "-a") == 0) {
- while ((pw = getpwent()) != 0)
- printuser(pw, 0);
- exit(0);
- }
- pw = getpwnam(argv[1]);
- if (pw == 0) {
- printf("User %s unknown\n", argv[1]);
- exit(3);
- }
- printuser(pw, 1);
- exit(0);
-}
-
-/*
- * print out info for specified password entry
- */
-void
-printuser(pw, printfail)
- struct passwd *pw;
- int printfail;
-{
- struct betinfo total;
- int i;
-
- if (pw->pw_uid < 0) {
- printf("Bad uid %d\n", pw->pw_uid);
- return;
- }
- i = lseek(dbfd, pw->pw_uid * sizeof(struct betinfo), SEEK_SET);
- if (i < 0) {
- perror("lseek");
- return;
- }
- i = read(dbfd, (char *)&total, sizeof(total));
- if (i < 0) {
- perror("read");
- return;
- }
- if (i == 0 || total.hand == 0) {
- if (printfail)
- printf("%s has never played canfield.\n", pw->pw_name);
- return;
- }
- printf("*----------------------*\n");
- if (total.worth >= 0)
- printf("* Winnings for %-8s*\n", pw->pw_name);
- else
- printf("* Losses for %-10s*\n", pw->pw_name);
- printf("*======================*\n");
- printf("|Costs Total |\n");
- printf("| Hands %8ld |\n", total.hand);
- printf("| Inspections %8ld |\n", total.inspection);
- printf("| Games %8ld |\n", total.game);
- printf("| Runs %8ld |\n", total.runs);
- printf("| Information %8ld |\n", total.information);
- printf("| Think time %8ld |\n", total.thinktime);
- printf("|Total Costs %8ld |\n", total.wins - total.worth);
- printf("|Winnings %8ld |\n", total.wins);
- printf("|Net Worth %8ld |\n", total.worth);
- printf("*----------------------*\n\n");
-}
diff --git a/games/cribbage/Makefile b/games/cribbage/Makefile
deleted file mode 100644
index 5faeccd..0000000
--- a/games/cribbage/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= cribbage
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-SRCS= extern.c crib.c cards.c instr.c io.c score.c support.c
-FILES= cribbage.n
-FILESNAME_cribbage.n= cribbage.instr
-MAN= cribbage.6
-HIDEGAME=hidegame
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/criblog)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/criblog
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/cribbage/cards.c b/games/cribbage/cards.c
deleted file mode 100644
index ba846ae..0000000
--- a/games/cribbage/cards.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <curses.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "deck.h"
-#include "cribbage.h"
-
-
-/*
- * Initialize a deck of cards to contain one of each type.
- */
-void
-makedeck(d)
- CARD d[];
-{
- int i, j, k;
-
- srandomdev();
- k = 0;
- for (i = 0; i < RANKS; i++)
- for (j = 0; j < SUITS; j++) {
- d[k].suit = j;
- d[k++].rank = i;
- }
-}
-
-/*
- * Given a deck of cards, shuffle it -- i.e. randomize it
- * see Knuth, vol. 2, page 125.
- */
-void
-shuffle(d)
- CARD d[];
-{
- int j, k;
- CARD c;
-
- for (j = CARDS; j > 0; --j) {
- k = random() % j; /* random 0 <= k < j */
- c = d[j - 1]; /* exchange (j - 1) and k */
- d[j - 1] = d[k];
- d[k] = c;
- }
-}
-
-/*
- * return true if the two cards are equal...
- */
-int
-eq(a, b)
- CARD a, b;
-{
- return ((a.rank == b.rank) && (a.suit == b.suit));
-}
-
-/*
- * isone returns TRUE if a is in the set of cards b
- */
-int
-isone(a, b, n)
- CARD a, b[];
- int n;
-{
- int i;
-
- for (i = 0; i < n; i++)
- if (eq(a, b[i]))
- return (TRUE);
- return (FALSE);
-}
-
-/*
- * remove the card a from the deck d of n cards
- */
-void
-cremove(a, d, n)
- CARD a, d[];
- int n;
-{
- int i, j;
-
- for (i = j = 0; i < n; i++)
- if (!eq(a, d[i]))
- d[j++] = d[i];
- if (j < n)
- d[j].suit = d[j].rank = EMPTY;
-}
-
-/*
- * sorthand:
- * Sort a hand of n cards
- */
-void
-sorthand(h, n)
- CARD h[];
- int n;
-{
- CARD *cp, *endp;
- CARD c;
-
- for (endp = &h[n]; h < endp - 1; h++)
- for (cp = h + 1; cp < endp; cp++)
- if ((cp->rank < h->rank) ||
- (cp->rank == h->rank && cp->suit < h->suit)) {
- c = *h;
- *h = *cp;
- *cp = c;
- }
-}
diff --git a/games/cribbage/crib.c b/games/cribbage/crib.c
deleted file mode 100644
index fc3c3df..0000000
--- a/games/cribbage/crib.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <curses.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include "deck.h"
-#include "cribbage.h"
-#include "cribcur.h"
-#include "pathnames.h"
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- BOOLEAN playing;
- FILE *f;
- int ch;
-
- f = fopen(_PATH_LOG, "a");
-
- /* revoke */
- setgid(getgid());
-
- while ((ch = getopt(argc, argv, "eqr")) != -1)
- switch (ch) {
- case 'e':
- explain = TRUE;
- break;
- case 'q':
- quiet = TRUE;
- break;
- case 'r':
- rflag = TRUE;
- break;
- case '?':
- default:
- (void) fprintf(stderr, "usage: cribbage [-eqr]\n");
- exit(1);
- }
-
- initscr();
- (void)signal(SIGINT, rint);
- crmode();
- noecho();
-
- Playwin = subwin(stdscr, PLAY_Y, PLAY_X, 0, 0);
- Tablewin = subwin(stdscr, TABLE_Y, TABLE_X, 0, PLAY_X);
- Compwin = subwin(stdscr, COMP_Y, COMP_X, 0, TABLE_X + PLAY_X);
- Msgwin = subwin(stdscr, MSG_Y, MSG_X, Y_MSG_START, SCORE_X + 1);
- leaveok(Playwin, TRUE);
- leaveok(Tablewin, TRUE);
- leaveok(Compwin, TRUE);
- clearok(stdscr, FALSE);
-
- if (!quiet) {
- msg("Do you need instructions for cribbage? ");
- if (getuchar() == 'Y') {
- endwin();
- clear();
- mvcur(0, COLS - 1, LINES - 1, 0);
- fflush(stdout);
- instructions();
- crmode();
- noecho();
- clear();
- refresh();
- msg("For cribbage rules, use \"man cribbage\"");
- }
- }
- playing = TRUE;
- do {
- wclrtobot(Msgwin);
- msg(quiet ? "L or S? " : "Long (to 121) or Short (to 61)? ");
- if (glimit == SGAME)
- glimit = (getuchar() == 'L' ? LGAME : SGAME);
- else
- glimit = (getuchar() == 'S' ? SGAME : LGAME);
- game();
- msg("Another game? ");
- playing = (getuchar() == 'Y');
- } while (playing);
-
- if (f != NULL) {
- (void)fprintf(f, "%s: won %5.5d, lost %5.5d\n",
- getlogin(), cgames, pgames);
- (void) fclose(f);
- }
- bye();
- if (!f) {
- (void) fprintf(stderr, "\ncribbage: can't open %s.\n",
- _PATH_LOG);
- exit(1);
- }
- exit(0);
-}
-
-/*
- * makeboard:
- * Print out the initial board on the screen
- */
-void
-makeboard()
-{
- mvaddstr(SCORE_Y + 0, SCORE_X,
- "+---------------------------------------+");
- mvaddstr(SCORE_Y + 1, SCORE_X,
- "| Score: 0 YOU |");
- mvaddstr(SCORE_Y + 2, SCORE_X,
- "| *.....:.....:.....:.....:.....:..... |");
- mvaddstr(SCORE_Y + 3, SCORE_X,
- "| *.....:.....:.....:.....:.....:..... |");
- mvaddstr(SCORE_Y + 4, SCORE_X,
- "| |");
- mvaddstr(SCORE_Y + 5, SCORE_X,
- "| *.....:.....:.....:.....:.....:..... |");
- mvaddstr(SCORE_Y + 6, SCORE_X,
- "| *.....:.....:.....:.....:.....:..... |");
- mvaddstr(SCORE_Y + 7, SCORE_X,
- "| Score: 0 ME |");
- mvaddstr(SCORE_Y + 8, SCORE_X,
- "+---------------------------------------+");
- gamescore();
-}
-
-/*
- * gamescore:
- * Print out the current game score
- */
-void
-gamescore()
-{
-
- if (pgames || cgames) {
- mvprintw(SCORE_Y + 1, SCORE_X + 28, "Games: %3d", pgames);
- mvprintw(SCORE_Y + 7, SCORE_X + 28, "Games: %3d", cgames);
- }
- Lastscore[0] = -1;
- Lastscore[1] = -1;
-}
-
-/*
- * game:
- * Play one game up to glimit points. Actually, we only ASK the
- * player what card to turn. We do a random one, anyway.
- */
-void
-game()
-{
- int i, j;
- BOOLEAN flag;
- BOOLEAN compcrib;
-
- compcrib = FALSE;
- makedeck(deck);
- shuffle(deck);
- if (gamecount == 0) {
- flag = TRUE;
- do {
- if (!rflag) { /* player cuts deck */
- msg(quiet ? "Cut for crib? " :
- "Cut to see whose crib it is -- low card wins? ");
- getline();
- }
- i = random() % CARDS; /* random cut */
- do { /* comp cuts deck */
- j = random() % CARDS;
- } while (j == i);
- addmsg(quiet ? "You cut " : "You cut the ");
- msgcard(deck[i], FALSE);
- endmsg();
- addmsg(quiet ? "I cut " : "I cut the ");
- msgcard(deck[j], FALSE);
- endmsg();
- flag = (deck[i].rank == deck[j].rank);
- if (flag) {
- msg(quiet ? "We tied..." :
- "We tied and have to try again...");
- shuffle(deck);
- continue;
- } else
- compcrib = (deck[i].rank > deck[j].rank);
- } while (flag);
- clear();
- makeboard();
- refresh();
- } else {
- werase(Tablewin);
- wrefresh(Tablewin);
- werase(Compwin);
- wrefresh(Compwin);
- msg("Loser (%s) gets first crib", (iwon ? "you" : "me"));
- compcrib = !iwon;
- }
-
- pscore = cscore = 0;
- flag = TRUE;
- do {
- shuffle(deck);
- flag = !playhand(compcrib);
- compcrib = !compcrib;
- } while (flag);
- ++gamecount;
- if (cscore < pscore) {
- if (glimit - cscore > 60) {
- msg("YOU DOUBLE SKUNKED ME!");
- pgames += 4;
- } else
- if (glimit - cscore > 30) {
- msg("YOU SKUNKED ME!");
- pgames += 2;
- } else {
- msg("YOU WON!");
- ++pgames;
- }
- iwon = FALSE;
- } else {
- if (glimit - pscore > 60) {
- msg("I DOUBLE SKUNKED YOU!");
- cgames += 4;
- } else
- if (glimit - pscore > 30) {
- msg("I SKUNKED YOU!");
- cgames += 2;
- } else {
- msg("I WON!");
- ++cgames;
- }
- iwon = TRUE;
- }
- gamescore();
-}
-
-/*
- * playhand:
- * Do up one hand of the game
- */
-int
-playhand(mycrib)
- BOOLEAN mycrib;
-{
- int deckpos;
-
- werase(Compwin);
-
- knownum = 0;
- deckpos = deal(mycrib);
- sorthand(chand, FULLHAND);
- sorthand(phand, FULLHAND);
- makeknown(chand, FULLHAND);
- prhand(phand, FULLHAND, Playwin, FALSE);
- discard(mycrib);
- if (cut(mycrib, deckpos))
- return TRUE;
- if (peg(mycrib))
- return TRUE;
- werase(Tablewin);
- wrefresh(Tablewin);
- if (score(mycrib))
- return TRUE;
- return FALSE;
-}
-
-/*
- * deal cards to both players from deck
- */
-int
-deal(mycrib)
- BOOLEAN mycrib;
-{
- int i, j;
-
- for (i = j = 0; i < FULLHAND; i++) {
- if (mycrib) {
- phand[i] = deck[j++];
- chand[i] = deck[j++];
- } else {
- chand[i] = deck[j++];
- phand[i] = deck[j++];
- }
- }
- return (j);
-}
-
-/*
- * discard:
- * Handle players discarding into the crib...
- * Note: we call cdiscard() after prining first message so player doesn't wait
- */
-void
-discard(mycrib)
- BOOLEAN mycrib;
-{
- char *prompt;
- CARD crd;
-
- prcrib(mycrib, TRUE);
- prompt = (quiet ? "Discard --> " : "Discard a card --> ");
- cdiscard(mycrib); /* puts best discard at end */
- crd = phand[infrom(phand, FULLHAND, prompt)];
- cremove(crd, phand, FULLHAND);
- prhand(phand, FULLHAND, Playwin, FALSE);
- crib[0] = crd;
-
- /* Next four lines same as last four except for cdiscard(). */
- crd = phand[infrom(phand, FULLHAND - 1, prompt)];
- cremove(crd, phand, FULLHAND - 1);
- prhand(phand, FULLHAND, Playwin, FALSE);
- crib[1] = crd;
- crib[2] = chand[4];
- crib[3] = chand[5];
- chand[4].rank = chand[4].suit = chand[5].rank = chand[5].suit = EMPTY;
-}
-
-/*
- * cut:
- * Cut the deck and set turnover. Actually, we only ASK the
- * player what card to turn. We do a random one, anyway.
- */
-int
-cut(mycrib, pos)
- BOOLEAN mycrib;
- int pos;
-{
- int i;
- BOOLEAN win;
-
- win = FALSE;
- if (mycrib) {
- if (!rflag) { /* random cut */
- msg(quiet ? "Cut the deck? " :
- "How many cards down do you wish to cut the deck? ");
- getline();
- }
- i = random() % (CARDS - pos);
- turnover = deck[i + pos];
- addmsg(quiet ? "You cut " : "You cut the ");
- msgcard(turnover, FALSE);
- endmsg();
- if (turnover.rank == JACK) {
- msg("I get two for his heels");
- win = chkscr(&cscore, 2);
- }
- } else {
- i = random() % (CARDS - pos) + pos;
- turnover = deck[i];
- addmsg(quiet ? "I cut " : "I cut the ");
- msgcard(turnover, FALSE);
- endmsg();
- if (turnover.rank == JACK) {
- msg("You get two for his heels");
- win = chkscr(&pscore, 2);
- }
- }
- makeknown(&turnover, 1);
- prcrib(mycrib, FALSE);
- return (win);
-}
-
-/*
- * prcrib:
- * Print out the turnover card with crib indicator
- */
-void
-prcrib(mycrib, blank)
- BOOLEAN mycrib, blank;
-{
- int y, cardx;
-
- if (mycrib)
- cardx = CRIB_X;
- else
- cardx = 0;
-
- mvaddstr(CRIB_Y, cardx + 1, "CRIB");
- prcard(stdscr, CRIB_Y + 1, cardx, turnover, blank);
-
- if (mycrib)
- cardx = 0;
- else
- cardx = CRIB_X;
-
- for (y = CRIB_Y; y <= CRIB_Y + 5; y++)
- mvaddstr(y, cardx, " ");
-}
-
-/*
- * peg:
- * Handle all the pegging...
- */
-static CARD Table[14];
-static int Tcnt;
-
-int
-peg(mycrib)
- BOOLEAN mycrib;
-{
- static CARD ch[CINHAND], ph[CINHAND];
- int i, j, k;
- int l;
- int cnum, pnum, sum;
- BOOLEAN myturn, mego, ugo, last, played;
- CARD crd;
-
- cnum = pnum = CINHAND;
- for (i = 0; i < CINHAND; i++) { /* make copies of hands */
- ch[i] = chand[i];
- ph[i] = phand[i];
- }
- Tcnt = 0; /* index to table of cards played */
- sum = 0; /* sum of cards played */
- played = mego = ugo = FALSE;
- myturn = !mycrib;
- for (;;) {
- last = TRUE; /* enable last flag */
- prhand(ph, pnum, Playwin, FALSE);
- prhand(ch, cnum, Compwin, TRUE);
- prtable(sum);
- if (myturn) { /* my tyrn to play */
- if (!anymove(ch, cnum, sum)) { /* if no card to play */
- if (!mego && cnum) { /* go for comp? */
- msg("GO");
- mego = TRUE;
- }
- /* can player move? */
- if (anymove(ph, pnum, sum))
- myturn = !myturn;
- else { /* give him his point */
- msg(quiet ? "You get one" :
- "You get one point");
- if (chkscr(&pscore, 1))
- return TRUE;
- sum = 0;
- mego = ugo = FALSE;
- Tcnt = 0;
- }
- } else {
- played = TRUE;
- j = -1;
- k = 0;
- /* maximize score */
- for (i = 0; i < cnum; i++) {
- l = pegscore(ch[i], Table, Tcnt, sum);
- if (l > k) {
- k = l;
- j = i;
- }
- }
- if (j < 0) /* if nothing scores */
- j = cchose(ch, cnum, sum);
- crd = ch[j];
- cremove(crd, ch, cnum--);
- sum += VAL(crd.rank);
- Table[Tcnt++] = crd;
- if (k > 0) {
- addmsg(quiet ? "I get %d playing " :
- "I get %d points playing ", k);
- msgcard(crd, FALSE);
- endmsg();
- if (chkscr(&cscore, k))
- return TRUE;
- }
- myturn = !myturn;
- }
- } else {
- if (!anymove(ph, pnum, sum)) { /* can player move? */
- if (!ugo && pnum) { /* go for player */
- msg("You have a GO");
- ugo = TRUE;
- }
- /* can computer play? */
- if (anymove(ch, cnum, sum))
- myturn = !myturn;
- else {
- msg(quiet ? "I get one" :
- "I get one point");
- do_wait();
- if (chkscr(&cscore, 1))
- return TRUE;
- sum = 0;
- mego = ugo = FALSE;
- Tcnt = 0;
- }
- } else { /* player plays */
- played = FALSE;
- if (pnum == 1) {
- crd = ph[0];
- msg("You play your last card");
- } else
- for (;;) {
- prhand(ph,
- pnum, Playwin, FALSE);
- crd = ph[infrom(ph,
- pnum, "Your play: ")];
- if (sum + VAL(crd.rank) <= 31)
- break;
- else
- msg("Total > 31 -- try again");
- }
- makeknown(&crd, 1);
- cremove(crd, ph, pnum--);
- i = pegscore(crd, Table, Tcnt, sum);
- sum += VAL(crd.rank);
- Table[Tcnt++] = crd;
- if (i > 0) {
- msg(quiet ? "You got %d" :
- "You got %d points", i);
- if (chkscr(&pscore, i))
- return TRUE;
- }
- myturn = !myturn;
- }
- }
- if (sum >= 31) {
- if (!myturn)
- do_wait();
- sum = 0;
- mego = ugo = FALSE;
- Tcnt = 0;
- last = FALSE; /* disable last flag */
- }
- if (!pnum && !cnum)
- break; /* both done */
- }
- prhand(ph, pnum, Playwin, FALSE);
- prhand(ch, cnum, Compwin, TRUE);
- prtable(sum);
- if (last) {
- if (played) {
- msg(quiet ? "I get one for last" :
- "I get one point for last");
- do_wait();
- if (chkscr(&cscore, 1))
- return TRUE;
- } else {
- msg(quiet ? "You get one for last" :
- "You get one point for last");
- if (chkscr(&pscore, 1))
- return TRUE;
- }
- }
- return (FALSE);
-}
-
-/*
- * prtable:
- * Print out the table with the current score
- */
-void
-prtable(score)
- int score;
-{
- prhand(Table, Tcnt, Tablewin, FALSE);
- mvwprintw(Tablewin, (Tcnt + 2) * 2, Tcnt + 1, "%2d", score);
- wrefresh(Tablewin);
-}
-
-/*
- * score:
- * Handle the scoring of the hands
- */
-int
-score(mycrib)
- BOOLEAN mycrib;
-{
- sorthand(crib, CINHAND);
- if (mycrib) {
- if (plyrhand(phand, "hand"))
- return (TRUE);
- if (comphand(chand, "hand"))
- return (TRUE);
- do_wait();
- if (comphand(crib, "crib"))
- return (TRUE);
- } else {
- if (comphand(chand, "hand"))
- return (TRUE);
- if (plyrhand(phand, "hand"))
- return (TRUE);
- if (plyrhand(crib, "crib"))
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/games/cribbage/cribbage.6 b/games/cribbage/cribbage.6
deleted file mode 100644
index 14e9755..0000000
--- a/games/cribbage/cribbage.6
+++ /dev/null
@@ -1,130 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)cribbage.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH CRIBBAGE 6 "May 31, 1993"
-.UC 4
-.SH NAME
-cribbage \- the card game cribbage
-.SH SYNOPSIS
-.B /usr/games/cribbage
-[
-.B \-req
-]
-.I name ...
-.SH DESCRIPTION
-.I Cribbage
-plays the card game cribbage, with the program playing one hand
-and the user the other. The program will initially ask the user if
-the rules of the game are needed \- if so, it will print out
-the appropriate section from
-.I According to Hoyle
-with
-.I more (I).
-.PP
-.I Cribbage
-options include:
-.TP
-.B \-e
-When the player makes a mistake scoring his hand or crib, provide an
-explanation of the correct score. (This is especially useful for
-beginning players.)
-.TP
-.B \-q
-Print a shorter form of all messages \- this is only recommended for
-users who have played the game without specifying this option.
-.TP
-.B \-r
-Instead of asking the player to cut the deck, the program will randomly
-cut the deck.
-.PP
-.I Cribbage
-first asks the player whether he wishes to play a short game
-(\*(lqonce around\*(rq, to 61) or a long game (\*(lqtwice around\*(rq, to 121). A
-response of `s' will result in a short game, any other response will
-play a long game.
-.PP
-At the start of the first game, the program
-asks the player to cut the deck to determine who gets the
-first crib. The user should respond with a number between 0 and
-51, indicating how many cards down the deck is to be cut. The player
-who cuts the lower ranked card gets the first crib.
-If more than one game is played, the
-loser of the previous game gets the first crib in the current game.
-.PP
-For each hand, the program first prints the player's hand,
-whose crib it is, and then asks the player
-to discard two cards into the crib. The cards are prompted for
-one per line, and are typed as explained below.
-.PP
-After discarding, the program cuts the deck (if it is the player's
-crib) or asks the player to cut the deck (if it's its crib); in the latter
-case, the appropriate response is a number from 0 to 39 indicating
-how far down the remaining 40 cards are to be cut.
-.PP
-After cutting the deck, play starts with the non-dealer (the person
-who doesn't have the crib) leading the first card.
-Play continues, as per cribbage, until all cards are exhausted. The
-program keeps track of the scoring of all points and the total of
-the cards on the table.
-.PP
-After play, the hands are scored. The program requests the player to
-score his hand (and the crib, if it is his) by printing out the
-appropriate cards (and the cut card enclosed in brackets).
-Play continues until one player reaches the game limit (61 or 121).
-.PP
-A carriage return when a numeric input is expected is equivalent
-to typing the lowest legal value; when cutting the deck this
-is equivalent to choosing the top card.
-.PP
-Cards are specified as rank followed by suit. The ranks may be specified
-as one of:
-`a', `2', `3', `4', `5', `6', `7', `8', `9', `t', `j', `q', and `k',
-or alternatively, one of: \*(lqace\*(rq, \*(lqtwo\*(rq, \*(lqthree\*(rq, \*(lqfour\*(rq, \*(lqfive\*(rq, \*(lqsix\*(rq,
-\*(lqseven\*(rq, \*(lqeight\*(rq, \*(lqnine\*(rq, \*(lqten\*(rq, \*(lqjack\*(rq, \*(lqqueen\*(rq, and \*(lqking\*(rq.
-Suits may be specified as: `s', `h', `d', and `c', or alternatively as:
-\*(lqspades\*(rq, \*(lqhearts\*(rq, \*(lqdiamonds\*(rq, and \*(lqclubs\*(rq.
-A card may be specified as: <rank> \*(lq \*(rq <suit>, or: <rank> \*(lq of \*(rq <suit>.
-If the single letter rank and suit designations are used, the space
-separating the suit and rank may be left out. Also, if only one card
-of the desired rank is playable, typing the rank is sufficient.
-For example, if your hand was \*(lq2H, 4D, 5C, 6H, JC, KD\*(rq and it was
-desired to discard the king of diamonds, any of the following could be typed:
-\*(lqk\*(rq, \*(lqking\*(rq, \*(lqkd\*(rq, \*(lqk d\*(rq, \*(lqk of d\*(rq, \*(lqking d\*(rq, \*(lqking of d\*(rq, \*(lqk diamonds\*(rq,
-\*(lqk of diamonds\*(rq, \*(lqking diamonds\*(rq, or \*(lqking of diamonds\*(rq.
-.SH FILES
-.ta 2i
-/usr/games/cribbage
-.SH AUTHORS
-Earl T. Cohen wrote the logic.
-Ken Arnold added the screen oriented interface.
diff --git a/games/cribbage/cribbage.h b/games/cribbage/cribbage.h
deleted file mode 100644
index 4a09a23..0000000
--- a/games/cribbage/cribbage.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cribbage.h 8.1 (Berkeley) 5/31/93
- */
-
-#include <sys/cdefs.h>
-
-__FBSDID("$FreeBSD$");
-
-extern CARD deck[ CARDS ]; /* a deck */
-extern CARD phand[ FULLHAND ]; /* player's hand */
-extern CARD chand[ FULLHAND ]; /* computer's hand */
-extern CARD crib[ CINHAND ]; /* the crib */
-extern CARD turnover; /* the starter */
-
-extern CARD known[ CARDS ]; /* cards we have seen */
-extern int knownum; /* # of cards we know */
-
-extern int pscore; /* player's score */
-extern int cscore; /* comp's score */
-extern int glimit; /* points to win game */
-
-extern int pgames; /* player's games won */
-extern int cgames; /* comp's games won */
-extern int gamecount; /* # games played */
-extern int Lastscore[2]; /* previous score for each */
-
-extern BOOLEAN iwon; /* if comp won last */
-extern BOOLEAN explain; /* player mistakes explained */
-extern BOOLEAN rflag; /* if all cuts random */
-extern BOOLEAN quiet; /* if suppress random mess */
-extern BOOLEAN playing; /* currently playing game */
-
-extern char expl[]; /* string for explanation */
-
-void addmsg(const char *, ...) __printflike(1, 2);
-int adjust(CARD [], CARD);
-int anymove(CARD [], int, int);
-int anysumto(CARD [], int, int, int);
-void bye(void);
-int cchose(CARD [], int, int);
-void cdiscard(BOOLEAN);
-int chkscr(int *, int);
-int comphand(CARD [], char *);
-void cremove(CARD, CARD [], int);
-int cut(BOOLEAN, int);
-int deal(int);
-void discard(BOOLEAN);
-void do_wait(void);
-void endmsg(void);
-int eq(CARD, CARD);
-int fifteens(CARD [], int);
-void game(void);
-void gamescore(void);
-char *getline(void);
-int getuchar(void);
-int incard(CARD *);
-int infrom(CARD [], int, char *);
-void instructions(void);
-int isone(CARD, CARD [], int);
-void makeboard(void);
-void makedeck(CARD []);
-void makeknown(CARD [], int);
-void msg(const char *, ...) __printflike(1, 2);
-int msgcard(CARD, BOOLEAN);
-int msgcrd(CARD, BOOLEAN, char *, BOOLEAN);
-int number(int, int, char *);
-int numofval(CARD [], int, int);
-int pairuns(CARD [], int);
-int peg(BOOLEAN);
-int pegscore(CARD, CARD [], int, int);
-int playhand(BOOLEAN);
-int plyrhand(CARD [], char *);
-void prcard(WINDOW *, int, int, CARD, BOOLEAN);
-void prcrib(BOOLEAN, BOOLEAN);
-void prhand(CARD [], int, WINDOW *, BOOLEAN);
-void printcard(WINDOW *, int, CARD, BOOLEAN);
-void prpeg(int, int, BOOLEAN);
-void prtable(int);
-int readchar(void);
-void rint(int);
-int score(BOOLEAN);
-int scorehand(CARD [], CARD, int, BOOLEAN, BOOLEAN);
-void shuffle(CARD []);
-void sorthand(CARD [], int);
-void wait_for(int);
diff --git a/games/cribbage/cribbage.n b/games/cribbage/cribbage.n
deleted file mode 100644
index 084e091..0000000
--- a/games/cribbage/cribbage.n
+++ /dev/null
@@ -1,226 +0,0 @@
-
- CRIBBAGE
- from
- According to Hoyle
-
-Cribbage is believed to have been invented by Sir John Suckling (1609-1642).
-Probably it is an elaboration of an older game, Noddy. The original game
-was played with hands of five cards; the modern game gives each player
-six. That is virtually the only change from Suckling's directions.
-
-Players:
-
- Two. There are variants for three and four players, described
- later.
-
-Cards:
-
- The pack of 52. The cards in each suit rank: K (high), Q, J, 10,
-9, 8, 7, 6, 5, 4, 3, 2, A. The counting values are: K, Q, J, 10, each 10
-(wherefore these are called tenth cards); ace, 1; each other card, its
-index value.
-
-Cribbage Board:
-
- Indispensable to scoring (unless you have a computer!, ed.) is
-the device known as the cribbage board. This is a rectangular panel, long
-and narrow, in which are four rows of 30 holes each. (See illustration.)
-At one end, or in the center, are two or four additional holes, called
-game holes. The board is placed between the two players, and each keeps
-his own score on the two rows of holes nearest himself. Each is supplied
-with two pegs. Before the first hand, the pegs are placed in the game
-holes. On making his first score, the player advances one peg an
-appropriate number of holes (one per point) away from the game end of the
-board. The second score is recorded by placing the second peg an
-appropriate distance ahead of the first. For each subsequent score, the
-rear peg is jumped ahead of the other, the distance between the two pegs
-always showing the amount of this last score.
-
- The traditional mode of scoring is down (away from the game end)
-the outer row, and up the inner row. "Once around" is a game of 61 points.
-"Twice around" is a game of 121 points.
-
-Preliminaries:
-
- Cards are drawn; the lower deals first. If cards of equal rank
-are drawn, both players draw again. Dealer has the right to shuffle last.
-Nondealer cuts, and must leave at least four cards in each packet.
-
-Dealing:
-
- Each player receives six cards, dealt one at a time face down,
-beginning with the nondealer. The turn to deal alternates. The dealer
-has an advantage.
-
-Laying Away:
-
- After seeing his hand, each player lays away two cards face down.
-The four cards laid away, placed in one pile, form the crib. The crib
-counts for the dealer. Nondealer therefore tries to lay away balking
-cards -- cards that are least likely to create a score in the crib.
-
-The Starter:
-
- After both hands have laid away, nondealer lifts off a packet from
-the top of the stock (the rest of the pack). Again, each packet must
-contain at least four cards. Dealer turns up the top card of the lower
-packer, which is then placed on top of the stock when the packets are
-reunited. The card thus turned up is called 1 the starter. If it is a
-jack, dealer immediately pegs 2, called 2 for his heels.
-
-The Play:
-
- Nondealer begins the play by laying a card from his hand face up
-on the table, announcing its counting value. Dealer then shows a card,
-announcing the total count of the two cards. Play continues in the same
-way, by alternate exposure of cards, each player announcing the new total
-count. The total may be carried only to 31, no further. If a player adds
-a card that brings the total exactly to 31, he pegs 2. If a player is
-unable to play another card without exceeding 31, he must say "Go," and
-his opponent pegs 1, but before doing so, opponent must lay down any
-additional cards he can without exceeding 31. If such additional cards
-bring the total to exactly 31, he pegs 2 instead of 1.
-
- Whenever a go occurs, the opponent of the player who played the
-last card must lead for a new count starting at zero. Playing the last
-card of all counts as a go. (Since nondealer makes the opening lead,
-dealer is bound to peg at least 1 in play.)
-
- Besides pegging for 31 and go, the player may also peg for certain
-combinations made in play, as follows:
-
- Fifteen:
- Making the count total 15 pegs 2.
- Pair:
- Playing a card of same rank as that previously played pegs
- 2. Playing a third card of the same rank makes pair royal
- and pegs 6. Playing the fourth card of the same rank
- makes double pair royal and pegs 12.
-
- The tenth cards pair strictly by rank, a king with a king,
- a queen with a queen, and so on. (King and jack do not
- make a pair, although each has the counting value 10.)
- Run:
- Playing a card which, with the two or more played
- immediately previously, makes a sequence of three or more
- cards, pegs 1 for each card in the run. Runs depend on
- rank alone; the suits do not matter. Nor does the score
- for run depend upon playing the cards in strict sequence,
- so long as the three or more last cards played can be
- arranged in a run. Example: 7, 6, 8 played in that order
- score 3 for run; 5, 2, 4, 3 played in that order score 4
- for run.
-
- Any of the foregoing combinations count, whether the cards
- are played alternately or one player plays several times
- in succession in consequence of a go. But a combination
- does not score if it is interrupted by a go.
-
- Showing:
- After the play, the hands are shown (counted). Nondealer
- shows first, then dealer's hand, then crib. The starter
- is deemed to belong to each hand, so that each hand includes
- five cards. Combinations of scoring value are as follows:
-
- Fifteen:
- Each combinations of two or more cards that total
- fifteen scores 2.
- Pair:
- Each pair of cards of the same rank scores 2.
-
- Run:
- Each combination of three or more cards in sequence
- scores 1 for each card in the run.
- Flush:
- Four cards of the same suit in hand score 4; four
- cards in hand or crib of same suit as the starter
- score 5. (No count for four-flush in crib.)
- His Nobs:
- Jack of same suit as the starter, in hand or crib,
- scores 1.
-
- It is important to note that every separate grouping of cards that
-makes a fifteen, pair, or run counts separately. Three of a kind, pair
-royal, counts 6 because three sets of pairs can be made; similarly, four
-of a kind, double pair royal, contain six pairs and count 12.
-
- The highest possible hand is J, 5, 5, 5 with the starter the 5 of
-the same suit as the jack. There are four fifteens by combining the jack
-with a five, four more by combinations of three fives (a total of 16 for
-fifteens); the double pair royal adds 12 for a total of 28; and his nobs
-adds 1 for a maximum score of 29. (the score of 2 for his heels does not
-count in the total of the hand, since it is pegged before the play.)
-
- A double run is a run with one card duplicated, as 4-3-3-2.
-Exclusive of fifteens, a double run of three cards counts 8; of four cards,
-10. A triple run is a run of three with one card triplicated, as K-K-K-Q-J.
-Exclusive of fifteens, it counts 15. A quadruple run is a run of three
-with two different cards duplicated, as the example 8-8-7-6-6 previously
-given. Exclusive of fifteens, it counts 16.
-
- No hand can be constructed that counts 19, 25, 26 or 27. A
-time-honored way of showing a hand with not a single counting combination
-is to say "I have nineteen."
-
- The customary order in showing is to count fifteens first, then
-runs, then pairs, but there is no compulsion of law. Example: A hand
-(with starter) of 9-6-5-4-4 will usually be counted "Fifteen 2, fifteen
-4, fifteen 6 and double run makes 14," or simply "Fifteen 6 and 8 is 14."
-
-Muggins:
-
- The hands and crib are counted aloud, and if a player claims a
-greater total than is due him, his opponent may require correction. In
-some localities, if a player claims less than is due, his opponent may
-say "Muggins" and himself score the points overlooked.
-
-Scoring:
-
- The usual game is 121, but it may be set at 61 by agreement.
-Since the player wins who first returns to the game hole by going "twice
-around," the scores must be pegged strictly in order: his heels, pegging
-in play, non-dealer's hand, dealer's hand, crib. Thus, if nondealer goes
-out on showing his hand, he wins, even though dealer might have gone out
-with a greater total if allowed to count his hand and crib.
-
- When the game of 121 is played for a stake, a player wins a single
-game if the loser makes 61 points or more. If the loser fails to reach
-61, he is lurched, and the other wins a double game.
-
-Irregularities:
-
- Misdeal. There must be a new deal by the same dealer if a card
-is found faced in the pack, if a card is exposed in dealing, or if the
-pack be found imperfect.
-
- Wrong Number of Cards. If one hand (not crib) is found to have
-the wrong number of cards after laying away for the crib, the other hand
-and crib being correct, the opponent may either demand a new deal or may
-peg 2 and rectify the hand. If the crib is incorrect, both hands being
-correct, nondealer pegs 2 and the crib is corrected.
-
-Error in Pegging:
-
- If a player places a peg short of the amount to which he is
-entitled, he may not correct his error after he has played the next card
-or after the cut for the next deal. If he pegs more than his announced
-score, the error must be corrected on demand at any time before the cut
-for the next deal and his opponent pegs 2.
-
-Strategy:
-
- The best balking cards are kings and aces, because they have the
-least chance of producing sequences. Tenth cards are generally good,
-provided that the two cards laid away are not too near (likely to make a
-sequence). When nothing better offers, give two wide cards -- at least
-three apart in rank.
-
- Proverbially the safest lead is a 4. The next card cannot make
-a 15. Lower cards are also safe from this point of view, but are better
-treasured for go and 31. The most dangerous leads are 7 and 8, but may
-be made to trap the opponent when they are backed with other close cards.
-Generally speaking, play on (toward a sequence) when you have close cards
-and off when you do not. However, the state of the score is a
-consideration. If far behind, play on when there is any chance of building
-a score for yourself; if well ahead, balk your opponent by playing off
-unless you will surely peg as much as he by playing on.
diff --git a/games/cribbage/cribcur.h b/games/cribbage/cribcur.h
deleted file mode 100644
index 5e8bfd4..0000000
--- a/games/cribbage/cribcur.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cribcur.h 8.1 (Berkeley) 5/31/93
- */
-
-# define PLAY_Y 15 /* size of player's hand window */
-# define PLAY_X 12
-# define TABLE_Y 21 /* size of table window */
-# define TABLE_X 14
-# define COMP_Y 15 /* size of computer's hand window */
-# define COMP_X 12
-# define Y_SCORE_SZ 9 /* Y size of score board */
-# define X_SCORE_SZ 41 /* X size of score board */
-# define SCORE_Y 0 /* starting position of scoring board */
-# define SCORE_X (PLAY_X + TABLE_X + COMP_X)
-# define CRIB_Y 17 /* position of crib (cut card) */
-# define CRIB_X (PLAY_X + TABLE_X)
-# define MSG_Y (LINES - (Y_SCORE_SZ + 1))
-# define MSG_X (COLS - SCORE_X - 1)
-# define Y_MSG_START (Y_SCORE_SZ + 1)
-
-# define PEG '*' /* what a peg looks like on the board */
-
-extern WINDOW *Compwin; /* computer's hand window */
-extern WINDOW *Msgwin; /* message window */
-extern WINDOW *Playwin; /* player's hand window */
-extern WINDOW *Tablewin; /* table window */
diff --git a/games/cribbage/deck.h b/games/cribbage/deck.h
deleted file mode 100644
index 2479ecf..0000000
--- a/games/cribbage/deck.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)deck.h 8.1 (Berkeley) 5/31/93
- * $FreeBSD$
- */
-
-/*
- * define structure of a deck of cards and other related things
- */
-
-
-#define CARDS 52 /* number cards in deck */
-#define RANKS 13 /* number ranks in deck */
-#define SUITS 4 /* number suits in deck */
-
-#define CINHAND 4 /* # cards in cribbage hand */
-#define FULLHAND 6 /* # cards in dealt hand */
-
-#define LGAME 121 /* number points in a game */
-#define SGAME 61 /* # points in a short game */
-
-#define SPADES 0 /* value of each suit */
-#define HEARTS 1
-#define DIAMONDS 2
-#define CLUBS 3
-
-#define ACE 0 /* value of each rank */
-#define TWO 1
-#define THREE 2
-#define FOUR 3
-#define FIVE 4
-#define SIX 5
-#define SEVEN 6
-#define EIGHT 7
-#define NINE 8
-#define TEN 9
-#define JACK 10
-#define QUEEN 11
-#define KING 12
-#define EMPTY 13
-
-#define VAL(c) ( (c) < 9 ? (c)+1 : 10 ) /* val of rank */
-
-
-#ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-#endif
-
-typedef struct {
- int rank;
- int suit;
- } CARD;
-
-typedef bool BOOLEAN;
-
diff --git a/games/cribbage/extern.c b/games/cribbage/extern.c
deleted file mode 100644
index 97516df..0000000
--- a/games/cribbage/extern.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <curses.h>
-
-#include "deck.h"
-#include "cribbage.h"
-
-bool explain = FALSE; /* player mistakes explained */
-bool iwon = FALSE; /* if comp won last game */
-bool quiet = FALSE; /* if suppress random mess */
-bool rflag = FALSE; /* if all cuts random */
-
-char expl[128]; /* explanation */
-
-int cgames = 0; /* number games comp won */
-int cscore = 0; /* comp score in this game */
-int gamecount = 0; /* number games played */
-int glimit = LGAME; /* game playe to glimit */
-int knownum = 0; /* number of cards we know */
-int pgames = 0; /* number games player won */
-int pscore = 0; /* player score in this game */
-
-CARD chand[FULLHAND]; /* computer's hand */
-CARD crib[CINHAND]; /* the crib */
-CARD deck[CARDS]; /* a deck */
-CARD known[CARDS]; /* cards we have seen */
-CARD phand[FULLHAND]; /* player's hand */
-CARD turnover; /* the starter */
-
-WINDOW *Compwin; /* computer's hand window */
-WINDOW *Msgwin; /* messages for the player */
-WINDOW *Playwin; /* player's hand window */
-WINDOW *Tablewin; /* table window */
diff --git a/games/cribbage/instr.c b/games/cribbage/instr.c
deleted file mode 100644
index ed06ce8..0000000
--- a/games/cribbage/instr.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)instr.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-
-#include <curses.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "deck.h"
-#include "cribbage.h"
-#include "pathnames.h"
-
-void
-instructions()
-{
- struct stat sb;
- pid_t pid;
- int pstat;
- char *pager, *path;
-
- if (stat(_PATH_INSTR, &sb)) {
- (void)fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR,
- strerror(errno));
- exit(1);
- }
- switch (pid = vfork()) {
- case -1:
- (void)fprintf(stderr, "cribbage: %s.\n", strerror(errno));
- exit(1);
- case 0:
- if (!(path = getenv("PAGER")))
- path = _PATH_MORE;
- if ((pager = rindex(path, '/')) != NULL)
- ++pager;
- pager = path;
- execlp(path, pager, _PATH_INSTR, (char *)NULL);
- (void)fprintf(stderr, "cribbage: %s.\n", strerror(errno));
- _exit(1);
- default:
- do {
- pid = waitpid(pid, (int *)&pstat, 0);
- } while (pid == -1 && errno == EINTR);
- if (pid == -1 || WEXITSTATUS(pstat) || WTERMSIG(pstat))
- exit(1);
- }
-}
diff --git a/games/cribbage/io.c b/games/cribbage/io.c
deleted file mode 100644
index fd30a08..0000000
--- a/games/cribbage/io.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <ctype.h>
-#include <curses.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-
-
-#include "deck.h"
-#include "cribbage.h"
-#include "cribcur.h"
-
-#define LINESIZE 128
-
-#ifdef CTRL
-#undef CTRL
-#endif
-#define CTRL(X) (X - 'A' + 1)
-
-char linebuf[LINESIZE];
-
-char *rankname[RANKS] = {
- "ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN",
- "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING"
-};
-
-char *rankchar[RANKS] = {
- "A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"
-};
-
-char *suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
-
-char *suitchar[SUITS] = {"S", "H", "D", "C"};
-
-/*
- * msgcard:
- * Call msgcrd in one of two forms
- */
-int
-msgcard(c, brief)
- CARD c;
- BOOLEAN brief;
-{
- if (brief)
- return (msgcrd(c, TRUE, NULL, TRUE));
- else
- return (msgcrd(c, FALSE, " of ", FALSE));
-}
-
-/*
- * msgcrd:
- * Print the value of a card in ascii
- */
-int
-msgcrd(c, brfrank, mid, brfsuit)
- CARD c;
- BOOLEAN brfrank, brfsuit;
- char *mid;
-{
- if (c.rank == EMPTY || c.suit == EMPTY)
- return (FALSE);
- if (brfrank)
- addmsg("%1.1s", rankchar[c.rank]);
- else
- addmsg("%s", rankname[c.rank]);
- if (mid != NULL)
- addmsg("%s", mid);
- if (brfsuit)
- addmsg("%1.1s", suitchar[c.suit]);
- else
- addmsg("%s", suitname[c.suit]);
- return (TRUE);
-}
-
-/*
- * printcard:
- * Print out a card.
- */
-void
-printcard(win, cardno, c, blank)
- WINDOW *win;
- int cardno;
- CARD c;
- BOOLEAN blank;
-{
- prcard(win, cardno * 2, cardno, c, blank);
-}
-
-/*
- * prcard:
- * Print out a card on the window at the specified location
- */
-void
-prcard(win, y, x, c, blank)
- WINDOW *win;
- int y, x;
- CARD c;
- BOOLEAN blank;
-{
- if (c.rank == EMPTY)
- return;
-
- mvwaddstr(win, y + 0, x, "+-----+");
- mvwaddstr(win, y + 1, x, "| |");
- mvwaddstr(win, y + 2, x, "| |");
- mvwaddstr(win, y + 3, x, "| |");
- mvwaddstr(win, y + 4, x, "+-----+");
- if (!blank) {
- mvwaddch(win, y + 1, x + 1, rankchar[c.rank][0]);
- waddch(win, suitchar[c.suit][0]);
- mvwaddch(win, y + 3, x + 4, rankchar[c.rank][0]);
- waddch(win, suitchar[c.suit][0]);
- }
-}
-
-/*
- * prhand:
- * Print a hand of n cards
- */
-void
-prhand(h, n, win, blank)
- CARD h[];
- int n;
- WINDOW *win;
- BOOLEAN blank;
-{
- int i;
-
- werase(win);
- for (i = 0; i < n; i++)
- printcard(win, i, *h++, blank);
- wrefresh(win);
-}
-
-/*
- * infrom:
- * reads a card, supposedly in hand, accepting unambigous brief
- * input, returns the index of the card found...
- */
-int
-infrom(hand, n, prompt)
- CARD hand[];
- int n;
- char *prompt;
-{
- int i, j;
- CARD crd;
-
- if (n < 1) {
- printf("\nINFROM: %d = n < 1!!\n", n);
- exit(74);
- }
- for (;;) {
- msg("%s", prompt);
- if (incard(&crd)) { /* if card is full card */
- if (!isone(crd, hand, n))
- msg("That's not in your hand");
- else {
- for (i = 0; i < n; i++)
- if (hand[i].rank == crd.rank &&
- hand[i].suit == crd.suit)
- break;
- if (i >= n) {
- printf("\nINFROM: isone or something messed up\n");
- exit(77);
- }
- return (i);
- }
- } else /* if not full card... */
- if (crd.rank != EMPTY) {
- for (i = 0; i < n; i++)
- if (hand[i].rank == crd.rank)
- break;
- if (i >= n)
- msg("No such rank in your hand");
- else {
- for (j = i + 1; j < n; j++)
- if (hand[j].rank == crd.rank)
- break;
- if (j < n)
- msg("Ambiguous rank");
- else
- return (i);
- }
- } else
- msg("Sorry, I missed that");
- }
- /* NOTREACHED */
-}
-
-/*
- * incard:
- * Inputs a card in any format. It reads a line ending with a CR
- * and then parses it.
- */
-int
-incard(crd)
- CARD *crd;
-{
- int i;
- int rnk, sut;
- char *line, *p, *p1;
- BOOLEAN retval;
-
- retval = FALSE;
- rnk = sut = EMPTY;
- if (!(line = getline()))
- goto gotit;
- p = p1 = line;
- while (*p1 != ' ' && *p1 != '\0')
- ++p1;
- *p1++ = '\0';
- if (*p == '\0')
- goto gotit;
-
- /* IMPORTANT: no real card has 2 char first name */
- if (strlen(p) == 2) { /* check for short form */
- rnk = EMPTY;
- for (i = 0; i < RANKS; i++) {
- if (*p == *rankchar[i]) {
- rnk = i;
- break;
- }
- }
- if (rnk == EMPTY)
- goto gotit; /* it's nothing... */
- ++p; /* advance to next char */
- sut = EMPTY;
- for (i = 0; i < SUITS; i++) {
- if (*p == *suitchar[i]) {
- sut = i;
- break;
- }
- }
- if (sut != EMPTY)
- retval = TRUE;
- goto gotit;
- }
- rnk = EMPTY;
- for (i = 0; i < RANKS; i++) {
- if (!strcmp(p, rankname[i]) || !strcmp(p, rankchar[i])) {
- rnk = i;
- break;
- }
- }
- if (rnk == EMPTY)
- goto gotit;
- p = p1;
- while (*p1 != ' ' && *p1 != '\0')
- ++p1;
- *p1++ = '\0';
- if (*p == '\0')
- goto gotit;
- if (!strcmp("OF", p)) {
- p = p1;
- while (*p1 != ' ' && *p1 != '\0')
- ++p1;
- *p1++ = '\0';
- if (*p == '\0')
- goto gotit;
- }
- sut = EMPTY;
- for (i = 0; i < SUITS; i++) {
- if (!strcmp(p, suitname[i]) || !strcmp(p, suitchar[i])) {
- sut = i;
- break;
- }
- }
- if (sut != EMPTY)
- retval = TRUE;
-gotit:
- (*crd).rank = rnk;
- (*crd).suit = sut;
- return (retval);
-}
-
-/*
- * getuchar:
- * Reads and converts to upper case
- */
-int
-getuchar()
-{
- int c;
-
- c = readchar();
- if (islower(c))
- c = toupper(c);
- waddch(Msgwin, c);
- return (c);
-}
-
-/*
- * number:
- * Reads in a decimal number and makes sure it is between "lo" and
- * "hi" inclusive.
- */
-int
-number(lo, hi, prompt)
- int lo, hi;
- char *prompt;
-{
- char *p;
- int sum;
-
- for (sum = 0;;) {
- msg("%s", prompt);
- if (!(p = getline()) || *p == '\0') {
- msg(quiet ? "Not a number" :
- "That doesn't look like a number");
- continue;
- }
- sum = 0;
-
- if (!isdigit(*p))
- sum = lo - 1;
- else
- while (isdigit(*p)) {
- sum = 10 * sum + (*p - '0');
- ++p;
- }
-
- if (*p != ' ' && *p != '\t' && *p != '\0')
- sum = lo - 1;
- if (sum >= lo && sum <= hi)
- break;
- if (sum == lo - 1)
- msg("that doesn't look like a number, try again --> ");
- else
- msg("%d is not between %d and %d inclusive, try again --> ",
- sum, lo, hi);
- }
- return (sum);
-}
-
-/*
- * msg:
- * Display a message at the top of the screen.
- */
-char Msgbuf[BUFSIZ] = {'\0'};
-int Mpos = 0;
-static int Newpos = 0;
-
-void
-msg(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- (void)vsprintf(&Msgbuf[Newpos], fmt, ap);
- va_end(ap);
- endmsg();
-}
-
-/*
- * addmsg:
- * Add things to the current message
- */
-void
-addmsg(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- (void)vsprintf(&Msgbuf[Newpos], fmt, ap);
- va_end(ap);
-}
-
-/*
- * endmsg:
- * Display a new msg.
- */
-int Lineno = 0;
-
-void
-endmsg()
-{
- static int lastline = 0;
- int len;
- char *mp, *omp;
-
- /* All messages should start with uppercase */
- mvaddch(lastline + Y_MSG_START, SCORE_X, ' ');
- if (islower(Msgbuf[0]) && Msgbuf[1] != ')')
- Msgbuf[0] = toupper(Msgbuf[0]);
- mp = Msgbuf;
- len = strlen(mp);
- if (len / MSG_X + Lineno >= MSG_Y) {
- while (Lineno < MSG_Y) {
- wmove(Msgwin, Lineno++, 0);
- wclrtoeol(Msgwin);
- }
- Lineno = 0;
- }
- mvaddch(Lineno + Y_MSG_START, SCORE_X, '*');
- lastline = Lineno;
- do {
- mvwaddstr(Msgwin, Lineno, 0, mp);
- if ((len = strlen(mp)) > MSG_X) {
- omp = mp;
- for (mp = &mp[MSG_X - 1]; *mp != ' '; mp--)
- continue;
- while (*mp == ' ')
- mp--;
- mp++;
- wmove(Msgwin, Lineno, mp - omp);
- wclrtoeol(Msgwin);
- }
- if (++Lineno >= MSG_Y)
- Lineno = 0;
- } while (len > MSG_X);
- wclrtoeol(Msgwin);
- Mpos = len;
- Newpos = 0;
- wrefresh(Msgwin);
- refresh();
- wrefresh(Msgwin);
-}
-
-/*
- * do_wait:
- * Wait for the user to type ' ' before doing anything else
- */
-void
-do_wait()
-{
- static char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'};
-
- if (Mpos + sizeof prompt < MSG_X)
- wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos);
- else {
- mvwaddch(Msgwin, Lineno, 0, ' ');
- wclrtoeol(Msgwin);
- if (++Lineno >= MSG_Y)
- Lineno = 0;
- }
- waddstr(Msgwin, prompt);
- wrefresh(Msgwin);
- wait_for(' ');
-}
-
-/*
- * wait_for
- * Sit around until the guy types the right key
- */
-void
-wait_for(ch)
- int ch;
-{
- char c;
-
- if (ch == '\n')
- while ((c = readchar()) != '\n')
- continue;
- else
- while (readchar() != ch)
- continue;
-}
-
-/*
- * readchar:
- * Reads and returns a character, checking for gross input errors
- */
-int
-readchar()
-{
- int cnt;
- char c;
-
-over:
- cnt = 0;
- while (read(STDIN_FILENO, &c, sizeof(char)) <= 0)
- if (cnt++ > 100) { /* if we are getting infinite EOFs */
- bye(); /* quit the game */
- exit(1);
- }
- if (c == CTRL('L')) {
- wrefresh(curscr);
- goto over;
- }
- if (c == '\r')
- return ('\n');
- else
- return (c);
-}
-
-/*
- * getline:
- * Reads the next line up to '\n' or EOF. Multiple spaces are
- * compressed to one space; a space is inserted before a ','
- */
-char *
-getline()
-{
- char *sp;
- int c, oy, ox;
- WINDOW *oscr;
-
- oscr = stdscr;
- stdscr = Msgwin;
- getyx(stdscr, oy, ox);
- refresh();
- /* loop reading in the string, and put it in a temporary buffer */
- for (sp = linebuf; (c = readchar()) != '\n'; clrtoeol(), refresh()) {
- if (c == -1)
- continue;
- else
- if (c == erasechar()) { /* process erase character */
- if (sp > linebuf) {
- int i;
-
- sp--;
- for (i = strlen(unctrl(*sp)); i; i--)
- addch('\b');
- }
- continue;
- } else
- if (c == killchar()) { /* process kill
- * character */
- sp = linebuf;
- move(oy, ox);
- continue;
- } else
- if (sp == linebuf && c == ' ')
- continue;
- if (sp >= &linebuf[LINESIZE - 1] || !(isprint(c) || c == ' '))
- putchar(CTRL('G'));
- else {
- if (islower(c))
- c = toupper(c);
- *sp++ = c;
- addstr(unctrl(c));
- Mpos++;
- }
- }
- *sp = '\0';
- stdscr = oscr;
- return (linebuf);
-}
-
-void
-rint(signo)
- int signo;
-{
- bye();
- exit(1);
-}
-
-/*
- * bye:
- * Leave the program, cleaning things up as we go.
- */
-void
-bye()
-{
- signal(SIGINT, SIG_IGN);
- mvcur(0, COLS - 1, LINES - 1, 0);
- fflush(stdout);
- endwin();
- putchar('\n');
-}
diff --git a/games/cribbage/pathnames.h b/games/cribbage/pathnames.h
deleted file mode 100644
index 5c30f73..0000000
--- a/games/cribbage/pathnames.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_INSTR "/usr/share/games/cribbage.instr"
-#define _PATH_LOG "/var/games/criblog"
-#define _PATH_MORE "/usr/bin/more"
diff --git a/games/cribbage/score.c b/games/cribbage/score.c
deleted file mode 100644
index a2a7d0b..0000000
--- a/games/cribbage/score.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <curses.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "deck.h"
-#include "cribbage.h"
-
-/*
- * the following arrays give the sum of the scores of the (50 2)*48 = 58800
- * hands obtainable for the crib given the two cards whose ranks index the
- * array. the two arrays are for the case where the suits are equal and
- * not equal respectively
- */
-long crbescr[169] = {
- -10000, 271827, 278883, 332319, 347769, 261129, 250653, 253203, 248259,
- 243435, 256275, 237435, 231051, -10000, -10000, 412815, 295707, 349497,
- 267519, 262521, 259695, 254019, 250047, 262887, 244047, 237663, -10000,
- -10000, -10000, 333987, 388629, 262017, 266787, 262971, 252729, 254475,
- 267315, 248475, 242091, -10000, -10000, -10000, -10000, 422097, 302787,
- 256437, 263751, 257883, 254271, 267111, 248271, 241887, -10000, -10000,
- -10000, -10000, -10000, 427677, 387837, 349173, 347985, 423861, 436701,
- 417861, 411477, -10000, -10000, -10000, -10000, -10000, -10000, 336387,
- 298851, 338667, 236487, 249327, 230487, 224103, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, 408483, 266691, 229803, 246195, 227355,
- 220971, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000,
- 300675, 263787, 241695, 226407, 220023, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, -10000, 295635, 273543, 219771, 216939,
- -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000,
- -10000, 306519, 252747, 211431, -10000, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, -10000, -10000, 304287, 262971, -10000,
- -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000,
- -10000, -10000, 244131, -10000, -10000, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, -10000, -10000, -10000
-};
-
-long crbnescr[169] = {
- 325272, 260772, 267828, 321264, 336714, 250074, 239598, 242148, 237204,
- 232380, 246348, 226380, 219996, -10000, 342528, 401760, 284652, 338442,
- 256464, 251466, 248640, 242964, 238992, 252960, 232992, 226608, -10000,
- -10000, 362280, 322932, 377574, 250962, 255732, 251916, 241674, 243420,
- 257388, 237420, 231036, -10000, -10000, -10000, 360768, 411042, 291732,
- 245382, 252696, 246828, 243216, 257184, 237216, 230832, -10000, -10000,
- -10000, -10000, 528768, 416622, 376782, 338118, 336930, 412806, 426774,
- 406806, 400422, -10000, -10000, -10000, -10000, -10000, 369864, 325332,
- 287796, 327612, 225432, 239400, 219432, 213048, -10000, -10000, -10000,
- -10000, -10000, -10000, 359160, 397428, 255636, 218748, 236268, 216300,
- 209916, -10000, -10000, -10000, -10000, -10000, -10000, -10000, 331320,
- 289620, 252732, 231768, 215352, 208968, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, 325152, 284580, 263616, 208716, 205884,
- -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000,
- 321240, 296592, 241692, 200376, -10000, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, -10000, 348600, 294360, 253044, -10000,
- -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000,
- -10000, 308664, 233076, -10000, -10000, -10000, -10000, -10000, -10000,
- -10000, -10000, -10000, -10000, -10000, -10000, 295896
-};
-
-static int ichoose2[5] = { 0, 0, 2, 6, 12 };
-static int pairpoints, runpoints; /* Globals from pairuns. */
-
-/*
- * scorehand:
- * Score the given hand of n cards and the starter card.
- * n must be <= 4
- */
-int
-scorehand(hand, starter, n, crb, do_explain)
- CARD hand[];
- CARD starter;
- int n;
- BOOLEAN crb; /* true if scoring crib */
- BOOLEAN do_explain; /* true if must explain this hand */
-{
- int i, k;
- int score;
- BOOLEAN flag;
- CARD h[(CINHAND + 1)];
- char buf[32];
-
- expl[0] = '\0'; /* initialize explanation */
- score = 0;
- flag = TRUE;
- k = hand[0].suit;
- for (i = 0; i < n; i++) { /* check for flush */
- flag = (flag && (hand[i].suit == k));
- if (hand[i].rank == JACK) /* check for his nibs */
- if (hand[i].suit == starter.suit) {
- score++;
- if (do_explain)
- strcat(expl, "His Nobs");
- }
- h[i] = hand[i];
- }
-
- if (flag && n >= CINHAND) {
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", ");
- if (starter.suit == k) {
- score += 5;
- if (do_explain)
- strcat(expl, "Five-flush");
- } else
- if (!crb) {
- score += 4;
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", Four-flush");
- else
- strcpy(expl, "Four-flush");
- }
- }
- if (do_explain && expl[0] != '\0')
- strcat(expl, ", ");
- h[n] = starter;
- sorthand(h, n + 1); /* sort by rank */
- i = 2 * fifteens(h, n + 1);
- score += i;
- if (do_explain) {
- if (i > 0) {
- (void) sprintf(buf, "%d points in fifteens", i);
- strcat(expl, buf);
- } else
- strcat(expl, "No fifteens");
- }
- i = pairuns(h, n + 1);
- score += i;
- if (do_explain) {
- if (i > 0) {
- (void) sprintf(buf, ", %d points in pairs, %d in runs",
- pairpoints, runpoints);
- strcat(expl, buf);
- } else
- strcat(expl, ", No pairs/runs");
- }
- return (score);
-}
-
-/*
- * fifteens:
- * Return number of fifteens in hand of n cards
- */
-int
-fifteens(hand, n)
- CARD hand[];
- int n;
-{
- int *sp, *np;
- int i;
- CARD *endp;
- static int sums[15], nsums[15];
-
- np = nsums;
- sp = sums;
- i = 16;
- while (--i) {
- *np++ = 0;
- *sp++ = 0;
- }
- for (endp = &hand[n]; hand < endp; hand++) {
- i = hand->rank + 1;
- if (i > 10)
- i = 10;
- np = &nsums[i];
- np[-1]++; /* one way to make this */
- sp = sums;
- while (i < 15) {
- *np++ += *sp++;
- i++;
- }
- sp = sums;
- np = nsums;
- i = 16;
- while (--i)
- *sp++ = *np++;
- }
- return sums[14];
-}
-
-/*
- * pairuns returns the number of points in the n card sorted hand
- * due to pairs and runs
- * this routine only works if n is strictly less than 6
- * sets the globals pairpoints and runpoints appropriately
- */
-int
-pairuns(h, n)
- CARD h[];
- int n;
-{
- int i;
- int runlength, runmult, lastmult, curmult;
- int mult1, mult2, pair1, pair2;
- BOOLEAN run;
-
- run = TRUE;
- runlength = 1;
- mult1 = 1;
- pair1 = -1;
- mult2 = 1;
- pair2 = -1;
- curmult = runmult = 1;
- for (i = 1; i < n; i++) {
- lastmult = curmult;
- if (h[i].rank == h[i - 1].rank) {
- if (pair1 < 0) {
- pair1 = h[i].rank;
- mult1 = curmult = 2;
- } else {
- if (h[i].rank == pair1) {
- curmult = ++mult1;
- } else {
- if (pair2 < 0) {
- pair2 = h[i].rank;
- mult2 = curmult = 2;
- } else {
- curmult = ++mult2;
- }
- }
- }
- if (i == (n - 1) && run) {
- runmult *= curmult;
- }
- } else {
- curmult = 1;
- if (h[i].rank == h[i - 1].rank + 1) {
- if (run) {
- ++runlength;
- } else {
- /* only if old short */
- if (runlength < 3) {
- run = TRUE;
- runlength = 2;
- runmult = 1;
- }
- }
- runmult *= lastmult;
- } else {
- /* if just ended */
- if (run)
- runmult *= lastmult;
- run = FALSE;
- }
- }
- }
- pairpoints = ichoose2[mult1] + ichoose2[mult2];
- runpoints = (runlength >= 3 ? runlength * runmult : 0);
- return (pairpoints + runpoints);
-}
-
-/*
- * pegscore tells how many points crd would get if played after
- * the n cards in tbl during pegging
- */
-int
-pegscore(crd, tbl, n, sum)
- CARD crd, tbl[];
- int n, sum;
-{
- BOOLEAN got[RANKS];
- int i, j, scr;
- int k, lo, hi;
-
- sum += VAL(crd.rank);
- if (sum > 31)
- return (-1);
- if (sum == 31 || sum == 15)
- scr = 2;
- else
- scr = 0;
- if (!n)
- return (scr);
- j = 1;
- while ((crd.rank == tbl[n - j].rank) && (n - j >= 0))
- ++j;
- if (j > 1)
- return (scr + ichoose2[j]);
- if (n < 2)
- return (scr);
- lo = hi = crd.rank;
- for (i = 0; i < RANKS; i++)
- got[i] = FALSE;
- got[crd.rank] = TRUE;
- k = -1;
- for (i = n - 1; i >= 0; --i) {
- if (got[tbl[i].rank])
- break;
- got[tbl[i].rank] = TRUE;
- if (tbl[i].rank < lo)
- lo = tbl[i].rank;
- if (tbl[i].rank > hi)
- hi = tbl[i].rank;
- for (j = lo; j <= hi; j++)
- if (!got[j])
- break;
- if (j > hi)
- k = hi - lo + 1;
- }
- if (k >= 3)
- return (scr + k);
- else
- return (scr);
-}
-
-/*
- * adjust takes a two card hand that will be put in the crib
- * and returns an adjusted normalized score for the number of
- * points such a crib will get.
- */
-int
-adjust(cb, tnv)
- CARD cb[], tnv;
-{
- long scr;
- int i, c0, c1;
-
- c0 = cb[0].rank;
- c1 = cb[1].rank;
- if (c0 > c1) {
- i = c0;
- c0 = c1;
- c1 = i;
- }
- if (cb[0].suit != cb[1].suit)
- scr = crbnescr[RANKS * c0 + c1];
- else
- scr = crbescr[RANKS * c0 + c1];
- if (scr <= 0) {
- printf("\nADJUST: internal error %d %d\n", c0, c1);
- exit(93);
- }
- return ((scr + 29400) / 58800);
-}
diff --git a/games/cribbage/support.c b/games/cribbage/support.c
deleted file mode 100644
index bc22ca6..0000000
--- a/games/cribbage/support.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*-
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <curses.h>
-#include <string.h>
-
-#include "deck.h"
-#include "cribbage.h"
-#include "cribcur.h"
-
-#define NTV 10 /* number scores to test */
-
-/* score to test reachability of, and order to test them in */
-int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
-
-/*
- * computer chooses what to play in pegging...
- * only called if no playable card will score points
- */
-int
-cchose(h, n, s)
- CARD h[];
- int n, s;
-{
- int i, j, l;
-
- if (n <= 1)
- return (0);
- if (s < 4) { /* try for good value */
- if ((j = anysumto(h, n, s, 4)) >= 0)
- return (j);
- if ((j = anysumto(h, n, s, 3)) >= 0 && s == 0)
- return (j);
- }
- if (s > 0 && s < 20) {
- /* try for retaliation to 31 */
- for (i = 1; i <= 10; i++) {
- if ((j = anysumto(h, n, s, 21 - i)) >= 0) {
- if ((l = numofval(h, n, i)) > 0) {
- if (l > 1 || VAL(h[j].rank) != i)
- return (j);
- }
- }
- }
- }
- if (s < 15) {
- /* for retaliation after 15 */
- for (i = 0; i < NTV; i++) {
- if ((j = anysumto(h, n, s, tv[i])) >= 0) {
- if ((l = numofval(h, n, 15 - tv[i])) > 0) {
- if (l > 1 ||
- VAL(h[j].rank) != 15 - tv[i])
- return (j);
- }
- }
- }
- }
- j = -1;
- /* remember: h is sorted */
- for (i = n - 1; i >= 0; --i) {
- l = s + VAL(h[i].rank);
- if (l > 31)
- continue;
- if (l != 5 && l != 10 && l != 21) {
- j = i;
- break;
- }
- }
- if (j >= 0)
- return (j);
- for (i = n - 1; i >= 0; --i) {
- l = s + VAL(h[i].rank);
- if (l > 31)
- continue;
- if (j < 0)
- j = i;
- if (l != 5 && l != 21) {
- j = i;
- break;
- }
- }
- return (j);
-}
-
-/*
- * plyrhand:
- * Evaluate and score a player hand or crib
- */
-int
-plyrhand(hand, s)
- CARD hand[];
- char *s;
-{
- static char prompt[BUFSIZ];
- int i, j;
- BOOLEAN win;
-
- prhand(hand, CINHAND, Playwin, FALSE);
- (void) sprintf(prompt, "Your %s scores ", s);
- i = scorehand(hand, turnover, CINHAND, strcmp(s, "crib") == 0, explain);
- if ((j = number(0, 29, prompt)) == 19)
- j = 0;
- if (i != j) {
- if (i < j) {
- win = chkscr(&pscore, i);
- msg("It's really only %d points; I get %d", i, 2);
- if (!win)
- win = chkscr(&cscore, 2);
- } else {
- win = chkscr(&pscore, j);
- msg("You should have taken %d, not %d!", i, j);
- }
- if (explain)
- msg("Explanation: %s", expl);
- do_wait();
- } else
- win = chkscr(&pscore, i);
- return (win);
-}
-
-/*
- * comphand:
- * Handle scoring and displaying the computers hand
- */
-int
-comphand(h, s)
- CARD h[];
- char *s;
-{
- int j;
-
- j = scorehand(h, turnover, CINHAND, strcmp(s, "crib") == 0, FALSE);
- prhand(h, CINHAND, Compwin, FALSE);
- msg("My %s scores %d", s, (j == 0 ? 19 : j));
- return (chkscr(&cscore, j));
-}
-
-/*
- * chkscr:
- * Add inc to scr and test for > glimit, printing on the scoring
- * board while we're at it.
- */
-int Lastscore[2] = {-1, -1};
-
-int
-chkscr(scr, inc)
- int *scr, inc;
-{
- BOOLEAN myturn;
-
- myturn = (scr == &cscore);
- if (inc != 0) {
- prpeg(Lastscore[myturn ? 1 : 0], '.', myturn);
- Lastscore[myturn ? 1 : 0] = *scr;
- *scr += inc;
- prpeg(*scr, PEG, myturn);
- refresh();
- }
- return (*scr >= glimit);
-}
-
-/*
- * prpeg:
- * Put out the peg character on the score board and put the
- * score up on the board.
- */
-void
-prpeg(score, peg, myturn)
- int score;
- int peg;
- BOOLEAN myturn;
-{
- int y, x;
-
- if (!myturn)
- y = SCORE_Y + 2;
- else
- y = SCORE_Y + 5;
-
- if (score <= 0 || score >= glimit) {
- if (peg == '.')
- peg = ' ';
- if (score == 0)
- x = SCORE_X + 2;
- else {
- x = SCORE_X + 2;
- y++;
- }
- } else {
- x = (score - 1) % 30;
- if (score > 90 || (score > 30 && score <= 60)) {
- y++;
- x = 29 - x;
- }
- x += x / 5;
- x += SCORE_X + 3;
- }
- mvaddch(y, x, peg);
- mvprintw(SCORE_Y + (myturn ? 7 : 1), SCORE_X + 10, "%3d", score);
-}
-
-/*
- * cdiscard -- the computer figures out what is the best discard for
- * the crib and puts the best two cards at the end
- */
-void
-cdiscard(mycrib)
- BOOLEAN mycrib;
-{
- CARD d[CARDS], h[FULLHAND], cb[2];
- int i, j, k;
- int nc, ns;
- long sums[15];
- static int undo1[15] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4};
- static int undo2[15] = {1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5};
-
- makedeck(d);
- nc = CARDS;
- for (i = 0; i < knownum; i++) { /* get all other cards */
- cremove(known[i], d, nc--);
- }
- for (i = 0; i < 15; i++)
- sums[i] = 0L;
- ns = 0;
- for (i = 0; i < (FULLHAND - 1); i++) {
- cb[0] = chand[i];
- for (j = i + 1; j < FULLHAND; j++) {
- cb[1] = chand[j];
- for (k = 0; k < FULLHAND; k++)
- h[k] = chand[k];
- cremove(chand[i], h, FULLHAND);
- cremove(chand[j], h, FULLHAND - 1);
- for (k = 0; k < nc; k++) {
- sums[ns] +=
- scorehand(h, d[k], CINHAND, TRUE, FALSE);
- if (mycrib)
- sums[ns] += adjust(cb, d[k]);
- else
- sums[ns] -= adjust(cb, d[k]);
- }
- ++ns;
- }
- }
- j = 0;
- for (i = 1; i < 15; i++)
- if (sums[i] > sums[j])
- j = i;
- for (k = 0; k < FULLHAND; k++)
- h[k] = chand[k];
- cremove(h[undo1[j]], chand, FULLHAND);
- cremove(h[undo2[j]], chand, FULLHAND - 1);
- chand[4] = h[undo1[j]];
- chand[5] = h[undo2[j]];
-}
-
-/*
- * returns true if some card in hand can be played without exceeding 31
- */
-int
-anymove(hand, n, sum)
- CARD hand[];
- int n, sum;
-{
- int i, j;
-
- if (n < 1)
- return (FALSE);
- j = hand[0].rank;
- for (i = 1; i < n; i++) {
- if (hand[i].rank < j)
- j = hand[i].rank;
- }
- return (sum + VAL(j) <= 31);
-}
-
-/*
- * anysumto returns the index (0 <= i < n) of the card in hand that brings
- * the s up to t, or -1 if there is none
- */
-int
-anysumto(hand, n, s, t)
- CARD hand[];
- int n, s, t;
-{
- int i;
-
- for (i = 0; i < n; i++) {
- if (s + VAL(hand[i].rank) == t)
- return (i);
- }
- return (-1);
-}
-
-/*
- * return the number of cards in h having the given rank value
- */
-int
-numofval(h, n, v)
- CARD h[];
- int n, v;
-{
- int i, j;
-
- j = 0;
- for (i = 0; i < n; i++) {
- if (VAL(h[i].rank) == v)
- ++j;
- }
- return (j);
-}
-
-/*
- * makeknown remembers all n cards in h for future recall
- */
-void
-makeknown(h, n)
- CARD h[];
- int n;
-{
- int i;
-
- for (i = 0; i < n; i++)
- known[knownum++] = h[i];
-}
diff --git a/games/dm/Makefile b/games/dm/Makefile
deleted file mode 100644
index 827352b..0000000
--- a/games/dm/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-# -DLOG log games
-PROG= dm
-MAN= dm.8 dm.conf.5
-BINGRP= games
-BINMODE=2555
-
-.include <bsd.prog.mk>
diff --git a/games/dm/dm.8 b/games/dm/dm.8
deleted file mode 100644
index 3c9600b..0000000
--- a/games/dm/dm.8
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1987, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)dm.8 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt DM 8
-.Os
-.Sh NAME
-.Nm dm
-.Nd dungeon master
-.Sh SYNOPSIS
-.Nm ln
-.Fl s Cm dm Ar game
-.Sh DESCRIPTION
-.Nm Dm
-is a program used to regulate game playing.
-.Nm Dm
-expects to be invoked with the name of a game that a user wishes to play.
-This is done by creating symbolic links to
-.Nm ,
-in the directory
-.Pa /usr/games
-for all of the regulated games.
-The actual binaries for these games should be placed in a
-.Dq hidden
-directory,
-.Pa /usr/games/hide ,
-that may only be accessed by the
-.Nm
-program.
-.Nm Dm
-determines if the requested game is available and, if so, runs it.
-The file
-.Pa /etc/dm.conf
-controls the conditions under which games may
-be run.
-.Pp
-The file
-.Pa /etc/nogames
-may be used to
-.Dq turn off
-game playing.
-If the file exists, no game playing is allowed; the contents of the file
-will be displayed to any user requesting a game.
-.Sh FILES
-.Bl -tag -width /var/log/games.log -compact
-.It Pa /etc/dm.conf
-configuration file
-.It Pa /etc/nogames
-turns off game playing
-.It Pa /usr/games/hide
-directory of ``real'' binaries
-.It Pa /var/log/games.log
-game logging file
-.El
-.Sh SEE ALSO
-.Xr dm.conf 5
-.Sh BUGS
-Two problems result from
-.Nm
-running the games setuid
-.Dq games .
-First, all games that allow users to run
-.Tn UNIX
-commands should carefully
-set both the real and effective user id's immediately before executing
-those commands. Probably more important is that
-.Nm
-never be setuid
-anything but
-.Dq games
-so that compromising a game will result only in
-the user's ability to play games at will. Secondly, games which previously
-had no reason to run setuid and which accessed user files may have to
-be modified.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.3 tahoe .
diff --git a/games/dm/dm.c b/games/dm/dm.c
deleted file mode 100644
index 5648eb1..0000000
--- a/games/dm/dm.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1987, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <nlist.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <utmp.h>
-
-#include "pathnames.h"
-
-static time_t now; /* current time value */
-static int priority = 0; /* priority game runs at */
-static char *game, /* requested game */
- *gametty; /* from tty? */
-
-void c_day(char *, char *, char *);
-void c_tty(char *);
-void c_game(char *, char *, char *, char *);
-void hour(int);
-double load(void);
-void nogamefile(void);
-void play(char **);
-void read_config(void);
-int users(void);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char *cp;
-
- nogamefile();
- game = (cp = strrchr(*argv, '/')) ? ++cp : *argv;
-
- if (!strcmp(game, "dm"))
- exit(0);
-
- gametty = ttyname(0);
- unsetenv("TZ");
- (void)time(&now);
- read_config();
-#ifdef LOG
- logfile();
-#endif
- play(argv);
- /*NOTREACHED*/
- exit(EXIT_FAILURE);
-}
-
-/*
- * play --
- * play the game
- */
-void
-play(args)
- char **args;
-{
- char pbuf[MAXPATHLEN];
-
- if (sizeof(_PATH_HIDE) + strlen(game) > sizeof(pbuf)) {
- (void)fprintf(stderr, "dm: %s/%s: %s\n", _PATH_HIDE, game,
- strerror(ENAMETOOLONG));
- exit(1);
- }
- (void)strcpy(pbuf, _PATH_HIDE);
- (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game);
- if (priority > 0) /* < 0 requires root */
- (void)setpriority(PRIO_PROCESS, 0, priority);
- execv(pbuf, args);
- (void)fprintf(stderr, "dm: %s: %s\n", pbuf, strerror(errno));
- exit(1);
-}
-
-/*
- * read_config --
- * read through config file, looking for key words.
- */
-void
-read_config()
-{
- FILE *cfp;
- char lbuf[BUFSIZ], f1[40], f2[40], f3[40], f4[40], f5[40];
-
- if (!(cfp = fopen(_PATH_CONFIG, "r")))
- return;
- while (fgets(lbuf, sizeof(lbuf), cfp))
- switch(*lbuf) {
- case 'b': /* badtty */
- if (sscanf(lbuf, "%s%s", f1, f2) != 2 ||
- strcasecmp(f1, "badtty"))
- break;
- c_tty(f2);
- break;
- case 'g': /* game */
- if (sscanf(lbuf, "%s%s%s%s%s",
- f1, f2, f3, f4, f5) != 5 || strcasecmp(f1, "game"))
- break;
- c_game(f2, f3, f4, f5);
- break;
- case 't': /* time */
- if (sscanf(lbuf, "%s%s%s%s", f1, f2, f3, f4) != 4 ||
- strcasecmp(f1, "time"))
- break;
- c_day(f2, f3, f4);
- }
- (void)fclose(cfp);
-}
-
-/*
- * c_day --
- * if day is today, see if okay to play
- */
-void
-c_day(s_day, s_start, s_stop)
- char *s_day, *s_start, *s_stop;
-{
- static const char *days[] = {
- "sunday", "monday", "tuesday", "wednesday",
- "thursday", "friday", "saturday",
- };
- static struct tm *ct;
- int start, stop;
-
- if (!ct)
- ct = localtime(&now);
- if (strcasecmp(s_day, days[ct->tm_wday]))
- return;
- if (!isdigit(*s_start) || !isdigit(*s_stop))
- return;
- start = atoi(s_start);
- stop = atoi(s_stop);
- if (ct->tm_hour >= start && ct->tm_hour < stop) {
- (void)fputs("dm: Sorry, games are not available from ", stderr);
- hour(start);
- (void)fputs(" to ", stderr);
- hour(stop);
- (void)fputs(" today.\n", stderr);
- exit(0);
- }
-}
-
-/*
- * c_tty --
- * decide if this tty can be used for games.
- */
-void
-c_tty(tty)
- char *tty;
-{
- static int first = 1;
- static char *p_tty;
-
- if (first) {
- p_tty = strrchr(gametty, '/');
- first = 0;
- }
-
- if (!strcmp(gametty, tty) || (p_tty && !strcmp(p_tty, tty))) {
- (void)fprintf(stderr, "dm: Sorry, you may not play games on %s.\n", gametty);
- exit(0);
- }
-}
-
-/*
- * c_game --
- * see if game can be played now.
- */
-void
-c_game(s_game, s_load, s_users, s_priority)
- char *s_game, *s_load, *s_users, *s_priority;
-{
- static int found;
-
- if (found)
- return;
- if (strcmp(game, s_game) && strcasecmp("default", s_game))
- return;
- ++found;
- if (isdigit(*s_load) && atoi(s_load) < load()) {
- (void)fputs("dm: Sorry, the load average is too high right now.\n", stderr);
- exit(0);
- }
- if (isdigit(*s_users) && atoi(s_users) <= users()) {
- (void)fputs("dm: Sorry, there are too many users logged on right now.\n", stderr);
- exit(0);
- }
- if (isdigit(*s_priority))
- priority = atoi(s_priority);
-}
-
-/*
- * load --
- * return 15 minute load average
- */
-double
-load()
-{
- double avenrun[3];
-
- if (getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])) < 0) {
- (void)fputs("dm: getloadavg() failed.\n", stderr);
- exit(1);
- }
- return(avenrun[2]);
-}
-
-/*
- * users --
- * return current number of users
- * todo: check idle time; if idle more than X minutes, don't
- * count them.
- */
-int
-users()
-{
-
- int nusers, utmp;
- struct utmp buf;
-
- if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) {
- (void)fprintf(stderr, "dm: %s: %s\n",
- _PATH_UTMP, strerror(errno));
- exit(1);
- }
- for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;)
- if (buf.ut_name[0] != '\0')
- ++nusers;
- return(nusers);
-}
-
-void
-nogamefile()
-{
- int fd, n;
- char buf[BUFSIZ];
-
- if ((fd = open(_PATH_NOGAMES, O_RDONLY, 0)) >= 0) {
-#define MESG "Sorry, no games right now.\n\n"
- (void)write(2, MESG, sizeof(MESG) - 1);
- while ((n = read(fd, buf, sizeof(buf))) > 0)
- (void)write(2, buf, n);
- exit(1);
- }
-}
-
-/*
- * hour --
- * print out the hour in human form
- */
-void
-hour(h)
- int h;
-{
- switch(h) {
- case 0:
- (void)fputs("midnight", stderr);
- break;
- case 12:
- (void)fputs("noon", stderr);
- break;
- default:
- if (h > 12)
- (void)fprintf(stderr, "%dpm", h - 12);
- else
- (void)fprintf(stderr, "%dam", h);
- }
-}
-
-#ifdef LOG
-/*
- * logfile --
- * log play of game
- */
-logfile()
-{
- struct passwd *pw;
- FILE *lp;
- uid_t uid;
- int lock_cnt;
-
- if (lp = fopen(_PATH_LOG, "a")) {
- for (lock_cnt = 0;; ++lock_cnt) {
- if (!flock(fileno(lp), LOCK_EX))
- break;
- if (lock_cnt == 4) {
- perror("dm: log lock");
- (void)fclose(lp);
- return;
- }
- sleep((u_int)1);
- }
- if (pw = getpwuid(uid = getuid()))
- fputs(pw->pw_name, lp);
- else
- fprintf(lp, "%u", uid);
- fprintf(lp, "\t%s\t%s\t%s", game, gametty, ctime(&now));
- (void)fclose(lp);
- (void)flock(fileno(lp), LOCK_UN);
- }
-}
-#endif /* LOG */
diff --git a/games/dm/dm.conf.5 b/games/dm/dm.conf.5
deleted file mode 100644
index 6947399..0000000
--- a/games/dm/dm.conf.5
+++ /dev/null
@@ -1,100 +0,0 @@
-.\" Copyright (c) 1988, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)dm.conf.5 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt DM.CONF 5
-.Os
-.Sh NAME
-.Nm dm.conf
-.Nd \&dm configuration file
-.Sh DESCRIPTION
-The
-.Nm
-file
-is the configuration file for the
-.Xr \&dm 8
-program.
-It consists of lines beginning with one of three keywords, ``badtty'',
-``game'', and ``time''. All other lines are ignored.
-.Pp
-Any tty listed after the keyword ``badtty'' may not have games played on
-it.
-Entries consist of two white-space separated fields: the string
-``badtty'' and the ttyname as returned by
-.Xr ttyname 3 .
-For example,
-to keep the uucp dialout, ``tty19'', from being used for games, the
-entry would be:
-.Bd -literal -offset indent
-badtty /dev/tty19
-.Ed
-.Pp
-Any day/hour combination listed after the keyword ``time'' will disallow
-games during those hours. Entries consist of four white-space separated
-fields: the string ``time'', the unabbreviated day of the week and the
-beginning and ending time of a period of the day when games may not be
-played. The time fields are in a 0 based, 24-hour clock. For example,
-the following entry allows games playing before 8AM and after 5PM on
-Mondays.
-.Bd -literal -offset indent
-time Monday 8 17
-.Ed
-.Pp
-Any game listed after the keyword ``game'' will set parameters for a specific
-game. Entries consist of five white-space separated fields: the keyword
-``game'', the name of a game, the highest system load average at which the
-game may be played, the maximum users allowed if the game is to be played,
-and the priority at which the game is to be run. Any of these fields may
-start with a non-numeric character, resulting in no game limitation or
-priority based on that field. The game "default" controls the settings for
-any game not otherwise listed, and must be the last ``game'' entry in the
-file. Priorities may not be negative. For example, the following entries
-limits the game ``hack'' to running only when the system has 10 or less
-users and a load average of 5 or less; all other games may be run any time
-the system has 15 or less users.
-.Bd -literal -offset indent
-game hack 5 10 *
-game default * 15 *
-.Ed
-.Sh FILES
-.Bl -tag -width /etc/dm.conf -compact
-.It Pa /etc/dm.conf
-The
-.Xr \&dm 8
-configuration file.
-.El
-.Sh SEE ALSO
-.Xr setpriority 2 ,
-.Xr ttyname 3 ,
-.Xr dm 8
diff --git a/games/dm/pathnames.h b/games/dm/pathnames.h
deleted file mode 100644
index c54fef9..0000000
--- a/games/dm/pathnames.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_CONFIG "/etc/dm.conf"
-#define _PATH_HIDE "/usr/games/hide/"
-#define _PATH_LOG "/var/log/games.log"
-#define _PATH_NOGAMES "/etc/nogames"
diff --git a/games/fish/Makefile b/games/fish/Makefile
deleted file mode 100644
index d2b5035..0000000
--- a/games/fish/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= fish
-FILES= fish.instr
-MAN= fish.6
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/fish/fish.6 b/games/fish/fish.6
deleted file mode 100644
index fd4d682..0000000
--- a/games/fish/fish.6
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)fish.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH FISH 6 "May 31, 1993"
-.UC 4
-.SH NAME
-fish \- play ``Go Fish''
-.SH SYNOPSIS
-.ft B
-fish [\-p]
-.ft R
-.SH DESCRIPTION
-.I Fish
-is the game
-.IR "Go Fish" ,
-a traditional children's card game.
-.PP
-The computer deals the player and itself seven cards, and places
-the rest of the deck face-down (figuratively).
-The object of the game is to collect ``books'', or all of the members
-of a single rank.
-For example, collecting four 2's would give the player a ``book of
-2's''.
-.PP
-The options are as follows:
-.TP
-\-p
-Professional mode.
-.PP
-The computer makes a random decision as to who gets to start the
-game, and then the computer and player take turns asking each other
-for cards of a specified rank.
-If the asked player has any cards of the requested rank, they give
-them up to the asking player.
-A player must have at least one of the cards of the rank they request
-in their hand.
-When a player asks for a rank of which the other player has no
-cards, the asker is told to ``Go Fish!''.
-Then, the asker draws a card from the non-dealt cards.
-If they draw the card they asked for, they continue their turn, asking
-for more ranks from the other player.
-Otherwise, the other player gets a turn.
-.PP
-When a player completes a book, either by getting cards from the
-other player or drawing from the deck, they set those cards aside and
-the rank is no longer in play.
-.PP
-The game ends when either player no longer has any cards in their hand.
-The player with the most books wins.
-.PP
-.I Fish
-provides instructions as to what input it accepts.
-.SH BUGS
-The computer cheats only rarely.
diff --git a/games/fish/fish.c b/games/fish/fish.c
deleted file mode 100644
index 2a54022..0000000
--- a/games/fish/fish.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Muffy Barkocy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "pathnames.h"
-
-#define RANKS 13
-#define HANDSIZE 7
-#define CARDS 4
-
-#define USER 1
-#define COMPUTER 0
-#define OTHER(a) (1 - (a))
-
-char *cards[] = {
- "A", "2", "3", "4", "5", "6", "7",
- "8", "9", "10", "J", "Q", "K", NULL,
-};
-#define PRC(card) (void)printf(" %s", cards[card])
-
-int promode;
-int asked[RANKS], comphand[RANKS], deck[RANKS];
-int userasked[RANKS], userhand[RANKS];
-
-void chkwinner(int player, int *hand);
-int compmove(void);
-int countbooks(int *hand);
-int countcards(int *hand);
-int drawcard(int player, int *hand);
-int gofish(int askedfor, int player, int *hand);
-void goodmove(int player, int move, int *hand, int *opphand);
-void init(void);
-void instructions(void);
-int nrandom(int n);
-void printhand(int *hand);
-void printplayer(int player);
-int promove(void);
-void usage(void);
-int usermove(void);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- int ch, move;
-
- while ((ch = getopt(argc, argv, "p")) != -1)
- switch(ch) {
- case 'p':
- promode = 1;
- break;
- case '?':
- default:
- (void)fprintf(stderr, "usage: fish [-p]\n");
- exit(1);
- }
-
- srandomdev();
- instructions();
- init();
-
- if (nrandom(2) == 1) {
- printplayer(COMPUTER);
- (void)printf("get to start.\n");
- goto istart;
- }
- printplayer(USER);
- (void)printf("get to start.\n");
-
- for (;;) {
- move = usermove();
- if (!comphand[move]) {
- if (gofish(move, USER, userhand))
- continue;
- } else {
- goodmove(USER, move, userhand, comphand);
- continue;
- }
-
-istart: for (;;) {
- move = compmove();
- if (!userhand[move]) {
- if (!gofish(move, COMPUTER, comphand))
- break;
- } else
- goodmove(COMPUTER, move, comphand, userhand);
- }
- }
- /* NOTREACHED */
- return(EXIT_FAILURE);
-}
-
-int
-usermove()
-{
- int n;
- char **p;
- char buf[256];
-
- (void)printf("\nYour hand is:");
- printhand(userhand);
-
- for (;;) {
- (void)printf("You ask me for: ");
- (void)fflush(stdout);
- if (fgets(buf, sizeof(buf), stdin) == NULL)
- exit(0);
- if (buf[0] == '\0')
- continue;
- if (buf[0] == '\n') {
- (void)printf("%d cards in my hand, %d in the pool.\n",
- countcards(comphand), countcards(deck));
- (void)printf("My books:");
- (void)countbooks(comphand);
- continue;
- }
- buf[strlen(buf) - 1] = '\0';
- if (!strcasecmp(buf, "p") && !promode) {
- promode = 1;
- (void)printf("Entering pro mode.\n");
- continue;
- }
- if (!strcasecmp(buf, "quit"))
- exit(0);
- for (p = cards; *p; ++p)
- if (!strcasecmp(*p, buf))
- break;
- if (!*p) {
- (void)printf("I don't understand!\n");
- continue;
- }
- n = p - cards;
- if (userhand[n]) {
- userasked[n] = 1;
- return(n);
- }
- if (nrandom(3) == 1)
- (void)printf("You don't have any of those!\n");
- else
- (void)printf("You don't have any %s's!\n", cards[n]);
- if (nrandom(4) == 1)
- (void)printf("No cheating!\n");
- (void)printf("Guess again.\n");
- }
- /* NOTREACHED */
-}
-
-int
-compmove()
-{
- static int lmove;
-
- if (promode)
- lmove = promove();
- else {
- do {
- lmove = (lmove + 1) % RANKS;
- } while (!comphand[lmove] || comphand[lmove] == CARDS);
- }
- asked[lmove] = 1;
-
- (void)printf("I ask you for: %s.\n", cards[lmove]);
- return(lmove);
-}
-
-int
-promove()
-{
- int i, max;
-
- for (i = 0; i < RANKS; ++i)
- if (userasked[i] &&
- comphand[i] > 0 && comphand[i] < CARDS) {
- userasked[i] = 0;
- return(i);
- }
- if (nrandom(3) == 1) {
- for (i = 0;; ++i)
- if (comphand[i] && comphand[i] != CARDS) {
- max = i;
- break;
- }
- while (++i < RANKS)
- if (comphand[i] != CARDS &&
- comphand[i] > comphand[max])
- max = i;
- return(max);
- }
- if (nrandom(1024) == 0723) {
- for (i = 0; i < RANKS; ++i)
- if (userhand[i] && comphand[i])
- return(i);
- }
- for (;;) {
- for (i = 0; i < RANKS; ++i)
- if (comphand[i] && comphand[i] != CARDS &&
- !asked[i])
- return(i);
- for (i = 0; i < RANKS; ++i)
- asked[i] = 0;
- }
- /* NOTREACHED */
-}
-
-int
-drawcard(player, hand)
- int player;
- int *hand;
-{
- int card;
-
- while (deck[card = nrandom(RANKS)] == 0);
- ++hand[card];
- --deck[card];
- if (player == USER || hand[card] == CARDS) {
- printplayer(player);
- (void)printf("drew %s", cards[card]);
- if (hand[card] == CARDS) {
- (void)printf(" and made a book of %s's!\n",
- cards[card]);
- chkwinner(player, hand);
- } else
- (void)printf(".\n");
- }
- return(card);
-}
-
-int
-gofish(askedfor, player, hand)
- int askedfor, player;
- int *hand;
-{
- printplayer(OTHER(player));
- (void)printf("say \"GO FISH!\"\n");
- if (askedfor == drawcard(player, hand)) {
- printplayer(player);
- (void)printf("drew the guess!\n");
- printplayer(player);
- (void)printf("get to ask again!\n");
- return(1);
- }
- return(0);
-}
-
-void
-goodmove(player, move, hand, opphand)
- int player, move;
- int *hand, *opphand;
-{
- printplayer(OTHER(player));
- (void)printf("have %d %s%s.\n",
- opphand[move], cards[move], opphand[move] == 1 ? "": "'s");
-
- hand[move] += opphand[move];
- opphand[move] = 0;
-
- if (hand[move] == CARDS) {
- printplayer(player);
- (void)printf("made a book of %s's!\n", cards[move]);
- chkwinner(player, hand);
- }
-
- chkwinner(OTHER(player), opphand);
-
- printplayer(player);
- (void)printf("get another guess!\n");
-}
-
-void
-chkwinner(player, hand)
- int player;
- int *hand;
-{
- int cb, i, ub;
-
- for (i = 0; i < RANKS; ++i)
- if (hand[i] > 0 && hand[i] < CARDS)
- return;
- printplayer(player);
- (void)printf("don't have any more cards!\n");
- (void)printf("My books:");
- cb = countbooks(comphand);
- (void)printf("Your books:");
- ub = countbooks(userhand);
- (void)printf("\nI have %d, you have %d.\n", cb, ub);
- if (ub > cb) {
- (void)printf("\nYou win!!!\n");
- if (nrandom(1024) == 0723)
- (void)printf("Cheater, cheater, pumpkin eater!\n");
- } else if (cb > ub) {
- (void)printf("\nI win!!!\n");
- if (nrandom(1024) == 0723)
- (void)printf("Hah! Stupid peasant!\n");
- } else
- (void)printf("\nTie!\n");
- exit(0);
-}
-
-void
-printplayer(player)
- int player;
-{
- switch (player) {
- case COMPUTER:
- (void)printf("I ");
- break;
- case USER:
- (void)printf("You ");
- break;
- }
-}
-
-void
-printhand(hand)
- int *hand;
-{
- int book, i, j;
-
- for (book = i = 0; i < RANKS; i++)
- if (hand[i] < CARDS)
- for (j = hand[i]; --j >= 0;)
- PRC(i);
- else
- ++book;
- if (book) {
- (void)printf(" + Book%s of", book > 1 ? "s" : "");
- for (i = 0; i < RANKS; i++)
- if (hand[i] == CARDS)
- PRC(i);
- }
- (void)putchar('\n');
-}
-
-int
-countcards(hand)
- int *hand;
-{
- int i, count;
-
- for (count = i = 0; i < RANKS; i++)
- count += *hand++;
- return(count);
-}
-
-int
-countbooks(hand)
- int *hand;
-{
- int i, count;
-
- for (count = i = 0; i < RANKS; i++)
- if (hand[i] == CARDS) {
- ++count;
- PRC(i);
- }
- if (!count)
- (void)printf(" none");
- (void)putchar('\n');
- return(count);
-}
-
-void
-init()
-{
- int i, rank;
-
- for (i = 0; i < RANKS; ++i)
- deck[i] = CARDS;
- for (i = 0; i < HANDSIZE; ++i) {
- while (!deck[rank = nrandom(RANKS)]);
- ++userhand[rank];
- --deck[rank];
- }
- for (i = 0; i < HANDSIZE; ++i) {
- while (!deck[rank = nrandom(RANKS)]);
- ++comphand[rank];
- --deck[rank];
- }
-}
-
-int
-nrandom(n)
- int n;
-{
-
- return((int)random() % n);
-}
-
-void
-instructions()
-{
- int input;
- char buf[1024];
-
- (void)printf("Would you like instructions (y or n)? ");
- input = getchar();
- while (getchar() != '\n');
- if (input != 'y')
- return;
-
- (void)sprintf(buf, "%s %s", _PATH_MORE, _PATH_INSTR);
- (void)system(buf);
- (void)printf("Hit return to continue...\n");
- while ((input = getchar()) != EOF && input != '\n');
-}
-
-void
-usage()
-{
- (void)fprintf(stderr, "usage: fish [-p]\n");
- exit(1);
-}
diff --git a/games/fish/fish.instr b/games/fish/fish.instr
deleted file mode 100644
index b7e87a0..0000000
--- a/games/fish/fish.instr
+++ /dev/null
@@ -1,29 +0,0 @@
-This is the traditional children's card game "Go Fish". We each get seven
-cards, and the rest of the deck is kept to be drawn from later. The
-object of the game is to collect "books", or all of the cards of a single
-value. For example, getting four 2's would give you a "book of 2's".
-
-We take turns asking each other for cards, but you can't ask me for a card
-value if you don't have one of them in your hand! If I have any cards of
-the value you ask for, I have to give them to you. As long as I have one
-of the cards you ask for, you get to keep asking. If you ask me for a
-card of which I don't have any, then I'll tell you to "Go Fish!" This
-means that you draw a card from the deck. If you draw the card you asked
-me for, you get to keep asking me for cards. If not, it's my turn and I ask
-you for a card.
-
-Sometimes you get to ask first, sometimes I do. I'll tell you when it's
-your turn to move, I'll draw cards from the deck for you, and I'll tell
-you what you have in your hand. (Don't worry, I don't look at your hand
-when I'm trying to decide what card to ask for, honest!)
-
-Your input can be a card name ("A", "2", "3", "4", "5", "6", "7", "8",
-"9", "10", "J", "Q" or "K") or the letter "p", or "quit". The letter "p"
-makes my game much smarter, and the line "quit" stops the game. Just
-hitting the carriage return key displays how many cards I have in my hand,
-how many are left in the deck, and which books I've gotten.
-
-Normally, the game stops when one of us runs out of cards, and the winner
-is whoever has the most books!
-
-Good luck!
diff --git a/games/fish/pathnames.h b/games/fish/pathnames.h
deleted file mode 100644
index 89b4bd7..0000000
--- a/games/fish/pathnames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_INSTR "/usr/share/games/fish.instr"
-#define _PATH_MORE "/usr/bin/more"
diff --git a/games/hack/COPYRIGHT b/games/hack/COPYRIGHT
deleted file mode 100644
index 71a9449..0000000
--- a/games/hack/COPYRIGHT
+++ /dev/null
@@ -1,6 +0,0 @@
-This entire subtree is copyright the Stichting Mathematisch Centrum.
-The following copyright notice applies to all files found here. None of
-these files contain AT&T proprietary source code.
-_____________________________________________________________________________
-
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
diff --git a/games/hack/Makefile b/games/hack/Makefile
deleted file mode 100644
index eaf19e5..0000000
--- a/games/hack/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= hack
-SRCS= alloc.c hack.Decl.c hack.apply.c hack.bones.c hack.c hack.cmd.c \
- hack.do.c hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c \
- hack.end.c hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c \
- hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c hack.mklev.c \
- hack.mkmaze.c hack.mkobj.c hack.mkshop.c hack.mon.c hack.monst.c \
- hack.o_init.c hack.objnam.c hack.options.c hack.pager.c hack.potion.c \
- hack.pri.c hack.read.c hack.rip.c hack.rumors.c hack.save.c \
- hack.search.c hack.shk.c hack.shknam.c hack.steal.c hack.termcap.c \
- hack.timeout.c hack.topl.c hack.track.c hack.trap.c hack.tty.c \
- hack.u_init.c hack.unix.c hack.vault.c hack.version.c hack.wield.c \
- hack.wizard.c hack.worm.c hack.worn.c hack.zap.c rnd.c \
- hack.onames.h
-MAN= hack.6
-DPADD= ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD= -ltermcap -lcompat
-CFLAGS+= -fwritable-strings -I${.CURDIR} -I.
-FILES= rumors help hh data
-FILESMODE_rumors= 440
-FILESGRP= ${BINGRP}
-FILESDIR= /var/games/hackdir
-HIDEGAME=hidegame
-CLEANFILES=hack.onames.h makedefs makedefs.o
-
-build-tools: makedefs
-
-hack.onames.h: makedefs def.objects.h
- ./makedefs ${.CURDIR}/def.objects.h > hack.onames.h
-
-makedefs: makedefs.o
- ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
-
-beforeinstall:
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} /dev/null \
- ${DESTDIR}/var/games/hackdir/perm
-.if !exists(${DESTDIR}/var/games/hackdir/record)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 460 /dev/null \
- ${DESTDIR}/var/games/hackdir/record
-.endif
-# rm -f ${DESTDIR}/var/games/hackdir/bones* \
-# ${DESTDIR}/var/games/hackdir/save/*
-
-.include <bsd.prog.mk>
diff --git a/games/hack/Makequest b/games/hack/Makequest
deleted file mode 100644
index 9271c28..0000000
--- a/games/hack/Makequest
+++ /dev/null
@@ -1,196 +0,0 @@
-# Hack or Quest Makefile.
-
-# on some systems the termcap library is in -ltermcap
-TERMLIB = -ltermlib
-
-
-# make hack
-GAME = quest
-GAMEDIR = /usr/games/lib/questdir
-CFLAGS = -g -DQUEST
-HACKCSRC = hack.Decl.c\
- hack.apply.c hack.bones.c hack.c hack.cmd.c hack.do.c\
- hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c hack.end.c\
- hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c\
- hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c\
- hack.mklev.c hack.mkmaze.c hack.mkobj.c hack.mkshop.c\
- hack.mon.c hack.monst.c hack.o_init.c hack.objnam.c\
- hack.options.c hack.pager.c hack.potion.c hack.pri.c\
- hack.read.c hack.rip.c hack.rumors.c hack.save.c\
- hack.search.c hack.shk.c hack.shknam.c hack.steal.c\
- hack.termcap.c hack.timeout.c hack.topl.c\
- hack.track.c hack.trap.c hack.tty.c hack.unix.c\
- hack.u_init.c hack.vault.c\
- hack.wield.c hack.wizard.c hack.worm.c hack.worn.c hack.zap.c\
- hack.version.c rnd.c alloc.c
-
-CSOURCES = $(HACKCSRC) makedefs.c
-
-HSOURCES = hack.h hack.mfndpos.h config.h\
- def.edog.h def.eshk.h def.flag.h def.func_tab.h def.gold.h\
- def.mkroom.h\
- def.monst.h def.obj.h def.objclass.h def.objects.h\
- def.permonst.h def.rm.h def.trap.h def.wseg.h
-
-SOURCES = $(CSOURCES) $(HSOURCES)
-
-AUX = data help hh rumors hack.6 hack.sh
-
-DISTR = $(SOURCES) $(AUX) READ_ME Makefile date.h hack.onames.h
-
-HOBJ = hack.Decl.o hack.apply.o hack.bones.o hack.o hack.cmd.o hack.do.o\
- hack.do_name.o hack.do_wear.o hack.dog.o hack.eat.o hack.end.o\
- hack.engrave.o hack.fight.o hack.invent.o hack.ioctl.o\
- hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o hack.mklev.o\
- hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o\
- hack.monst.o hack.o_init.o hack.objnam.o hack.options.o\
- hack.pager.o hack.potion.o hack.pri.o\
- hack.read.o hack.rip.o hack.rumors.o hack.save.o\
- hack.search.o hack.shk.o hack.shknam.o hack.steal.o\
- hack.termcap.o hack.timeout.o hack.topl.o\
- hack.track.o hack.trap.o\
- hack.tty.o hack.unix.o hack.u_init.o hack.vault.o hack.wield.o\
- hack.wizard.o hack.worm.o hack.worn.o hack.zap.o\
- hack.version.o rnd.o alloc.o
-
-$(GAME): $(HOBJ) Makefile
- @echo "Loading ..."
- @ld -X -o $(GAME) /lib/crt0.o $(HOBJ) $(TERMLIB) -lc
-
-all: $(GAME) lint
- @echo "Done."
-
-makedefs: makedefs.c
- cc -o makedefs makedefs.c
-
-
-hack.onames.h: makedefs def.objects.h
- makedefs > hack.onames.h
-
-lint:
-# lint cannot have -p here because (i) capitals are meaningful:
-# [Ww]izard, (ii) identifiers may coincide in the first six places:
-# doweararm() versus dowearring().
-# _flsbuf comes from <stdio.h>, a bug in the system libraries.
- @echo lint -axbh -DLINT ...
- @lint -axbh -DLINT $(HACKCSRC) | sed '/_flsbuf/d'
-
-
-diff:
- @- for i in $(SOURCES) $(AUX) ; do \
- cmp -s $$i $D/$$i || \
- ( echo diff $D/$$i $$i ; diff $D/$$i $$i ; echo ) ; done
-
-distribution: Makefile
- @- for i in READ_ME $(SOURCES) $(AUX) Makefile date.h hack.onames.h\
- ; do \
- cmp -s $$i $D/$$i || \
- ( echo cp $$i $D ; cp $$i $D ) ; done
-# the distribution directory also contains the empty files perm and record.
-
-
-install:
- rm -f $(GAMEDIR)/$(GAME)
- cp $(GAME) $(GAMEDIR)/$(GAME)
- chmod 04511 $(GAMEDIR)/$(GAME)
- rm -f $(GAMEDIR)/bones*
-# cp hack.6 /usr/man/man6
-
-clean:
- rm -f *.o
-
-
-depend:
-# For the moment we are lazy and disregard /usr/include files because
-# the sources contain them conditionally. Perhaps we should use cpp.
-# ( /bin/grep '^#[ ]*include' $$i | sed -n \
-# -e 's,<\(.*\)>,"/usr/include/\1",' \
-#
- for i in ${CSOURCES}; do \
- ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
- -e 's/[^"]*"\([^"]*\)".*/\1/' \
- -e H -e '$$g' -e '$$s/\n/ /g' \
- -e '$$s/.*/'$$i': &/' -e '$$s/\.c:/.o:/p' \
- >> makedep); done
- for i in ${HSOURCES}; do \
- ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
- -e 's/[^"]*"\([^"]*\)".*/\1/' \
- -e H -e '$$g' -e '$$s/\n/ /g' \
- -e '$$s/.*/'$$i': &\
- touch '$$i/p \
- >> makedep); done
- @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- @echo '$$r makedep' >>eddep
- @echo 'w' >>eddep
- @cp Makefile Makefile.bak
- ed - Makefile < eddep
- @rm -f eddep makedep
- @echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- @echo '# see make depend above' >> Makefile
- - diff Makefile Makefile.bak
- @rm -f Makefile.bak
-
-# DO NOT DELETE THIS LINE
-
-hack.Decl.o: hack.h def.mkroom.h
-hack.apply.o: hack.h def.edog.h def.mkroom.h
-hack.bones.o: hack.h
-hack.o: hack.h
-hack.cmd.o: hack.h def.func_tab.h
-hack.do.o: hack.h
-hack.do_name.o: hack.h
-hack.do_wear.o: hack.h
-hack.dog.o: hack.h hack.mfndpos.h def.edog.h def.mkroom.h
-hack.eat.o: hack.h
-hack.end.o: hack.h
-hack.engrave.o: hack.h
-hack.fight.o: hack.h
-hack.invent.o: hack.h def.wseg.h
-hack.ioctl.o: config.h
-hack.lev.o: hack.h def.mkroom.h def.wseg.h
-hack.main.o: hack.h
-hack.makemon.o: hack.h
-hack.mhitu.o: hack.h
-hack.mklev.o: hack.h def.mkroom.h
-hack.mkmaze.o: hack.h def.mkroom.h
-hack.mkobj.o: hack.h
-hack.mkshop.o: hack.h def.mkroom.h def.eshk.h
-hack.mon.o: hack.h hack.mfndpos.h
-hack.monst.o: hack.h def.eshk.h
-hack.o_init.o: config.h def.objects.h hack.onames.h
-hack.objnam.o: hack.h
-hack.options.o: config.h hack.h
-hack.pager.o: hack.h
-hack.potion.o: hack.h
-hack.pri.o: hack.h def.wseg.h
-hack.read.o: hack.h
-hack.rip.o: hack.h
-hack.rumors.o: hack.h
-hack.save.o: hack.h
-hack.search.o: hack.h
-hack.shk.o: hack.h hack.mfndpos.h def.mkroom.h def.eshk.h
-hack.shknam.o: hack.h
-hack.steal.o: hack.h
-hack.termcap.o: config.h def.flag.h
-hack.timeout.o: hack.h
-hack.topl.o: hack.h
-hack.track.o: hack.h
-hack.trap.o: hack.h def.mkroom.h
-hack.tty.o: hack.h
-hack.unix.o: hack.h def.mkroom.h
-hack.u_init.o: hack.h
-hack.vault.o: hack.h def.mkroom.h
-hack.wield.o: hack.h
-hack.wizard.o: hack.h
-hack.worm.o: hack.h def.wseg.h
-hack.worn.o: hack.h
-hack.zap.o: hack.h
-hack.version.o: date.h
-hack.h: config.h def.objclass.h def.monst.h def.gold.h def.trap.h def.obj.h def.flag.h def.rm.h def.permonst.h hack.onames.h
- touch hack.h
-def.objects.h: config.h def.objclass.h
- touch def.objects.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
diff --git a/games/hack/OWNER b/games/hack/OWNER
deleted file mode 100644
index be2d1e5..0000000
--- a/games/hack/OWNER
+++ /dev/null
@@ -1,2 +0,0 @@
-Andries Brouwer
-mcvax!aeb
diff --git a/games/hack/Original_READ_ME b/games/hack/Original_READ_ME
deleted file mode 100644
index 9d2070b..0000000
--- a/games/hack/Original_READ_ME
+++ /dev/null
@@ -1,61 +0,0 @@
-This is export hack, my first semester programming project.
-
-To set it up for your system, you will have to do the following:
- 1: create a hack uid, to own the top ten list, etc.
- 2: create a hack directory "/usr/lib/game/hack" is the default.
- 2.5: make the directory 700 mode. /* sav files go in there...*/
- 3: modify hack.main.c to use the new directory.
- 4: modify hack.main.c so it uses the new hack gid. Gid accounts can
-go into magic mode without the password, can get cores with ^G, etc.
-(make sure gid isn't checked anywhere else...)
- 5: recompile hack.
- 6: put it in games after making it set-uid hack.
- 8: fix the bugs I undobtedly left in it.
- 9: tell me what you think of it.
-
- Hack uses the UCB file /etc/termcap to get your terminal escape codes.
-If you don't use it, you will have to make extensive changes to hack.pri.c
-
-If you find any bugs (That you think I don't know about), or have any
-awesome new changes (Like a better save (One that works!)), or have ANY
-questions, write me
- Jay Fenlason
- 29 East St.
- Sudbury Mass.
- 01776
-
-or call me at (617) 443-5036. Since I have both a modem and a teen-age
-sister, Good Luck.
-
-
-Hack is split (roughly) into several source files that do different things.
-I have tried to fit all the procedures having to do with a certain segment
-of the game into a single file, but the job is not the best in the world.
-The rough splits are:
-
-hack.c General random stuff and things I never got around to moving.
-hack.main.c main() and other random procedures, also the lock file stuff.
-hack.mon.c Monsters, moving, attacking, etc.
-hack.do.c drink, eat, read, wield, save, etc.
-hack.do1.c zap, wear, remove, etc...
-hack.pri.c stuff having to do with the screen, most of the terminal
- independant stuff is in here.
-hack.lev.c temp files and calling of mklev.
-
-Because of the peculiar restraints on our system, I make mklev (create
-a level) a separate procedure execd by hack when needed. The source for
-mklev is (Naturaly) mklev.c. You may want to put mklev back into hack.
-Good luck.
-
-Most of hack was written by me, with help from
- Kenny Woodland (KW) (general random things including
- the original BUZZ())
- Mike Thome (MT) (The original chamelian)
- and Jon Payne (JP) (The original lock file kludge and
- the massive CURS())
-
-This entire program would not have been possible without the SFSU Logo
-Workshop. I am eternally grateful to all of our students (Especially K.L.),
-without whom I would never have seen Rogue. I am especially grateful to
-Mike Clancy, without whose generous help I would never have gotten to play
-ROGUE.
diff --git a/games/hack/READ_ME b/games/hack/READ_ME
deleted file mode 100644
index cfe6ca2..0000000
--- a/games/hack/READ_ME
+++ /dev/null
@@ -1,92 +0,0 @@
-Hack is a display oriented dungeons & dragons - like game.
-Both display and command structure resemble rogue.
-(For a game with the same structure but entirely different display -
-a real cave instead of dull rectangles - try Quest)
-
-Hack was originally written by Jay Fenlason (at lincolnsudbury:
- 29 East St., Sudbury Mass., 01776) with help from
- Kenny Woodland, Mike Thome and Jon Payne.
-Basically it was an implementation of Rogue, however, with 52+ instead of 26
- monster types.
-The current version is more than thrice as large (with such new features as
- the dog, the long worms, the shops, etc.) and almost entirely rewritten
- (only the display routines are the original ones - I must rewrite these
- too one day; especially when you are blind strange things still happen).
-
-Files for hack:
- hack The actual game
- record Top 100 list (just start with an empty file)
- news Tells about recent changes in hack, or bugs found ...
- (Just start with no news file.)
- data Auxiliary file used by hack to give you the names
- and sometimes some more information on the
- objects and monsters.
- help Introductory information (no doubt outdated).
- hh Compactified version of help.
- perm An empty file used for locking purposes.
- rumors Texts for fortune cookies.
- (Some of these contain information on the game,
- others are just plain stupid. Additional rumors
- are appreciated.)
- hack.sh A shell script.
- (We have hack.sh in /usr/games/hack and
- hack in /usr/games/lib/hackdir/hack and all the other
- hack stuff in /usr/games/lib/hackdir - perhaps this
- will make the script clear.
- There is no need for you to use it.)
- READ_ME This file.
- Original_READ_ME Jay Fenlason's READ_ME
-
-System files used:
- /etc/termcap Used in conjunction with the environment variable
- $TERM.
- /bin/cat
- /usr/ucb/more
- /bin/sh Used when $SHELL is undefined.
-
-How to install hack:
-0. Compile the sources. Perhaps you should first look at the file config.h
- and define BSD if you are on a BSDtype system,
- define STUPID if your C-compiler chokes on complicated expressions.
- Make sure schar and uchar represent signed and unsigned types.
- If your C compiler doesnt allow initialization of bit fields
- change Bitfield. When config.h looks reasonable, say 'make'.
- (Perhaps you have to change TERMLIB in the makefile.)
-1. If it didnt exist already, introduce a loginname `play' .
-2. The program hack resides in a directory so that it is executable
- for everybody and is suid play:
- ---s--s--x 1 play 206848 Apr 3 00:17 hack
- Perhaps you wish to restrict playing to certain hours, or have games
- running under nice; in that case you might write a program play.c
- such that the program play is suid play and executable for everybody
- while all the games in /usr/games are readable or executable for
- play only; all the program play does is asking for the name of a game,
- checking that time-of-day and system load do not forbid playing,
- and then executing the game. Thus:
- -r-sr-sr-x 1 play 13312 May 24 12:52 play
- ---x------ 1 play 206848 Apr 3 00:17 hack
- If you are worried about security you might let play do
- chroot("/usr/games") so that no player can get access to the rest
- of the system via shell escapes and the likes.
- If you #define SECURE in config.h then hack will not setuid(getuid())
- before executing a chdir(). Hack will always do setuid(getuid()) with
- a fork. If you do not define UNIX then hack will not fork.
-3. The rest of the stuff belonging to hack sits in a subdirectory hackdir
- (on our system /usr/games/lib/hackdir) with modes
- drwx------ 3 play 1024 Aug 9 09:03 hackdir
- Here all the temporary files will be created (with names like xlock.17
- or user.5).
-4. If you are not really short on file space, creating a subdirectory
- hackdir/save (modes again drwx------) will enable users to save their
- unfinished games.
-
-The program hack is called
-$ hack [-d hackdir] [maxnrofplayers]
-(for playing) or
-$ hack [-d hackdir] -s [listofusers | limit | all]
-(for seeing part of the scorelist).
-The shell file hack (in this kit called hack.sh) takes care of
-calling hack with the right arguments.
-
-Send complaints, bug reports, suggestions for improvements to
-mcvax!aeb - in real life Andries Brouwer.
diff --git a/games/hack/alloc.c b/games/hack/alloc.c
deleted file mode 100644
index 13379f6..0000000
--- a/games/hack/alloc.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* alloc.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include <stdlib.h>
-
-#ifdef LINT
-
-/*
- a ridiculous definition, suppressing
- "possible pointer alignment problem" for (long *) malloc()
- "enlarg defined but never used"
- "ftell defined (in <stdio.h>) but never used"
- from lint
-*/
-#include <stdio.h>
-long *
-alloc(n) unsigned n; {
-long dummy = ftell(stderr);
- if(n) dummy = 0; /* make sure arg is used */
- return(&dummy);
-}
-
-#else
-
-long *
-alloc(lth)
-unsigned lth;
-{
- char *ptr;
-
- if(!(ptr = malloc(lth)))
- panic("Cannot get %d bytes", lth);
- return((long *) ptr);
-}
-
-long *
-enlarge(ptr,lth)
-char *ptr;
-unsigned lth;
-{
- char *nptr;
-
- if(!(nptr = realloc(ptr,lth)))
- panic("Cannot reallocate %d bytes", lth);
- return((long *) nptr);
-}
-
-#endif /* LINT */
diff --git a/games/hack/config.h b/games/hack/config.h
deleted file mode 100644
index dd25cfa..0000000
--- a/games/hack/config.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* config.h - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "pathnames.h"
-
-#ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */
-
-#define CONFIG
-#define UNIX /* delete if no fork(), exec() available */
-#define CHDIR /* delete if no chdir() available */
-
-/*
- * Some include files are in a different place under SYSV
- * BSD SYSV
- * <sys/wait.h> <wait.h>
- * <sys/time.h> <time.h>
- * <sgtty.h> <termio.h>
- * Some routines are called differently
- * index strchr
- * rindex strrchr
- * Also, the code for suspend and various ioctls is only given for BSD4.2
- * (I do not have access to a SYSV system.)
- */
-#define BSD /* delete this line on System V */
-
-/* #define STUPID */ /* avoid some complicated expressions if
- your C compiler chokes on them */
-/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
-/* #define NOWAITINCLUDE */ /* neither <wait.h> nor <sys/wait.h> exists */
-
-#define WIZARD "bruno" /* the person allowed to use the -D option */
-#define RECORD "record"/* the file containing the list of topscorers */
-#define NEWS "news" /* the file containing the latest hack news */
-#define HELP "help" /* the file containing a description of the commands */
-#define SHELP "hh" /* abbreviated form of the same */
-#define RUMORFILE "rumors" /* a file with fortune cookies */
-#define DATAFILE "data" /* a file giving the meaning of symbols used */
-#define FMASK 0660 /* file creation mask */
-#define HLOCK "perm" /* an empty file used for locking purposes */
-#define LLOCK "safelock" /* link to previous */
-
-#ifdef UNIX
-/*
- * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
- * If defined, it can be overridden by the environment variable PAGER.
- * Hack will use its internal pager if DEF_PAGER is not defined.
- * (This might be preferable for security reasons.)
- * #define DEF_PAGER ".../mydir/mypager"
- */
-
-/*
- * If you define MAIL, then the player will be notified of new mail
- * when it arrives. If you also define DEF_MAILREADER then this will
- * be the default mail reader, and can be overridden by the environment
- * variable MAILREADER; otherwise an internal pager will be used.
- * A stat system call is done on the mailbox every MAILCKFREQ moves.
- */
-/* #define MAIL */
-#define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */
-#define MAILCKFREQ 100
-
-
-#define SHELL /* do not delete the '!' command */
-
-#ifdef BSD
-#define SUSPEND /* let ^Z suspend the game */
-#endif /* BSD */
-#endif /* UNIX */
-
-#ifdef CHDIR
-/*
- * If you define HACKDIR, then this will be the default playground;
- * otherwise it will be the current directory.
- */
-#ifdef QUEST
-#define HACKDIR _PATH_QUEST
-#else /* QUEST */
-#define HACKDIR _PATH_HACK
-#endif /* QUEST */
-
-/*
- * Some system administrators are stupid enough to make Hack suid root
- * or suid daemon, where daemon has other powers besides that of reading or
- * writing Hack files. In such cases one should be careful with chdir's
- * since the user might create files in a directory of his choice.
- * Of course SECURE is meaningful only if HACKDIR is defined.
- */
-#define SECURE /* do setuid(getuid()) after chdir() */
-
-/*
- * If it is desirable to limit the number of people that can play Hack
- * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
- * #define MAX_NR_OF_PLAYERS 100
- */
-#endif /* CHDIR */
-
-/* size of terminal screen is (at least) (ROWNO+2) by COLNO */
-#define COLNO 80
-#define ROWNO 22
-
-/*
- * small signed integers (8 bits suffice)
- * typedef char schar;
- * will do when you have signed characters; otherwise use
- * typedef short int schar;
- */
-typedef char schar;
-
-/*
- * small unsigned integers (8 bits suffice - but 7 bits do not)
- * - these are usually object types; be careful with inequalities! -
- * typedef unsigned char uchar;
- * will be satisfactory if you have an "unsigned char" type; otherwise use
- * typedef unsigned short int uchar;
- */
-typedef unsigned char uchar;
-
-/*
- * small integers in the range 0 - 127, usually coordinates
- * although they are nonnegative they must not be declared unsigned
- * since otherwise comparisons with signed quantities are done incorrectly
- */
-typedef schar xchar;
-typedef xchar boolean; /* 0 or 1 */
-#define TRUE 1
-#define FALSE 0
-
-/*
- * Declaration of bitfields in various structs; if your C compiler
- * doesnt handle bitfields well, e.g., if it is unable to initialize
- * structs containing bitfields, then you might use
- * #define Bitfield(x,n) uchar x
- * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
- */
-#define Bitfield(x,n) unsigned x:n
-
-#define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
-
-#endif /* CONFIG */
diff --git a/games/hack/data b/games/hack/data
deleted file mode 100644
index 5d8d509..0000000
--- a/games/hack/data
+++ /dev/null
@@ -1,232 +0,0 @@
- Hack & Quest data file - version 1.0.3
-@ human (or you)
-- a wall
-| a wall
-+ a door
-. the floor of a room
- a dark part of a room
-# a corridor
-} water filled area
-< the staircase to the previous level
-> the staircase to the next level
-^ a trap
-$ a pile, pot or chest of gold
-%% a piece of food
-! a potion
-* a gem
-? a scroll
-= a ring
-/ a wand
-[ a suit of armor
-) a weapon
-( a useful item (camera, key, rope etc.)
-0 an iron ball
-_ an iron chain
-` an enormous rock
-" an amulet
-, a trapper
-: a chameleon
-; a giant eel
-' a lurker above
-& a demon
-A a giant ant
-B a giant bat
-C a centaur;
- Of all the monsters put together by the Greek imagination
- the Centaurs (Kentauroi) constituted a class in themselves.
- Despite a strong streak of sensuality in their make-up,
- their normal behaviour was moral, and they took a kindly
- thought of man's welfare. The attempted outrage of Nessos on
- Deianeira, and that of the whole tribe of Centaurs on the
- Lapith women, are more than offset by the hospitality of
- Pholos and by the wisdom of Cheiron, physician, prophet,
- lyrist, and the instructor of Achilles. Further, the Cen-
- taurs were peculiar in that their nature, which united the
- body of a horse with the trunk and head of a man, involved
- an unthinkable duplication of vital organs and important
- members. So grotesque a combination seems almost un-Greek.
- These strange creatures were said to live in the caves and
- clefts of the mountains, myths associating them especially
- with the hills of Thessaly and the range of Erymanthos.
- [Mythology of all races, Vol. 1, pp. 270-271]
-D a dragon;
- In the West the dragon was the natural enemy of man. Although
- preferring to live in bleak and desolate regions, whenever it was
- seen among men it left in its wake a trail of destruction and
- disease. Yet any attempt to slay this beast was a perilous under-
- taking. For the dragon's assailant had to contend not only with
- clouds of sulphurous fumes pouring from its fire-breathing nos-
- trils, but also with the thrashings of its tail, the most deadly
- part of its serpent-like body.
- [From: Mythical Beasts by Deirdre Headon (The Leprechaun Library)]
-E a floating eye
-F a freezing sphere
-G a gnome;
- ... And then a gnome came by, carrying a bundle, an old fellow
- three times as large as an imp and wearing clothes of a sort,
- especially a hat. And he was clearly just as frightened as the
- imps though he could not go so fast. Ramon Alonzo saw that there
- must be some great trouble that was vexing magical things; and,
- since gnomes speak the language of men, and will answer if spoken
- to gently, he raised his hat, and asked of the gnome his name.
- The gnome did not stop his hasty shuffle a moment as he answered
- 'Alaraba' and grabbed the rim of his hat but forgot to doff it.
- 'What is the trouble, Alaraba?' said Ramon Alonzo.
- 'White magic. Run!' said the gnome ...
- [From: The Charwoman's Shadow, by Lord Dunsany.]
-H a hobgoblin;
- Hobgoblin. Used by the Puritans and in later times for
- wicked goblin spirits, as in Bunyan's 'Hobgoblin nor foul
- friend', but its more correct use is for the friendly spir-
- its of the brownie type. In 'A midsummer night's dream' a
- fairy says to Shakespeare's Puck:
- Those that Hobgoblin call you, and sweet Puck,
- You do their work, and they shall have good luck:
- Are you not he?
- and obviously Puck would not wish to be called a hobgoblin
- if that was an ill-omened word.
- Hobgoblins are on the whole, good-humoured and ready to be
- helpful, but fond of practical joking, and like most of the
- fairies rather nasty people to annoy. Boggarts hover on the
- verge of hobgoblindom. Bogles are just over the edge.
- One Hob mentioned by Henderson, was Hob Headless who haunted
- the road between Hurworth and Neasham, but could not cross
- the little river Kent, which flowed into the Tess. He was
- exorcised and laid under a large stone by the roadside for
- ninety-nine years and a day. If anyone was so unwary as to
- sit on that stone, he would be unable to quit it for ever.
- The ninety-nine years is nearly up, so trouble may soon be
- heard of on the road between Hurworth and Neasham.
- [Katharine Briggs, A dictionary of Fairies]
-I an invisible stalker
-J a jackal
-K a kobold
-L a leprechaun;
- The Irish Leprechaun is the Faeries' shoemaker and is known
- under various names in different parts of Ireland: Cluri-
- caune in Cork, Lurican in Kerry, Lurikeen in Kildare and Lu-
- rigadaun in Tipperary. Although he works for the Faeries,
- the Leprechaun is not of the same species. He is small, has
- dark skin and wears strange clothes. His nature has some-
- thing of the manic-depressive about it: first he is quite
- happy, whistling merrily as he nails a sole on to a shoe; a
- few minutes later, he is sullen and morose, drunk on his
- home-made heather ale. The Leprechaun's two great loves are
- tobacco and whiskey, and he is a first-rate con-man, impos-
- sible to out-fox. No one, no matter how clever, has ever
- managed to cheat him out of his hidden pot of gold or his
- magic shilling. At the last minute he always thinks of some
- way to divert his captor's attention and vanishes in the
- twinkling of an eye.
- [From: A Field Guide to the Little People
- by Nancy Arrowsmith & George Moorse. ]
-M a mimic
-N a nymph
-O an orc
-P a purple worm
-Q a quasit
-R a rust monster
-S a snake
-T a troll
-U an umber hulk
-V a vampire
-W a wraith
-X a xorn
-Y a yeti
-Z a zombie
-a an acid blob
-b a giant beetle
-c a cockatrice;
- Once in a great while, when the positions of the stars are
- just right, a seven-year-old rooster will lay an egg. Then,
- along will come a snake, to coil around the egg, or a toad,
- to squat upon the egg, keeping it warm and helping it to
- hatch. When it hatches, out comes a creature called basil-
- isk, or cockatrice, the most deadly of all creatures. A sin-
- gle glance from its yellow, piercing toad's eyes will kill
- both man and beast. Its power of destruction is said to be
- so great that sometimes simply to hear its hiss can prove
- fatal. Its breath is so venomenous that it causes all vege-
- tation to wither.
- There is, however, one creature which can withstand the
- basilisk's deadly gaze, and this is the weasel. No one knows
- why this is so, but although the fierce weasel can slay the
- basilisk, it will itself be killed in the struggle. Perhaps
- the weasel knows the basilisk's fatal weakness: if it ever
- sees its own reflection in a mirror it will perish instant-
- ly. But even a dead basilisk is dangerous, for it is said
- that merely touching its lifeless body can cause a person to
- sicken and die.
- [From: Mythical Beasts by Deirdre Headon (The Leprechaun
- Library) and other sources. ]
-d a dog
-e an ettin
-f a fog cloud
-g a gelatinous cube
-h a homunculus
-i an imp;
- ... imps ... little creatures of two feet high that could
- gambol and jump prodigiously; ...
- [From: The Charwoman's Shadow, by Lord Dunsany.]
-
- An 'imp' is an off-shoot or cutting. Thus an 'ymp tree' was
- a grafted tree, or one grown from a cutting, not from seed.
- 'Imp' properly means a small devil, an off-shoot of Satan,
- but the distinction between goblins or bogles and imps from
- hell is hard to make, and many in the Celtic countries as
- well as the English Puritans regarded all fairies as devils.
- The fairies of tradition often hover uneasily between the
- ghostly and the diabolic state.
- [Katharine Briggs, A dictionary of Fairies]
-j a jaguar
-k a killer bee
-l a leocrotta
-m a minotaur
-n a nurse
-o an owlbear
-p a piercer
-q a quivering blob
-r a giant rat
-s a scorpion
-t a tengu;
- The tengu was the most troublesome creature of Japanese
- legend. Part bird and part man, with red beak for a nose
- and flashing eyes, the tengu was notorious for stirring up
- feuds and prolonging enmity between families. Indeed, the
- belligerent tengus were supposed to have been man's first
- instructors in the use of arms.
- [From: Mythical Beasts by Deirdre Headon
- (The Leprechaun Library). ]
-u a unicorn;
- Men have always sought the elusive unicorn, for the single
- twisted horn which projected from its forehead was thought
- to be a powerful talisman. It was said that the unicorn had
- simply to dip the tip of its horn in a muddy pool for the
- water to become pure. Men also believed that to drink from
- this horn was a protection against all sickness, and that if
- the horn was ground to a powder it would act as an antidote
- to all poisons. Less than 200 years ago in France, the horn
- of a unicorn was used in a ceremony to test the royal food
- for poison.
- Although only the size of a small horse, the unicorn is a
- very fierce beast, capable of killing an elephant with a
- single thrust from its horn. Its fleetness of foot also
- makes this solitary creature difficult to capture. However,
- it can be tamed and captured by a maiden. Made gentle by the
- sight of a virgin, the unicorn can be lured to lay its head
- in her lap, and in this docile mood, the maiden may secure
- it with a golden rope.
- [From: Mythical Beasts by Deirdre Headon
- (The Leprechaun Library). ]
-v a violet fungi
-w a long worm;
- From its teeth the crysknife can be manufactured.
-~ the tail of a long worm
-x a xan;
- The xan were animals sent to prick the legs of the Lords of Xibalba.
-y a yellow light
-z a zruty;
- The zruty are wild and gigantic beings, living in the wildernesses
- of the Tatra mountains.
-1 The wizard of Yendor
-2 The mail daemon
diff --git a/games/hack/date.h b/games/hack/date.h
deleted file mode 100644
index 9a7ef76..0000000
--- a/games/hack/date.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-char datestring[] = "Tue Jul 23 1985";
diff --git a/games/hack/def.edog.h b/games/hack/def.edog.h
deleted file mode 100644
index a5c2b46..0000000
--- a/games/hack/def.edog.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.edog.h - version 1.0.2 */
-
-struct edog {
- long hungrytime; /* at this time dog gets hungry */
- long eattime; /* dog is eating */
- long droptime; /* moment dog dropped object */
- unsigned dropdist; /* dist of drpped obj from @ */
- unsigned apport; /* amount of training */
- long whistletime; /* last time he whistled */
-};
-#define EDOG(mp) ((struct edog *)(&(mp->mextra[0])))
diff --git a/games/hack/def.eshk.h b/games/hack/def.eshk.h
deleted file mode 100644
index 2ebf280..0000000
--- a/games/hack/def.eshk.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.eshk.h - version 1.0.2 : added 'following' */
-
-#define BILLSZ 200
-struct bill_x {
- unsigned bo_id;
- unsigned useup:1;
- unsigned bquan:7;
- unsigned price; /* price per unit */
-};
-
-struct eshk {
- long int robbed; /* amount stolen by most recent customer */
- boolean following; /* following customer since he owes us sth */
- schar shoproom; /* index in rooms; set by inshop() */
- coord shk; /* usual position shopkeeper */
- coord shd; /* position shop door */
- int shoplevel; /* level of his shop */
- int billct;
- struct bill_x bill[BILLSZ];
- int visitct; /* nr of visits by most recent customer */
- char customer[PL_NSIZ]; /* most recent customer */
- char shknam[PL_NSIZ];
-};
diff --git a/games/hack/def.flag.h b/games/hack/def.flag.h
deleted file mode 100644
index 221f33d..0000000
--- a/games/hack/def.flag.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.flag.h - version 1.0.3 */
-
-struct flag {
- unsigned ident; /* social security number for each monster */
- unsigned debug:1; /* in debugging mode */
-#define wizard flags.debug
- unsigned toplin:2; /* a top line (message) has been printed */
- /* 0: top line empty; 2: no --More-- reqd. */
- unsigned cbreak:1; /* in cbreak mode, rogue format */
- unsigned standout:1; /* use standout for --More-- */
- unsigned nonull:1; /* avoid sending nulls to the terminal */
- unsigned time:1; /* display elapsed 'time' */
- unsigned nonews:1; /* suppress news printing */
- unsigned notombstone:1;
- unsigned end_top, end_around; /* describe desired score list */
- unsigned end_own:1; /* idem (list all own scores) */
- unsigned no_rest_on_space:1; /* spaces are ignored */
- unsigned beginner:1;
- unsigned female:1;
- unsigned invlet_constant:1; /* let objects keep their
- inventory symbol */
- unsigned move:1;
- unsigned mv:1;
- unsigned run:3; /* 0: h (etc), 1: H (etc), 2: fh (etc) */
- /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
- unsigned nopick:1; /* do not pickup objects */
- unsigned echo:1; /* 1 to echo characters */
- unsigned botl:1; /* partially redo status line */
- unsigned botlx:1; /* print an entirely new bottom line */
- unsigned nscrinh:1; /* inhibit nscr() in pline(); */
- unsigned made_amulet:1;
- unsigned no_of_wizards:2;/* 0, 1 or 2 (wizard and his shadow) */
- /* reset from 2 to 1, but never to 0 */
- unsigned moonphase:3;
-#define NEW_MOON 0
-#define FULL_MOON 4
-
-};
-
-extern struct flag flags;
-
diff --git a/games/hack/def.func_tab.h b/games/hack/def.func_tab.h
deleted file mode 100644
index 63f74d2..0000000
--- a/games/hack/def.func_tab.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.func_tab.h - version 1.0.2 */
-
-struct func_tab {
- char f_char;
- int (*f_funct)();
-};
-
-extern struct func_tab cmdlist[];
-
-struct ext_func_tab {
- char *ef_txt;
- int (*ef_funct)();
-};
-
-extern struct ext_func_tab extcmdlist[];
diff --git a/games/hack/def.gen.h b/games/hack/def.gen.h
deleted file mode 100644
index f1e44fc..0000000
--- a/games/hack/def.gen.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.gen.h version 1.0.1: added ONCE flag */
-
-struct gen {
- struct gen *ngen;
- xchar gx,gy;
- unsigned gflag; /* 037: trap type; 040: SEEN flag */
- /* 0100: ONCE only */
-#define TRAPTYPE 037
-#define SEEN 040
-#define ONCE 0100
-};
-extern struct gen *fgold, *ftrap;
-struct gen *g_at();
-#define newgen() (struct gen *) alloc(sizeof(struct gen))
diff --git a/games/hack/def.gold.h b/games/hack/def.gold.h
deleted file mode 100644
index 8088908..0000000
--- a/games/hack/def.gold.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.gold.h - version 1.0.2 */
-
-struct gold {
- struct gold *ngold;
- xchar gx,gy;
- long amount;
-};
-
-extern struct gold *fgold;
-struct gold *g_at();
-#define newgold() (struct gold *) alloc(sizeof(struct gold))
diff --git a/games/hack/def.mkroom.h b/games/hack/def.mkroom.h
deleted file mode 100644
index ddbb62b..0000000
--- a/games/hack/def.mkroom.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.mkroom.h - version 1.0.3 */
-
-struct mkroom {
- schar lx,hx,ly,hy; /* usually xchar, but hx may be -1 */
- schar rtype,rlit,doorct,fdoor;
-};
-
-#define MAXNROFROOMS 15
-extern struct mkroom rooms[MAXNROFROOMS+1];
-
-#define DOORMAX 100
-extern coord doors[DOORMAX];
-
-/* various values of rtype */
-/* 0: ordinary room; 8-15: various shops */
-/* Note: some code assumes that >= 8 means shop, so be careful when adding
- new roomtypes */
-#define SWAMP 3
-#define VAULT 4
-#define BEEHIVE 5
-#define MORGUE 6
-#define ZOO 7
-#define SHOPBASE 8
-#define WANDSHOP 9
-#define GENERAL 15
diff --git a/games/hack/def.monst.h b/games/hack/def.monst.h
deleted file mode 100644
index 7a2d6e3..0000000
--- a/games/hack/def.monst.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.monst.h - version 1.0.2 */
-/* $FreeBSD$ */
-
-struct monst {
- struct monst *nmon;
- struct permonst *data;
- unsigned m_id;
- xchar mx,my;
- xchar mdx,mdy; /* if mdispl then pos where last displayed */
-#define MTSZ 4
- coord mtrack[MTSZ]; /* monster track */
- schar mhp,mhpmax;
- char mappearance; /* nonzero for undetected 'M's and for '1's */
- Bitfield(mimic,1); /* undetected mimic */
- Bitfield(mdispl,1); /* mdx,mdy valid */
- Bitfield(minvis,1); /* invisible */
- Bitfield(cham,1); /* shape-changer */
- Bitfield(mhide,1); /* hides beneath objects */
- Bitfield(mundetected,1); /* not seen in present hiding place */
- Bitfield(mspeed,2);
- Bitfield(msleep,1);
- Bitfield(mfroz,1);
- Bitfield(mconf,1);
- Bitfield(mflee,1); /* fleeing */
- Bitfield(mfleetim,7); /* timeout for mflee */
- Bitfield(mcan,1); /* has been cancelled */
- Bitfield(mtame,1); /* implies peaceful */
- Bitfield(mpeaceful,1); /* does not attack unprovoked */
- Bitfield(isshk,1); /* is shopkeeper */
- Bitfield(isgd,1); /* is guard */
- Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */
- Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */
- Bitfield(mtrapped,1); /* trapped in a pit or bear trap */
- Bitfield(mnamelth,6); /* length of name (following mxlth) */
-#ifndef NOWORM
- Bitfield(wormno,5); /* at most 31 worms on any level */
-#endif /* NOWORM */
- unsigned mtrapseen; /* bitmap of traps we've been trapped in */
- long mlstmv; /* prevent two moves at once */
- struct obj *minvent;
- long mgold;
- unsigned mxlth; /* length of following data */
- /* in order to prevent alignment problems mextra should
- be (or follow) a long int */
- long mextra[1]; /* monster dependent info */
-};
-
-#define newmonst(xl) (struct monst *) alloc((unsigned)(xl) + sizeof(struct monst))
-
-extern struct monst *fmon;
-extern struct monst *fallen_down;
-struct monst *m_at();
-
-/* these are in mspeed */
-#define MSLOW 1 /* slow monster */
-#define MFAST 2 /* speeded monster */
-
-#define NAME(mtmp) (((char *) mtmp->mextra) + mtmp->mxlth)
-#define MREGEN "TVi1"
-#define UNDEAD "ZVW "
diff --git a/games/hack/def.obj.h b/games/hack/def.obj.h
deleted file mode 100644
index 50b21df..0000000
--- a/games/hack/def.obj.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.obj.h - version 1.0.3 */
-
-struct obj {
- struct obj *nobj;
- unsigned o_id;
- unsigned o_cnt_id; /* id of container object is in */
- xchar ox,oy;
- xchar odx,ody;
- uchar otyp;
- uchar owt;
- uchar quan; /* use oextra for tmp gold objects */
- schar spe; /* quality of weapon, armor or ring (+ or -)
- number of charges for wand ( >= -1 )
- special for uball and amulet %% BAH */
- char olet;
- char invlet;
- Bitfield(oinvis,1); /* not yet implemented */
- Bitfield(odispl,1);
- Bitfield(known,1); /* exact nature known */
- Bitfield(dknown,1); /* color or text known */
- Bitfield(cursed,1);
- Bitfield(unpaid,1); /* on some bill */
- Bitfield(rustfree,1);
- Bitfield(onamelth,6);
- long age; /* creation date */
- long owornmask;
-#define W_ARM 01L
-#define W_ARM2 02L
-#define W_ARMH 04L
-#define W_ARMS 010L
-#define W_ARMG 020L
-#define W_ARMOR (W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG)
-#define W_RINGL 010000L /* make W_RINGL = RING_LEFT (see uprop) */
-#define W_RINGR 020000L
-#define W_RING (W_RINGL | W_RINGR)
-#define W_WEP 01000L
-#define W_BALL 02000L
-#define W_CHAIN 04000L
- long oextra[1]; /* used for name of ordinary objects - length
- is flexible; amount for tmp gold objects */
-};
-
-extern struct obj *fobj;
-
-#define newobj(xl) (struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
-#define ONAME(otmp) ((char *) otmp->oextra)
-#define OGOLD(otmp) (otmp->oextra[0])
diff --git a/games/hack/def.objclass.h b/games/hack/def.objclass.h
deleted file mode 100644
index 9e17de2..0000000
--- a/games/hack/def.objclass.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.objclass.h - version 1.0.3 */
-
-/* definition of a class of objects */
-
-struct objclass {
- char *oc_name; /* actual name */
- char *oc_descr; /* description when name unknown */
- char *oc_uname; /* called by user */
- Bitfield(oc_name_known,1);
- Bitfield(oc_merge,1); /* merge otherwise equal objects */
- char oc_olet;
- schar oc_prob; /* probability for mkobj() */
- schar oc_delay; /* delay when using such an object */
- uchar oc_weight;
- schar oc_oc1, oc_oc2;
- int oc_oi;
-#define nutrition oc_oi /* for foods */
-#define a_ac oc_oc1 /* for armors - only used in ARM_BONUS */
-#define ARM_BONUS(obj) ((10 - objects[obj->otyp].a_ac) + obj->spe)
-#define a_can oc_oc2 /* for armors */
-#define bits oc_oc1 /* for wands and rings */
- /* wands */
-#define NODIR 1
-#define IMMEDIATE 2
-#define RAY 4
- /* rings */
-#define SPEC 1 /* +n is meaningful */
-#define wldam oc_oc1 /* for weapons and PICK_AXE */
-#define wsdam oc_oc2 /* for weapons and PICK_AXE */
-#define g_val oc_oi /* for gems: value on exit */
-};
-
-extern struct objclass objects[];
-
-/* definitions of all object-symbols */
-
-#define ILLOBJ_SYM '\\'
-#define AMULET_SYM '"'
-#define FOOD_SYM '%'
-#define WEAPON_SYM ')'
-#define TOOL_SYM '('
-#define BALL_SYM '0'
-#define CHAIN_SYM '_'
-#define ROCK_SYM '`'
-#define ARMOR_SYM '['
-#define POTION_SYM '!'
-#define SCROLL_SYM '?'
-#define WAND_SYM '/'
-#define RING_SYM '='
-#define GEM_SYM '*'
-/* Other places with explicit knowledge of object symbols:
- * ....shk.c: char shtypes[] = "=/)%?![";
- * mklev.c: "=/)%?![<>"
- * hack.mkobj.c: char mkobjstr[] = "))[[!!!!????%%%%/=**";
- * hack.apply.c: otmp = getobj("0#%", "put in");
- * hack.eat.c: otmp = getobj("%", "eat");
- * hack.invent.c: if(index("!%?[)=*(0/\"", sym)){
- * hack.invent.c: || index("%?!*",otmp->olet))){
- */
diff --git a/games/hack/def.objects.h b/games/hack/def.objects.h
deleted file mode 100644
index 9d21be6..0000000
--- a/games/hack/def.objects.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.objects.h - version 1.0.3 */
-
-/* objects have letter " % ) ( 0 _ ` [ ! ? / = * */
-#include "config.h"
-#include "def.objclass.h"
-
-struct objclass objects[] = {
-
- { "strange object", NULL, NULL, 1, 0,
- ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 },
- { "amulet of Yendor", NULL, NULL, 1, 0,
- AMULET_SYM, 100, 0, 2, 0, 0, 0 },
-
-#define FOOD(name,prob,delay,weight,nutrition) { name, NULL, NULL, 1, 1,\
- FOOD_SYM, prob, delay, weight, 0, 0, nutrition }
-
-/* dog eats foods 0-4 but prefers 1 above 0,2,3,4 */
-/* food 4 can be read */
-/* food 5 improves your vision */
-/* food 6 makes you stronger (like Popeye) */
-/* foods CORPSE up to CORPSE+52 are cadavers */
-
- FOOD("food ration", 50, 5, 4, 800),
- FOOD("tripe ration", 20, 1, 2, 200),
- FOOD("pancake", 3, 1, 1, 200),
- FOOD("dead lizard", 3, 0, 1, 40),
- FOOD("fortune cookie", 7, 0, 1, 40),
- FOOD("carrot", 2, 0, 1, 50),
- FOOD("tin", 7, 0, 1, 0),
- FOOD("orange", 1, 0, 1, 80),
- FOOD("apple", 1, 0, 1, 50),
- FOOD("pear", 1, 0, 1, 50),
- FOOD("melon", 1, 0, 1, 100),
- FOOD("banana", 1, 0, 1, 80),
- FOOD("candy bar", 1, 0, 1, 100),
- FOOD("egg", 1, 0, 1, 80),
- FOOD("clove of garlic", 1, 0, 1, 40),
- FOOD("lump of royal jelly", 0, 0, 1, 200),
-
- FOOD("dead human", 0, 4, 40, 400),
- FOOD("dead giant ant", 0, 1, 3, 30),
- FOOD("dead giant bat", 0, 1, 3, 30),
- FOOD("dead centaur", 0, 5, 50, 500),
- FOOD("dead dragon", 0, 15, 150, 1500),
- FOOD("dead floating eye", 0, 1, 1, 10),
- FOOD("dead freezing sphere", 0, 1, 1, 10),
- FOOD("dead gnome", 0, 1, 10, 100),
- FOOD("dead hobgoblin", 0, 2, 20, 200),
- FOOD("dead stalker", 0, 4, 40, 400),
- FOOD("dead jackal", 0, 1, 10, 100),
- FOOD("dead kobold", 0, 1, 10, 100),
- FOOD("dead leprechaun", 0, 4, 40, 400),
- FOOD("dead mimic", 0, 4, 40, 400),
- FOOD("dead nymph", 0, 4, 40, 400),
- FOOD("dead orc", 0, 2, 20, 200),
- FOOD("dead purple worm", 0, 7, 70, 700),
- FOOD("dead quasit", 0, 2, 20, 200),
- FOOD("dead rust monster", 0, 5, 50, 500),
- FOOD("dead snake", 0, 1, 10, 100),
- FOOD("dead troll", 0, 4, 40, 400),
- FOOD("dead umber hulk", 0, 5, 50, 500),
- FOOD("dead vampire", 0, 4, 40, 400),
- FOOD("dead wraith", 0, 1, 1, 10),
- FOOD("dead xorn", 0, 7, 70, 700),
- FOOD("dead yeti", 0, 7, 70, 700),
- FOOD("dead zombie", 0, 1, 3, 30),
- FOOD("dead acid blob", 0, 1, 3, 30),
- FOOD("dead giant beetle", 0, 1, 1, 10),
- FOOD("dead cockatrice", 0, 1, 3, 30),
- FOOD("dead dog", 0, 2, 20, 200),
- FOOD("dead ettin", 0, 1, 3, 30),
- FOOD("dead fog cloud", 0, 1, 1, 10),
- FOOD("dead gelatinous cube", 0, 1, 10, 100),
- FOOD("dead homunculus", 0, 2, 20, 200),
- FOOD("dead imp", 0, 1, 1, 10),
- FOOD("dead jaguar", 0, 3, 30, 300),
- FOOD("dead killer bee", 0, 1, 1, 10),
- FOOD("dead leocrotta", 0, 5, 50, 500),
- FOOD("dead minotaur", 0, 7, 70, 700),
- FOOD("dead nurse", 0, 4, 40, 400),
- FOOD("dead owlbear", 0, 7, 70, 700),
- FOOD("dead piercer", 0, 2, 20, 200),
- FOOD("dead quivering blob", 0, 1, 10, 100),
- FOOD("dead giant rat", 0, 1, 3, 30),
- FOOD("dead giant scorpion", 0, 1, 10, 100),
- FOOD("dead tengu", 0, 3, 30, 300),
- FOOD("dead unicorn", 0, 3, 30, 300),
- FOOD("dead violet fungi", 0, 1, 10, 100),
- FOOD("dead long worm", 0, 5, 50, 500),
-/* %% wt of long worm should be proportional to its length */
- FOOD("dead xan", 0, 3, 30, 300),
- FOOD("dead yellow light", 0, 1, 1, 10),
- FOOD("dead zruty", 0, 6, 60, 600),
-
-/* weapons ... - ROCK come several at a time */
-/* weapons ... - (ROCK-1) are shot using idem+(BOW-ARROW) */
-/* weapons AXE, SWORD, THSWORD are good for worm-cutting */
-/* weapons (PICK-)AXE, DAGGER, CRYSKNIFE are good for tin-opening */
-#define WEAPON(name,prob,wt,ldam,sdam) { name, NULL, NULL, 1, 0 /*%%*/,\
- WEAPON_SYM, prob, 0, wt, ldam, sdam, 0 }
-
- WEAPON("arrow", 7, 0, 6, 6),
- WEAPON("sling bullet", 7, 0, 4, 6),
- WEAPON("crossbow bolt", 7, 0, 4, 6),
- WEAPON("dart", 7, 0, 3, 2),
- WEAPON("rock", 6, 1, 3, 3),
- WEAPON("boomerang", 2, 3, 9, 9),
- WEAPON("mace", 9, 3, 6, 7),
- WEAPON("axe", 6, 3, 6, 4),
- WEAPON("flail", 6, 3, 6, 5),
- WEAPON("long sword", 8, 3, 8, 12),
- WEAPON("two handed sword", 6, 4, 12, 6),
- WEAPON("dagger", 6, 3, 4, 3),
- WEAPON("worm tooth", 0, 4, 2, 2),
- WEAPON("crysknife", 0, 3, 10, 10),
- WEAPON("spear", 6, 3, 6, 8),
- WEAPON("bow", 6, 3, 4, 6),
- WEAPON("sling", 5, 3, 6, 6),
- WEAPON("crossbow", 6, 3, 4, 6),
-
- { "whistle", "whistle", NULL, 0, 0,
- TOOL_SYM, 90, 0, 2, 0, 0, 0 },
- { "magic whistle", "whistle", NULL, 0, 0,
- TOOL_SYM, 10, 0, 2, 0, 0, 0 },
- { "expensive camera", NULL, NULL, 1, 1,
- TOOL_SYM, 0, 0, 3, 0, 0, 0 },
- { "ice box", "large box", NULL, 0, 0,
- TOOL_SYM, 0, 0, 40, 0, 0, 0 },
- { "pick-axe", NULL, NULL, 1, 1,
- TOOL_SYM, 0, 0, 5, 6, 3, 0 },
- { "can opener", NULL, NULL, 1, 1,
- TOOL_SYM, 0, 0, 1, 0, 0, 0 },
- { "heavy iron ball", NULL, NULL, 1, 0,
- BALL_SYM, 100, 0, 20, 0, 0, 0 },
- { "iron chain", NULL, NULL, 1, 0,
- CHAIN_SYM, 100, 0, 20, 0, 0, 0 },
- { "enormous rock", NULL, NULL, 1, 0,
- ROCK_SYM, 100, 0, 200 /* > MAX_CARR_CAP */, 0, 0, 0 },
-
-#define ARMOR(name,prob,delay,ac,can) { name, NULL, NULL, 1, 0,\
- ARMOR_SYM, prob, delay, 8, ac, can, 0 }
- ARMOR("helmet", 3, 1, 9, 0),
- ARMOR("plate mail", 5, 5, 3, 2),
- ARMOR("splint mail", 8, 5, 4, 1),
- ARMOR("banded mail", 10, 5, 4, 0),
- ARMOR("chain mail", 10, 5, 5, 1),
- ARMOR("scale mail", 10, 5, 6, 0),
- ARMOR("ring mail", 15, 5, 7, 0),
- /* the armors below do not rust */
- ARMOR("studded leather armor", 13, 3, 7, 1),
- ARMOR("leather armor", 17, 3, 8, 0),
- ARMOR("elven cloak", 5, 0, 9, 3),
- ARMOR("shield", 3, 0, 9, 0),
- ARMOR("pair of gloves", 1, 1, 9, 0),
-
-#define POTION(name,color) { name, color, NULL, 0, 1,\
- POTION_SYM, 0, 0, 2, 0, 0, 0 }
-
- POTION("restore strength", "orange"),
- POTION("booze", "bubbly"),
- POTION("invisibility", "glowing"),
- POTION("fruit juice", "smoky"),
- POTION("healing", "pink"),
- POTION("paralysis", "puce"),
- POTION("monster detection", "purple"),
- POTION("object detection", "yellow"),
- POTION("sickness", "white"),
- POTION("confusion", "swirly"),
- POTION("gain strength", "purple-red"),
- POTION("speed", "ruby"),
- POTION("blindness", "dark green"),
- POTION("gain level", "emerald"),
- POTION("extra healing", "sky blue"),
- POTION("levitation", "brown"),
- POTION(NULL, "brilliant blue"),
- POTION(NULL, "clear"),
- POTION(NULL, "magenta"),
- POTION(NULL, "ebony"),
-
-#define SCROLL(name,text,prob) { name, text, NULL, 0, 1,\
- SCROLL_SYM, prob, 0, 3, 0, 0, 0 }
- SCROLL("mail", "KIRJE", 0),
- SCROLL("enchant armor", "ZELGO MER", 6),
- SCROLL("destroy armor", "JUYED AWK YACC", 5),
- SCROLL("confuse monster", "NR 9", 5),
- SCROLL("scare monster", "XIXAXA XOXAXA XUXAXA", 4),
- SCROLL("blank paper", "READ ME", 3),
- SCROLL("remove curse", "PRATYAVAYAH", 6),
- SCROLL("enchant weapon", "DAIYEN FOOELS", 6),
- SCROLL("damage weapon", "HACKEM MUCHE", 5),
- SCROLL("create monster", "LEP GEX VEN ZEA", 5),
- SCROLL("taming", "PRIRUTSENIE", 1),
- SCROLL("genocide", "ELBIB YLOH",2),
- SCROLL("light", "VERR YED HORRE", 10),
- SCROLL("teleportation", "VENZAR BORGAVVE", 5),
- SCROLL("gold detection", "THARR", 4),
- SCROLL("food detection", "YUM YUM", 1),
- SCROLL("identify", "KERNOD WEL", 18),
- SCROLL("magic mapping", "ELAM EBOW", 5),
- SCROLL("amnesia", "DUAM XNAHT", 3),
- SCROLL("fire", "ANDOVA BEGARIN", 5),
- SCROLL("punishment", "VE FORBRYDERNE", 1),
- SCROLL(NULL, "VELOX NEB", 0),
- SCROLL(NULL, "FOOBIE BLETCH", 0),
- SCROLL(NULL, "TEMOV", 0),
- SCROLL(NULL, "GARVEN DEH", 0),
-
-#define WAND(name,metal,prob,flags) { name, metal, NULL, 0, 0,\
- WAND_SYM, prob, 0, 3, flags, 0, 0 }
-
- WAND("light", "iridium", 10, NODIR),
- WAND("secret door detection", "tin", 5, NODIR),
- WAND("create monster", "platinum", 5, NODIR),
- WAND("wishing", "glass", 1, NODIR),
- WAND("striking", "zinc", 9, IMMEDIATE),
- WAND("slow monster", "balsa", 5, IMMEDIATE),
- WAND("speed monster", "copper", 5, IMMEDIATE),
- WAND("undead turning", "silver", 5, IMMEDIATE),
- WAND("polymorph", "brass", 5, IMMEDIATE),
- WAND("cancellation", "maple", 5, IMMEDIATE),
- WAND("teleportation", "pine", 5, IMMEDIATE),
- WAND("make invisible", "marble", 9, IMMEDIATE),
- WAND("digging", "iron", 5, RAY),
- WAND("magic missile", "aluminium", 10, RAY),
- WAND("fire", "steel", 5, RAY),
- WAND("sleep", "curved", 5, RAY),
- WAND("cold", "short", 5, RAY),
- WAND("death", "long", 1, RAY),
- WAND(NULL, "oak", 0, 0),
- WAND(NULL, "ebony", 0, 0),
- WAND(NULL, "runed", 0, 0),
-
-#define RING(name,stone,spec) { name, stone, NULL, 0, 0,\
- RING_SYM, 0, 0, 1, spec, 0, 0 }
-
- RING("adornment", "engagement", 0),
- RING("teleportation", "wooden", 0),
- RING("regeneration", "black onyx", 0),
- RING("searching", "topaz", 0),
- RING("see invisible", "pearl", 0),
- RING("stealth", "sapphire", 0),
- RING("levitation", "moonstone", 0),
- RING("poison resistance", "agate", 0),
- RING("aggravate monster", "tiger eye", 0),
- RING("hunger", "shining", 0),
- RING("fire resistance", "gold", 0),
- RING("cold resistance", "copper", 0),
- RING("protection from shape changers", "diamond", 0),
- RING("conflict", "jade", 0),
- RING("gain strength", "ruby", SPEC),
- RING("increase damage", "silver", SPEC),
- RING("protection", "granite", SPEC),
- RING("warning", "wire", 0),
- RING("teleport control", "iron", 0),
- RING(NULL, "ivory", 0),
- RING(NULL, "blackened", 0),
-
-/* gems ************************************************************/
-#define GEM(name,color,prob,gval) { name, color, NULL, 0, 1,\
- GEM_SYM, prob, 0, 1, 0, 0, gval }
- GEM("diamond", "blue", 1, 4000),
- GEM("ruby", "red", 1, 3500),
- GEM("sapphire", "blue", 1, 3000),
- GEM("emerald", "green", 1, 2500),
- GEM("turquoise", "green", 1, 2000),
- GEM("aquamarine", "blue", 1, 1500),
- GEM("tourmaline", "green", 1, 1000),
- GEM("topaz", "yellow", 1, 900),
- GEM("opal", "yellow", 1, 800),
- GEM("garnet", "dark", 1, 700),
- GEM("amethyst", "violet", 2, 650),
- GEM("agate", "green", 2, 600),
- GEM("onyx", "white", 2, 550),
- GEM("jasper", "yellowish brown", 2, 500),
- GEM("jade", "green", 2, 450),
- GEM("worthless piece of blue glass", "blue", 20, 0),
- GEM("worthless piece of red glass", "red", 20, 0),
- GEM("worthless piece of yellow glass", "yellow", 20, 0),
- GEM("worthless piece of green glass", "green", 20, 0),
- { NULL, NULL, NULL, 0, 0, ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 }
-};
-
-char obj_symbols[] = {
- ILLOBJ_SYM, AMULET_SYM, FOOD_SYM, WEAPON_SYM, TOOL_SYM,
- BALL_SYM, CHAIN_SYM, ROCK_SYM, ARMOR_SYM, POTION_SYM, SCROLL_SYM,
- WAND_SYM, RING_SYM, GEM_SYM, 0 };
-int bases[sizeof(obj_symbols)];
diff --git a/games/hack/def.permonst.h b/games/hack/def.permonst.h
deleted file mode 100644
index b19efc6..0000000
--- a/games/hack/def.permonst.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.permonst.h - version 1.0.2 */
-
-struct permonst {
- char *mname,mlet;
- schar mlevel,mmove,ac,damn,damd;
- unsigned pxlth;
-};
-
-extern struct permonst mons[];
-#define PM_ACID_BLOB &mons[7]
-#define PM_ZOMBIE &mons[13]
-#define PM_PIERCER &mons[17]
-#define PM_KILLER_BEE &mons[26]
-#define PM_WRAITH &mons[33]
-#define PM_MIMIC &mons[37]
-#define PM_VAMPIRE &mons[43]
-#define PM_CHAMELEON &mons[47]
-#define PM_DEMON &mons[54]
-#define PM_MINOTAUR &mons[55] /* last in mons array */
-#define PM_SHK &mons[56] /* very last */
-#define PM_GHOST &pm_ghost
-#define PM_EEL &pm_eel
-#define PM_WIZARD &pm_wizard
-#define CMNUM 55 /* number of common monsters */
diff --git a/games/hack/def.rm.h b/games/hack/def.rm.h
deleted file mode 100644
index 162c10d..0000000
--- a/games/hack/def.rm.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.rm.h - version 1.0.2 */
-/* $FreeBSD$ */
-
-/* Level location types */
-#define HWALL 1
-#define VWALL 2
-#define SDOOR 3
-#define SCORR 4
-#define LDOOR 5
-#define POOL 6 /* not yet fully implemented */
- /* this should in fact be a bit like lit */
-#define DOOR 7
-#define CORR 8
-#define ROOM 9
-#define STAIRS 10
-
-/*
- * Avoid using the level types in inequalities:
- * these types are subject to change.
- * Instead, use one of the macros below.
- */
-#define IS_WALL(typ) ((typ) <= VWALL)
-#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */
-#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
-#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM or STAIRS */
-#define ZAP_POS(typ) ((typ) > DOOR)
-
-/*
- * A few of the associated symbols are not hardwired.
- */
-#ifdef QUEST
-#define CORR_SYM ':'
-#else
-#define CORR_SYM '#'
-#endif /* QUEST */
-#define POOL_SYM '}'
-
-#define ERRCHAR '{'
-
-/*
- * The structure describing a coordinate position.
- * Before adding fields, remember that this will significantly affect
- * the size of temporary files and save files.
- */
-struct rm {
- char scrsym;
- unsigned typ:5;
- unsigned new:1;
- unsigned seen:1;
- unsigned lit:1;
-};
-extern struct rm levl[COLNO][ROWNO];
diff --git a/games/hack/def.trap.h b/games/hack/def.trap.h
deleted file mode 100644
index 26946ad..0000000
--- a/games/hack/def.trap.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.trap.h - version 1.0.2 */
-
-struct trap {
- struct trap *ntrap;
- xchar tx,ty;
- unsigned ttyp:5;
- unsigned tseen:1;
- unsigned once:1;
-};
-
-extern struct trap *ftrap;
-struct trap *t_at();
-#define newtrap() (struct trap *) alloc(sizeof(struct trap))
-
-/* various kinds of traps */
-#define BEAR_TRAP 0
-#define ARROW_TRAP 1
-#define DART_TRAP 2
-#define TRAPDOOR 3
-#define TELEP_TRAP 4
-#define PIT 5
-#define SLP_GAS_TRAP 6
-#define PIERC 7
-#define MIMIC 8 /* used only in mklev.c */
-#define TRAPNUM 9 /* if not less than 32, change sizeof(ttyp) */
- /* see also mtrapseen (bit map) */
diff --git a/games/hack/def.wseg.h b/games/hack/def.wseg.h
deleted file mode 100644
index 8b52277..0000000
--- a/games/hack/def.wseg.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* def.wseg.h - version 1.0.2 */
-/* $FreeBSD$ */
-
-#ifndef NOWORM
-/* worm structure */
-struct wseg {
- struct wseg *nseg;
- xchar wx,wy;
- unsigned wdispl:1;
-};
-
-#define newseg() (struct wseg *) alloc(sizeof(struct wseg))
-#endif /* NOWORM */
diff --git a/games/hack/hack.6 b/games/hack/hack.6
deleted file mode 100644
index de34120..0000000
--- a/games/hack/hack.6
+++ /dev/null
@@ -1,152 +0,0 @@
-.\" $FreeBSD$
-.TH HACK 6 "31 March 1985"
-.UC 4
-.SH NAME
-hack \- exploring The Dungeons of Doom
-.SH SYNOPSIS
-.B /usr/games/hack
-[
-.B \-d
-.I directory
-]
-[
-.B \-n
-]
-[
-.B \-u
-.I playername
-]
-.br
-.B /usr/games/hack
-[
-.B \-d
-.I directory
-]
-.B \-s
-[
-.B \-X
-]
-[
-.I playernames
-]
-.SH DESCRIPTION
-.I Hack
-is a display oriented dungeons & dragons - like game.
-Both display and command structure resemble rogue.
-(For a game with the same structure but entirely different display -
-a real cave instead of dull rectangles - try Quest.)
-.PP
-To get started you really only need to know two commands. The command
-.B ?
-will give you a list of the available commands and the command
-.B /
-will identify the things you see on the screen.
-.PP
-To win the game (as opposed to merely playing to beat other people high
-scores) you must locate the Amulet of Yendor which is somewhere below
-the 20th level of the dungeon and get it out. Nobody has achieved this
-yet and if somebody does, he will probably go down in history as a hero
-among heroes.
-.PP
-When the game ends, either by your death, when you quit, or if you escape
-from the caves,
-.I hack
-will give you (a fragment of) the list of top scorers. The scoring
-is based on many aspects of your behavior but a rough estimate is
-obtained by taking the amount of gold you've found in the cave plus four
-times your (real) experience. Precious stones may be worth a lot of gold
-when brought to the exit.
-There is a 10% penalty for getting yourself killed.
-.PP
-The administration of the game is kept in the directory specified with the
-.B \-d
-option, or, if no such option is given, in the directory specified by
-the environment variable HACKDIR, or, if no such variable exists, in
-the current directory. This same directory contains several auxiliary
-files such as lockfiles and the list of top scorers and a subdirectory
-.I save
-where games are saved.
-The game administrator may however choose to install hack with a fixed
-playing ground, usually /usr/games/lib/hackdir.
-.PP
-The
-.B \-n
-option suppresses printing of the news.
-.PP
-The
-.B \-u
-.I playername
-option supplies the answer to the question "Who are you?".
-When
-.I playername
-has as suffix one of
-.B \-T \-S \-K \-F \-C \-W
-then this supplies the answer to the question "What kind of character ... ?".
-.PP
-The
-.B \-s
-option will print out the list of your scores. It may be followed by arguments
-.B \-X
-where X is one of the letters C, F, K, S, T, W to print the scores of
-Cavemen, Fighters, Knights, Speleologists, Tourists or Wizards.
-It may also be followed by one or more player names to print the scores of the
-players mentioned.
-.SH AUTHORS
-Jay Fenlason (+ Kenny Woodland, Mike Thome and Jon Payne) wrote the
-original hack, very much like rogue (but full of bugs).
-.br
-Andries Brouwer continuously deformed their sources into the current
-version - in fact an entirely different game.
-.SH FILES
-.DT
-.ta \w'data, rumors\ \ \ 'u
-hack The hack program.
-.br
-data, rumors Data files used by hack.
-.br
-help, hh Help data files.
-.br
-record The list of top scorers.
-.br
-save A subdirectory containing the saved
-.br
- games.
-.br
-bones_dd Descriptions of the ghost and
-.br
- belongings of a deceased adventurer.
-.br
-xlock.dd Description of a dungeon level.
-.br
-safelock Lock file for xlock.
-.br
-record_lock Lock file for record.
-.SH ENVIRONMENT
-.DT
-.ta \w'HACKPAGER, PAGER\ \ \ 'u
-USER or LOGNAME Your login name.
-.br
-HOME Your home directory.
-.br
-SHELL Your shell.
-.br
-TERM The type of your terminal.
-.br
-HACKPAGER, PAGER Pager used instead of default pager.
-.br
-MAIL Mailbox file.
-.br
-MAILREADER Reader used instead of default.
-.br
-HACKDIR Playground.
-.br
-HACKOPTIONS String predefining several hack options
-.br
- (see help file).
-.br
-
-Several other environment variables are used in debugging (wizard) mode,
-like GENOCIDED, INVENT, MAGIC and SHOPTYPE.
-.SH BUGS
-Probably infinite.
-Mail complaints to mcvax!aeb .
diff --git a/games/hack/hack.Decl.c b/games/hack/hack.Decl.c
deleted file mode 100644
index 840f4e0..0000000
--- a/games/hack/hack.Decl.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.Decl.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-char nul[40]; /* contains zeros */
-char plname[PL_NSIZ]; /* player name */
-char lock[PL_NSIZ+4] = "1lock"; /* long enough for login name .99 */
-
-boolean in_mklev, restoring;
-
-struct rm levl[COLNO][ROWNO]; /* level map */
-#ifndef QUEST
-#include "def.mkroom.h"
-struct mkroom rooms[MAXNROFROOMS+1];
-coord doors[DOORMAX];
-#endif /* QUEST */
-struct monst *fmon = 0;
-struct trap *ftrap = 0;
-struct gold *fgold = 0;
-struct obj *fobj = 0, *fcobj = 0, *invent = 0, *uwep = 0, *uarm = 0,
- *uarm2 = 0, *uarmh = 0, *uarms = 0, *uarmg = 0, *uright = 0,
- *uleft = 0, *uchain = 0, *uball = 0;
-struct flag flags;
-struct you u;
-struct monst youmonst; /* dummy; used as return value for boomhit */
-
-xchar dlevel = 1;
-xchar xupstair, yupstair, xdnstair, ydnstair;
-char *save_cm = 0, *killer, *nomovemsg;
-
-long moves = 1;
-long wailmsg = 0;
-
-int multi = 0;
-char genocided[60];
-char fut_geno[60];
-
-xchar curx,cury;
-xchar seelx, seehx, seely, seehy; /* corners of lit room */
-
-coord bhitpos;
-
-char quitchars[] = " \r\n\033";
diff --git a/games/hack/hack.apply.c b/games/hack/hack.apply.c
deleted file mode 100644
index 0de483d..0000000
--- a/games/hack/hack.apply.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.apply.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-#include "def.edog.h"
-#include "def.mkroom.h"
-static struct monst *bchit();
-extern struct obj *addinv();
-extern struct trap *maketrap();
-extern int (*occupation)();
-extern char *occtxt;
-extern char quitchars[];
-extern char pl_character[];
-
-static void use_camera(), use_ice_box(), use_whistle(), use_magic_whistle();
-static int use_pick_axe();
-
-doapply() {
- struct obj *obj;
- int res = 1;
-
- obj = getobj("(", "use or apply");
- if(!obj) return(0);
-
- switch(obj->otyp){
- case EXPENSIVE_CAMERA:
- use_camera(obj); break;
- case ICE_BOX:
- use_ice_box(obj); break;
- case PICK_AXE:
- res = use_pick_axe(obj);
- break;
-
- case MAGIC_WHISTLE:
- if(pl_character[0] == 'W' || u.ulevel > 9) {
- use_magic_whistle(obj);
- break;
- }
- /* FALLTHROUGH */
- case WHISTLE:
- use_whistle(obj);
- break;
-
- case CAN_OPENER:
- if(!carrying(TIN)) {
- pline("You have no can to open.");
- goto xit;
- }
- pline("You cannot open a tin without eating its contents.");
- pline("In order to eat, use the 'e' command.");
- if(obj != uwep)
- pline("Opening the tin will be much easier if you wield the can-opener.");
- goto xit;
-
- default:
- pline("Sorry, I don't know how to use that.");
- xit:
- nomul(0);
- return(0);
- }
- nomul(0);
- return(res);
-}
-
-/* ARGSUSED */
-static void
-use_camera(obj) /* */ struct obj *obj; {
-struct monst *mtmp;
- if(!getdir(1)){ /* ask: in what direction? */
- flags.move = multi = 0;
- return;
- }
- if(u.uswallow) {
- pline("You take a picture of %s's stomach.", monnam(u.ustuck));
- return;
- }
- if(u.dz) {
- pline("You take a picture of the %s.",
- (u.dz > 0) ? "floor" : "ceiling");
- return;
- }
- if(mtmp = bchit(u.dx, u.dy, COLNO, '!')) {
- if(mtmp->msleep){
- mtmp->msleep = 0;
- pline("The flash awakens %s.", monnam(mtmp)); /* a3 */
- } else
- if(mtmp->data->mlet != 'y')
- if(mtmp->mcansee || mtmp->mblinded){
- int tmp = dist(mtmp->mx,mtmp->my);
- int tmp2;
- if(cansee(mtmp->mx,mtmp->my))
- pline("%s is blinded by the flash!", Monnam(mtmp));
- setmangry(mtmp);
- if(tmp < 9 && !mtmp->isshk && rn2(4)) {
- mtmp->mflee = 1;
- if(rn2(4)) mtmp->mfleetim = rnd(100);
- }
- if(tmp < 3) mtmp->mcansee = mtmp->mblinded = 0;
- else {
- tmp2 = mtmp->mblinded;
- tmp2 += rnd(1 + 50/tmp);
- if(tmp2 > 127) tmp2 = 127;
- mtmp->mblinded = tmp2;
- mtmp->mcansee = 0;
- }
- }
- }
-}
-
-static
-struct obj *current_ice_box; /* a local variable of use_ice_box, to be
- used by its local procedures in/ck_ice_box */
-static
-in_ice_box(obj) struct obj *obj; {
- if(obj == current_ice_box ||
- (Punished && (obj == uball || obj == uchain))){
- pline("You must be kidding.");
- return(0);
- }
- if(obj->owornmask & (W_ARMOR | W_RING)) {
- pline("You cannot refrigerate something you are wearing.");
- return(0);
- }
- if(obj->owt + current_ice_box->owt > 70) {
- pline("It won't fit.");
- return(1); /* be careful! */
- }
- if(obj == uwep) {
- if(uwep->cursed) {
- pline("Your weapon is welded to your hand!");
- return(0);
- }
- setuwep((struct obj *) 0);
- }
- current_ice_box->owt += obj->owt;
- freeinv(obj);
- obj->o_cnt_id = current_ice_box->o_id;
- obj->nobj = fcobj;
- fcobj = obj;
- obj->age = moves - obj->age; /* actual age */
- return(1);
-}
-
-static
-ck_ice_box(obj) struct obj *obj; {
- return(obj->o_cnt_id == current_ice_box->o_id);
-}
-
-static
-out_ice_box(obj) struct obj *obj; {
-struct obj *otmp;
- if(obj == fcobj) fcobj = fcobj->nobj;
- else {
- for(otmp = fcobj; otmp->nobj != obj; otmp = otmp->nobj)
- if(!otmp->nobj) panic("out_ice_box");
- otmp->nobj = obj->nobj;
- }
- current_ice_box->owt -= obj->owt;
- obj->age = moves - obj->age; /* simulated point of time */
- (void) addinv(obj);
-}
-
-static void
-use_ice_box(obj) struct obj *obj; {
-int cnt = 0;
-struct obj *otmp;
- current_ice_box = obj; /* for use by in/out_ice_box */
- for(otmp = fcobj; otmp; otmp = otmp->nobj)
- if(otmp->o_cnt_id == obj->o_id)
- cnt++;
- if(!cnt) pline("Your ice-box is empty.");
- else {
- pline("Do you want to take something out of the ice-box? [yn] ");
- if(readchar() == 'y')
- if(askchain(fcobj, (char *) 0, 0, out_ice_box, ck_ice_box, 0))
- return;
- pline("That was all. Do you wish to put something in? [yn] ");
- if(readchar() != 'y') return;
- }
- /* call getobj: 0: allow cnt; #: allow all types; %: expect food */
- otmp = getobj("0#%", "put in");
- if(!otmp || !in_ice_box(otmp))
- flags.move = multi = 0;
-}
-
-static
-struct monst *
-bchit(ddx,ddy,range,sym) int ddx,ddy,range; char sym; {
- struct monst *mtmp = (struct monst *) 0;
- int bchx = u.ux, bchy = u.uy;
-
- if(sym) Tmp_at(-1, sym); /* open call */
- while(range--) {
- bchx += ddx;
- bchy += ddy;
- if(mtmp = m_at(bchx,bchy))
- break;
- if(!ZAP_POS(levl[bchx][bchy].typ)) {
- bchx -= ddx;
- bchy -= ddy;
- break;
- }
- if(sym) Tmp_at(bchx, bchy);
- }
- if(sym) Tmp_at(-1, -1);
- return(mtmp);
-}
-
-/* ARGSUSED */
-static void
-use_whistle(obj) struct obj *obj; {
-struct monst *mtmp = fmon;
- pline("You produce a high whistling sound.");
- while(mtmp) {
- if(dist(mtmp->mx,mtmp->my) < u.ulevel*20) {
- if(mtmp->msleep)
- mtmp->msleep = 0;
- if(mtmp->mtame)
- EDOG(mtmp)->whistletime = moves;
- }
- mtmp = mtmp->nmon;
- }
-}
-
-/* ARGSUSED */
-static void
-use_magic_whistle(obj) struct obj *obj; {
-struct monst *mtmp = fmon;
- pline("You produce a strange whistling sound.");
- while(mtmp) {
- if(mtmp->mtame) mnexto(mtmp);
- mtmp = mtmp->nmon;
- }
-}
-
-static int dig_effort; /* effort expended on current pos */
-static uchar dig_level;
-static coord dig_pos;
-static boolean dig_down;
-
-static
-dig() {
- struct rm *lev;
- int dpx = dig_pos.x, dpy = dig_pos.y;
-
- /* perhaps a nymph stole his pick-axe while he was busy digging */
- /* or perhaps he teleported away */
- if(u.uswallow || !uwep || uwep->otyp != PICK_AXE ||
- dig_level != dlevel ||
- ((dig_down && (dpx != u.ux || dpy != u.uy)) ||
- (!dig_down && dist(dpx,dpy) > 2)))
- return(0);
-
- dig_effort += 10 + abon() + uwep->spe + rn2(5);
- if(dig_down) {
- if(!xdnstair) {
- pline("The floor here seems too hard to dig in.");
- return(0);
- }
- if(dig_effort > 250) {
- dighole();
- return(0); /* done with digging */
- }
- if(dig_effort > 50) {
- struct trap *ttmp = t_at(dpx,dpy);
-
- if(!ttmp) {
- ttmp = maketrap(dpx,dpy,PIT);
- ttmp->tseen = 1;
- pline("You have dug a pit.");
- u.utrap = rn1(4,2);
- u.utraptype = TT_PIT;
- return(0);
- }
- }
- } else
- if(dig_effort > 100) {
- char *digtxt;
- struct obj *obj;
-
- lev = &levl[dpx][dpy];
- if(obj = sobj_at(ENORMOUS_ROCK, dpx, dpy)) {
- fracture_rock(obj);
- digtxt = "The rock falls apart.";
- } else if(!lev->typ || lev->typ == SCORR) {
- lev->typ = CORR;
- digtxt = "You succeeded in cutting away some rock.";
- } else if(lev->typ == HWALL || lev->typ == VWALL
- || lev->typ == SDOOR) {
- lev->typ = xdnstair ? DOOR : ROOM;
- digtxt = "You just made an opening in the wall.";
- } else
- digtxt = "Now what exactly was it that you were digging in?";
- mnewsym(dpx, dpy);
- prl(dpx, dpy);
- pline("%s", digtxt); /* after mnewsym & prl */
- return(0);
- } else {
- if(IS_WALL(levl[dpx][dpy].typ)) {
- int rno = inroom(dpx,dpy);
-
- if(rno >= 0 && rooms[rno].rtype >= 8) {
- pline("This wall seems too hard to dig into.");
- return(0);
- }
- }
- pline("You hit the rock with all your might.");
- }
- return(1);
-}
-
-/* When will hole be finished? Very rough indication used by shopkeeper. */
-holetime() {
- return( (occupation == dig) ? (250 - dig_effort)/20 : -1);
-}
-
-dighole()
-{
- struct trap *ttmp = t_at(u.ux, u.uy);
-
- if(!xdnstair) {
- pline("The floor here seems too hard to dig in.");
- } else {
- if(ttmp)
- ttmp->ttyp = TRAPDOOR;
- else
- ttmp = maketrap(u.ux, u.uy, TRAPDOOR);
- ttmp->tseen = 1;
- pline("You've made a hole in the floor.");
- if(!u.ustuck) {
- if(inshop())
- shopdig(1);
- pline("You fall through ...");
- if(u.utraptype == TT_PIT) {
- u.utrap = 0;
- u.utraptype = 0;
- }
- goto_level(dlevel+1, FALSE);
- }
- }
-}
-
-static
-use_pick_axe(obj)
-struct obj *obj;
-{
- char dirsyms[12];
- extern char sdir[];
- char *dsp = dirsyms, *sdp = sdir;
- struct monst *mtmp;
- struct rm *lev;
- int rx, ry, res = 0;
-
- if(obj != uwep) {
- if(uwep && uwep->cursed) {
- /* Andreas Bormann - ihnp4!decvax!mcvax!unido!ab */
- pline("Since your weapon is welded to your hand,");
- pline("you cannot use that pick-axe.");
- return(0);
- }
- pline("You now wield %s.", doname(obj));
- setuwep(obj);
- res = 1;
- }
- while(*sdp) {
- (void) movecmd(*sdp); /* sets u.dx and u.dy and u.dz */
- rx = u.ux + u.dx;
- ry = u.uy + u.dy;
- if(u.dz > 0 || (u.dz == 0 && isok(rx, ry) &&
- (IS_ROCK(levl[rx][ry].typ)
- || sobj_at(ENORMOUS_ROCK, rx, ry))))
- *dsp++ = *sdp;
- sdp++;
- }
- *dsp = 0;
- pline("In what direction do you want to dig? [%s] ", dirsyms);
- if(!getdir(0)) /* no txt */
- return(res);
- if(u.uswallow && attack(u.ustuck)) /* return(1) */;
- else
- if(u.dz < 0)
- pline("You cannot reach the ceiling.");
- else
- if(u.dz == 0) {
- if(Confusion)
- confdir();
- rx = u.ux + u.dx;
- ry = u.uy + u.dy;
- if((mtmp = m_at(rx, ry)) && attack(mtmp))
- return(1);
- if(!isok(rx, ry)) {
- pline("Clash!");
- return(1);
- }
- lev = &levl[rx][ry];
- if(lev->typ == DOOR)
- pline("Your %s against the door.",
- aobjnam(obj, "clang"));
- else if(!IS_ROCK(lev->typ)
- && !sobj_at(ENORMOUS_ROCK, rx, ry)) {
- /* ACCESSIBLE or POOL */
- pline("You swing your %s through thin air.",
- aobjnam(obj, (char *) 0));
- } else {
- if(dig_pos.x != rx || dig_pos.y != ry
- || dig_level != dlevel || dig_down) {
- dig_down = FALSE;
- dig_pos.x = rx;
- dig_pos.y = ry;
- dig_level = dlevel;
- dig_effort = 0;
- pline("You start digging.");
- } else
- pline("You continue digging.");
- occupation = dig;
- occtxt = "digging";
- }
- } else if(Levitation) {
- pline("You cannot reach the floor.");
- } else {
- if(dig_pos.x != u.ux || dig_pos.y != u.uy
- || dig_level != dlevel || !dig_down) {
- dig_down = TRUE;
- dig_pos.x = u.ux;
- dig_pos.y = u.uy;
- dig_level = dlevel;
- dig_effort = 0;
- pline("You start digging in the floor.");
- if(inshop())
- shopdig(0);
- } else
- pline("You continue digging in the floor.");
- occupation = dig;
- occtxt = "digging";
- }
- return(1);
-}
diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c
deleted file mode 100644
index 97f8c26..0000000
--- a/games/hack/hack.bones.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.bones.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern char plname[PL_NSIZ];
-extern long somegold();
-extern struct monst *makemon();
-extern struct permonst pm_ghost;
-
-char bones[] = "bones_xx";
-
-/* save bones and possessions of a deceased adventurer */
-savebones(){
-int fd;
-struct obj *otmp;
-struct trap *ttmp;
-struct monst *mtmp;
- if(dlevel <= 0 || dlevel > MAXLEVEL) return;
- if(!rn2(1 + dlevel/2)) return; /* not so many ghosts on low levels */
- bones[6] = '0' + (dlevel/10);
- bones[7] = '0' + (dlevel%10);
- if((fd = open(bones,0)) >= 0){
- (void) close(fd);
- return;
- }
- /* drop everything; the corpse's possessions are usually cursed */
- otmp = invent;
- while(otmp){
- otmp->ox = u.ux;
- otmp->oy = u.uy;
- otmp->age = 0; /* very long ago */
- otmp->owornmask = 0;
- if(rn2(5)) otmp->cursed = 1;
- if(!otmp->nobj){
- otmp->nobj = fobj;
- fobj = invent;
- invent = 0; /* superfluous */
- break;
- }
- otmp = otmp->nobj;
- }
- if(!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) return;
- mtmp->mx = u.ux;
- mtmp->my = u.uy;
- mtmp->msleep = 1;
- (void) strcpy((char *) mtmp->mextra, plname);
- mkgold(somegold() + d(dlevel,30), u.ux, u.uy);
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
- mtmp->m_id = 0;
- if(mtmp->mtame) {
- mtmp->mtame = 0;
- mtmp->mpeaceful = 0;
- }
- mtmp->mlstmv = 0;
- if(mtmp->mdispl) unpmon(mtmp);
- }
- for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
- ttmp->tseen = 0;
- for(otmp = fobj; otmp; otmp = otmp->nobj) {
- otmp->o_id = 0;
- /* otmp->o_cnt_id = 0; - superfluous */
- otmp->onamelth = 0;
- otmp->known = 0;
- otmp->invlet = 0;
- if(otmp->olet == AMULET_SYM && !otmp->spe) {
- otmp->spe = -1; /* no longer the actual amulet */
- otmp->cursed = 1; /* flag as gotten from a ghost */
- }
- }
- if((fd = creat(bones, FMASK)) < 0) return;
- savelev(fd,dlevel);
- (void) close(fd);
-}
-
-getbones(){
-int fd,x,y,ok;
- if(rn2(3)) return(0); /* only once in three times do we find bones */
- bones[6] = '0' + dlevel/10;
- bones[7] = '0' + dlevel%10;
- if((fd = open(bones, 0)) < 0) return(0);
- if((ok = uptodate(fd)) != 0){
- getlev(fd, 0, dlevel);
- for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++)
- levl[x][y].seen = levl[x][y].new = 0;
- }
- (void) close(fd);
-#ifdef WIZARD
- if(!wizard) /* duvel!frans: don't remove bones while debugging */
-#endif /* WiZARD */
- if(unlink(bones) < 0){
- pline("Cannot unlink %s .", bones);
- return(0);
- }
- return(ok);
-}
diff --git a/games/hack/hack.c b/games/hack/hack.c
deleted file mode 100644
index 5a27204..0000000
--- a/games/hack/hack.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-#include <stdio.h>
-
-extern char news0();
-extern char *nomovemsg;
-extern char *exclam();
-extern struct obj *addinv();
-extern boolean hmon();
-
-/* called on movement:
- 1. when throwing ball+chain far away
- 2. when teleporting
- 3. when walking out of a lit room
- */
-unsee() {
- int x,y;
- struct rm *lev;
-
-/*
- if(u.udispl){
- u.udispl = 0;
- newsym(u.udisx, u.udisy);
- }
-*/
-#ifndef QUEST
- if(seehx){
- seehx = 0;
- } else
-#endif /* QUEST */
- for(x = u.ux-1; x < u.ux+2; x++)
- for(y = u.uy-1; y < u.uy+2; y++) {
- if(!isok(x, y)) continue;
- lev = &levl[x][y];
- if(!lev->lit && lev->scrsym == '.') {
- lev->scrsym =' ';
- lev->new = 1;
- on_scr(x,y);
- }
- }
-}
-
-/* called:
- in hack.eat.c: seeoff(0) - blind after eating rotten food
- in hack.mon.c: seeoff(0) - blinded by a yellow light
- in hack.mon.c: seeoff(1) - swallowed
- in hack.do.c: seeoff(0) - blind after drinking potion
- in hack.do.c: seeoff(1) - go up or down the stairs
- in hack.trap.c:seeoff(1) - fall through trapdoor
- */
-seeoff(mode) /* 1 to redo @, 0 to leave them */
-{ /* 1 means misc movement, 0 means blindness */
- int x,y;
- struct rm *lev;
-
- if(u.udispl && mode){
- u.udispl = 0;
- levl[u.udisx][u.udisy].scrsym = news0(u.udisx,u.udisy);
- }
-#ifndef QUEST
- if(seehx) {
- seehx = 0;
- } else
-#endif /* QUEST */
- if(!mode) {
- for(x = u.ux-1; x < u.ux+2; x++)
- for(y = u.uy-1; y < u.uy+2; y++) {
- if(!isok(x, y)) continue;
- lev = &levl[x][y];
- if(!lev->lit && lev->scrsym == '.')
- lev->seen = 0;
- }
- }
-}
-
-domove()
-{
- xchar oldx,oldy;
- struct monst *mtmp;
- struct rm *tmpr,*ust;
- struct trap *trap;
- struct obj *otmp;
-
- u_wipe_engr(rnd(5));
-
- if(inv_weight() > 0){
- pline("You collapse under your load.");
- nomul(0);
- return;
- }
- if(u.uswallow) {
- u.dx = u.dy = 0;
- u.ux = u.ustuck->mx;
- u.uy = u.ustuck->my;
- } else {
- if(Confusion) {
- do {
- confdir();
- } while(!isok(u.ux+u.dx, u.uy+u.dy) ||
- IS_ROCK(levl[u.ux+u.dx][u.uy+u.dy].typ));
- }
- if(!isok(u.ux+u.dx, u.uy+u.dy)){
- nomul(0);
- return;
- }
- }
-
- ust = &levl[u.ux][u.uy];
- oldx = u.ux;
- oldy = u.uy;
- if(!u.uswallow && (trap = t_at(u.ux+u.dx, u.uy+u.dy)) && trap->tseen)
- nomul(0);
- if(u.ustuck && !u.uswallow && (u.ux+u.dx != u.ustuck->mx ||
- u.uy+u.dy != u.ustuck->my)) {
- if(dist(u.ustuck->mx, u.ustuck->my) > 2){
- /* perhaps it fled (or was teleported or ... ) */
- u.ustuck = 0;
- } else {
- if(Blind) pline("You cannot escape from it!");
- else pline("You cannot escape from %s!",
- monnam(u.ustuck));
- nomul(0);
- return;
- }
- }
- if(u.uswallow || (mtmp = m_at(u.ux+u.dx,u.uy+u.dy))) {
- /* attack monster */
-
- nomul(0);
- gethungry();
- if(multi < 0) return; /* we just fainted */
-
- /* try to attack; note that it might evade */
- if(attack(u.uswallow ? u.ustuck : mtmp))
- return;
- }
- /* not attacking an animal, so we try to move */
- if(u.utrap) {
- if(u.utraptype == TT_PIT) {
- pline("You are still in a pit.");
- u.utrap--;
- } else {
- pline("You are caught in a beartrap.");
- if((u.dx && u.dy) || !rn2(5)) u.utrap--;
- }
- return;
- }
- tmpr = &levl[u.ux+u.dx][u.uy+u.dy];
- if(IS_ROCK(tmpr->typ) ||
- (u.dx && u.dy && (tmpr->typ == DOOR || ust->typ == DOOR))){
- flags.move = 0;
- nomul(0);
- return;
- }
- while(otmp = sobj_at(ENORMOUS_ROCK, u.ux+u.dx, u.uy+u.dy)) {
- xchar rx = u.ux+2*u.dx, ry = u.uy+2*u.dy;
- struct trap *ttmp;
- nomul(0);
- if(isok(rx,ry) && !IS_ROCK(levl[rx][ry].typ) &&
- (levl[rx][ry].typ != DOOR || !(u.dx && u.dy)) &&
- !sobj_at(ENORMOUS_ROCK, rx, ry)) {
- if(m_at(rx,ry)) {
- pline("You hear a monster behind the rock.");
- pline("Perhaps that's why you cannot move it.");
- goto cannot_push;
- }
- if(ttmp = t_at(rx,ry))
- switch(ttmp->ttyp) {
- case PIT:
- pline("You push the rock into a pit!");
- deltrap(ttmp);
- delobj(otmp);
- pline("It completely fills the pit!");
- continue;
- case TELEP_TRAP:
- pline("You push the rock and suddenly it disappears!");
- delobj(otmp);
- continue;
- }
- if(levl[rx][ry].typ == POOL) {
- levl[rx][ry].typ = ROOM;
- mnewsym(rx,ry);
- prl(rx,ry);
- pline("You push the rock into the water.");
- pline("Now you can cross the water!");
- delobj(otmp);
- continue;
- }
- otmp->ox = rx;
- otmp->oy = ry;
- /* pobj(otmp); */
- if(cansee(rx,ry)) atl(rx,ry,otmp->olet);
- if(Invisible) newsym(u.ux+u.dx, u.uy+u.dy);
-
- { static long lastmovetime;
- /* note: this var contains garbage initially and
- after a restore */
- if(moves > lastmovetime+2 || moves < lastmovetime)
- pline("With great effort you move the enormous rock.");
- lastmovetime = moves;
- }
- } else {
- pline("You try to move the enormous rock, but in vain.");
- cannot_push:
- if((!invent || inv_weight()+90 <= 0) &&
- (!u.dx || !u.dy || (IS_ROCK(levl[u.ux][u.uy+u.dy].typ)
- && IS_ROCK(levl[u.ux+u.dx][u.uy].typ)))){
- pline("However, you can squeeze yourself into a small opening.");
- break;
- } else
- return;
- }
- }
- if(u.dx && u.dy && IS_ROCK(levl[u.ux][u.uy+u.dy].typ) &&
- IS_ROCK(levl[u.ux+u.dx][u.uy].typ) &&
- invent && inv_weight()+40 > 0) {
- pline("You are carrying too much to get through.");
- nomul(0);
- return;
- }
- if(Punished &&
- DIST(u.ux+u.dx, u.uy+u.dy, uchain->ox, uchain->oy) > 2){
- if(carried(uball)) {
- movobj(uchain, u.ux, u.uy);
- goto nodrag;
- }
-
- if(DIST(u.ux+u.dx, u.uy+u.dy, uball->ox, uball->oy) < 3){
- /* leave ball, move chain under/over ball */
- movobj(uchain, uball->ox, uball->oy);
- goto nodrag;
- }
-
- if(inv_weight() + (int) uball->owt/2 > 0) {
- pline("You cannot %sdrag the heavy iron ball.",
- invent ? "carry all that and also " : "");
- nomul(0);
- return;
- }
-
- movobj(uball, uchain->ox, uchain->oy);
- unpobj(uball); /* BAH %% */
- uchain->ox = u.ux;
- uchain->oy = u.uy;
- nomul(-2);
- nomovemsg = "";
- nodrag: ;
- }
- u.ux += u.dx;
- u.uy += u.dy;
- if(flags.run) {
- if(tmpr->typ == DOOR ||
- (xupstair == u.ux && yupstair == u.uy) ||
- (xdnstair == u.ux && ydnstair == u.uy))
- nomul(0);
- }
-
- if(tmpr->typ == POOL && !Levitation)
- drown(); /* not necessarily fatal */
-
-/*
- if(u.udispl) {
- u.udispl = 0;
- newsym(oldx,oldy);
- }
-*/
- if(!Blind) {
-#ifdef QUEST
- setsee();
-#else
- if(ust->lit) {
- if(tmpr->lit) {
- if(tmpr->typ == DOOR)
- prl1(u.ux+u.dx,u.uy+u.dy);
- else if(ust->typ == DOOR)
- nose1(oldx-u.dx,oldy-u.dy);
- } else {
- unsee();
- prl1(u.ux+u.dx,u.uy+u.dy);
- }
- } else {
- if(tmpr->lit) setsee();
- else {
- prl1(u.ux+u.dx,u.uy+u.dy);
- if(tmpr->typ == DOOR) {
- if(u.dy) {
- prl(u.ux-1,u.uy);
- prl(u.ux+1,u.uy);
- } else {
- prl(u.ux,u.uy-1);
- prl(u.ux,u.uy+1);
- }
- }
- }
- nose1(oldx-u.dx,oldy-u.dy);
- }
-#endif /* QUEST */
- } else {
- pru();
- }
- if(!flags.nopick) pickup(1);
- if(trap) dotrap(trap); /* fall into pit, arrow trap, etc. */
- (void) inshop();
- if(!Blind) read_engr_at(u.ux,u.uy);
-}
-
-movobj(obj, ox, oy)
-struct obj *obj;
-int ox, oy;
-{
- /* Some dirty programming to get display right */
- freeobj(obj);
- unpobj(obj);
- obj->nobj = fobj;
- fobj = obj;
- obj->ox = ox;
- obj->oy = oy;
-}
-
-dopickup(){
- if(!g_at(u.ux,u.uy) && !o_at(u.ux,u.uy)) {
- pline("There is nothing here to pick up.");
- return(0);
- }
- if(Levitation) {
- pline("You cannot reach the floor.");
- return(1);
- }
- pickup(0);
- return(1);
-}
-
-pickup(all)
-{
- struct gold *gold;
- struct obj *obj, *obj2;
- int wt;
-
- if(Levitation) return;
- while(gold = g_at(u.ux,u.uy)) {
- pline("%ld gold piece%s.", gold->amount, plur(gold->amount));
- u.ugold += gold->amount;
- flags.botl = 1;
- freegold(gold);
- if(flags.run) nomul(0);
- if(Invisible) newsym(u.ux,u.uy);
- }
-
- /* check for more than one object */
- if(!all) {
- int ct = 0;
-
- for(obj = fobj; obj; obj = obj->nobj)
- if(obj->ox == u.ux && obj->oy == u.uy)
- if(!Punished || obj != uchain)
- ct++;
- if(ct < 2)
- all++;
- else
- pline("There are several objects here.");
- }
-
- for(obj = fobj; obj; obj = obj2) {
- obj2 = obj->nobj; /* perhaps obj will be picked up */
- if(obj->ox == u.ux && obj->oy == u.uy) {
- if(flags.run) nomul(0);
-
- /* do not pick up uchain */
- if(Punished && obj == uchain)
- continue;
-
- if(!all) {
- char c;
-
- pline("Pick up %s ? [ynaq]", doname(obj));
- while(!index("ynaq ", (c = readchar())))
- bell();
- if(c == 'q') return;
- if(c == 'n') continue;
- if(c == 'a') all = 1;
- }
-
- if(obj->otyp == DEAD_COCKATRICE && !uarmg){
- pline("Touching the dead cockatrice is a fatal mistake.");
- pline("You turn to stone.");
- killer = "cockatrice cadaver";
- done("died");
- }
-
- if(obj->otyp == SCR_SCARE_MONSTER){
- if(!obj->spe) obj->spe = 1;
- else {
- /* Note: perhaps the 1st pickup failed: you cannot
- carry anymore, and so we never dropped it -
- let's assume that treading on it twice also
- destroys the scroll */
- pline("The scroll turns to dust as you pick it up.");
- delobj(obj);
- continue;
- }
- }
-
- wt = inv_weight() + obj->owt;
- if(wt > 0) {
- if(obj->quan > 1) {
- /* see how many we can lift */
- extern struct obj *splitobj();
- int savequan = obj->quan;
- int iw = inv_weight();
- int qq;
- for(qq = 1; qq < savequan; qq++){
- obj->quan = qq;
- if(iw + weight(obj) > 0)
- break;
- }
- obj->quan = savequan;
- qq--;
- /* we can carry qq of them */
- if(!qq) goto too_heavy;
- pline("You can only carry %s of the %s lying here.",
- (qq == 1) ? "one" : "some",
- doname(obj));
- (void) splitobj(obj, qq);
- /* note: obj2 is set already, so we'll never
- * encounter the other half; if it should be
- * otherwise then write
- * obj2 = splitobj(obj,qq);
- */
- goto lift_some;
- }
- too_heavy:
- pline("There %s %s here, but %s.",
- (obj->quan == 1) ? "is" : "are",
- doname(obj),
- !invent ? "it is too heavy for you to lift"
- : "you cannot carry anymore");
- break;
- }
- lift_some:
- if(inv_cnt() >= 52) {
- pline("Your knapsack cannot accomodate anymore items.");
- break;
- }
- if(wt > -5) pline("You have a little trouble lifting");
- freeobj(obj);
- if(Invisible) newsym(u.ux,u.uy);
- addtobill(obj); /* sets obj->unpaid if necessary */
- { int pickquan = obj->quan;
- int mergquan;
- if(!Blind) obj->dknown = 1; /* this is done by prinv(),
- but addinv() needs it already for merging */
- obj = addinv(obj); /* might merge it with other objects */
- mergquan = obj->quan;
- obj->quan = pickquan; /* to fool prinv() */
- prinv(obj);
- obj->quan = mergquan;
- }
- }
- }
-}
-
-/* stop running if we see something interesting */
-/* turn around a corner if that is the only way we can proceed */
-/* do not turn left or right twice */
-lookaround(){
-int x,y,i,x0,y0,m0,i0 = 9;
-int corrct = 0, noturn = 0;
-struct monst *mtmp;
-#ifdef lint
- /* suppress "used before set" message */
- x0 = y0 = 0;
-#endif /* lint */
- if(Blind || flags.run == 0) return;
- if(flags.run == 1 && levl[u.ux][u.uy].typ == ROOM) return;
-#ifdef QUEST
- if(u.ux0 == u.ux+u.dx && u.uy0 == u.uy+u.dy) goto stop;
-#endif /* QUEST */
- for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){
- if(x == u.ux && y == u.uy) continue;
- if(!levl[x][y].typ) continue;
- if((mtmp = m_at(x,y)) && !mtmp->mimic &&
- (!mtmp->minvis || See_invisible)){
- if(!mtmp->mtame || (x == u.ux+u.dx && y == u.uy+u.dy))
- goto stop;
- } else mtmp = 0; /* invisible M cannot influence us */
- if(x == u.ux-u.dx && y == u.uy-u.dy) continue;
- switch(levl[x][y].scrsym){
- case '|':
- case '-':
- case '.':
- case ' ':
- break;
- case '+':
- if(x != u.ux && y != u.uy) break;
- if(flags.run != 1) goto stop;
- /* FALLTHROUGH */
- case CORR_SYM:
- corr:
- if(flags.run == 1 || flags.run == 3) {
- i = DIST(x,y,u.ux+u.dx,u.uy+u.dy);
- if(i > 2) break;
- if(corrct == 1 && DIST(x,y,x0,y0) != 1)
- noturn = 1;
- if(i < i0) {
- i0 = i;
- x0 = x;
- y0 = y;
- m0 = mtmp ? 1 : 0;
- }
- }
- corrct++;
- break;
- case '^':
- if(flags.run == 1) goto corr; /* if you must */
- if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop;
- break;
- default: /* e.g. objects or trap or stairs */
- if(flags.run == 1) goto corr;
- if(mtmp) break; /* d */
- stop:
- nomul(0);
- return;
- }
- }
-#ifdef QUEST
- if(corrct > 0 && (flags.run == 4 || flags.run == 5)) goto stop;
-#endif /* QUEST */
- if(corrct > 1 && flags.run == 2) goto stop;
- if((flags.run == 1 || flags.run == 3) && !noturn && !m0 && i0 &&
- (corrct == 1 || (corrct == 2 && i0 == 1))) {
- /* make sure that we do not turn too far */
- if(i0 == 2) {
- if(u.dx == y0-u.uy && u.dy == u.ux-x0)
- i = 2; /* straight turn right */
- else
- i = -2; /* straight turn left */
- } else if(u.dx && u.dy) {
- if((u.dx == u.dy && y0 == u.uy) ||
- (u.dx != u.dy && y0 != u.uy))
- i = -1; /* half turn left */
- else
- i = 1; /* half turn right */
- } else {
- if((x0-u.ux == y0-u.uy && !u.dy) ||
- (x0-u.ux != y0-u.uy && u.dy))
- i = 1; /* half turn right */
- else
- i = -1; /* half turn left */
- }
- i += u.last_str_turn;
- if(i <= 2 && i >= -2) {
- u.last_str_turn = i;
- u.dx = x0-u.ux, u.dy = y0-u.uy;
- }
- }
-}
-
-/* something like lookaround, but we are not running */
-/* react only to monsters that might hit us */
-monster_nearby() {
-int x,y;
-struct monst *mtmp;
- if(!Blind)
- for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){
- if(x == u.ux && y == u.uy) continue;
- if((mtmp = m_at(x,y)) && !mtmp->mimic && !mtmp->mtame &&
- !mtmp->mpeaceful && !index("Ea", mtmp->data->mlet) &&
- !mtmp->mfroz && !mtmp->msleep && /* aplvax!jcn */
- (!mtmp->minvis || See_invisible))
- return(1);
- }
- return(0);
-}
-
-#ifdef QUEST
-cansee(x,y) xchar x,y; {
-int dx,dy,adx,ady,sdx,sdy,dmax,d;
- if(Blind) return(0);
- if(!isok(x,y)) return(0);
- d = dist(x,y);
- if(d < 3) return(1);
- if(d > u.uhorizon*u.uhorizon) return(0);
- if(!levl[x][y].lit)
- return(0);
- dx = x - u.ux; adx = abs(dx); sdx = sgn(dx);
- dy = y - u.uy; ady = abs(dy); sdy = sgn(dy);
- if(dx == 0 || dy == 0 || adx == ady){
- dmax = (dx == 0) ? ady : adx;
- for(d = 1; d <= dmax; d++)
- if(!rroom(sdx*d,sdy*d))
- return(0);
- return(1);
- } else if(ady > adx){
- for(d = 1; d <= ady; d++){
- if(!rroom(sdx*( (d*adx)/ady ), sdy*d) ||
- !rroom(sdx*( (d*adx-1)/ady+1 ), sdy*d))
- return(0);
- }
- return(1);
- } else {
- for(d = 1; d <= adx; d++){
- if(!rroom(sdx*d, sdy*( (d*ady)/adx )) ||
- !rroom(sdx*d, sdy*( (d*ady-1)/adx+1 )))
- return(0);
- }
- return(1);
- }
-}
-
-rroom(x,y) int x,y; {
- return(IS_ROOM(levl[u.ux+x][u.uy+y].typ));
-}
-
-#else
-
-cansee(x,y) xchar x,y; {
- if(Blind || u.uswallow) return(0);
- if(dist(x,y) < 3) return(1);
- if(levl[x][y].lit && seelx <= x && x <= seehx && seely <= y &&
- y <= seehy) return(1);
- return(0);
-}
-#endif /* QUEST */
-
-sgn(a) int a; {
- return((a > 0) ? 1 : (a == 0) ? 0 : -1);
-}
-
-#ifdef QUEST
-setsee()
-{
- x,y;
-
- if(Blind) {
- pru();
- return;
- }
- for(y = u.uy-u.uhorizon; y <= u.uy+u.uhorizon; y++)
- for(x = u.ux-u.uhorizon; x <= u.ux+u.uhorizon; x++) {
- if(cansee(x,y))
- prl(x,y);
- }
-}
-
-#else
-
-setsee()
-{
- int x,y;
-
- if(Blind) {
- pru();
- return;
- }
- if(!levl[u.ux][u.uy].lit) {
- seelx = u.ux-1;
- seehx = u.ux+1;
- seely = u.uy-1;
- seehy = u.uy+1;
- } else {
- for(seelx = u.ux; levl[seelx-1][u.uy].lit; seelx--);
- for(seehx = u.ux; levl[seehx+1][u.uy].lit; seehx++);
- for(seely = u.uy; levl[u.ux][seely-1].lit; seely--);
- for(seehy = u.uy; levl[u.ux][seehy+1].lit; seehy++);
- }
- for(y = seely; y <= seehy; y++)
- for(x = seelx; x <= seehx; x++) {
- prl(x,y);
- }
- if(!levl[u.ux][u.uy].lit) seehx = 0; /* seems necessary elsewhere */
- else {
- if(seely == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seely-1);
- if(seehy == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seehy+1);
- if(seelx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seelx-1,y);
- if(seehx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seehx+1,y);
- }
-}
-#endif /* QUEST */
-
-nomul(nval)
-int nval;
-{
- if(multi < 0) return;
- multi = nval;
- flags.mv = flags.run = 0;
-}
-
-abon()
-{
- if(u.ustr == 3) return(-3);
- else if(u.ustr < 6) return(-2);
- else if(u.ustr < 8) return(-1);
- else if(u.ustr < 17) return(0);
- else if(u.ustr < 69) return(1); /* up to 18/50 */
- else if(u.ustr < 118) return(2);
- else return(3);
-}
-
-dbon()
-{
- if(u.ustr < 6) return(-1);
- else if(u.ustr < 16) return(0);
- else if(u.ustr < 18) return(1);
- else if(u.ustr == 18) return(2); /* up to 18 */
- else if(u.ustr < 94) return(3); /* up to 18/75 */
- else if(u.ustr < 109) return(4); /* up to 18/90 */
- else if(u.ustr < 118) return(5); /* up to 18/99 */
- else return(6);
-}
-
-losestr(num) /* may kill you; cause may be poison or monster like 'A' */
-int num;
-{
- u.ustr -= num;
- while(u.ustr < 3) {
- u.ustr++;
- u.uhp -= 6;
- u.uhpmax -= 6;
- }
- flags.botl = 1;
-}
-
-losehp(n,knam)
-int n;
-char *knam;
-{
- u.uhp -= n;
- if(u.uhp > u.uhpmax)
- u.uhpmax = u.uhp; /* perhaps n was negative */
- flags.botl = 1;
- if(u.uhp < 1) {
- killer = knam; /* the thing that killed you */
- done("died");
- }
-}
-
-losehp_m(n,mtmp)
-int n;
-struct monst *mtmp;
-{
- u.uhp -= n;
- flags.botl = 1;
- if(u.uhp < 1)
- done_in_by(mtmp);
-}
-
-losexp() /* hit by V or W */
-{
- int num;
- extern long newuexp();
-
- if(u.ulevel > 1)
- pline("Goodbye level %u.", u.ulevel--);
- else
- u.uhp = -1;
- num = rnd(10);
- u.uhp -= num;
- u.uhpmax -= num;
- u.uexp = newuexp();
- flags.botl = 1;
-}
-
-inv_weight(){
-struct obj *otmp = invent;
-int wt = (u.ugold + 500)/1000;
-int carrcap;
- if(Levitation) /* pugh@cornell */
- carrcap = MAX_CARR_CAP;
- else {
- carrcap = 5*(((u.ustr > 18) ? 20 : u.ustr) + u.ulevel);
- if(carrcap > MAX_CARR_CAP) carrcap = MAX_CARR_CAP;
- if(Wounded_legs & LEFT_SIDE) carrcap -= 10;
- if(Wounded_legs & RIGHT_SIDE) carrcap -= 10;
- }
- while(otmp){
- wt += otmp->owt;
- otmp = otmp->nobj;
- }
- return(wt - carrcap);
-}
-
-inv_cnt(){
-struct obj *otmp = invent;
-int ct = 0;
- while(otmp){
- ct++;
- otmp = otmp->nobj;
- }
- return(ct);
-}
-
-long
-newuexp()
-{
- return(10*(1L << (u.ulevel-1)));
-}
diff --git a/games/hack/hack.cmd.c b/games/hack/hack.cmd.c
deleted file mode 100644
index fe32ced..0000000
--- a/games/hack/hack.cmd.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.cmd.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include "def.func_tab.h"
-
-int doredraw(),doredotopl(),dodrop(),dodrink(),doread(),dosearch(),dopickup(),
-doversion(),doweararm(),dowearring(),doremarm(),doremring(),dopay(),doapply(),
-dosave(),dowield(),ddoinv(),dozap(),ddocall(),dowhatis(),doengrave(),dotele(),
-dohelp(),doeat(),doddrop(),do_mname(),doidtrap(),doprwep(),doprarm(),
-doprring(),doprgold(),dodiscovered(),dotypeinv(),dolook(),doset(),
-doup(), dodown(), done1(), donull(), dothrow(), doextcmd(), dodip(), dopray();
-#ifdef SHELL
-int dosh();
-#endif /* SHELL */
-#ifdef SUSPEND
-int dosuspend();
-#endif /* SUSPEND */
-
-struct func_tab cmdlist[]={
- '\020', doredotopl,
- '\022', doredraw,
- '\024', dotele,
-#ifdef SUSPEND
- '\032', dosuspend,
-#endif /* SUSPEND */
- 'a', doapply,
-/* 'A' : UNUSED */
-/* 'b', 'B' : go sw */
- 'c', ddocall,
- 'C', do_mname,
- 'd', dodrop,
- 'D', doddrop,
- 'e', doeat,
- 'E', doengrave,
-/* 'f', 'F' : multiple go (might become 'fight') */
-/* 'g', 'G' : UNUSED */
-/* 'h', 'H' : go west */
- 'I', dotypeinv, /* Robert Viduya */
- 'i', ddoinv,
-/* 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N' : move commands */
-/* 'o', doopen, */
- 'O', doset,
- 'p', dopay,
- 'P', dowearring,
- 'q', dodrink,
- 'Q', done1,
- 'r', doread,
- 'R', doremring,
- 's', dosearch,
- 'S', dosave,
- 't', dothrow,
- 'T', doremarm,
-/* 'u', 'U' : go ne */
- 'v', doversion,
-/* 'V' : UNUSED */
- 'w', dowield,
- 'W', doweararm,
-/* 'x', 'X' : UNUSED */
-/* 'y', 'Y' : go nw */
- 'z', dozap,
-/* 'Z' : UNUSED */
- '<', doup,
- '>', dodown,
- '/', dowhatis,
- '?', dohelp,
-#ifdef SHELL
- '!', dosh,
-#endif /* SHELL */
- '.', donull,
- ' ', donull,
- ',', dopickup,
- ':', dolook,
- '^', doidtrap,
- '\\', dodiscovered, /* Robert Viduya */
- WEAPON_SYM, doprwep,
- ARMOR_SYM, doprarm,
- RING_SYM, doprring,
- '$', doprgold,
- '#', doextcmd,
- 0,0,0
-};
-
-struct ext_func_tab extcmdlist[] = {
- "dip", dodip,
- "pray", dopray,
- (char *) 0, donull
-};
-
-extern char *parse(), lowc(), unctrl(), quitchars[];
-
-rhack(cmd)
-char *cmd;
-{
- struct func_tab *tlist = cmdlist;
- boolean firsttime = FALSE;
- int res;
-
- if(!cmd) {
- firsttime = TRUE;
- flags.nopick = 0;
- cmd = parse();
- }
- if(!*cmd || (*cmd & 0377) == 0377 ||
- (flags.no_rest_on_space && *cmd == ' ')){
- bell();
- flags.move = 0;
- return; /* probably we just had an interrupt */
- }
- if(movecmd(*cmd)) {
- walk:
- if(multi) flags.mv = 1;
- domove();
- return;
- }
- if(movecmd(lowc(*cmd))) {
- flags.run = 1;
- rush:
- if(firsttime){
- if(!multi) multi = COLNO;
- u.last_str_turn = 0;
- }
- flags.mv = 1;
-#ifdef QUEST
- if(flags.run >= 4) finddir();
- if(firsttime){
- u.ux0 = u.ux + u.dx;
- u.uy0 = u.uy + u.dy;
- }
-#endif /* QUEST */
- domove();
- return;
- }
- if((*cmd == 'f' && movecmd(cmd[1])) || movecmd(unctrl(*cmd))) {
- flags.run = 2;
- goto rush;
- }
- if(*cmd == 'F' && movecmd(lowc(cmd[1]))) {
- flags.run = 3;
- goto rush;
- }
- if(*cmd == 'm' && movecmd(cmd[1])) {
- flags.run = 0;
- flags.nopick = 1;
- goto walk;
- }
- if(*cmd == 'M' && movecmd(lowc(cmd[1]))) {
- flags.run = 1;
- flags.nopick = 1;
- goto rush;
- }
-#ifdef QUEST
- if(*cmd == cmd[1] && (*cmd == 'f' || *cmd == 'F')) {
- flags.run = 4;
- if(*cmd == 'F') flags.run += 2;
- if(cmd[2] == '-') flags.run += 1;
- goto rush;
- }
-#endif /* QUEST */
- while(tlist->f_char) {
- if(*cmd == tlist->f_char){
- res = (*(tlist->f_funct))();
- if(!res) {
- flags.move = 0;
- multi = 0;
- }
- return;
- }
- tlist++;
- }
- { char expcmd[10];
- char *cp = expcmd;
- while(*cmd && cp-expcmd < sizeof(expcmd)-2) {
- if(*cmd >= 040 && *cmd < 0177)
- *cp++ = *cmd++;
- else {
- *cp++ = '^';
- *cp++ = *cmd++ ^ 0100;
- }
- }
- *cp++ = 0;
- pline("Unknown command '%s'.", expcmd);
- }
- multi = flags.move = 0;
-}
-
-doextcmd() /* here after # - now read a full-word command */
-{
- char buf[BUFSZ];
- struct ext_func_tab *efp = extcmdlist;
-
- pline("# ");
- getlin(buf);
- clrlin();
- if(buf[0] == '\033')
- return(0);
- while(efp->ef_txt) {
- if(!strcmp(efp->ef_txt, buf))
- return((*(efp->ef_funct))());
- efp++;
- }
- pline("%s: unknown command.", buf);
- return(0);
-}
-
-char
-lowc(sym)
-char sym;
-{
- return( (sym >= 'A' && sym <= 'Z') ? sym+'a'-'A' : sym );
-}
-
-char
-unctrl(sym)
-char sym;
-{
- return( (sym >= ('A' & 037) && sym <= ('Z' & 037)) ? sym + 0140 : sym );
-}
-
-/* 'rogue'-like direction commands */
-char sdir[] = "hykulnjb><";
-schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 };
-schar ydir[10] = { 0,-1,-1,-1, 0, 1, 1, 1, 0, 0 };
-schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1,-1 };
-
-movecmd(sym) /* also sets u.dz, but returns false for <> */
-char sym;
-{
- char *dp;
-
- u.dz = 0;
- if(!(dp = index(sdir, sym))) return(0);
- u.dx = xdir[dp-sdir];
- u.dy = ydir[dp-sdir];
- u.dz = zdir[dp-sdir];
- return(!u.dz);
-}
-
-getdir(s)
-boolean s;
-{
- char dirsym;
-
- if(s) pline("In what direction?");
- dirsym = readchar();
- if(!movecmd(dirsym) && !u.dz) {
- if(!index(quitchars, dirsym))
- pline("What a strange direction!");
- return(0);
- }
- if(Confusion && !u.dz)
- confdir();
- return(1);
-}
-
-confdir()
-{
- int x = rn2(8);
- u.dx = xdir[x];
- u.dy = ydir[x];
-}
-
-#ifdef QUEST
-finddir(){
-int i, ui = u.di;
- for(i = 0; i <= 8; i++){
- if(flags.run & 1) ui++; else ui += 7;
- ui %= 8;
- if(i == 8){
- pline("Not near a wall.");
- flags.move = multi = 0;
- return(0);
- }
- if(!isroom(u.ux+xdir[ui], u.uy+ydir[ui]))
- break;
- }
- for(i = 0; i <= 8; i++){
- if(flags.run & 1) ui += 7; else ui++;
- ui %= 8;
- if(i == 8){
- pline("Not near a room.");
- flags.move = multi = 0;
- return(0);
- }
- if(isroom(u.ux+xdir[ui], u.uy+ydir[ui]))
- break;
- }
- u.di = ui;
- u.dx = xdir[ui];
- u.dy = ydir[ui];
-}
-
-isroom(x,y) x,y; { /* what about POOL? */
- return(isok(x,y) && (levl[x][y].typ == ROOM ||
- (levl[x][y].typ >= LDOOR && flags.run >= 6)));
-}
-#endif /* QUEST */
-
-isok(x,y) int x,y; {
- /* x corresponds to curx, so x==1 is the first column. Ach. %% */
- return(x >= 1 && x <= COLNO-1 && y >= 0 && y <= ROWNO-1);
-}
diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c
deleted file mode 100644
index a232782..0000000
--- a/games/hack/hack.do.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.do.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */
-
-#include "hack.h"
-
-extern struct obj *splitobj(), *addinv();
-extern boolean hmon();
-extern boolean level_exists[];
-extern struct monst youmonst;
-extern char *Doname();
-extern char *nomovemsg;
-
-static int drop();
-
-dodrop() {
- return(drop(getobj("0$#", "drop")));
-}
-
-static int
-drop(obj) struct obj *obj; {
- if(!obj) return(0);
- if(obj->olet == '$') { /* pseudo object */
- long amount = OGOLD(obj);
-
- if(amount == 0)
- pline("You didn't drop any gold pieces.");
- else {
- mkgold(amount, u.ux, u.uy);
- pline("You dropped %ld gold piece%s.",
- amount, plur(amount));
- if(Invisible) newsym(u.ux, u.uy);
- }
- free((char *) obj);
- return(1);
- }
- if(obj->owornmask & (W_ARMOR | W_RING)){
- pline("You cannot drop something you are wearing.");
- return(0);
- }
- if(obj == uwep) {
- if(uwep->cursed) {
- pline("Your weapon is welded to your hand!");
- return(0);
- }
- setuwep((struct obj *) 0);
- }
- pline("You dropped %s.", doname(obj));
- dropx(obj);
- return(1);
-}
-
-/* Called in several places - should not produce texts */
-dropx(obj)
-struct obj *obj;
-{
- freeinv(obj);
- dropy(obj);
-}
-
-dropy(obj)
-struct obj *obj;
-{
- if(obj->otyp == CRYSKNIFE)
- obj->otyp = WORM_TOOTH;
- obj->ox = u.ux;
- obj->oy = u.uy;
- obj->nobj = fobj;
- fobj = obj;
- if(Invisible) newsym(u.ux,u.uy);
- subfrombill(obj);
- stackobj(obj);
-}
-
-/* drop several things */
-doddrop() {
- return(ggetobj("drop", drop, 0));
-}
-
-dodown()
-{
- if(u.ux != xdnstair || u.uy != ydnstair) {
- pline("You can't go down here.");
- return(0);
- }
- if(u.ustuck) {
- pline("You are being held, and cannot go down.");
- return(1);
- }
- if(Levitation) {
- pline("You're floating high above the stairs.");
- return(0);
- }
-
- goto_level(dlevel+1, TRUE);
- return(1);
-}
-
-doup()
-{
- if(u.ux != xupstair || u.uy != yupstair) {
- pline("You can't go up here.");
- return(0);
- }
- if(u.ustuck) {
- pline("You are being held, and cannot go up.");
- return(1);
- }
- if(!Levitation && inv_weight() + 5 > 0) {
- pline("Your load is too heavy to climb the stairs.");
- return(1);
- }
-
- goto_level(dlevel-1, TRUE);
- return(1);
-}
-
-goto_level(newlevel, at_stairs)
-int newlevel;
-boolean at_stairs;
-{
- int fd;
- boolean up = (newlevel < dlevel);
-
- if(newlevel <= 0) done("escaped"); /* in fact < 0 is impossible */
- if(newlevel > MAXLEVEL) newlevel = MAXLEVEL; /* strange ... */
- if(newlevel == dlevel) return; /* this can happen */
-
- glo(dlevel);
- fd = creat(lock, FMASK);
- if(fd < 0) {
- /*
- * This is not quite impossible: e.g., we may have
- * exceeded our quota. If that is the case then we
- * cannot leave this level, and cannot save either.
- * Another possibility is that the directory was not
- * writable.
- */
- pline("A mysterious force prevents you from going %s.",
- up ? "up" : "down");
- return;
- }
-
- if(Punished) unplacebc();
- u.utrap = 0; /* needed in level_tele */
- u.ustuck = 0; /* idem */
- keepdogs();
- seeoff(1);
- if(u.uswallow) /* idem */
- u.uswldtim = u.uswallow = 0;
- flags.nscrinh = 1;
- u.ux = FAR; /* hack */
- (void) inshop(); /* probably was a trapdoor */
-
- savelev(fd,dlevel);
- (void) close(fd);
-
- dlevel = newlevel;
- if(maxdlevel < dlevel)
- maxdlevel = dlevel;
- glo(dlevel);
-
- if(!level_exists[dlevel])
- mklev();
- else {
- extern int hackpid;
-
- if((fd = open(lock,0)) < 0) {
- pline("Cannot open %s .", lock);
- pline("Probably someone removed it.");
- done("tricked");
- }
- getlev(fd, hackpid, dlevel);
- (void) close(fd);
- }
-
- if(at_stairs) {
- if(up) {
- u.ux = xdnstair;
- u.uy = ydnstair;
- if(!u.ux) { /* entering a maze from below? */
- u.ux = xupstair; /* this will confuse the player! */
- u.uy = yupstair;
- }
- if(Punished && !Levitation){
- pline("With great effort you climb the stairs.");
- placebc(1);
- }
- } else {
- u.ux = xupstair;
- u.uy = yupstair;
- if(inv_weight() + 5 > 0 || Punished){
- pline("You fall down the stairs."); /* %% */
- losehp(rnd(3), "fall");
- if(Punished) {
- if(uwep != uball && rn2(3)){
- pline("... and are hit by the iron ball.");
- losehp(rnd(20), "iron ball");
- }
- placebc(1);
- }
- selftouch("Falling, you");
- }
- }
- { struct monst *mtmp = m_at(u.ux, u.uy);
- if(mtmp)
- mnexto(mtmp);
- }
- } else { /* trapdoor or level_tele */
- do {
- u.ux = rnd(COLNO-1);
- u.uy = rn2(ROWNO);
- } while(levl[u.ux][u.uy].typ != ROOM ||
- m_at(u.ux,u.uy));
- if(Punished){
- if(uwep != uball && !up /* %% */ && rn2(5)){
- pline("The iron ball falls on your head.");
- losehp(rnd(25), "iron ball");
- }
- placebc(1);
- }
- selftouch("Falling, you");
- }
- (void) inshop();
- initrack();
-
- losedogs();
- { struct monst *mtmp;
- if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */
- }
- flags.nscrinh = 0;
- setsee();
- seeobjs(); /* make old cadavers disappear - riv05!a3 */
- docrt();
- pickup(1);
- read_engr_at(u.ux,u.uy);
-}
-
-donull() {
- return(1); /* Do nothing, but let other things happen */
-}
-
-dopray() {
- nomovemsg = "You finished your prayer.";
- nomul(-3);
- return(1);
-}
-
-struct monst *bhit(), *boomhit();
-dothrow()
-{
- struct obj *obj;
- struct monst *mon;
- int tmp;
-
- obj = getobj("#)", "throw"); /* it is also possible to throw food */
- /* (or jewels, or iron balls ... ) */
- if(!obj || !getdir(1)) /* ask "in what direction?" */
- return(0);
- if(obj->owornmask & (W_ARMOR | W_RING)){
- pline("You can't throw something you are wearing.");
- return(0);
- }
-
- u_wipe_engr(2);
-
- if(obj == uwep){
- if(obj->cursed){
- pline("Your weapon is welded to your hand.");
- return(1);
- }
- if(obj->quan > 1)
- setuwep(splitobj(obj, 1));
- else
- setuwep((struct obj *) 0);
- }
- else if(obj->quan > 1)
- (void) splitobj(obj, 1);
- freeinv(obj);
- if(u.uswallow) {
- mon = u.ustuck;
- bhitpos.x = mon->mx;
- bhitpos.y = mon->my;
- } else if(u.dz) {
- if(u.dz < 0) {
- pline("%s hits the ceiling, then falls back on top of your head.",
- Doname(obj)); /* note: obj->quan == 1 */
- if(obj->olet == POTION_SYM)
- potionhit(&youmonst, obj);
- else {
- if(uarmh) pline("Fortunately, you are wearing a helmet!");
- losehp(uarmh ? 1 : rnd((int)(obj->owt)), "falling object");
- dropy(obj);
- }
- } else {
- pline("%s hits the floor.", Doname(obj));
- if(obj->otyp == EXPENSIVE_CAMERA) {
- pline("It is shattered in a thousand pieces!");
- obfree(obj, Null(obj));
- } else if(obj->otyp == EGG) {
- pline("\"Splash!\"");
- obfree(obj, Null(obj));
- } else if(obj->olet == POTION_SYM) {
- pline("The flask breaks, and you smell a peculiar odor ...");
- potionbreathe(obj);
- obfree(obj, Null(obj));
- } else {
- dropy(obj);
- }
- }
- return(1);
- } else if(obj->otyp == BOOMERANG) {
- mon = boomhit(u.dx, u.dy);
- if(mon == &youmonst) { /* the thing was caught */
- (void) addinv(obj);
- return(1);
- }
- } else {
- if(obj->otyp == PICK_AXE && shkcatch(obj))
- return(1);
-
- mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 :
- (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1,
- obj->olet,
- (int (*)()) 0, (int (*)()) 0, obj);
- }
- if(mon) {
- /* awake monster if sleeping */
- wakeup(mon);
-
- if(obj->olet == WEAPON_SYM) {
- tmp = -1+u.ulevel+mon->data->ac+abon();
- if(obj->otyp < ROCK) {
- if(!uwep ||
- uwep->otyp != obj->otyp+(BOW-ARROW))
- tmp -= 4;
- else {
- tmp += uwep->spe;
- }
- } else
- if(obj->otyp == BOOMERANG) tmp += 4;
- tmp += obj->spe;
- if(u.uswallow || tmp >= rnd(20)) {
- if(hmon(mon,obj,1) == TRUE){
- /* mon still alive */
-#ifndef NOWORM
- cutworm(mon,bhitpos.x,bhitpos.y,obj->otyp);
-#endif /* NOWORM */
- } else mon = 0;
- /* weapons thrown disappear sometimes */
- if(obj->otyp < BOOMERANG && rn2(3)) {
- /* check bill; free */
- obfree(obj, (struct obj *) 0);
- return(1);
- }
- } else miss(objects[obj->otyp].oc_name, mon);
- } else if(obj->otyp == HEAVY_IRON_BALL) {
- tmp = -1+u.ulevel+mon->data->ac+abon();
- if(!Punished || obj != uball) tmp += 2;
- if(u.utrap) tmp -= 2;
- if(u.uswallow || tmp >= rnd(20)) {
- if(hmon(mon,obj,1) == FALSE)
- mon = 0; /* he died */
- } else miss("iron ball", mon);
- } else if(obj->olet == POTION_SYM && u.ulevel > rn2(15)) {
- potionhit(mon, obj);
- return(1);
- } else {
- if(cansee(bhitpos.x,bhitpos.y))
- pline("You miss %s.",monnam(mon));
- else pline("You miss it.");
- if(obj->olet == FOOD_SYM && mon->data->mlet == 'd')
- if(tamedog(mon,obj)) return(1);
- if(obj->olet == GEM_SYM && mon->data->mlet == 'u' &&
- !mon->mtame){
- if(obj->dknown && objects[obj->otyp].oc_name_known){
- if(objects[obj->otyp].g_val > 0){
- u.uluck += 5;
- goto valuable;
- } else {
- pline("%s is not interested in your junk.",
- Monnam(mon));
- }
- } else { /* value unknown to @ */
- u.uluck++;
- valuable:
- if(u.uluck > LUCKMAX) /* dan@ut-ngp */
- u.uluck = LUCKMAX;
- pline("%s graciously accepts your gift.",
- Monnam(mon));
- mpickobj(mon, obj);
- rloc(mon);
- return(1);
- }
- }
- }
- }
- /* the code following might become part of dropy() */
- if(obj->otyp == CRYSKNIFE)
- obj->otyp = WORM_TOOTH;
- obj->ox = bhitpos.x;
- obj->oy = bhitpos.y;
- obj->nobj = fobj;
- fobj = obj;
- /* prevent him from throwing articles to the exit and escaping */
- /* subfrombill(obj); */
- stackobj(obj);
- if(Punished && obj == uball &&
- (bhitpos.x != u.ux || bhitpos.y != u.uy)){
- freeobj(uchain);
- unpobj(uchain);
- if(u.utrap){
- if(u.utraptype == TT_PIT)
- pline("The ball pulls you out of the pit!");
- else {
- long side =
- rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
- pline("The ball pulls you out of the bear trap.");
- pline("Your %s leg is severely damaged.",
- (side == LEFT_SIDE) ? "left" : "right");
- set_wounded_legs(side, 500+rn2(1000));
- losehp(2, "thrown ball");
- }
- u.utrap = 0;
- }
- unsee();
- uchain->nobj = fobj;
- fobj = uchain;
- u.ux = uchain->ox = bhitpos.x - u.dx;
- u.uy = uchain->oy = bhitpos.y - u.dy;
- setsee();
- (void) inshop();
- }
- if(cansee(bhitpos.x, bhitpos.y)) prl(bhitpos.x,bhitpos.y);
- return(1);
-}
-
-/* split obj so that it gets size num */
-/* remainder is put in the object structure delivered by this call */
-struct obj *
-splitobj(obj, num) struct obj *obj; int num; {
-struct obj *otmp;
- otmp = newobj(0);
- *otmp = *obj; /* copies whole structure */
- otmp->o_id = flags.ident++;
- otmp->onamelth = 0;
- obj->quan = num;
- obj->owt = weight(obj);
- otmp->quan -= num;
- otmp->owt = weight(otmp); /* -= obj->owt ? */
- obj->nobj = otmp;
- if(obj->unpaid) splitbill(obj,otmp);
- return(otmp);
-}
-
-more_experienced(exp,rexp)
-int exp, rexp;
-{
- extern char pl_character[];
-
- u.uexp += exp;
- u.urexp += 4*exp + rexp;
- if(exp) flags.botl = 1;
- if(u.urexp >= ((pl_character[0] == 'W') ? 1000 : 2000))
- flags.beginner = 0;
-}
-
-set_wounded_legs(side, timex)
-long side;
-int timex;
-{
- if(!Wounded_legs || (Wounded_legs & TIMEOUT))
- Wounded_legs |= side + timex;
- else
- Wounded_legs |= side;
-}
-
-heal_legs()
-{
- if(Wounded_legs) {
- if((Wounded_legs & BOTH_SIDES) == BOTH_SIDES)
- pline("Your legs feel somewhat better.");
- else
- pline("Your leg feels somewhat better.");
- Wounded_legs = 0;
- }
-}
diff --git a/games/hack/hack.do_name.c b/games/hack/hack.do_name.c
deleted file mode 100644
index 24dce8a..0000000
--- a/games/hack/hack.do_name.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.do_name.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-#include <stdio.h>
-extern char plname[];
-
-coord
-getpos(force,goal) int force; char *goal; {
-int cx,cy,i,c;
-extern char sdir[]; /* defined in hack.c */
-extern schar xdir[], ydir[]; /* idem */
-extern char *visctrl(); /* see below */
-coord cc;
- pline("(For instructions type a ?)");
- cx = u.ux;
- cy = u.uy;
- curs(cx,cy+2);
- while((c = readchar()) != '.'){
- for(i=0; i<8; i++) if(sdir[i] == c){
- if(1 <= cx + xdir[i] && cx + xdir[i] <= COLNO)
- cx += xdir[i];
- if(0 <= cy + ydir[i] && cy + ydir[i] <= ROWNO-1)
- cy += ydir[i];
- goto nxtc;
- }
- if(c == '?'){
- pline("Use [hjkl] to move the cursor to %s.", goal);
- pline("Type a . when you are at the right place.");
- } else {
- pline("Unknown direction: '%s' (%s).",
- visctrl(c),
- force ? "use hjkl or ." : "aborted");
- if(force) goto nxtc;
- cc.x = -1;
- cc.y = 0;
- return(cc);
- }
- nxtc: ;
- curs(cx,cy+2);
- }
- cc.x = cx;
- cc.y = cy;
- return(cc);
-}
-
-do_mname(){
-char buf[BUFSZ];
-coord cc;
-int cx,cy,lth,i;
-struct monst *mtmp, *mtmp2;
-extern char *lmonnam();
- cc = getpos(0, "the monster you want to name");
- cx = cc.x;
- cy = cc.y;
- if(cx < 0) return(0);
- mtmp = m_at(cx,cy);
- if(!mtmp){
- if(cx == u.ux && cy == u.uy)
- pline("This ugly monster is called %s and cannot be renamed.",
- plname);
- else
- pline("There is no monster there.");
- return(1);
- }
- if(mtmp->mimic){
- pline("I see no monster there.");
- return(1);
- }
- if(!cansee(cx,cy)) {
- pline("I cannot see a monster there.");
- return(1);
- }
- pline("What do you want to call %s? ", lmonnam(mtmp));
- getlin(buf);
- clrlin();
- if(!*buf || *buf == '\033')
- return(1);
- lth = strlen(buf)+1;
- if(lth > 63){
- buf[62] = 0;
- lth = 63;
- }
- mtmp2 = newmonst(mtmp->mxlth + lth);
- *mtmp2 = *mtmp;
- for(i=0; i<mtmp->mxlth; i++)
- ((char *) mtmp2->mextra)[i] = ((char *) mtmp->mextra)[i];
- mtmp2->mnamelth = lth;
- (void) strcpy(NAME(mtmp2), buf);
- replmon(mtmp,mtmp2);
- return(1);
-}
-
-/*
- * This routine changes the address of obj . Be careful not to call it
- * when there might be pointers around in unknown places. For now: only
- * when obj is in the inventory.
- */
-do_oname(obj) struct obj *obj; {
-struct obj *otmp, *otmp2;
-int lth;
-char buf[BUFSZ];
- pline("What do you want to name %s? ", doname(obj));
- getlin(buf);
- clrlin();
- if(!*buf || *buf == '\033')
- return;
- lth = strlen(buf)+1;
- if(lth > 63){
- buf[62] = 0;
- lth = 63;
- }
- otmp2 = newobj(lth);
- *otmp2 = *obj;
- otmp2->onamelth = lth;
- (void) strcpy(ONAME(otmp2), buf);
-
- setworn((struct obj *) 0, obj->owornmask);
- setworn(otmp2, otmp2->owornmask);
-
- /* do freeinv(obj); etc. by hand in order to preserve
- the position of this object in the inventory */
- if(obj == invent) invent = otmp2;
- else for(otmp = invent; ; otmp = otmp->nobj){
- if(!otmp)
- panic("Do_oname: cannot find obj.");
- if(otmp->nobj == obj){
- otmp->nobj = otmp2;
- break;
- }
- }
- /*obfree(obj, otmp2);*/ /* now unnecessary: no pointers on bill */
- free((char *) obj); /* let us hope nobody else saved a pointer */
-}
-
-ddocall()
-{
- struct obj *obj;
-
- pline("Do you want to name an individual object? [ny] ");
- switch(readchar()) {
- case '\033':
- break;
- case 'y':
- obj = getobj("#", "name");
- if(obj) do_oname(obj);
- break;
- default:
- obj = getobj("?!=/", "call");
- if(obj) docall(obj);
- }
- return(0);
-}
-
-docall(obj)
-struct obj *obj;
-{
- char buf[BUFSZ];
- struct obj otemp;
- char **str1;
- extern char *xname();
- char *str;
-
- otemp = *obj;
- otemp.quan = 1;
- otemp.onamelth = 0;
- str = xname(&otemp);
- pline("Call %s %s: ", index(vowels,*str) ? "an" : "a", str);
- getlin(buf);
- clrlin();
- if(!*buf || *buf == '\033')
- return;
- str = newstring(strlen(buf)+1);
- (void) strcpy(str,buf);
- str1 = &(objects[obj->otyp].oc_uname);
- if(*str1) free(*str1);
- *str1 = str;
-}
-
-char *ghostnames[] = { /* these names should have length < PL_NSIZ */
- "adri", "andries", "andreas", "bert", "david", "dirk", "emile",
- "frans", "fred", "greg", "hether", "jay", "john", "jon", "kay",
- "kenny", "maud", "michiel", "mike", "peter", "robert", "ron",
- "tom", "wilmar"
-};
-
-char *
-xmonnam(mtmp, vb) struct monst *mtmp; int vb; {
-static char buf[BUFSZ]; /* %% */
-extern char *shkname();
- if(mtmp->mnamelth && !vb) {
- (void) strcpy(buf, NAME(mtmp));
- return(buf);
- }
- switch(mtmp->data->mlet) {
- case ' ':
- { char *gn = (char *) mtmp->mextra;
- if(!*gn) { /* might also look in scorefile */
- gn = ghostnames[rn2(SIZE(ghostnames))];
- if(!rn2(2)) (void)
- strcpy((char *) mtmp->mextra, !rn2(5) ? plname : gn);
- }
- (void) sprintf(buf, "%s's ghost", gn);
- }
- break;
- case '@':
- if(mtmp->isshk) {
- (void) strcpy(buf, shkname(mtmp));
- break;
- }
- /* FALLTHROUGH */
- default:
- (void) sprintf(buf, "the %s%s",
- mtmp->minvis ? "invisible " : "",
- mtmp->data->mname);
- }
- if(vb && mtmp->mnamelth) {
- (void) strcat(buf, " called ");
- (void) strcat(buf, NAME(mtmp));
- }
- return(buf);
-}
-
-char *
-lmonnam(mtmp) struct monst *mtmp; {
- return(xmonnam(mtmp, 1));
-}
-
-char *
-monnam(mtmp) struct monst *mtmp; {
- return(xmonnam(mtmp, 0));
-}
-
-char *
-Monnam(mtmp) struct monst *mtmp; {
-char *bp = monnam(mtmp);
- if('a' <= *bp && *bp <= 'z') *bp += ('A' - 'a');
- return(bp);
-}
-
-char *
-amonnam(mtmp,adj)
-struct monst *mtmp;
-char *adj;
-{
- char *bp = monnam(mtmp);
- static char buf[BUFSZ]; /* %% */
-
- if(!strncmp(bp, "the ", 4)) bp += 4;
- (void) sprintf(buf, "the %s %s", adj, bp);
- return(buf);
-}
-
-char *
-Amonnam(mtmp, adj)
-struct monst *mtmp;
-char *adj;
-{
- char *bp = amonnam(mtmp,adj);
-
- *bp = 'T';
- return(bp);
-}
-
-char *
-Xmonnam(mtmp) struct monst *mtmp; {
-char *bp = Monnam(mtmp);
- if(!strncmp(bp, "The ", 4)) {
- bp += 2;
- *bp = 'A';
- }
- return(bp);
-}
-
-char *
-visctrl(c)
-char c;
-{
-static char ccc[3];
- if(c < 040) {
- ccc[0] = '^';
- ccc[1] = c + 0100;
- ccc[2] = 0;
- } else {
- ccc[0] = c;
- ccc[1] = 0;
- }
- return(ccc);
-}
diff --git a/games/hack/hack.do_wear.c b/games/hack/hack.do_wear.c
deleted file mode 100644
index 1aa77fd..0000000
--- a/games/hack/hack.do_wear.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.do_wear.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-extern char *nomovemsg;
-extern char quitchars[];
-extern char *Doname();
-
-off_msg(otmp) struct obj *otmp; {
- pline("You were wearing %s.", doname(otmp));
-}
-
-doremarm() {
- struct obj *otmp;
- if(!uarm && !uarmh && !uarms && !uarmg) {
- pline("Not wearing any armor.");
- return(0);
- }
- otmp = (!uarmh && !uarms && !uarmg) ? uarm :
- (!uarms && !uarm && !uarmg) ? uarmh :
- (!uarmh && !uarm && !uarmg) ? uarms :
- (!uarmh && !uarm && !uarms) ? uarmg :
- getobj("[", "take off");
- if(!otmp) return(0);
- if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) {
- pline("You can't take that off.");
- return(0);
- }
- if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */
- pline("You seem not able to take off the gloves while holding your weapon.");
- return(0);
- }
- (void) armoroff(otmp);
- return(1);
-}
-
-doremring() {
- if(!uleft && !uright){
- pline("Not wearing any ring.");
- return(0);
- }
- if(!uleft)
- return(dorr(uright));
- if(!uright)
- return(dorr(uleft));
- if(uleft && uright) while(1) {
- char answer;
-
- pline("What ring, Right or Left? [ rl?]");
- if(index(quitchars, (answer = readchar())))
- return(0);
- switch(answer) {
- case 'l':
- case 'L':
- return(dorr(uleft));
- case 'r':
- case 'R':
- return(dorr(uright));
- case '?':
- (void) doprring();
- /* might look at morc here %% */
- }
- }
- /* NOTREACHED */
-#ifdef lint
- return(0);
-#endif /* lint */
-}
-
-dorr(otmp) struct obj *otmp; {
- if(cursed(otmp)) return(0);
- ringoff(otmp);
- off_msg(otmp);
- return(1);
-}
-
-cursed(otmp) struct obj *otmp; {
- if(otmp->cursed){
- pline("You can't. It appears to be cursed.");
- return(1);
- }
- return(0);
-}
-
-armoroff(otmp) struct obj *otmp; {
-int delay = -objects[otmp->otyp].oc_delay;
- if(cursed(otmp)) return(0);
- setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
- if(delay) {
- nomul(delay);
- switch(otmp->otyp) {
- case HELMET:
- nomovemsg = "You finished taking off your helmet.";
- break;
- case PAIR_OF_GLOVES:
- nomovemsg = "You finished taking off your gloves";
- break;
- default:
- nomovemsg = "You finished taking off your suit.";
- }
- } else {
- off_msg(otmp);
- }
- return(1);
-}
-
-doweararm() {
- struct obj *otmp;
- int delay;
- int err = 0;
- long mask = 0;
-
- otmp = getobj("[", "wear");
- if(!otmp) return(0);
- if(otmp->owornmask & W_ARMOR) {
- pline("You are already wearing that!");
- return(0);
- }
- if(otmp->otyp == HELMET){
- if(uarmh) {
- pline("You are already wearing a helmet.");
- err++;
- } else
- mask = W_ARMH;
- } else if(otmp->otyp == SHIELD){
- if(uarms) pline("You are already wearing a shield."), err++;
- if(uwep && uwep->otyp == TWO_HANDED_SWORD)
- pline("You cannot wear a shield and wield a two-handed sword."), err++;
- if(!err) mask = W_ARMS;
- } else if(otmp->otyp == PAIR_OF_GLOVES) {
- if(uarmg) {
- pline("You are already wearing gloves.");
- err++;
- } else
- if(uwep && uwep->cursed) {
- pline("You cannot wear gloves over your weapon.");
- err++;
- } else
- mask = W_ARMG;
- } else {
- if(uarm) {
- if(otmp->otyp != ELVEN_CLOAK || uarm2) {
- pline("You are already wearing some armor.");
- err++;
- }
- }
- if(!err) mask = W_ARM;
- }
- if(otmp == uwep && uwep->cursed) {
- if(!err++)
- pline("%s is welded to your hand.", Doname(uwep));
- }
- if(err) return(0);
- setworn(otmp, mask);
- if(otmp == uwep)
- setuwep((struct obj *) 0);
- delay = -objects[otmp->otyp].oc_delay;
- if(delay){
- nomul(delay);
- nomovemsg = "You finished your dressing manoeuvre.";
- }
- otmp->known = 1;
- return(1);
-}
-
-dowearring() {
- struct obj *otmp;
- long mask = 0;
- long oldprop;
-
- if(uleft && uright){
- pline("There are no more ring-fingers to fill.");
- return(0);
- }
- otmp = getobj("=", "wear");
- if(!otmp) return(0);
- if(otmp->owornmask & W_RING) {
- pline("You are already wearing that!");
- return(0);
- }
- if(otmp == uleft || otmp == uright) {
- pline("You are already wearing that.");
- return(0);
- }
- if(otmp == uwep && uwep->cursed) {
- pline("%s is welded to your hand.", Doname(uwep));
- return(0);
- }
- if(uleft) mask = RIGHT_RING;
- else if(uright) mask = LEFT_RING;
- else do {
- char answer;
-
- pline("What ring-finger, Right or Left? ");
- if(index(quitchars, (answer = readchar())))
- return(0);
- switch(answer){
- case 'l':
- case 'L':
- mask = LEFT_RING;
- break;
- case 'r':
- case 'R':
- mask = RIGHT_RING;
- break;
- }
- } while(!mask);
- setworn(otmp, mask);
- if(otmp == uwep)
- setuwep((struct obj *) 0);
- oldprop = u.uprops[PROP(otmp->otyp)].p_flgs;
- u.uprops[PROP(otmp->otyp)].p_flgs |= mask;
- switch(otmp->otyp){
- case RIN_LEVITATION:
- if(!oldprop) float_up();
- break;
- case RIN_PROTECTION_FROM_SHAPE_CHANGERS:
- rescham();
- break;
- case RIN_GAIN_STRENGTH:
- u.ustr += otmp->spe;
- u.ustrmax += otmp->spe;
- if(u.ustr > 118) u.ustr = 118;
- if(u.ustrmax > 118) u.ustrmax = 118;
- flags.botl = 1;
- break;
- case RIN_INCREASE_DAMAGE:
- u.udaminc += otmp->spe;
- break;
- }
- prinv(otmp);
- return(1);
-}
-
-ringoff(obj)
-struct obj *obj;
-{
-long mask;
- mask = obj->owornmask & W_RING;
- setworn((struct obj *) 0, obj->owornmask);
- if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask))
- impossible("Strange... I didnt know you had that ring.");
- u.uprops[PROP(obj->otyp)].p_flgs &= ~mask;
- switch(obj->otyp) {
- case RIN_FIRE_RESISTANCE:
- /* Bad luck if the player is in hell... --jgm */
- if (!Fire_resistance && dlevel >= 30) {
- pline("The flames of Hell burn you to a crisp.");
- killer = "stupidity in hell";
- done("burned");
- }
- break;
- case RIN_LEVITATION:
- if(!Levitation) { /* no longer floating */
- float_down();
- }
- break;
- case RIN_GAIN_STRENGTH:
- u.ustr -= obj->spe;
- u.ustrmax -= obj->spe;
- if(u.ustr > 118) u.ustr = 118;
- if(u.ustrmax > 118) u.ustrmax = 118;
- flags.botl = 1;
- break;
- case RIN_INCREASE_DAMAGE:
- u.udaminc -= obj->spe;
- break;
- }
-}
-
-find_ac(){
-int uac = 10;
- if(uarm) uac -= ARM_BONUS(uarm);
- if(uarm2) uac -= ARM_BONUS(uarm2);
- if(uarmh) uac -= ARM_BONUS(uarmh);
- if(uarms) uac -= ARM_BONUS(uarms);
- if(uarmg) uac -= ARM_BONUS(uarmg);
- if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe;
- if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe;
- if(uac != u.uac){
- u.uac = uac;
- flags.botl = 1;
- }
-}
-
-glibr(){
-struct obj *otmp;
-int xfl = 0;
- if(!uarmg) if(uleft || uright) {
- /* Note: at present also cursed rings fall off */
- pline("Your %s off your fingers.",
- (uleft && uright) ? "rings slip" : "ring slips");
- xfl++;
- if((otmp = uleft) != Null(obj)){
- ringoff(uleft);
- dropx(otmp);
- }
- if((otmp = uright) != Null(obj)){
- ringoff(uright);
- dropx(otmp);
- }
- }
- if((otmp = uwep) != Null(obj)){
- /* Note: at present also cursed weapons fall */
- setuwep((struct obj *) 0);
- dropx(otmp);
- pline("Your weapon %sslips from your hands.",
- xfl ? "also " : "");
- }
-}
-
-struct obj *
-some_armor(){
-struct obj *otmph = uarm;
- if(uarmh && (!otmph || !rn2(4))) otmph = uarmh;
- if(uarmg && (!otmph || !rn2(4))) otmph = uarmg;
- if(uarms && (!otmph || !rn2(4))) otmph = uarms;
- return(otmph);
-}
-
-corrode_armor(){
-struct obj *otmph = some_armor();
- if(otmph){
- if(otmph->rustfree ||
- otmph->otyp == ELVEN_CLOAK ||
- otmph->otyp == LEATHER_ARMOR ||
- otmph->otyp == STUDDED_LEATHER_ARMOR) {
- pline("Your %s not affected!",
- aobjnam(otmph, "are"));
- return;
- }
- pline("Your %s!", aobjnam(otmph, "corrode"));
- otmph->spe--;
- }
-}
diff --git a/games/hack/hack.dog.c b/games/hack/hack.dog.c
deleted file mode 100644
index 6272a18..0000000
--- a/games/hack/hack.dog.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.dog.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-#include "hack.mfndpos.h"
-extern struct monst *makemon();
-#include "def.edog.h"
-#include "def.mkroom.h"
-
-struct permonst li_dog =
- { "little dog", 'd',2,18,6,1,6,sizeof(struct edog) };
-struct permonst dog =
- { "dog", 'd',4,16,5,1,6,sizeof(struct edog) };
-struct permonst la_dog =
- { "large dog", 'd',6,15,4,2,4,sizeof(struct edog) };
-
-
-makedog(){
-struct monst *mtmp = makemon(&li_dog,u.ux,u.uy);
- if(!mtmp) return; /* dogs were genocided */
- initedog(mtmp);
-}
-
-initedog(mtmp) struct monst *mtmp; {
- mtmp->mtame = mtmp->mpeaceful = 1;
- EDOG(mtmp)->hungrytime = 1000 + moves;
- EDOG(mtmp)->eattime = 0;
- EDOG(mtmp)->droptime = 0;
- EDOG(mtmp)->dropdist = 10000;
- EDOG(mtmp)->apport = 10;
- EDOG(mtmp)->whistletime = 0;
-}
-
-/* attach the monsters that went down (or up) together with @ */
-struct monst *mydogs = 0;
-struct monst *fallen_down = 0; /* monsters that fell through a trapdoor */
- /* they will appear on the next level @ goes to, even if he goes up! */
-
-losedogs(){
-struct monst *mtmp;
- while(mtmp = mydogs){
- mydogs = mtmp->nmon;
- mtmp->nmon = fmon;
- fmon = mtmp;
- mnexto(mtmp);
- }
- while(mtmp = fallen_down){
- fallen_down = mtmp->nmon;
- mtmp->nmon = fmon;
- fmon = mtmp;
- rloc(mtmp);
- }
-}
-
-keepdogs(){
-struct monst *mtmp;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(dist(mtmp->mx,mtmp->my) < 3 && follower(mtmp)
- && !mtmp->msleep && !mtmp->mfroz) {
- relmon(mtmp);
- mtmp->nmon = mydogs;
- mydogs = mtmp;
- unpmon(mtmp);
- keepdogs(); /* we destroyed the link, so use recursion */
- return; /* (admittedly somewhat primitive) */
- }
-}
-
-fall_down(mtmp) struct monst *mtmp; {
- relmon(mtmp);
- mtmp->nmon = fallen_down;
- fallen_down = mtmp;
- unpmon(mtmp);
- mtmp->mtame = 0;
-}
-
-/* return quality of food; the lower the better */
-#define DOGFOOD 0
-#define CADAVER 1
-#define ACCFOOD 2
-#define MANFOOD 3
-#define APPORT 4
-#define POISON 5
-#define UNDEF 6
-dogfood(obj) struct obj *obj; {
- switch(obj->olet) {
- case FOOD_SYM:
- return(
- (obj->otyp == TRIPE_RATION) ? DOGFOOD :
- (obj->otyp < CARROT) ? ACCFOOD :
- (obj->otyp < CORPSE) ? MANFOOD :
- (poisonous(obj) || obj->age + 50 <= moves ||
- obj->otyp == DEAD_COCKATRICE)
- ? POISON : CADAVER
- );
- default:
- if(!obj->cursed) return(APPORT);
- /* FALLTHROUGH */
- case BALL_SYM:
- case CHAIN_SYM:
- case ROCK_SYM:
- return(UNDEF);
- }
-}
-
-/* return 0 (no move), 1 (move) or 2 (dead) */
-dog_move(mtmp, after) struct monst *mtmp; {
-int nx,ny,omx,omy,appr,nearer,j;
-int udist,chi,i,whappr;
-struct monst *mtmp2;
-struct permonst *mdat = mtmp->data;
-struct edog *edog = EDOG(mtmp);
-struct obj *obj;
-struct trap *trap;
-xchar cnt,chcnt,nix,niy;
-schar dogroom,uroom;
-xchar gx,gy,gtyp,otyp; /* current goal */
-coord poss[9];
-int info[9];
-#define GDIST(x,y) ((x-gx)*(x-gx) + (y-gy)*(y-gy))
-#define DDIST(x,y) ((x-omx)*(x-omx) + (y-omy)*(y-omy))
-
- if(moves <= edog->eattime) return(0); /* dog is still eating */
- omx = mtmp->mx;
- omy = mtmp->my;
- whappr = (moves - EDOG(mtmp)->whistletime < 5);
- if(moves > edog->hungrytime + 500 && !mtmp->mconf){
- mtmp->mconf = 1;
- mtmp->mhpmax /= 3;
- if(mtmp->mhp > mtmp->mhpmax)
- mtmp->mhp = mtmp->mhpmax;
- if(cansee(omx,omy))
- pline("%s is confused from hunger.", Monnam(mtmp));
- else pline("You feel worried about %s.", monnam(mtmp));
- } else
- if(moves > edog->hungrytime + 750 || mtmp->mhp < 1){
- if(cansee(omx,omy))
- pline("%s dies from hunger.", Monnam(mtmp));
- else
- pline("You have a sad feeling for a moment, then it passes.");
- mondied(mtmp);
- return(2);
- }
- dogroom = inroom(omx,omy);
- uroom = inroom(u.ux,u.uy);
- udist = dist(omx,omy);
-
- /* maybe we tamed him while being swallowed --jgm */
- if(!udist) return(0);
-
- /* if we are carrying sth then we drop it (perhaps near @) */
- /* Note: if apport == 1 then our behaviour is independent of udist */
- if(mtmp->minvent){
- if(!rn2(udist) || !rn2((int) edog->apport))
- if(rn2(10) < edog->apport){
- relobj(mtmp, (int) mtmp->minvis);
- if(edog->apport > 1) edog->apport--;
- edog->dropdist = udist; /* hpscdi!jon */
- edog->droptime = moves;
- }
- } else {
- if(obj = o_at(omx,omy)) if(!index("0_", obj->olet)){
- if((otyp = dogfood(obj)) <= CADAVER){
- nix = omx;
- niy = omy;
- goto eatobj;
- }
- if(obj->owt < 10*mtmp->data->mlevel)
- if(rn2(20) < edog->apport+3)
- if(rn2(udist) || !rn2((int) edog->apport)){
- freeobj(obj);
- unpobj(obj);
- /* if(levl[omx][omy].scrsym == obj->olet)
- newsym(omx,omy); */
- mpickobj(mtmp,obj);
- }
- }
- }
-
- /* first we look for food */
- gtyp = UNDEF; /* no goal as yet */
-#ifdef lint
- gx = gy = 0; /* suppress 'used before set' message */
-#endif /* LINT */
- for(obj = fobj; obj; obj = obj->nobj) {
- otyp = dogfood(obj);
- if(otyp > gtyp || otyp == UNDEF) continue;
- if(inroom(obj->ox,obj->oy) != dogroom) continue;
- if(otyp < MANFOOD &&
- (dogroom >= 0 || DDIST(obj->ox,obj->oy) < 10)) {
- if(otyp < gtyp || (otyp == gtyp &&
- DDIST(obj->ox,obj->oy) < DDIST(gx,gy))){
- gx = obj->ox;
- gy = obj->oy;
- gtyp = otyp;
- }
- } else
- if(gtyp == UNDEF && dogroom >= 0 &&
- uroom == dogroom &&
- !mtmp->minvent && edog->apport > rn2(8)){
- gx = obj->ox;
- gy = obj->oy;
- gtyp = APPORT;
- }
- }
- if(gtyp == UNDEF ||
- (gtyp != DOGFOOD && gtyp != APPORT && moves < edog->hungrytime)){
- if(dogroom < 0 || dogroom == uroom){
- gx = u.ux;
- gy = u.uy;
-#ifndef QUEST
- } else {
- int tmp = rooms[dogroom].fdoor;
- cnt = rooms[dogroom].doorct;
-
- gx = gy = FAR; /* random, far away */
- while(cnt--){
- if(dist(gx,gy) >
- dist(doors[tmp].x, doors[tmp].y)){
- gx = doors[tmp].x;
- gy = doors[tmp].y;
- }
- tmp++;
- }
- /* here gx == FAR e.g. when dog is in a vault */
- if(gx == FAR || (gx == omx && gy == omy)){
- gx = u.ux;
- gy = u.uy;
- }
-#endif /* QUEST */
- }
- appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0;
- if(after && udist <= 4 && gx == u.ux && gy == u.uy)
- return(0);
- if(udist > 1){
- if(!IS_ROOM(levl[u.ux][u.uy].typ) || !rn2(4) ||
- whappr ||
- (mtmp->minvent && rn2((int) edog->apport)))
- appr = 1;
- }
- /* if you have dog food he'll follow you more closely */
- if(appr == 0){
- obj = invent;
- while(obj){
- if(obj->otyp == TRIPE_RATION){
- appr = 1;
- break;
- }
- obj = obj->nobj;
- }
- }
- } else appr = 1; /* gtyp != UNDEF */
- if(mtmp->mconf) appr = 0;
-
- if(gx == u.ux && gy == u.uy && (dogroom != uroom || dogroom < 0)){
- extern coord *gettrack();
- coord *cp;
- cp = gettrack(omx,omy);
- if(cp){
- gx = cp->x;
- gy = cp->y;
- }
- }
-
- nix = omx;
- niy = omy;
- cnt = mfndpos(mtmp,poss,info,ALLOW_M | ALLOW_TRAPS);
- chcnt = 0;
- chi = -1;
- for(i=0; i<cnt; i++){
- nx = poss[i].x;
- ny = poss[i].y;
- if(info[i] & ALLOW_M){
- mtmp2 = m_at(nx,ny);
- if(mtmp2->data->mlevel >= mdat->mlevel+2 ||
- mtmp2->data->mlet == 'c')
- continue;
- if(after) return(0); /* hit only once each move */
-
- if(hitmm(mtmp, mtmp2) == 1 && rn2(4) &&
- mtmp2->mlstmv != moves &&
- hitmm(mtmp2,mtmp) == 2) return(2);
- return(0);
- }
-
- /* dog avoids traps */
- /* but perhaps we have to pass a trap in order to follow @ */
- if((info[i] & ALLOW_TRAPS) && (trap = t_at(nx,ny))){
- if(!trap->tseen && rn2(40)) continue;
- if(rn2(10)) continue;
- }
-
- /* dog eschewes cursed objects */
- /* but likes dog food */
- obj = fobj;
- while(obj){
- if(obj->ox != nx || obj->oy != ny)
- goto nextobj;
- if(obj->cursed) goto nxti;
- if(obj->olet == FOOD_SYM &&
- (otyp = dogfood(obj)) < MANFOOD &&
- (otyp < ACCFOOD || edog->hungrytime <= moves)){
- /* Note: our dog likes the food so much that he
- might eat it even when it conceals a cursed object */
- nix = nx;
- niy = ny;
- chi = i;
- eatobj:
- edog->eattime =
- moves + obj->quan * objects[obj->otyp].oc_delay;
- if(edog->hungrytime < moves)
- edog->hungrytime = moves;
- edog->hungrytime +=
- 5*obj->quan * objects[obj->otyp].nutrition;
- mtmp->mconf = 0;
- if(cansee(nix,niy))
- pline("%s ate %s.", Monnam(mtmp), doname(obj));
- /* perhaps this was a reward */
- if(otyp != CADAVER)
- edog->apport += 200/(edog->dropdist+moves-edog->droptime);
- delobj(obj);
- goto newdogpos;
- }
- nextobj:
- obj = obj->nobj;
- }
-
- for(j=0; j<MTSZ && j<cnt-1; j++)
- if(nx == mtmp->mtrack[j].x && ny == mtmp->mtrack[j].y)
- if(rn2(4*(cnt-j))) goto nxti;
-
-/* Some stupid C compilers cannot compute the whole expression at once. */
- nearer = GDIST(nx,ny);
- nearer -= GDIST(nix,niy);
- nearer *= appr;
- if((nearer == 0 && !rn2(++chcnt)) || nearer<0 ||
- (nearer > 0 && !whappr &&
- ((omx == nix && omy == niy && !rn2(3))
- || !rn2(12))
- )){
- nix = nx;
- niy = ny;
- if(nearer < 0) chcnt = 0;
- chi = i;
- }
- nxti: ;
- }
-newdogpos:
- if(nix != omx || niy != omy){
- if(info[chi] & ALLOW_U){
- (void) hitu(mtmp, d(mdat->damn, mdat->damd)+1);
- return(0);
- }
- mtmp->mx = nix;
- mtmp->my = niy;
- for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1];
- mtmp->mtrack[0].x = omx;
- mtmp->mtrack[0].y = omy;
- }
- if(mintrap(mtmp) == 2) /* he died */
- return(2);
- pmon(mtmp);
- return(1);
-}
-
-/* return roomnumber or -1 */
-inroom(x,y) xchar x,y; {
-#ifndef QUEST
- struct mkroom *croom = &rooms[0];
- while(croom->hx >= 0){
- if(croom->hx >= x-1 && croom->lx <= x+1 &&
- croom->hy >= y-1 && croom->ly <= y+1)
- return(croom - rooms);
- croom++;
- }
-#endif /* QUEST */
- return(-1); /* not in room or on door */
-}
-
-tamedog(mtmp, obj)
-struct monst *mtmp;
-struct obj *obj;
-{
- struct monst *mtmp2;
-
- if(flags.moonphase == FULL_MOON && night() && rn2(6))
- return(0);
-
- /* If we cannot tame him, at least he's no longer afraid. */
- mtmp->mflee = 0;
- mtmp->mfleetim = 0;
- if(mtmp->mtame || mtmp->mfroz ||
-#ifndef NOWORM
- mtmp->wormno ||
-#endif /* NOWORM */
- mtmp->isshk || mtmp->isgd || index(" &@12", mtmp->data->mlet))
- return(0); /* no tame long worms? */
- if(obj) {
- if(dogfood(obj) >= MANFOOD) return(0);
- if(cansee(mtmp->mx,mtmp->my)){
- pline("%s devours the %s.", Monnam(mtmp),
- objects[obj->otyp].oc_name);
- }
- obfree(obj, (struct obj *) 0);
- }
- mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth);
- *mtmp2 = *mtmp;
- mtmp2->mxlth = sizeof(struct edog);
- if(mtmp->mnamelth) (void) strcpy(NAME(mtmp2), NAME(mtmp));
- initedog(mtmp2);
- replmon(mtmp,mtmp2);
- return(1);
-}
diff --git a/games/hack/hack.eat.c b/games/hack/hack.eat.c
deleted file mode 100644
index 6f4116b..0000000
--- a/games/hack/hack.eat.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.eat.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-char POISONOUS[] = "ADKSVabhks";
-extern char *nomovemsg;
-extern int (*afternmv)();
-extern int (*occupation)();
-extern char *occtxt;
-extern struct obj *splitobj(), *addinv();
-
-/* hunger texts used on bottom line (each 8 chars long) */
-#define SATIATED 0
-#define NOT_HUNGRY 1
-#define HUNGRY 2
-#define WEAK 3
-#define FAINTING 4
-#define FAINTED 5
-#define STARVED 6
-
-char *hu_stat[] = {
- "Satiated",
- " ",
- "Hungry ",
- "Weak ",
- "Fainting",
- "Fainted ",
- "Starved "
-};
-
-init_uhunger(){
- u.uhunger = 900;
- u.uhs = NOT_HUNGRY;
-}
-
-#define TTSZ SIZE(tintxts)
-struct { char *txt; int nut; } tintxts[] = {
- "It contains first quality peaches - what a surprise!", 40,
- "It contains salmon - not bad!", 60,
- "It contains apple juice - perhaps not what you hoped for.", 20,
- "It contains some nondescript substance, tasting awfully.", 500,
- "It contains rotten meat. You vomit.", -50,
- "It turns out to be empty.", 0
-};
-
-static struct {
- struct obj *tin;
- int usedtime, reqtime;
-} tin;
-
-opentin(){
- int r;
-
- if(!carried(tin.tin)) /* perhaps it was stolen? */
- return(0); /* %% probably we should use tinoid */
- if(tin.usedtime++ >= 50) {
- pline("You give up your attempt to open the tin.");
- return(0);
- }
- if(tin.usedtime < tin.reqtime)
- return(1); /* still busy */
-
- pline("You succeed in opening the tin.");
- useup(tin.tin);
- r = rn2(2*TTSZ);
- if(r < TTSZ){
- pline(tintxts[r].txt);
- lesshungry(tintxts[r].nut);
- if(r == 1) /* SALMON */ {
- Glib = rnd(15);
- pline("Eating salmon made your fingers very slippery.");
- }
- } else {
- pline("It contains spinach - this makes you feel like Popeye!");
- lesshungry(600);
- if(u.ustr < 118)
- u.ustr += rnd( ((u.ustr < 17) ? 19 : 118) - u.ustr);
- if(u.ustr > u.ustrmax) u.ustrmax = u.ustr;
- flags.botl = 1;
- }
- return(0);
-}
-
-Meatdone(){
- u.usym = '@';
- prme();
-}
-
-doeat(){
- struct obj *otmp;
- struct objclass *ftmp;
- int tmp;
-
- /* Is there some food (probably a heavy corpse) here on the ground? */
- if(!Levitation)
- for(otmp = fobj; otmp; otmp = otmp->nobj) {
- if(otmp->ox == u.ux && otmp->oy == u.uy &&
- otmp->olet == FOOD_SYM) {
- pline("There %s %s here; eat %s? [ny] ",
- (otmp->quan == 1) ? "is" : "are",
- doname(otmp),
- (otmp->quan == 1) ? "it" : "one");
- if(readchar() == 'y') {
- if(otmp->quan != 1)
- (void) splitobj(otmp, 1);
- freeobj(otmp);
- otmp = addinv(otmp);
- addtobill(otmp);
- goto gotit;
- }
- }
- }
- otmp = getobj("%", "eat");
- if(!otmp) return(0);
-gotit:
- if(otmp->otyp == TIN){
- if(uwep) {
- switch(uwep->otyp) {
- case CAN_OPENER:
- tmp = 1;
- break;
- case DAGGER:
- case CRYSKNIFE:
- tmp = 3;
- break;
- case PICK_AXE:
- case AXE:
- tmp = 6;
- break;
- default:
- goto no_opener;
- }
- pline("Using your %s you try to open the tin.",
- aobjnam(uwep, (char *) 0));
- } else {
- no_opener:
- pline("It is not so easy to open this tin.");
- if(Glib) {
- pline("The tin slips out of your hands.");
- if(otmp->quan > 1) {
- struct obj *obj;
- extern struct obj *splitobj();
-
- obj = splitobj(otmp, 1);
- if(otmp == uwep) setuwep(obj);
- }
- dropx(otmp);
- return(1);
- }
- tmp = 10 + rn2(1 + 500/((int)(u.ulevel + u.ustr)));
- }
- tin.reqtime = tmp;
- tin.usedtime = 0;
- tin.tin = otmp;
- occupation = opentin;
- occtxt = "opening the tin";
- return(1);
- }
- ftmp = &objects[otmp->otyp];
- multi = -ftmp->oc_delay;
- if(otmp->otyp >= CORPSE && eatcorpse(otmp)) goto eatx;
- if(!rn2(7) && otmp->otyp != FORTUNE_COOKIE) {
- pline("Blecch! Rotten food!");
- if(!rn2(4)) {
- pline("You feel rather light headed.");
- Confusion += d(2,4);
- } else if(!rn2(4)&& !Blind) {
- pline("Everything suddenly goes dark.");
- Blind = d(2,10);
- seeoff(0);
- } else if(!rn2(3)) {
- if(Blind)
- pline("The world spins and you slap against the floor.");
- else
- pline("The world spins and goes dark.");
- nomul(-rnd(10));
- nomovemsg = "You are conscious again.";
- }
- lesshungry(ftmp->nutrition / 4);
- } else {
- if(u.uhunger >= 1500) {
- pline("You choke over your food.");
- pline("You die...");
- killer = ftmp->oc_name;
- done("choked");
- }
- switch(otmp->otyp){
- case FOOD_RATION:
- if(u.uhunger <= 200)
- pline("That food really hit the spot!");
- else if(u.uhunger <= 700)
- pline("That satiated your stomach!");
- else {
- pline("You're having a hard time getting all that food down.");
- multi -= 2;
- }
- lesshungry(ftmp->nutrition);
- if(multi < 0) nomovemsg = "You finished your meal.";
- break;
- case TRIPE_RATION:
- pline("Yak - dog food!");
- more_experienced(1,0);
- flags.botl = 1;
- if(rn2(2)){
- pline("You vomit.");
- morehungry(20);
- if(Sick) {
- Sick = 0; /* David Neves */
- pline("What a relief!");
- }
- } else lesshungry(ftmp->nutrition);
- break;
- default:
- if(otmp->otyp >= CORPSE)
- pline("That %s tasted terrible!",ftmp->oc_name);
- else
- pline("That %s was delicious!",ftmp->oc_name);
- lesshungry(ftmp->nutrition);
- if(otmp->otyp == DEAD_LIZARD && (Confusion > 2))
- Confusion = 2;
- else
-#ifdef QUEST
- if(otmp->otyp == CARROT && !Blind){
- u.uhorizon++;
- setsee();
- pline("Your vision improves.");
- } else
-#endif /* QUEST */
- if(otmp->otyp == FORTUNE_COOKIE) {
- if(Blind) {
- pline("This cookie has a scrap of paper inside!");
- pline("What a pity, that you cannot read it!");
- } else
- outrumor();
- } else
- if(otmp->otyp == LUMP_OF_ROYAL_JELLY) {
- /* This stuff seems to be VERY healthy! */
- if(u.ustrmax < 118) u.ustrmax++;
- if(u.ustr < u.ustrmax) u.ustr++;
- u.uhp += rnd(20);
- if(u.uhp > u.uhpmax) {
- if(!rn2(17)) u.uhpmax++;
- u.uhp = u.uhpmax;
- }
- heal_legs();
- }
- break;
- }
- }
-eatx:
- if(multi<0 && !nomovemsg){
- static char msgbuf[BUFSZ];
- (void) sprintf(msgbuf, "You finished eating the %s.",
- ftmp->oc_name);
- nomovemsg = msgbuf;
- }
- useup(otmp);
- return(1);
-}
-
-/* called in hack.main.c */
-gethungry(){
- --u.uhunger;
- if(moves % 2) {
- if(Regeneration) u.uhunger--;
- if(Hunger) u.uhunger--;
- /* a3: if(Hunger & LEFT_RING) u.uhunger--;
- if(Hunger & RIGHT_RING) u.uhunger--;
- etc. */
- }
- if(moves % 20 == 0) { /* jimt@asgb */
- if(uleft) u.uhunger--;
- if(uright) u.uhunger--;
- }
- newuhs(TRUE);
-}
-
-/* called after vomiting and after performing feats of magic */
-morehungry(num) int num; {
- u.uhunger -= num;
- newuhs(TRUE);
-}
-
-/* called after eating something (and after drinking fruit juice) */
-lesshungry(num) int num; {
- u.uhunger += num;
- newuhs(FALSE);
-}
-
-unfaint(){
- u.uhs = FAINTING;
- flags.botl = 1;
-}
-
-newuhs(incr) boolean incr; {
- int newhs, h = u.uhunger;
-
- newhs = (h > 1000) ? SATIATED :
- (h > 150) ? NOT_HUNGRY :
- (h > 50) ? HUNGRY :
- (h > 0) ? WEAK : FAINTING;
-
- if(newhs == FAINTING) {
- if(u.uhs == FAINTED)
- newhs = FAINTED;
- if(u.uhs <= WEAK || rn2(20-u.uhunger/10) >= 19) {
- if(u.uhs != FAINTED && multi >= 0 /* %% */) {
- pline("You faint from lack of food.");
- nomul(-10+(u.uhunger/10));
- nomovemsg = "You regain consciousness.";
- afternmv = unfaint;
- newhs = FAINTED;
- }
- } else
- if(u.uhunger < -(int)(200 + 25*u.ulevel)) {
- u.uhs = STARVED;
- flags.botl = 1;
- bot();
- pline("You die from starvation.");
- done("starved");
- }
- }
-
- if(newhs != u.uhs) {
- if(newhs >= WEAK && u.uhs < WEAK)
- losestr(1); /* this may kill you -- see below */
- else
- if(newhs < WEAK && u.uhs >= WEAK && u.ustr < u.ustrmax)
- losestr(-1);
- switch(newhs){
- case HUNGRY:
- pline((!incr) ? "You only feel hungry now." :
- (u.uhunger < 145) ? "You feel hungry." :
- "You are beginning to feel hungry.");
- break;
- case WEAK:
- pline((!incr) ? "You feel weak now." :
- (u.uhunger < 45) ? "You feel weak." :
- "You are beginning to feel weak.");
- break;
- }
- u.uhs = newhs;
- flags.botl = 1;
- if(u.uhp < 1) {
- pline("You die from hunger and exhaustion.");
- killer = "exhaustion";
- done("starved");
- }
- }
-}
-
-#define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\
- ? 'a' + (otyp - DEAD_ACID_BLOB)\
- : '@' + (otyp - DEAD_HUMAN))
-poisonous(otmp)
-struct obj *otmp;
-{
- return(index(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0);
-}
-
-/* returns 1 if some text was printed */
-eatcorpse(otmp) struct obj *otmp; {
-char let = CORPSE_I_TO_C(otmp->otyp);
-int tp = 0;
- if(let != 'a' && moves > otmp->age + 50 + rn2(100)) {
- tp++;
- pline("Ulch -- that meat was tainted!");
- pline("You get very sick.");
- Sick = 10 + rn2(10);
- u.usick_cause = objects[otmp->otyp].oc_name;
- } else if(index(POISONOUS, let) && rn2(5)){
- tp++;
- pline("Ecch -- that must have been poisonous!");
- if(!Poison_resistance){
- losestr(rnd(4));
- losehp(rnd(15), "poisonous corpse");
- } else
- pline("You don't seem affected by the poison.");
- } else if(index("ELNOPQRUuxz", let) && rn2(5)){
- tp++;
- pline("You feel sick.");
- losehp(rnd(8), "cadaver");
- }
- switch(let) {
- case 'L':
- case 'N':
- case 't':
- Teleportation |= INTRINSIC;
- break;
- case 'W':
- pluslvl();
- break;
- case 'n':
- u.uhp = u.uhpmax;
- flags.botl = 1;
- /* FALLTHROUGH */
- case '@':
- pline("You cannibal! You will be sorry for this!");
- /* not tp++; */
- /* FALLTHROUGH */
- case 'd':
- Aggravate_monster |= INTRINSIC;
- break;
- case 'I':
- if(!Invis) {
- Invis = 50+rn2(100);
- if(!See_invisible)
- newsym(u.ux, u.uy);
- } else {
- Invis |= INTRINSIC;
- See_invisible |= INTRINSIC;
- }
- /* FALLTHROUGH */
- case 'y':
-#ifdef QUEST
- u.uhorizon++;
-#endif /* QUEST */
- /* FALLTHROUGH */
- case 'B':
- Confusion = 50;
- break;
- case 'D':
- Fire_resistance |= INTRINSIC;
- break;
- case 'E':
- Telepat |= INTRINSIC;
- break;
- case 'F':
- case 'Y':
- Cold_resistance |= INTRINSIC;
- break;
- case 'k':
- case 's':
- Poison_resistance |= INTRINSIC;
- break;
- case 'c':
- pline("You turn to stone.");
- killer = "dead cockatrice";
- done("died");
- /* NOTREACHED */
- case 'a':
- if(Stoned) {
- pline("What a pity - you just destroyed a future piece of art!");
- tp++;
- Stoned = 0;
- }
- break;
- case 'M':
- pline("You cannot resist the temptation to mimic a treasure chest.");
- tp++;
- nomul(-30);
- afternmv = Meatdone;
- nomovemsg = "You now again prefer mimicking a human.";
- u.usym = '$';
- prme();
- break;
- }
- return(tp);
-}
diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c
deleted file mode 100644
index e839ae1..0000000
--- a/games/hack/hack.end.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.end.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-#include <signal.h>
-#define Sprintf (void) sprintf
-extern char plname[], pl_character[];
-extern char *itoa(), *ordin(), *eos();
-
-xchar maxdlevel = 1;
-
-void
-done1()
-{
- (void) signal(SIGINT,SIG_IGN);
- pline("Really quit?");
- if(readchar() != 'y') {
- (void) signal(SIGINT,done1);
- clrlin();
- (void) fflush(stdout);
- if(multi > 0) nomul(0);
- return;
- }
- done("quit");
- /* NOTREACHED */
-}
-
-int done_stopprint;
-int done_hup;
-
-void
-done_intr(){
- done_stopprint++;
- (void) signal(SIGINT, SIG_IGN);
- (void) signal(SIGQUIT, SIG_IGN);
-}
-
-void
-done_hangup(){
- done_hup++;
- (void) signal(SIGHUP, SIG_IGN);
- done_intr();
-}
-
-done_in_by(mtmp) struct monst *mtmp; {
-static char buf[BUFSZ];
- pline("You die ...");
- if(mtmp->data->mlet == ' '){
- Sprintf(buf, "the ghost of %s", (char *) mtmp->mextra);
- killer = buf;
- } else if(mtmp->mnamelth) {
- Sprintf(buf, "%s called %s",
- mtmp->data->mname, NAME(mtmp));
- killer = buf;
- } else if(mtmp->minvis) {
- Sprintf(buf, "invisible %s", mtmp->data->mname);
- killer = buf;
- } else killer = mtmp->data->mname;
- done("died");
-}
-
-/* called with arg "died", "drowned", "escaped", "quit", "choked", "panicked",
- "burned", "starved" or "tricked" */
-/* Be careful not to call panic from here! */
-done(st1)
-char *st1;
-{
-
-#ifdef WIZARD
- if(wizard && *st1 == 'd'){
- u.uswldtim = 0;
- if(u.uhpmax < 0) u.uhpmax = 100; /* arbitrary */
- u.uhp = u.uhpmax;
- pline("For some reason you are still alive.");
- flags.move = 0;
- if(multi > 0) multi = 0; else multi = -1;
- flags.botl = 1;
- return;
- }
-#endif /* WIZARD */
- (void) signal(SIGINT, done_intr);
- (void) signal(SIGQUIT, done_intr);
- (void) signal(SIGHUP, done_hangup);
- if(*st1 == 'q' && u.uhp < 1){
- st1 = "died";
- killer = "quit while already on Charon's boat";
- }
- if(*st1 == 's') killer = "starvation"; else
- if(*st1 == 'd' && st1[1] == 'r') killer = "drowning"; else
- if(*st1 == 'p') killer = "panic"; else
- if(*st1 == 't') killer = "trickery"; else
- if(!index("bcd", *st1)) killer = st1;
- paybill();
- clearlocks();
- if(flags.toplin == 1) more();
- if(index("bcds", *st1)){
-#ifdef WIZARD
- if(!wizard)
-#endif /* WIZARD */
- savebones();
- if(!flags.notombstone)
- outrip();
- }
- if(*st1 == 'c') killer = st1; /* after outrip() */
- settty((char *) 0); /* does a clear_screen() */
- if(!done_stopprint)
- printf("Goodbye %s %s...\n\n", pl_character, plname);
- { long int tmp;
- tmp = u.ugold - u.ugold0;
- if(tmp < 0)
- tmp = 0;
- if(*st1 == 'd' || *st1 == 'b')
- tmp -= tmp/10;
- u.urexp += tmp;
- u.urexp += 50 * maxdlevel;
- if(maxdlevel > 20)
- u.urexp += 1000*((maxdlevel > 30) ? 10 : maxdlevel - 20);
- }
- if(*st1 == 'e') {
- extern struct monst *mydogs;
- struct monst *mtmp;
- struct obj *otmp;
- int i;
- unsigned worthlessct = 0;
- boolean has_amulet = FALSE;
-
- killer = st1;
- keepdogs();
- mtmp = mydogs;
- if(mtmp) {
- if(!done_stopprint) printf("You");
- while(mtmp) {
- if(!done_stopprint)
- printf(" and %s", monnam(mtmp));
- if(mtmp->mtame)
- u.urexp += mtmp->mhp;
- mtmp = mtmp->nmon;
- }
- if(!done_stopprint)
- printf("\nescaped from the dungeon with %ld points,\n",
- u.urexp);
- } else
- if(!done_stopprint)
- printf("You escaped from the dungeon with %ld points,\n",
- u.urexp);
- for(otmp = invent; otmp; otmp = otmp->nobj) {
- if(otmp->olet == GEM_SYM){
- objects[otmp->otyp].oc_name_known = 1;
- i = otmp->quan*objects[otmp->otyp].g_val;
- if(i == 0) {
- worthlessct += otmp->quan;
- continue;
- }
- u.urexp += i;
- if(!done_stopprint)
- printf("\t%s (worth %d Zorkmids),\n",
- doname(otmp), i);
- } else if(otmp->olet == AMULET_SYM) {
- otmp->known = 1;
- i = (otmp->spe < 0) ? 2 : 5000;
- u.urexp += i;
- if(!done_stopprint)
- printf("\t%s (worth %d Zorkmids),\n",
- doname(otmp), i);
- if(otmp->spe >= 0) {
- has_amulet = TRUE;
- killer = "escaped (with amulet)";
- }
- }
- }
- if(worthlessct) if(!done_stopprint)
- printf("\t%u worthless piece%s of coloured glass,\n",
- worthlessct, plur(worthlessct));
- if(has_amulet) u.urexp *= 2;
- } else
- if(!done_stopprint)
- printf("You %s on dungeon level %d with %ld points,\n",
- st1, dlevel, u.urexp);
- if(!done_stopprint)
- printf("and %ld piece%s of gold, after %ld move%s.\n",
- u.ugold, plur(u.ugold), moves, plur(moves));
- if(!done_stopprint)
- printf("You were level %u with a maximum of %d hit points when you %s.\n",
- u.ulevel, u.uhpmax, st1);
- if(*st1 == 'e' && !done_stopprint){
- getret(); /* all those pieces of coloured glass ... */
- cls();
- }
-#ifdef WIZARD
- if(!wizard)
-#endif /* WIZARD */
- topten();
- if(done_stopprint) printf("\n\n");
- exit(0);
-}
-
-#define newttentry() (struct toptenentry *) alloc(sizeof(struct toptenentry))
-#define NAMSZ 8
-#define DTHSZ 40
-#define PERSMAX 1
-#define POINTSMIN 1 /* must be > 0 */
-#define ENTRYMAX 100 /* must be >= 10 */
-#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */
-struct toptenentry {
- struct toptenentry *tt_next;
- long int points;
- int level,maxlvl,hp,maxhp;
- int uid;
- char plchar;
- char sex;
- char name[NAMSZ+1];
- char death[DTHSZ+1];
- char date[7]; /* yymmdd */
-} *tt_head;
-
-topten(){
- int uid = getuid();
- int rank, rank0 = -1, rank1 = 0;
- int occ_cnt = PERSMAX;
- struct toptenentry *t0, *t1, *tprev;
- char *recfile = RECORD;
- char *reclock = "record_lock";
- int sleepct = 300;
- FILE *rfile;
- int flg = 0;
- extern char *getdate();
-#define HUP if(!done_hup)
- while(link(recfile, reclock) == -1) {
- HUP perror(reclock);
- if(!sleepct--) {
- HUP puts("I give up. Sorry.");
- HUP puts("Perhaps there is an old record_lock around?");
- return;
- }
- HUP printf("Waiting for access to record file. (%d)\n",
- sleepct);
- HUP (void) fflush(stdout);
- sleep(1);
- }
- if(!(rfile = fopen(recfile,"r"))){
- HUP puts("Cannot open record file!");
- goto unlock;
- }
- HUP (void) putchar('\n');
-
- /* create a new 'topten' entry */
- t0 = newttentry();
- t0->level = dlevel;
- t0->maxlvl = maxdlevel;
- t0->hp = u.uhp;
- t0->maxhp = u.uhpmax;
- t0->points = u.urexp;
- t0->plchar = pl_character[0];
- t0->sex = (flags.female ? 'F' : 'M');
- t0->uid = uid;
- (void) strncpy(t0->name, plname, NAMSZ);
- (t0->name)[NAMSZ] = 0;
- (void) strncpy(t0->death, killer, DTHSZ);
- (t0->death)[DTHSZ] = 0;
- (void) strcpy(t0->date, getdate());
-
- /* assure minimum number of points */
- if(t0->points < POINTSMIN)
- t0->points = 0;
-
- t1 = tt_head = newttentry();
- tprev = 0;
- /* rank0: -1 undefined, 0 not_on_list, n n_th on list */
- for(rank = 1; ; ) {
- if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]",
- t1->date, &t1->uid,
- &t1->level, &t1->maxlvl,
- &t1->hp, &t1->maxhp, &t1->points,
- &t1->plchar, &t1->sex, t1->name, t1->death) != 11
- || t1->points < POINTSMIN)
- t1->points = 0;
- if(rank0 < 0 && t1->points < t0->points) {
- rank0 = rank++;
- if(tprev == 0)
- tt_head = t0;
- else
- tprev->tt_next = t0;
- t0->tt_next = t1;
- occ_cnt--;
- flg++; /* ask for a rewrite */
- } else
- tprev = t1;
- if(t1->points == 0) break;
- if(
-#ifdef PERS_IS_UID
- t1->uid == t0->uid &&
-#else
- strncmp(t1->name, t0->name, NAMSZ) == 0 &&
-#endif /* PERS_IS_UID */
- t1->plchar == t0->plchar && --occ_cnt <= 0){
- if(rank0 < 0){
- rank0 = 0;
- rank1 = rank;
- HUP printf("You didn't beat your previous score of %ld points.\n\n",
- t1->points);
- }
- if(occ_cnt < 0){
- flg++;
- continue;
- }
- }
- if(rank <= ENTRYMAX){
- t1 = t1->tt_next = newttentry();
- rank++;
- }
- if(rank > ENTRYMAX){
- t1->points = 0;
- break;
- }
- }
- if(flg) { /* rewrite record file */
- (void) fclose(rfile);
- if(!(rfile = fopen(recfile,"w"))){
- HUP puts("Cannot write record file\n");
- goto unlock;
- }
-
- if(!done_stopprint) if(rank0 > 0){
- if(rank0 <= 10)
- puts("You made the top ten list!\n");
- else
- printf("You reached the %d%s place on the top %d list.\n\n",
- rank0, ordin(rank0), ENTRYMAX);
- }
- }
- if(rank0 == 0) rank0 = rank1;
- if(rank0 <= 0) rank0 = rank;
- if(!done_stopprint) outheader();
- t1 = tt_head;
- for(rank = 1; t1->points != 0; rank++, t1 = t1->tt_next) {
- if(flg) fprintf(rfile,"%6s %d %d %d %d %d %ld %c%c %s,%s\n",
- t1->date, t1->uid,
- t1->level, t1->maxlvl,
- t1->hp, t1->maxhp, t1->points,
- t1->plchar, t1->sex, t1->name, t1->death);
- if(done_stopprint) continue;
- if(rank > flags.end_top &&
- (rank < rank0-flags.end_around || rank > rank0+flags.end_around)
- && (!flags.end_own ||
-#ifdef PERS_IS_UID
- t1->uid != t0->uid ))
-#else
- strncmp(t1->name, t0->name, NAMSZ)))
-#endif /* PERS_IS_UID */
- continue;
- if(rank == rank0-flags.end_around &&
- rank0 > flags.end_top+flags.end_around+1 &&
- !flags.end_own)
- (void) putchar('\n');
- if(rank != rank0)
- (void) outentry(rank, t1, 0);
- else if(!rank1)
- (void) outentry(rank, t1, 1);
- else {
- int t0lth = outentry(0, t0, -1);
- int t1lth = outentry(rank, t1, t0lth);
- if(t1lth > t0lth) t0lth = t1lth;
- (void) outentry(0, t0, t0lth);
- }
- }
- if(rank0 >= rank) if(!done_stopprint)
- (void) outentry(0, t0, 1);
- (void) fclose(rfile);
-unlock:
- (void) unlink(reclock);
-}
-
-outheader() {
-char linebuf[BUFSZ];
-char *bp;
- (void) strcpy(linebuf, "Number Points Name");
- bp = eos(linebuf);
- while(bp < linebuf + COLNO - 9) *bp++ = ' ';
- (void) strcpy(bp, "Hp [max]");
- puts(linebuf);
-}
-
-/* so>0: standout line; so=0: ordinary line; so<0: no output, return lth */
-int
-outentry(rank,t1,so) struct toptenentry *t1; {
-boolean quit = FALSE, killed = FALSE, starv = FALSE;
-char linebuf[BUFSZ];
- linebuf[0] = 0;
- if(rank) Sprintf(eos(linebuf), "%3d", rank);
- else Sprintf(eos(linebuf), " ");
- Sprintf(eos(linebuf), " %6ld %8s", t1->points, t1->name);
- if(t1->plchar == 'X') Sprintf(eos(linebuf), " ");
- else Sprintf(eos(linebuf), "-%c ", t1->plchar);
- if(!strncmp("escaped", t1->death, 7)) {
- if(!strcmp(" (with amulet)", t1->death+7))
- Sprintf(eos(linebuf), "escaped the dungeon with amulet");
- else
- Sprintf(eos(linebuf), "escaped the dungeon [max level %d]",
- t1->maxlvl);
- } else {
- if(!strncmp(t1->death,"quit",4)) {
- quit = TRUE;
- if(t1->maxhp < 3*t1->hp && t1->maxlvl < 4)
- Sprintf(eos(linebuf), "cravenly gave up");
- else
- Sprintf(eos(linebuf), "quit");
- }
- else if(!strcmp(t1->death,"choked"))
- Sprintf(eos(linebuf), "choked on %s food",
- (t1->sex == 'F') ? "her" : "his");
- else if(!strncmp(t1->death,"starv",5))
- Sprintf(eos(linebuf), "starved to death"), starv = TRUE;
- else Sprintf(eos(linebuf), "was killed"), killed = TRUE;
- Sprintf(eos(linebuf), " on%s level %d",
- (killed || starv) ? "" : " dungeon", t1->level);
- if(t1->maxlvl != t1->level)
- Sprintf(eos(linebuf), " [max %d]", t1->maxlvl);
- if(quit && t1->death[4]) Sprintf(eos(linebuf), t1->death + 4);
- }
- if(killed) Sprintf(eos(linebuf), " by %s%s",
- (!strncmp(t1->death, "trick", 5) || !strncmp(t1->death, "the ", 4))
- ? "" :
- index(vowels,*t1->death) ? "an " : "a ",
- t1->death);
- Sprintf(eos(linebuf), ".");
- if(t1->maxhp) {
- char *bp = eos(linebuf);
- char hpbuf[10];
- int hppos;
- Sprintf(hpbuf, (t1->hp > 0) ? itoa(t1->hp) : "-");
- hppos = COLNO - 7 - strlen(hpbuf);
- if(bp <= linebuf + hppos) {
- while(bp < linebuf + hppos) *bp++ = ' ';
- (void) strcpy(bp, hpbuf);
- Sprintf(eos(bp), " [%d]", t1->maxhp);
- }
- }
- if(so == 0) puts(linebuf);
- else if(so > 0) {
- char *bp = eos(linebuf);
- if(so >= COLNO) so = COLNO-1;
- while(bp < linebuf + so) *bp++ = ' ';
- *bp = 0;
- standoutbeg();
- fputs(linebuf,stdout);
- standoutend();
- (void) putchar('\n');
- }
- return(strlen(linebuf));
-}
-
-char *
-itoa(a) int a; {
-static char buf[12];
- Sprintf(buf,"%d",a);
- return(buf);
-}
-
-char *
-ordin(n) int n; {
-int d = n%10;
- return((d==0 || d>3 || n/10==1) ? "th" : (d==1) ? "st" :
- (d==2) ? "nd" : "rd");
-}
-
-clearlocks(){
-int x;
- (void) signal(SIGHUP,SIG_IGN);
- for(x = maxdlevel; x >= 0; x--) {
- glo(x);
- (void) unlink(lock); /* not all levels need be present */
- }
-}
-
-#ifdef NOSAVEONHANGUP
-hangup()
-{
- (void) signal(SIGINT, SIG_IGN);
- clearlocks();
- exit(1);
-}
-#endif /* NOSAVEONHANGUP */
-
-char *
-eos(s)
-char *s;
-{
- while(*s) s++;
- return(s);
-}
-
-/* it is the callers responsibility to check that there is room for c */
-charcat(s,c) char *s, c; {
- while(*s) s++;
- *s++ = c;
- *s = 0;
-}
-
-/*
- * Called with args from main if argc >= 0. In this case, list scores as
- * requested. Otherwise, find scores for the current player (and list them
- * if argc == -1).
- */
-prscore(argc,argv) int argc; char **argv; {
- extern char *hname;
- char **players;
- int playerct;
- int rank;
- struct toptenentry *t1, *t2;
- char *recfile = RECORD;
- FILE *rfile;
- int flg = 0;
- int i;
-#ifdef nonsense
- long total_score = 0L;
- char totchars[10];
- int totcharct = 0;
-#endif /* nonsense */
- int outflg = (argc >= -1);
-#ifdef PERS_IS_UID
- int uid = -1;
-#else
- char *player0;
-#endif /* PERS_IS_UID */
-
- if(!(rfile = fopen(recfile,"r"))){
- puts("Cannot open record file!");
- return;
- }
-
- if(argc > 1 && !strncmp(argv[1], "-s", 2)){
- if(!argv[1][2]){
- argc--;
- argv++;
- } else if(!argv[1][3] && index("CFKSTWX", argv[1][2])) {
- argv[1]++;
- argv[1][0] = '-';
- } else argv[1] += 2;
- }
- if(argc <= 1){
-#ifdef PERS_IS_UID
- uid = getuid();
- playerct = 0;
-#else
- player0 = plname;
- if(!*player0)
- player0 = "hackplayer";
- playerct = 1;
- players = &player0;
-#endif /* PERS_IS_UID */
- } else {
- playerct = --argc;
- players = ++argv;
- }
- if(outflg) putchar('\n');
-
- t1 = tt_head = newttentry();
- for(rank = 1; ; rank++) {
- if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]",
- t1->date, &t1->uid,
- &t1->level, &t1->maxlvl,
- &t1->hp, &t1->maxhp, &t1->points,
- &t1->plchar, &t1->sex, t1->name, t1->death) != 11)
- t1->points = 0;
- if(t1->points == 0) break;
-#ifdef PERS_IS_UID
- if(!playerct && t1->uid == uid)
- flg++;
- else
-#endif /* PERS_IS_UID */
- for(i = 0; i < playerct; i++){
- if(strcmp(players[i], "all") == 0 ||
- strncmp(t1->name, players[i], NAMSZ) == 0 ||
- (players[i][0] == '-' &&
- players[i][1] == t1->plchar &&
- players[i][2] == 0) ||
- (digit(players[i][0]) && rank <= atoi(players[i])))
- flg++;
- }
- t1 = t1->tt_next = newttentry();
- }
- (void) fclose(rfile);
- if(!flg) {
- if(outflg) {
- printf("Cannot find any entries for ");
- if(playerct < 1) printf("you.\n");
- else {
- if(playerct > 1) printf("any of ");
- for(i=0; i<playerct; i++)
- printf("%s%s", players[i], (i<playerct-1)?", ":".\n");
- printf("Call is: %s -s [playernames]\n", hname);
- }
- }
- return;
- }
-
- if(outflg) outheader();
- t1 = tt_head;
- for(rank = 1; t1->points != 0; rank++, t1 = t2) {
- t2 = t1->tt_next;
-#ifdef PERS_IS_UID
- if(!playerct && t1->uid == uid)
- goto outwithit;
- else
-#endif /* PERS_IS_UID */
- for(i = 0; i < playerct; i++){
- if(strcmp(players[i], "all") == 0 ||
- strncmp(t1->name, players[i], NAMSZ) == 0 ||
- (players[i][0] == '-' &&
- players[i][1] == t1->plchar &&
- players[i][2] == 0) ||
- (digit(players[i][0]) && rank <= atoi(players[i]))){
- outwithit:
- if(outflg)
- (void) outentry(rank, t1, 0);
-#ifdef nonsense
- total_score += t1->points;
- if(totcharct < sizeof(totchars)-1)
- totchars[totcharct++] = t1->plchar;
-#endif /* nonsense */
- break;
- }
- }
- free((char *) t1);
- }
-#ifdef nonsense
- totchars[totcharct] = 0;
-
- /* We would like to determine whether he is experienced. However,
- the information collected here only tells about the scores/roles
- that got into the topten (top 100?). We should maintain a
- .hacklog or something in his home directory. */
- flags.beginner = (total_score < 6000);
- for(i=0; i<6; i++)
- if(!index(totchars, "CFKSTWX"[i])) {
- flags.beginner = 1;
- if(!pl_character[0]) pl_character[0] = "CFKSTWX"[i];
- break;
- }
-#endif /* nonsense */
-}
diff --git a/games/hack/hack.engrave.c b/games/hack/hack.engrave.c
deleted file mode 100644
index bc9ed84..0000000
--- a/games/hack/hack.engrave.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.engrave.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-extern char *nomovemsg;
-extern char nul[];
-extern struct obj zeroobj;
-struct engr {
- struct engr *nxt_engr;
- char *engr_txt;
- xchar engr_x, engr_y;
- unsigned engr_lth; /* for save & restore; not length of text */
- long engr_time; /* moment engraving was (will be) finished */
- xchar engr_type;
-#define DUST 1
-#define ENGRAVE 2
-#define BURN 3
-} *head_engr;
-
-struct engr *
-engr_at(x,y) xchar x,y; {
-struct engr *ep = head_engr;
- while(ep) {
- if(x == ep->engr_x && y == ep->engr_y)
- return(ep);
- ep = ep->nxt_engr;
- }
- return((struct engr *) 0);
-}
-
-sengr_at(s,x,y) char *s; xchar x,y; {
-struct engr *ep = engr_at(x,y);
-char *t;
-int n;
- if(ep && ep->engr_time <= moves) {
- t = ep->engr_txt;
-/*
- if(!strcmp(s,t)) return(1);
-*/
- n = strlen(s);
- while(*t) {
- if(!strncmp(s,t,n)) return(1);
- t++;
- }
- }
- return(0);
-}
-
-u_wipe_engr(cnt)
-int cnt;
-{
- if(!u.uswallow && !Levitation)
- wipe_engr_at(u.ux, u.uy, cnt);
-}
-
-wipe_engr_at(x,y,cnt) xchar x,y,cnt; {
-struct engr *ep = engr_at(x,y);
-int lth,pos;
-char ch;
- if(ep){
- if((ep->engr_type != DUST) || Levitation) {
- cnt = rn2(1 + 50/(cnt+1)) ? 0 : 1;
- }
- lth = strlen(ep->engr_txt);
- if(lth && cnt > 0 ) {
- while(cnt--) {
- pos = rn2(lth);
- if((ch = ep->engr_txt[pos]) == ' ')
- continue;
- ep->engr_txt[pos] = (ch != '?') ? '?' : ' ';
- }
- }
- while(lth && ep->engr_txt[lth-1] == ' ')
- ep->engr_txt[--lth] = 0;
- while(ep->engr_txt[0] == ' ')
- ep->engr_txt++;
- if(!ep->engr_txt[0]) del_engr(ep);
- }
-}
-
-read_engr_at(x,y) int x,y; {
-struct engr *ep = engr_at(x,y);
- if(ep && ep->engr_txt[0]) {
- switch(ep->engr_type) {
- case DUST:
- pline("Something is written here in the dust.");
- break;
- case ENGRAVE:
- pline("Something is engraved here on the floor.");
- break;
- case BURN:
- pline("Some text has been burned here in the floor.");
- break;
- default:
- impossible("Something is written in a very strange way.");
- }
- pline("You read: \"%s\".", ep->engr_txt);
- }
-}
-
-make_engr_at(x,y,s)
-int x,y;
-char *s;
-{
- struct engr *ep;
-
- if(ep = engr_at(x,y))
- del_engr(ep);
- ep = (struct engr *)
- alloc((unsigned)(sizeof(struct engr) + strlen(s) + 1));
- ep->nxt_engr = head_engr;
- head_engr = ep;
- ep->engr_x = x;
- ep->engr_y = y;
- ep->engr_txt = (char *)(ep + 1);
- (void) strcpy(ep->engr_txt, s);
- ep->engr_time = 0;
- ep->engr_type = DUST;
- ep->engr_lth = strlen(s) + 1;
-}
-
-doengrave(){
-int len;
-char *sp;
-struct engr *ep, *oep = engr_at(u.ux,u.uy);
-char buf[BUFSZ];
-xchar type;
-int spct; /* number of leading spaces */
-struct obj *otmp;
- multi = 0;
-
- if(u.uswallow) {
- pline("You're joking. Hahaha!"); /* riv05!a3 */
- return(0);
- }
-
- /* one may write with finger, weapon or wand */
- otmp = getobj("#-)/", "write with");
- if(!otmp) return(0);
-
- if(otmp == &zeroobj)
- otmp = 0;
- if(otmp && otmp->otyp == WAN_FIRE && otmp->spe) {
- type = BURN;
- otmp->spe--;
- } else {
- /* first wield otmp */
- if(otmp != uwep) {
- if(uwep && uwep->cursed) {
- /* Andreas Bormann */
- pline("Since your weapon is welded to your hand,");
- pline("you use the %s.", aobjnam(uwep, (char *) 0));
- otmp = uwep;
- } else {
- if(!otmp)
- pline("You are now empty-handed.");
- else if(otmp->cursed)
- pline("The %s %s to your hand!",
- aobjnam(otmp, "weld"),
- (otmp->quan == 1) ? "itself" : "themselves");
- else
- pline("You now wield %s.", doname(otmp));
- setuwep(otmp);
- }
- }
-
- if(!otmp)
- type = DUST;
- else
- if(otmp->otyp == DAGGER || otmp->otyp == TWO_HANDED_SWORD ||
- otmp->otyp == CRYSKNIFE ||
- otmp->otyp == LONG_SWORD || otmp->otyp == AXE) {
- type = ENGRAVE;
- if((int)otmp->spe <= -3) {
- type = DUST;
- pline("Your %s too dull for engraving.",
- aobjnam(otmp, "are"));
- if(oep && oep->engr_type != DUST) return(1);
- }
- } else type = DUST;
- }
- if(Levitation && type != BURN){ /* riv05!a3 */
- pline("You can't reach the floor!");
- return(1);
- }
- if(oep && oep->engr_type == DUST){
- pline("You wipe out the message that was written here.");
- del_engr(oep);
- oep = 0;
- }
- if(type == DUST && oep){
- pline("You cannot wipe out the message that is %s in the rock.",
- (oep->engr_type == BURN) ? "burned" : "engraved");
- return(1);
- }
-
- pline("What do you want to %s on the floor here? ",
- (type == ENGRAVE) ? "engrave" : (type == BURN) ? "burn" : "write");
- getlin(buf);
- clrlin();
- spct = 0;
- sp = buf;
- while(*sp == ' ') spct++, sp++;
- len = strlen(sp);
- if(!len || *buf == '\033') {
- if(type == BURN) otmp->spe++;
- return(0);
- }
-
- switch(type) {
- case DUST:
- case BURN:
- if(len > 15) {
- multi = -(len/10);
- nomovemsg = "You finished writing.";
- }
- break;
- case ENGRAVE: /* here otmp != 0 */
- { int len2 = (otmp->spe + 3) * 2 + 1;
-
- pline("Your %s dull.", aobjnam(otmp, "get"));
- if(len2 < len) {
- len = len2;
- sp[len] = 0;
- otmp->spe = -3;
- nomovemsg = "You cannot engrave more.";
- } else {
- otmp->spe -= len/2;
- nomovemsg = "You finished engraving.";
- }
- multi = -len;
- }
- break;
- }
- if(oep) len += strlen(oep->engr_txt) + spct;
- ep = (struct engr *) alloc((unsigned)(sizeof(struct engr) + len + 1));
- ep->nxt_engr = head_engr;
- head_engr = ep;
- ep->engr_x = u.ux;
- ep->engr_y = u.uy;
- sp = (char *)(ep + 1); /* (char *)ep + sizeof(struct engr) */
- ep->engr_txt = sp;
- if(oep) {
- (void) strcpy(sp, oep->engr_txt);
- (void) strcat(sp, buf);
- del_engr(oep);
- } else
- (void) strcpy(sp, buf);
- ep->engr_lth = len+1;
- ep->engr_type = type;
- ep->engr_time = moves-multi;
-
- /* kludge to protect pline against excessively long texts */
- if(len > BUFSZ-20) sp[BUFSZ-20] = 0;
-
- return(1);
-}
-
-save_engravings(fd) int fd; {
-struct engr *ep = head_engr;
- while(ep) {
- if(!ep->engr_lth || !ep->engr_txt[0]){
- ep = ep->nxt_engr;
- continue;
- }
- bwrite(fd, (char *) & (ep->engr_lth), sizeof(ep->engr_lth));
- bwrite(fd, (char *) ep, sizeof(struct engr) + ep->engr_lth);
- ep = ep->nxt_engr;
- }
- bwrite(fd, (char *) nul, sizeof(unsigned));
- head_engr = 0;
-}
-
-rest_engravings(fd) int fd; {
-struct engr *ep;
-unsigned lth;
- head_engr = 0;
- while(1) {
- mread(fd, (char *) &lth, sizeof(unsigned));
- if(lth == 0) return;
- ep = (struct engr *) alloc(sizeof(struct engr) + lth);
- mread(fd, (char *) ep, sizeof(struct engr) + lth);
- ep->nxt_engr = head_engr;
- ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */
- head_engr = ep;
- }
-}
-
-del_engr(ep) struct engr *ep; {
-struct engr *ept;
- if(ep == head_engr)
- head_engr = ep->nxt_engr;
- else {
- for(ept = head_engr; ept; ept = ept->nxt_engr) {
- if(ept->nxt_engr == ep) {
- ept->nxt_engr = ep->nxt_engr;
- goto fnd;
- }
- }
- impossible("Error in del_engr?");
- return;
- fnd: ;
- }
- free((char *) ep);
-}
diff --git a/games/hack/hack.fight.c b/games/hack/hack.fight.c
deleted file mode 100644
index 532cb9e..0000000
--- a/games/hack/hack.fight.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.fight.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern struct permonst li_dog, dog, la_dog;
-extern char *exclam(), *xname();
-extern struct obj *mkobj_at();
-
-static boolean far_noise;
-static long noisetime;
-
-/* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */
-hitmm(magr,mdef) struct monst *magr,*mdef; {
-struct permonst *pa = magr->data, *pd = mdef->data;
-int hit;
-schar tmp;
-boolean vis;
- if(index("Eauy", pa->mlet)) return(0);
- if(magr->mfroz) return(0); /* riv05!a3 */
- tmp = pd->ac + pa->mlevel;
- if(mdef->mconf || mdef->mfroz || mdef->msleep){
- tmp += 4;
- if(mdef->msleep) mdef->msleep = 0;
- }
- hit = (tmp > rnd(20));
- if(hit) mdef->msleep = 0;
- vis = (cansee(magr->mx,magr->my) && cansee(mdef->mx,mdef->my));
- if(vis){
- char buf[BUFSZ];
- if(mdef->mimic) seemimic(mdef);
- if(magr->mimic) seemimic(magr);
- (void) sprintf(buf,"%s %s", Monnam(magr),
- hit ? "hits" : "misses");
- pline("%s %s.", buf, monnam(mdef));
- } else {
- boolean far = (dist(magr->mx, magr->my) > 15);
- if(far != far_noise || moves-noisetime > 10) {
- far_noise = far;
- noisetime = moves;
- pline("You hear some noises%s.",
- far ? " in the distance" : "");
- }
- }
- if(hit){
- if(magr->data->mlet == 'c' && !magr->cham) {
- magr->mhpmax += 3;
- if(vis) pline("%s is turned to stone!", Monnam(mdef));
- else if(mdef->mtame)
- pline("You have a peculiarly sad feeling for a moment, then it passes.");
- monstone(mdef);
- hit = 2;
- } else
- if((mdef->mhp -= d(pa->damn,pa->damd)) < 1) {
- magr->mhpmax += 1 + rn2(pd->mlevel+1);
- if(magr->mtame && magr->mhpmax > 8*pa->mlevel){
- if(pa == &li_dog) magr->data = pa = &dog;
- else if(pa == &dog) magr->data = pa = &la_dog;
- }
- if(vis) pline("%s is killed!", Monnam(mdef));
- else if(mdef->mtame)
- pline("You have a sad feeling for a moment, then it passes.");
- mondied(mdef);
- hit = 2;
- }
- }
- return(hit);
-}
-
-/* drop (perhaps) a cadaver and remove monster */
-mondied(mdef) struct monst *mdef; {
-struct permonst *pd = mdef->data;
- if(letter(pd->mlet) && rn2(3)){
- (void) mkobj_at(pd->mlet,mdef->mx,mdef->my);
- if(cansee(mdef->mx,mdef->my)){
- unpmon(mdef);
- atl(mdef->mx,mdef->my,fobj->olet);
- }
- stackobj(fobj);
- }
- mondead(mdef);
-}
-
-/* drop a rock and remove monster */
-monstone(mdef) struct monst *mdef; {
- extern char mlarge[];
- if(index(mlarge, mdef->data->mlet))
- mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my);
- else
- mksobj_at(ROCK, mdef->mx, mdef->my);
- if(cansee(mdef->mx, mdef->my)){
- unpmon(mdef);
- atl(mdef->mx,mdef->my,fobj->olet);
- }
- mondead(mdef);
-}
-
-
-fightm(mtmp) struct monst *mtmp; {
-struct monst *mon;
- for(mon = fmon; mon; mon = mon->nmon) if(mon != mtmp) {
- if(DIST(mon->mx,mon->my,mtmp->mx,mtmp->my) < 3)
- if(rn2(4))
- return(hitmm(mtmp,mon));
- }
- return(-1);
-}
-
-/* u is hit by sth, but not a monster */
-thitu(tlev,dam,name)
-int tlev,dam;
-char *name;
-{
-char buf[BUFSZ];
- setan(name,buf);
- if(u.uac + tlev <= rnd(20)) {
- if(Blind) pline("It misses.");
- else pline("You are almost hit by %s!", buf);
- return(0);
- } else {
- if(Blind) pline("You are hit!");
- else pline("You are hit by %s!", buf);
- losehp(dam,name);
- return(1);
- }
-}
-
-char mlarge[] = "bCDdegIlmnoPSsTUwY',&";
-
-boolean
-hmon(mon,obj,thrown) /* return TRUE if mon still alive */
-struct monst *mon;
-struct obj *obj;
-int thrown;
-{
- int tmp;
- boolean hittxt = FALSE;
-
- if(!obj){
- tmp = rnd(2); /* attack with bare hands */
- if(mon->data->mlet == 'c' && !uarmg){
- pline("You hit the cockatrice with your bare hands.");
- pline("You turn to stone ...");
- done_in_by(mon);
- }
- } else if(obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE) {
- if(obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG))
- tmp = rnd(2);
- else {
- if(index(mlarge, mon->data->mlet)) {
- tmp = rnd(objects[obj->otyp].wldam);
- if(obj->otyp == TWO_HANDED_SWORD) tmp += d(2,6);
- else if(obj->otyp == FLAIL) tmp += rnd(4);
- } else {
- tmp = rnd(objects[obj->otyp].wsdam);
- }
- tmp += obj->spe;
- if(!thrown && obj == uwep && obj->otyp == BOOMERANG
- && !rn2(3)){
- pline("As you hit %s, the boomerang breaks into splinters.",
- monnam(mon));
- freeinv(obj);
- setworn((struct obj *) 0, obj->owornmask);
- obfree(obj, (struct obj *) 0);
- tmp++;
- }
- }
- if(mon->data->mlet == 'O' && obj->otyp == TWO_HANDED_SWORD &&
- !strcmp(ONAME(obj), "Orcrist"))
- tmp += rnd(10);
- } else switch(obj->otyp) {
- case HEAVY_IRON_BALL:
- tmp = rnd(25); break;
- case EXPENSIVE_CAMERA:
- pline("You succeed in destroying your camera. Congratulations!");
- freeinv(obj);
- if(obj->owornmask)
- setworn((struct obj *) 0, obj->owornmask);
- obfree(obj, (struct obj *) 0);
- return(TRUE);
- case DEAD_COCKATRICE:
- pline("You hit %s with the cockatrice corpse.",
- monnam(mon));
- if(mon->data->mlet == 'c') {
- tmp = 1;
- hittxt = TRUE;
- break;
- }
- pline("%s is turned to stone!", Monnam(mon));
- killed(mon);
- return(FALSE);
- case CLOVE_OF_GARLIC: /* no effect against demons */
- if(index(UNDEAD, mon->data->mlet))
- mon->mflee = 1;
- tmp = 1;
- break;
- default:
- /* non-weapons can damage because of their weight */
- /* (but not too much) */
- tmp = obj->owt/10;
- if(tmp < 1) tmp = 1;
- else tmp = rnd(tmp);
- if(tmp > 6) tmp = 6;
- }
-
- /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG) */
-
- tmp += u.udaminc + dbon();
- if(u.uswallow) {
- if((tmp -= u.uswldtim) <= 0) {
- pline("Your arms are no longer able to hit.");
- return(TRUE);
- }
- }
- if(tmp < 1) tmp = 1;
- mon->mhp -= tmp;
- if(mon->mhp < 1) {
- killed(mon);
- return(FALSE);
- }
- if(mon->mtame && (!mon->mflee || mon->mfleetim)) {
- mon->mflee = 1; /* Rick Richardson */
- mon->mfleetim += 10*rnd(tmp);
- }
-
- if(!hittxt) {
- if(thrown)
- /* this assumes that we cannot throw plural things */
- hit( xname(obj) /* or: objects[obj->otyp].oc_name */,
- mon, exclam(tmp) );
- else if(Blind)
- pline("You hit it.");
- else
- pline("You hit %s%s", monnam(mon), exclam(tmp));
- }
-
- if(u.umconf && !thrown) {
- if(!Blind) {
- pline("Your hands stop glowing blue.");
- if(!mon->mfroz && !mon->msleep)
- pline("%s appears confused.",Monnam(mon));
- }
- mon->mconf = 1;
- u.umconf = 0;
- }
- return(TRUE); /* mon still alive */
-}
-
-/* try to attack; return FALSE if monster evaded */
-/* u.dx and u.dy must be set */
-attack(mtmp)
-struct monst *mtmp;
-{
- schar tmp;
- boolean malive = TRUE;
- struct permonst *mdat;
- mdat = mtmp->data;
-
- u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe attacks */
-
- if(mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep &&
- !mtmp->mconf && mtmp->mcansee && !rn2(7) &&
- (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */
- mtmp->mx != u.ux+u.dx || mtmp->my != u.uy+u.dy))
- return(FALSE);
-
- if(mtmp->mimic){
- if(!u.ustuck && !mtmp->mflee) u.ustuck = mtmp;
- switch(levl[u.ux+u.dx][u.uy+u.dy].scrsym){
- case '+':
- pline("The door actually was a Mimic.");
- break;
- case '$':
- pline("The chest was a Mimic!");
- break;
- default:
- pline("Wait! That's a Mimic!");
- }
- wakeup(mtmp); /* clears mtmp->mimic */
- return(TRUE);
- }
-
- wakeup(mtmp);
-
- if(mtmp->mhide && mtmp->mundetected){
- struct obj *obj;
-
- mtmp->mundetected = 0;
- if((obj = o_at(mtmp->mx,mtmp->my)) && !Blind)
- pline("Wait! There's a %s hiding under %s!",
- mdat->mname, doname(obj));
- return(TRUE);
- }
-
- tmp = u.uluck + u.ulevel + mdat->ac + abon();
- if(uwep) {
- if(uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE)
- tmp += uwep->spe;
- if(uwep->otyp == TWO_HANDED_SWORD) tmp -= 1;
- else if(uwep->otyp == DAGGER) tmp += 2;
- else if(uwep->otyp == CRYSKNIFE) tmp += 3;
- else if(uwep->otyp == SPEAR &&
- index("XDne", mdat->mlet)) tmp += 2;
- }
- if(mtmp->msleep) {
- mtmp->msleep = 0;
- tmp += 2;
- }
- if(mtmp->mfroz) {
- tmp += 4;
- if(!rn2(10)) mtmp->mfroz = 0;
- }
- if(mtmp->mflee) tmp += 2;
- if(u.utrap) tmp -= 3;
-
- /* with a lot of luggage, your agility diminishes */
- tmp -= (inv_weight() + 40)/20;
-
- if(tmp <= rnd(20) && !u.uswallow){
- if(Blind) pline("You miss it.");
- else pline("You miss %s.",monnam(mtmp));
- } else {
- /* we hit the monster; be careful: it might die! */
-
- if((malive = hmon(mtmp,uwep,0)) == TRUE) {
- /* monster still alive */
- if(!rn2(25) && mtmp->mhp < mtmp->mhpmax/2) {
- mtmp->mflee = 1;
- if(!rn2(3)) mtmp->mfleetim = rnd(100);
- if(u.ustuck == mtmp && !u.uswallow)
- u.ustuck = 0;
- }
-#ifndef NOWORM
- if(mtmp->wormno)
- cutworm(mtmp, u.ux+u.dx, u.uy+u.dy,
- uwep ? uwep->otyp : 0);
-#endif /* NOWORM */
- }
- if(mdat->mlet == 'a') {
- if(rn2(2)) {
- pline("You are splashed by the blob's acid!");
- losehp_m(rnd(6), mtmp);
- if(!rn2(30)) corrode_armor();
- }
- if(!rn2(6)) corrode_weapon();
- }
- }
- if(malive && mdat->mlet == 'E' && canseemon(mtmp)
- && !mtmp->mcan && rn2(3)) {
- if(mtmp->mcansee) {
- pline("You are frozen by the floating eye's gaze!");
- nomul((u.ulevel > 6 || rn2(4)) ? rn1(20,-21) : -200);
- } else {
- pline("The blinded floating eye cannot defend itself.");
- if(!rn2(500)) if((int)u.uluck > LUCKMIN) u.uluck--;
- }
- }
- return(TRUE);
-}
diff --git a/games/hack/hack.fix b/games/hack/hack.fix
deleted file mode 100644
index 01e6460..0000000
--- a/games/hack/hack.fix
+++ /dev/null
@@ -1,113 +0,0 @@
-/***** unido:net.games.hack / ab / 7:23 pm Sep 13, 1985*/
-
-Recently hack (1.0.3) crashed with core dumps during some good games.
-The crashes occured in the onbill-routine. After investigating the core
-dump I found that the shopkeeper's bill was still to be paid. Normaly
-if you leave a shop the bill will be cleared and onbill() would not
-check it. But under certain conditions you can leave a shop without
-clearing the bill. The conditions are:
-
- 1. You have to rob a shop in order to make the shopkeeper
- follow you.
-
- 2. After leaving the shop being followed by the shopkeeper
- you must return to the shop...
-
- 3. ...and then leave the unguarded shop again.
- - The shopkeeper mustn't be present!
-
-If you climb the stairs to the previous level, chances are that your
-bill now contains much more items than allowed. If so the next call to
-onbill() will dump the core.
-
-Following is a context diff to fix the bug. Actually just the last hunk
-does the fix [it deletes two lines which have been inserted in 1.0.3],
-but I think the other fix was intended by the now deleted lines.
-
- Andreas
-
---
-Andreas Bormann ab@unido.UUCP
-University of Dortmund N 51 29' 05" E 07 24' 42"
-West Germany
-
------- the diff follows:
-
-*** hack.shk.c.orig Sun Aug 4 12:07:51 1985
---- hack.shk.c Fri Sep 13 14:29:52 1985
-***************
-*** 133,139
- /* Did we just leave a shop? */
- if(u.uinshop &&
- (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
-- u.uinshop = 0;
- if(shopkeeper) {
- if(ESHK(shopkeeper)->billct) {
- pline("Somehow you escaped the shop without paying!");
-
---- 133,138 -----
- /* Did we just leave a shop? */
- if(u.uinshop &&
- (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
- if(shopkeeper) {
- if(ESHK(shopkeeper)->billct) {
- if(inroom(shopkeeper->mx, shopkeeper->my)
-***************
-*** 136,142
- u.uinshop = 0;
- if(shopkeeper) {
- if(ESHK(shopkeeper)->billct) {
-! pline("Somehow you escaped the shop without paying!");
- addupbill();
- pline("You stole for a total worth of %ld zorkmids.",
- total);
-
---- 135,143 -----
- (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
- if(shopkeeper) {
- if(ESHK(shopkeeper)->billct) {
-! if(inroom(shopkeeper->mx, shopkeeper->my)
-! == u.uinshop - 1) /* ab@unido */
-! pline("Somehow you escaped the shop without paying!");
- addupbill();
- pline("You stole for a total worth of %ld zorkmids.",
- total);
-***************
-*** 149,154
- shopkeeper = 0;
- shlevel = 0;
- }
- }
-
- /* Did we just enter a zoo of some kind? */
-
---- 150,156 -----
- shopkeeper = 0;
- shlevel = 0;
- }
-+ u.uinshop = 0;
- }
-
- /* Did we just enter a zoo of some kind? */
-***************
-*** 183,190
- findshk(roomno);
- if(!shopkeeper) {
- rooms[roomno].rtype = 0;
-- u.uinshop = 0;
-- } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) {
- u.uinshop = 0;
- } else if(!u.uinshop){
- if(!ESHK(shopkeeper)->visitct ||
-
---- 185,190 -----
- findshk(roomno);
- if(!shopkeeper) {
- rooms[roomno].rtype = 0;
- u.uinshop = 0;
- } else if(!u.uinshop){
- if(!ESHK(shopkeeper)->visitct ||
-/* ---------- */
-
-
-
diff --git a/games/hack/hack.h b/games/hack/hack.h
deleted file mode 100644
index a9cc347..0000000
--- a/games/hack/hack.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.h - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "config.h"
-#include <string.h>
-
-#ifndef BSD
-#define index strchr
-#define rindex strrchr
-#endif /* BSD */
-
-#define Null(type) ((struct type *) 0)
-
-#include "def.objclass.h"
-
-typedef struct {
- xchar x,y;
-} coord;
-
-#include "def.monst.h" /* uses coord */
-#include "def.gold.h"
-#include "def.trap.h"
-#include "def.obj.h"
-#include "def.flag.h"
-
-#define plur(x) (((x) == 1) ? "" : "s")
-
-#define BUFSZ 256 /* for getlin buffers */
-#define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
-
-#include "def.rm.h"
-#include "def.permonst.h"
-
-extern long *alloc();
-
-extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
-
-extern xchar dlevel;
-#define newstring(x) (char *) alloc((unsigned)(x))
-#include "hack.onames.h"
-
-#define ON 1
-#define OFF 0
-
-extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg,
- *uleft, *uright, *fcobj;
-extern struct obj *uchain; /* defined iff PUNISHED */
-extern struct obj *uball; /* defined if PUNISHED */
-struct obj *o_at(), *getobj(), *sobj_at();
-
-struct prop {
-#define TIMEOUT 007777 /* mask */
-#define LEFT_RING W_RINGL /* 010000L */
-#define RIGHT_RING W_RINGR /* 020000L */
-#define INTRINSIC 040000L
-#define LEFT_SIDE LEFT_RING
-#define RIGHT_SIDE RIGHT_RING
-#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
- long p_flgs;
- int (*p_tofn)(); /* called after timeout */
-};
-
-struct you {
- xchar ux, uy;
- schar dx, dy, dz; /* direction of move (or zap or ... ) */
-#ifdef QUEST
- schar di; /* direction of FF */
- xchar ux0, uy0; /* initial position FF */
-#endif /* QUEST */
- xchar udisx, udisy; /* last display pos */
- char usym; /* usually '@' */
- schar uluck;
-#define LUCKMAX 10 /* on moonlit nights 11 */
-#define LUCKMIN (-10)
- int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */
- /* +: turn right, -: turn left */
- unsigned udispl:1; /* @ on display */
- unsigned ulevel:4; /* 1 - 14 */
-#ifdef QUEST
- unsigned uhorizon:7;
-#endif /* QUEST */
- unsigned utrap:3; /* trap timeout */
- unsigned utraptype:1; /* defined if utrap nonzero */
-#define TT_BEARTRAP 0
-#define TT_PIT 1
- unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */
-
-
-/* perhaps these #define's should also be generated by makedefs */
-#define TELEPAT LAST_RING /* not a ring */
-#define Telepat u.uprops[TELEPAT].p_flgs
-#define FAST (LAST_RING+1) /* not a ring */
-#define Fast u.uprops[FAST].p_flgs
-#define CONFUSION (LAST_RING+2) /* not a ring */
-#define Confusion u.uprops[CONFUSION].p_flgs
-#define INVIS (LAST_RING+3) /* not a ring */
-#define Invis u.uprops[INVIS].p_flgs
-#define Invisible (Invis && !See_invisible)
-#define GLIB (LAST_RING+4) /* not a ring */
-#define Glib u.uprops[GLIB].p_flgs
-#define PUNISHED (LAST_RING+5) /* not a ring */
-#define Punished u.uprops[PUNISHED].p_flgs
-#define SICK (LAST_RING+6) /* not a ring */
-#define Sick u.uprops[SICK].p_flgs
-#define BLIND (LAST_RING+7) /* not a ring */
-#define Blind u.uprops[BLIND].p_flgs
-#define WOUNDED_LEGS (LAST_RING+8) /* not a ring */
-#define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs
-#define STONED (LAST_RING+9) /* not a ring */
-#define Stoned u.uprops[STONED].p_flgs
-#define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
- unsigned umconf:1;
- char *usick_cause;
- struct prop uprops[LAST_RING+10];
-
- unsigned uswallow:1; /* set if swallowed by a monster */
- unsigned uswldtim:4; /* time you have been swallowed */
- unsigned uhs:3; /* hunger state - see hack.eat.c */
- schar ustr,ustrmax;
- schar udaminc;
- schar uac;
- int uhp,uhpmax;
- long int ugold,ugold0,uexp,urexp;
- int uhunger; /* refd only in eat.c and shk.c */
- int uinvault;
- struct monst *ustuck;
- int nr_killed[CMNUM+2]; /* used for experience bookkeeping */
-};
-
-extern struct you u;
-
-extern char *traps[];
-extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(),
- *doname(), *aobjnam();
-extern char readchar();
-extern char vowels[];
-
-extern xchar curx,cury; /* cursor location on screen */
-
-extern coord bhitpos; /* place where thrown weapon falls to the ground */
-
-extern xchar seehx,seelx,seehy,seely; /* where to see*/
-extern char *save_cm,*killer;
-
-extern xchar dlevel, maxdlevel; /* dungeon level */
-
-extern long moves;
-
-extern int multi;
-
-
-extern char lock[];
-
-
-#define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
-
-#define PL_CSIZ 20 /* sizeof pl_character */
-#define MAX_CARR_CAP 120 /* so that boulders can be heavier */
-#define MAXLEVEL 40
-#define FAR (COLNO+2) /* position outside screen */
diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c
deleted file mode 100644
index f261034..0000000
--- a/games/hack/hack.invent.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.invent.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-extern struct obj *splitobj();
-extern struct obj zeroobj;
-extern char morc;
-extern char quitchars[];
-static char *xprname();
-
-#ifndef NOWORM
-#include "def.wseg.h"
-extern struct wseg *wsegs[32];
-#endif /* NOWORM */
-
-#define NOINVSYM '#'
-
-static int lastinvnr = 51; /* 0 ... 51 */
-static
-assigninvlet(otmp)
-struct obj *otmp;
-{
- boolean inuse[52];
- int i;
- struct obj *obj;
-
- for(i = 0; i < 52; i++) inuse[i] = FALSE;
- for(obj = invent; obj; obj = obj->nobj) if(obj != otmp) {
- i = obj->invlet;
- if('a' <= i && i <= 'z') inuse[i - 'a'] = TRUE; else
- if('A' <= i && i <= 'Z') inuse[i - 'A' + 26] = TRUE;
- if(i == otmp->invlet) otmp->invlet = 0;
- }
- if((i = otmp->invlet) &&
- (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z')))
- return;
- for(i = lastinvnr+1; i != lastinvnr; i++) {
- if(i == 52) { i = -1; continue; }
- if(!inuse[i]) break;
- }
- otmp->invlet = (inuse[i] ? NOINVSYM :
- (i < 26) ? ('a'+i) : ('A'+i-26));
- lastinvnr = i;
-}
-
-struct obj *
-addinv(obj)
-struct obj *obj;
-{
- struct obj *otmp;
-
- /* merge or attach to end of chain */
- if(!invent) {
- invent = obj;
- otmp = 0;
- } else
- for(otmp = invent; /* otmp */; otmp = otmp->nobj) {
- if(merged(otmp, obj, 0))
- return(otmp);
- if(!otmp->nobj) {
- otmp->nobj = obj;
- break;
- }
- }
- obj->nobj = 0;
-
- if(flags.invlet_constant) {
- assigninvlet(obj);
- /*
- * The ordering of the chain is nowhere significant
- * so in case you prefer some other order than the
- * historical one, change the code below.
- */
- if(otmp) { /* find proper place in chain */
- otmp->nobj = 0;
- if((invent->invlet ^ 040) > (obj->invlet ^ 040)) {
- obj->nobj = invent;
- invent = obj;
- } else
- for(otmp = invent; ; otmp = otmp->nobj) {
- if(!otmp->nobj ||
- (otmp->nobj->invlet ^ 040) > (obj->invlet ^ 040)){
- obj->nobj = otmp->nobj;
- otmp->nobj = obj;
- break;
- }
- }
- }
- }
-
- return(obj);
-}
-
-useup(obj)
-struct obj *obj;
-{
- if(obj->quan > 1){
- obj->quan--;
- obj->owt = weight(obj);
- } else {
- setnotworn(obj);
- freeinv(obj);
- obfree(obj, (struct obj *) 0);
- }
-}
-
-freeinv(obj)
-struct obj *obj;
-{
- struct obj *otmp;
-
- if(obj == invent)
- invent = invent->nobj;
- else {
- for(otmp = invent; otmp->nobj != obj; otmp = otmp->nobj)
- if(!otmp->nobj) panic("freeinv");
- otmp->nobj = obj->nobj;
- }
-}
-
-/* destroy object in fobj chain (if unpaid, it remains on the bill) */
-delobj(obj) struct obj *obj; {
- freeobj(obj);
- unpobj(obj);
- obfree(obj, (struct obj *) 0);
-}
-
-/* unlink obj from chain starting with fobj */
-freeobj(obj) struct obj *obj; {
- struct obj *otmp;
-
- if(obj == fobj) fobj = fobj->nobj;
- else {
- for(otmp = fobj; otmp->nobj != obj; otmp = otmp->nobj)
- if(!otmp) panic("error in freeobj");
- otmp->nobj = obj->nobj;
- }
-}
-
-/* Note: freegold throws away its argument! */
-freegold(gold) struct gold *gold; {
- struct gold *gtmp;
-
- if(gold == fgold) fgold = gold->ngold;
- else {
- for(gtmp = fgold; gtmp->ngold != gold; gtmp = gtmp->ngold)
- if(!gtmp) panic("error in freegold");
- gtmp->ngold = gold->ngold;
- }
- free((char *) gold);
-}
-
-deltrap(trap)
-struct trap *trap;
-{
- struct trap *ttmp;
-
- if(trap == ftrap)
- ftrap = ftrap->ntrap;
- else {
- for(ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap) ;
- ttmp->ntrap = trap->ntrap;
- }
- free((char *) trap);
-}
-
-struct wseg *m_atseg;
-
-struct monst *
-m_at(x,y)
-int x,y;
-{
- struct monst *mtmp;
-#ifndef NOWORM
- struct wseg *wtmp;
-#endif /* NOWORM */
-
- m_atseg = 0;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
- if(mtmp->mx == x && mtmp->my == y)
- return(mtmp);
-#ifndef NOWORM
- if(mtmp->wormno){
- for(wtmp = wsegs[mtmp->wormno]; wtmp; wtmp = wtmp->nseg)
- if(wtmp->wx == x && wtmp->wy == y){
- m_atseg = wtmp;
- return(mtmp);
- }
- }
-#endif /* NOWORM */
- }
- return(0);
-}
-
-struct obj *
-o_at(x,y)
-int x,y;
-{
- struct obj *otmp;
-
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->ox == x && otmp->oy == y) return(otmp);
- return(0);
-}
-
-struct obj *
-sobj_at(n,x,y)
-int n,x,y;
-{
- struct obj *otmp;
-
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->ox == x && otmp->oy == y && otmp->otyp == n)
- return(otmp);
- return(0);
-}
-
-carried(obj) struct obj *obj; {
-struct obj *otmp;
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp == obj) return(1);
- return(0);
-}
-
-carrying(type)
-int type;
-{
- struct obj *otmp;
-
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp->otyp == type)
- return(TRUE);
- return(FALSE);
-}
-
-struct obj *
-o_on(id, objchn) unsigned int id; struct obj *objchn; {
- while(objchn) {
- if(objchn->o_id == id) return(objchn);
- objchn = objchn->nobj;
- }
- return((struct obj *) 0);
-}
-
-struct trap *
-t_at(x,y)
-int x,y;
-{
- struct trap *trap = ftrap;
- while(trap) {
- if(trap->tx == x && trap->ty == y) return(trap);
- trap = trap->ntrap;
- }
- return(0);
-}
-
-struct gold *
-g_at(x,y)
-int x,y;
-{
- struct gold *gold = fgold;
- while(gold) {
- if(gold->gx == x && gold->gy == y) return(gold);
- gold = gold->ngold;
- }
- return(0);
-}
-
-/* make dummy object structure containing gold - for temporary use only */
-struct obj *
-mkgoldobj(q)
-long q;
-{
- struct obj *otmp;
-
- otmp = newobj(0);
- /* should set o_id etc. but otmp will be freed soon */
- otmp->olet = '$';
- u.ugold -= q;
- OGOLD(otmp) = q;
- flags.botl = 1;
- return(otmp);
-}
-
-/*
- * getobj returns:
- * struct obj *xxx: object to do something with.
- * (struct obj *) 0 error return: no object.
- * &zeroobj explicitly no object (as in w-).
- */
-struct obj *
-getobj(let,word)
-char *let,*word;
-{
- struct obj *otmp;
- char ilet,ilet1,ilet2;
- char buf[BUFSZ];
- char lets[BUFSZ];
- int foo = 0, foo2;
- char *bp = buf;
- xchar allowcnt = 0; /* 0, 1 or 2 */
- boolean allowgold = FALSE;
- boolean allowall = FALSE;
- boolean allownone = FALSE;
- xchar foox = 0;
- long cnt;
-
- if(*let == '0') let++, allowcnt = 1;
- if(*let == '$') let++, allowgold = TRUE;
- if(*let == '#') let++, allowall = TRUE;
- if(*let == '-') let++, allownone = TRUE;
- if(allownone) *bp++ = '-';
- if(allowgold) *bp++ = '$';
- if(bp > buf && bp[-1] == '-') *bp++ = ' ';
-
- ilet = 'a';
- for(otmp = invent; otmp; otmp = otmp->nobj){
- if(!*let || index(let, otmp->olet)) {
- bp[foo++] = flags.invlet_constant ? otmp->invlet : ilet;
-
- /* ugly check: remove inappropriate things */
- if((!strcmp(word, "take off") &&
- !(otmp->owornmask & (W_ARMOR - W_ARM2)))
- || (!strcmp(word, "wear") &&
- (otmp->owornmask & (W_ARMOR | W_RING)))
- || (!strcmp(word, "wield") &&
- (otmp->owornmask & W_WEP))) {
- foo--;
- foox++;
- }
- }
- if(ilet == 'z') ilet = 'A'; else ilet++;
- }
- bp[foo] = 0;
- if(foo == 0 && bp > buf && bp[-1] == ' ') *--bp = 0;
- (void) strcpy(lets, bp); /* necessary since we destroy buf */
- if(foo > 5) { /* compactify string */
- foo = foo2 = 1;
- ilet2 = bp[0];
- ilet1 = bp[1];
- while(ilet = bp[++foo2] = bp[++foo]){
- if(ilet == ilet1+1){
- if(ilet1 == ilet2+1)
- bp[foo2 - 1] = ilet1 = '-';
- else if(ilet2 == '-') {
- bp[--foo2] = ++ilet1;
- continue;
- }
- }
- ilet2 = ilet1;
- ilet1 = ilet;
- }
- }
- if(!foo && !allowall && !allowgold && !allownone) {
- pline("You don't have anything %sto %s.",
- foox ? "else " : "", word);
- return(0);
- }
- for(;;) {
- if(!buf[0])
- pline("What do you want to %s [*]? ", word);
- else
- pline("What do you want to %s [%s or ?*]? ",
- word, buf);
-
- cnt = 0;
- ilet = readchar();
- while(digit(ilet) && allowcnt) {
- if (cnt < 100000000)
- cnt = 10*cnt + (ilet - '0');
- else
- cnt = 999999999;
- allowcnt = 2; /* signal presence of cnt */
- ilet = readchar();
- }
- if(digit(ilet)) {
- pline("No count allowed with this command.");
- continue;
- }
- if(index(quitchars,ilet))
- return((struct obj *)0);
- if(ilet == '-') {
- return(allownone ? &zeroobj : (struct obj *) 0);
- }
- if(ilet == '$') {
- if(!allowgold){
- pline("You cannot %s gold.", word);
- continue;
- }
- if(!(allowcnt == 2 && cnt < u.ugold))
- cnt = u.ugold;
- return(mkgoldobj(cnt));
- }
- if(ilet == '?') {
- doinv(lets);
- if(!(ilet = morc)) continue;
- /* he typed a letter (not a space) to more() */
- } else if(ilet == '*') {
- doinv((char *) 0);
- if(!(ilet = morc)) continue;
- /* ... */
- }
- if(flags.invlet_constant) {
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp->invlet == ilet) break;
- } else {
- if(ilet >= 'A' && ilet <= 'Z') ilet += 'z'-'A'+1;
- ilet -= 'a';
- for(otmp = invent; otmp && ilet;
- ilet--, otmp = otmp->nobj) ;
- }
- if(!otmp) {
- pline("You don't have that object.");
- continue;
- }
- if(cnt < 0 || otmp->quan < cnt) {
- pline("You don't have that many! [You have %u]"
- , otmp->quan);
- continue;
- }
- break;
- }
- if(!allowall && let && !index(let,otmp->olet)) {
- pline("That is a silly thing to %s.",word);
- return(0);
- }
- if(allowcnt == 2) { /* cnt given */
- if(cnt == 0) return(0);
- if(cnt != otmp->quan) {
- struct obj *obj;
- obj = splitobj(otmp, (int) cnt);
- if(otmp == uwep) setuwep(obj);
- }
- }
- return(otmp);
-}
-
-ckunpaid(otmp) struct obj *otmp; {
- return( otmp->unpaid );
-}
-
-/* interactive version of getobj - used for Drop and Identify */
-/* return the number of times fn was called successfully */
-ggetobj(word, fn, max)
-char *word;
-int (*fn)(), max;
-{
-char buf[BUFSZ];
-char *ip;
-char sym;
-int oletct = 0, iletct = 0;
-boolean allflag = FALSE;
-char olets[20], ilets[20];
-int (*ckfn)() = (int (*)()) 0;
-xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */
- if(!invent && !allowgold){
- pline("You have nothing to %s.", word);
- return(0);
- } else {
- struct obj *otmp = invent;
- int uflg = 0;
-
- if(allowgold) ilets[iletct++] = '$';
- ilets[iletct] = 0;
- while(otmp) {
- if(!index(ilets, otmp->olet)){
- ilets[iletct++] = otmp->olet;
- ilets[iletct] = 0;
- }
- if(otmp->unpaid) uflg = 1;
- otmp = otmp->nobj;
- }
- ilets[iletct++] = ' ';
- if(uflg) ilets[iletct++] = 'u';
- if(invent) ilets[iletct++] = 'a';
- ilets[iletct] = 0;
- }
- pline("What kinds of thing do you want to %s? [%s] ",
- word, ilets);
- getlin(buf);
- if(buf[0] == '\033') {
- clrlin();
- return(0);
- }
- ip = buf;
- olets[0] = 0;
- while(sym = *ip++){
- if(sym == ' ') continue;
- if(sym == '$') {
- if(allowgold == 1)
- (*fn)(mkgoldobj(u.ugold));
- else if(!u.ugold)
- pline("You have no gold.");
- allowgold = 2;
- } else
- if(sym == 'a' || sym == 'A') allflag = TRUE; else
- if(sym == 'u' || sym == 'U') ckfn = ckunpaid; else
- if(index("!%?[()=*/\"0", sym)){
- if(!index(olets, sym)){
- olets[oletct++] = sym;
- olets[oletct] = 0;
- }
- }
- else pline("You don't have any %c's.", sym);
- }
- if(allowgold == 2 && !oletct)
- return(1); /* he dropped gold (or at least tried to) */
- else
- return(askchain(invent, olets, allflag, fn, ckfn, max));
-}
-
-/*
- * Walk through the chain starting at objchn and ask for all objects
- * with olet in olets (if nonNULL) and satisfying ckfn (if nonNULL)
- * whether the action in question (i.e., fn) has to be performed.
- * If allflag then no questions are asked. Max gives the max nr of
- * objects to be treated. Return the number of objects treated.
- */
-askchain(objchn, olets, allflag, fn, ckfn, max)
-struct obj *objchn;
-char *olets;
-int allflag;
-int (*fn)(), (*ckfn)();
-int max;
-{
-struct obj *otmp, *otmp2;
-char sym, ilet;
-int cnt = 0;
- ilet = 'a'-1;
- for(otmp = objchn; otmp; otmp = otmp2){
- if(ilet == 'z') ilet = 'A'; else ilet++;
- otmp2 = otmp->nobj;
- if(olets && *olets && !index(olets, otmp->olet)) continue;
- if(ckfn && !(*ckfn)(otmp)) continue;
- if(!allflag) {
- pline(xprname(otmp, ilet));
- addtopl(" [nyaq]? ");
- sym = readchar();
- }
- else sym = 'y';
-
- switch(sym){
- case 'a':
- allflag = 1;
- case 'y':
- cnt += (*fn)(otmp);
- if(--max == 0) goto ret;
- case 'n':
- default:
- break;
- case 'q':
- goto ret;
- }
- }
- pline(cnt ? "That was all." : "No applicable objects.");
-ret:
- return(cnt);
-}
-
-obj_to_let(obj) /* should of course only be called for things in invent */
-struct obj *obj;
-{
- struct obj *otmp;
- char ilet;
-
- if(flags.invlet_constant)
- return(obj->invlet);
- ilet = 'a';
- for(otmp = invent; otmp && otmp != obj; otmp = otmp->nobj)
- if(++ilet > 'z') ilet = 'A';
- return(otmp ? ilet : NOINVSYM);
-}
-
-prinv(obj)
-struct obj *obj;
-{
- pline(xprname(obj, obj_to_let(obj)));
-}
-
-static char *
-xprname(obj,let)
-struct obj *obj;
-char let;
-{
- static char li[BUFSZ];
-
- (void) sprintf(li, "%c - %s.",
- flags.invlet_constant ? obj->invlet : let,
- doname(obj));
- return(li);
-}
-
-ddoinv()
-{
- doinv((char *) 0);
- return(0);
-}
-
-/* called with 0 or "": all objects in inventory */
-/* otherwise: all objects with (serial) letter in lets */
-doinv(lets)
-char *lets;
-{
- struct obj *otmp;
- char ilet;
- int ct = 0;
- char any[BUFSZ];
-
- morc = 0; /* just to be sure */
-
- if(!invent){
- pline("Not carrying anything.");
- return;
- }
-
- cornline(0, (char *) 0);
- ilet = 'a';
- for(otmp = invent; otmp; otmp = otmp->nobj) {
- if(flags.invlet_constant) ilet = otmp->invlet;
- if(!lets || !*lets || index(lets, ilet)) {
- cornline(1, xprname(otmp, ilet));
- any[ct++] = ilet;
- }
- if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A';
- }
- any[ct] = 0;
- cornline(2, any);
-}
-
-dotypeinv () /* free after Robert Viduya */
-/* Changed to one type only, so he doesnt have to type cr */
-{
- char c, ilet;
- char stuff[BUFSZ];
- int stct;
- struct obj *otmp;
- boolean billx = inshop() && doinvbill(0);
- boolean unpd = FALSE;
-
- if (!invent && !u.ugold && !billx) {
- pline ("You aren't carrying anything.");
- return(0);
- }
-
- stct = 0;
- if(u.ugold) stuff[stct++] = '$';
- stuff[stct] = 0;
- for(otmp = invent; otmp; otmp = otmp->nobj) {
- if (!index (stuff, otmp->olet)) {
- stuff[stct++] = otmp->olet;
- stuff[stct] = 0;
- }
- if(otmp->unpaid)
- unpd = TRUE;
- }
- if(unpd) stuff[stct++] = 'u';
- if(billx) stuff[stct++] = 'x';
- stuff[stct] = 0;
-
- if(stct > 1) {
- pline ("What type of object [%s] do you want an inventory of? ",
- stuff);
- c = readchar();
- if(index(quitchars,c)) return(0);
- } else
- c = stuff[0];
-
- if(c == '$')
- return(doprgold());
-
- if(c == 'x' || c == 'X') {
- if(billx)
- (void) doinvbill(1);
- else
- pline("No used-up objects on the shopping bill.");
- return(0);
- }
-
- if((c == 'u' || c == 'U') && !unpd) {
- pline("You are not carrying any unpaid objects.");
- return(0);
- }
-
- stct = 0;
- ilet = 'a';
- for (otmp = invent; otmp; otmp = otmp -> nobj) {
- if(flags.invlet_constant) ilet = otmp->invlet;
- if (c == otmp -> olet || (c == 'u' && otmp -> unpaid))
- stuff[stct++] = ilet;
- if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A';
- }
- stuff[stct] = '\0';
- if(stct == 0)
- pline("You have no such objects.");
- else
- doinv (stuff);
-
- return(0);
-}
-
-/* look at what is here */
-dolook() {
- struct obj *otmp, *otmp0;
- struct gold *gold;
- char *verb = Blind ? "feel" : "see";
- int ct = 0;
-
- if(!u.uswallow) {
- if(Blind) {
- pline("You try to feel what is lying here on the floor.");
- if(Levitation) { /* ab@unido */
- pline("You cannot reach the floor!");
- return(1);
- }
- }
- otmp0 = o_at(u.ux, u.uy);
- gold = g_at(u.ux, u.uy);
- }
-
- if(u.uswallow || (!otmp0 && !gold)) {
- pline("You %s no objects here.", verb);
- return(!!Blind);
- }
-
- cornline(0, "Things that are here:");
- for(otmp = otmp0; otmp; otmp = otmp->nobj) {
- if(otmp->ox == u.ux && otmp->oy == u.uy) {
- ct++;
- cornline(1, doname(otmp));
- if(Blind && otmp->otyp == DEAD_COCKATRICE && !uarmg) {
- pline("Touching the dead cockatrice is a fatal mistake ...");
- pline("You die ...");
- killer = "dead cockatrice";
- done("died");
- }
- }
- }
-
- if(gold) {
- char gbuf[30];
-
- (void) sprintf(gbuf, "%ld gold piece%s",
- gold->amount, plur(gold->amount));
- if(!ct++)
- pline("You %s here %s.", verb, gbuf);
- else
- cornline(1, gbuf);
- }
-
- if(ct == 1 && !gold) {
- pline("You %s here %s.", verb, doname(otmp0));
- cornline(3, (char *) 0);
- }
- if(ct > 1)
- cornline(2, (char *) 0);
- return(!!Blind);
-}
-
-stackobj(obj) struct obj *obj; {
-struct obj *otmp = fobj;
- for(otmp = fobj; otmp; otmp = otmp->nobj) if(otmp != obj)
- if(otmp->ox == obj->ox && otmp->oy == obj->oy &&
- merged(obj,otmp,1))
- return;
-}
-
-/* merge obj with otmp and delete obj if types agree */
-merged(otmp,obj,lose) struct obj *otmp, *obj; {
- if(obj->otyp == otmp->otyp &&
- obj->unpaid == otmp->unpaid &&
- obj->spe == otmp->spe &&
- obj->dknown == otmp->dknown &&
- obj->cursed == otmp->cursed &&
- (index("%*?!", obj->olet) ||
- (obj->known == otmp->known &&
- (obj->olet == WEAPON_SYM && obj->otyp < BOOMERANG)))) {
- otmp->quan += obj->quan;
- otmp->owt += obj->owt;
- if(lose) freeobj(obj);
- obfree(obj,otmp); /* free(obj), bill->otmp */
- return(1);
- } else return(0);
-}
-
-/*
- * Gold is no longer displayed; in fact, when you have a lot of money,
- * it may take a while before you have counted it all.
- * [Bug: d$ and pickup still tell you how much it was.]
- */
-extern int (*occupation)();
-extern char *occtxt;
-static long goldcounted;
-
-countgold(){
- if((goldcounted += 100*(u.ulevel + 1)) >= u.ugold) {
- long eps = 0;
- if(!rn2(2)) eps = rnd((int) (u.ugold/100 + 1));
- pline("You probably have about %ld gold pieces.",
- u.ugold + eps);
- return(0); /* done */
- }
- return(1); /* continue */
-}
-
-doprgold(){
- if(!u.ugold)
- pline("You do not carry any gold.");
- else if(u.ugold <= 500)
- pline("You are carrying %ld gold pieces.", u.ugold);
- else {
- pline("You sit down in order to count your gold pieces.");
- goldcounted = 500;
- occupation = countgold;
- occtxt = "counting your gold";
- }
- return(1);
-}
-
-/* --- end of gold counting section --- */
-
-doprwep(){
- if(!uwep) pline("You are empty handed.");
- else prinv(uwep);
- return(0);
-}
-
-doprarm(){
- if(!uarm && !uarmg && !uarms && !uarmh)
- pline("You are not wearing any armor.");
- else {
- char lets[6];
- int ct = 0;
-
- if(uarm) lets[ct++] = obj_to_let(uarm);
- if(uarm2) lets[ct++] = obj_to_let(uarm2);
- if(uarmh) lets[ct++] = obj_to_let(uarmh);
- if(uarms) lets[ct++] = obj_to_let(uarms);
- if(uarmg) lets[ct++] = obj_to_let(uarmg);
- lets[ct] = 0;
- doinv(lets);
- }
- return(0);
-}
-
-doprring(){
- if(!uleft && !uright)
- pline("You are not wearing any rings.");
- else {
- char lets[3];
- int ct = 0;
-
- if(uleft) lets[ct++] = obj_to_let(uleft);
- if(uright) lets[ct++] = obj_to_let(uright);
- lets[ct] = 0;
- doinv(lets);
- }
- return(0);
-}
-
-digit(c) char c; {
- return(c >= '0' && c <= '9');
-}
diff --git a/games/hack/hack.ioctl.c b/games/hack/hack.ioctl.c
deleted file mode 100644
index 9989e62..0000000
--- a/games/hack/hack.ioctl.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.ioctl.c - version 1.0.2 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/* This cannot be part of hack.tty.c (as it was earlier) since on some
- systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
- define the same constants, and the C preprocessor complains. */
-
-#include <stdio.h>
-#include "config.h"
-#ifdef BSD
-#include <sgtty.h>
-struct ltchars ltchars, ltchars0;
-#else
-#include <termio.h> /* also includes part of <sgtty.h> */
-struct termio termio;
-#endif /* BSD */
-
-getioctls() {
-#ifdef BSD
- (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
- (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
-#else
- (void) ioctl(fileno(stdin), (int) TCGETA, &termio);
-#endif /* BSD */
-}
-
-setioctls() {
-#ifdef BSD
- (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
-#else
- (void) ioctl(fileno(stdin), (int) TCSETA, &termio);
-#endif /* BSD */
-}
-
-#ifdef SUSPEND /* implies BSD */
-#include <signal.h>
-dosuspend() {
-#ifdef SIGTSTP
- if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
- settty((char *) 0);
- (void) signal(SIGTSTP, SIG_DFL);
- (void) kill(0, SIGTSTP);
- gettty();
- setftty();
- docrt();
- } else {
- pline("I don't think your shell has job control.");
- }
-#else /* SIGTSTP */
- pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
-#endif /* SIGTSTP */
- return(0);
-}
-#endif /* SUSPEND */
diff --git a/games/hack/hack.lev.c b/games/hack/hack.lev.c
deleted file mode 100644
index 8cc709e..0000000
--- a/games/hack/hack.lev.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.lev.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include "def.mkroom.h"
-#include <stdio.h>
-extern struct monst *restmonchn();
-extern struct obj *restobjchn();
-extern struct obj *billobjs;
-extern char *itoa();
-extern char SAVEF[];
-extern int hackpid;
-extern xchar dlevel;
-extern char nul[];
-
-#ifndef NOWORM
-#include "def.wseg.h"
-extern struct wseg *wsegs[32], *wheads[32];
-extern long wgrowtime[32];
-#endif /* NOWORM */
-
-boolean level_exists[MAXLEVEL+1];
-
-savelev(fd,lev)
-int fd;
-xchar lev;
-{
-#ifndef NOWORM
- struct wseg *wtmp, *wtmp2;
- int tmp;
-#endif /* NOWORM */
-
- if(fd < 0) panic("Save on bad file!"); /* impossible */
- if(lev >= 0 && lev <= MAXLEVEL)
- level_exists[lev] = TRUE;
-
- bwrite(fd,(char *) &hackpid,sizeof(hackpid));
- bwrite(fd,(char *) &lev,sizeof(lev));
- bwrite(fd,(char *) levl,sizeof(levl));
- bwrite(fd,(char *) &moves,sizeof(long));
- bwrite(fd,(char *) &xupstair,sizeof(xupstair));
- bwrite(fd,(char *) &yupstair,sizeof(yupstair));
- bwrite(fd,(char *) &xdnstair,sizeof(xdnstair));
- bwrite(fd,(char *) &ydnstair,sizeof(ydnstair));
- savemonchn(fd, fmon);
- savegoldchn(fd, fgold);
- savetrapchn(fd, ftrap);
- saveobjchn(fd, fobj);
- saveobjchn(fd, billobjs);
- billobjs = 0;
- save_engravings(fd);
-#ifndef QUEST
- bwrite(fd,(char *) rooms,sizeof(rooms));
- bwrite(fd,(char *) doors,sizeof(doors));
-#endif /* QUEST */
- fgold = 0;
- ftrap = 0;
- fmon = 0;
- fobj = 0;
-#ifndef NOWORM
- bwrite(fd,(char *) wsegs,sizeof(wsegs));
- for(tmp=1; tmp<32; tmp++){
- for(wtmp = wsegs[tmp]; wtmp; wtmp = wtmp2){
- wtmp2 = wtmp->nseg;
- bwrite(fd,(char *) wtmp,sizeof(struct wseg));
- }
- wsegs[tmp] = 0;
- }
- bwrite(fd,(char *) wgrowtime,sizeof(wgrowtime));
-#endif /* NOWORM */
-}
-
-bwrite(fd,loc,num)
-int fd;
-char *loc;
-unsigned num;
-{
-/* lint wants the 3rd arg of write to be an int; lint -p an unsigned */
- if(write(fd, loc, (int) num) != num)
- panic("cannot write %u bytes to file #%d", num, fd);
-}
-
-saveobjchn(fd,otmp)
-int fd;
-struct obj *otmp;
-{
- struct obj *otmp2;
- unsigned xl;
- int minusone = -1;
-
- while(otmp) {
- otmp2 = otmp->nobj;
- xl = otmp->onamelth;
- bwrite(fd, (char *) &xl, sizeof(int));
- bwrite(fd, (char *) otmp, xl + sizeof(struct obj));
- free((char *) otmp);
- otmp = otmp2;
- }
- bwrite(fd, (char *) &minusone, sizeof(int));
-}
-
-savemonchn(fd,mtmp)
-int fd;
-struct monst *mtmp;
-{
- struct monst *mtmp2;
- unsigned xl;
- int minusone = -1;
- struct permonst *monbegin = &mons[0];
-
- bwrite(fd, (char *) &monbegin, sizeof(monbegin));
-
- while(mtmp) {
- mtmp2 = mtmp->nmon;
- xl = mtmp->mxlth + mtmp->mnamelth;
- bwrite(fd, (char *) &xl, sizeof(int));
- bwrite(fd, (char *) mtmp, xl + sizeof(struct monst));
- if(mtmp->minvent) saveobjchn(fd,mtmp->minvent);
- free((char *) mtmp);
- mtmp = mtmp2;
- }
- bwrite(fd, (char *) &minusone, sizeof(int));
-}
-
-savegoldchn(fd,gold)
-int fd;
-struct gold *gold;
-{
- struct gold *gold2;
- while(gold) {
- gold2 = gold->ngold;
- bwrite(fd, (char *) gold, sizeof(struct gold));
- free((char *) gold);
- gold = gold2;
- }
- bwrite(fd, nul, sizeof(struct gold));
-}
-
-savetrapchn(fd,trap)
-int fd;
-struct trap *trap;
-{
- struct trap *trap2;
- while(trap) {
- trap2 = trap->ntrap;
- bwrite(fd, (char *) trap, sizeof(struct trap));
- free((char *) trap);
- trap = trap2;
- }
- bwrite(fd, nul, sizeof(struct trap));
-}
-
-getlev(fd,pid,lev)
-int fd,pid;
-xchar lev;
-{
- struct gold *gold;
- struct trap *trap;
-#ifndef NOWORM
- struct wseg *wtmp;
-#endif /* NOWORM */
- int tmp;
- long omoves;
- int hpid;
- xchar dlvl;
-
- /* First some sanity checks */
- mread(fd, (char *) &hpid, sizeof(hpid));
- mread(fd, (char *) &dlvl, sizeof(dlvl));
- if((pid && pid != hpid) || (lev && dlvl != lev)) {
- pline("Strange, this map is not as I remember it.");
- pline("Somebody is trying some trickery here ...");
- pline("This game is void ...");
- done("tricked");
- }
-
- fgold = 0;
- ftrap = 0;
- mread(fd, (char *) levl, sizeof(levl));
- mread(fd, (char *)&omoves, sizeof(omoves));
- mread(fd, (char *)&xupstair, sizeof(xupstair));
- mread(fd, (char *)&yupstair, sizeof(yupstair));
- mread(fd, (char *)&xdnstair, sizeof(xdnstair));
- mread(fd, (char *)&ydnstair, sizeof(ydnstair));
-
- fmon = restmonchn(fd);
-
- /* regenerate animals while on another level */
- { long tmoves = (moves > omoves) ? moves-omoves : 0;
- struct monst *mtmp, *mtmp2;
- extern char genocided[];
-
- for(mtmp = fmon; mtmp; mtmp = mtmp2) {
- long newhp; /* tmoves may be very large */
-
- mtmp2 = mtmp->nmon;
- if(index(genocided, mtmp->data->mlet)) {
- mondead(mtmp);
- continue;
- }
-
- if(mtmp->mtame && tmoves > 250) {
- mtmp->mtame = 0;
- mtmp->mpeaceful = 0;
- }
-
- newhp = mtmp->mhp +
- (index(MREGEN, mtmp->data->mlet) ? tmoves : tmoves/20);
- if(newhp > mtmp->mhpmax)
- mtmp->mhp = mtmp->mhpmax;
- else
- mtmp->mhp = newhp;
- }
- }
-
- setgd();
- gold = newgold();
- mread(fd, (char *)gold, sizeof(struct gold));
- while(gold->gx) {
- gold->ngold = fgold;
- fgold = gold;
- gold = newgold();
- mread(fd, (char *)gold, sizeof(struct gold));
- }
- free((char *) gold);
- trap = newtrap();
- mread(fd, (char *)trap, sizeof(struct trap));
- while(trap->tx) {
- trap->ntrap = ftrap;
- ftrap = trap;
- trap = newtrap();
- mread(fd, (char *)trap, sizeof(struct trap));
- }
- free((char *) trap);
- fobj = restobjchn(fd);
- billobjs = restobjchn(fd);
- rest_engravings(fd);
-#ifndef QUEST
- mread(fd, (char *)rooms, sizeof(rooms));
- mread(fd, (char *)doors, sizeof(doors));
-#endif /* QUEST */
-#ifndef NOWORM
- mread(fd, (char *)wsegs, sizeof(wsegs));
- for(tmp = 1; tmp < 32; tmp++) if(wsegs[tmp]){
- wheads[tmp] = wsegs[tmp] = wtmp = newseg();
- while(1) {
- mread(fd, (char *)wtmp, sizeof(struct wseg));
- if(!wtmp->nseg) break;
- wheads[tmp]->nseg = wtmp = newseg();
- wheads[tmp] = wtmp;
- }
- }
- mread(fd, (char *)wgrowtime, sizeof(wgrowtime));
-#endif /* NOWORM */
-}
-
-mread(fd, buf, len)
-int fd;
-char *buf;
-unsigned len;
-{
- int rlen;
- extern boolean restoring;
-
- rlen = read(fd, buf, (int) len);
- if(rlen != len){
- pline("Read %d instead of %u bytes.\n", rlen, len);
- if(restoring) {
- (void) unlink(SAVEF);
- error("Error restoring old game.");
- }
- panic("Error reading level file.");
- }
-}
-
-mklev()
-{
- extern boolean in_mklev;
-
- if(getbones()) return;
-
- in_mklev = TRUE;
- makelevel();
- in_mklev = FALSE;
-}
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
deleted file mode 100644
index b29320a..0000000
--- a/games/hack/hack.main.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.main.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "hack.h"
-
-#ifdef QUEST
-#define gamename "quest"
-#else
-#define gamename "hack"
-#endif
-
-extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
-extern struct permonst mons[CMNUM+2];
-extern char genocided[60], fut_geno[];
-
-int (*afternmv)();
-int (*occupation)();
-char *occtxt; /* defined when occupation != NULL */
-
-void done1();
-void hangup();
-
-int hackpid; /* current pid */
-int locknum; /* max num of players */
-#ifdef DEF_PAGER
-char *catmore; /* default pager */
-#endif
-char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */
-char *hname; /* name of the game (argv[0] of call) */
-char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */
-
-extern char *nomovemsg;
-extern long wailmsg;
-
-#ifdef CHDIR
-static void chdirx();
-#endif
-
-main(argc,argv)
-int argc;
-char *argv[];
-{
- int fd;
-#ifdef CHDIR
- char *dir;
-#endif
-
- hname = argv[0];
- hackpid = getpid();
-
-#ifdef CHDIR /* otherwise no chdir() */
- /*
- * See if we must change directory to the playground.
- * (Perhaps hack runs suid and playground is inaccessible
- * for the player.)
- * The environment variable HACKDIR is overridden by a
- * -d command line option (must be the first option given)
- */
-
- dir = getenv("HACKDIR");
- if(argc > 1 && !strncmp(argv[1], "-d", 2)) {
- argc--;
- argv++;
- dir = argv[0]+2;
- if(*dir == '=' || *dir == ':') dir++;
- if(!*dir && argc > 1) {
- argc--;
- argv++;
- dir = argv[0];
- }
- if(!*dir)
- error("Flag -d must be followed by a directory name.");
- }
-#endif
-
- /*
- * Who am i? Algorithm: 1. Use name as specified in HACKOPTIONS
- * 2. Use $USER or $LOGNAME (if 1. fails)
- * 3. Use getlogin() (if 2. fails)
- * The resulting name is overridden by command line options.
- * If everything fails, or if the resulting name is some generic
- * account like "games", "play", "player", "hack" then eventually
- * we'll ask him.
- * Note that we trust him here; it is possible to play under
- * somebody else's name.
- */
- { char *s;
-
- initoptions();
- if(!*plname && (s = getenv("USER")))
- (void) strncpy(plname, s, sizeof(plname)-1);
- if(!*plname && (s = getenv("LOGNAME")))
- (void) strncpy(plname, s, sizeof(plname)-1);
- if(!*plname && (s = getlogin()))
- (void) strncpy(plname, s, sizeof(plname)-1);
- }
-
- /*
- * Now we know the directory containing 'record' and
- * may do a prscore().
- */
- if(argc > 1 && !strncmp(argv[1], "-s", 2)) {
-#ifdef CHDIR
- chdirx(dir,0);
-#endif
- prscore(argc, argv);
- exit(0);
- }
-
- /*
- * It seems he really wants to play.
- * Remember tty modes, to be restored on exit.
- */
- gettty();
- setbuf(stdout,obuf);
- umask(007);
- setrandom();
- startup();
- cls();
- u.uhp = 1; /* prevent RIP on early quits */
- u.ux = FAR; /* prevent nscr() */
- (void) signal(SIGHUP, hangup);
-
- /*
- * Find the creation date of this game,
- * so as to avoid restoring outdated savefiles.
- */
- gethdate(hname);
-
- /*
- * We cannot do chdir earlier, otherwise gethdate will fail.
- */
-#ifdef CHDIR
- chdirx(dir,1);
-#endif
-
- /*
- * Process options.
- */
- while(argc > 1 && argv[1][0] == '-'){
- argv++;
- argc--;
- switch(argv[0][1]){
-#ifdef WIZARD
- case 'D':
-/* if(!strcmp(getlogin(), WIZARD)) */
- wizard = TRUE;
-/* else
- printf("Sorry.\n"); */
- break;
-#endif
-#ifdef NEWS
- case 'n':
- flags.nonews = TRUE;
- break;
-#endif
- case 'u':
- if(argv[0][2])
- (void) strncpy(plname, argv[0]+2, sizeof(plname)-1);
- else if(argc > 1) {
- argc--;
- argv++;
- (void) strncpy(plname, argv[0], sizeof(plname)-1);
- } else
- printf("Player name expected after -u\n");
- break;
- default:
- /* allow -T for Tourist, etc. */
- (void) strncpy(pl_character, argv[0]+1,
- sizeof(pl_character)-1);
-
- /* printf("Unknown option: %s\n", *argv); */
- }
- }
-
- if(argc > 1)
- locknum = atoi(argv[1]);
-#ifdef MAX_NR_OF_PLAYERS
- if(!locknum || locknum > MAX_NR_OF_PLAYERS)
- locknum = MAX_NR_OF_PLAYERS;
-#endif
-#ifdef DEF_PAGER
- if(!(catmore = getenv("HACKPAGER")) && !(catmore = getenv("PAGER")))
- catmore = DEF_PAGER;
-#endif
-#ifdef MAIL
- getmailstatus();
-#endif
-#ifdef WIZARD
- if(wizard) (void) strcpy(plname, "wizard"); else
-#endif
- if(!*plname || !strncmp(plname, "player", 4)
- || !strncmp(plname, "games", 4))
- askname();
- plnamesuffix(); /* strip suffix from name; calls askname() */
- /* again if suffix was whole name */
- /* accepts any suffix */
-#ifdef WIZARD
- if(!wizard) {
-#endif
- /*
- * check for multiple games under the same name
- * (if !locknum) or check max nr of players (otherwise)
- */
- (void) signal(SIGQUIT,SIG_IGN);
- (void) signal(SIGINT,SIG_IGN);
- if(!locknum)
- (void) strcpy(lock,plname);
- getlock(); /* sets lock if locknum != 0 */
-#ifdef WIZARD
- } else {
- char *sfoo;
- (void) strcpy(lock,plname);
- if(sfoo = getenv("MAGIC"))
- while(*sfoo) {
- switch(*sfoo++) {
- case 'n': (void) srandom(*sfoo++);
- break;
- }
- }
- if(sfoo = getenv("GENOCIDED")){
- if(*sfoo == '!'){
- struct permonst *pm = mons;
- char *gp = genocided;
-
- while(pm < mons+CMNUM+2){
- if(!index(sfoo, pm->mlet))
- *gp++ = pm->mlet;
- pm++;
- }
- *gp = 0;
- } else
- (void) strncpy(genocided, sfoo, sizeof(genocided)-1);
- (void) strcpy(fut_geno, genocided);
- }
- }
-#endif
- setftty();
- (void) sprintf(SAVEF, "save/%d%s", getuid(), plname);
- regularize(SAVEF+5); /* avoid . or / in name */
- if((fd = open(SAVEF,0)) >= 0 &&
- (uptodate(fd) || unlink(SAVEF) == 666)) {
- (void) signal(SIGINT,done1);
- pline("Restoring old save file...");
- (void) fflush(stdout);
- if(!dorecover(fd))
- goto not_recovered;
- pline("Hello %s, welcome to %s!", plname, gamename);
- flags.move = 0;
- } else {
-not_recovered:
- fobj = fcobj = invent = 0;
- fmon = fallen_down = 0;
- ftrap = 0;
- fgold = 0;
- flags.ident = 1;
- init_objects();
- u_init();
-
- (void) signal(SIGINT,done1);
- mklev();
- u.ux = xupstair;
- u.uy = yupstair;
- (void) inshop();
- setsee();
- flags.botlx = 1;
- makedog();
- { struct monst *mtmp;
- if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */
- }
- seemons();
-#ifdef NEWS
- if(flags.nonews || !readnews())
- /* after reading news we did docrt() already */
-#endif
- docrt();
-
- /* give welcome message before pickup messages */
- pline("Hello %s, welcome to %s!", plname, gamename);
-
- pickup(1);
- read_engr_at(u.ux,u.uy);
- flags.move = 1;
- }
-
- flags.moonphase = phase_of_the_moon();
- if(flags.moonphase == FULL_MOON) {
- pline("You are lucky! Full moon tonight.");
- u.uluck++;
- } else if(flags.moonphase == NEW_MOON) {
- pline("Be careful! New moon tonight.");
- }
-
- initrack();
-
- for(;;) {
- if(flags.move) { /* actual time passed */
-
- settrack();
-
- if(moves%2 == 0 ||
- (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) {
- extern struct monst *makemon();
- movemon();
- if(!rn2(70))
- (void) makemon((struct permonst *)0, 0, 0);
- }
- if(Glib) glibr();
- timeout();
- ++moves;
- if(flags.time) flags.botl = 1;
- if(u.uhp < 1) {
- pline("You die...");
- done("died");
- }
- if(u.uhp*10 < u.uhpmax && moves-wailmsg > 50){
- wailmsg = moves;
- if(u.uhp == 1)
- pline("You hear the wailing of the Banshee...");
- else
- pline("You hear the howling of the CwnAnnwn...");
- }
- if(u.uhp < u.uhpmax) {
- if(u.ulevel > 9) {
- if(Regeneration || !(moves%3)) {
- flags.botl = 1;
- u.uhp += rnd((int) u.ulevel-9);
- if(u.uhp > u.uhpmax)
- u.uhp = u.uhpmax;
- }
- } else if(Regeneration ||
- (!(moves%(22-u.ulevel*2)))) {
- flags.botl = 1;
- u.uhp++;
- }
- }
- if(Teleportation && !rn2(85)) tele();
- if(Searching && multi >= 0) (void) dosearch();
- gethungry();
- invault();
- amulet();
- }
- if(multi < 0) {
- if(!++multi){
- pline(nomovemsg ? nomovemsg :
- "You can move again.");
- nomovemsg = 0;
- if(afternmv) (*afternmv)();
- afternmv = 0;
- }
- }
-
- find_ac();
-#ifndef QUEST
- if(!flags.mv || Blind)
-#endif
- {
- seeobjs();
- seemons();
- nscr();
- }
- if(flags.botl || flags.botlx) bot();
-
- flags.move = 1;
-
- if(multi >= 0 && occupation) {
- if(monster_nearby())
- stop_occupation();
- else if ((*occupation)() == 0)
- occupation = 0;
- continue;
- }
-
- if(multi > 0) {
-#ifdef QUEST
- if(flags.run >= 4) finddir();
-#endif
- lookaround();
- if(!multi) { /* lookaround may clear multi */
- flags.move = 0;
- continue;
- }
- if(flags.mv) {
- if(multi < COLNO && !--multi)
- flags.mv = flags.run = 0;
- domove();
- } else {
- --multi;
- rhack(save_cm);
- }
- } else if(multi == 0) {
-#ifdef MAIL
- ckmailstatus();
-#endif
- rhack((char *) 0);
- }
- if(multi && multi%7 == 0)
- (void) fflush(stdout);
- }
-}
-
-glo(foo)
-int foo;
-{
- /* construct the string xlock.n */
- char *tf;
-
- tf = lock;
- while(*tf && *tf != '.') tf++;
- (void) sprintf(tf, ".%d", foo);
-}
-
-/*
- * plname is filled either by an option (-u Player or -uPlayer) or
- * explicitly (-w implies wizard) or by askname.
- * It may still contain a suffix denoting pl_character.
- */
-askname(){
-int c,ct;
- printf("\nWho are you? ");
- (void) fflush(stdout);
- ct = 0;
- while((c = getchar()) != '\n'){
- if(c == EOF) error("End of input\n");
- /* some people get confused when their erase char is not ^H */
- if(c == '\010') {
- if(ct) ct--;
- continue;
- }
- if(c != '-')
- if(c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_';
- if(ct < sizeof(plname)-1) plname[ct++] = c;
- }
- plname[ct] = 0;
- if(ct == 0) askname();
-}
-
-/*VARARGS1*/
-impossible(s,x1,x2)
-char *s;
-{
- pline(s,x1,x2);
- pline("Program in disorder - perhaps you'd better Quit.");
-}
-
-#ifdef CHDIR
-static void
-chdirx(dir, wr)
-char *dir;
-boolean wr;
-{
-
-#ifdef SECURE
- if(dir /* User specified directory? */
-#ifdef HACKDIR
- && strcmp(dir, HACKDIR) /* and not the default? */
-#endif
- ) {
- /* revoke */
- setgid(getgid());
- }
-#endif
-
-#ifdef HACKDIR
- if(dir == NULL)
- dir = HACKDIR;
-#endif
-
- if(dir && chdir(dir) < 0) {
- perror(dir);
- error("Cannot chdir to %s.", dir);
- }
-
- /* warn the player if he cannot write the record file */
- /* perhaps we should also test whether . is writable */
- /* unfortunately the access systemcall is worthless */
- if(wr) {
- int fd;
-
- if(dir == NULL)
- dir = ".";
- if((fd = open(RECORD, 2)) < 0) {
- printf("Warning: cannot write %s/%s", dir, RECORD);
- getret();
- } else
- (void) close(fd);
- }
-}
-#endif
-
-stop_occupation()
-{
- if(occupation) {
- pline("You stop %s.", occtxt);
- occupation = 0;
- }
-}
diff --git a/games/hack/hack.makemon.c b/games/hack/hack.makemon.c
deleted file mode 100644
index 54cf307..0000000
--- a/games/hack/hack.makemon.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.makemon.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern char fut_geno[];
-extern char *index();
-extern struct obj *mkobj_at();
-struct monst zeromonst;
-
-/*
- * called with [x,y] = coordinates;
- * [0,0] means anyplace
- * [u.ux,u.uy] means: call mnexto (if !in_mklev)
- *
- * In case we make an Orc or killer bee, we make an entire horde (swarm);
- * note that in this case we return only one of them (the one at [x,y]).
- */
-struct monst *
-makemon(ptr,x,y)
-struct permonst *ptr;
-{
- struct monst *mtmp;
- int tmp, ct;
- boolean anything = (!ptr);
- extern boolean in_mklev;
-
- if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0);
- if(ptr){
- if(index(fut_geno, ptr->mlet)) return((struct monst *) 0);
- } else {
- ct = CMNUM - strlen(fut_geno);
- if(index(fut_geno, 'm')) ct++; /* make only 1 minotaur */
- if(index(fut_geno, '@')) ct++;
- if(ct <= 0) return(0); /* no more monsters! */
- tmp = rn2(ct*dlevel/24 + 7);
- if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12);
- if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2);
- for(ct = 0; ct < CMNUM; ct++){
- ptr = &mons[ct];
- if(index(fut_geno, ptr->mlet))
- continue;
- if(!tmp--) goto gotmon;
- }
- panic("makemon?");
- }
-gotmon:
- mtmp = newmonst(ptr->pxlth);
- *mtmp = zeromonst; /* clear all entries in structure */
- for(ct = 0; ct < ptr->pxlth; ct++)
- ((char *) &(mtmp->mextra[0]))[ct] = 0;
- mtmp->nmon = fmon;
- fmon = mtmp;
- mtmp->m_id = flags.ident++;
- mtmp->data = ptr;
- mtmp->mxlth = ptr->pxlth;
- if(ptr->mlet == 'D') mtmp->mhpmax = mtmp->mhp = 80;
- else if(!ptr->mlevel) mtmp->mhpmax = mtmp->mhp = rnd(4);
- else mtmp->mhpmax = mtmp->mhp = d(ptr->mlevel, 8);
- mtmp->mx = x;
- mtmp->my = y;
- mtmp->mcansee = 1;
- if(ptr->mlet == 'M'){
- mtmp->mimic = 1;
- mtmp->mappearance = ']';
- }
- if(!in_mklev) {
- if(x == u.ux && y == u.uy && ptr->mlet != ' ')
- mnexto(mtmp);
- if(x == 0 && y == 0)
- rloc(mtmp);
- }
- if(ptr->mlet == 's' || ptr->mlet == 'S') {
- mtmp->mhide = mtmp->mundetected = 1;
- if(in_mklev)
- if(mtmp->mx && mtmp->my)
- (void) mkobj_at(0, mtmp->mx, mtmp->my);
- }
- if(ptr->mlet == ':') {
- mtmp->cham = 1;
- (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]);
- }
- if(ptr->mlet == 'I' || ptr->mlet == ';')
- mtmp->minvis = 1;
- if(ptr->mlet == 'L' || ptr->mlet == 'N'
- || (in_mklev && index("&w;", ptr->mlet) && rn2(5))
- ) mtmp->msleep = 1;
-
-#ifndef NOWORM
- if(ptr->mlet == 'w' && getwn(mtmp))
- initworm(mtmp);
-#endif /* NOWORM */
-
- if(anything) if(ptr->mlet == 'O' || ptr->mlet == 'k') {
- coord enexto();
- coord mm;
- int cnt = rnd(10);
- mm.x = x;
- mm.y = y;
- while(cnt--) {
- mm = enexto(mm.x, mm.y);
- (void) makemon(ptr, mm.x, mm.y);
- }
- }
-
- return(mtmp);
-}
-
-coord
-enexto(xx,yy)
-xchar xx,yy;
-{
- xchar x,y;
- coord foo[15], *tfoo;
- int range;
-
- tfoo = foo;
- range = 1;
- do { /* full kludge action. */
- for(x = xx-range; x <= xx+range; x++)
- if(goodpos(x, yy-range)) {
- tfoo->x = x;
- tfoo++->y = yy-range;
- if(tfoo == &foo[15]) goto foofull;
- }
- for(x = xx-range; x <= xx+range; x++)
- if(goodpos(x,yy+range)) {
- tfoo->x = x;
- tfoo++->y = yy+range;
- if(tfoo == &foo[15]) goto foofull;
- }
- for(y = yy+1-range; y < yy+range; y++)
- if(goodpos(xx-range,y)) {
- tfoo->x = xx-range;
- tfoo++->y = y;
- if(tfoo == &foo[15]) goto foofull;
- }
- for(y = yy+1-range; y < yy+range; y++)
- if(goodpos(xx+range,y)) {
- tfoo->x = xx+range;
- tfoo++->y = y;
- if(tfoo == &foo[15]) goto foofull;
- }
- range++;
- } while(tfoo == foo);
-foofull:
- return( foo[rn2(tfoo-foo)] );
-}
-
-goodpos(x,y) /* used only in mnexto and rloc */
-{
- return(
- ! (x < 1 || x > COLNO-2 || y < 1 || y > ROWNO-2 ||
- m_at(x,y) || !ACCESSIBLE(levl[x][y].typ)
- || (x == u.ux && y == u.uy)
- || sobj_at(ENORMOUS_ROCK, x, y)
- ));
-}
-
-rloc(mtmp)
-struct monst *mtmp;
-{
- int tx,ty;
- char ch = mtmp->data->mlet;
-
-#ifndef NOWORM
- if(ch == 'w' && mtmp->mx) return; /* do not relocate worms */
-#endif /* NOWORM */
- do {
- tx = rn1(COLNO-3,2);
- ty = rn2(ROWNO);
- } while(!goodpos(tx,ty));
- mtmp->mx = tx;
- mtmp->my = ty;
- if(u.ustuck == mtmp){
- if(u.uswallow) {
- u.ux = tx;
- u.uy = ty;
- docrt();
- } else u.ustuck = 0;
- }
- pmon(mtmp);
-}
-
-struct monst *
-mkmon_at(let,x,y)
-char let;
-int x,y;
-{
- int ct;
- struct permonst *ptr;
-
- for(ct = 0; ct < CMNUM; ct++) {
- ptr = &mons[ct];
- if(ptr->mlet == let)
- return(makemon(ptr,x,y));
- }
- return(0);
-}
diff --git a/games/hack/hack.mfndpos.h b/games/hack/hack.mfndpos.h
deleted file mode 100644
index f4da529..0000000
--- a/games/hack/hack.mfndpos.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mfndpos.h - version 1.0.2 */
-
-#define ALLOW_TRAPS 0777
-#define ALLOW_U 01000
-#define ALLOW_M 02000
-#define ALLOW_TM 04000
-#define ALLOW_ALL (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS)
-#define ALLOW_SSM 010000
-#define ALLOW_ROCK 020000
-#define NOTONL 040000
-#define NOGARLIC 0100000
diff --git a/games/hack/hack.mhitu.c b/games/hack/hack.mhitu.c
deleted file mode 100644
index e8c3d75..0000000
--- a/games/hack/hack.mhitu.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mhitu.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern struct monst *makemon();
-
-/*
- * mhitu: monster hits you
- * returns 1 if monster dies (e.g. 'y', 'F'), 0 otherwise
- */
-mhitu(mtmp)
-struct monst *mtmp;
-{
- struct permonst *mdat = mtmp->data;
- int tmp, ctmp;
-
- nomul(0);
-
- /* If swallowed, can only be affected by hissers and by u.ustuck */
- if(u.uswallow) {
- if(mtmp != u.ustuck) {
- if(mdat->mlet == 'c' && !rn2(13)) {
- pline("Outside, you hear %s's hissing!",
- monnam(mtmp));
- pline("%s gets turned to stone!",
- Monnam(u.ustuck));
- pline("And the same fate befalls you.");
- done_in_by(mtmp);
- /* "notreached": not return(1); */
- }
- return(0);
- }
- switch(mdat->mlet) { /* now mtmp == u.ustuck */
- case ',':
- youswld(mtmp, (u.uac > 0) ? u.uac+4 : 4,
- 5, "The trapper");
- break;
- case '\'':
- youswld(mtmp,rnd(6),7,"The lurker above");
- break;
- case 'P':
- youswld(mtmp,d(2,4),12,"The purple worm");
- break;
- default:
- /* This is not impossible! */
- pline("The mysterious monster totally digests you.");
- u.uhp = 0;
- }
- if(u.uhp < 1) done_in_by(mtmp);
- return(0);
- }
-
- if(mdat->mlet == 'c' && Stoned)
- return(0);
-
- /* make eels visible the moment they hit/miss us */
- if(mdat->mlet == ';' && mtmp->minvis && cansee(mtmp->mx,mtmp->my)){
- mtmp->minvis = 0;
- pmon(mtmp);
- }
- if(!index("1&DuxynNF",mdat->mlet))
- tmp = hitu(mtmp,d(mdat->damn,mdat->damd));
- else
- tmp = 0;
- if(index(UNDEAD, mdat->mlet) && midnight())
- tmp += hitu(mtmp,d(mdat->damn,mdat->damd));
-
- ctmp = tmp && !mtmp->mcan &&
- (!uarm || objects[uarm->otyp].a_can < rnd(3) || !rn2(50));
- switch(mdat->mlet) {
- case '1':
- if(wiz_hit(mtmp)) return(1); /* he disappeared */
- break;
- case '&':
- if(!mtmp->cham && !mtmp->mcan && !rn2(13)) {
- (void) makemon(PM_DEMON,u.ux,u.uy);
- } else {
- (void) hitu(mtmp,d(2,6));
- (void) hitu(mtmp,d(2,6));
- (void) hitu(mtmp,rnd(3));
- (void) hitu(mtmp,rnd(3));
- (void) hitu(mtmp,rn1(4,2));
- }
- break;
- case ',':
- if(tmp) justswld(mtmp,"The trapper");
- break;
- case '\'':
- if(tmp) justswld(mtmp, "The lurker above");
- break;
- case ';':
- if(ctmp) {
- if(!u.ustuck && !rn2(10)) {
- pline("%s swings itself around you!",
- Monnam(mtmp));
- u.ustuck = mtmp;
- } else if(u.ustuck == mtmp &&
- levl[mtmp->mx][mtmp->my].typ == POOL) {
- pline("%s drowns you ...", Monnam(mtmp));
- done("drowned");
- }
- }
- break;
- case 'A':
- if(ctmp && rn2(2)) {
- if(Poison_resistance)
- pline("The sting doesn't seem to affect you.");
- else {
- pline("You feel weaker!");
- losestr(1);
- }
- }
- break;
- case 'C':
- (void) hitu(mtmp,rnd(6));
- break;
- case 'c':
- if(!rn2(5)) {
- pline("You hear %s's hissing!", monnam(mtmp));
- if(ctmp || !rn2(20) || (flags.moonphase == NEW_MOON
- && !carrying(DEAD_LIZARD))) {
- Stoned = 5;
- /* pline("You get turned to stone!"); */
- /* done_in_by(mtmp); */
- }
- }
- break;
- case 'D':
- if(rn2(6) || mtmp->mcan) {
- (void) hitu(mtmp,d(3,10));
- (void) hitu(mtmp,rnd(8));
- (void) hitu(mtmp,rnd(8));
- break;
- }
- kludge("%s breathes fire!","The dragon");
- buzz(-1,mtmp->mx,mtmp->my,u.ux-mtmp->mx,u.uy-mtmp->my);
- break;
- case 'd':
- (void) hitu(mtmp,d(2, (flags.moonphase == FULL_MOON) ? 3 : 4));
- break;
- case 'e':
- (void) hitu(mtmp,d(3,6));
- break;
- case 'F':
- if(mtmp->mcan) break;
- kludge("%s explodes!","The freezing sphere");
- if(Cold_resistance) pline("You don't seem affected by it.");
- else {
- xchar dn;
- if(17-(u.ulevel/2) > rnd(20)) {
- pline("You get blasted!");
- dn = 6;
- } else {
- pline("You duck the blast...");
- dn = 3;
- }
- losehp_m(d(dn,6), mtmp);
- }
- mondead(mtmp);
- return(1);
- case 'g':
- if(ctmp && multi >= 0 && !rn2(3)) {
- kludge("You are frozen by %ss juices","the cube'");
- nomul(-rnd(10));
- }
- break;
- case 'h':
- if(ctmp && multi >= 0 && !rn2(5)) {
- nomul(-rnd(10));
- kludge("You are put to sleep by %ss bite!",
- "the homunculus'");
- }
- break;
- case 'j':
- tmp = hitu(mtmp,rnd(3));
- tmp &= hitu(mtmp,rnd(3));
- if(tmp){
- (void) hitu(mtmp,rnd(4));
- (void) hitu(mtmp,rnd(4));
- }
- break;
- case 'k':
- if((hitu(mtmp,rnd(4)) || !rn2(3)) && ctmp){
- poisoned("bee's sting",mdat->mname);
- }
- break;
- case 'L':
- if(tmp) stealgold(mtmp);
- break;
- case 'N':
- if(mtmp->mcan && !Blind) {
- pline("%s tries to seduce you, but you seem not interested.",
- Amonnam(mtmp, "plain"));
- if(rn2(3)) rloc(mtmp);
- } else if(steal(mtmp)) {
- rloc(mtmp);
- mtmp->mflee = 1;
- }
- break;
- case 'n':
- if(!uwep && !uarm && !uarmh && !uarms && !uarmg) {
- pline("%s hits! (I hope you don't mind)",
- Monnam(mtmp));
- u.uhp += rnd(7);
- if(!rn2(7)) u.uhpmax++;
- if(u.uhp > u.uhpmax) u.uhp = u.uhpmax;
- flags.botl = 1;
- if(!rn2(50)) rloc(mtmp);
- } else {
- (void) hitu(mtmp,d(2,6));
- (void) hitu(mtmp,d(2,6));
- }
- break;
- case 'o':
- tmp = hitu(mtmp,rnd(6));
- if(hitu(mtmp,rnd(6)) && tmp && /* hits with both paws */
- !u.ustuck && rn2(2)) {
- u.ustuck = mtmp;
- kludge("%s has grabbed you!","The owlbear");
- u.uhp -= d(2,8);
- } else if(u.ustuck == mtmp) {
- u.uhp -= d(2,8);
- pline("You are being crushed.");
- }
- break;
- case 'P':
- if(ctmp && !rn2(4))
- justswld(mtmp,"The purple worm");
- else
- (void) hitu(mtmp,d(2,4));
- break;
- case 'Q':
- (void) hitu(mtmp,rnd(2));
- (void) hitu(mtmp,rnd(2));
- break;
- case 'R':
- if(tmp && uarmh && !uarmh->rustfree &&
- (int) uarmh->spe >= -1) {
- pline("Your helmet rusts!");
- uarmh->spe--;
- } else
- if(ctmp && uarm && !uarm->rustfree && /* Mike Newton */
- uarm->otyp < STUDDED_LEATHER_ARMOR &&
- (int) uarm->spe >= -1) {
- pline("Your armor rusts!");
- uarm->spe--;
- }
- break;
- case 'S':
- if(ctmp && !rn2(8)) {
- poisoned("snake's bite",mdat->mname);
- }
- break;
- case 's':
- if(tmp && !rn2(8)) {
- poisoned("scorpion's sting",mdat->mname);
- }
- (void) hitu(mtmp,rnd(8));
- (void) hitu(mtmp,rnd(8));
- break;
- case 'T':
- (void) hitu(mtmp,rnd(6));
- (void) hitu(mtmp,rnd(6));
- break;
- case 't':
- if(!rn2(5)) rloc(mtmp);
- break;
- case 'u':
- mtmp->mflee = 1;
- break;
- case 'U':
- (void) hitu(mtmp,d(3,4));
- (void) hitu(mtmp,d(3,4));
- break;
- case 'v':
- if(ctmp && !u.ustuck) u.ustuck = mtmp;
- break;
- case 'V':
- if(tmp) u.uhp -= 4;
- if(ctmp) losexp();
- break;
- case 'W':
- if(ctmp) losexp();
- break;
-#ifndef NOWORM
- case 'w':
- if(tmp) wormhit(mtmp);
-#endif /* NOWORM */
- break;
- case 'X':
- (void) hitu(mtmp,rnd(5));
- (void) hitu(mtmp,rnd(5));
- (void) hitu(mtmp,rnd(5));
- break;
- case 'x':
- { long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE;
- pline("%s pricks in your %s leg!",
- Monnam(mtmp), (side == RIGHT_SIDE) ? "right" : "left");
- set_wounded_legs(side, rnd(50));
- losehp_m(2, mtmp);
- break;
- }
- case 'y':
- if(mtmp->mcan) break;
- mondead(mtmp);
- if(!Blind) {
- pline("You are blinded by a blast of light!");
- Blind = d(4,12);
- seeoff(0);
- }
- return(1);
- case 'Y':
- (void) hitu(mtmp,rnd(6));
- break;
- }
- if(u.uhp < 1) done_in_by(mtmp);
- return(0);
-}
-
-hitu(mtmp,dam)
-struct monst *mtmp;
-int dam;
-{
- int tmp, res;
-
- nomul(0);
- if(u.uswallow) return(0);
-
- if(mtmp->mhide && mtmp->mundetected) {
- mtmp->mundetected = 0;
- if(!Blind) {
- struct obj *obj;
- extern char * Xmonnam();
- if(obj = o_at(mtmp->mx,mtmp->my))
- pline("%s was hidden under %s!",
- Xmonnam(mtmp), doname(obj));
- }
- }
-
- tmp = u.uac;
- /* give people with Ac = -10 at least some vulnerability */
- if(tmp < 0) {
- dam += tmp; /* decrease damage */
- if(dam <= 0) dam = 1;
- tmp = -rn2(-tmp);
- }
- tmp += mtmp->data->mlevel;
- if(multi < 0) tmp += 4;
- if((Invis && mtmp->data->mlet != 'I') || !mtmp->mcansee) tmp -= 2;
- if(mtmp->mtrapped) tmp -= 2;
- if(tmp <= rnd(20)) {
- if(Blind) pline("It misses.");
- else pline("%s misses.",Monnam(mtmp));
- res = 0;
- } else {
- if(Blind) pline("It hits!");
- else pline("%s hits!",Monnam(mtmp));
- losehp_m(dam, mtmp);
- res = 1;
- }
- stop_occupation();
- return(res);
-}
diff --git a/games/hack/hack.mklev.c b/games/hack/hack.mklev.c
deleted file mode 100644
index f6b9933..0000000
--- a/games/hack/hack.mklev.c
+++ /dev/null
@@ -1,744 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mklev.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "hack.h"
-
-extern struct monst *makemon();
-extern struct obj *mkobj_at();
-extern struct trap *maketrap();
-
-#define somex() ((random()%(croom->hx-croom->lx+1))+croom->lx)
-#define somey() ((random()%(croom->hy-croom->ly+1))+croom->ly)
-
-#include "def.mkroom.h"
-#define XLIM 4 /* define minimum required space around a room */
-#define YLIM 3
-boolean secret; /* TRUE while making a vault: increase [XY]LIM */
-struct mkroom rooms[MAXNROFROOMS+1];
-int smeq[MAXNROFROOMS+1];
-coord doors[DOORMAX];
-int doorindex;
-struct rm zerorm;
-int comp();
-schar nxcor;
-boolean goldseen;
-int nroom;
-xchar xdnstair,xupstair,ydnstair,yupstair;
-
-/* Definitions used by makerooms() and addrs() */
-#define MAXRS 50 /* max lth of temp rectangle table - arbitrary */
-struct rectangle {
- xchar rlx,rly,rhx,rhy;
-} rs[MAXRS+1];
-int rscnt,rsmax; /* 0..rscnt-1: currently under consideration */
- /* rscnt..rsmax: discarded */
-
-makelevel()
-{
- struct mkroom *croom, *troom;
- unsigned tryct;
- int x,y;
-
- nroom = 0;
- doorindex = 0;
- rooms[0].hx = -1; /* in case we are in a maze */
-
- for(x=0; x<COLNO; x++) for(y=0; y<ROWNO; y++)
- levl[x][y] = zerorm;
-
- oinit(); /* assign level dependent obj probabilities */
-
- if(dlevel >= rn1(3, 26)) { /* there might be several mazes */
- makemaz();
- return;
- }
-
- /* construct the rooms */
- nroom = 0;
- secret = FALSE;
- (void) makerooms();
-
- /* construct stairs (up and down in different rooms if possible) */
- croom = &rooms[rn2(nroom)];
- xdnstair = somex();
- ydnstair = somey();
- levl[xdnstair][ydnstair].scrsym ='>';
- levl[xdnstair][ydnstair].typ = STAIRS;
- if(nroom > 1) {
- troom = croom;
- croom = &rooms[rn2(nroom-1)];
- if(croom >= troom) croom++;
- }
- xupstair = somex(); /* %% < and > might be in the same place */
- yupstair = somey();
- levl[xupstair][yupstair].scrsym ='<';
- levl[xupstair][yupstair].typ = STAIRS;
-
- /* for each room: put things inside */
- for(croom = rooms; croom->hx > 0; croom++) {
-
- /* put a sleeping monster inside */
- /* Note: monster may be on the stairs. This cannot be
- avoided: maybe the player fell through a trapdoor
- while a monster was on the stairs. Conclusion:
- we have to check for monsters on the stairs anyway. */
- if(!rn2(3)) (void)
- makemon((struct permonst *) 0, somex(), somey());
-
- /* put traps and mimics inside */
- goldseen = FALSE;
- while(!rn2(8-(dlevel/6))) mktrap(0,0,croom);
- if(!goldseen && !rn2(3)) mkgold(0L,somex(),somey());
- if(!rn2(3)) {
- (void) mkobj_at(0, somex(), somey());
- tryct = 0;
- while(!rn2(5)) {
- if(++tryct > 100){
- printf("tryct overflow4\n");
- break;
- }
- (void) mkobj_at(0, somex(), somey());
- }
- }
- }
-
- qsort((char *) rooms, nroom, sizeof(struct mkroom), comp);
- makecorridors();
- make_niches();
-
- /* make a secret treasure vault, not connected to the rest */
- if(nroom <= (2*MAXNROFROOMS/3)) if(rn2(3)) {
- troom = &rooms[nroom];
- secret = TRUE;
- if(makerooms()) {
- troom->rtype = VAULT; /* treasure vault */
- for(x = troom->lx; x <= troom->hx; x++)
- for(y = troom->ly; y <= troom->hy; y++)
- mkgold((long)(rnd(dlevel*100) + 50), x, y);
- if(!rn2(3))
- makevtele();
- }
- }
-
-#ifndef QUEST
-#ifdef WIZARD
- if(wizard && getenv("SHOPTYPE")) mkshop(); else
-#endif /* WIZARD */
- if(dlevel > 1 && dlevel < 20 && rn2(dlevel) < 3) mkshop();
- else
- if(dlevel > 6 && !rn2(7)) mkzoo(ZOO);
- else
- if(dlevel > 9 && !rn2(5)) mkzoo(BEEHIVE);
- else
- if(dlevel > 11 && !rn2(6)) mkzoo(MORGUE);
- else
- if(dlevel > 18 && !rn2(6)) mkswamp();
-#endif /* QUEST */
-}
-
-makerooms() {
-struct rectangle *rsp;
-int lx, ly, hx, hy, lowx, lowy, hix, hiy, dx, dy;
-int tryct = 0, xlim, ylim;
-
- /* init */
- xlim = XLIM + secret;
- ylim = YLIM + secret;
- if(nroom == 0) {
- rsp = rs;
- rsp->rlx = rsp->rly = 0;
- rsp->rhx = COLNO-1;
- rsp->rhy = ROWNO-1;
- rsmax = 1;
- }
- rscnt = rsmax;
-
- /* make rooms until satisfied */
- while(rscnt > 0 && nroom < MAXNROFROOMS-1) {
- if(!secret && nroom > (MAXNROFROOMS/3) &&
- !rn2((MAXNROFROOMS-nroom)*(MAXNROFROOMS-nroom)))
- return(0);
-
- /* pick a rectangle */
- rsp = &rs[rn2(rscnt)];
- hx = rsp->rhx;
- hy = rsp->rhy;
- lx = rsp->rlx;
- ly = rsp->rly;
-
- /* find size of room */
- if(secret)
- dx = dy = 1;
- else {
- dx = 2 + rn2((hx-lx-8 > 20) ? 12 : 8);
- dy = 2 + rn2(4);
- if(dx*dy > 50)
- dy = 50/dx;
- }
-
- /* look whether our room will fit */
- if(hx-lx < dx + dx/2 + 2*xlim || hy-ly < dy + dy/3 + 2*ylim) {
- /* no, too small */
- /* maybe we throw this area out */
- if(secret || !rn2(MAXNROFROOMS+1-nroom-tryct)) {
- rscnt--;
- rs[rsmax] = *rsp;
- *rsp = rs[rscnt];
- rs[rscnt] = rs[rsmax];
- tryct = 0;
- } else
- tryct++;
- continue;
- }
-
- lowx = lx + xlim + rn2(hx - lx - dx - 2*xlim + 1);
- lowy = ly + ylim + rn2(hy - ly - dy - 2*ylim + 1);
- hix = lowx + dx;
- hiy = lowy + dy;
-
- if(maker(lowx, dx, lowy, dy)) {
- if(secret)
- return(1);
- addrs(lowx-1, lowy-1, hix+1, hiy+1);
- tryct = 0;
- } else
- if(tryct++ > 100)
- break;
- }
- return(0); /* failed to make vault - very strange */
-}
-
-addrs(lowx,lowy,hix,hiy)
-int lowx,lowy,hix,hiy;
-{
- struct rectangle *rsp;
- int lx,ly,hx,hy,xlim,ylim;
- boolean discarded;
-
- xlim = XLIM + secret;
- ylim = YLIM + secret;
-
- /* walk down since rscnt and rsmax change */
- for(rsp = &rs[rsmax-1]; rsp >= rs; rsp--) {
-
- if((lx = rsp->rlx) > hix || (ly = rsp->rly) > hiy ||
- (hx = rsp->rhx) < lowx || (hy = rsp->rhy) < lowy)
- continue;
- if((discarded = (rsp >= &rs[rscnt]))) {
- *rsp = rs[--rsmax];
- } else {
- rsmax--;
- rscnt--;
- *rsp = rs[rscnt];
- if(rscnt != rsmax)
- rs[rscnt] = rs[rsmax];
- }
- if(lowy - ly > 2*ylim + 4)
- addrsx(lx,ly,hx,lowy-2,discarded);
- if(lowx - lx > 2*xlim + 4)
- addrsx(lx,ly,lowx-2,hy,discarded);
- if(hy - hiy > 2*ylim + 4)
- addrsx(lx,hiy+2,hx,hy,discarded);
- if(hx - hix > 2*xlim + 4)
- addrsx(hix+2,ly,hx,hy,discarded);
- }
-}
-
-addrsx(lx,ly,hx,hy,discarded)
-int lx,ly,hx,hy;
-boolean discarded; /* piece of a discarded area */
-{
- struct rectangle *rsp;
-
- /* check inclusions */
- for(rsp = rs; rsp < &rs[rsmax]; rsp++) {
- if(lx >= rsp->rlx && hx <= rsp->rhx &&
- ly >= rsp->rly && hy <= rsp->rhy)
- return;
- }
-
- /* make a new entry */
- if(rsmax >= MAXRS) {
-#ifdef WIZARD
- if(wizard) pline("MAXRS may be too small.");
-#endif /* WIZARD */
- return;
- }
- rsmax++;
- if(!discarded) {
- *rsp = rs[rscnt];
- rsp = &rs[rscnt];
- rscnt++;
- }
- rsp->rlx = lx;
- rsp->rly = ly;
- rsp->rhx = hx;
- rsp->rhy = hy;
-}
-
-comp(x,y)
-struct mkroom *x,*y;
-{
- if(x->lx < y->lx) return(-1);
- return(x->lx > y->lx);
-}
-
-coord
-finddpos(xl,yl,xh,yh) {
- coord ff;
- int x,y;
-
- x = (xl == xh) ? xl : (xl + rn2(xh-xl+1));
- y = (yl == yh) ? yl : (yl + rn2(yh-yl+1));
- if(okdoor(x, y))
- goto gotit;
-
- for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++)
- if(okdoor(x, y))
- goto gotit;
-
- for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++)
- if(levl[x][y].typ == DOOR || levl[x][y].typ == SDOOR)
- goto gotit;
- /* cannot find something reasonable -- strange */
- x = xl;
- y = yh;
-gotit:
- ff.x = x;
- ff.y = y;
- return(ff);
-}
-
-/* see whether it is allowable to create a door at [x,y] */
-okdoor(x,y)
-int x,y;
-{
- if(levl[x-1][y].typ == DOOR || levl[x+1][y].typ == DOOR ||
- levl[x][y+1].typ == DOOR || levl[x][y-1].typ == DOOR ||
- levl[x-1][y].typ == SDOOR || levl[x+1][y].typ == SDOOR ||
- levl[x][y-1].typ == SDOOR || levl[x][y+1].typ == SDOOR ||
- (levl[x][y].typ != HWALL && levl[x][y].typ != VWALL) ||
- doorindex >= DOORMAX)
- return(0);
- return(1);
-}
-
-dodoor(x,y,aroom)
-int x,y;
-struct mkroom *aroom;
-{
- if(doorindex >= DOORMAX) {
- impossible("DOORMAX exceeded?");
- return;
- }
- if(!okdoor(x,y) && nxcor)
- return;
- dosdoor(x,y,aroom,rn2(8) ? DOOR : SDOOR);
-}
-
-dosdoor(x,y,aroom,type)
-int x,y;
-struct mkroom *aroom;
-int type;
-{
- struct mkroom *broom;
- int tmp;
-
- if(!IS_WALL(levl[x][y].typ)) /* avoid SDOORs with '+' as scrsym */
- type = DOOR;
- levl[x][y].typ = type;
- if(type == DOOR)
- levl[x][y].scrsym = '+';
- aroom->doorct++;
- broom = aroom+1;
- if(broom->hx < 0) tmp = doorindex; else
- for(tmp = doorindex; tmp > broom->fdoor; tmp--)
- doors[tmp] = doors[tmp-1];
- doorindex++;
- doors[tmp].x = x;
- doors[tmp].y = y;
- for( ; broom->hx >= 0; broom++) broom->fdoor++;
-}
-
-/* Only called from makerooms() */
-maker(lowx,ddx,lowy,ddy)
-schar lowx,ddx,lowy,ddy;
-{
- struct mkroom *croom;
- int x, y, hix = lowx+ddx, hiy = lowy+ddy;
- int xlim = XLIM + secret, ylim = YLIM + secret;
-
- if(nroom >= MAXNROFROOMS) return(0);
- if(lowx < XLIM) lowx = XLIM;
- if(lowy < YLIM) lowy = YLIM;
- if(hix > COLNO-XLIM-1) hix = COLNO-XLIM-1;
- if(hiy > ROWNO-YLIM-1) hiy = ROWNO-YLIM-1;
-chk:
- if(hix <= lowx || hiy <= lowy) return(0);
-
- /* check area around room (and make room smaller if necessary) */
- for(x = lowx - xlim; x <= hix + xlim; x++) {
- for(y = lowy - ylim; y <= hiy + ylim; y++) {
- if(levl[x][y].typ) {
-#ifdef WIZARD
- if(wizard && !secret)
- pline("Strange area [%d,%d] in maker().",x,y);
-#endif /* WIZARD */
- if(!rn2(3)) return(0);
- if(x < lowx)
- lowx = x+xlim+1;
- else
- hix = x-xlim-1;
- if(y < lowy)
- lowy = y+ylim+1;
- else
- hiy = y-ylim-1;
- goto chk;
- }
- }
- }
-
- croom = &rooms[nroom];
-
- /* on low levels the room is lit (usually) */
- /* secret vaults are always lit */
- if((rnd(dlevel) < 10 && rn2(77)) || (ddx == 1 && ddy == 1)) {
- for(x = lowx-1; x <= hix+1; x++)
- for(y = lowy-1; y <= hiy+1; y++)
- levl[x][y].lit = 1;
- croom->rlit = 1;
- } else
- croom->rlit = 0;
- croom->lx = lowx;
- croom->hx = hix;
- croom->ly = lowy;
- croom->hy = hiy;
- croom->rtype = croom->doorct = croom->fdoor = 0;
-
- for(x = lowx-1; x <= hix+1; x++)
- for(y = lowy-1; y <= hiy+1; y += (hiy-lowy+2)) {
- levl[x][y].scrsym = '-';
- levl[x][y].typ = HWALL;
- }
- for(x = lowx-1; x <= hix+1; x += (hix-lowx+2))
- for(y = lowy; y <= hiy; y++) {
- levl[x][y].scrsym = '|';
- levl[x][y].typ = VWALL;
- }
- for(x = lowx; x <= hix; x++)
- for(y = lowy; y <= hiy; y++) {
- levl[x][y].scrsym = '.';
- levl[x][y].typ = ROOM;
- }
-
- smeq[nroom] = nroom;
- croom++;
- croom->hx = -1;
- nroom++;
- return(1);
-}
-
-makecorridors() {
- int a,b;
-
- nxcor = 0;
- for(a = 0; a < nroom-1; a++)
- join(a, a+1);
- for(a = 0; a < nroom-2; a++)
- if(smeq[a] != smeq[a+2])
- join(a, a+2);
- for(a = 0; a < nroom; a++)
- for(b = 0; b < nroom; b++)
- if(smeq[a] != smeq[b])
- join(a, b);
- if(nroom > 2)
- for(nxcor = rn2(nroom) + 4; nxcor; nxcor--) {
- a = rn2(nroom);
- b = rn2(nroom-2);
- if(b >= a) b += 2;
- join(a, b);
- }
-}
-
-join(a,b)
-int a,b;
-{
- coord cc,tt;
- int tx, ty, xx, yy;
- struct rm *crm;
- struct mkroom *croom, *troom;
- int dx, dy, dix, diy, cct;
-
- croom = &rooms[a];
- troom = &rooms[b];
-
- /* find positions cc and tt for doors in croom and troom
- and direction for a corridor between them */
-
- if(troom->hx < 0 || croom->hx < 0 || doorindex >= DOORMAX) return;
- if(troom->lx > croom->hx) {
- dx = 1;
- dy = 0;
- xx = croom->hx+1;
- tx = troom->lx-1;
- cc = finddpos(xx,croom->ly,xx,croom->hy);
- tt = finddpos(tx,troom->ly,tx,troom->hy);
- } else if(troom->hy < croom->ly) {
- dy = -1;
- dx = 0;
- yy = croom->ly-1;
- cc = finddpos(croom->lx,yy,croom->hx,yy);
- ty = troom->hy+1;
- tt = finddpos(troom->lx,ty,troom->hx,ty);
- } else if(troom->hx < croom->lx) {
- dx = -1;
- dy = 0;
- xx = croom->lx-1;
- tx = troom->hx+1;
- cc = finddpos(xx,croom->ly,xx,croom->hy);
- tt = finddpos(tx,troom->ly,tx,troom->hy);
- } else {
- dy = 1;
- dx = 0;
- yy = croom->hy+1;
- ty = troom->ly-1;
- cc = finddpos(croom->lx,yy,croom->hx,yy);
- tt = finddpos(troom->lx,ty,troom->hx,ty);
- }
- xx = cc.x;
- yy = cc.y;
- tx = tt.x - dx;
- ty = tt.y - dy;
- if(nxcor && levl[xx+dx][yy+dy].typ)
- return;
- dodoor(xx,yy,croom);
-
- cct = 0;
- while(xx != tx || yy != ty) {
- xx += dx;
- yy += dy;
-
- /* loop: dig corridor at [xx,yy] and find new [xx,yy] */
- if(cct++ > 500 || (nxcor && !rn2(35)))
- return;
-
- if(xx == COLNO-1 || xx == 0 || yy == 0 || yy == ROWNO-1)
- return; /* impossible */
-
- crm = &levl[xx][yy];
- if(!(crm->typ)) {
- if(rn2(100)) {
- crm->typ = CORR;
- crm->scrsym = CORR_SYM;
- if(nxcor && !rn2(50))
- (void) mkobj_at(ROCK_SYM, xx, yy);
- } else {
- crm->typ = SCORR;
- crm->scrsym = ' ';
- }
- } else
- if(crm->typ != CORR && crm->typ != SCORR) {
- /* strange ... */
- return;
- }
-
- /* find next corridor position */
- dix = abs(xx-tx);
- diy = abs(yy-ty);
-
- /* do we have to change direction ? */
- if(dy && dix > diy) {
- int ddx = (xx > tx) ? -1 : 1;
-
- crm = &levl[xx+ddx][yy];
- if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) {
- dx = ddx;
- dy = 0;
- continue;
- }
- } else if(dx && diy > dix) {
- int ddy = (yy > ty) ? -1 : 1;
-
- crm = &levl[xx][yy+ddy];
- if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) {
- dy = ddy;
- dx = 0;
- continue;
- }
- }
-
- /* continue straight on? */
- crm = &levl[xx+dx][yy+dy];
- if(!crm->typ || crm->typ == CORR || crm->typ == SCORR)
- continue;
-
- /* no, what must we do now?? */
- if(dx) {
- dx = 0;
- dy = (ty < yy) ? -1 : 1;
- crm = &levl[xx+dx][yy+dy];
- if(!crm->typ || crm->typ == CORR || crm->typ == SCORR)
- continue;
- dy = -dy;
- continue;
- } else {
- dy = 0;
- dx = (tx < xx) ? -1 : 1;
- crm = &levl[xx+dx][yy+dy];
- if(!crm->typ || crm->typ == CORR || crm->typ == SCORR)
- continue;
- dx = -dx;
- continue;
- }
- }
-
- /* we succeeded in digging the corridor */
- dodoor(tt.x, tt.y, troom);
-
- if(smeq[a] < smeq[b])
- smeq[b] = smeq[a];
- else
- smeq[a] = smeq[b];
-}
-
-make_niches()
-{
- int ct = rnd(nroom/2 + 1);
- while(ct--) makeniche(FALSE);
-}
-
-makevtele()
-{
- makeniche(TRUE);
-}
-
-makeniche(with_trap)
-boolean with_trap;
-{
- struct mkroom *aroom;
- struct rm *rm;
- int vct = 8;
- coord dd;
- int dy,xx,yy;
- struct trap *ttmp;
-
- if(doorindex < DOORMAX)
- while(vct--) {
- aroom = &rooms[rn2(nroom-1)];
- if(aroom->rtype != 0) continue; /* not an ordinary room */
- if(aroom->doorct == 1 && rn2(5)) continue;
- if(rn2(2)) {
- dy = 1;
- dd = finddpos(aroom->lx,aroom->hy+1,aroom->hx,aroom->hy+1);
- } else {
- dy = -1;
- dd = finddpos(aroom->lx,aroom->ly-1,aroom->hx,aroom->ly-1);
- }
- xx = dd.x;
- yy = dd.y;
- if((rm = &levl[xx][yy+dy])->typ) continue;
- if(with_trap || !rn2(4)) {
- rm->typ = SCORR;
- rm->scrsym = ' ';
- if(with_trap) {
- ttmp = maketrap(xx, yy+dy, TELEP_TRAP);
- ttmp->once = 1;
- make_engr_at(xx, yy-dy, "ad ae?ar um");
- }
- dosdoor(xx, yy, aroom, SDOOR);
- } else {
- rm->typ = CORR;
- rm->scrsym = CORR_SYM;
- if(rn2(7))
- dosdoor(xx, yy, aroom, rn2(5) ? SDOOR : DOOR);
- else {
- mksobj_at(SCR_TELEPORTATION, xx, yy+dy);
- if(!rn2(3)) (void) mkobj_at(0, xx, yy+dy);
- }
- }
- return;
- }
-}
-
-/* make a trap somewhere (in croom if mazeflag = 0) */
-mktrap(num,mazeflag,croom)
-int num,mazeflag;
-struct mkroom *croom;
-{
- struct trap *ttmp;
- int kind,nopierc,nomimic,fakedoor,fakegold,tryct = 0;
- xchar mx,my;
- extern char fut_geno[];
-
- if(!num || num >= TRAPNUM) {
- nopierc = (dlevel < 4) ? 1 : 0;
- nomimic = (dlevel < 9 || goldseen ) ? 1 : 0;
- if(index(fut_geno, 'M')) nomimic = 1;
- kind = rn2(TRAPNUM - nopierc - nomimic);
- /* note: PIERC = 7, MIMIC = 8, TRAPNUM = 9 */
- } else kind = num;
-
- if(kind == MIMIC) {
- struct monst *mtmp;
-
- fakedoor = (!rn2(3) && !mazeflag);
- fakegold = (!fakedoor && !rn2(2));
- if(fakegold) goldseen = TRUE;
- do {
- if(++tryct > 200) return;
- if(fakedoor) {
- /* note: fakedoor maybe on actual door */
- if(rn2(2)){
- if(rn2(2))
- mx = croom->hx+1;
- else mx = croom->lx-1;
- my = somey();
- } else {
- if(rn2(2))
- my = croom->hy+1;
- else my = croom->ly-1;
- mx = somex();
- }
- } else if(mazeflag) {
- extern coord mazexy();
- coord mm;
- mm = mazexy();
- mx = mm.x;
- my = mm.y;
- } else {
- mx = somex();
- my = somey();
- }
- } while(m_at(mx,my) || levl[mx][my].typ == STAIRS);
- if(mtmp = makemon(PM_MIMIC,mx,my)) {
- mtmp->mimic = 1;
- mtmp->mappearance =
- fakegold ? '$' : fakedoor ? '+' :
- (mazeflag && rn2(2)) ? AMULET_SYM :
- "=/)%?![<>" [ rn2(9) ];
- }
- return;
- }
-
- do {
- if(++tryct > 200)
- return;
- if(mazeflag){
- extern coord mazexy();
- coord mm;
- mm = mazexy();
- mx = mm.x;
- my = mm.y;
- } else {
- mx = somex();
- my = somey();
- }
- } while(t_at(mx, my) || levl[mx][my].typ == STAIRS);
- ttmp = maketrap(mx, my, kind);
- if(mazeflag && !rn2(10) && ttmp->ttyp < PIERC)
- ttmp->tseen = 1;
-}
diff --git a/games/hack/hack.mkmaze.c b/games/hack/hack.mkmaze.c
deleted file mode 100644
index 769cd5d..0000000
--- a/games/hack/hack.mkmaze.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mkmaze.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include "def.mkroom.h" /* not really used */
-extern struct monst *makemon();
-extern struct permonst pm_wizard;
-extern struct obj *mkobj_at();
-extern coord mazexy();
-struct permonst hell_hound =
- { "hell hound", 'd', 12, 14, 2, 3, 6, 0 };
-
-makemaz()
-{
- int x,y;
- int zx,zy;
- coord mm;
- boolean al = (dlevel >= 30 && !flags.made_amulet);
-
- for(x = 2; x < COLNO-1; x++)
- for(y = 2; y < ROWNO-1; y++)
- levl[x][y].typ = (x%2 && y%2) ? 0 : HWALL;
- if(al) {
- struct monst *mtmp;
-
- zx = 2*(COLNO/4) - 1;
- zy = 2*(ROWNO/4) - 1;
- for(x = zx-2; x < zx+4; x++) for(y = zy-2; y <= zy+2; y++) {
- levl[x][y].typ =
- (y == zy-2 || y == zy+2 || x == zx-2 || x == zx+3) ? POOL :
- (y == zy-1 || y == zy+1 || x == zx-1 || x == zx+2) ? HWALL:
- ROOM;
- }
- (void) mkobj_at(AMULET_SYM, zx, zy);
- flags.made_amulet = 1;
- walkfrom(zx+4, zy);
- if(mtmp = makemon(&hell_hound, zx, zy))
- mtmp->msleep = 1;
- if(mtmp = makemon(PM_WIZARD, zx+1, zy)) {
- mtmp->msleep = 1;
- flags.no_of_wizards = 1;
- }
- } else {
- mm = mazexy();
- zx = mm.x;
- zy = mm.y;
- walkfrom(zx,zy);
- (void) mksobj_at(WAN_WISHING, zx, zy);
- (void) mkobj_at(ROCK_SYM, zx, zy); /* put a rock on top of it */
- }
-
- for(x = 2; x < COLNO-1; x++)
- for(y = 2; y < ROWNO-1; y++) {
- switch(levl[x][y].typ) {
- case HWALL:
- levl[x][y].scrsym = '-';
- break;
- case ROOM:
- levl[x][y].scrsym = '.';
- break;
- }
- }
- for(x = rn1(8,11); x; x--) {
- mm = mazexy();
- (void) mkobj_at(rn2(2) ? GEM_SYM : 0, mm.x, mm.y);
- }
- for(x = rn1(10,2); x; x--) {
- mm = mazexy();
- (void) mkobj_at(ROCK_SYM, mm.x, mm.y);
- }
- mm = mazexy();
- (void) makemon(PM_MINOTAUR, mm.x, mm.y);
- for(x = rn1(5,7); x; x--) {
- mm = mazexy();
- (void) makemon((struct permonst *) 0, mm.x, mm.y);
- }
- for(x = rn1(6,7); x; x--) {
- mm = mazexy();
- mkgold(0L,mm.x,mm.y);
- }
- for(x = rn1(6,7); x; x--)
- mktrap(0,1,(struct mkroom *) 0);
- mm = mazexy();
- levl[(xupstair = mm.x)][(yupstair = mm.y)].scrsym = '<';
- levl[xupstair][yupstair].typ = STAIRS;
- xdnstair = ydnstair = 0;
-}
-
-walkfrom(x,y) int x,y; {
-int q,a,dir;
-int dirs[4];
- levl[x][y].typ = ROOM;
- while(1) {
- q = 0;
- for(a = 0; a < 4; a++)
- if(okay(x,y,a)) dirs[q++]= a;
- if(!q) return;
- dir = dirs[rn2(q)];
- move(&x,&y,dir);
- levl[x][y].typ = ROOM;
- move(&x,&y,dir);
- walkfrom(x,y);
- }
-}
-
-move(x,y,dir)
-int *x, *y;
-int dir;
-{
- switch(dir){
- case 0: --(*y); break;
- case 1: (*x)++; break;
- case 2: (*y)++; break;
- case 3: --(*x); break;
- }
-}
-
-okay(x,y,dir)
-int x,y;
-int dir;
-{
- move(&x,&y,dir);
- move(&x,&y,dir);
- if(x<3 || y<3 || x>COLNO-3 || y>ROWNO-3 || levl[x][y].typ != 0)
- return(0);
- else
- return(1);
-}
-
-coord
-mazexy(){
- coord mm;
- mm.x = 3 + 2*rn2(COLNO/2 - 2);
- mm.y = 3 + 2*rn2(ROWNO/2 - 2);
- return mm;
-}
diff --git a/games/hack/hack.mkobj.c b/games/hack/hack.mkobj.c
deleted file mode 100644
index 7ef1540..0000000
--- a/games/hack/hack.mkobj.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mkobj.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-
-char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%";
-struct obj *mkobj(), *mksobj();
-
-struct obj *
-mkobj_at(let,x,y)
-int let,x,y;
-{
- struct obj *otmp = mkobj(let);
- otmp->ox = x;
- otmp->oy = y;
- otmp->nobj = fobj;
- fobj = otmp;
- return(otmp);
-}
-
-mksobj_at(otyp,x,y)
-int otyp,x,y;
-{
- struct obj *otmp = mksobj(otyp);
- otmp->ox = x;
- otmp->oy = y;
- otmp->nobj = fobj;
- fobj = otmp;
-}
-
-struct obj *
-mkobj(let) {
- if(!let)
- let = mkobjstr[rn2(sizeof(mkobjstr) - 1)];
- return(
- mksobj(
- letter(let) ?
- CORPSE + ((let > 'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@'))
- : probtype(let)
- )
- );
-}
-
-
-struct obj zeroobj;
-
-struct obj *
-mksobj(otyp)
-int otyp;
-{
- struct obj *otmp;
- char let = objects[otyp].oc_olet;
-
- otmp = newobj(0);
- *otmp = zeroobj;
- otmp->age = moves;
- otmp->o_id = flags.ident++;
- otmp->quan = 1;
- otmp->olet = let;
- otmp->otyp = otyp;
- otmp->dknown = index("/=!?*", let) ? 0 : 1;
- switch(let) {
- case WEAPON_SYM:
- otmp->quan = (otmp->otyp <= ROCK) ? rn1(6,6) : 1;
- if(!rn2(11)) otmp->spe = rnd(3);
- else if(!rn2(10)) {
- otmp->cursed = 1;
- otmp->spe = -rnd(3);
- }
- break;
- case FOOD_SYM:
- if(otmp->otyp >= CORPSE) break;
-#ifdef NOT_YET_IMPLEMENTED
- /* if tins are to be identified, need to adapt doname() etc */
- if(otmp->otyp == TIN)
- otmp->spe = rnd(...);
-#endif /* NOT_YET_IMPLEMENTED */
- /* FALLTHROUGH */
- case GEM_SYM:
- otmp->quan = rn2(6) ? 1 : 2;
- case TOOL_SYM:
- case CHAIN_SYM:
- case BALL_SYM:
- case ROCK_SYM:
- case POTION_SYM:
- case SCROLL_SYM:
- case AMULET_SYM:
- break;
- case ARMOR_SYM:
- if(!rn2(8)) otmp->cursed = 1;
- if(!rn2(10)) otmp->spe = rnd(3);
- else if(!rn2(9)) {
- otmp->spe = -rnd(3);
- otmp->cursed = 1;
- }
- break;
- case WAND_SYM:
- if(otmp->otyp == WAN_WISHING) otmp->spe = 3; else
- otmp->spe = rn1(5,
- (objects[otmp->otyp].bits & NODIR) ? 11 : 4);
- break;
- case RING_SYM:
- if(objects[otmp->otyp].bits & SPEC) {
- if(!rn2(3)) {
- otmp->cursed = 1;
- otmp->spe = -rnd(2);
- } else otmp->spe = rnd(2);
- } else if(otmp->otyp == RIN_TELEPORTATION ||
- otmp->otyp == RIN_AGGRAVATE_MONSTER ||
- otmp->otyp == RIN_HUNGER || !rn2(9))
- otmp->cursed = 1;
- break;
- default:
- panic("impossible mkobj");
- }
- otmp->owt = weight(otmp);
- return(otmp);
-}
-
-letter(c) {
- return(('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z'));
-}
-
-weight(obj)
-struct obj *obj;
-{
-int wt = objects[obj->otyp].oc_weight;
- return(wt ? wt*obj->quan : (obj->quan + 1)/2);
-}
-
-mkgold(num,x,y)
-long num;
-{
- struct gold *gold;
- long amount = (num ? num : 1 + (rnd(dlevel+2) * rnd(30)));
-
- if(gold = g_at(x,y))
- gold->amount += amount;
- else {
- gold = newgold();
- gold->ngold = fgold;
- gold->gx = x;
- gold->gy = y;
- gold->amount = amount;
- fgold = gold;
- /* do sth with display? */
- }
-}
diff --git a/games/hack/hack.mkshop.c b/games/hack/hack.mkshop.c
deleted file mode 100644
index c503b7d..0000000
--- a/games/hack/hack.mkshop.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mkshop.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#ifndef QUEST
-#include "hack.h"
-#include "def.mkroom.h"
-#include "def.eshk.h"
-#include <stdlib.h>
-#define ESHK ((struct eshk *)(&(shk->mextra[0])))
-extern struct monst *makemon();
-extern struct obj *mkobj_at();
-extern int nroom;
-extern char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
-schar shprobs[] = { 3,3,5,5,10,10,14,50 }; /* their probabilities */
-
-mkshop(){
-struct mkroom *sroom;
-int sh,sx,sy,i = -1;
-char let;
-int roomno;
-struct monst *shk;
-#ifdef WIZARD
- /* first determine shoptype */
- if(wizard){
- char *ep = getenv("SHOPTYPE");
- if(ep){
- if(*ep == 'z' || *ep == 'Z'){
- mkzoo(ZOO);
- return;
- }
- if(*ep == 'm' || *ep == 'M'){
- mkzoo(MORGUE);
- return;
- }
- if(*ep == 'b' || *ep == 'B'){
- mkzoo(BEEHIVE);
- return;
- }
- if(*ep == 's' || *ep == 'S'){
- mkswamp();
- return;
- }
- for(i=0; shtypes[i]; i++)
- if(*ep == shtypes[i]) break;
- goto gottype;
- }
- }
-gottype:
-#endif /* WIZARD */
- for(sroom = &rooms[0], roomno = 0; ; sroom++, roomno++){
- if(sroom->hx < 0) return;
- if(sroom - rooms >= nroom) {
- pline("rooms not closed by -1?");
- return;
- }
- if(sroom->rtype) continue;
- if(!sroom->rlit || has_dnstairs(sroom) || has_upstairs(sroom))
- continue;
- if(
-#ifdef WIZARD
- (wizard && getenv("SHOPTYPE") && sroom->doorct != 0) ||
-#endif /* WIZARD */
- sroom->doorct <= 2 && sroom->doorct > 0) break;
- }
-
- if(i < 0) { /* shoptype not yet determined */
- int j;
-
- for(j = rn2(100), i = 0; (j -= shprobs[i])>= 0; i++)
- if(!shtypes[i]) break; /* superfluous */
- if(isbig(sroom) && i + SHOPBASE == WANDSHOP)
- i = GENERAL-SHOPBASE;
- }
- sroom->rtype = i + SHOPBASE;
- let = shtypes[i];
- sh = sroom->fdoor;
- sx = doors[sh].x;
- sy = doors[sh].y;
- if(sx == sroom->lx-1) sx++; else
- if(sx == sroom->hx+1) sx--; else
- if(sy == sroom->ly-1) sy++; else
- if(sy == sroom->hy+1) sy--; else {
-#ifdef WIZARD
- /* This is said to happen sometimes, but I've never seen it. */
- if(wizard) {
- int j = sroom->doorct;
- extern int doorindex;
-
- pline("Where is shopdoor?");
- pline("Room at (%d,%d),(%d,%d).", sroom->lx, sroom->ly,
- sroom->hx, sroom->hy);
- pline("doormax=%d doorct=%d fdoor=%d",
- doorindex, sroom->doorct, sh);
- while(j--) {
- pline("door [%d,%d]", doors[sh].x, doors[sh].y);
- sh++;
- }
- more();
- }
-#endif /* WIZARD */
- return;
- }
- if(!(shk = makemon(PM_SHK,sx,sy))) return;
- shk->isshk = shk->mpeaceful = 1;
- shk->msleep = 0;
- shk->mtrapseen = ~0; /* we know all the traps already */
- ESHK->shoproom = roomno;
- ESHK->shoplevel = dlevel;
- ESHK->shd = doors[sh];
- ESHK->shk.x = sx;
- ESHK->shk.y = sy;
- ESHK->robbed = 0;
- ESHK->visitct = 0;
- ESHK->following = 0;
- shk->mgold = 1000 + 30*rnd(100); /* initial capital */
- ESHK->billct = 0;
- findname(ESHK->shknam, let);
- for(sx = sroom->lx; sx <= sroom->hx; sx++)
- for(sy = sroom->ly; sy <= sroom->hy; sy++){
- struct monst *mtmp;
- if((sx == sroom->lx && doors[sh].x == sx-1) ||
- (sx == sroom->hx && doors[sh].x == sx+1) ||
- (sy == sroom->ly && doors[sh].y == sy-1) ||
- (sy == sroom->hy && doors[sh].y == sy+1)) continue;
- if(rn2(100) < dlevel && !m_at(sx,sy) &&
- (mtmp = makemon(PM_MIMIC, sx, sy))){
- mtmp->mimic = 1;
- mtmp->mappearance =
- (let && rn2(10) < dlevel) ? let : ']';
- continue;
- }
- (void) mkobj_at(let, sx, sy);
- }
-}
-
-mkzoo(type)
-int type;
-{
- struct mkroom *sroom;
- struct monst *mon;
- int sh,sx,sy,i;
- int goldlim = 500 * dlevel;
- int moct = 0;
- struct permonst *morguemon();
-
- i = nroom;
- for(sroom = &rooms[rn2(nroom)]; ; sroom++) {
- if(sroom == &rooms[nroom])
- sroom = &rooms[0];
- if(!i-- || sroom->hx < 0)
- return;
- if(sroom->rtype)
- continue;
- if(type == MORGUE && sroom->rlit)
- continue;
- if(has_upstairs(sroom) || (has_dnstairs(sroom) && rn2(3)))
- continue;
- if(sroom->doorct == 1 || !rn2(5))
- break;
- }
- sroom->rtype = type;
- sh = sroom->fdoor;
- for(sx = sroom->lx; sx <= sroom->hx; sx++)
- for(sy = sroom->ly; sy <= sroom->hy; sy++){
- if((sx == sroom->lx && doors[sh].x == sx-1) ||
- (sx == sroom->hx && doors[sh].x == sx+1) ||
- (sy == sroom->ly && doors[sh].y == sy-1) ||
- (sy == sroom->hy && doors[sh].y == sy+1)) continue;
- mon = makemon(
- (type == MORGUE) ? morguemon() :
- (type == BEEHIVE) ? PM_KILLER_BEE : (struct permonst *) 0,
- sx, sy);
- if(mon) mon->msleep = 1;
- switch(type) {
- case ZOO:
- i = sq(dist2(sx,sy,doors[sh].x,doors[sh].y));
- if(i >= goldlim) i = 5*dlevel;
- goldlim -= i;
- mkgold((long)(10 + rn2(i)), sx, sy);
- break;
- case MORGUE:
- /* Usually there is one dead body in the morgue */
- if(!moct && rn2(3)) {
- mksobj_at(CORPSE, sx, sy);
- moct++;
- }
- break;
- case BEEHIVE:
- if(!rn2(3)) mksobj_at(LUMP_OF_ROYAL_JELLY, sx, sy);
- break;
- }
- }
-}
-
-struct permonst *
-morguemon()
-{
- extern struct permonst pm_ghost;
- int i = rn2(100), hd = rn2(dlevel);
-
- if(hd > 10 && i < 10) return(PM_DEMON);
- if(hd > 8 && i > 85) return(PM_VAMPIRE);
- return((i < 40) ? PM_GHOST : (i < 60) ? PM_WRAITH : PM_ZOMBIE);
-}
-
-mkswamp() /* Michiel Huisjes & Fred de Wilde */
-{
- struct mkroom *sroom;
- int sx,sy,i,eelct = 0;
- extern struct permonst pm_eel;
-
- for(i=0; i<5; i++) { /* 5 tries */
- sroom = &rooms[rn2(nroom)];
- if(sroom->hx < 0 || sroom->rtype ||
- has_upstairs(sroom) || has_dnstairs(sroom))
- continue;
-
- /* satisfied; make a swamp */
- sroom->rtype = SWAMP;
- for(sx = sroom->lx; sx <= sroom->hx; sx++)
- for(sy = sroom->ly; sy <= sroom->hy; sy++)
- if((sx+sy)%2 && !o_at(sx,sy) && !t_at(sx,sy)
- && !m_at(sx,sy) && !nexttodoor(sx,sy)){
- levl[sx][sy].typ = POOL;
- levl[sx][sy].scrsym = POOL_SYM;
- if(!eelct || !rn2(4)) {
- (void) makemon(PM_EEL, sx, sy);
- eelct++;
- }
- }
- }
-}
-
-nexttodoor(sx,sy)
-int sx,sy;
-{
- int dx,dy;
- struct rm *lev;
- for(dx = -1; dx <= 1; dx++) for(dy = -1; dy <= 1; dy++)
- if((lev = &levl[sx+dx][sy+dy])->typ == DOOR ||
- lev->typ == SDOOR || lev->typ == LDOOR)
- return(1);
- return(0);
-}
-
-has_dnstairs(sroom)
-struct mkroom *sroom;
-{
- return(sroom->lx <= xdnstair && xdnstair <= sroom->hx &&
- sroom->ly <= ydnstair && ydnstair <= sroom->hy);
-}
-
-has_upstairs(sroom)
-struct mkroom *sroom;
-{
- return(sroom->lx <= xupstair && xupstair <= sroom->hx &&
- sroom->ly <= yupstair && yupstair <= sroom->hy);
-}
-
-isbig(sroom)
-struct mkroom *sroom;
-{
- int area = (sroom->hx - sroom->lx) * (sroom->hy - sroom->ly);
- return( area > 20 );
-}
-
-dist2(x0,y0,x1,y1){
- return((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1));
-}
-
-sq(a) int a; {
- return(a*a);
-}
-#endif /* QUEST */
diff --git a/games/hack/hack.mon.c b/games/hack/hack.mon.c
deleted file mode 100644
index 8cf641b..0000000
--- a/games/hack/hack.mon.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.mon.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include "hack.mfndpos.h"
-
-#ifndef NULL
-#define NULL (char *) 0
-#endif
-
-extern struct monst *makemon();
-extern struct obj *mkobj_at();
-
-int warnlevel; /* used by movemon and dochugw */
-long lastwarntime;
-int lastwarnlev;
-char *warnings[] = {
- "white", "pink", "red", "ruby", "purple", "black"
-};
-
-movemon()
-{
- struct monst *mtmp;
- int fr;
-
- warnlevel = 0;
-
- while(1) {
- /* find a monster that we haven't treated yet */
- /* note that mtmp or mtmp->nmon might get killed
- while mtmp moves, so we cannot just walk down the
- chain (even new monsters might get created!) */
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->mlstmv < moves) goto next_mon;
- /* treated all monsters */
- break;
-
- next_mon:
- mtmp->mlstmv = moves;
-
- /* most monsters drown in pools */
- { boolean inpool, iseel;
-
- inpool = (levl[mtmp->mx][mtmp->my].typ == POOL);
- iseel = (mtmp->data->mlet == ';');
- if(inpool && !iseel) {
- if(cansee(mtmp->mx,mtmp->my))
- pline("%s drowns.", Monnam(mtmp));
- mondead(mtmp);
- continue;
- }
- /* but eels have a difficult time outside */
- if(iseel && !inpool) {
- if(mtmp->mhp > 1) mtmp->mhp--;
- mtmp->mflee = 1;
- mtmp->mfleetim += 2;
- }
- }
- if(mtmp->mblinded && !--mtmp->mblinded)
- mtmp->mcansee = 1;
- if(mtmp->mfleetim && !--mtmp->mfleetim)
- mtmp->mflee = 0;
- if(mtmp->mimic) continue;
- if(mtmp->mspeed != MSLOW || !(moves%2)){
- /* continue if the monster died fighting */
- fr = -1;
- if(Conflict && cansee(mtmp->mx,mtmp->my)
- && (fr = fightm(mtmp)) == 2)
- continue;
- if(fr<0 && dochugw(mtmp))
- continue;
- }
- if(mtmp->mspeed == MFAST && dochugw(mtmp))
- continue;
- }
-
- warnlevel -= u.ulevel;
- if(warnlevel >= SIZE(warnings))
- warnlevel = SIZE(warnings)-1;
- if(warnlevel >= 0)
- if(warnlevel > lastwarnlev || moves > lastwarntime + 5){
- char *rr;
- switch(Warning & (LEFT_RING | RIGHT_RING)){
- case LEFT_RING:
- rr = "Your left ring glows";
- break;
- case RIGHT_RING:
- rr = "Your right ring glows";
- break;
- case LEFT_RING | RIGHT_RING:
- rr = "Both your rings glow";
- break;
- default:
- rr = "Your fingertips glow";
- break;
- }
- pline("%s %s!", rr, warnings[warnlevel]);
- lastwarntime = moves;
- lastwarnlev = warnlevel;
- }
-
- dmonsfree(); /* remove all dead monsters */
-}
-
-justswld(mtmp,name)
-struct monst *mtmp;
-char *name;
-{
-
- mtmp->mx = u.ux;
- mtmp->my = u.uy;
- u.ustuck = mtmp;
- pmon(mtmp);
- kludge("%s swallows you!",name);
- more();
- seeoff(1);
- u.uswallow = 1;
- u.uswldtim = 0;
- swallowed();
-}
-
-youswld(mtmp,dam,die,name)
-struct monst *mtmp;
-int dam,die;
-char *name;
-{
- if(mtmp != u.ustuck) return;
- kludge("%s digests you!",name);
- u.uhp -= dam;
- if(u.uswldtim++ >= die){ /* a3 */
- pline("It totally digests you!");
- u.uhp = -1;
- }
- if(u.uhp < 1) done_in_by(mtmp);
- /* flags.botlx = 1; */ /* should we show status line ? */
-}
-
-dochugw(mtmp) struct monst *mtmp; {
-int x = mtmp->mx;
-int y = mtmp->my;
-int d = dochug(mtmp);
-int dd;
- if(!d) /* monster still alive */
- if(Warning)
- if(!mtmp->mpeaceful)
- if(mtmp->data->mlevel > warnlevel)
- if((dd = dist(mtmp->mx,mtmp->my)) < dist(x,y))
- if(dd < 100)
- if(!canseemon(mtmp))
- warnlevel = mtmp->data->mlevel;
- return(d);
-}
-
-/* returns 1 if monster died moving, 0 otherwise */
-dochug(mtmp)
-struct monst *mtmp;
-{
- struct permonst *mdat;
- int tmp, nearby, scared;
-
- if(mtmp->cham && !rn2(6))
- (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]);
- mdat = mtmp->data;
- if(mdat->mlevel < 0)
- panic("bad monster %c (%d)",mdat->mlet,mdat->mlevel);
-
- /* regenerate monsters */
- if((!(moves%20) || index(MREGEN, mdat->mlet)) &&
- mtmp->mhp < mtmp->mhpmax)
- mtmp->mhp++;
-
- if(mtmp->mfroz) return(0); /* frozen monsters don't do anything */
-
- if(mtmp->msleep) {
- /* wake up, or get out of here. */
- /* ettins are hard to surprise */
- /* Nymphs and Leprechauns do not easily wake up */
- if(cansee(mtmp->mx,mtmp->my) &&
- (!Stealth || (mdat->mlet == 'e' && rn2(10))) &&
- (!index("NL",mdat->mlet) || !rn2(50)) &&
- (Aggravate_monster || index("d1", mdat->mlet)
- || (!rn2(7) && !mtmp->mimic)))
- mtmp->msleep = 0;
- else return(0);
- }
-
- /* not frozen or sleeping: wipe out texts written in the dust */
- wipe_engr_at(mtmp->mx, mtmp->my, 1);
-
- /* confused monsters get unconfused with small probability */
- if(mtmp->mconf && !rn2(50)) mtmp->mconf = 0;
-
- /* some monsters teleport */
- if(mtmp->mflee && index("tNL", mdat->mlet) && !rn2(40)){
- rloc(mtmp);
- return(0);
- }
- if(mdat->mmove < rnd(6)) return(0);
-
- /* fleeing monsters might regain courage */
- if(mtmp->mflee && !mtmp->mfleetim
- && mtmp->mhp == mtmp->mhpmax && !rn2(25))
- mtmp->mflee = 0;
-
- nearby = (dist(mtmp->mx, mtmp->my) < 3);
- scared = (nearby && (sengr_at("Elbereth", u.ux, u.uy) ||
- sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy)));
- if(scared && !mtmp->mflee) {
- mtmp->mflee = 1;
- mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100));
- }
-
- if(!nearby ||
- mtmp->mflee ||
- mtmp->mconf ||
- (mtmp->minvis && !rn2(3)) ||
- (index("BIuy", mdat->mlet) && !rn2(4)) ||
- (mdat->mlet == 'L' && !u.ugold && (mtmp->mgold || rn2(2))) ||
- (!mtmp->mcansee && !rn2(4)) ||
- mtmp->mpeaceful
- ) {
- tmp = m_move(mtmp,0); /* 2: monster died moving */
- if(tmp == 2 || (tmp && mdat->mmove <= 12))
- return(tmp == 2);
- }
-
- if(!index("Ea", mdat->mlet) && nearby &&
- !mtmp->mpeaceful && u.uhp > 0 && !scared) {
- if(mhitu(mtmp))
- return(1); /* monster died (e.g. 'y' or 'F') */
- }
- /* extra movement for fast monsters */
- if(mdat->mmove-12 > rnd(12)) tmp = m_move(mtmp,1);
- return(tmp == 2);
-}
-
-m_move(mtmp,after)
-struct monst *mtmp;
-{
- struct monst *mtmp2;
- int nx,ny,omx,omy,appr,nearer,cnt,i,j;
- xchar gx,gy,nix,niy,chcnt;
- schar chi;
- boolean likegold, likegems, likeobjs;
- char msym = mtmp->data->mlet;
- schar mmoved = 0; /* not strictly nec.: chi >= 0 will do */
- coord poss[9];
- int info[9];
-
- if(mtmp->mfroz || mtmp->msleep)
- return(0);
- if(mtmp->mtrapped) {
- i = mintrap(mtmp);
- if(i == 2) return(2); /* he died */
- if(i == 1) return(0); /* still in trap, so didnt move */
- }
- if(mtmp->mhide && o_at(mtmp->mx,mtmp->my) && rn2(10))
- return(0); /* do not leave hiding place */
-
-#ifndef NOWORM
- if(mtmp->wormno)
- goto not_special;
-#endif /* NOWORM */
-
- /* my dog gets a special treatment */
- if(mtmp->mtame) {
- return( dog_move(mtmp, after) );
- }
-
- /* likewise for shopkeeper */
- if(mtmp->isshk) {
- mmoved = shk_move(mtmp);
- if(mmoved >= 0)
- goto postmov;
- mmoved = 0; /* follow player outside shop */
- }
-
- /* and for the guard */
- if(mtmp->isgd) {
- mmoved = gd_move();
- goto postmov;
- }
-
-/* teleport if that lies in our nature ('t') or when badly wounded ('1') */
- if((msym == 't' && !rn2(5))
- || (msym == '1' && (mtmp->mhp < 7 || (!xdnstair && !rn2(5))
- || levl[u.ux][u.uy].typ == STAIRS))) {
- if(mtmp->mhp < 7 || (msym == 't' && rn2(2)))
- rloc(mtmp);
- else
- mnexto(mtmp);
- mmoved = 1;
- goto postmov;
- }
-
- /* spit fire ('D') or use a wand ('1') when appropriate */
- if(index("D1", msym))
- inrange(mtmp);
-
- if(msym == 'U' && !mtmp->mcan && canseemon(mtmp) &&
- mtmp->mcansee && rn2(5)) {
- if(!Confusion)
- pline("%s's gaze has confused you!", Monnam(mtmp));
- else
- pline("You are getting more and more confused.");
- if(rn2(3)) mtmp->mcan = 1;
- Confusion += d(3,4); /* timeout */
- }
-not_special:
- if(!mtmp->mflee && u.uswallow && u.ustuck != mtmp) return(1);
- appr = 1;
- if(mtmp->mflee) appr = -1;
- if(mtmp->mconf || Invis || !mtmp->mcansee ||
- (index("BIy", msym) && !rn2(3)))
- appr = 0;
- omx = mtmp->mx;
- omy = mtmp->my;
- gx = u.ux;
- gy = u.uy;
- if(msym == 'L' && appr == 1 && mtmp->mgold > u.ugold)
- appr = -1;
-
- /* random criterion for 'smell' or track finding ability
- should use mtmp->msmell or sth
- */
- if(msym == '@' ||
- ('a' <= msym && msym <= 'z')) {
- extern coord *gettrack();
- coord *cp;
- schar mroom;
- mroom = inroom(omx,omy);
- if(mroom < 0 || mroom != inroom(u.ux,u.uy)){
- cp = gettrack(omx,omy);
- if(cp){
- gx = cp->x;
- gy = cp->y;
- }
- }
- }
-
- /* look for gold or jewels nearby */
- likegold = (index("LOD", msym) != NULL);
- likegems = (index("ODu", msym) != NULL);
- likeobjs = mtmp->mhide;
-#define SRCHRADIUS 25
- { xchar mind = SRCHRADIUS; /* not too far away */
- int dd;
- if(likegold){
- struct gold *gold;
- for(gold = fgold; gold; gold = gold->ngold)
- if((dd = DIST(omx,omy,gold->gx,gold->gy)) < mind){
- mind = dd;
- gx = gold->gx;
- gy = gold->gy;
- }
- }
- if(likegems || likeobjs){
- struct obj *otmp;
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(likeobjs || otmp->olet == GEM_SYM)
- if(msym != 'u' ||
- objects[otmp->otyp].g_val != 0)
- if((dd = DIST(omx,omy,otmp->ox,otmp->oy)) < mind){
- mind = dd;
- gx = otmp->ox;
- gy = otmp->oy;
- }
- }
- if(mind < SRCHRADIUS && appr == -1) {
- if(dist(omx,omy) < 10) {
- gx = u.ux;
- gy = u.uy;
- } else
- appr = 1;
- }
- }
- nix = omx;
- niy = omy;
- cnt = mfndpos(mtmp,poss,info,
- msym == 'u' ? NOTONL :
- (msym == '@' || msym == '1') ? (ALLOW_SSM | ALLOW_TRAPS) :
- index(UNDEAD, msym) ? NOGARLIC : ALLOW_TRAPS);
- /* ALLOW_ROCK for some monsters ? */
- chcnt = 0;
- chi = -1;
- for(i=0; i<cnt; i++) {
- nx = poss[i].x;
- ny = poss[i].y;
- for(j=0; j<MTSZ && j<cnt-1; j++)
- if(nx == mtmp->mtrack[j].x && ny == mtmp->mtrack[j].y)
- if(rn2(4*(cnt-j))) goto nxti;
-#ifdef STUPID
- /* some stupid compilers think that this is too complicated */
- { int d1 = DIST(nx,ny,gx,gy);
- int d2 = DIST(nix,niy,gx,gy);
- nearer = (d1 < d2);
- }
-#else
- nearer = (DIST(nx,ny,gx,gy) < DIST(nix,niy,gx,gy));
-#endif /* STUPID */
- if((appr == 1 && nearer) || (appr == -1 && !nearer) ||
- !mmoved ||
- (!appr && !rn2(++chcnt))){
- nix = nx;
- niy = ny;
- chi = i;
- mmoved = 1;
- }
- nxti: ;
- }
- if(mmoved){
- if(info[chi] & ALLOW_M){
- mtmp2 = m_at(nix,niy);
- if(hitmm(mtmp,mtmp2) == 1 && rn2(4) &&
- hitmm(mtmp2,mtmp) == 2) return(2);
- return(0);
- }
- if(info[chi] & ALLOW_U){
- (void) hitu(mtmp, d(mtmp->data->damn, mtmp->data->damd)+1);
- return(0);
- }
- mtmp->mx = nix;
- mtmp->my = niy;
- for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1];
- mtmp->mtrack[0].x = omx;
- mtmp->mtrack[0].y = omy;
-#ifndef NOWORM
- if(mtmp->wormno) worm_move(mtmp);
-#endif /* NOWORM */
- } else {
- if(msym == 'u' && rn2(2)){
- rloc(mtmp);
- return(0);
- }
-#ifndef NOWORM
- if(mtmp->wormno) worm_nomove(mtmp);
-#endif /* NOWORM */
- }
-postmov:
- if(mmoved == 1) {
- if(mintrap(mtmp) == 2) /* he died */
- return(2);
- if(likegold) mpickgold(mtmp);
- if(likegems) mpickgems(mtmp);
- if(mtmp->mhide) mtmp->mundetected = 1;
- }
- pmon(mtmp);
- return(mmoved);
-}
-
-mpickgold(mtmp) struct monst *mtmp; {
-struct gold *gold;
- while(gold = g_at(mtmp->mx, mtmp->my)){
- mtmp->mgold += gold->amount;
- freegold(gold);
- if(levl[mtmp->mx][mtmp->my].scrsym == '$')
- newsym(mtmp->mx, mtmp->my);
- }
-}
-
-mpickgems(mtmp) struct monst *mtmp; {
-struct obj *otmp;
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->olet == GEM_SYM)
- if(otmp->ox == mtmp->mx && otmp->oy == mtmp->my)
- if(mtmp->data->mlet != 'u' || objects[otmp->otyp].g_val != 0){
- freeobj(otmp);
- mpickobj(mtmp, otmp);
- if(levl[mtmp->mx][mtmp->my].scrsym == GEM_SYM)
- newsym(mtmp->mx, mtmp->my); /* %% */
- return; /* pick only one object */
- }
-}
-
-/* return number of acceptable neighbour positions */
-mfndpos(mon,poss,info,flag)
-struct monst *mon;
-coord poss[9];
-int info[9], flag;
-{
- int x,y,nx,ny,cnt = 0,ntyp;
- struct monst *mtmp;
- int nowtyp;
- boolean pool;
-
- x = mon->mx;
- y = mon->my;
- nowtyp = levl[x][y].typ;
-
- pool = (mon->data->mlet == ';');
-nexttry: /* eels prefer the water, but if there is no water nearby,
- they will crawl over land */
- if(mon->mconf) {
- flag |= ALLOW_ALL;
- flag &= ~NOTONL;
- }
- for(nx = x-1; nx <= x+1; nx++) for(ny = y-1; ny <= y+1; ny++)
- if(nx != x || ny != y) if(isok(nx,ny))
- if(!IS_ROCK(ntyp = levl[nx][ny].typ))
- if(!(nx != x && ny != y && (nowtyp == DOOR || ntyp == DOOR)))
- if((ntyp == POOL) == pool) {
- info[cnt] = 0;
- if(nx == u.ux && ny == u.uy){
- if(!(flag & ALLOW_U)) continue;
- info[cnt] = ALLOW_U;
- } else if(mtmp = m_at(nx,ny)){
- if(!(flag & ALLOW_M)) continue;
- info[cnt] = ALLOW_M;
- if(mtmp->mtame){
- if(!(flag & ALLOW_TM)) continue;
- info[cnt] |= ALLOW_TM;
- }
- }
- if(sobj_at(CLOVE_OF_GARLIC, nx, ny)) {
- if(flag & NOGARLIC) continue;
- info[cnt] |= NOGARLIC;
- }
- if(sobj_at(SCR_SCARE_MONSTER, nx, ny) ||
- (!mon->mpeaceful && sengr_at("Elbereth", nx, ny))) {
- if(!(flag & ALLOW_SSM)) continue;
- info[cnt] |= ALLOW_SSM;
- }
- if(sobj_at(ENORMOUS_ROCK, nx, ny)) {
- if(!(flag & ALLOW_ROCK)) continue;
- info[cnt] |= ALLOW_ROCK;
- }
- if(!Invis && online(nx,ny)){
- if(flag & NOTONL) continue;
- info[cnt] |= NOTONL;
- }
- /* we cannot avoid traps of an unknown kind */
- { struct trap *ttmp = t_at(nx, ny);
- int tt;
- if(ttmp) {
- tt = 1 << ttmp->ttyp;
- if(mon->mtrapseen & tt){
- if(!(flag & tt)) continue;
- info[cnt] |= tt;
- }
- }
- }
- poss[cnt].x = nx;
- poss[cnt].y = ny;
- cnt++;
- }
- if(!cnt && pool && nowtyp != POOL) {
- pool = FALSE;
- goto nexttry;
- }
- return(cnt);
-}
-
-dist(x,y) int x,y; {
- return((x-u.ux)*(x-u.ux) + (y-u.uy)*(y-u.uy));
-}
-
-poisoned(string, pname)
-char *string, *pname;
-{
- int i;
-
- if(Blind) pline("It was poisoned.");
- else pline("The %s was poisoned!",string);
- if(Poison_resistance) {
- pline("The poison doesn't seem to affect you.");
- return;
- }
- i = rn2(10);
- if(i == 0) {
- u.uhp = -1;
- pline("I am afraid the poison was deadly ...");
- } else if(i <= 5) {
- losestr(rn1(3,3));
- } else {
- losehp(rn1(10,6), pname);
- }
- if(u.uhp < 1) {
- killer = pname;
- done("died");
- }
-}
-
-mondead(mtmp)
-struct monst *mtmp;
-{
- relobj(mtmp,1);
- unpmon(mtmp);
- relmon(mtmp);
- unstuck(mtmp);
- if(mtmp->isshk) shkdead(mtmp);
- if(mtmp->isgd) gddead();
-#ifndef NOWORM
- if(mtmp->wormno) wormdead(mtmp);
-#endif /* NOWORM */
- monfree(mtmp);
-}
-
-/* called when monster is moved to larger structure */
-replmon(mtmp,mtmp2)
-struct monst *mtmp, *mtmp2;
-{
- relmon(mtmp);
- monfree(mtmp);
- mtmp2->nmon = fmon;
- fmon = mtmp2;
- if(u.ustuck == mtmp) u.ustuck = mtmp2;
- if(mtmp2->isshk) replshk(mtmp,mtmp2);
- if(mtmp2->isgd) replgd(mtmp,mtmp2);
-}
-
-relmon(mon)
-struct monst *mon;
-{
- struct monst *mtmp;
-
- if(mon == fmon) fmon = fmon->nmon;
- else {
- for(mtmp = fmon; mtmp->nmon != mon; mtmp = mtmp->nmon) ;
- mtmp->nmon = mon->nmon;
- }
-}
-
-/* we do not free monsters immediately, in order to have their name
- available shortly after their demise */
-struct monst *fdmon; /* chain of dead monsters, need not to be saved */
-
-monfree(mtmp) struct monst *mtmp; {
- mtmp->nmon = fdmon;
- fdmon = mtmp;
-}
-
-dmonsfree(){
-struct monst *mtmp;
- while(mtmp = fdmon){
- fdmon = mtmp->nmon;
- free((char *) mtmp);
- }
-}
-
-unstuck(mtmp)
-struct monst *mtmp;
-{
- if(u.ustuck == mtmp) {
- if(u.uswallow){
- u.ux = mtmp->mx;
- u.uy = mtmp->my;
- u.uswallow = 0;
- setsee();
- docrt();
- }
- u.ustuck = 0;
- }
-}
-
-killed(mtmp)
-struct monst *mtmp;
-{
-#ifdef lint
-#define NEW_SCORING
-#endif /* lint */
- int tmp,tmp2,nk,x,y;
- struct permonst *mdat;
- extern long newuexp();
-
- if(mtmp->cham) mtmp->data = PM_CHAMELEON;
- mdat = mtmp->data;
- if(Blind) pline("You destroy it!");
- else {
- pline("You destroy %s!",
- mtmp->mtame ? amonnam(mtmp, "poor") : monnam(mtmp));
- }
- if(u.umconf) {
- if(!Blind) pline("Your hands stop glowing blue.");
- u.umconf = 0;
- }
-
- /* count killed monsters */
-#define MAXMONNO 100
- nk = 1; /* in case we cannot find it in mons */
- tmp = mdat - mons; /* index in mons array (if not 'd', '@', ...) */
- if(tmp >= 0 && tmp < CMNUM+2) {
- extern char fut_geno[];
- u.nr_killed[tmp]++;
- if((nk = u.nr_killed[tmp]) > MAXMONNO &&
- !index(fut_geno, mdat->mlet))
- charcat(fut_geno, mdat->mlet);
- }
-
- /* punish bad behaviour */
- if(mdat->mlet == '@') Telepat = 0, u.uluck -= 2;
- if(mtmp->mpeaceful || mtmp->mtame) u.uluck--;
- if(mdat->mlet == 'u') u.uluck -= 5;
- if((int)u.uluck < LUCKMIN) u.uluck = LUCKMIN;
-
- /* give experience points */
- tmp = 1 + mdat->mlevel * mdat->mlevel;
- if(mdat->ac < 3) tmp += 2*(7 - mdat->ac);
- if(index("AcsSDXaeRTVWU&In:P", mdat->mlet))
- tmp += 2*mdat->mlevel;
- if(index("DeV&P",mdat->mlet)) tmp += (7*mdat->mlevel);
- if(mdat->mlevel > 6) tmp += 50;
- if(mdat->mlet == ';') tmp += 1000;
-
-#ifdef NEW_SCORING
- /* ------- recent addition: make nr of points decrease
- when this is not the first of this kind */
- { int ul = u.ulevel;
- int ml = mdat->mlevel;
-
- if(ul < 14) /* points are given based on present and future level */
- for(tmp2 = 0; !tmp2 || ul + tmp2 <= ml; tmp2++)
- if(u.uexp + 1 + (tmp + ((tmp2 <= 0) ? 0 : 4<<(tmp2-1)))/nk
- >= 10*pow((unsigned)(ul-1)))
- if(++ul == 14) break;
-
- tmp2 = ml - ul -1;
- tmp = (tmp + ((tmp2 < 0) ? 0 : 4<<tmp2))/nk;
- if(!tmp) tmp = 1;
- }
- /* note: ul is not necessarily the future value of u.ulevel */
- /* ------- end of recent valuation change ------- */
-#endif /* NEW_SCORING */
-
- more_experienced(tmp,0);
- flags.botl = 1;
- while(u.ulevel < 14 && u.uexp >= newuexp()){
- pline("Welcome to experience level %u.", ++u.ulevel);
- tmp = rnd(10);
- if(tmp < 3) tmp = rnd(10);
- u.uhpmax += tmp;
- u.uhp += tmp;
- flags.botl = 1;
- }
-
- /* dispose of monster and make cadaver */
- x = mtmp->mx; y = mtmp->my;
- mondead(mtmp);
- tmp = mdat->mlet;
- if(tmp == 'm') { /* he killed a minotaur, give him a wand of digging */
- /* note: the dead minotaur will be on top of it! */
- mksobj_at(WAN_DIGGING, x, y);
- /* if(cansee(x,y)) atl(x,y,fobj->olet); */
- stackobj(fobj);
- } else
-#ifndef NOWORM
- if(tmp == 'w') {
- mksobj_at(WORM_TOOTH, x, y);
- stackobj(fobj);
- } else
-#endif /* NOWORM */
- if(!letter(tmp) || (!index("mw", tmp) && !rn2(3))) tmp = 0;
-
- if(ACCESSIBLE(levl[x][y].typ)) /* might be mimic in wall or dead eel*/
- if(x != u.ux || y != u.uy) /* might be here after swallowed */
- if(index("NTVm&",mdat->mlet) || rn2(5)) {
- struct obj *obj2 = mkobj_at(tmp,x,y);
- if(cansee(x,y))
- atl(x,y,obj2->olet);
- stackobj(obj2);
- }
-}
-
-kludge(str,arg)
-char *str,*arg;
-{
- if(Blind) {
- if(*str == '%') pline(str,"It");
- else pline(str,"it");
- } else pline(str,arg);
-}
-
-rescham() /* force all chameleons to become normal */
-{
- struct monst *mtmp;
-
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->cham) {
- mtmp->cham = 0;
- (void) newcham(mtmp, PM_CHAMELEON);
- }
-}
-
-newcham(mtmp,mdat) /* make a chameleon look like a new monster */
- /* returns 1 if the monster actually changed */
-struct monst *mtmp;
-struct permonst *mdat;
-{
- int mhp, hpn, hpd;
-
- if(mdat == mtmp->data) return(0); /* still the same monster */
-#ifndef NOWORM
- if(mtmp->wormno) wormdead(mtmp); /* throw tail away */
-#endif /* NOWORM */
- if (u.ustuck == mtmp) {
- if (u.uswallow) {
- u.uswallow = 0;
- u.uswldtim = 0;
- mnexto (mtmp);
- docrt ();
- prme ();
- }
- u.ustuck = 0;
- }
- hpn = mtmp->mhp;
- hpd = (mtmp->data->mlevel)*8;
- if(!hpd) hpd = 4;
- mtmp->data = mdat;
- mhp = (mdat->mlevel)*8;
- /* new hp: same fraction of max as before */
- mtmp->mhp = 2 + (hpn*mhp)/hpd;
- hpn = mtmp->mhpmax;
- mtmp->mhpmax = 2 + (hpn*mhp)/hpd;
- mtmp->minvis = (mdat->mlet == 'I') ? 1 : 0;
-#ifndef NOWORM
- if(mdat->mlet == 'w' && getwn(mtmp)) initworm(mtmp);
- /* perhaps we should clear mtmp->mtame here? */
-#endif /* NOWORM */
- unpmon(mtmp); /* necessary for 'I' and to force pmon */
- pmon(mtmp);
- return(1);
-}
-
-mnexto(mtmp) /* Make monster mtmp next to you (if possible) */
-struct monst *mtmp;
-{
- extern coord enexto();
- coord mm;
- mm = enexto(u.ux, u.uy);
- mtmp->mx = mm.x;
- mtmp->my = mm.y;
- pmon(mtmp);
-}
-
-ishuman(mtmp) struct monst *mtmp; {
- return(mtmp->data->mlet == '@');
-}
-
-setmangry(mtmp) struct monst *mtmp; {
- if(!mtmp->mpeaceful) return;
- if(mtmp->mtame) return;
- mtmp->mpeaceful = 0;
- if(ishuman(mtmp)) pline("%s gets angry!", Monnam(mtmp));
-}
-
-/* not one hundred procent correct: now a snake may hide under an
- invisible object */
-canseemon(mtmp)
-struct monst *mtmp;
-{
- return((!mtmp->minvis || See_invisible)
- && (!mtmp->mhide || !o_at(mtmp->mx,mtmp->my))
- && cansee(mtmp->mx, mtmp->my));
-}
diff --git a/games/hack/hack.monst.c b/games/hack/hack.monst.c
deleted file mode 100644
index 78c2a2e..0000000
--- a/games/hack/hack.monst.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.monst.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include "def.eshk.h"
-extern char plname[PL_NSIZ];
-
-struct permonst mons[CMNUM+2] = {
- { "bat", 'B',1,22,8,1,4,0 },
- { "gnome", 'G',1,6,5,1,6,0 },
- { "hobgoblin", 'H',1,9,5,1,8,0 },
- { "jackal", 'J',0,12,7,1,2,0 },
- { "kobold", 'K',1,6,7,1,4,0 },
- { "leprechaun", 'L',5,15,8,1,2,0 },
- { "giant rat", 'r',0,12,7,1,3,0 },
- { "acid blob", 'a',2,3,8,0,0,0 },
- { "floating eye", 'E',2,1,9,0,0,0 },
- { "homunculus", 'h',2,6,6,1,3,0 },
- { "imp", 'i',2,6,2,1,4,0 },
- { "orc", 'O',2,9,6,1,8,0 },
- { "yellow light", 'y',3,15,0,0,0,0 },
- { "zombie", 'Z',2,6,8,1,8,0 },
- { "giant ant", 'A',3,18,3,1,6,0 },
- { "fog cloud", 'f',3,1,0,1,6,0 },
- { "nymph", 'N',6,12,9,1,2,0 },
- { "piercer", 'p',3,1,3,2,6,0 },
- { "quasit", 'Q',3,15,3,1,4,0 },
- { "quivering blob", 'q',3,1,8,1,8,0 },
- { "violet fungi", 'v',3,1,7,1,4,0 },
- { "giant beetle", 'b',4,6,4,3,4,0 },
- { "centaur", 'C',4,18,4,1,6,0 },
- { "cockatrice", 'c',4,6,6,1,3,0 },
- { "gelatinous cube", 'g',4,6,8,2,4,0 },
- { "jaguar", 'j',4,15,6,1,8,0 },
- { "killer bee", 'k',4,14,4,2,4,0 },
- { "snake", 'S',4,15,3,1,6,0 },
- { "freezing sphere", 'F',2,13,4,0,0,0 },
- { "owlbear", 'o',5,12,5,2,6,0 },
- { "rust monster", 'R',10,18,3,0,0,0 },
- { "scorpion", 's',5,15,3,1,4,0 },
- { "tengu", 't',5,13,5,1,7,0 },
- { "wraith", 'W',5,12,5,1,6,0 },
-#ifdef NOWORM
- { "wumpus", 'w',8,3,2,3,6,0 },
-#else
- { "long worm", 'w',8,3,5,1,4,0 },
-#endif /* NOWORM */
- { "large dog", 'd',6,15,4,2,4,0 },
- { "leocrotta", 'l',6,18,4,3,6,0 },
- { "mimic", 'M',7,3,7,3,4,0 },
- { "troll", 'T',7,12,4,2,7,0 },
- { "unicorn", 'u',8,24,5,1,10,0 },
- { "yeti", 'Y',5,15,6,1,6,0 },
- { "stalker", 'I',8,12,3,4,4,0 },
- { "umber hulk", 'U',9,6,2,2,10,0 },
- { "vampire", 'V',8,12,1,1,6,0 },
- { "xorn", 'X',8,9,-2,4,6,0 },
- { "xan", 'x',7,18,-2,2,4,0 },
- { "zruty", 'z',9,8,3,3,6,0 },
- { "chameleon", ':',6,5,6,4,2,0 },
- { "dragon", 'D',10,9,-1,3,8,0 },
- { "ettin", 'e',10,12,3,2,8,0 },
- { "lurker above", '\'',10,3,3,0,0,0 },
- { "nurse", 'n',11,6,0,1,3,0 },
- { "trapper", ',',12,3,3,0,0,0 },
- { "purple worm", 'P',15,9,6,2,8,0 },
- { "demon", '&',10,12,-4,1,4,0 },
- { "minotaur", 'm',15,15,6,4,10,0 },
- { "shopkeeper", '@', 12, 18, 0, 4, 8, sizeof(struct eshk) }
-};
-
-struct permonst pm_ghost = { "ghost", ' ', 10, 3, -5, 1, 1, sizeof(plname) };
-struct permonst pm_wizard = {
- "wizard of Yendor", '1', 15, 12, -2, 1, 12, 0
-};
-#ifdef MAIL
-struct permonst pm_mail_daemon = { "mail daemon", '2', 100, 1, 10, 0, 0, 0 };
-#endif /* MAIL */
-struct permonst pm_eel = { "giant eel", ';', 15, 6, -3, 3, 6, 0 };
diff --git a/games/hack/hack.o_init.c b/games/hack/hack.o_init.c
deleted file mode 100644
index 0bb9418..0000000
--- a/games/hack/hack.o_init.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.o_init.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <string.h>
-#include "config.h" /* for typedefs */
-#include "def.objects.h"
-#include "hack.onames.h" /* for LAST_GEM */
-extern char *index();
-
-int
-letindex(let) char let; {
-int i = 0;
-char ch;
- while((ch = obj_symbols[i++]) != 0)
- if(ch == let) return(i);
- return(0);
-}
-
-init_objects(){
-int i, j, first, last, sum, end;
-char let, *tmp;
- /* init base; if probs given check that they add up to 100,
- otherwise compute probs; shuffle descriptions */
- end = SIZE(objects);
- first = 0;
- while( first < end ) {
- let = objects[first].oc_olet;
- last = first+1;
- while(last < end && objects[last].oc_olet == let
- && objects[last].oc_name != NULL)
- last++;
- i = letindex(let);
- if((!i && let != ILLOBJ_SYM) || bases[i] != 0)
- error("initialization error");
- bases[i] = first;
-
- if(let == GEM_SYM)
- setgemprobs();
- check:
- sum = 0;
- for(j = first; j < last; j++) sum += objects[j].oc_prob;
- if(sum == 0) {
- for(j = first; j < last; j++)
- objects[j].oc_prob = (100+j-first)/(last-first);
- goto check;
- }
- if(sum != 100)
- error("init-prob error for %c", let);
-
- if(objects[first].oc_descr != NULL && let != TOOL_SYM){
- /* shuffle, also some additional descriptions */
- while(last < end && objects[last].oc_olet == let)
- last++;
- j = last;
- while(--j > first) {
- i = first + rn2(j+1-first);
- tmp = objects[j].oc_descr;
- objects[j].oc_descr = objects[i].oc_descr;
- objects[i].oc_descr = tmp;
- }
- }
- first = last;
- }
-}
-
-probtype(let) char let; {
-int i = bases[letindex(let)];
-int prob = rn2(100);
- while((prob -= objects[i].oc_prob) >= 0) i++;
- if(objects[i].oc_olet != let || !objects[i].oc_name)
- panic("probtype(%c) error, i=%d", let, i);
- return(i);
-}
-
-setgemprobs()
-{
- int j,first;
- extern xchar dlevel;
-
- first = bases[letindex(GEM_SYM)];
-
- for(j = 0; j < 9-dlevel/3; j++)
- objects[first+j].oc_prob = 0;
- first += j;
- if(first >= LAST_GEM || first >= SIZE(objects) ||
- objects[first].oc_olet != GEM_SYM ||
- objects[first].oc_name == NULL)
- printf("Not enough gems? - first=%d j=%d LAST_GEM=%d\n",
- first, j, LAST_GEM);
- for(j = first; j < LAST_GEM; j++)
- objects[j].oc_prob = (20+j-first)/(LAST_GEM-first);
-}
-
-oinit() /* level dependent initialization */
-{
- setgemprobs();
-}
-
-extern long *alloc();
-
-savenames(fd) int fd; {
-int i;
-unsigned len;
- bwrite(fd, (char *) bases, sizeof bases);
- bwrite(fd, (char *) objects, sizeof objects);
- /* as long as we use only one version of Hack/Quest we
- need not save oc_name and oc_descr, but we must save
- oc_uname for all objects */
- for(i=0; i < SIZE(objects); i++) {
- if(objects[i].oc_uname) {
- len = strlen(objects[i].oc_uname)+1;
- bwrite(fd, (char *) &len, sizeof len);
- bwrite(fd, objects[i].oc_uname, len);
- }
- }
-}
-
-restnames(fd) int fd; {
-int i;
-unsigned len;
- mread(fd, (char *) bases, sizeof bases);
- mread(fd, (char *) objects, sizeof objects);
- for(i=0; i < SIZE(objects); i++) if(objects[i].oc_uname) {
- mread(fd, (char *) &len, sizeof len);
- objects[i].oc_uname = (char *) alloc(len);
- mread(fd, objects[i].oc_uname, len);
- }
-}
-
-dodiscovered() /* free after Robert Viduya */
-{
- extern char *typename();
- int i, end;
- int ct = 0;
-
- cornline(0, "Discoveries");
-
- end = SIZE(objects);
- for (i = 0; i < end; i++) {
- if (interesting_to_discover (i)) {
- ct++;
- cornline(1, typename(i));
- }
- }
- if (ct == 0) {
- pline ("You haven't discovered anything yet...");
- cornline(3, (char *) 0);
- } else
- cornline(2, (char *) 0);
-
- return(0);
-}
-
-interesting_to_discover(i)
-int i;
-{
- return(
- objects[i].oc_uname != NULL ||
- (objects[i].oc_name_known && objects[i].oc_descr != NULL)
- );
-}
diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c
deleted file mode 100644
index add63a2..0000000
--- a/games/hack/hack.objnam.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.objnam.c - version 1.0.2 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-#define Sprintf (void) sprintf
-#define Strcat (void) strcat
-#define Strcpy (void) strcpy
-#define PREFIX 15
-extern char *eos();
-extern int bases[];
-
-char *
-strprepend(s,pref) char *s, *pref; {
-int i = strlen(pref);
- if(i > PREFIX) {
- pline("WARNING: prefix too short.");
- return(s);
- }
- s -= i;
- (void) strncpy(s, pref, i); /* do not copy trailing 0 */
- return(s);
-}
-
-char *
-sitoa(a) int a; {
-static char buf[13];
- Sprintf(buf, (a < 0) ? "%d" : "+%d", a);
- return(buf);
-}
-
-char *
-typename(otyp)
-int otyp;
-{
-static char buf[BUFSZ];
-struct objclass *ocl = &objects[otyp];
-char *an = ocl->oc_name;
-char *dn = ocl->oc_descr;
-char *un = ocl->oc_uname;
-int nn = ocl->oc_name_known;
- switch(ocl->oc_olet) {
- case POTION_SYM:
- Strcpy(buf, "potion");
- break;
- case SCROLL_SYM:
- Strcpy(buf, "scroll");
- break;
- case WAND_SYM:
- Strcpy(buf, "wand");
- break;
- case RING_SYM:
- Strcpy(buf, "ring");
- break;
- default:
- if(nn) {
- Strcpy(buf, an);
- if(otyp >= TURQUOISE && otyp <= JADE)
- Strcat(buf, " stone");
- if(un)
- Sprintf(eos(buf), " called %s", un);
- if(dn)
- Sprintf(eos(buf), " (%s)", dn);
- } else {
- Strcpy(buf, dn ? dn : an);
- if(ocl->oc_olet == GEM_SYM)
- Strcat(buf, " gem");
- if(un)
- Sprintf(eos(buf), " called %s", un);
- }
- return(buf);
- }
- /* here for ring/scroll/potion/wand */
- if(nn)
- Sprintf(eos(buf), " of %s", an);
- if(un)
- Sprintf(eos(buf), " called %s", un);
- if(dn)
- Sprintf(eos(buf), " (%s)", dn);
- return(buf);
-}
-
-char *
-xname(obj)
-struct obj *obj;
-{
-static char bufr[BUFSZ];
-char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */
-int nn = objects[obj->otyp].oc_name_known;
-char *an = objects[obj->otyp].oc_name;
-char *dn = objects[obj->otyp].oc_descr;
-char *un = objects[obj->otyp].oc_uname;
-int pl = (obj->quan != 1);
- if(!obj->dknown && !Blind) obj->dknown = 1; /* %% doesnt belong here */
- switch(obj->olet) {
- case AMULET_SYM:
- Strcpy(buf, (obj->spe < 0 && obj->known)
- ? "cheap plastic imitation of the " : "");
- Strcat(buf,"Amulet of Yendor");
- break;
- case TOOL_SYM:
- if(!nn) {
- Strcpy(buf, dn);
- break;
- }
- Strcpy(buf,an);
- break;
- case FOOD_SYM:
- if(obj->otyp == DEAD_HOMUNCULUS && pl) {
- pl = 0;
- Strcpy(buf, "dead homunculi");
- break;
- }
- /* fungis ? */
- /* FALLTHROUGH */
- case WEAPON_SYM:
- if(obj->otyp == WORM_TOOTH && pl) {
- pl = 0;
- Strcpy(buf, "worm teeth");
- break;
- }
- if(obj->otyp == CRYSKNIFE && pl) {
- pl = 0;
- Strcpy(buf, "crysknives");
- break;
- }
- /* FALLTHROUGH */
- case ARMOR_SYM:
- case CHAIN_SYM:
- case ROCK_SYM:
- Strcpy(buf,an);
- break;
- case BALL_SYM:
- Sprintf(buf, "%sheavy iron ball",
- (obj->owt > objects[obj->otyp].oc_weight) ? "very " : "");
- break;
- case POTION_SYM:
- if(nn || un || !obj->dknown) {
- Strcpy(buf, "potion");
- if(pl) {
- pl = 0;
- Strcat(buf, "s");
- }
- if(!obj->dknown) break;
- if(un) {
- Strcat(buf, " called ");
- Strcat(buf, un);
- } else {
- Strcat(buf, " of ");
- Strcat(buf, an);
- }
- } else {
- Strcpy(buf, dn);
- Strcat(buf, " potion");
- }
- break;
- case SCROLL_SYM:
- Strcpy(buf, "scroll");
- if(pl) {
- pl = 0;
- Strcat(buf, "s");
- }
- if(!obj->dknown) break;
- if(nn) {
- Strcat(buf, " of ");
- Strcat(buf, an);
- } else if(un) {
- Strcat(buf, " called ");
- Strcat(buf, un);
- } else {
- Strcat(buf, " labeled ");
- Strcat(buf, dn);
- }
- break;
- case WAND_SYM:
- if(!obj->dknown)
- Sprintf(buf, "wand");
- else if(nn)
- Sprintf(buf, "wand of %s", an);
- else if(un)
- Sprintf(buf, "wand called %s", un);
- else
- Sprintf(buf, "%s wand", dn);
- break;
- case RING_SYM:
- if(!obj->dknown)
- Sprintf(buf, "ring");
- else if(nn)
- Sprintf(buf, "ring of %s", an);
- else if(un)
- Sprintf(buf, "ring called %s", un);
- else
- Sprintf(buf, "%s ring", dn);
- break;
- case GEM_SYM:
- if(!obj->dknown) {
- Strcpy(buf, "gem");
- break;
- }
- if(!nn) {
- Sprintf(buf, "%s gem", dn);
- break;
- }
- Strcpy(buf, an);
- if(obj->otyp >= TURQUOISE && obj->otyp <= JADE)
- Strcat(buf, " stone");
- break;
- default:
- Sprintf(buf,"glorkum %c (0%o) %u %d",
- obj->olet,obj->olet,obj->otyp,obj->spe);
- }
- if(pl) {
- char *p;
-
- for(p = buf; *p; p++) {
- if(!strncmp(" of ", p, 4)) {
- /* pieces of, cloves of, lumps of */
- int c1, c2 = 's';
-
- do {
- c1 = c2; c2 = *p; *p++ = c1;
- } while(c1);
- goto nopl;
- }
- }
- p = eos(buf)-1;
- if(*p == 's' || *p == 'z' || *p == 'x' ||
- (*p == 'h' && p[-1] == 's'))
- Strcat(buf, "es"); /* boxes */
- else if(*p == 'y' && !index(vowels, p[-1]))
- Strcpy(p, "ies"); /* rubies, zruties */
- else
- Strcat(buf, "s");
- }
-nopl:
- if(obj->onamelth) {
- Strcat(buf, " named ");
- Strcat(buf, ONAME(obj));
- }
- return(buf);
-}
-
-char *
-doname(obj)
-struct obj *obj;
-{
-char prefix[PREFIX];
-char *bp = xname(obj);
- if(obj->quan != 1)
- Sprintf(prefix, "%u ", obj->quan);
- else
- Strcpy(prefix, "a ");
- switch(obj->olet) {
- case AMULET_SYM:
- if(strncmp(bp, "cheap ", 6))
- Strcpy(prefix, "the ");
- break;
- case ARMOR_SYM:
- if(obj->owornmask & W_ARMOR)
- Strcat(bp, " (being worn)");
- /* FALLTHROUGH */
- case WEAPON_SYM:
- if(obj->known) {
- Strcat(prefix, sitoa(obj->spe));
- Strcat(prefix, " ");
- }
- break;
- case WAND_SYM:
- if(obj->known)
- Sprintf(eos(bp), " (%d)", obj->spe);
- break;
- case RING_SYM:
- if(obj->owornmask & W_RINGR) Strcat(bp, " (on right hand)");
- if(obj->owornmask & W_RINGL) Strcat(bp, " (on left hand)");
- if(obj->known && (objects[obj->otyp].bits & SPEC)) {
- Strcat(prefix, sitoa(obj->spe));
- Strcat(prefix, " ");
- }
- break;
- }
- if(obj->owornmask & W_WEP)
- Strcat(bp, " (weapon in hand)");
- if(obj->unpaid)
- Strcat(bp, " (unpaid)");
- if(!strcmp(prefix, "a ") && index(vowels, *bp))
- Strcpy(prefix, "an ");
- bp = strprepend(bp, prefix);
- return(bp);
-}
-
-/* used only in hack.fight.c (thitu) */
-setan(str,buf)
-char *str,*buf;
-{
- if(index(vowels,*str))
- Sprintf(buf, "an %s", str);
- else
- Sprintf(buf, "a %s", str);
-}
-
-char *
-aobjnam(otmp,verb) struct obj *otmp; char *verb; {
-char *bp = xname(otmp);
-char prefix[PREFIX];
- if(otmp->quan != 1) {
- Sprintf(prefix, "%u ", otmp->quan);
- bp = strprepend(bp, prefix);
- }
-
- if(verb) {
- /* verb is given in plural (i.e., without trailing s) */
- Strcat(bp, " ");
- if(otmp->quan != 1)
- Strcat(bp, verb);
- else if(!strcmp(verb, "are"))
- Strcat(bp, "is");
- else {
- Strcat(bp, verb);
- Strcat(bp, "s");
- }
- }
- return(bp);
-}
-
-char *
-Doname(obj)
-struct obj *obj;
-{
- char *s = doname(obj);
-
- if('a' <= *s && *s <= 'z') *s -= ('a' - 'A');
- return(s);
-}
-
-char *wrp[] = { "wand", "ring", "potion", "scroll", "gem" };
-char wrpsym[] = { WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM };
-
-struct obj *
-readobjnam(bp) char *bp; {
-char *p;
-int i;
-int cnt, spe, spesgn, typ, heavy;
-char let;
-char *un, *dn, *an;
-/* int the = 0; char *oname = 0; */
- cnt = spe = spesgn = typ = heavy = 0;
- let = 0;
- an = dn = un = 0;
- for(p = bp; *p; p++)
- if('A' <= *p && *p <= 'Z') *p += 'a'-'A';
- if(!strncmp(bp, "the ", 4)){
-/* the = 1; */
- bp += 4;
- } else if(!strncmp(bp, "an ", 3)){
- cnt = 1;
- bp += 3;
- } else if(!strncmp(bp, "a ", 2)){
- cnt = 1;
- bp += 2;
- }
- if(!cnt && digit(*bp)){
- cnt = atoi(bp);
- while(digit(*bp)) bp++;
- while(*bp == ' ') bp++;
- }
- if(!cnt) cnt = 1; /* %% what with "gems" etc. ? */
-
- if(*bp == '+' || *bp == '-'){
- spesgn = (*bp++ == '+') ? 1 : -1;
- spe = atoi(bp);
- while(digit(*bp)) bp++;
- while(*bp == ' ') bp++;
- } else {
- p = rindex(bp, '(');
- if(p) {
- if(p > bp && p[-1] == ' ') p[-1] = 0;
- else *p = 0;
- p++;
- spe = atoi(p);
- while(digit(*p)) p++;
- if(strcmp(p, ")")) spe = 0;
- else spesgn = 1;
- }
- }
- /* now we have the actual name, as delivered by xname, say
- green potions called whisky
- scrolls labeled "QWERTY"
- egg
- dead zruties
- fortune cookies
- very heavy iron ball named hoei
- wand of wishing
- elven cloak
- */
- for(p = bp; *p; p++) if(!strncmp(p, " named ", 7)) {
- *p = 0;
-/* oname = p+7; */
- }
- for(p = bp; *p; p++) if(!strncmp(p, " called ", 8)) {
- *p = 0;
- un = p+8;
- }
- for(p = bp; *p; p++) if(!strncmp(p, " labeled ", 9)) {
- *p = 0;
- dn = p+9;
- }
-
- /* first change to singular if necessary */
- if(cnt != 1) {
- /* find "cloves of garlic", "worthless pieces of blue glass" */
- for(p = bp; *p; p++) if(!strncmp(p, "s of ", 5)){
- while(*p = p[1]) p++;
- goto sing;
- }
- /* remove -s or -es (boxes) or -ies (rubies, zruties) */
- p = eos(bp);
- if(p[-1] == 's') {
- if(p[-2] == 'e') {
- if(p[-3] == 'i') {
- if(!strcmp(p-7, "cookies"))
- goto mins;
- Strcpy(p-3, "y");
- goto sing;
- }
-
- /* note: cloves / knives from clove / knife */
- if(!strcmp(p-6, "knives")) {
- Strcpy(p-3, "fe");
- goto sing;
- }
-
- /* note: nurses, axes but boxes */
- if(!strcmp(p-5, "boxes")) {
- p[-2] = 0;
- goto sing;
- }
- }
- mins:
- p[-1] = 0;
- } else {
- if(!strcmp(p-9, "homunculi")) {
- Strcpy(p-1, "us"); /* !! makes string longer */
- goto sing;
- }
- if(!strcmp(p-5, "teeth")) {
- Strcpy(p-5, "tooth");
- goto sing;
- }
- /* here we cannot find the plural suffix */
- }
- }
-sing:
- if(!strcmp(bp, "amulet of yendor")) {
- typ = AMULET_OF_YENDOR;
- goto typfnd;
- }
- p = eos(bp);
- if(!strcmp(p-5, " mail")){ /* Note: ring mail is not a ring ! */
- let = ARMOR_SYM;
- an = bp;
- goto srch;
- }
- for(i = 0; i < sizeof(wrpsym); i++) {
- int j = strlen(wrp[i]);
- if(!strncmp(bp, wrp[i], j)){
- let = wrpsym[i];
- bp += j;
- if(!strncmp(bp, " of ", 4)) an = bp+4;
- /* else if(*bp) ?? */
- goto srch;
- }
- if(!strcmp(p-j, wrp[i])){
- let = wrpsym[i];
- p -= j;
- *p = 0;
- if(p[-1] == ' ') p[-1] = 0;
- dn = bp;
- goto srch;
- }
- }
- if(!strcmp(p-6, " stone")){
- p[-6] = 0;
- let = GEM_SYM;
- an = bp;
- goto srch;
- }
- if(!strcmp(bp, "very heavy iron ball")){
- heavy = 1;
- typ = HEAVY_IRON_BALL;
- goto typfnd;
- }
- an = bp;
-srch:
- if(!an && !dn && !un)
- goto any;
- i = 1;
- if(let) i = bases[letindex(let)];
- while(i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)){
- char *zn = objects[i].oc_name;
-
- if(!zn) goto nxti;
- if(an && strcmp(an, zn))
- goto nxti;
- if(dn && (!(zn = objects[i].oc_descr) || strcmp(dn, zn)))
- goto nxti;
- if(un && (!(zn = objects[i].oc_uname) || strcmp(un, zn)))
- goto nxti;
- typ = i;
- goto typfnd;
- nxti:
- i++;
- }
-any:
- if(!let) let = wrpsym[rn2(sizeof(wrpsym))];
- typ = probtype(let);
-typfnd:
- { struct obj *otmp;
- extern struct obj *mksobj();
- let = objects[typ].oc_olet;
- otmp = mksobj(typ);
- if(heavy)
- otmp->owt += 15;
- if(cnt > 0 && index("%?!*)", let) &&
- (cnt < 4 || (let == WEAPON_SYM && typ <= ROCK && cnt < 20)))
- otmp->quan = cnt;
-
- if(spe > 3 && spe > otmp->spe)
- spe = 0;
- else if(let == WAND_SYM)
- spe = otmp->spe;
- if(spe == 3 && u.uluck < 0)
- spesgn = -1;
- if(let != WAND_SYM && spesgn == -1)
- spe = -spe;
- if(let == BALL_SYM)
- spe = 0;
- else if(let == AMULET_SYM)
- spe = -1;
- else if(typ == WAN_WISHING && rn2(10))
- spe = (rn2(10) ? -1 : 0);
- otmp->spe = spe;
-
- if(spesgn == -1)
- otmp->cursed = 1;
-
- return(otmp);
- }
-}
diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c
deleted file mode 100644
index 7bd1baa..0000000
--- a/games/hack/hack.options.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.options.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <stdlib.h>
-#include "config.h"
-#include "hack.h"
-extern char *eos();
-
-initoptions()
-{
- char *opts;
-
- flags.time = flags.nonews = flags.notombstone = flags.end_own =
- flags.standout = flags.nonull = FALSE;
- flags.no_rest_on_space = TRUE;
- flags.invlet_constant = TRUE;
- flags.end_top = 5;
- flags.end_around = 4;
- flags.female = FALSE; /* players are usually male */
-
- if(opts = getenv("HACKOPTIONS"))
- parseoptions(opts,TRUE);
-}
-
-parseoptions(opts, from_env)
-char *opts;
-boolean from_env;
-{
- char *op,*op2;
- unsigned num;
- boolean negated;
-
- if(op = index(opts, ',')) {
- *op++ = 0;
- parseoptions(op, from_env);
- }
- if(op = index(opts, ' ')) {
- op2 = op;
- while(*op++)
- if(*op != ' ') *op2++ = *op;
- }
- if(!*opts) return;
- negated = FALSE;
- while((*opts == '!') || !strncmp(opts, "no", 2)) {
- if(*opts == '!') opts++; else opts += 2;
- negated = !negated;
- }
-
- if(!strncmp(opts,"standout",8)) {
- flags.standout = !negated;
- return;
- }
-
- if(!strncmp(opts,"null",3)) {
- flags.nonull = negated;
- return;
- }
-
- if(!strncmp(opts,"tombstone",4)) {
- flags.notombstone = negated;
- return;
- }
-
- if(!strncmp(opts,"news",4)) {
- flags.nonews = negated;
- return;
- }
-
- if(!strncmp(opts,"time",4)) {
- flags.time = !negated;
- flags.botl = 1;
- return;
- }
-
- if(!strncmp(opts,"restonspace",4)) {
- flags.no_rest_on_space = negated;
- return;
- }
-
- if(!strncmp(opts,"fixinv",4)) {
- if(from_env)
- flags.invlet_constant = !negated;
- else
- pline("The fixinvlet option must be in HACKOPTIONS.");
- return;
- }
-
- if(!strncmp(opts,"male",4)) {
- flags.female = negated;
- return;
- }
- if(!strncmp(opts,"female",6)) {
- flags.female = !negated;
- return;
- }
-
- /* name:string */
- if(!strncmp(opts,"name",4)) {
- extern char plname[PL_NSIZ];
- if(!from_env) {
- pline("The playername can be set only from HACKOPTIONS.");
- return;
- }
- op = index(opts,':');
- if(!op) goto bad;
- (void) strncpy(plname, op+1, sizeof(plname)-1);
- return;
- }
-
- /* endgame:5t[op] 5a[round] o[wn] */
- if(!strncmp(opts,"endgame",3)) {
- op = index(opts,':');
- if(!op) goto bad;
- op++;
- while(*op) {
- num = 1;
- if(digit(*op)) {
- num = atoi(op);
- while(digit(*op)) op++;
- } else
- if(*op == '!') {
- negated = !negated;
- op++;
- }
- switch(*op) {
- case 't':
- flags.end_top = num;
- break;
- case 'a':
- flags.end_around = num;
- break;
- case 'o':
- flags.end_own = !negated;
- break;
- default:
- goto bad;
- }
- while(letter(*++op)) ;
- if(*op == '/') op++;
- }
- return;
- }
-bad:
- if(!from_env) {
- if(!strncmp(opts, "help", 4)) {
- pline("%s%s%s",
-"To set options use `HACKOPTIONS=\"<options>\"' in your environment, or ",
-"give the command 'o' followed by the line `<options>' while playing. ",
-"Here <options> is a list of <option>s separated by commas." );
- pline("%s%s%s",
-"Simple (boolean) options are rest_on_space, news, time, ",
-"null, tombstone, (fe)male. ",
-"These can be negated by prefixing them with '!' or \"no\"." );
- pline("%s",
-"A string option is name, as in HACKOPTIONS=\"name:Merlin-W\"." );
- pline("%s%s%s",
-"A compound option is endgame; it is followed by a description of what ",
-"parts of the scorelist you want to see. You might for example say: ",
-"`endgame:own scores/5 top scores/4 around my score'." );
- return;
- }
- pline("Bad option: %s.", opts);
- pline("Type `o help<cr>' for help.");
- return;
- }
- puts("Bad syntax in HACKOPTIONS.");
- puts("Use for example:");
- puts(
-"HACKOPTIONS=\"!restonspace,notombstone,endgame:own/5 topscorers/4 around me\""
- );
- getret();
-}
-
-doset()
-{
- char buf[BUFSZ];
-
- pline("What options do you want to set? ");
- getlin(buf);
- if(!buf[0] || buf[0] == '\033') {
- (void) strcpy(buf,"HACKOPTIONS=");
- (void) strcat(buf, flags.female ? "female," : "male,");
- if(flags.standout) (void) strcat(buf,"standout,");
- if(flags.nonull) (void) strcat(buf,"nonull,");
- if(flags.nonews) (void) strcat(buf,"nonews,");
- if(flags.time) (void) strcat(buf,"time,");
- if(flags.notombstone) (void) strcat(buf,"notombstone,");
- if(flags.no_rest_on_space)
- (void) strcat(buf,"!rest_on_space,");
- if(flags.end_top != 5 || flags.end_around != 4 || flags.end_own){
- (void) sprintf(eos(buf), "endgame: %u topscores/%u around me",
- flags.end_top, flags.end_around);
- if(flags.end_own) (void) strcat(buf, "/own scores");
- } else {
- char *eop = eos(buf);
- if(*--eop == ',') *eop = 0;
- }
- pline(buf);
- } else
- parseoptions(buf, FALSE);
-
- return(0);
-}
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c
deleted file mode 100644
index 8cc7002..0000000
--- a/games/hack/hack.pager.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.pager.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-/* This file contains the command routine dowhatis() and a pager. */
-/* Also readmail() and doshell(), and generally the things that
- contact the outside world. */
-
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "hack.h"
-extern int CO, LI; /* usually COLNO and ROWNO+2 */
-extern char *CD;
-extern char quitchars[];
-void done1();
-
-dowhatis()
-{
- FILE *fp;
- char bufr[BUFSZ+6];
- char *buf = &bufr[6], *ep, q;
- extern char readchar();
-
- if(!(fp = fopen(DATAFILE, "r")))
- pline("Cannot open data file!");
- else {
- pline("Specify what? ");
- q = readchar();
- if(q != '\t')
- while(fgets(buf,BUFSZ,fp))
- if(*buf == q) {
- ep = index(buf, '\n');
- if(ep) *ep = 0;
- /* else: bad data file */
- /* Expand tab 'by hand' */
- if(buf[1] == '\t'){
- buf = bufr;
- buf[0] = q;
- (void) strncpy(buf+1, " ", 7);
- }
- pline(buf);
- if(ep[-1] == ';') {
- pline("More info? ");
- if(readchar() == 'y') {
- page_more(fp,1); /* does fclose() */
- return(0);
- }
- }
- (void) fclose(fp); /* kopper@psuvax1 */
- return(0);
- }
- pline("I've never heard of such things.");
- (void) fclose(fp);
- }
- return(0);
-}
-
-/* make the paging of a file interruptible */
-static int got_intrup;
-
-void
-intruph(){
- got_intrup++;
-}
-
-/* simple pager, also used from dohelp() */
-page_more(fp,strip)
-FILE *fp;
-int strip; /* nr of chars to be stripped from each line (0 or 1) */
-{
- char *bufr, *ep;
- sig_t prevsig = signal(SIGINT, intruph);
-
- set_pager(0);
- bufr = (char *) alloc((unsigned) CO);
- bufr[CO-1] = 0;
- while(fgets(bufr,CO-1,fp) && (!strip || *bufr == '\t') && !got_intrup){
- ep = index(bufr, '\n');
- if(ep)
- *ep = 0;
- if(page_line(bufr+strip)) {
- set_pager(2);
- goto ret;
- }
- }
- set_pager(1);
-ret:
- free(bufr);
- (void) fclose(fp);
- (void) signal(SIGINT, prevsig);
- got_intrup = 0;
-}
-
-static boolean whole_screen = TRUE;
-#define PAGMIN 12 /* minimum # of lines for page below level map */
-
-set_whole_screen() { /* called in termcap as soon as LI is known */
- whole_screen = (LI-ROWNO-2 <= PAGMIN || !CD);
-}
-
-#ifdef NEWS
-readnews() {
- int ret;
-
- whole_screen = TRUE; /* force a docrt(), our first */
- ret = page_file(NEWS, TRUE);
- set_whole_screen();
- return(ret); /* report whether we did docrt() */
-}
-#endif /* NEWS */
-
-set_pager(mode)
-int mode; /* 0: open 1: wait+close 2: close */
-{
- static boolean so;
- if(mode == 0) {
- if(!whole_screen) {
- /* clear topline */
- clrlin();
- /* use part of screen below level map */
- curs(1, ROWNO+4);
- } else {
- cls();
- }
- so = flags.standout;
- flags.standout = 1;
- } else {
- if(mode == 1) {
- curs(1, LI);
- more();
- }
- flags.standout = so;
- if(whole_screen)
- docrt();
- else {
- curs(1, ROWNO+4);
- cl_eos();
- }
- }
-}
-
-page_line(s) /* returns 1 if we should quit */
-char *s;
-{
- extern char morc;
-
- if(cury == LI-1) {
- if(!*s)
- return(0); /* suppress blank lines at top */
- putchar('\n');
- cury++;
- cmore("q\033");
- if(morc) {
- morc = 0;
- return(1);
- }
- if(whole_screen)
- cls();
- else {
- curs(1, ROWNO+4);
- cl_eos();
- }
- }
- puts(s);
- cury++;
- return(0);
-}
-
-/*
- * Flexible pager: feed it with a number of lines and it will decide
- * whether these should be fed to the pager above, or displayed in a
- * corner.
- * Call:
- * cornline(0, title or 0) : initialize
- * cornline(1, text) : add text to the chain of texts
- * cornline(2, morcs) : output everything and cleanup
- * cornline(3, 0) : cleanup
- */
-
-cornline(mode, text)
-int mode;
-char *text;
-{
- static struct line {
- struct line *next_line;
- char *line_text;
- } *texthead, *texttail;
- static int maxlen;
- static int linect;
- struct line *tl;
-
- if(mode == 0) {
- texthead = 0;
- maxlen = 0;
- linect = 0;
- if(text) {
- cornline(1, text); /* title */
- cornline(1, ""); /* blank line */
- }
- return;
- }
-
- if(mode == 1) {
- int len;
-
- if(!text) return; /* superfluous, just to be sure */
- linect++;
- len = strlen(text);
- if(len > maxlen)
- maxlen = len;
- tl = (struct line *)
- alloc((unsigned)(len + sizeof(struct line) + 1));
- tl->next_line = 0;
- tl->line_text = (char *)(tl + 1);
- (void) strcpy(tl->line_text, text);
- if(!texthead)
- texthead = tl;
- else
- texttail->next_line = tl;
- texttail = tl;
- return;
- }
-
- /* --- now we really do it --- */
- if(mode == 2 && linect == 1) /* topline only */
- pline(texthead->line_text);
- else
- if(mode == 2) {
- int curline, lth;
-
- if(flags.toplin == 1) more(); /* ab@unido */
- remember_topl();
-
- lth = CO - maxlen - 2; /* Use full screen width */
- if (linect < LI && lth >= 10) { /* in a corner */
- home ();
- cl_end ();
- flags.toplin = 0;
- curline = 1;
- for (tl = texthead; tl; tl = tl->next_line) {
- curs (lth, curline);
- if(curline > 1)
- cl_end ();
- putsym(' ');
- putstr (tl->line_text);
- curline++;
- }
- curs (lth, curline);
- cl_end ();
- cmore (text);
- home ();
- cl_end ();
- docorner (lth, curline-1);
- } else { /* feed to pager */
- set_pager(0);
- for (tl = texthead; tl; tl = tl->next_line) {
- if (page_line (tl->line_text)) {
- set_pager(2);
- goto cleanup;
- }
- }
- if(text) {
- cgetret(text);
- set_pager(2);
- } else
- set_pager(1);
- }
- }
-
-cleanup:
- while(tl = texthead) {
- texthead = tl->next_line;
- free((char *) tl);
- }
-}
-
-dohelp()
-{
- char c;
-
- pline ("Long or short help? ");
- while (((c = readchar ()) != 'l') && (c != 's') && !index(quitchars,c))
- bell ();
- if (!index(quitchars, c))
- (void) page_file((c == 'l') ? HELP : SHELP, FALSE);
- return(0);
-}
-
-page_file(fnam, silent) /* return: 0 - cannot open fnam; 1 - otherwise */
-char *fnam;
-boolean silent;
-{
-#ifdef DEF_PAGER /* this implies that UNIX is defined */
- {
- /* use external pager; this may give security problems */
-
- int fd = open(fnam, 0);
-
- if(fd < 0) {
- if(!silent) pline("Cannot open %s.", fnam);
- return(0);
- }
- if(child(1)){
- extern char *catmore;
-
- /* Now that child() does a setuid(getuid()) and a chdir(),
- we may not be able to open file fnam anymore, so make
- it stdin. */
- (void) close(0);
- if(dup(fd)) {
- if(!silent) printf("Cannot open %s as stdin.\n", fnam);
- } else {
- execl(catmore, "page", (char *) 0);
- if(!silent) printf("Cannot exec %s.\n", catmore);
- }
- exit(1);
- }
- (void) close(fd);
- }
-#else /* DEF_PAGER */
- {
- FILE *f; /* free after Robert Viduya */
-
- if ((f = fopen (fnam, "r")) == (FILE *) 0) {
- if(!silent) {
- home(); perror (fnam); flags.toplin = 1;
- pline ("Cannot open %s.", fnam);
- }
- return(0);
- }
- page_more(f, 0);
- }
-#endif /* DEF_PAGER */
-
- return(1);
-}
-
-#ifdef UNIX
-#ifdef SHELL
-dosh(){
-char *str;
- if(child(0)) {
- if(str = getenv("SHELL"))
- execl(str, str, (char *) 0);
- else
- execl("/bin/sh", "sh", (char *) 0);
- pline("sh: cannot execute.");
- exit(1);
- }
- return(0);
-}
-#endif /* SHELL */
-
-#ifdef NOWAITINCLUDE
-union wait { /* used only for the cast (union wait *) 0 */
- int w_status;
- struct {
- unsigned short w_Termsig:7;
- unsigned short w_Coredump:1;
- unsigned short w_Retcode:8;
- } w_T;
-};
-
-#else
-
-#ifdef BSD
-#include <sys/wait.h>
-#else
-#include <wait.h>
-#endif /* BSD */
-#endif /* NOWAITINCLUDE */
-
-child(wt) {
- int status;
- int f;
-
- f = fork();
- if(f == 0){ /* child */
- settty((char *) 0); /* also calls end_screen() */
- /* revoke */
- setgid(getgid());
-#ifdef CHDIR
- (void) chdir(getenv("HOME"));
-#endif /* CHDIR */
- return(1);
- }
- if(f == -1) { /* cannot fork */
- pline("Fork failed. Try again.");
- return(0);
- }
- /* fork succeeded; wait for child to exit */
- (void) signal(SIGINT,SIG_IGN);
- (void) signal(SIGQUIT,SIG_IGN);
- (void) wait(&status);
- gettty();
- setftty();
- (void) signal(SIGINT,done1);
-#ifdef WIZARD
- if(wizard) (void) signal(SIGQUIT,SIG_DFL);
-#endif /* WIZARD */
- if(wt) getret();
- docrt();
- return(0);
-}
-#endif /* UNIX */
diff --git a/games/hack/hack.potion.c b/games/hack/hack.potion.c
deleted file mode 100644
index 751b7e0..0000000
--- a/games/hack/hack.potion.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.potion.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern int float_down();
-extern char *nomovemsg;
-extern struct monst youmonst;
-extern struct monst *makemon();
-
-dodrink() {
- struct obj *otmp,*objs;
- struct monst *mtmp;
- int unkn = 0, nothing = 0;
-
- otmp = getobj("!", "drink");
- if(!otmp) return(0);
- if(!strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) {
- ghost_from_bottle();
- goto use_it;
- }
- switch(otmp->otyp){
- case POT_RESTORE_STRENGTH:
- unkn++;
- pline("Wow! This makes you feel great!");
- if(u.ustr < u.ustrmax) {
- u.ustr = u.ustrmax;
- flags.botl = 1;
- }
- break;
- case POT_BOOZE:
- unkn++;
- pline("Ooph! This tastes like liquid fire!");
- Confusion += d(3,8);
- /* the whiskey makes us feel better */
- if(u.uhp < u.uhpmax) losehp(-1, "bottle of whiskey");
- if(!rn2(4)) {
- pline("You pass out.");
- multi = -rnd(15);
- nomovemsg = "You awake with a headache.";
- }
- break;
- case POT_INVISIBILITY:
- if(Invis || See_invisible)
- nothing++;
- else {
- if(!Blind)
- pline("Gee! All of a sudden, you can't see yourself.");
- else
- pline("You feel rather airy."), unkn++;
- newsym(u.ux,u.uy);
- }
- Invis += rn1(15,31);
- break;
- case POT_FRUIT_JUICE:
- pline("This tastes like fruit juice.");
- lesshungry(20);
- break;
- case POT_HEALING:
- pline("You begin to feel better.");
- flags.botl = 1;
- u.uhp += rnd(10);
- if(u.uhp > u.uhpmax)
- u.uhp = ++u.uhpmax;
- if(Blind) Blind = 1; /* see on next move */
- if(Sick) Sick = 0;
- break;
- case POT_PARALYSIS:
- if(Levitation)
- pline("You are motionlessly suspended.");
- else
- pline("Your feet are frozen to the floor!");
- nomul(-(rn1(10,25)));
- break;
- case POT_MONSTER_DETECTION:
- if(!fmon) {
- strange_feeling(otmp, "You feel threatened.");
- return(1);
- } else {
- cls();
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->mx > 0)
- at(mtmp->mx,mtmp->my,mtmp->data->mlet);
- prme();
- pline("You sense the presence of monsters.");
- more();
- docrt();
- }
- break;
- case POT_OBJECT_DETECTION:
- if(!fobj) {
- strange_feeling(otmp, "You feel a pull downward.");
- return(1);
- } else {
- for(objs = fobj; objs; objs = objs->nobj)
- if(objs->ox != u.ux || objs->oy != u.uy)
- goto outobjmap;
- pline("You sense the presence of objects close nearby.");
- break;
- outobjmap:
- cls();
- for(objs = fobj; objs; objs = objs->nobj)
- at(objs->ox,objs->oy,objs->olet);
- prme();
- pline("You sense the presence of objects.");
- more();
- docrt();
- }
- break;
- case POT_SICKNESS:
- pline("Yech! This stuff tastes like poison.");
- if(Poison_resistance)
- pline("(But in fact it was biologically contaminated orange juice.)");
- losestr(rn1(4,3));
- losehp(rnd(10), "contaminated potion");
- break;
- case POT_CONFUSION:
- if(!Confusion)
- pline("Huh, What? Where am I?");
- else
- nothing++;
- Confusion += rn1(7,16);
- break;
- case POT_GAIN_STRENGTH:
- pline("Wow do you feel strong!");
- if(u.ustr >= 118) break; /* > 118 is impossible */
- if(u.ustr > 17) u.ustr += rnd(118-u.ustr);
- else u.ustr++;
- if(u.ustr > u.ustrmax) u.ustrmax = u.ustr;
- flags.botl = 1;
- break;
- case POT_SPEED:
- if(Wounded_legs) {
- heal_legs();
- unkn++;
- break;
- }
- if(!(Fast & ~INTRINSIC))
- pline("You are suddenly moving much faster.");
- else
- pline("Your legs get new energy."), unkn++;
- Fast += rn1(10,100);
- break;
- case POT_BLINDNESS:
- if(!Blind)
- pline("A cloud of darkness falls upon you.");
- else
- nothing++;
- Blind += rn1(100,250);
- seeoff(0);
- break;
- case POT_GAIN_LEVEL:
- pluslvl();
- break;
- case POT_EXTRA_HEALING:
- pline("You feel much better.");
- flags.botl = 1;
- u.uhp += d(2,20)+1;
- if(u.uhp > u.uhpmax)
- u.uhp = (u.uhpmax += 2);
- if(Blind) Blind = 1;
- if(Sick) Sick = 0;
- break;
- case POT_LEVITATION:
- if(!Levitation)
- float_up();
- else
- nothing++;
- Levitation += rnd(100);
- u.uprops[PROP(RIN_LEVITATION)].p_tofn = float_down;
- break;
- default:
- impossible("What a funny potion! (%u)", otmp->otyp);
- return(0);
- }
- if(nothing) {
- unkn++;
- pline("You have a peculiar feeling for a moment, then it passes.");
- }
- if(otmp->dknown && !objects[otmp->otyp].oc_name_known) {
- if(!unkn) {
- objects[otmp->otyp].oc_name_known = 1;
- more_experienced(0,10);
- } else if(!objects[otmp->otyp].oc_uname)
- docall(otmp);
- }
-use_it:
- useup(otmp);
- return(1);
-}
-
-pluslvl()
-{
- int num;
-
- pline("You feel more experienced.");
- num = rnd(10);
- u.uhpmax += num;
- u.uhp += num;
- if(u.ulevel < 14) {
- extern long newuexp();
-
- u.uexp = newuexp()+1;
- pline("Welcome to experience level %u.", ++u.ulevel);
- }
- flags.botl = 1;
-}
-
-strange_feeling(obj,txt)
-struct obj *obj;
-char *txt;
-{
- if(flags.beginner)
- pline("You have a strange feeling for a moment, then it passes.");
- else
- pline(txt);
- if(!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
- docall(obj);
- useup(obj);
-}
-
-char *bottlenames[] = {
- "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
-};
-
-potionhit(mon, obj)
-struct monst *mon;
-struct obj *obj;
-{
- extern char *xname();
- char *botlnam = bottlenames[rn2(SIZE(bottlenames))];
- boolean uclose, isyou = (mon == &youmonst);
-
- if(isyou) {
- uclose = TRUE;
- pline("The %s crashes on your head and breaks into shivers.",
- botlnam);
- losehp(rnd(2), "thrown potion");
- } else {
- uclose = (dist(mon->mx,mon->my) < 3);
- /* perhaps 'E' and 'a' have no head? */
- pline("The %s crashes on %s's head and breaks into shivers.",
- botlnam, monnam(mon));
- if(rn2(5) && mon->mhp > 1)
- mon->mhp--;
- }
- pline("The %s evaporates.", xname(obj));
-
- if(!isyou && !rn2(3)) switch(obj->otyp) {
-
- case POT_RESTORE_STRENGTH:
- case POT_GAIN_STRENGTH:
- case POT_HEALING:
- case POT_EXTRA_HEALING:
- if(mon->mhp < mon->mhpmax) {
- mon->mhp = mon->mhpmax;
- pline("%s looks sound and hale again!", Monnam(mon));
- }
- break;
- case POT_SICKNESS:
- if(mon->mhpmax > 3)
- mon->mhpmax /= 2;
- if(mon->mhp > 2)
- mon->mhp /= 2;
- break;
- case POT_CONFUSION:
- case POT_BOOZE:
- mon->mconf = 1;
- break;
- case POT_INVISIBILITY:
- unpmon(mon);
- mon->minvis = 1;
- pmon(mon);
- break;
- case POT_PARALYSIS:
- mon->mfroz = 1;
- break;
- case POT_SPEED:
- mon->mspeed = MFAST;
- break;
- case POT_BLINDNESS:
- mon->mblinded |= 64 + rn2(64);
- break;
-/*
- case POT_GAIN_LEVEL:
- case POT_LEVITATION:
- case POT_FRUIT_JUICE:
- case POT_MONSTER_DETECTION:
- case POT_OBJECT_DETECTION:
- break;
-*/
- }
- if(uclose && rn2(5))
- potionbreathe(obj);
- obfree(obj, Null(obj));
-}
-
-potionbreathe(obj)
-struct obj *obj;
-{
- switch(obj->otyp) {
- case POT_RESTORE_STRENGTH:
- case POT_GAIN_STRENGTH:
- if(u.ustr < u.ustrmax) u.ustr++, flags.botl = 1;
- break;
- case POT_HEALING:
- case POT_EXTRA_HEALING:
- if(u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
- break;
- case POT_SICKNESS:
- if(u.uhp <= 5) u.uhp = 1; else u.uhp -= 5;
- flags.botl = 1;
- break;
- case POT_CONFUSION:
- case POT_BOOZE:
- if(!Confusion)
- pline("You feel somewhat dizzy.");
- Confusion += rnd(5);
- break;
- case POT_INVISIBILITY:
- pline("For an instant you couldn't see your right hand.");
- break;
- case POT_PARALYSIS:
- pline("Something seems to be holding you.");
- nomul(-rnd(5));
- break;
- case POT_SPEED:
- Fast += rnd(5);
- pline("Your knees seem more flexible now.");
- break;
- case POT_BLINDNESS:
- if(!Blind) pline("It suddenly gets dark.");
- Blind += rnd(5);
- seeoff(0);
- break;
-/*
- case POT_GAIN_LEVEL:
- case POT_LEVITATION:
- case POT_FRUIT_JUICE:
- case POT_MONSTER_DETECTION:
- case POT_OBJECT_DETECTION:
- break;
-*/
- }
- /* note: no obfree() */
-}
-
-/*
- * -- rudimentary -- to do this correctly requires much more work
- * -- all sharp weapons get one or more qualities derived from the potions
- * -- texts on scrolls may be (partially) wiped out; do they become blank?
- * -- or does their effect change, like under Confusion?
- * -- all objects may be made invisible by POT_INVISIBILITY
- * -- If the flask is small, can one dip a large object? Does it magically
- * -- become a jug? Etc.
- */
-dodip(){
- struct obj *potion, *obj;
-
- if(!(obj = getobj("#", "dip")))
- return(0);
- if(!(potion = getobj("!", "dip into")))
- return(0);
- pline("Interesting...");
- if(obj->otyp == ARROW || obj->otyp == DART ||
- obj->otyp == CROSSBOW_BOLT) {
- if(potion->otyp == POT_SICKNESS) {
- useup(potion);
- if(obj->spe < 7) obj->spe++; /* %% */
- }
- }
- return(1);
-}
-
-ghost_from_bottle(){
- extern struct permonst pm_ghost;
- struct monst *mtmp;
-
- if(!(mtmp = makemon(PM_GHOST,u.ux,u.uy))){
- pline("This bottle turns out to be empty.");
- return;
- }
- mnexto(mtmp);
- pline("As you open the bottle, an enormous ghost emerges!");
- pline("You are frightened to death, and unable to move.");
- nomul(-3);
-}
diff --git a/games/hack/hack.pri.c b/games/hack/hack.pri.c
deleted file mode 100644
index 53eabdc..0000000
--- a/games/hack/hack.pri.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.pri.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-xchar scrlx, scrhx, scrly, scrhy; /* corners of new area on screen */
-
-extern char *hu_stat[]; /* in eat.c */
-extern char *CD;
-
-swallowed()
-{
- char *ulook = "|@|";
- ulook[1] = u.usym;
-
- cls();
- curs(u.ux-1, u.uy+1);
- fputs("/-\\", stdout);
- curx = u.ux+2;
- curs(u.ux-1, u.uy+2);
- fputs(ulook, stdout);
- curx = u.ux+2;
- curs(u.ux-1, u.uy+3);
- fputs("\\-/", stdout);
- curx = u.ux+2;
- u.udispl = 1;
- u.udisx = u.ux;
- u.udisy = u.uy;
-}
-
-
-/*VARARGS1*/
-boolean panicking;
-
-panic(str,a1,a2,a3,a4,a5,a6)
-char *str;
-{
- if(panicking++) exit(1); /* avoid loops - this should never happen*/
- home();
- puts(" Suddenly, the dungeon collapses.");
- fputs(" ERROR: ", stdout);
- printf(str,a1,a2,a3,a4,a5,a6);
-#ifdef DEBUG
-#ifdef UNIX
- if(!fork())
- abort(); /* generate core dump */
-#endif /* UNIX */
-#endif /* DEBUG */
- more(); /* contains a fflush() */
- done("panicked");
-}
-
-atl(x,y,ch)
-int x,y;
-{
- struct rm *crm = &levl[x][y];
-
- if(x<0 || x>COLNO-1 || y<0 || y>ROWNO-1){
- impossible("atl(%d,%d,%c)",x,y,ch);
- return;
- }
- if(crm->seen && crm->scrsym == ch) return;
- crm->scrsym = ch;
- crm->new = 1;
- on_scr(x,y);
-}
-
-on_scr(x,y)
-int x,y;
-{
- if(x < scrlx) scrlx = x;
- if(x > scrhx) scrhx = x;
- if(y < scrly) scrly = y;
- if(y > scrhy) scrhy = y;
-}
-
-/* call: (x,y) - display
- (-1,0) - close (leave last symbol)
- (-1,-1)- close (undo last symbol)
- (-1,let)-open: initialize symbol
- (-2,let)-change let
-*/
-
-tmp_at(x,y) schar x,y; {
-static schar prevx, prevy;
-static char let;
- if((int)x == -2){ /* change let call */
- let = y;
- return;
- }
- if((int)x == -1 && (int)y >= 0){ /* open or close call */
- let = y;
- prevx = -1;
- return;
- }
- if(prevx >= 0 && cansee(prevx,prevy)) {
- delay_output(50);
- prl(prevx, prevy); /* in case there was a monster */
- at(prevx, prevy, levl[prevx][prevy].scrsym);
- }
- if(x >= 0){ /* normal call */
- if(cansee(x,y)) at(x,y,let);
- prevx = x;
- prevy = y;
- } else { /* close call */
- let = 0;
- prevx = -1;
- }
-}
-
-/* like the previous, but the symbols are first erased on completion */
-Tmp_at(x,y) schar x,y; {
-static char let;
-static xchar cnt;
-static coord tc[COLNO]; /* but watch reflecting beams! */
-int xx,yy;
- if((int)x == -1) {
- if(y > 0) { /* open call */
- let = y;
- cnt = 0;
- return;
- }
- /* close call (do not distinguish y==0 and y==-1) */
- while(cnt--) {
- xx = tc[cnt].x;
- yy = tc[cnt].y;
- prl(xx, yy);
- at(xx, yy, levl[xx][yy].scrsym);
- }
- cnt = let = 0; /* superfluous */
- return;
- }
- if((int)x == -2) { /* change let call */
- let = y;
- return;
- }
- /* normal call */
- if(cansee(x,y)) {
- if(cnt) delay_output(50);
- at(x,y,let);
- tc[cnt].x = x;
- tc[cnt].y = y;
- if(++cnt >= COLNO) panic("Tmp_at overflow?");
- levl[x][y].new = 0; /* prevent pline-nscr erasing --- */
- }
-}
-
-setclipped(){
- error("Hack needs a screen of size at least %d by %d.\n",
- ROWNO+2, COLNO);
-}
-
-at(x,y,ch)
-xchar x,y;
-char ch;
-{
-#ifndef lint
- /* if xchar is unsigned, lint will complain about if(x < 0) */
- if(x < 0 || x > COLNO-1 || y < 0 || y > ROWNO-1) {
- impossible("At gets 0%o at %d %d.", ch, x, y);
- return;
- }
-#endif /* lint */
- if(!ch) {
- impossible("At gets null at %d %d.", x, y);
- return;
- }
- y += 2;
- curs(x,y);
- (void) putchar(ch);
- curx++;
-}
-
-prme(){
- if(!Invisible) at(u.ux,u.uy,u.usym);
-}
-
-doredraw()
-{
- docrt();
- return(0);
-}
-
-docrt()
-{
- int x,y;
- struct rm *room;
- struct monst *mtmp;
-
- if(u.uswallow) {
- swallowed();
- return;
- }
- cls();
-
-/* Some ridiculous code to get display of @ and monsters (almost) right */
- if(!Invisible) {
- levl[(u.udisx = u.ux)][(u.udisy = u.uy)].scrsym = u.usym;
- levl[u.udisx][u.udisy].seen = 1;
- u.udispl = 1;
- } else u.udispl = 0;
-
- seemons(); /* reset old positions */
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- mtmp->mdispl = 0;
- seemons(); /* force new positions to be shown */
-/* This nonsense should disappear soon --------------------------------- */
-
- for(y = 0; y < ROWNO; y++)
- for(x = 0; x < COLNO; x++)
- if((room = &levl[x][y])->new) {
- room->new = 0;
- at(x,y,room->scrsym);
- } else if(room->seen)
- at(x,y,room->scrsym);
- scrlx = COLNO;
- scrly = ROWNO;
- scrhx = scrhy = 0;
- flags.botlx = 1;
- bot();
-}
-
-docorner(xmin,ymax) int xmin,ymax; {
- int x,y;
- struct rm *room;
- struct monst *mtmp;
-
- if(u.uswallow) { /* Can be done more efficiently */
- swallowed();
- return;
- }
-
- seemons(); /* reset old positions */
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->mx >= xmin && mtmp->my < ymax)
- mtmp->mdispl = 0;
- seemons(); /* force new positions to be shown */
-
- for(y = 0; y < ymax; y++) {
- if(y > ROWNO && CD) break;
- curs(xmin,y+2);
- cl_end();
- if(y < ROWNO) {
- for(x = xmin; x < COLNO; x++) {
- if((room = &levl[x][y])->new) {
- room->new = 0;
- at(x,y,room->scrsym);
- } else
- if(room->seen)
- at(x,y,room->scrsym);
- }
- }
- }
- if(ymax > ROWNO) {
- cornbot(xmin-1);
- if(ymax > ROWNO+1 && CD) {
- curs(1,ROWNO+3);
- cl_eos();
- }
- }
-}
-
-curs_on_u(){
- curs(u.ux, u.uy+2);
-}
-
-pru()
-{
- if(u.udispl && (Invisible || u.udisx != u.ux || u.udisy != u.uy))
- /* if(! levl[u.udisx][u.udisy].new) */
- if(!vism_at(u.udisx, u.udisy))
- newsym(u.udisx, u.udisy);
- if(Invisible) {
- u.udispl = 0;
- prl(u.ux,u.uy);
- } else
- if(!u.udispl || u.udisx != u.ux || u.udisy != u.uy) {
- atl(u.ux, u.uy, u.usym);
- u.udispl = 1;
- u.udisx = u.ux;
- u.udisy = u.uy;
- }
- levl[u.ux][u.uy].seen = 1;
-}
-
-#ifndef NOWORM
-#include "def.wseg.h"
-extern struct wseg *m_atseg;
-#endif /* NOWORM */
-
-/* print a position that is visible for @ */
-prl(x,y)
-{
- struct rm *room;
- struct monst *mtmp;
- struct obj *otmp;
-
- if(x == u.ux && y == u.uy && (!Invisible)) {
- pru();
- return;
- }
- if(!isok(x,y)) return;
- room = &levl[x][y];
- if((!room->typ) ||
- (IS_ROCK(room->typ) && levl[u.ux][u.uy].typ == CORR))
- return;
- if((mtmp = m_at(x,y)) && !mtmp->mhide &&
- (!mtmp->minvis || See_invisible)) {
-#ifndef NOWORM
- if(m_atseg)
- pwseg(m_atseg);
- else
-#endif /* NOWORM */
- pmon(mtmp);
- }
- else if((otmp = o_at(x,y)) && room->typ != POOL)
- atl(x,y,otmp->olet);
- else if(mtmp && (!mtmp->minvis || See_invisible)) {
- /* must be a hiding monster, but not hiding right now */
- /* assume for the moment that long worms do not hide */
- pmon(mtmp);
- }
- else if(g_at(x,y) && room->typ != POOL)
- atl(x,y,'$');
- else if(!room->seen || room->scrsym == ' ') {
- room->new = room->seen = 1;
- newsym(x,y);
- on_scr(x,y);
- }
- room->seen = 1;
-}
-
-char
-news0(x,y)
-xchar x,y;
-{
- struct obj *otmp;
- struct trap *ttmp;
- struct rm *room;
- char tmp;
-
- room = &levl[x][y];
- if(!room->seen) tmp = ' ';
- else if(room->typ == POOL) tmp = POOL_SYM;
- else if(!Blind && (otmp = o_at(x,y))) tmp = otmp->olet;
- else if(!Blind && g_at(x,y)) tmp = '$';
- else if(x == xupstair && y == yupstair) tmp = '<';
- else if(x == xdnstair && y == ydnstair) tmp = '>';
- else if((ttmp = t_at(x,y)) && ttmp->tseen) tmp = '^';
- else switch(room->typ) {
- case SCORR:
- case SDOOR:
- tmp = room->scrsym; /* %% wrong after killing mimic ! */
- break;
- case HWALL:
- tmp = '-';
- break;
- case VWALL:
- tmp = '|';
- break;
- case LDOOR:
- case DOOR:
- tmp = '+';
- break;
- case CORR:
- tmp = CORR_SYM;
- break;
- case ROOM:
- if(room->lit || cansee(x,y) || Blind) tmp = '.';
- else tmp = ' ';
- break;
-/*
- case POOL:
- tmp = POOL_SYM;
- break;
-*/
- default:
- tmp = ERRCHAR;
- }
- return(tmp);
-}
-
-newsym(x,y)
-int x,y;
-{
- atl(x,y,news0(x,y));
-}
-
-/* used with wand of digging (or pick-axe): fill scrsym and force display */
-/* also when a POOL evaporates */
-mnewsym(x,y)
-int x,y;
-{
- struct rm *room;
- char newscrsym;
-
- if(!vism_at(x,y)) {
- room = &levl[x][y];
- newscrsym = news0(x,y);
- if(room->scrsym != newscrsym) {
- room->scrsym = newscrsym;
- room->seen = 0;
- }
- }
-}
-
-nosee(x,y)
-int x,y;
-{
- struct rm *room;
-
- if(!isok(x,y)) return;
- room = &levl[x][y];
- if(room->scrsym == '.' && !room->lit && !Blind) {
- room->scrsym = ' ';
- room->new = 1;
- on_scr(x,y);
- }
-}
-
-#ifndef QUEST
-prl1(x,y)
-int x,y;
-{
- if(u.dx) {
- if(u.dy) {
- prl(x-(2*u.dx),y);
- prl(x-u.dx,y);
- prl(x,y);
- prl(x,y-u.dy);
- prl(x,y-(2*u.dy));
- } else {
- prl(x,y-1);
- prl(x,y);
- prl(x,y+1);
- }
- } else {
- prl(x-1,y);
- prl(x,y);
- prl(x+1,y);
- }
-}
-
-nose1(x,y)
-int x,y;
-{
- if(u.dx) {
- if(u.dy) {
- nosee(x,u.uy);
- nosee(x,u.uy-u.dy);
- nosee(x,y);
- nosee(u.ux-u.dx,y);
- nosee(u.ux,y);
- } else {
- nosee(x,y-1);
- nosee(x,y);
- nosee(x,y+1);
- }
- } else {
- nosee(x-1,y);
- nosee(x,y);
- nosee(x+1,y);
- }
-}
-#endif /* QUEST */
-
-vism_at(x,y)
-int x,y;
-{
- struct monst *mtmp;
-
- return((x == u.ux && y == u.uy && !Invisible)
- ? 1 :
- (mtmp = m_at(x,y))
- ? ((Blind && Telepat) || canseemon(mtmp)) :
- 0);
-}
-
-#ifdef NEWSCR
-pobj(obj) struct obj *obj; {
-int show = (!obj->oinvis || See_invisible) &&
- cansee(obj->ox,obj->oy);
- if(obj->odispl){
- if(obj->odx != obj->ox || obj->ody != obj->oy || !show)
- if(!vism_at(obj->odx,obj->ody)){
- newsym(obj->odx, obj->ody);
- obj->odispl = 0;
- }
- }
- if(show && !vism_at(obj->ox,obj->oy)){
- atl(obj->ox,obj->oy,obj->olet);
- obj->odispl = 1;
- obj->odx = obj->ox;
- obj->ody = obj->oy;
- }
-}
-#endif /* NEWSCR */
-
-unpobj(obj) struct obj *obj; {
-/* if(obj->odispl){
- if(!vism_at(obj->odx, obj->ody))
- newsym(obj->odx, obj->ody);
- obj->odispl = 0;
- }
-*/
- if(!vism_at(obj->ox,obj->oy))
- newsym(obj->ox,obj->oy);
-}
-
-seeobjs(){
-struct obj *obj, *obj2;
- for(obj = fobj; obj; obj = obj2) {
- obj2 = obj->nobj;
- if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE
- && obj->age + 250 < moves)
- delobj(obj);
- }
- for(obj = invent; obj; obj = obj2) {
- obj2 = obj->nobj;
- if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE
- && obj->age + 250 < moves)
- useup(obj);
- }
-}
-
-seemons(){
-struct monst *mtmp;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
- if(mtmp->data->mlet == ';')
- mtmp->minvis = (u.ustuck != mtmp &&
- levl[mtmp->mx][mtmp->my].typ == POOL);
- pmon(mtmp);
-#ifndef NOWORM
- if(mtmp->wormno) wormsee(mtmp->wormno);
-#endif /* NOWORM */
- }
-}
-
-pmon(mon) struct monst *mon; {
-int show = (Blind && Telepat) || canseemon(mon);
- if(mon->mdispl){
- if(mon->mdx != mon->mx || mon->mdy != mon->my || !show)
- unpmon(mon);
- }
- if(show && !mon->mdispl){
- atl(mon->mx,mon->my,
- (!mon->mappearance
- || u.uprops[PROP(RIN_PROTECTION_FROM_SHAPE_CHANGERS)].p_flgs
- ) ? mon->data->mlet : mon->mappearance);
- mon->mdispl = 1;
- mon->mdx = mon->mx;
- mon->mdy = mon->my;
- }
-}
-
-unpmon(mon) struct monst *mon; {
- if(mon->mdispl){
- newsym(mon->mdx, mon->mdy);
- mon->mdispl = 0;
- }
-}
-
-nscr()
-{
- int x,y;
- struct rm *room;
-
- if(u.uswallow || u.ux == FAR || flags.nscrinh) return;
- pru();
- for(y = scrly; y <= scrhy; y++)
- for(x = scrlx; x <= scrhx; x++)
- if((room = &levl[x][y])->new) {
- room->new = 0;
- at(x,y,room->scrsym);
- }
- scrhx = scrhy = 0;
- scrlx = COLNO;
- scrly = ROWNO;
-}
-
-/* 100 suffices for bot(); no relation with COLNO */
-char oldbot[100], newbot[100];
-cornbot(lth)
-int lth;
-{
- if(lth < sizeof(oldbot)) {
- oldbot[lth] = 0;
- flags.botl = 1;
- }
-}
-
-bot()
-{
-char *ob = oldbot, *nb = newbot;
-int i;
-extern char *eos();
- if(flags.botlx) *ob = 0;
- flags.botl = flags.botlx = 0;
-#ifdef GOLD_ON_BOTL
- (void) sprintf(newbot,
- "Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Str ",
- dlevel, u.ugold, u.uhp, u.uhpmax, u.uac);
-#else
- (void) sprintf(newbot,
- "Level %-2d Hp %3d(%d) Ac %-2d Str ",
- dlevel, u.uhp, u.uhpmax, u.uac);
-#endif /* GOLD_ON_BOTL */
- if(u.ustr>18) {
- if(u.ustr>117)
- (void) strcat(newbot,"18/**");
- else
- (void) sprintf(eos(newbot), "18/%02d",u.ustr-18);
- } else
- (void) sprintf(eos(newbot), "%-2d ",u.ustr);
-#ifdef EXP_ON_BOTL
- (void) sprintf(eos(newbot), " Exp %2d/%-5lu ", u.ulevel,u.uexp);
-#else
- (void) sprintf(eos(newbot), " Exp %2u ", u.ulevel);
-#endif /* EXP_ON_BOTL */
- (void) strcat(newbot, hu_stat[u.uhs]);
- if(flags.time)
- (void) sprintf(eos(newbot), " %ld", moves);
- if(strlen(newbot) >= COLNO) {
- char *bp0, *bp1;
- bp0 = bp1 = newbot;
- do {
- if(*bp0 != ' ' || bp0[1] != ' ' || bp0[2] != ' ')
- *bp1++ = *bp0;
- } while(*bp0++);
- }
- for(i = 1; i<COLNO; i++) {
- if(*ob != *nb){
- curs(i,ROWNO+2);
- (void) putchar(*nb ? *nb : ' ');
- curx++;
- }
- if(*ob) ob++;
- if(*nb) nb++;
- }
- (void) strcpy(oldbot, newbot);
-}
-
-#ifdef WAN_PROBING
-mstatusline(mtmp) struct monst *mtmp; {
- pline("Status of %s: ", monnam(mtmp));
- pline("Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Dam %d",
- mtmp->data->mlevel, mtmp->mgold, mtmp->mhp, mtmp->mhpmax,
- mtmp->data->ac, (mtmp->data->damn + 1) * (mtmp->data->damd + 1));
-}
-#endif /* WAN_PROBING */
-
-cls(){
- if(flags.toplin == 1)
- more();
- flags.toplin = 0;
-
- clear_screen();
-
- flags.botlx = 1;
-}
diff --git a/games/hack/hack.read.c b/games/hack/hack.read.c
deleted file mode 100644
index 82b917a..0000000
--- a/games/hack/hack.read.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.read.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-extern struct monst *makemon();
-extern struct obj *mkobj_at();
-int identify();
-
-doread() {
- struct obj *scroll;
- boolean confused = (Confusion != 0);
- boolean known = FALSE;
- extern struct obj *some_armor();
-
- scroll = getobj("?", "read");
- if(!scroll) return(0);
- if(!scroll->dknown && Blind) {
- pline("Being blind, you cannot read the formula on the scroll.");
- return(0);
- }
- if(Blind)
- pline("As you pronounce the formula on it, the scroll disappears.");
- else
- pline("As you read the scroll, it disappears.");
- if(confused)
- pline("Being confused, you mispronounce the magic words ... ");
-
- switch(scroll->otyp) {
-#ifdef MAIL
- case SCR_MAIL:
- readmail(/* scroll */);
- break;
-#endif /* MAIL */
- case SCR_ENCHANT_ARMOR:
- { struct obj *otmp = some_armor();
- if(!otmp) {
- strange_feeling(scroll,"Your skin glows then fades.");
- return(1);
- }
- if(confused) {
- pline("Your %s glows silver for a moment.",
- objects[otmp->otyp].oc_name);
- otmp->rustfree = 1;
- break;
- }
- if(otmp->spe > 3 && rn2(otmp->spe)) {
- pline("Your %s glows violently green for a while, then evaporates.",
- objects[otmp->otyp].oc_name);
- useup(otmp);
- break;
- }
- pline("Your %s glows green for a moment.",
- objects[otmp->otyp].oc_name);
- otmp->cursed = 0;
- otmp->spe++;
- break;
- }
- case SCR_DESTROY_ARMOR:
- if(confused) {
- struct obj *otmp = some_armor();
- if(!otmp) {
- strange_feeling(scroll,"Your bones itch.");
- return(1);
- }
- pline("Your %s glows purple for a moment.",
- objects[otmp->otyp].oc_name);
- otmp->rustfree = 0;
- break;
- }
- if(uarm) {
- pline("Your armor turns to dust and falls to the floor!");
- useup(uarm);
- } else if(uarmh) {
- pline("Your helmet turns to dust and is blown away!");
- useup(uarmh);
- } else if(uarmg) {
- pline("Your gloves vanish!");
- useup(uarmg);
- selftouch("You");
- } else {
- strange_feeling(scroll,"Your skin itches.");
- return(1);
- }
- break;
- case SCR_CONFUSE_MONSTER:
- if(confused) {
- pline("Your hands begin to glow purple.");
- Confusion += rnd(100);
- } else {
- pline("Your hands begin to glow blue.");
- u.umconf = 1;
- }
- break;
- case SCR_SCARE_MONSTER:
- { int ct = 0;
- struct monst *mtmp;
-
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(cansee(mtmp->mx,mtmp->my)) {
- if(confused)
- mtmp->mflee = mtmp->mfroz =
- mtmp->msleep = 0;
- else
- mtmp->mflee = 1;
- ct++;
- }
- if(!ct) {
- if(confused)
- pline("You hear sad wailing in the distance.");
- else
- pline("You hear maniacal laughter in the distance.");
- }
- break;
- }
- case SCR_BLANK_PAPER:
- if(confused)
- pline("You see strange patterns on this scroll.");
- else
- pline("This scroll seems to be blank.");
- break;
- case SCR_REMOVE_CURSE:
- { struct obj *obj;
- if(confused)
- pline("You feel like you need some help.");
- else
- pline("You feel like someone is helping you.");
- for(obj = invent; obj ; obj = obj->nobj)
- if(obj->owornmask)
- obj->cursed = confused;
- if(Punished && !confused) {
- Punished = 0;
- freeobj(uchain);
- unpobj(uchain);
- free((char *) uchain);
- uball->spe = 0;
- uball->owornmask &= ~W_BALL;
- uchain = uball = (struct obj *) 0;
- }
- break;
- }
- case SCR_CREATE_MONSTER:
- { int cnt = 1;
-
- if(!rn2(73)) cnt += rnd(4);
- if(confused) cnt += 12;
- while(cnt--)
- (void) makemon(confused ? PM_ACID_BLOB :
- (struct permonst *) 0, u.ux, u.uy);
- break;
- }
- case SCR_ENCHANT_WEAPON:
- if(uwep && confused) {
- pline("Your %s glows silver for a moment.",
- objects[uwep->otyp].oc_name);
- uwep->rustfree = 1;
- } else
- if(!chwepon(scroll, 1)) /* tests for !uwep */
- return(1);
- break;
- case SCR_DAMAGE_WEAPON:
- if(uwep && confused) {
- pline("Your %s glows purple for a moment.",
- objects[uwep->otyp].oc_name);
- uwep->rustfree = 0;
- } else
- if(!chwepon(scroll, -1)) /* tests for !uwep */
- return(1);
- break;
- case SCR_TAMING:
- { int i,j;
- int bd = confused ? 5 : 1;
- struct monst *mtmp;
-
- for(i = -bd; i <= bd; i++) for(j = -bd; j <= bd; j++)
- if(mtmp = m_at(u.ux+i, u.uy+j))
- (void) tamedog(mtmp, (struct obj *) 0);
- break;
- }
- case SCR_GENOCIDE:
- { extern char genocided[], fut_geno[];
- char buf[BUFSZ];
- struct monst *mtmp, *mtmp2;
-
- pline("You have found a scroll of genocide!");
- known = TRUE;
- if(confused)
- *buf = u.usym;
- else do {
- pline("What monster do you want to genocide (Type the letter)? ");
- getlin(buf);
- } while(strlen(buf) != 1 || !monstersym(*buf));
- if(!index(fut_geno, *buf))
- charcat(fut_geno, *buf);
- if(!index(genocided, *buf))
- charcat(genocided, *buf);
- else {
- pline("Such monsters do not exist in this world.");
- break;
- }
- for(mtmp = fmon; mtmp; mtmp = mtmp2){
- mtmp2 = mtmp->nmon;
- if(mtmp->data->mlet == *buf)
- mondead(mtmp);
- }
- pline("Wiped out all %c's.", *buf);
- if(*buf == u.usym) {
- killer = "scroll of genocide";
- u.uhp = -1;
- }
- break;
- }
- case SCR_LIGHT:
- if(!Blind) known = TRUE;
- litroom(!confused);
- break;
- case SCR_TELEPORTATION:
- if(confused)
- level_tele();
- else {
-#ifdef QUEST
- int oux = u.ux, ouy = u.uy;
- tele();
- if(dist(oux, ouy) > 100) known = TRUE;
-#else /* QUEST */
- int uroom = inroom(u.ux, u.uy);
- tele();
- if(uroom != inroom(u.ux, u.uy)) known = TRUE;
-#endif /* QUEST */
- }
- break;
- case SCR_GOLD_DETECTION:
- /* Unfortunately this code has become slightly less elegant,
- now that gold and traps no longer are of the same type. */
- if(confused) {
- struct trap *ttmp;
-
- if(!ftrap) {
- strange_feeling(scroll, "Your toes stop itching.");
- return(1);
- } else {
- for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
- if(ttmp->tx != u.ux || ttmp->ty != u.uy)
- goto outtrapmap;
- /* only under me - no separate display required */
- pline("Your toes itch!");
- break;
- outtrapmap:
- cls();
- for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
- at(ttmp->tx, ttmp->ty, '$');
- prme();
- pline("You feel very greedy!");
- }
- } else {
- struct gold *gtmp;
-
- if(!fgold) {
- strange_feeling(scroll, "You feel materially poor.");
- return(1);
- } else {
- known = TRUE;
- for(gtmp = fgold; gtmp; gtmp = gtmp->ngold)
- if(gtmp->gx != u.ux || gtmp->gy != u.uy)
- goto outgoldmap;
- /* only under me - no separate display required */
- pline("You notice some gold between your feet.");
- break;
- outgoldmap:
- cls();
- for(gtmp = fgold; gtmp; gtmp = gtmp->ngold)
- at(gtmp->gx, gtmp->gy, '$');
- prme();
- pline("You feel very greedy, and sense gold!");
- }
- }
- /* common sequel */
- more();
- docrt();
- break;
- case SCR_FOOD_DETECTION:
- { int ct = 0, ctu = 0;
- struct obj *obj;
- char foodsym = confused ? POTION_SYM : FOOD_SYM;
-
- for(obj = fobj; obj; obj = obj->nobj)
- if(obj->olet == FOOD_SYM) {
- if(obj->ox == u.ux && obj->oy == u.uy) ctu++;
- else ct++;
- }
- if(!ct && !ctu) {
- strange_feeling(scroll,"Your nose twitches.");
- return(1);
- } else if(!ct) {
- known = TRUE;
- pline("You smell %s close nearby.",
- confused ? "something" : "food");
-
- } else {
- known = TRUE;
- cls();
- for(obj = fobj; obj; obj = obj->nobj)
- if(obj->olet == foodsym)
- at(obj->ox, obj->oy, FOOD_SYM);
- prme();
- pline("Your nose tingles and you smell %s!",
- confused ? "something" : "food");
- more();
- docrt();
- }
- break;
- }
- case SCR_IDENTIFY:
- /* known = TRUE; */
- if(confused)
- pline("You identify this as an identify scroll.");
- else
- pline("This is an identify scroll.");
- useup(scroll);
- objects[SCR_IDENTIFY].oc_name_known = 1;
- if(!confused)
- while(
- !ggetobj("identify", identify, rn2(5) ? 1 : rn2(5))
- && invent
- );
- return(1);
- case SCR_MAGIC_MAPPING:
- { struct rm *lev;
- int num, zx, zy;
-
- known = TRUE;
- pline("On this scroll %s a map!",
- confused ? "was" : "is");
- for(zy = 0; zy < ROWNO; zy++)
- for(zx = 0; zx < COLNO; zx++) {
- if(confused && rn2(7)) continue;
- lev = &(levl[zx][zy]);
- if((num = lev->typ) == 0)
- continue;
- if(num == SCORR) {
- lev->typ = CORR;
- lev->scrsym = CORR_SYM;
- } else
- if(num == SDOOR) {
- lev->typ = DOOR;
- lev->scrsym = '+';
- /* do sth in doors ? */
- } else if(lev->seen) continue;
-#ifndef QUEST
- if(num != ROOM)
-#endif /* QUEST */
- {
- lev->seen = lev->new = 1;
- if(lev->scrsym == ' ' || !lev->scrsym)
- newsym(zx,zy);
- else
- on_scr(zx,zy);
- }
- }
- break;
- }
- case SCR_AMNESIA:
- { int zx, zy;
-
- known = TRUE;
- for(zx = 0; zx < COLNO; zx++) for(zy = 0; zy < ROWNO; zy++)
- if(!confused || rn2(7))
- if(!cansee(zx,zy))
- levl[zx][zy].seen = 0;
- docrt();
- pline("Thinking of Maud you forget everything else.");
- break;
- }
- case SCR_FIRE:
- { int num;
- struct monst *mtmp;
-
- known = TRUE;
- if(confused) {
- pline("The scroll catches fire and you burn your hands.");
- losehp(1, "scroll of fire");
- } else {
- pline("The scroll erupts in a tower of flame!");
- if(Fire_resistance)
- pline("You are uninjured.");
- else {
- num = rnd(6);
- u.uhpmax -= num;
- losehp(num, "scroll of fire");
- }
- }
- num = (2*num + 1)/3;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
- if(dist(mtmp->mx,mtmp->my) < 3) {
- mtmp->mhp -= num;
- if(index("FY", mtmp->data->mlet))
- mtmp->mhp -= 3*num; /* this might well kill 'F's */
- if(mtmp->mhp < 1) {
- killed(mtmp);
- break; /* primitive */
- }
- }
- }
- break;
- }
- case SCR_PUNISHMENT:
- known = TRUE;
- if(confused) {
- pline("You feel guilty.");
- break;
- }
- pline("You are being punished for your misbehaviour!");
- if(Punished){
- pline("Your iron ball gets heavier.");
- uball->owt += 15;
- break;
- }
- Punished = INTRINSIC;
- setworn(mkobj_at(CHAIN_SYM, u.ux, u.uy), W_CHAIN);
- setworn(mkobj_at(BALL_SYM, u.ux, u.uy), W_BALL);
- uball->spe = 1; /* special ball (see save) */
- break;
- default:
- impossible("What weird language is this written in? (%u)",
- scroll->otyp);
- }
- if(!objects[scroll->otyp].oc_name_known) {
- if(known && !confused) {
- objects[scroll->otyp].oc_name_known = 1;
- more_experienced(0,10);
- } else if(!objects[scroll->otyp].oc_uname)
- docall(scroll);
- }
- useup(scroll);
- return(1);
-}
-
-identify(otmp) /* also called by newmail() */
-struct obj *otmp;
-{
- objects[otmp->otyp].oc_name_known = 1;
- otmp->known = otmp->dknown = 1;
- prinv(otmp);
- return(1);
-}
-
-litroom(on)
-boolean on;
-{
- int num,zx,zy;
-
- /* first produce the text (provided he is not blind) */
- if(Blind) goto do_it;
- if(!on) {
- if(u.uswallow || !xdnstair || levl[u.ux][u.uy].typ == CORR ||
- !levl[u.ux][u.uy].lit) {
- pline("It seems even darker in here than before.");
- return;
- } else
- pline("It suddenly becomes dark in here.");
- } else {
- if(u.uswallow){
- pline("%s's stomach is lit.", Monnam(u.ustuck));
- return;
- }
- if(!xdnstair){
- pline("Nothing Happens.");
- return;
- }
-#ifdef QUEST
- pline("The cave lights up around you, then fades.");
- return;
-#else /* QUEST */
- if(levl[u.ux][u.uy].typ == CORR) {
- pline("The corridor lights up around you, then fades.");
- return;
- } else if(levl[u.ux][u.uy].lit) {
- pline("The light here seems better now.");
- return;
- } else
- pline("The room is lit.");
-#endif /* QUEST */
- }
-
-do_it:
-#ifdef QUEST
- return;
-#else /* QUEST */
- if(levl[u.ux][u.uy].lit == on)
- return;
- if(levl[u.ux][u.uy].typ == DOOR) {
- if(IS_ROOM(levl[u.ux][u.uy+1].typ)) zy = u.uy+1;
- else if(IS_ROOM(levl[u.ux][u.uy-1].typ)) zy = u.uy-1;
- else zy = u.uy;
- if(IS_ROOM(levl[u.ux+1][u.uy].typ)) zx = u.ux+1;
- else if(IS_ROOM(levl[u.ux-1][u.uy].typ)) zx = u.ux-1;
- else zx = u.ux;
- } else {
- zx = u.ux;
- zy = u.uy;
- }
- for(seelx = u.ux; (num = levl[seelx-1][zy].typ) != CORR && num != 0;
- seelx--);
- for(seehx = u.ux; (num = levl[seehx+1][zy].typ) != CORR && num != 0;
- seehx++);
- for(seely = u.uy; (num = levl[zx][seely-1].typ) != CORR && num != 0;
- seely--);
- for(seehy = u.uy; (num = levl[zx][seehy+1].typ) != CORR && num != 0;
- seehy++);
- for(zy = seely; zy <= seehy; zy++)
- for(zx = seelx; zx <= seehx; zx++) {
- levl[zx][zy].lit = on;
- if(!Blind && dist(zx,zy) > 2) {
- if(on) prl(zx,zy); else nosee(zx,zy);
- }
- }
- if(!on) seehx = 0;
-#endif /* QUEST */
-}
-
-/* Test whether we may genocide all monsters with symbol ch */
-monstersym(ch) /* arnold@ucsfcgl */
-char ch;
-{
- struct permonst *mp;
- extern struct permonst pm_eel;
-
- /*
- * can't genocide certain monsters
- */
- if (index("12 &:", ch))
- return FALSE;
-
- if (ch == pm_eel.mlet)
- return TRUE;
- for (mp = mons; mp < &mons[CMNUM+2]; mp++)
- if (mp->mlet == ch)
- return TRUE;
- return FALSE;
-}
diff --git a/games/hack/hack.rip.c b/games/hack/hack.rip.c
deleted file mode 100644
index f37b9ec..0000000
--- a/games/hack/hack.rip.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.rip.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include <stdio.h>
-#include "hack.h"
-
-extern char plname[];
-
-static char *rip[] = {
-" ----------",
-" / \\",
-" / REST \\",
-" / IN \\",
-" / PEACE \\",
-" / \\",
-" | |",
-" | |",
-" | |",
-" | |",
-" | |",
-" | 1001 |",
-" *| * * * | *",
-" _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______\n",
-0
-};
-
-outrip(){
- char **dp = rip;
- char *dpx;
- char buf[BUFSZ];
- int x,y;
-
- cls();
- (void) strcpy(buf, plname);
- buf[16] = 0;
- center(6, buf);
- (void) sprintf(buf, "%ld AU", u.ugold);
- center(7, buf);
- (void) sprintf(buf, "killed by%s",
- !strncmp(killer, "the ", 4) ? "" :
- !strcmp(killer, "starvation") ? "" :
- index(vowels, *killer) ? " an" : " a");
- center(8, buf);
- (void) strcpy(buf, killer);
- if(strlen(buf) > 16) {
- int i,i0,i1;
- i0 = i1 = 0;
- for(i = 0; i <= 16; i++)
- if(buf[i] == ' ') i0 = i, i1 = i+1;
- if(!i0) i0 = i1 = 16;
- buf[i1 + 16] = 0;
- center(10, buf+i1);
- buf[i0] = 0;
- }
- center(9, buf);
- (void) sprintf(buf, "%4d", getyear());
- center(11, buf);
- for(y=8; *dp; y++,dp++){
- x = 0;
- dpx = *dp;
- while(dpx[x]) {
- while(dpx[x] == ' ') x++;
- curs(x,y);
- while(dpx[x] && dpx[x] != ' '){
- extern int done_stopprint;
- if(done_stopprint)
- return;
- curx++;
- (void) putchar(dpx[x++]);
- }
- }
- }
- getret();
-}
-
-center(line, text) int line; char *text; {
-char *ip,*op;
- ip = text;
- op = &rip[line][28 - ((strlen(text)+1)/2)];
- while(*ip) *op++ = *ip++;
-}
diff --git a/games/hack/hack.rumors.c b/games/hack/hack.rumors.c
deleted file mode 100644
index 6d63ee5..0000000
--- a/games/hack/hack.rumors.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.rumors.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <stdio.h>
-#include "hack.h" /* for RUMORFILE and BSD (index) */
-#define CHARSZ 8 /* number of bits in a char */
-extern long *alloc();
-extern char *index();
-int n_rumors = 0;
-int n_used_rumors = -1;
-char *usedbits;
-
-init_rumors(rumf) FILE *rumf; {
-int i;
- n_used_rumors = 0;
- while(skipline(rumf)) n_rumors++;
- rewind(rumf);
- i = n_rumors/CHARSZ;
- usedbits = (char *) alloc((unsigned)(i+1));
- for( ; i>=0; i--) usedbits[i] = 0;
-}
-
-skipline(rumf) FILE *rumf; {
-char line[COLNO];
- while(1) {
- if(!fgets(line, sizeof(line), rumf)) return(0);
- if(index(line, '\n')) return(1);
- }
-}
-
-outline(rumf) FILE *rumf; {
-char line[COLNO];
-char *ep;
- if(!fgets(line, sizeof(line), rumf)) return;
- if((ep = index(line, '\n')) != 0) *ep = 0;
- pline("This cookie has a scrap of paper inside! It reads: ");
- pline(line);
-}
-
-outrumor(){
-int rn,i;
-FILE *rumf;
- if(n_rumors <= n_used_rumors ||
- (rumf = fopen(RUMORFILE, "r")) == (FILE *) 0) return;
- if(n_used_rumors < 0) init_rumors(rumf);
- if(!n_rumors) goto none;
- rn = rn2(n_rumors - n_used_rumors);
- i = 0;
- while(rn || used(i)) {
- (void) skipline(rumf);
- if(!used(i)) rn--;
- i++;
- }
- usedbits[i/CHARSZ] |= (1 << (i % CHARSZ));
- n_used_rumors++;
- outline(rumf);
-none:
- (void) fclose(rumf);
-}
-
-used(i) int i; {
- return(usedbits[i/CHARSZ] & (1 << (i % CHARSZ)));
-}
diff --git a/games/hack/hack.save.c b/games/hack/hack.save.c
deleted file mode 100644
index a14e11e..0000000
--- a/games/hack/hack.save.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.save.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern char genocided[60]; /* defined in Decl.c */
-extern char fut_geno[60]; /* idem */
-#include <signal.h>
-#include <unistd.h>
-
-extern char SAVEF[], nul[];
-extern char pl_character[PL_CSIZ];
-extern struct obj *restobjchn();
-extern struct monst *restmonchn();
-
-dosave(){
- if(dosave0(0)) {
- settty("Be seeing you ...\n");
- exit(0);
- }
-#ifdef lint
- return(0);
-#endif /* lint */
-}
-
-#ifndef NOSAVEONHANGUP
-hangup(){
- (void) dosave0(1);
- exit(1);
-}
-#endif /* NOSAVEONHANGUP */
-
-/* returns 1 if save successful */
-dosave0(hu) int hu; {
- int fd, ofd;
- int tmp; /* not ! */
-
- (void) signal(SIGHUP, SIG_IGN);
- (void) signal(SIGINT, SIG_IGN);
- if((fd = creat(SAVEF, FMASK)) < 0) {
- if(!hu) pline("Cannot open save file. (Continue or Quit)");
- (void) unlink(SAVEF); /* ab@unido */
- return(0);
- }
- if(flags.moonphase == FULL_MOON) /* ut-sally!fletcher */
- u.uluck--; /* and unido!ab */
- savelev(fd,dlevel);
- saveobjchn(fd, invent);
- saveobjchn(fd, fcobj);
- savemonchn(fd, fallen_down);
- tmp = getuid();
- bwrite(fd, (char *) &tmp, sizeof tmp);
- bwrite(fd, (char *) &flags, sizeof(struct flag));
- bwrite(fd, (char *) &dlevel, sizeof dlevel);
- bwrite(fd, (char *) &maxdlevel, sizeof maxdlevel);
- bwrite(fd, (char *) &moves, sizeof moves);
- bwrite(fd, (char *) &u, sizeof(struct you));
- if(u.ustuck)
- bwrite(fd, (char *) &(u.ustuck->m_id), sizeof u.ustuck->m_id);
- bwrite(fd, (char *) pl_character, sizeof pl_character);
- bwrite(fd, (char *) genocided, sizeof genocided);
- bwrite(fd, (char *) fut_geno, sizeof fut_geno);
- savenames(fd);
- for(tmp = 1; tmp <= maxdlevel; tmp++) {
- extern int hackpid;
- extern boolean level_exists[];
-
- if(tmp == dlevel || !level_exists[tmp]) continue;
- glo(tmp);
- if((ofd = open(lock, 0)) < 0) {
- if(!hu) pline("Error while saving: cannot read %s.", lock);
- (void) close(fd);
- (void) unlink(SAVEF);
- if(!hu) done("tricked");
- return(0);
- }
- getlev(ofd, hackpid, tmp);
- (void) close(ofd);
- bwrite(fd, (char *) &tmp, sizeof tmp); /* level number */
- savelev(fd,tmp); /* actual level */
- (void) unlink(lock);
- }
- (void) close(fd);
- glo(dlevel);
- (void) unlink(lock); /* get rid of current level --jgm */
- glo(0);
- (void) unlink(lock);
- return(1);
-}
-
-dorecover(fd)
-int fd;
-{
- int nfd;
- int tmp; /* not a ! */
- unsigned mid; /* idem */
- struct obj *otmp;
- extern boolean restoring;
-
- restoring = TRUE;
- getlev(fd, 0, 0);
- invent = restobjchn(fd);
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp->owornmask)
- setworn(otmp, otmp->owornmask);
- fcobj = restobjchn(fd);
- fallen_down = restmonchn(fd);
- mread(fd, (char *) &tmp, sizeof tmp);
- if(tmp != getuid()) { /* strange ... */
- (void) close(fd);
- (void) unlink(SAVEF);
- puts("Saved game was not yours.");
- restoring = FALSE;
- return(0);
- }
- mread(fd, (char *) &flags, sizeof(struct flag));
- mread(fd, (char *) &dlevel, sizeof dlevel);
- mread(fd, (char *) &maxdlevel, sizeof maxdlevel);
- mread(fd, (char *) &moves, sizeof moves);
- mread(fd, (char *) &u, sizeof(struct you));
- if(u.ustuck)
- mread(fd, (char *) &mid, sizeof mid);
- mread(fd, (char *) pl_character, sizeof pl_character);
- mread(fd, (char *) genocided, sizeof genocided);
- mread(fd, (char *) fut_geno, sizeof fut_geno);
- restnames(fd);
- while(1) {
- if(read(fd, (char *) &tmp, sizeof tmp) != sizeof tmp)
- break;
- getlev(fd, 0, tmp);
- glo(tmp);
- if((nfd = creat(lock, FMASK)) < 0)
- panic("Cannot open temp file %s!\n", lock);
- savelev(nfd,tmp);
- (void) close(nfd);
- }
- (void) lseek(fd, (off_t)0, 0);
- getlev(fd, 0, 0);
- (void) close(fd);
- (void) unlink(SAVEF);
- if(Punished) {
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->olet == CHAIN_SYM) goto chainfnd;
- panic("Cannot find the iron chain?");
- chainfnd:
- uchain = otmp;
- if(!uball){
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->olet == BALL_SYM && otmp->spe)
- goto ballfnd;
- panic("Cannot find the iron ball?");
- ballfnd:
- uball = otmp;
- }
- }
- if(u.ustuck) {
- struct monst *mtmp;
-
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->m_id == mid) goto monfnd;
- panic("Cannot find the monster ustuck.");
- monfnd:
- u.ustuck = mtmp;
- }
-#ifndef QUEST
- setsee(); /* only to recompute seelx etc. - these weren't saved */
-#endif /* QUEST */
- docrt();
- restoring = FALSE;
- return(1);
-}
-
-struct obj *
-restobjchn(fd)
-int fd;
-{
- struct obj *otmp, *otmp2;
- struct obj *first = 0;
- int xl;
-#ifdef lint
- /* suppress "used before set" warning from lint */
- otmp2 = 0;
-#endif /* lint */
- while(1) {
- mread(fd, (char *) &xl, sizeof(xl));
- if(xl == -1) break;
- otmp = newobj(xl);
- if(!first) first = otmp;
- else otmp2->nobj = otmp;
- mread(fd, (char *) otmp, (unsigned) xl + sizeof(struct obj));
- if(!otmp->o_id) otmp->o_id = flags.ident++;
- otmp2 = otmp;
- }
- if(first && otmp2->nobj){
- impossible("Restobjchn: error reading objchn.");
- otmp2->nobj = 0;
- }
- return(first);
-}
-
-struct monst *
-restmonchn(fd)
-int fd;
-{
- struct monst *mtmp, *mtmp2;
- struct monst *first = 0;
- int xl;
-
- struct permonst *monbegin;
- long differ;
-
- mread(fd, (char *)&monbegin, sizeof(monbegin));
- differ = (char *)(&mons[0]) - (char *)(monbegin);
-
-#ifdef lint
- /* suppress "used before set" warning from lint */
- mtmp2 = 0;
-#endif /* lint */
- while(1) {
- mread(fd, (char *) &xl, sizeof(xl));
- if(xl == -1) break;
- mtmp = newmonst(xl);
- if(!first) first = mtmp;
- else mtmp2->nmon = mtmp;
- mread(fd, (char *) mtmp, (unsigned) xl + sizeof(struct monst));
- if(!mtmp->m_id)
- mtmp->m_id = flags.ident++;
- mtmp->data = (struct permonst *)
- ((char *) mtmp->data + differ);
- if(mtmp->minvent)
- mtmp->minvent = restobjchn(fd);
- mtmp2 = mtmp;
- }
- if(first && mtmp2->nmon){
- impossible("Restmonchn: error reading monchn.");
- mtmp2->nmon = 0;
- }
- return(first);
-}
diff --git a/games/hack/hack.search.c b/games/hack/hack.search.c
deleted file mode 100644
index 8476c88..0000000
--- a/games/hack/hack.search.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.search.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-extern struct monst *makemon();
-
-findit() /* returns number of things found */
-{
- int num;
- xchar zx,zy;
- struct trap *ttmp;
- struct monst *mtmp;
- xchar lx,hx,ly,hy;
-
- if(u.uswallow) return(0);
- for(lx = u.ux; (num = levl[lx-1][u.uy].typ) && num != CORR; lx--) ;
- for(hx = u.ux; (num = levl[hx+1][u.uy].typ) && num != CORR; hx++) ;
- for(ly = u.uy; (num = levl[u.ux][ly-1].typ) && num != CORR; ly--) ;
- for(hy = u.uy; (num = levl[u.ux][hy+1].typ) && num != CORR; hy++) ;
- num = 0;
- for(zy = ly; zy <= hy; zy++)
- for(zx = lx; zx <= hx; zx++) {
- if(levl[zx][zy].typ == SDOOR) {
- levl[zx][zy].typ = DOOR;
- atl(zx, zy, '+');
- num++;
- } else if(levl[zx][zy].typ == SCORR) {
- levl[zx][zy].typ = CORR;
- atl(zx, zy, CORR_SYM);
- num++;
- } else if(ttmp = t_at(zx, zy)) {
- if(ttmp->ttyp == PIERC){
- (void) makemon(PM_PIERCER, zx, zy);
- num++;
- deltrap(ttmp);
- } else if(!ttmp->tseen) {
- ttmp->tseen = 1;
- if(!vism_at(zx, zy))
- atl(zx,zy,'^');
- num++;
- }
- } else if(mtmp = m_at(zx,zy)) if(mtmp->mimic){
- seemimic(mtmp);
- num++;
- }
- }
- return(num);
-}
-
-dosearch()
-{
- xchar x,y;
- struct trap *trap;
- struct monst *mtmp;
-
- if(u.uswallow)
- pline("What are you looking for? The exit?");
- else
- for(x = u.ux-1; x < u.ux+2; x++)
- for(y = u.uy-1; y < u.uy+2; y++) if(x != u.ux || y != u.uy) {
- if(levl[x][y].typ == SDOOR) {
- if(rn2(7)) continue;
- levl[x][y].typ = DOOR;
- levl[x][y].seen = 0; /* force prl */
- prl(x,y);
- nomul(0);
- } else if(levl[x][y].typ == SCORR) {
- if(rn2(7)) continue;
- levl[x][y].typ = CORR;
- levl[x][y].seen = 0; /* force prl */
- prl(x,y);
- nomul(0);
- } else {
- /* Be careful not to find anything in an SCORR or SDOOR */
- if(mtmp = m_at(x,y)) if(mtmp->mimic){
- seemimic(mtmp);
- pline("You find a mimic.");
- return(1);
- }
- for(trap = ftrap; trap; trap = trap->ntrap)
- if(trap->tx == x && trap->ty == y &&
- !trap->tseen && !rn2(8)) {
- nomul(0);
- pline("You find a%s.", traps[trap->ttyp]);
- if(trap->ttyp == PIERC) {
- deltrap(trap);
- (void) makemon(PM_PIERCER,x,y);
- return(1);
- }
- trap->tseen = 1;
- if(!vism_at(x,y)) atl(x,y,'^');
- }
- }
- }
- return(1);
-}
-
-doidtrap() {
-struct trap *trap;
-int x,y;
- if(!getdir(1)) return(0);
- x = u.ux + u.dx;
- y = u.uy + u.dy;
- for(trap = ftrap; trap; trap = trap->ntrap)
- if(trap->tx == x && trap->ty == y && trap->tseen) {
- if(u.dz)
- if((u.dz < 0) != (!xdnstair && trap->ttyp == TRAPDOOR))
- continue;
- pline("That is a%s.", traps[trap->ttyp]);
- return(0);
- }
- pline("I can't see a trap there.");
- return(0);
-}
-
-wakeup(mtmp)
-struct monst *mtmp;
-{
- mtmp->msleep = 0;
- setmangry(mtmp);
- if(mtmp->mimic) seemimic(mtmp);
-}
-
-/* NOTE: we must check if(mtmp->mimic) before calling this routine */
-seemimic(mtmp)
-struct monst *mtmp;
-{
- mtmp->mimic = 0;
- mtmp->mappearance = 0;
- unpmon(mtmp);
- pmon(mtmp);
-}
diff --git a/games/hack/hack.sh b/games/hack/hack.sh
deleted file mode 100644
index 8136ec4..0000000
--- a/games/hack/hack.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-HACKDIR=/usr/games/lib/hackdir
-HACK=$HACKDIR/hack
-MAXNROFPLAYERS=4
-
-cd $HACKDIR
-case $1 in
- -s*)
- exec $HACK $@
- ;;
- *)
- exec $HACK $@ $MAXNROFPLAYERS
- ;;
-esac
diff --git a/games/hack/hack.shk.c b/games/hack/hack.shk.c
deleted file mode 100644
index a959209..0000000
--- a/games/hack/hack.shk.c
+++ /dev/null
@@ -1,988 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.shk.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#ifdef QUEST
-int shlevel = 0;
-struct monst *shopkeeper = 0;
-struct obj *billobjs = 0;
-obfree(obj,merge) struct obj *obj, *merge; {
- free((char *) obj);
-}
-inshop(){ return(0); }
-shopdig(){}
-addtobill(){}
-subfrombill(){}
-splitbill(){}
-dopay(){ return(0); }
-paybill(){}
-doinvbill(){ return(0); }
-shkdead(){}
-shkcatch(){ return(0); }
-shk_move(){ return(0); }
-replshk(mtmp,mtmp2) struct monst *mtmp, *mtmp2; {}
-char *shkname(){ return(""); }
-
-#else /* QUEST */
-#include "hack.mfndpos.h"
-#include "def.mkroom.h"
-#include "def.eshk.h"
-
-#define ESHK(mon) ((struct eshk *)(&(mon->mextra[0])))
-#define NOTANGRY(mon) mon->mpeaceful
-#define ANGRY(mon) !NOTANGRY(mon)
-
-extern char plname[], *xname();
-extern struct obj *o_on(), *bp_to_obj();
-
-/* Descriptor of current shopkeeper. Note that the bill need not be
- per-shopkeeper, since it is valid only when in a shop. */
-static struct monst *shopkeeper = 0;
-static struct bill_x *bill;
-static int shlevel = 0; /* level of this shopkeeper */
- struct obj *billobjs; /* objects on bill with bp->useup */
- /* only accessed here and by save & restore */
-static long int total; /* filled by addupbill() */
-static long int followmsg; /* last time of follow message */
-
-/*
- invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
- obj->quan <= bp->bquan
- */
-
-
-char shtypes[] = { /* 8 shoptypes: 7 specialized, 1 mixed */
- RING_SYM, WAND_SYM, WEAPON_SYM, FOOD_SYM, SCROLL_SYM,
- POTION_SYM, ARMOR_SYM, 0
-};
-
-static char *shopnam[] = {
- "engagement ring", "walking cane", "antique weapon",
- "delicatessen", "second hand book", "liquor",
- "used armor", "assorted antiques"
-};
-
-char *
-shkname(mtmp) /* called in do_name.c */
-struct monst *mtmp;
-{
- return(ESHK(mtmp)->shknam);
-}
-
-static void setpaid();
-
-shkdead(mtmp) /* called in mon.c */
-struct monst *mtmp;
-{
- struct eshk *eshk = ESHK(mtmp);
-
- if(eshk->shoplevel == dlevel)
- rooms[eshk->shoproom].rtype = 0;
- if(mtmp == shopkeeper) {
- setpaid();
- shopkeeper = 0;
- bill = (struct bill_x *) -1000; /* dump core when referenced */
- }
-}
-
-replshk(mtmp,mtmp2)
-struct monst *mtmp, *mtmp2;
-{
- if(mtmp == shopkeeper) {
- shopkeeper = mtmp2;
- bill = &(ESHK(shopkeeper)->bill[0]);
- }
-}
-
-static void
-setpaid(){ /* caller has checked that shopkeeper exists */
- /* either we paid or left the shop or he just died */
-struct obj *obj;
-struct monst *mtmp;
- for(obj = invent; obj; obj = obj->nobj)
- obj->unpaid = 0;
- for(obj = fobj; obj; obj = obj->nobj)
- obj->unpaid = 0;
- for(obj = fcobj; obj; obj = obj->nobj)
- obj->unpaid = 0;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- for(obj = mtmp->minvent; obj; obj = obj->nobj)
- obj->unpaid = 0;
- for(mtmp = fallen_down; mtmp; mtmp = mtmp->nmon)
- for(obj = mtmp->minvent; obj; obj = obj->nobj)
- obj->unpaid = 0;
- while(obj = billobjs){
- billobjs = obj->nobj;
- free((char *) obj);
- }
- ESHK(shopkeeper)->billct = 0;
-}
-
-static
-addupbill(){ /* delivers result in total */
- /* caller has checked that shopkeeper exists */
-int ct = ESHK(shopkeeper)->billct;
-struct bill_x *bp = bill;
- total = 0;
- while(ct--){
- total += bp->price * bp->bquan;
- bp++;
- }
-}
-
-inshop(){
-int roomno = inroom(u.ux,u.uy);
-
- static void findshk();
-
- /* Did we just leave a shop? */
- if(u.uinshop &&
- (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
- if(shopkeeper) {
- if(ESHK(shopkeeper)->billct) {
- if(inroom(shopkeeper->mx, shopkeeper->my)
- == u.uinshop - 1) /* ab@unido */
- pline("Somehow you escaped the shop without paying!");
- addupbill();
- pline("You stole for a total worth of %ld zorkmids.",
- total);
- ESHK(shopkeeper)->robbed += total;
- setpaid();
- if((rooms[ESHK(shopkeeper)->shoproom].rtype == GENERAL)
- == (rn2(3) == 0))
- ESHK(shopkeeper)->following = 1;
- }
- shopkeeper = 0;
- shlevel = 0;
- }
- u.uinshop = 0;
- }
-
- /* Did we just enter a zoo of some kind? */
- if(roomno >= 0) {
- int rt = rooms[roomno].rtype;
- struct monst *mtmp;
- if(rt == ZOO) {
- pline("Welcome to David's treasure zoo!");
- } else
- if(rt == SWAMP) {
- pline("It looks rather muddy down here.");
- } else
- if(rt == MORGUE) {
- if(midnight())
- pline("Go away! Go away!");
- else
- pline("You get an uncanny feeling ...");
- } else
- rt = 0;
- if(rt != 0) {
- rooms[roomno].rtype = 0;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(rt != ZOO || !rn2(3))
- mtmp->msleep = 0;
- }
- }
-
- /* Did we just enter a shop? */
- if(roomno >= 0 && rooms[roomno].rtype >= 8) {
- if(shlevel != dlevel || !shopkeeper
- || ESHK(shopkeeper)->shoproom != roomno)
- findshk(roomno);
- if(!shopkeeper) {
- rooms[roomno].rtype = 0;
- u.uinshop = 0;
- } else if(!u.uinshop){
- if(!ESHK(shopkeeper)->visitct ||
- strncmp(ESHK(shopkeeper)->customer, plname, PL_NSIZ)){
-
- /* He seems to be new here */
- ESHK(shopkeeper)->visitct = 0;
- ESHK(shopkeeper)->following = 0;
- (void) strncpy(ESHK(shopkeeper)->customer,plname,PL_NSIZ);
- NOTANGRY(shopkeeper) = 1;
- }
- if(!ESHK(shopkeeper)->following) {
- boolean box, pick;
-
- pline("Hello %s! Welcome%s to %s's %s shop!",
- plname,
- ESHK(shopkeeper)->visitct++ ? " again" : "",
- shkname(shopkeeper),
- shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8] );
- box = carrying(ICE_BOX);
- pick = carrying(PICK_AXE);
- if(box || pick) {
- if(dochug(shopkeeper)) {
- u.uinshop = 0; /* he died moving */
- return(0);
- }
- pline("Will you please leave your %s outside?",
- (box && pick) ? "box and pick-axe" :
- box ? "box" : "pick-axe");
- }
- }
- u.uinshop = roomno + 1;
- }
- }
- return(u.uinshop);
-}
-
-static void
-findshk(roomno)
-int roomno;
-{
-struct monst *mtmp;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->isshk && ESHK(mtmp)->shoproom == roomno
- && ESHK(mtmp)->shoplevel == dlevel) {
- shopkeeper = mtmp;
- bill = &(ESHK(shopkeeper)->bill[0]);
- shlevel = dlevel;
- if(ANGRY(shopkeeper) &&
- strncmp(ESHK(shopkeeper)->customer,plname,PL_NSIZ))
- NOTANGRY(shopkeeper) = 1;
- /* billobjs = 0; -- this is wrong if we save in a shop */
- /* (and it is harmless to have too many things in billobjs) */
- return;
- }
- shopkeeper = 0;
- shlevel = 0;
- bill = (struct bill_x *) -1000; /* dump core when referenced */
-}
-
-static struct bill_x *
-onbill(obj) struct obj *obj; {
-struct bill_x *bp;
- if(!shopkeeper) return(0);
- for(bp = bill; bp < &bill[ESHK(shopkeeper)->billct]; bp++)
- if(bp->bo_id == obj->o_id) {
- if(!obj->unpaid) pline("onbill: paid obj on bill?");
- return(bp);
- }
- if(obj->unpaid) pline("onbill: unpaid obj not on bill?");
- return(0);
-}
-
-/* called with two args on merge */
-obfree(obj,merge) struct obj *obj, *merge; {
-struct bill_x *bp = onbill(obj);
-struct bill_x *bpm;
- if(bp) {
- if(!merge){
- bp->useup = 1;
- obj->unpaid = 0; /* only for doinvbill */
- obj->nobj = billobjs;
- billobjs = obj;
- return;
- }
- bpm = onbill(merge);
- if(!bpm){
- /* this used to be a rename */
- impossible("obfree: not on bill??");
- return;
- } else {
- /* this was a merger */
- bpm->bquan += bp->bquan;
- ESHK(shopkeeper)->billct--;
- *bp = bill[ESHK(shopkeeper)->billct];
- }
- }
- free((char *) obj);
-}
-
-static
-pay(tmp,shkp)
-long tmp;
-struct monst *shkp;
-{
- long robbed = ESHK(shkp)->robbed;
-
- u.ugold -= tmp;
- shkp->mgold += tmp;
- flags.botl = 1;
- if(robbed) {
- robbed -= tmp;
- if(robbed < 0) robbed = 0;
- ESHK(shkp)->robbed = robbed;
- }
-}
-
-dopay(){
-long ltmp;
-struct bill_x *bp;
-struct monst *shkp;
-int pass, tmp;
-
- static int dopayobj();
-
- multi = 0;
- (void) inshop();
- for(shkp = fmon; shkp; shkp = shkp->nmon)
- if(shkp->isshk && dist(shkp->mx,shkp->my) < 3)
- break;
- if(!shkp && u.uinshop &&
- inroom(shopkeeper->mx,shopkeeper->my) == ESHK(shopkeeper)->shoproom)
- shkp = shopkeeper;
-
- if(!shkp) {
- pline("There is nobody here to receive your payment.");
- return(0);
- }
- ltmp = ESHK(shkp)->robbed;
- if(shkp != shopkeeper && NOTANGRY(shkp)) {
- if(!ltmp) {
- pline("You do not owe %s anything.", monnam(shkp));
- } else
- if(!u.ugold) {
- pline("You have no money.");
- } else {
- long ugold = u.ugold;
-
- if(u.ugold > ltmp) {
- pline("You give %s the %ld gold pieces he asked for.",
- monnam(shkp), ltmp);
- pay(ltmp, shkp);
- } else {
- pline("You give %s all your gold.", monnam(shkp));
- pay(u.ugold, shkp);
- }
- if(ugold < ltmp/2) {
- pline("Unfortunately, he doesn't look satisfied.");
- } else {
- ESHK(shkp)->robbed = 0;
- ESHK(shkp)->following = 0;
- if(ESHK(shkp)->shoplevel != dlevel) {
- /* For convenience's sake, let him disappear */
- shkp->minvent = 0; /* %% */
- shkp->mgold = 0;
- mondead(shkp);
- }
- }
- }
- return(1);
- }
-
- if(!ESHK(shkp)->billct){
- pline("You do not owe %s anything.", monnam(shkp));
- if(!u.ugold){
- pline("Moreover, you have no money.");
- return(1);
- }
- if(ESHK(shkp)->robbed){
-#define min(a,b) ((a<b)?a:b)
- pline("But since his shop has been robbed recently,");
- pline("you %srepay %s's expenses.",
- (u.ugold < ESHK(shkp)->robbed) ? "partially " : "",
- monnam(shkp));
- pay(min(u.ugold, ESHK(shkp)->robbed), shkp);
- ESHK(shkp)->robbed = 0;
- return(1);
- }
- if(ANGRY(shkp)){
- pline("But in order to appease %s,",
- amonnam(shkp, "angry"));
- if(u.ugold >= 1000){
- ltmp = 1000;
- pline(" you give him 1000 gold pieces.");
- } else {
- ltmp = u.ugold;
- pline(" you give him all your money.");
- }
- pay(ltmp, shkp);
- if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ)
- || rn2(3)){
- pline("%s calms down.", Monnam(shkp));
- NOTANGRY(shkp) = 1;
- } else pline("%s is as angry as ever.",
- Monnam(shkp));
- }
- return(1);
- }
- if(shkp != shopkeeper) {
- impossible("dopay: not to shopkeeper?");
- if(shopkeeper) setpaid();
- return(0);
- }
- for(pass = 0; pass <= 1; pass++) {
- tmp = 0;
- while(tmp < ESHK(shopkeeper)->billct) {
- bp = &bill[tmp];
- if(!pass && !bp->useup) {
- tmp++;
- continue;
- }
- if(!dopayobj(bp)) return(1);
- bill[tmp] = bill[--ESHK(shopkeeper)->billct];
- }
- }
- pline("Thank you for shopping in %s's %s store!",
- shkname(shopkeeper),
- shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]);
- NOTANGRY(shopkeeper) = 1;
- return(1);
-}
-
-/* return 1 if paid successfully */
-/* 0 if not enough money */
-/* -1 if object could not be found (but was paid) */
-static
-dopayobj(bp) struct bill_x *bp; {
-struct obj *obj;
-long ltmp;
-
- /* find the object on one of the lists */
- obj = bp_to_obj(bp);
-
- if(!obj) {
- impossible("Shopkeeper administration out of order.");
- setpaid(); /* be nice to the player */
- return(0);
- }
-
- if(!obj->unpaid && !bp->useup){
- impossible("Paid object on bill??");
- return(1);
- }
- obj->unpaid = 0;
- ltmp = bp->price * bp->bquan;
- if(ANGRY(shopkeeper)) ltmp += ltmp/3;
- if(u.ugold < ltmp){
- pline("You don't have gold enough to pay %s.",
- doname(obj));
- obj->unpaid = 1;
- return(0);
- }
- pay(ltmp, shopkeeper);
- pline("You bought %s for %ld gold piece%s.",
- doname(obj), ltmp, plur(ltmp));
- if(bp->useup) {
- struct obj *otmp = billobjs;
- if(obj == billobjs)
- billobjs = obj->nobj;
- else {
- while(otmp && otmp->nobj != obj) otmp = otmp->nobj;
- if(otmp) otmp->nobj = obj->nobj;
- else pline("Error in shopkeeper administration.");
- }
- free((char *) obj);
- }
- return(1);
-}
-
-/* routine called after dying (or quitting) with nonempty bill */
-paybill(){
- if(shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct){
- addupbill();
- if(total > u.ugold){
- shopkeeper->mgold += u.ugold;
- u.ugold = 0;
- pline("%s comes and takes all your possessions.",
- Monnam(shopkeeper));
- } else {
- u.ugold -= total;
- shopkeeper->mgold += total;
- pline("%s comes and takes the %ld zorkmids you owed him.",
- Monnam(shopkeeper), total);
- }
- setpaid(); /* in case we create bones */
- }
-}
-
-/* find obj on one of the lists */
-struct obj *
-bp_to_obj(bp)
-struct bill_x *bp;
-{
- struct obj *obj;
- struct monst *mtmp;
- unsigned id = bp->bo_id;
-
- if(bp->useup)
- obj = o_on(id, billobjs);
- else if(!(obj = o_on(id, invent)) &&
- !(obj = o_on(id, fobj)) &&
- !(obj = o_on(id, fcobj))) {
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(obj = o_on(id, mtmp->minvent))
- break;
- for(mtmp = fallen_down; mtmp; mtmp = mtmp->nmon)
- if(obj = o_on(id, mtmp->minvent))
- break;
- }
- return(obj);
-}
-
-static int getprice();
-
-/* called in hack.c when we pickup an object */
-addtobill(obj) struct obj *obj; {
-struct bill_x *bp;
- if(!inshop() ||
- (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) ||
- (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y) ||
- onbill(obj) /* perhaps we threw it away earlier */
- ) return;
- if(ESHK(shopkeeper)->billct == BILLSZ){
- pline("You got that for free!");
- return;
- }
- bp = &bill[ESHK(shopkeeper)->billct];
- bp->bo_id = obj->o_id;
- bp->bquan = obj->quan;
- bp->useup = 0;
- bp->price = getprice(obj);
- ESHK(shopkeeper)->billct++;
- obj->unpaid = 1;
-}
-
-splitbill(obj,otmp) struct obj *obj, *otmp; {
- /* otmp has been split off from obj */
-struct bill_x *bp;
-int tmp;
- bp = onbill(obj);
- if(!bp) {
- impossible("splitbill: not on bill?");
- return;
- }
- if(bp->bquan < otmp->quan) {
- impossible("Negative quantity on bill??");
- }
- if(bp->bquan == otmp->quan) {
- impossible("Zero quantity on bill??");
- }
- bp->bquan -= otmp->quan;
-
- /* addtobill(otmp); */
- if(ESHK(shopkeeper)->billct == BILLSZ) otmp->unpaid = 0;
- else {
- tmp = bp->price;
- bp = &bill[ESHK(shopkeeper)->billct];
- bp->bo_id = otmp->o_id;
- bp->bquan = otmp->quan;
- bp->useup = 0;
- bp->price = tmp;
- ESHK(shopkeeper)->billct++;
- }
-}
-
-subfrombill(obj) struct obj *obj; {
-long ltmp;
-int tmp;
-struct obj *otmp;
-struct bill_x *bp;
- if(!inshop() || (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) ||
- (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y))
- return;
- if((bp = onbill(obj)) != 0){
- obj->unpaid = 0;
- if(bp->bquan > obj->quan){
- otmp = newobj(0);
- *otmp = *obj;
- bp->bo_id = otmp->o_id = flags.ident++;
- otmp->quan = (bp->bquan -= obj->quan);
- otmp->owt = 0; /* superfluous */
- otmp->onamelth = 0;
- bp->useup = 1;
- otmp->nobj = billobjs;
- billobjs = otmp;
- return;
- }
- ESHK(shopkeeper)->billct--;
- *bp = bill[ESHK(shopkeeper)->billct];
- return;
- }
- if(obj->unpaid){
- pline("%s didn't notice.", Monnam(shopkeeper));
- obj->unpaid = 0;
- return; /* %% */
- }
- /* he dropped something of his own - probably wants to sell it */
- if(shopkeeper->msleep || shopkeeper->mfroz ||
- inroom(shopkeeper->mx,shopkeeper->my) != ESHK(shopkeeper)->shoproom)
- return;
- if(ESHK(shopkeeper)->billct == BILLSZ ||
- ((tmp = shtypes[rooms[ESHK(shopkeeper)->shoproom].rtype-8]) && tmp != obj->olet)
- || index("_0", obj->olet)) {
- pline("%s seems not interested.", Monnam(shopkeeper));
- return;
- }
- ltmp = getprice(obj) * obj->quan;
- if(ANGRY(shopkeeper)) {
- ltmp /= 3;
- NOTANGRY(shopkeeper) = 1;
- } else ltmp /= 2;
- if(ESHK(shopkeeper)->robbed){
- if((ESHK(shopkeeper)->robbed -= ltmp) < 0)
- ESHK(shopkeeper)->robbed = 0;
-pline("Thank you for your contribution to restock this recently plundered shop.");
- return;
- }
- if(ltmp > shopkeeper->mgold)
- ltmp = shopkeeper->mgold;
- pay(-ltmp, shopkeeper);
- if(!ltmp)
- pline("%s gladly accepts %s but cannot pay you at present.",
- Monnam(shopkeeper), doname(obj));
- else
- pline("You sold %s and got %ld gold piece%s.", doname(obj), ltmp,
- plur(ltmp));
-}
-
-doinvbill(mode)
-int mode; /* 0: deliver count 1: paged */
-{
- struct bill_x *bp;
- struct obj *obj;
- long totused, thisused;
- char buf[BUFSZ];
-
- if(mode == 0) {
- int cnt = 0;
-
- if(shopkeeper)
- for(bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++)
- if(bp->useup ||
- ((obj = bp_to_obj(bp)) && obj->quan < bp->bquan))
- cnt++;
- return(cnt);
- }
-
- if(!shopkeeper) {
- impossible("doinvbill: no shopkeeper?");
- return(0);
- }
-
- set_pager(0);
- if(page_line("Unpaid articles already used up:") || page_line(""))
- goto quit;
-
- totused = 0;
- for(bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++) {
- obj = bp_to_obj(bp);
- if(!obj) {
- impossible("Bad shopkeeper administration.");
- goto quit;
- }
- if(bp->useup || bp->bquan > obj->quan) {
- int cnt, oquan, uquan;
-
- oquan = obj->quan;
- uquan = (bp->useup ? bp->bquan : bp->bquan - oquan);
- thisused = bp->price * uquan;
- totused += thisused;
- obj->quan = uquan; /* cheat doname */
- (void) sprintf(buf, "x - %s", doname(obj));
- obj->quan = oquan; /* restore value */
- for(cnt = 0; buf[cnt]; cnt++);
- while(cnt < 50)
- buf[cnt++] = ' ';
- (void) sprintf(&buf[cnt], " %5ld zorkmids", thisused);
- if(page_line(buf))
- goto quit;
- }
- }
- (void) sprintf(buf, "Total:%50ld zorkmids", totused);
- if(page_line("") || page_line(buf))
- goto quit;
- set_pager(1);
- return(0);
-quit:
- set_pager(2);
- return(0);
-}
-
-static
-getprice(obj) struct obj *obj; {
-int tmp, ac;
- static int realhunger();
-
- switch(obj->olet){
- case AMULET_SYM:
- tmp = 10*rnd(500);
- break;
- case TOOL_SYM:
- tmp = 10*rnd((obj->otyp == EXPENSIVE_CAMERA) ? 150 : 30);
- break;
- case RING_SYM:
- tmp = 10*rnd(100);
- break;
- case WAND_SYM:
- tmp = 10*rnd(100);
- break;
- case SCROLL_SYM:
- tmp = 10*rnd(50);
-#ifdef MAIL
- if(obj->otyp == SCR_MAIL)
- tmp = rnd(5);
-#endif /* MAIL */
- break;
- case POTION_SYM:
- tmp = 10*rnd(50);
- break;
- case FOOD_SYM:
- tmp = 10*rnd(5 + (2000/realhunger()));
- break;
- case GEM_SYM:
- tmp = 10*rnd(20);
- break;
- case ARMOR_SYM:
- ac = ARM_BONUS(obj);
- if(ac <= -10) /* probably impossible */
- ac = -9;
- tmp = 100 + ac*ac*rnd(10+ac);
- break;
- case WEAPON_SYM:
- if(obj->otyp < BOOMERANG)
- tmp = 5*rnd(10);
- else if(obj->otyp == LONG_SWORD ||
- obj->otyp == TWO_HANDED_SWORD)
- tmp = 10*rnd(150);
- else tmp = 10*rnd(75);
- break;
- case CHAIN_SYM:
- pline("Strange ..., carrying a chain?");
- case BALL_SYM:
- tmp = 10;
- break;
- default:
- tmp = 10000;
- }
- return(tmp);
-}
-
-static
-realhunger(){ /* not completely foolproof */
-int tmp = u.uhunger;
-struct obj *otmp = invent;
- while(otmp){
- if(otmp->olet == FOOD_SYM && !otmp->unpaid)
- tmp += objects[otmp->otyp].nutrition;
- otmp = otmp->nobj;
- }
- return((tmp <= 0) ? 1 : tmp);
-}
-
-shkcatch(obj)
-struct obj *obj;
-{
- struct monst *shkp = shopkeeper;
-
- if(u.uinshop && shkp && !shkp->mfroz && !shkp->msleep &&
- u.dx && u.dy &&
- inroom(u.ux+u.dx, u.uy+u.dy) + 1 == u.uinshop &&
- shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y &&
- u.ux == ESHK(shkp)->shd.x && u.uy == ESHK(shkp)->shd.y) {
- pline("%s nimbly catches the %s.", Monnam(shkp), xname(obj));
- obj->nobj = shkp->minvent;
- shkp->minvent = obj;
- return(1);
- }
- return(0);
-}
-
-/*
- * shk_move: return 1: he moved 0: he didnt -1: let m_move do it
- */
-shk_move(shkp)
-struct monst *shkp;
-{
- struct monst *mtmp;
- struct permonst *mdat = shkp->data;
- xchar gx,gy,omx,omy,nx,ny,nix,niy;
- schar appr,i;
- int udist;
- int z;
- schar shkroom,chi,chcnt,cnt;
- boolean uondoor, satdoor, avoid, badinv;
- coord poss[9];
- int info[9];
- struct obj *ib = 0;
-
- omx = shkp->mx;
- omy = shkp->my;
-
- if((udist = dist(omx,omy)) < 3) {
- if(ANGRY(shkp)) {
- (void) hitu(shkp, d(mdat->damn, mdat->damd)+1);
- return(0);
- }
- if(ESHK(shkp)->following) {
- if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ)){
- pline("Hello %s! I was looking for %s.",
- plname, ESHK(shkp)->customer);
- ESHK(shkp)->following = 0;
- return(0);
- }
- if(!ESHK(shkp)->robbed) { /* impossible? */
- ESHK(shkp)->following = 0;
- return(0);
- }
- if(moves > followmsg+4) {
- pline("Hello %s! Didn't you forget to pay?",
- plname);
- followmsg = moves;
- }
- if(udist < 2)
- return(0);
- }
- }
-
- shkroom = inroom(omx,omy);
- appr = 1;
- gx = ESHK(shkp)->shk.x;
- gy = ESHK(shkp)->shk.y;
- satdoor = (gx == omx && gy == omy);
- if(ESHK(shkp)->following || ((z = holetime()) >= 0 && z*z <= udist)){
- gx = u.ux;
- gy = u.uy;
- if(shkroom < 0 || shkroom != inroom(u.ux,u.uy))
- if(udist > 4)
- return(-1); /* leave it to m_move */
- } else if(ANGRY(shkp)) {
- long saveBlind = Blind;
- Blind = 0;
- if(shkp->mcansee && !Invis && cansee(omx,omy)) {
- gx = u.ux;
- gy = u.uy;
- }
- Blind = saveBlind;
- avoid = FALSE;
- } else {
-#define GDIST(x,y) ((x-gx)*(x-gx)+(y-gy)*(y-gy))
- if(Invis)
- avoid = FALSE;
- else {
- uondoor = (u.ux == ESHK(shkp)->shd.x &&
- u.uy == ESHK(shkp)->shd.y);
- if(uondoor) {
- if(ESHK(shkp)->billct)
- pline("Hello %s! Will you please pay before leaving?",
- plname);
- badinv = (carrying(PICK_AXE) || carrying(ICE_BOX));
- if(satdoor && badinv)
- return(0);
- avoid = !badinv;
- } else {
- avoid = (u.uinshop && dist(gx,gy) > 8);
- badinv = FALSE;
- }
-
- if(((!ESHK(shkp)->robbed && !ESHK(shkp)->billct) || avoid)
- && GDIST(omx,omy) < 3){
- if(!badinv && !online(omx,omy))
- return(0);
- if(satdoor)
- appr = gx = gy = 0;
- }
- }
- }
- if(omx == gx && omy == gy)
- return(0);
- if(shkp->mconf) {
- avoid = FALSE;
- appr = 0;
- }
- nix = omx;
- niy = omy;
- cnt = mfndpos(shkp,poss,info,ALLOW_SSM);
- if(avoid && uondoor) { /* perhaps we cannot avoid him */
- for(i=0; i<cnt; i++)
- if(!(info[i] & NOTONL)) goto notonl_ok;
- avoid = FALSE;
- notonl_ok:
- ;
- }
- chi = -1;
- chcnt = 0;
- for(i=0; i<cnt; i++){
- nx = poss[i].x;
- ny = poss[i].y;
- if(levl[nx][ny].typ == ROOM
- || shkroom != ESHK(shkp)->shoproom
- || ESHK(shkp)->following) {
-#ifdef STUPID
- /* cater for stupid compilers */
- int zz;
-#endif /* STUPID */
- if(uondoor && (ib = sobj_at(ICE_BOX, nx, ny))) {
- nix = nx; niy = ny; chi = i; break;
- }
- if(avoid && (info[i] & NOTONL))
- continue;
- if((!appr && !rn2(++chcnt)) ||
-#ifdef STUPID
- (appr && (zz = GDIST(nix,niy)) && zz > GDIST(nx,ny))
-#else
- (appr && GDIST(nx,ny) < GDIST(nix,niy))
-#endif /* STUPID */
- ) {
- nix = nx;
- niy = ny;
- chi = i;
- }
- }
- }
- if(nix != omx || niy != omy){
- if(info[chi] & ALLOW_M){
- mtmp = m_at(nix,niy);
- if(hitmm(shkp,mtmp) == 1 && rn2(3) &&
- hitmm(mtmp,shkp) == 2) return(2);
- return(0);
- } else if(info[chi] & ALLOW_U){
- (void) hitu(shkp, d(mdat->damn, mdat->damd)+1);
- return(0);
- }
- shkp->mx = nix;
- shkp->my = niy;
- pmon(shkp);
- if(ib) {
- freeobj(ib);
- mpickobj(shkp, ib);
- }
- return(1);
- }
- return(0);
-}
-
-/* He is digging in the shop. */
-shopdig(fall)
-int fall;
-{
- if(!fall) {
- if(u.utraptype == TT_PIT)
- pline("\"Be careful, sir, or you might fall through the floor.\"");
- else
- pline("\"Please, do not damage the floor here.\"");
- } else if(dist(shopkeeper->mx, shopkeeper->my) < 3) {
- struct obj *obj, *obj2;
-
- pline("%s grabs your backpack!", shkname(shopkeeper));
- for(obj = invent; obj; obj = obj2) {
- obj2 = obj->nobj;
- if(obj->owornmask) continue;
- freeinv(obj);
- obj->nobj = shopkeeper->minvent;
- shopkeeper->minvent = obj;
- if(obj->unpaid)
- subfrombill(obj);
- }
- }
-}
-#endif /* QUEST */
-
-online(x,y) {
- return(x==u.ux || y==u.uy ||
- (x-u.ux)*(x-u.ux) == (y-u.uy)*(y-u.uy));
-}
-
-/* Does this monster follow me downstairs? */
-follower(mtmp)
-struct monst *mtmp;
-{
- return( mtmp->mtame || index("1TVWZi&, ", mtmp->data->mlet)
-#ifndef QUEST
- || (mtmp->isshk && ESHK(mtmp)->following)
-#endif /* QUEST */
- );
-}
diff --git a/games/hack/hack.shknam.c b/games/hack/hack.shknam.c
deleted file mode 100644
index f3bf8f0..0000000
--- a/games/hack/hack.shknam.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.shknam.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-char *shkliquors[] = {
- /* Ukraine */
- "Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka",
- /* N. Russia */
- "Konosja", "Weliki Oestjoeg", "Syktywkar", "Sablja",
- "Narodnaja", "Kyzyl",
- /* Silezie */
- "Walbrzych", "Swidnica", "Klodzko", "Raciborz", "Gliwice",
- "Brzeg", "Krnov", "Hradec Kralove",
- /* Schweiz */
- "Leuk", "Brig", "Brienz", "Thun", "Sarnen", "Burglen", "Elm",
- "Flims", "Vals", "Schuls", "Zum Loch",
- 0
-};
-
-char *shkbooks[] = {
- /* Eire */
- "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch",
- "Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff",
- "Kinnegad", "Lugnaquillia", "Enniscorthy", "Gweebarra",
- "Kittamagh", "Nenagh", "Sneem", "Ballingeary", "Kilgarvan",
- "Cahersiveen", "Glenbeigh", "Kilmihil", "Kiltamagh",
- "Droichead Atha", "Inniscrone", "Clonegal", "Lisnaskea",
- "Culdaff", "Dunfanaghy", "Inishbofin", "Kesh",
- 0
-};
-
-char *shkarmors[] = {
- /* Turquie */
- "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep",
- "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak",
- "Iskenderun", "Kadirli", "Siverek", "Pervari", "Malasgirt",
- "Bayburt", "Ayancik", "Zonguldak", "Balya", "Tefenni",
- "Artvin", "Kars", "Makharadze", "Malazgirt", "Midyat",
- "Birecik", "Kirikkale", "Alaca", "Polatli", "Nallihan",
- 0
-};
-
-char *shkwands[] = {
- /* Wales */
- "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
- "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
- "Y-Fenni", "Measteg", "Rhydaman", "Beddgelert",
- "Curig", "Llanrwst", "Llanerchymedd", "Caergybi",
- /* Scotland */
- "Nairn", "Turriff", "Inverurie", "Braemar", "Lochnagar",
- "Kerloch", "Beinn a Ghlo", "Drumnadrochit", "Morven",
- "Uist", "Storr", "Sgurr na Ciche", "Cannich", "Gairloch",
- "Kyleakin", "Dunvegan",
- 0
-};
-
-char *shkrings[] = {
- /* Hollandse familienamen */
- "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken",
- "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy",
- "Olycan", "Sadelin", "Svaving", "Tapper", "Terwen", "Wirix",
- "Ypey",
- /* Skandinaviske navne */
- "Rastegaisa", "Varjag Njarga", "Kautekeino", "Abisko",
- "Enontekis", "Rovaniemi", "Avasaksa", "Haparanda",
- "Lulea", "Gellivare", "Oeloe", "Kajaani", "Fauske",
- 0
-};
-
-char *shkfoods[] = {
- /* Indonesia */
- "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan",
- "Bandjar", "Parbalingga", "Bojolali", "Sarangan",
- "Ngebel", "Djombang", "Ardjawinangun", "Berbek",
- "Papar", "Baliga", "Tjisolok", "Siboga", "Banjoewangi",
- "Trenggalek", "Karangkobar", "Njalindoeng", "Pasawahan",
- "Pameunpeuk", "Patjitan", "Kediri", "Pemboeang", "Tringanoe",
- "Makin", "Tipor", "Semai", "Berhala", "Tegal", "Samoe",
- 0
-};
-
-char *shkweapons[] = {
- /* Perigord */
- "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard",
- "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac",
- "Fleac", "Lonzac", "Vergt", "Queyssac", "Liorac", "Echourgnac",
- "Cazelon", "Eypau", "Carignan", "Monbazillac", "Jonzac",
- "Pons", "Jumilhac", "Fenouilledes", "Laguiolet", "Saujon",
- "Eymoutiers", "Eygurande", "Eauze", "Labouheyre",
- 0
-};
-
-char *shkgeneral[] = {
- /* Suriname */
- "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
- "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
- "Akalapi", "Sipaliwini",
- /* Greenland */
- "Annootok", "Upernavik", "Angmagssalik",
- /* N. Canada */
- "Aklavik", "Inuvik", "Tuktoyaktuk",
- "Chicoutimi", "Ouiatchouane", "Chibougamau",
- "Matagami", "Kipawa", "Kinojevis",
- "Abitibi", "Maganasipi",
- /* Iceland */
- "Akureyri", "Kopasker", "Budereyri", "Akranes", "Bordeyri",
- "Holmavik",
- 0
-};
-
-struct shk_nx {
- char x;
- char **xn;
-} shk_nx[] = {
- { POTION_SYM, shkliquors },
- { SCROLL_SYM, shkbooks },
- { ARMOR_SYM, shkarmors },
- { WAND_SYM, shkwands },
- { RING_SYM, shkrings },
- { FOOD_SYM, shkfoods },
- { WEAPON_SYM, shkweapons },
- { 0, shkgeneral }
-};
-
-findname(nampt, let) char *nampt; char let; {
-struct shk_nx *p = shk_nx;
-char **q;
-int i;
- while(p->x && p->x != let) p++;
- q = p->xn;
- for(i=0; i<dlevel; i++) if(!q[i]){
- /* Not enough names, try general name */
- if(let) findname(nampt, 0);
- else (void) strcpy(nampt, "Dirk");
- return;
- }
- (void) strncpy(nampt, q[i], PL_NSIZ);
- nampt[PL_NSIZ-1] = 0;
-}
diff --git a/games/hack/hack.steal.c b/games/hack/hack.steal.c
deleted file mode 100644
index 6c97a58..0000000
--- a/games/hack/hack.steal.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.steal.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-long /* actually returns something that fits in an int */
-somegold(){
- return( (u.ugold < 100) ? u.ugold :
- (u.ugold > 10000) ? rnd(10000) : rnd((int) u.ugold) );
-}
-
-stealgold(mtmp) struct monst *mtmp; {
-struct gold *gold = g_at(u.ux, u.uy);
-long tmp;
- if(gold && ( !u.ugold || gold->amount > u.ugold || !rn2(5))) {
- mtmp->mgold += gold->amount;
- freegold(gold);
- if(Invisible) newsym(u.ux, u.uy);
- pline("%s quickly snatches some gold from between your feet!",
- Monnam(mtmp));
- if(!u.ugold || !rn2(5)) {
- rloc(mtmp);
- mtmp->mflee = 1;
- }
- } else if(u.ugold) {
- u.ugold -= (tmp = somegold());
- pline("Your purse feels lighter.");
- mtmp->mgold += tmp;
- rloc(mtmp);
- mtmp->mflee = 1;
- flags.botl = 1;
- }
-}
-
-/* steal armor after he finishes taking it off */
-unsigned stealoid; /* object to be stolen */
-unsigned stealmid; /* monster doing the stealing */
-stealarm(){
- struct monst *mtmp;
- struct obj *otmp;
-
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp->o_id == stealoid) {
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->m_id == stealmid) {
- if(dist(mtmp->mx,mtmp->my) < 3) {
- freeinv(otmp);
- pline("%s steals %s!", Monnam(mtmp), doname(otmp));
- mpickobj(mtmp,otmp);
- mtmp->mflee = 1;
- rloc(mtmp);
- }
- break;
- }
- break;
- }
- stealoid = 0;
-}
-
-/* returns 1 when something was stolen */
-/* (or at least, when N should flee now) */
-/* avoid stealing the object stealoid */
-steal(mtmp)
-struct monst *mtmp;
-{
- struct obj *otmp;
- int tmp;
- int named = 0;
-
- if(!invent){
- if(Blind)
- pline("Somebody tries to rob you, but finds nothing to steal.");
- else
- pline("%s tries to rob you, but she finds nothing to steal!",
- Monnam(mtmp));
- return(1); /* let her flee */
- }
- tmp = 0;
- for(otmp = invent; otmp; otmp = otmp->nobj) if(otmp != uarm2)
- tmp += ((otmp->owornmask & (W_ARMOR | W_RING)) ? 5 : 1);
- tmp = rn2(tmp);
- for(otmp = invent; otmp; otmp = otmp->nobj) if(otmp != uarm2)
- if((tmp -= ((otmp->owornmask & (W_ARMOR | W_RING)) ? 5 : 1))
- < 0) break;
- if(!otmp) {
- impossible("Steal fails!");
- return(0);
- }
- if(otmp->o_id == stealoid)
- return(0);
- if((otmp->owornmask & (W_ARMOR | W_RING))){
- switch(otmp->olet) {
- case RING_SYM:
- ringoff(otmp);
- break;
- case ARMOR_SYM:
- if(multi < 0 || otmp == uarms){
- setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
- break;
- }
- { int curssv = otmp->cursed;
- otmp->cursed = 0;
- stop_occupation();
- pline("%s seduces you and %s off your %s.",
- Amonnam(mtmp, Blind ? "gentle" : "beautiful"),
- otmp->cursed ? "helps you to take"
- : "you start taking",
- (otmp == uarmg) ? "gloves" :
- (otmp == uarmh) ? "helmet" : "armor");
- named++;
- (void) armoroff(otmp);
- otmp->cursed = curssv;
- if(multi < 0){
- extern char *nomovemsg;
- extern int (*afternmv)();
- /*
- multi = 0;
- nomovemsg = 0;
- afternmv = 0;
- */
- stealoid = otmp->o_id;
- stealmid = mtmp->m_id;
- afternmv = stealarm;
- return(0);
- }
- break;
- }
- default:
- impossible("Tried to steal a strange worn thing.");
- }
- }
- else if(otmp == uwep)
- setuwep((struct obj *) 0);
- if(otmp->olet == CHAIN_SYM) {
- impossible("How come you are carrying that chain?");
- }
- if(Punished && otmp == uball){
- Punished = 0;
- freeobj(uchain);
- free((char *) uchain);
- uchain = (struct obj *) 0;
- uball->spe = 0;
- uball = (struct obj *) 0; /* superfluous */
- }
- freeinv(otmp);
- pline("%s stole %s.", named ? "She" : Monnam(mtmp), doname(otmp));
- mpickobj(mtmp,otmp);
- return((multi < 0) ? 0 : 1);
-}
-
-mpickobj(mtmp,otmp)
-struct monst *mtmp;
-struct obj *otmp;
-{
- otmp->nobj = mtmp->minvent;
- mtmp->minvent = otmp;
-}
-
-stealamulet(mtmp)
-struct monst *mtmp;
-{
- struct obj *otmp;
-
- for(otmp = invent; otmp; otmp = otmp->nobj) {
- if(otmp->olet == AMULET_SYM) {
- /* might be an imitation one */
- if(otmp == uwep) setuwep((struct obj *) 0);
- freeinv(otmp);
- mpickobj(mtmp,otmp);
- pline("%s stole %s!", Monnam(mtmp), doname(otmp));
- return(1);
- }
- }
- return(0);
-}
-
-/* release the objects the killed animal has stolen */
-relobj(mtmp,show)
-struct monst *mtmp;
-int show;
-{
- struct obj *otmp, *otmp2;
-
- for(otmp = mtmp->minvent; otmp; otmp = otmp2){
- otmp->ox = mtmp->mx;
- otmp->oy = mtmp->my;
- otmp2 = otmp->nobj;
- otmp->nobj = fobj;
- fobj = otmp;
- stackobj(fobj);
- if(show & cansee(mtmp->mx,mtmp->my))
- atl(otmp->ox,otmp->oy,otmp->olet);
- }
- mtmp->minvent = (struct obj *) 0;
- if(mtmp->mgold || mtmp->data->mlet == 'L') {
- long tmp;
-
- tmp = (mtmp->mgold > 10000) ? 10000 : mtmp->mgold;
- mkgold((long)(tmp + d(dlevel,30)), mtmp->mx, mtmp->my);
- if(show & cansee(mtmp->mx,mtmp->my))
- atl(mtmp->mx,mtmp->my,'$');
- }
-}
diff --git a/games/hack/hack.termcap.c b/games/hack/hack.termcap.c
deleted file mode 100644
index c4a3a82..0000000
--- a/games/hack/hack.termcap.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.termcap.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include <stdio.h>
-#include <termcap.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "config.h" /* for ROWNO and COLNO */
-#include "def.flag.h" /* for flags.nonull */
-extern long *alloc();
-
-static char tbuf[512];
-static char *HO, *CL, *CE, *UP, *CM, *ND, *XD, *BC, *SO, *SE, *TI, *TE;
-static char *VS, *VE;
-static int SG;
-static char PC = '\0';
-char *CD; /* tested in pri.c: docorner() */
-int CO, LI; /* used in pri.c and whatis.c */
-
-startup()
-{
- char *term;
- char *tptr;
- char *tbufptr, *pc;
-
- tptr = (char *) alloc(1024);
-
- tbufptr = tbuf;
- if(!(term = getenv("TERM")))
- error("Can't get TERM.");
- if(tgetent(tptr, term) < 1)
- error("Unknown terminal type: %s.", term);
- if(tgetflag("NP") || tgetflag("nx"))
- flags.nonull = 1;
- if(pc = tgetstr("pc", &tbufptr))
- PC = *pc;
- if(!(BC = tgetstr("bc", &tbufptr))) {
- if(!tgetflag("bs"))
- error("Terminal must backspace.");
- BC = tbufptr;
- tbufptr += 2;
- *BC = '\b';
- }
- HO = tgetstr("ho", &tbufptr);
- CO = tgetnum("co");
- LI = tgetnum("li");
- if(CO < COLNO || LI < ROWNO+2)
- setclipped();
- if(!(CL = tgetstr("cl", &tbufptr)))
- error("Hack needs CL.");
- ND = tgetstr("nd", &tbufptr);
- if(tgetflag("os"))
- error("Hack can't have OS.");
- CE = tgetstr("ce", &tbufptr);
- UP = tgetstr("up", &tbufptr);
- /* It seems that xd is no longer supported, and we should use
- a linefeed instead; unfortunately this requires resetting
- CRMOD, and many output routines will have to be modified
- slightly. Let's leave that till the next release. */
- XD = tgetstr("xd", &tbufptr);
-/* not: XD = tgetstr("do", &tbufptr); */
- if(!(CM = tgetstr("cm", &tbufptr))) {
- if(!UP && !HO)
- error("Hack needs CM or UP or HO.");
- printf("Playing hack on terminals without cm is suspect...\n");
- getret();
- }
- SO = tgetstr("so", &tbufptr);
- SE = tgetstr("se", &tbufptr);
- SG = tgetnum("sg"); /* -1: not fnd; else # of spaces left by so */
- if(!SO || !SE || (SG > 0)) SO = SE = 0;
- CD = tgetstr("cd", &tbufptr);
- set_whole_screen(); /* uses LI and CD */
- if(tbufptr-tbuf > sizeof(tbuf)) error("TERMCAP entry too big...\n");
- free(tptr);
-}
-
-start_screen()
-{
- xputs(TI);
- xputs(VS);
-}
-
-end_screen()
-{
- xputs(VE);
- xputs(TE);
-}
-
-/* Cursor movements */
-extern xchar curx, cury;
-
-curs(x, y)
-int x, y; /* not xchar: perhaps xchar is unsigned and
- curx-x would be unsigned as well */
-{
-
- if (y == cury && x == curx)
- return;
- if(!ND && (curx != x || x <= 3)) { /* Extremely primitive */
- cmov(x, y); /* bunker!wtm */
- return;
- }
- if(abs(cury-y) <= 3 && abs(curx-x) <= 3)
- nocmov(x, y);
- else if((x <= 3 && abs(cury-y)<= 3) || (!CM && x<abs(curx-x))) {
- (void) putchar('\r');
- curx = 1;
- nocmov(x, y);
- } else if(!CM) {
- nocmov(x, y);
- } else
- cmov(x, y);
-}
-
-nocmov(x, y)
-{
- if (cury > y) {
- if(UP) {
- while (cury > y) { /* Go up. */
- xputs(UP);
- cury--;
- }
- } else if(CM) {
- cmov(x, y);
- } else if(HO) {
- home();
- curs(x, y);
- } /* else impossible("..."); */
- } else if (cury < y) {
- if(XD) {
- while(cury < y) {
- xputs(XD);
- cury++;
- }
- } else if(CM) {
- cmov(x, y);
- } else {
- while(cury < y) {
- xputc('\n');
- curx = 1;
- cury++;
- }
- }
- }
- if (curx < x) { /* Go to the right. */
- if(!ND) cmov(x, y); else /* bah */
- /* should instead print what is there already */
- while (curx < x) {
- xputs(ND);
- curx++;
- }
- } else if (curx > x) {
- while (curx > x) { /* Go to the left. */
- xputs(BC);
- curx--;
- }
- }
-}
-
-cmov(x, y)
-int x, y;
-{
- xputs(tgoto(CM, x-1, y-1));
- cury = y;
- curx = x;
-}
-
-xputc(c) char c; {
- (void) fputc(c, stdout);
-}
-
-xputs(s) char *s; {
- tputs(s, 1, xputc);
-}
-
-cl_end() {
- if(CE)
- xputs(CE);
- else { /* no-CE fix - free after Harold Rynes */
- /* this looks terrible, especially on a slow terminal
- but is better than nothing */
- int cx = curx, cy = cury;
-
- while(curx < COLNO) {
- xputc(' ');
- curx++;
- }
- curs(cx, cy);
- }
-}
-
-clear_screen() {
- xputs(CL);
- curx = cury = 1;
-}
-
-home()
-{
- if(HO)
- xputs(HO);
- else if(CM)
- xputs(tgoto(CM, 0, 0));
- else
- curs(1, 1); /* using UP ... */
- curx = cury = 1;
-}
-
-standoutbeg()
-{
- if(SO) xputs(SO);
-}
-
-standoutend()
-{
- if(SE) xputs(SE);
-}
-
-backsp()
-{
- xputs(BC);
- curx--;
-}
-
-bell()
-{
- (void) putchar('\007'); /* curx does not change */
- (void) fflush(stdout);
-}
-
-static short tmspc10[] = { /* from termcap */
- 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5, 3, 2, 1
-};
-
-#if 0
-delay_output() {
- /* delay 50 ms - could also use a 'nap'-system call */
- /* BUG: if the padding character is visible, as it is on the 5620
- then this looks terrible. */
- if(!flags.nonull)
- tputs("50", 1, xputc);
-
- /* cbosgd!cbcephus!pds for SYS V R2 */
- /* is this terminfo, or what? */
- /* tputs("$<50>", 1, xputc); */
- else {
- (void) fflush(stdout);
- usleep(50*1000);
- }
- else if(ospeed > 0 || ospeed < SIZE(tmspc10)) if(CM) {
- /* delay by sending cm(here) an appropriate number of times */
- int cmlen = strlen(tgoto(CM, curx-1, cury-1));
- int i = 500 + tmspc10[ospeed]/2;
-
- while(i > 0) {
- cmov(curx, cury);
- i -= cmlen*tmspc10[ospeed];
- }
- }
-}
-#endif /* 0 */
-
-cl_eos() /* free after Robert Viduya */
-{ /* must only be called with curx = 1 */
-
- if(CD)
- xputs(CD);
- else {
- int cx = curx, cy = cury;
- while(cury <= LI-2) {
- cl_end();
- xputc('\n');
- curx = 1;
- cury++;
- }
- cl_end();
- curs(cx, cy);
- }
-}
diff --git a/games/hack/hack.timeout.c b/games/hack/hack.timeout.c
deleted file mode 100644
index f23febf..0000000
--- a/games/hack/hack.timeout.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.timeout.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-timeout(){
-struct prop *upp;
- if(Stoned) stoned_dialogue();
- for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
- if((upp->p_flgs & TIMEOUT) && !--upp->p_flgs) {
- if(upp->p_tofn) (*upp->p_tofn)();
- else switch(upp - u.uprops){
- case STONED:
- killer = "cockatrice";
- done("died");
- break;
- case SICK:
- pline("You die because of food poisoning.");
- killer = u.usick_cause;
- done("died");
- break;
- case FAST:
- pline("You feel yourself slowing down.");
- break;
- case CONFUSION:
- pline("You feel less confused now.");
- break;
- case BLIND:
- pline("You can see again.");
- setsee();
- break;
- case INVIS:
- on_scr(u.ux,u.uy);
- pline("You are no longer invisible.");
- break;
- case WOUNDED_LEGS:
- heal_legs();
- break;
- }
- }
-}
-
-/* He is being petrified - dialogue by inmet!tower */
-char *stoned_texts[] = {
- "You are slowing down.", /* 5 */
- "Your limbs are stiffening.", /* 4 */
- "Your limbs have turned to stone.", /* 3 */
- "You have turned to stone.", /* 2 */
- "You are a statue." /* 1 */
-};
-
-stoned_dialogue()
-{
- long i = (Stoned & TIMEOUT);
-
- if(i > 0 && i <= SIZE(stoned_texts))
- pline(stoned_texts[SIZE(stoned_texts) - i]);
- if(i == 5)
- Fast = 0;
- if(i == 3)
- nomul(-3);
-}
diff --git a/games/hack/hack.topl.c b/games/hack/hack.topl.c
deleted file mode 100644
index 739b2ce..0000000
--- a/games/hack/hack.topl.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.topl.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-extern char *eos();
-extern int CO;
-
-char toplines[BUFSZ];
-xchar tlx, tly; /* set by pline; used by addtopl */
-
-struct topl {
- struct topl *next_topl;
- char *topl_text;
-} *old_toplines, *last_redone_topl;
-#define OTLMAX 20 /* max nr of old toplines remembered */
-
-doredotopl(){
- if(last_redone_topl)
- last_redone_topl = last_redone_topl->next_topl;
- if(!last_redone_topl)
- last_redone_topl = old_toplines;
- if(last_redone_topl){
- (void) strcpy(toplines, last_redone_topl->topl_text);
- }
- redotoplin();
- return(0);
-}
-
-redotoplin() {
- home();
- if(index(toplines, '\n')) cl_end();
- putstr(toplines);
- cl_end();
- tlx = curx;
- tly = cury;
- flags.toplin = 1;
- if(tly > 1)
- more();
-}
-
-remember_topl() {
-struct topl *tl;
-int cnt = OTLMAX;
- if(last_redone_topl &&
- !strcmp(toplines, last_redone_topl->topl_text)) return;
- if(old_toplines &&
- !strcmp(toplines, old_toplines->topl_text)) return;
- last_redone_topl = 0;
- tl = (struct topl *)
- alloc((unsigned)(strlen(toplines) + sizeof(struct topl) + 1));
- tl->next_topl = old_toplines;
- tl->topl_text = (char *)(tl + 1);
- (void) strcpy(tl->topl_text, toplines);
- old_toplines = tl;
- while(cnt && tl){
- cnt--;
- tl = tl->next_topl;
- }
- if(tl && tl->next_topl){
- free((char *) tl->next_topl);
- tl->next_topl = 0;
- }
-}
-
-addtopl(s) char *s; {
- curs(tlx,tly);
- if(tlx + strlen(s) > CO) putsym('\n');
- putstr(s);
- tlx = curx;
- tly = cury;
- flags.toplin = 1;
-}
-
-xmore(s)
-char *s; /* allowed chars besides space/return */
-{
- if(flags.toplin) {
- curs(tlx, tly);
- if(tlx + 8 > CO) putsym('\n'), tly++;
- }
-
- if(flags.standout)
- standoutbeg();
- putstr("--More--");
- if(flags.standout)
- standoutend();
-
- xwaitforspace(s);
- if(flags.toplin && tly > 1) {
- home();
- cl_end();
- docorner(1, tly-1);
- }
- flags.toplin = 0;
-}
-
-more(){
- xmore("");
-}
-
-cmore(s)
-char *s;
-{
- xmore(s);
-}
-
-clrlin(){
- if(flags.toplin) {
- home();
- cl_end();
- if(tly > 1) docorner(1, tly-1);
- remember_topl();
- }
- flags.toplin = 0;
-}
-
-/*VARARGS1*/
-pline(line,arg1,arg2,arg3,arg4,arg5,arg6)
-char *line,*arg1,*arg2,*arg3,*arg4,*arg5,*arg6;
-{
- char pbuf[BUFSZ];
- char *bp = pbuf, *tl;
- int n,n0;
-
- if(!line || !*line) return;
- if(!index(line, '%')) (void) strcpy(pbuf,line); else
- (void) sprintf(pbuf,line,arg1,arg2,arg3,arg4,arg5,arg6);
- if(flags.toplin == 1 && !strcmp(pbuf, toplines)) return;
- nscr(); /* %% */
-
- /* If there is room on the line, print message on same line */
- /* But messages like "You die..." deserve their own line */
- n0 = strlen(bp);
- if(flags.toplin == 1 && tly == 1 &&
- n0 + strlen(toplines) + 3 < CO-8 && /* leave room for --More-- */
- strncmp(bp, "You ", 4)) {
- (void) strcat(toplines, " ");
- (void) strcat(toplines, bp);
- tlx += 2;
- addtopl(bp);
- return;
- }
- if(flags.toplin == 1) more();
- remember_topl();
- toplines[0] = 0;
- while(n0){
- if(n0 >= CO){
- /* look for appropriate cut point */
- n0 = 0;
- for(n = 0; n < CO; n++) if(bp[n] == ' ')
- n0 = n;
- if(!n0) for(n = 0; n < CO-1; n++)
- if(!letter(bp[n])) n0 = n;
- if(!n0) n0 = CO-2;
- }
- (void) strncpy((tl = eos(toplines)), bp, n0);
- tl[n0] = 0;
- bp += n0;
-
- /* remove trailing spaces, but leave one */
- while(n0 > 1 && tl[n0-1] == ' ' && tl[n0-2] == ' ')
- tl[--n0] = 0;
-
- n0 = strlen(bp);
- if(n0 && tl[0]) (void) strcat(tl, "\n");
- }
- redotoplin();
-}
-
-putsym(c) char c; {
- switch(c) {
- case '\b':
- backsp();
- return;
- case '\n':
- curx = 1;
- cury++;
- if(cury > tly) tly = cury;
- break;
- default:
- if(curx == CO)
- putsym('\n'); /* 1 <= curx <= CO; avoid CO */
- else
- curx++;
- }
- (void) putchar(c);
-}
-
-putstr(s) char *s; {
- while(*s) putsym(*s++);
-}
diff --git a/games/hack/hack.track.c b/games/hack/hack.track.c
deleted file mode 100644
index 0062ae9..0000000
--- a/games/hack/hack.track.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.track.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-#define UTSZ 50
-
-coord utrack[UTSZ];
-int utcnt = 0;
-int utpnt = 0;
-
-initrack(){
- utcnt = utpnt = 0;
-}
-
-/* add to track */
-settrack(){
- if(utcnt < UTSZ) utcnt++;
- if(utpnt == UTSZ) utpnt = 0;
- utrack[utpnt].x = u.ux;
- utrack[utpnt].y = u.uy;
- utpnt++;
-}
-
-coord *
-gettrack(x,y) int x,y; {
-int i,cnt,dist;
-coord tc;
- cnt = utcnt;
- for(i = utpnt-1; cnt--; i--){
- if(i == -1) i = UTSZ-1;
- tc = utrack[i];
- dist = (x-tc.x)*(x-tc.x) + (y-tc.y)*(y-tc.y);
- if(dist < 3)
- return(dist ? &(utrack[i]) : 0);
- }
- return(0);
-}
diff --git a/games/hack/hack.trap.c b/games/hack/hack.trap.c
deleted file mode 100644
index 9d10098..0000000
--- a/games/hack/hack.trap.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.trap.c - version 1.0.3 */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-
-extern struct monst *makemon();
-
-char vowels[] = "aeiou";
-
-char *traps[] = {
- " bear trap",
- "n arrow trap",
- " dart trap",
- " trapdoor",
- " teleportation trap",
- " pit",
- " sleeping gas trap",
- " piercer",
- " mimic"
-};
-
-struct trap *
-maketrap(x,y,typ)
-int x,y,typ;
-{
- struct trap *ttmp;
-
- ttmp = newtrap();
- ttmp->ttyp = typ;
- ttmp->tseen = 0;
- ttmp->once = 0;
- ttmp->tx = x;
- ttmp->ty = y;
- ttmp->ntrap = ftrap;
- ftrap = ttmp;
- return(ttmp);
-}
-
-dotrap(trap) struct trap *trap; {
- int ttype = trap->ttyp;
-
- nomul(0);
- if(trap->tseen && !rn2(5) && ttype != PIT)
- pline("You escape a%s.", traps[ttype]);
- else {
- trap->tseen = 1;
- switch(ttype) {
- case SLP_GAS_TRAP:
- pline("A cloud of gas puts you to sleep!");
- nomul(-rnd(25));
- break;
- case BEAR_TRAP:
- if(Levitation) {
- pline("You float over a bear trap.");
- break;
- }
- u.utrap = 4 + rn2(4);
- u.utraptype = TT_BEARTRAP;
- pline("A bear trap closes on your foot!");
- break;
- case PIERC:
- deltrap(trap);
- if(makemon(PM_PIERCER,u.ux,u.uy)) {
- pline("A piercer suddenly drops from the ceiling!");
- if(uarmh)
- pline("Its blow glances off your helmet.");
- else
- (void) thitu(3,d(4,6),"falling piercer");
- }
- break;
- case ARROW_TRAP:
- pline("An arrow shoots out at you!");
- if(!thitu(8,rnd(6),"arrow")){
- mksobj_at(ARROW, u.ux, u.uy);
- fobj->quan = 1;
- }
- break;
- case TRAPDOOR:
- if(!xdnstair) {
-pline("A trap door in the ceiling opens and a rock falls on your head!");
-if(uarmh) pline("Fortunately, you are wearing a helmet!");
- losehp(uarmh ? 2 : d(2,10),"falling rock");
- mksobj_at(ROCK, u.ux, u.uy);
- fobj->quan = 1;
- stackobj(fobj);
- if(Invisible) newsym(u.ux, u.uy);
- } else {
- int newlevel = dlevel + 1;
- while(!rn2(4) && newlevel < 29)
- newlevel++;
- pline("A trap door opens up under you!");
- if(Levitation || u.ustuck) {
- pline("For some reason you don't fall in.");
- break;
- }
-
- goto_level(newlevel, FALSE);
- }
- break;
- case DART_TRAP:
- pline("A little dart shoots out at you!");
- if(thitu(7,rnd(3),"little dart")) {
- if(!rn2(6))
- poisoned("dart","poison dart");
- } else {
- mksobj_at(DART, u.ux, u.uy);
- fobj->quan = 1;
- }
- break;
- case TELEP_TRAP:
- if(trap->once) {
- deltrap(trap);
- newsym(u.ux,u.uy);
- vtele();
- } else {
- newsym(u.ux,u.uy);
- tele();
- }
- break;
- case PIT:
- if(Levitation) {
- pline("A pit opens up under you!");
- pline("You don't fall in!");
- break;
- }
- pline("You fall into a pit!");
- u.utrap = rn1(6,2);
- u.utraptype = TT_PIT;
- losehp(rnd(6),"fall into a pit");
- selftouch("Falling, you");
- break;
- default:
- impossible("You hit a trap of type %u", trap->ttyp);
- }
- }
-}
-
-mintrap(mtmp) struct monst *mtmp; {
- struct trap *trap = t_at(mtmp->mx, mtmp->my);
- int wasintrap = mtmp->mtrapped;
-
- if(!trap) {
- mtmp->mtrapped = 0; /* perhaps teleported? */
- } else if(wasintrap) {
- if(!rn2(40)) mtmp->mtrapped = 0;
- } else {
- int tt = trap->ttyp;
- int in_sight = cansee(mtmp->mx,mtmp->my);
- extern char mlarge[];
-
- if(mtmp->mtrapseen & (1 << tt)) {
- /* he has been in such a trap - perhaps he escapes */
- if(rn2(4)) return(0);
- }
- mtmp->mtrapseen |= (1 << tt);
- switch (tt) {
- case BEAR_TRAP:
- if(index(mlarge, mtmp->data->mlet)) {
- if(in_sight)
- pline("%s is caught in a bear trap!",
- Monnam(mtmp));
- else
- if(mtmp->data->mlet == 'o')
- pline("You hear the roaring of an angry bear!");
- mtmp->mtrapped = 1;
- }
- break;
- case PIT:
- /* there should be a mtmp/data -> floating */
- if(!index("EywBfk'& ", mtmp->data->mlet)) { /* ab */
- mtmp->mtrapped = 1;
- if(in_sight)
- pline("%s falls in a pit!", Monnam(mtmp));
- }
- break;
- case SLP_GAS_TRAP:
- if(!mtmp->msleep && !mtmp->mfroz) {
- mtmp->msleep = 1;
- if(in_sight)
- pline("%s suddenly falls asleep!",
- Monnam(mtmp));
- }
- break;
- case TELEP_TRAP:
- rloc(mtmp);
- if(in_sight && !cansee(mtmp->mx,mtmp->my))
- pline("%s suddenly disappears!",
- Monnam(mtmp));
- break;
- case ARROW_TRAP:
- if(in_sight) {
- pline("%s is hit by an arrow!",
- Monnam(mtmp));
- }
- mtmp->mhp -= 3;
- break;
- case DART_TRAP:
- if(in_sight) {
- pline("%s is hit by a dart!",
- Monnam(mtmp));
- }
- mtmp->mhp -= 2;
- /* not mondied here !! */
- break;
- case TRAPDOOR:
- if(!xdnstair) {
- mtmp->mhp -= 10;
- if(in_sight)
-pline("A trap door in the ceiling opens and a rock hits %s!", monnam(mtmp));
- break;
- }
- if(mtmp->data->mlet != 'w'){
- fall_down(mtmp);
- if(in_sight)
- pline("Suddenly, %s disappears out of sight.", monnam(mtmp));
- return(2); /* no longer on this level */
- }
- break;
- case PIERC:
- break;
- default:
- impossible("Some monster encountered a strange trap.");
- }
- }
- return(mtmp->mtrapped);
-}
-
-selftouch(arg) char *arg; {
- if(uwep && uwep->otyp == DEAD_COCKATRICE){
- pline("%s touch the dead cockatrice.", arg);
- pline("You turn to stone.");
- killer = objects[uwep->otyp].oc_name;
- done("died");
- }
-}
-
-float_up(){
- if(u.utrap) {
- if(u.utraptype == TT_PIT) {
- u.utrap = 0;
- pline("You float up, out of the pit!");
- } else {
- pline("You float up, only your leg is still stuck.");
- }
- } else
- pline("You start to float in the air!");
-}
-
-float_down(){
- struct trap *trap;
- pline("You float gently to the ground.");
- if(trap = t_at(u.ux,u.uy))
- switch(trap->ttyp) {
- case PIERC:
- break;
- case TRAPDOOR:
- if(!xdnstair || u.ustuck) break;
- /* FALLTHROUGH */
- default:
- dotrap(trap);
- }
- pickup(1);
-}
-
-vtele() {
-#include "def.mkroom.h"
- struct mkroom *croom;
- for(croom = &rooms[0]; croom->hx >= 0; croom++)
- if(croom->rtype == VAULT) {
- int x,y;
-
- x = rn2(2) ? croom->lx : croom->hx;
- y = rn2(2) ? croom->ly : croom->hy;
- if(teleok(x,y)) {
- teleds(x,y);
- return;
- }
- }
- tele();
-}
-
-tele() {
- extern coord getpos();
- coord cc;
- int nux,nuy;
-
- if(Teleport_control) {
- pline("To what position do you want to be teleported?");
- cc = getpos(1, "the desired position"); /* 1: force valid */
- /* possible extensions: introduce a small error if
- magic power is low; allow transfer to solid rock */
- if(teleok(cc.x, cc.y)){
- teleds(cc.x, cc.y);
- return;
- }
- pline("Sorry ...");
- }
- do {
- nux = rnd(COLNO-1);
- nuy = rn2(ROWNO);
- } while(!teleok(nux, nuy));
- teleds(nux, nuy);
-}
-
-teleds(nux, nuy)
-int nux,nuy;
-{
- if(Punished) unplacebc();
- unsee();
- u.utrap = 0;
- u.ustuck = 0;
- u.ux = nux;
- u.uy = nuy;
- setsee();
- if(Punished) placebc(1);
- if(u.uswallow){
- u.uswldtim = u.uswallow = 0;
- docrt();
- }
- nomul(0);
- if(levl[nux][nuy].typ == POOL && !Levitation)
- drown();
- (void) inshop();
- pickup(1);
- if(!Blind) read_engr_at(u.ux,u.uy);
-}
-
-teleok(x,y) int x,y; { /* might throw him into a POOL */
- return( isok(x,y) && !IS_ROCK(levl[x][y].typ) && !m_at(x,y) &&
- !sobj_at(ENORMOUS_ROCK,x,y) && !t_at(x,y)
- );
- /* Note: gold is permitted (because of vaults) */
-}
-
-dotele() {
- extern char pl_character[];
-
- if(
-#ifdef WIZARD
- !wizard &&
-#endif /* WIZARD */
- (!Teleportation || u.ulevel < 6 ||
- (pl_character[0] != 'W' && u.ulevel < 10))) {
- pline("You are not able to teleport at will.");
- return(0);
- }
- if(u.uhunger <= 100 || u.ustr < 6) {
- pline("You miss the strength for a teleport spell.");
- return(1);
- }
- tele();
- morehungry(100);
- return(1);
-}
-
-placebc(attach) int attach; {
- if(!uchain || !uball){
- impossible("Where are your chain and ball??");
- return;
- }
- uball->ox = uchain->ox = u.ux;
- uball->oy = uchain->oy = u.uy;
- if(attach){
- uchain->nobj = fobj;
- fobj = uchain;
- if(!carried(uball)){
- uball->nobj = fobj;
- fobj = uball;
- }
- }
-}
-
-unplacebc(){
- if(!carried(uball)){
- freeobj(uball);
- unpobj(uball);
- }
- freeobj(uchain);
- unpobj(uchain);
-}
-
-level_tele() {
-int newlevel;
- if(Teleport_control) {
- char buf[BUFSZ];
-
- do {
- pline("To what level do you want to teleport? [type a number] ");
- getlin(buf);
- } while(!digit(buf[0]) && (buf[0] != '-' || !digit(buf[1])));
- newlevel = atoi(buf);
- } else {
- newlevel = 5 + rn2(20); /* 5 - 24 */
- if(dlevel == newlevel) {
- if(!xdnstair) newlevel--; else newlevel++;
- }
- }
- if(newlevel >= 30) {
- if(newlevel > MAXLEVEL) newlevel = MAXLEVEL;
- pline("You arrive at the center of the earth ...");
- pline("Unfortunately it is here that hell is located.");
- if(Fire_resistance) {
- pline("But the fire doesn't seem to harm you.");
- } else {
- pline("You burn to a crisp.");
- dlevel = maxdlevel = newlevel;
- killer = "visit to the hell";
- done("burned");
- }
- }
- if(newlevel < 0) {
- newlevel = 0;
- pline("You are now high above the clouds ...");
- if(Levitation) {
- pline("You float gently down to earth.");
- done("escaped");
- }
- pline("Unfortunately, you don't know how to fly.");
- pline("You fall down a few thousand feet and break your neck.");
- dlevel = 0;
- killer = "fall";
- done("died");
- }
-
- goto_level(newlevel, FALSE); /* calls done("escaped") if newlevel==0 */
-}
-
-drown()
-{
- pline("You fall into a pool!");
- pline("You can't swim!");
- if(rn2(3) < u.uluck+2) {
- /* most scrolls become unreadable */
- struct obj *obj;
-
- for(obj = invent; obj; obj = obj->nobj)
- if(obj->olet == SCROLL_SYM && rn2(12) > u.uluck)
- obj->otyp = SCR_BLANK_PAPER;
- /* we should perhaps merge these scrolls ? */
-
- pline("You attempt a teleport spell."); /* utcsri!carroll */
- (void) dotele();
- if(levl[u.ux][u.uy].typ != POOL) return;
- }
- pline("You drown ...");
- killer = "pool of water";
- done("drowned");
-}
diff --git a/games/hack/hack.tty.c b/games/hack/hack.tty.c
deleted file mode 100644
index 7932633..0000000
--- a/games/hack/hack.tty.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*-
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.tty.c - version 1.0.3 */
-/* With thanks to the people who sent code for SYSV - hpscdi!jon,
- arnold@ucsf-cgl, wcs@bo95b, cbcephus!pds and others. */
-
-#include "hack.h"
-#include <stdio.h>
-
-/*
- * The distinctions here are not BSD - rest but rather USG - rest, as
- * BSD still has the old sgttyb structure, but SYSV has termio. Thus:
- */
-#ifdef BSD
-#define V7
-#else
-#define USG
-#endif /* BSD */
-
-/*
- * Some systems may have getchar() return EOF for various reasons, and
- * we should not quit before seeing at least NR_OF_EOFS consecutive EOFs.
- */
-#ifndef BSD
-#define NR_OF_EOFS 20
-#endif /* BSD */
-
-
-#ifdef USG
-
-#include <termio.h>
-#define termstruct termio
-#define kill_sym c_cc[VKILL]
-#define erase_sym c_cc[VERASE]
-#define EXTABS TAB3
-#define tabflgs c_oflag
-#define echoflgs c_lflag
-#define cbrkflgs c_lflag
-#define CBRKMASK ICANON
-#define CBRKON ! /* reverse condition */
-#define OSPEED(x) ((x).c_cflag & CBAUD)
-#define GTTY(x) (ioctl(0, TCGETA, x))
-#define STTY(x) (ioctl(0, TCSETA, x)) /* TCSETAF? TCSETAW? */
-
-#else /* V7 */
-
-#include <sgtty.h>
-#define termstruct sgttyb
-#define kill_sym sg_kill
-#define erase_sym sg_erase
-#define EXTABS XTABS
-#define tabflgs sg_flags
-#define echoflgs sg_flags
-#define cbrkflgs sg_flags
-#define CBRKMASK CBREAK
-#define CBRKON /* empty */
-#define OSPEED(x) (x).sg_ospeed
-#define GTTY(x) (gtty(0, x))
-#define STTY(x) (stty(0, x))
-
-#endif /* USG */
-
-#if 0
-extern short ospeed;
-#endif
-static char erase_char, kill_char;
-static boolean settty_needed = FALSE;
-struct termstruct inittyb, curttyb;
-
-/*
- * Get initial state of terminal, set ospeed (for termcap routines)
- * and switch off tab expansion if necessary.
- * Called by startup() in termcap.c and after returning from ! or ^Z
- */
-gettty(){
- if(GTTY(&inittyb) < 0)
- perror("Hack (gettty)");
- curttyb = inittyb;
-#if 0
- ospeed = OSPEED(inittyb);
-#endif
- erase_char = inittyb.erase_sym;
- kill_char = inittyb.kill_sym;
- getioctls();
-
- /* do not expand tabs - they might be needed inside a cm sequence */
- if(curttyb.tabflgs & EXTABS) {
- curttyb.tabflgs &= ~EXTABS;
- setctty();
- }
- settty_needed = TRUE;
-}
-
-/* reset terminal to original state */
-settty(s) char *s; {
- clear_screen();
- end_screen();
- if(s) printf("%s", s);
- (void) fflush(stdout);
- if(STTY(&inittyb) < 0)
- perror("Hack (settty)");
- flags.echo = (inittyb.echoflgs & ECHO) ? ON : OFF;
- flags.cbreak = (CBRKON(inittyb.cbrkflgs & CBRKMASK)) ? ON : OFF;
- setioctls();
-}
-
-setctty(){
- if(STTY(&curttyb) < 0)
- perror("Hack (setctty)");
-}
-
-
-setftty(){
-int ef = 0; /* desired value of flags & ECHO */
-int cf = CBRKON(CBRKMASK); /* desired value of flags & CBREAK */
-int change = 0;
- flags.cbreak = ON;
- flags.echo = OFF;
- /* Should use (ECHO|CRMOD) here instead of ECHO */
- if((curttyb.echoflgs & ECHO) != ef){
- curttyb.echoflgs &= ~ECHO;
-/* curttyb.echoflgs |= ef; */
- change++;
- }
- if((curttyb.cbrkflgs & CBRKMASK) != cf){
- curttyb.cbrkflgs &= ~CBRKMASK;
- curttyb.cbrkflgs |= cf;
-#ifdef USG
- /* be satisfied with one character; no timeout */
- curttyb.c_cc[VMIN] = 1; /* was VEOF */
- curttyb.c_cc[VTIME] = 0; /* was VEOL */
-#endif /* USG */
- change++;
- }
- if(change){
- setctty();
- }
- start_screen();
-}
-
-
-/* fatal error */
-/*VARARGS1*/
-error(s,x,y) char *s; {
- if(settty_needed)
- settty((char *) 0);
- printf(s,x,y);
- putchar('\n');
- exit(1);
-}
-
-/*
- * Read a line closed with '\n' into the array char bufp[BUFSZ].
- * (The '\n' is not stored. The string is closed with a '\0'.)
- * Reading can be interrupted by an escape ('\033') - now the
- * resulting string is "\033".
- */
-getlin(bufp)
-char *bufp;
-{
- char *obufp = bufp;
- int c;
-
- flags.toplin = 2; /* nonempty, no --More-- required */
- for(;;) {
- (void) fflush(stdout);
- if((c = getchar()) == EOF) {
- *bufp = 0;
- return;
- }
- if(c == '\033') {
- *obufp = c;
- obufp[1] = 0;
- return;
- }
- if(c == erase_char || c == '\b') {
- if(bufp != obufp) {
- bufp--;
- putstr("\b \b"); /* putsym converts \b */
- } else bell();
- } else if(c == '\n') {
- *bufp = 0;
- return;
- } else if(' ' <= c && c < '\177') {
- /* avoid isprint() - some people don't have it
- ' ' is not always a printing char */
- *bufp = c;
- bufp[1] = 0;
- putstr(bufp);
- if(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)
- bufp++;
- } else if(c == kill_char || c == '\177') { /* Robert Viduya */
- /* this test last - @ might be the kill_char */
- while(bufp != obufp) {
- bufp--;
- putstr("\b \b");
- }
- } else
- bell();
- }
-}
-
-getret() {
- cgetret("");
-}
-
-cgetret(s)
-char *s;
-{
- putsym('\n');
- if(flags.standout)
- standoutbeg();
- putstr("Hit ");
- putstr(flags.cbreak ? "space" : "return");
- putstr(" to continue: ");
- if(flags.standout)
- standoutend();
- xwaitforspace(s);
-}
-
-char morc; /* tell the outside world what char he used */
-
-xwaitforspace(s)
-char *s; /* chars allowed besides space or return */
-{
-int c;
-
- morc = 0;
-
- while((c = readchar()) != '\n') {
- if(flags.cbreak) {
- if(c == ' ') break;
- if(s && index(s,c)) {
- morc = c;
- break;
- }
- bell();
- }
- }
-}
-
-char *
-parse()
-{
- static char inputline[COLNO];
- int foo;
-
- flags.move = 1;
- if(!Invisible) curs_on_u(); else home();
- while((foo = readchar()) >= '0' && foo <= '9')
- multi = 10*multi+foo-'0';
- if(multi) {
- multi--;
- save_cm = inputline;
- }
- inputline[0] = foo;
- inputline[1] = 0;
- if(foo == 'f' || foo == 'F'){
- inputline[1] = getchar();
-#ifdef QUEST
- if(inputline[1] == foo) inputline[2] = getchar(); else
-#endif /* QUEST */
- inputline[2] = 0;
- }
- if(foo == 'm' || foo == 'M'){
- inputline[1] = getchar();
- inputline[2] = 0;
- }
- clrlin();
- return(inputline);
-}
-
-char
-readchar() {
- int sym;
-
- (void) fflush(stdout);
- if((sym = getchar()) == EOF)
-#ifdef NR_OF_EOFS
- { /*
- * Some SYSV systems seem to return EOFs for various reasons
- * (?like when one hits break or for interrupted systemcalls?),
- * and we must see several before we quit.
- */
- int cnt = NR_OF_EOFS;
- while (cnt--) {
- clearerr(stdin); /* omit if clearerr is undefined */
- if((sym = getchar()) != EOF) goto noteof;
- }
- end_of_input();
- noteof: ;
- }
-#else
- end_of_input();
-#endif /* NR_OF_EOFS */
- if(flags.toplin == 1)
- flags.toplin = 2;
- return((char) sym);
-}
-
-end_of_input()
-{
- settty("End of input?\n");
- clearlocks();
- exit(0);
-}
diff --git a/games/hack/hack.u_init.c b/games/hack/hack.u_init.c
deleted file mode 100644
index 1cd3b2d..0000000
--- a/games/hack/hack.u_init.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.u_init.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-#define Strcpy (void) strcpy
-#define Strcat (void) strcat
-#define UNDEF_TYP 0
-#define UNDEF_SPE '\177'
-extern struct obj *addinv();
-extern char *eos();
-extern char plname[];
-
-struct you zerou;
-char pl_character[PL_CSIZ];
-char *(roles[]) = { /* must all have distinct first letter */
- /* roles[4] may be changed to -man */
- "Tourist", "Speleologist", "Fighter", "Knight",
- "Cave-man", "Wizard"
-};
-#define NR_OF_ROLES SIZE(roles)
-char rolesyms[NR_OF_ROLES + 1]; /* filled by u_init() */
-
-struct trobj {
- uchar trotyp;
- schar trspe;
- char trolet;
- Bitfield(trquan,6);
- Bitfield(trknown,1);
-};
-
-#ifdef WIZARD
-struct trobj Extra_objs[] = {
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 }
-};
-#endif /* WIZARD */
-
-struct trobj Cave_man[] = {
- { MACE, 1, WEAPON_SYM, 1, 1 },
- { BOW, 1, WEAPON_SYM, 1, 1 },
- { ARROW, 0, WEAPON_SYM, 25, 1 }, /* quan is variable */
- { LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1 },
- { 0, 0, 0, 0, 0}
-};
-
-struct trobj Fighter[] = {
- { TWO_HANDED_SWORD, 0, WEAPON_SYM, 1, 1 },
- { RING_MAIL, 0, ARMOR_SYM, 1, 1 },
- { 0, 0, 0, 0, 0 }
-};
-
-struct trobj Knight[] = {
- { LONG_SWORD, 0, WEAPON_SYM, 1, 1 },
- { SPEAR, 2, WEAPON_SYM, 1, 1 },
- { RING_MAIL, 1, ARMOR_SYM, 1, 1 },
- { HELMET, 0, ARMOR_SYM, 1, 1 },
- { SHIELD, 0, ARMOR_SYM, 1, 1 },
- { PAIR_OF_GLOVES, 0, ARMOR_SYM, 1, 1 },
- { 0, 0, 0, 0, 0 }
-};
-
-struct trobj Speleologist[] = {
- { STUDDED_LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1 },
- { UNDEF_TYP, 0, POTION_SYM, 2, 0 },
- { FOOD_RATION, 0, FOOD_SYM, 3, 1 },
- { PICK_AXE, UNDEF_SPE, TOOL_SYM, 1, 0 },
- { ICE_BOX, 0, TOOL_SYM, 1, 0 },
- { 0, 0, 0, 0, 0}
-};
-
-struct trobj Tinopener[] = {
- { CAN_OPENER, 0, TOOL_SYM, 1, 1 },
- { 0, 0, 0, 0, 0 }
-};
-
-struct trobj Tourist[] = {
- { UNDEF_TYP, 0, FOOD_SYM, 10, 1 },
- { POT_EXTRA_HEALING, 0, POTION_SYM, 2, 0 },
- { EXPENSIVE_CAMERA, 0, TOOL_SYM, 1, 1 },
- { DART, 2, WEAPON_SYM, 25, 1 }, /* quan is variable */
- { 0, 0, 0, 0, 0 }
-};
-
-struct trobj Wizard[] = {
- { ELVEN_CLOAK, 0, ARMOR_SYM, 1, 1 },
- { UNDEF_TYP, UNDEF_SPE, WAND_SYM, 2, 0 },
- { UNDEF_TYP, UNDEF_SPE, RING_SYM, 2, 0 },
- { UNDEF_TYP, UNDEF_SPE, POTION_SYM, 2, 0 },
- { UNDEF_TYP, UNDEF_SPE, SCROLL_SYM, 3, 0 },
- { 0, 0, 0, 0, 0 }
-};
-
-u_init(){
-int i;
-char exper = 'y', pc;
-extern char readchar();
- if(flags.female) /* should have been set in HACKOPTIONS */
- roles[4] = "Cave-woman";
- for(i = 0; i < NR_OF_ROLES; i++)
- rolesyms[i] = roles[i][0];
- rolesyms[i] = 0;
-
- if(pc = pl_character[0]) {
- if('a' <= pc && pc <= 'z') pc += 'A'-'a';
- if((i = role_index(pc)) >= 0)
- goto got_suffix; /* implies experienced */
- printf("\nUnknown role: %c\n", pc);
- pl_character[0] = pc = 0;
- }
-
- printf("\nAre you an experienced player? [ny] ");
-
- while(!index("ynYN \n\004", (exper = readchar())))
- bell();
- if(exper == '\004') /* Give him an opportunity to get out */
- end_of_input();
- printf("%c\n", exper); /* echo */
- if(index("Nn \n", exper)) {
- exper = 0;
- goto beginner;
- }
-
- printf("\nTell me what kind of character you are:\n");
- printf("Are you");
- for(i = 0; i < NR_OF_ROLES; i++) {
- printf(" a %s", roles[i]);
- if(i == 2) /* %% */
- printf(",\n\t");
- else if(i < NR_OF_ROLES - 2)
- printf(",");
- else if(i == NR_OF_ROLES - 2)
- printf(" or");
- }
- printf("? [%s] ", rolesyms);
-
- while(pc = readchar()) {
- if('a' <= pc && pc <= 'z') pc += 'A'-'a';
- if((i = role_index(pc)) >= 0) {
- printf("%c\n", pc); /* echo */
- (void) fflush(stdout); /* should be seen */
- break;
- }
- if(pc == '\n')
- break;
- if(pc == '\004') /* Give him the opportunity to get out */
- end_of_input();
- bell();
- }
- if(pc == '\n')
- pc = 0;
-
-beginner:
- if(!pc) {
- printf("\nI'll choose a character for you.\n");
- i = rn2(NR_OF_ROLES);
- pc = rolesyms[i];
- printf("This game you will be a%s %s.\n",
- exper ? "n experienced" : "",
- roles[i]);
- getret();
- /* give him some feedback in case mklev takes much time */
- (void) putchar('\n');
- (void) fflush(stdout);
- }
- if(exper) {
- roles[i][0] = pc;
- }
-
-got_suffix:
-
- (void) strncpy(pl_character, roles[i], PL_CSIZ-1);
- pl_character[PL_CSIZ-1] = 0;
- flags.beginner = 1;
- u = zerou;
- u.usym = '@';
- u.ulevel = 1;
- init_uhunger();
-#ifdef QUEST
- u.uhorizon = 6;
-#endif /* QUEST */
- uarm = uarm2 = uarmh = uarms = uarmg = uwep = uball = uchain =
- uleft = uright = 0;
-
- switch(pc) {
- case 'c':
- case 'C':
- Cave_man[2].trquan = 12 + rnd(9)*rnd(9);
- u.uhp = u.uhpmax = 16;
- u.ustr = u.ustrmax = 18;
- ini_inv(Cave_man);
- break;
- case 't':
- case 'T':
- Tourist[3].trquan = 20 + rnd(20);
- u.ugold = u.ugold0 = rnd(1000);
- u.uhp = u.uhpmax = 10;
- u.ustr = u.ustrmax = 8;
- ini_inv(Tourist);
- if(!rn2(25)) ini_inv(Tinopener);
- break;
- case 'w':
- case 'W':
- for(i=1; i<=4; i++) if(!rn2(5))
- Wizard[i].trquan += rn2(3) - 1;
- u.uhp = u.uhpmax = 15;
- u.ustr = u.ustrmax = 16;
- ini_inv(Wizard);
- break;
- case 's':
- case 'S':
- Fast = INTRINSIC;
- Stealth = INTRINSIC;
- u.uhp = u.uhpmax = 12;
- u.ustr = u.ustrmax = 10;
- ini_inv(Speleologist);
- if(!rn2(10)) ini_inv(Tinopener);
- break;
- case 'k':
- case 'K':
- u.uhp = u.uhpmax = 12;
- u.ustr = u.ustrmax = 10;
- ini_inv(Knight);
- break;
- case 'f':
- case 'F':
- u.uhp = u.uhpmax = 14;
- u.ustr = u.ustrmax = 17;
- ini_inv(Fighter);
- break;
- default: /* impossible */
- u.uhp = u.uhpmax = 12;
- u.ustr = u.ustrmax = 16;
- }
- find_ac();
- if(!rn2(20)) {
- int d = rn2(7) - 2; /* biased variation */
- u.ustr += d;
- u.ustrmax += d;
- }
-
-#ifdef WIZARD
- if(wizard) wiz_inv();
-#endif /* WIZARD */
-
- /* make sure he can carry all he has - especially for T's */
- while(inv_weight() > 0 && u.ustr < 118)
- u.ustr++, u.ustrmax++;
-}
-
-ini_inv(trop) struct trobj *trop; {
-struct obj *obj;
-extern struct obj *mkobj();
- while(trop->trolet) {
- obj = mkobj(trop->trolet);
- obj->known = trop->trknown;
- /* not obj->dknown = 1; - let him look at it at least once */
- obj->cursed = 0;
- if(obj->olet == WEAPON_SYM){
- obj->quan = trop->trquan;
- trop->trquan = 1;
- }
- if(trop->trspe != UNDEF_SPE)
- obj->spe = trop->trspe;
- if(trop->trotyp != UNDEF_TYP)
- obj->otyp = trop->trotyp;
- else
- if(obj->otyp == WAN_WISHING) /* gitpyr!robert */
- obj->otyp = WAN_DEATH;
- obj->owt = weight(obj); /* defined after setting otyp+quan */
- obj = addinv(obj);
- if(obj->olet == ARMOR_SYM){
- switch(obj->otyp){
- case SHIELD:
- if(!uarms) setworn(obj, W_ARMS);
- break;
- case HELMET:
- if(!uarmh) setworn(obj, W_ARMH);
- break;
- case PAIR_OF_GLOVES:
- if(!uarmg) setworn(obj, W_ARMG);
- break;
- case ELVEN_CLOAK:
- if(!uarm2)
- setworn(obj, W_ARM);
- break;
- default:
- if(!uarm) setworn(obj, W_ARM);
- }
- }
- if(obj->olet == WEAPON_SYM)
- if(!uwep) setuwep(obj);
-#ifndef PYRAMID_BUG
- if(--trop->trquan) continue; /* make a similar object */
-#else
- if(trop->trquan) { /* check if zero first */
- --trop->trquan;
- if(trop->trquan)
- continue; /* make a similar object */
- }
-#endif /* PYRAMID_BUG */
- trop++;
- }
-}
-
-#ifdef WIZARD
-wiz_inv(){
-struct trobj *trop = &Extra_objs[0];
-char *ep = getenv("INVENT");
-int type;
- while(ep && *ep) {
- type = atoi(ep);
- ep = index(ep, ',');
- if(ep) while(*ep == ',' || *ep == ' ') ep++;
- if(type <= 0 || type > NROFOBJECTS) continue;
- trop->trotyp = type;
- trop->trolet = objects[type].oc_olet;
- trop->trspe = 4;
- trop->trknown = 1;
- trop->trquan = 1;
- ini_inv(trop);
- }
- /* give him a wand of wishing by default */
- trop->trotyp = WAN_WISHING;
- trop->trolet = WAND_SYM;
- trop->trspe = 20;
- trop->trknown = 1;
- trop->trquan = 1;
- ini_inv(trop);
-}
-#endif /* WIZARD */
-
-plnamesuffix() {
-char *p;
- if(p = rindex(plname, '-')) {
- *p = 0;
- pl_character[0] = p[1];
- pl_character[1] = 0;
- if(!plname[0]) {
- askname();
- plnamesuffix();
- }
- }
-}
-
-role_index(pc)
-char pc;
-{ /* must be called only from u_init() */
- /* so that rolesyms[] is defined */
- char *cp;
-
- if(cp = index(rolesyms, pc))
- return(cp - rolesyms);
- return(-1);
-}
diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c
deleted file mode 100644
index 19a7cdd..0000000
--- a/games/hack/hack.unix.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.unix.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-/* This file collects some Unix dependencies; hack.pager.c contains some more */
-
-/*
- * The time is used for:
- * - seed for random()
- * - year on tombstone and yymmdd in record file
- * - phase of the moon (various monsters react to NEW_MOON or FULL_MOON)
- * - night and midnight (the undead are dangerous at midnight)
- * - determination of what files are "very old"
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "hack.h" /* mainly for index() which depends on BSD */
-
-#include <sys/types.h> /* for time_t and stat */
-#include <sys/stat.h>
-#include <time.h>
-
-setrandom()
-{
- (void) srandomdev();
-}
-
-struct tm *
-getlt()
-{
- time_t date;
- struct tm *localtime();
-
- (void) time(&date);
- return(localtime(&date));
-}
-
-getyear()
-{
- return(1900 + getlt()->tm_year);
-}
-
-char *
-getdate()
-{
- static char datestr[7];
- struct tm *lt = getlt();
-
- (void) snprintf(datestr, sizeof(datestr), "%02d%02d%02d",
- lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday);
- return(datestr);
-}
-
-phase_of_the_moon() /* 0-7, with 0: new, 4: full */
-{ /* moon period: 29.5306 days */
- /* year: 365.2422 days */
- struct tm *lt = getlt();
- int epact, diy, golden;
-
- diy = lt->tm_yday;
- golden = (lt->tm_year % 19) + 1;
- epact = (11 * golden + 18) % 30;
- if ((epact == 25 && golden > 11) || epact == 24)
- epact++;
-
- return( (((((diy + epact) * 6) + 11) % 177) / 22) & 7 );
-}
-
-night()
-{
- int hour = getlt()->tm_hour;
-
- return(hour < 6 || hour > 21);
-}
-
-midnight()
-{
- return(getlt()->tm_hour == 0);
-}
-
-struct stat buf, hbuf;
-
-gethdate(name) char *name; {
-/* old version - for people short of space */
-char *np;
-
- name = "/usr/games/hide/hack";
- if(stat(name, &hbuf))
- error("Cannot get status of %s.",
- (np = rindex(name, '/')) ? np+1 : name);
-}
-
-uptodate(fd) {
- if(fstat(fd, &buf)) {
- pline("Cannot get status of saved level? ");
- return(0);
- }
- if(buf.st_mtime < hbuf.st_mtime) {
- pline("Saved level is out of date. ");
- return(0);
- }
- return(1);
-}
-
-/* see whether we should throw away this xlock file */
-veryold(fd) {
- int i;
- time_t date;
-
- if(fstat(fd, &buf)) return(0); /* cannot get status */
- if(buf.st_size != sizeof(int)) return(0); /* not an xlock file */
- (void) time(&date);
- if(date - buf.st_mtime < 3L*24L*60L*60L) { /* recent */
- extern int errno;
- int lockedpid; /* should be the same size as hackpid */
-
- if(read(fd, (char *)&lockedpid, sizeof(lockedpid)) !=
- sizeof(lockedpid))
- /* strange ... */
- return(0);
-
- /* From: Rick Adams <seismo!rick> */
- /* This will work on 4.1cbsd, 4.2bsd and system 3? & 5. */
- /* It will do nothing on V7 or 4.1bsd. */
- if(!(kill(lockedpid, 0) == -1 && errno == ESRCH))
- return(0);
- }
- (void) close(fd);
- for(i = 1; i <= MAXLEVEL; i++) { /* try to remove all */
- glo(i);
- (void) unlink(lock);
- }
- glo(0);
- if(unlink(lock)) return(0); /* cannot remove it */
- return(1); /* success! */
-}
-
-getlock()
-{
- extern int errno, hackpid, locknum;
- int i = 0, fd;
-
- (void) fflush(stdout);
-
- /* we ignore QUIT and INT at this point */
- if (link(HLOCK, LLOCK) == -1) {
- int errnosv = errno;
-
- perror(HLOCK);
- printf("Cannot link %s to %s\n", LLOCK, HLOCK);
- switch(errnosv) {
- case ENOENT:
- printf("Perhaps there is no (empty) file %s ?\n", HLOCK);
- break;
- case EACCES:
- printf("It seems you don't have write permission here.\n");
- break;
- case EEXIST:
- printf("(Try again or rm %s.)\n", LLOCK);
- break;
- default:
- printf("I don't know what is wrong.");
- }
- getret();
- error("");
- /*NOTREACHED*/
- }
-
- regularize(lock);
- glo(0);
- if(locknum > 25) locknum = 25;
-
- do {
- if(locknum) lock[0] = 'a' + i++;
-
- if((fd = open(lock, 0)) == -1) {
- if(errno == ENOENT) goto gotlock; /* no such file */
- perror(lock);
- (void) unlink(LLOCK);
- error("Cannot open %s", lock);
- }
-
- if(veryold(fd)) /* if true, this closes fd and unlinks lock */
- goto gotlock;
- (void) close(fd);
- } while(i < locknum);
-
- (void) unlink(LLOCK);
- error(locknum ? "Too many hacks running now."
- : "There is a game in progress under your name.");
-gotlock:
- fd = creat(lock, FMASK);
- if(unlink(LLOCK) == -1)
- error("Cannot unlink %s.", LLOCK);
- if(fd == -1) {
- error("cannot creat lock file.");
- } else {
- if(write(fd, (char *) &hackpid, sizeof(hackpid))
- != sizeof(hackpid)){
- error("cannot write lock");
- }
- if(close(fd) == -1) {
- error("cannot close lock");
- }
- }
-}
-
-#ifdef MAIL
-
-/*
- * Notify user when new mail has arrived. [Idea from Merlyn Leroy, but
- * I don't know the details of his implementation.]
- * { Later note: he disliked my calling a general mailreader and felt that
- * hack should do the paging itself. But when I get mail, I want to put it
- * in some folder, reply, etc. - it would be unreasonable to put all these
- * functions in hack. }
- * The mail daemon '2' is at present not a real monster, but only a visual
- * effect. Thus, makemon() is superfluous. This might become otherwise,
- * however. The motion of '2' is less restrained than usual: diagonal moves
- * from a DOOR are possible. He might also use SDOOR's. Also, '2' is visible
- * in a ROOM, even when you are Blind.
- * Its path should be longer when you are Telepat-hic and Blind.
- *
- * Interesting side effects:
- * - You can get rich by sending yourself a lot of mail and selling
- * it to the shopkeeper. Unfortunately mail isn't very valuable.
- * - You might die in case '2' comes along at a critical moment during
- * a fight and delivers a scroll the weight of which causes you to
- * collapse.
- *
- * Possible extensions:
- * - Open the file MAIL and do fstat instead of stat for efficiency.
- * (But sh uses stat, so this cannot be too bad.)
- * - Examine the mail and produce a scroll of mail called "From somebody".
- * - Invoke MAILREADER in such a way that only this single letter is read.
- *
- * - Make him lose his mail when a Nymph steals the letter.
- * - Do something to the text when the scroll is enchanted or cancelled.
- */
-#include "def.mkroom.h"
-static struct stat omstat,nmstat;
-static char *mailbox;
-static long laststattime;
-
-getmailstatus() {
- if(!(mailbox = getenv("MAIL")))
- return;
- if(stat(mailbox, &omstat)){
-#ifdef PERMANENT_MAILBOX
- pline("Cannot get status of MAIL=%s .", mailbox);
- mailbox = 0;
-#else
- omstat.st_mtime = 0;
-#endif /* PERMANENT_MAILBOX */
- }
-}
-
-ckmailstatus() {
- if(!mailbox
-#ifdef MAILCKFREQ
- || moves < laststattime + MAILCKFREQ
-#endif /* MAILCKFREQ */
- )
- return;
- laststattime = moves;
- if(stat(mailbox, &nmstat)){
-#ifdef PERMANENT_MAILBOX
- pline("Cannot get status of MAIL=%s anymore.", mailbox);
- mailbox = 0;
-#else
- nmstat.st_mtime = 0;
-#endif /* PERMANENT_MAILBOX */
- } else if(nmstat.st_mtime > omstat.st_mtime) {
- if(nmstat.st_size)
- newmail();
- getmailstatus(); /* might be too late ... */
- }
-}
-
-newmail() {
- /* produce a scroll of mail */
- struct obj *obj;
- struct monst *md;
- extern char plname[];
- extern struct obj *mksobj(), *addinv();
- extern struct monst *makemon();
- extern struct permonst pm_mail_daemon;
-
- obj = mksobj(SCR_MAIL);
- if(md = makemon(&pm_mail_daemon, u.ux, u.uy)) /* always succeeds */
- mdrush(md,0);
-
- pline("\"Hello, %s! I have some mail for you.\"", plname);
- if(md) {
- if(dist(md->mx,md->my) > 2)
- pline("\"Catch!\"");
- more();
-
- /* let him disappear again */
- mdrush(md,1);
- mondead(md);
- }
-
- obj = addinv(obj);
- (void) identify(obj); /* set known and do prinv() */
-}
-
-/* make md run through the cave */
-mdrush(md,away)
-struct monst *md;
-boolean away;
-{
- int uroom = inroom(u.ux, u.uy);
- if(uroom >= 0) {
- int tmp = rooms[uroom].fdoor;
- int cnt = rooms[uroom].doorct;
- int fx = u.ux, fy = u.uy;
- while(cnt--) {
- if(dist(fx,fy) < dist(doors[tmp].x, doors[tmp].y)){
- fx = doors[tmp].x;
- fy = doors[tmp].y;
- }
- tmp++;
- }
- tmp_at(-1, md->data->mlet); /* open call */
- if(away) { /* interchange origin and destination */
- unpmon(md);
- tmp = fx; fx = md->mx; md->mx = tmp;
- tmp = fy; fy = md->my; md->my = tmp;
- }
- while(fx != md->mx || fy != md->my) {
- int dx,dy,nfx = fx,nfy = fy,d1,d2;
-
- tmp_at(fx,fy);
- d1 = DIST(fx,fy,md->mx,md->my);
- for(dx = -1; dx <= 1; dx++) for(dy = -1; dy <= 1; dy++)
- if(dx || dy) {
- d2 = DIST(fx+dx,fy+dy,md->mx,md->my);
- if(d2 < d1) {
- d1 = d2;
- nfx = fx+dx;
- nfy = fy+dy;
- }
- }
- if(nfx != fx || nfy != fy) {
- fx = nfx;
- fy = nfy;
- } else {
- if(!away) {
- md->mx = fx;
- md->my = fy;
- }
- break;
- }
- }
- tmp_at(-1,-1); /* close call */
- }
- if(!away)
- pmon(md);
-}
-
-readmail() {
-#ifdef DEF_MAILREADER /* This implies that UNIX is defined */
- char *mr = 0;
- more();
- if(!(mr = getenv("MAILREADER")))
- mr = DEF_MAILREADER;
- if(child(1)){
- execl(mr, mr, (char *) 0);
- exit(1);
- }
-#else /* DEF_MAILREADER */
- (void) page_file(mailbox, FALSE);
-#endif /* DEF_MAILREADER */
- /* get new stat; not entirely correct: there is a small time
- window where we do not see new mail */
- getmailstatus();
-}
-#endif /* MAIL */
-
-regularize(s) /* normalize file name - we don't like ..'s or /'s */
-char *s;
-{
- char *lp;
-
- while((lp = index(s, '.')) || (lp = index(s, '/')))
- *lp = '_';
-}
diff --git a/games/hack/hack.vault.c b/games/hack/hack.vault.c
deleted file mode 100644
index b5cf932..0000000
--- a/games/hack/hack.vault.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.vault.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#ifdef QUEST
-setgd(/* mtmp */) /* struct monst *mtmp; */ {}
-gd_move() { return(2); }
-gddead(mtmp) struct monst *mtmp; {}
-replgd(mtmp,mtmp2) struct monst *mtmp, *mtmp2; {}
-invault(){}
-
-#else
-
-
-#include "def.mkroom.h"
-extern struct monst *makemon();
-#define FCSIZ (ROWNO+COLNO)
-struct fakecorridor {
- xchar fx,fy,ftyp;
-};
-
-struct egd {
- int fcbeg, fcend; /* fcend: first unused pos */
- xchar gdx, gdy; /* goal of guard's walk */
- unsigned gddone:1;
- struct fakecorridor fakecorr[FCSIZ];
-};
-
-static struct permonst pm_guard =
- { "guard", '@', 12, 12, -1, 4, 10, sizeof(struct egd) };
-
-static struct monst *guard;
-static int gdlevel;
-#define EGD ((struct egd *)(&(guard->mextra[0])))
-
-static
-restfakecorr()
-{
- int fcx,fcy,fcbeg;
- struct rm *crm;
-
- while((fcbeg = EGD->fcbeg) < EGD->fcend) {
- fcx = EGD->fakecorr[fcbeg].fx;
- fcy = EGD->fakecorr[fcbeg].fy;
- if((u.ux == fcx && u.uy == fcy) || cansee(fcx,fcy) ||
- m_at(fcx,fcy))
- return;
- crm = &levl[fcx][fcy];
- crm->typ = EGD->fakecorr[fcbeg].ftyp;
- if(!crm->typ) crm->seen = 0;
- newsym(fcx,fcy);
- EGD->fcbeg++;
- }
- /* it seems he left the corridor - let the guard disappear */
- mondead(guard);
- guard = 0;
-}
-
-static
-goldincorridor()
-{
- int fci;
-
- for(fci = EGD->fcbeg; fci < EGD->fcend; fci++)
- if(g_at(EGD->fakecorr[fci].fx, EGD->fakecorr[fci].fy))
- return(1);
- return(0);
-}
-
-setgd(){
-struct monst *mtmp;
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) if(mtmp->isgd){
- guard = mtmp;
- gdlevel = dlevel;
- return;
- }
- guard = 0;
-}
-
-invault(){
-int tmp = inroom(u.ux, u.uy);
- if(tmp < 0 || rooms[tmp].rtype != VAULT) {
- u.uinvault = 0;
- return;
- }
- if(++u.uinvault % 50 == 0 && (!guard || gdlevel != dlevel)) {
- char buf[BUFSZ];
- int x,y,dd,gx,gy;
-
- /* first find the goal for the guard */
- for(dd = 1; (dd < ROWNO || dd < COLNO); dd++) {
- for(y = u.uy-dd; y <= u.uy+dd; y++) {
- if(y < 0 || y > ROWNO-1) continue;
- for(x = u.ux-dd; x <= u.ux+dd; x++) {
- if(y != u.uy-dd && y != u.uy+dd && x != u.ux-dd)
- x = u.ux+dd;
- if(x < 0 || x > COLNO-1) continue;
- if(levl[x][y].typ == CORR) goto fnd;
- }
- }
- }
- impossible("Not a single corridor on this level??");
- tele();
- return;
-fnd:
- gx = x; gy = y;
-
- /* next find a good place for a door in the wall */
- x = u.ux; y = u.uy;
- while(levl[x][y].typ == ROOM) {
- int dx,dy;
-
- dx = (gx > x) ? 1 : (gx < x) ? -1 : 0;
- dy = (gy > y) ? 1 : (gy < y) ? -1 : 0;
- if(abs(gx-x) >= abs(gy-y))
- x += dx;
- else
- y += dy;
- }
-
- /* make something interesting happen */
- if(!(guard = makemon(&pm_guard,x,y))) return;
- guard->isgd = guard->mpeaceful = 1;
- EGD->gddone = 0;
- gdlevel = dlevel;
- if(!cansee(guard->mx, guard->my)) {
- mondead(guard);
- guard = 0;
- return;
- }
-
- pline("Suddenly one of the Vault's guards enters!");
- pmon(guard);
- do {
- pline("\"Hello stranger, who are you?\" - ");
- getlin(buf);
- } while (!letter(buf[0]));
-
- if(!strcmp(buf, "Croesus") || !strcmp(buf, "Kroisos")) {
- pline("\"Oh, yes - of course. Sorry to have disturbed you.\"");
- mondead(guard);
- guard = 0;
- return;
- }
- clrlin();
- pline("\"I don't know you.\"");
- if(!u.ugold)
- pline("\"Please follow me.\"");
- else {
- pline("\"Most likely all that gold was stolen from this vault.\"");
- pline("\"Please drop your gold (say d$ ) and follow me.\"");
- }
- EGD->gdx = gx;
- EGD->gdy = gy;
- EGD->fcbeg = 0;
- EGD->fakecorr[0].fx = x;
- EGD->fakecorr[0].fy = y;
- EGD->fakecorr[0].ftyp = levl[x][y].typ;
- levl[x][y].typ = DOOR;
- EGD->fcend = 1;
- }
-}
-
-gd_move(){
-int x,y,dx,dy,gx,gy,nx,ny,typ;
-struct fakecorridor *fcp;
-struct rm *crm;
- if(!guard || gdlevel != dlevel){
- impossible("Where is the guard?");
- return(2); /* died */
- }
- if(u.ugold || goldincorridor())
- return(0); /* didnt move */
- if(dist(guard->mx,guard->my) > 1 || EGD->gddone) {
- restfakecorr();
- return(0); /* didnt move */
- }
- x = guard->mx;
- y = guard->my;
- /* look around (hor & vert only) for accessible places */
- for(nx = x-1; nx <= x+1; nx++) for(ny = y-1; ny <= y+1; ny++) {
- if(nx == x || ny == y) if(nx != x || ny != y)
- if(isok(nx,ny))
- if(!IS_WALL(typ = (crm = &levl[nx][ny])->typ) && typ != POOL) {
- int i;
- for(i = EGD->fcbeg; i < EGD->fcend; i++)
- if(EGD->fakecorr[i].fx == nx &&
- EGD->fakecorr[i].fy == ny)
- goto nextnxy;
- if((i = inroom(nx,ny)) >= 0 && rooms[i].rtype == VAULT)
- goto nextnxy;
- /* seems we found a good place to leave him alone */
- EGD->gddone = 1;
- if(ACCESSIBLE(typ)) goto newpos;
- crm->typ = (typ == SCORR) ? CORR : DOOR;
- goto proceed;
- }
- nextnxy: ;
- }
- nx = x;
- ny = y;
- gx = EGD->gdx;
- gy = EGD->gdy;
- dx = (gx > x) ? 1 : (gx < x) ? -1 : 0;
- dy = (gy > y) ? 1 : (gy < y) ? -1 : 0;
- if(abs(gx-x) >= abs(gy-y)) nx += dx; else ny += dy;
-
- while((typ = (crm = &levl[nx][ny])->typ) != 0) {
- /* in view of the above we must have IS_WALL(typ) or typ == POOL */
- /* must be a wall here */
- if(isok(nx+nx-x,ny+ny-y) && typ != POOL &&
- ZAP_POS(levl[nx+nx-x][ny+ny-y].typ)){
- crm->typ = DOOR;
- goto proceed;
- }
- if(dy && nx != x) {
- nx = x; ny = y+dy;
- continue;
- }
- if(dx && ny != y) {
- ny = y; nx = x+dx; dy = 0;
- continue;
- }
- /* I don't like this, but ... */
- crm->typ = DOOR;
- goto proceed;
- }
- crm->typ = CORR;
-proceed:
- if(cansee(nx,ny)) {
- mnewsym(nx,ny);
- prl(nx,ny);
- }
- fcp = &(EGD->fakecorr[EGD->fcend]);
- if(EGD->fcend++ == FCSIZ) panic("fakecorr overflow");
- fcp->fx = nx;
- fcp->fy = ny;
- fcp->ftyp = typ;
-newpos:
- if(EGD->gddone) nx = ny = 0;
- guard->mx = nx;
- guard->my = ny;
- pmon(guard);
- restfakecorr();
- return(1);
-}
-
-gddead(){
- guard = 0;
-}
-
-replgd(mtmp,mtmp2)
-struct monst *mtmp, *mtmp2;
-{
- if(mtmp == guard)
- guard = mtmp2;
-}
-
-#endif /* QUEST */
diff --git a/games/hack/hack.version.c b/games/hack/hack.version.c
deleted file mode 100644
index a6744d1..0000000
--- a/games/hack/hack.version.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.version.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "date.h"
-
-doversion(){
- pline("%s 1.0.3 - last edit %s.", (
-#ifdef QUEST
- "Quest"
-#else
- "Hack"
-#endif /* QUEST */
- ), datestring);
- return(0);
-}
diff --git a/games/hack/hack.wield.c b/games/hack/hack.wield.c
deleted file mode 100644
index 7533de6..0000000
--- a/games/hack/hack.wield.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.wield.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-extern struct obj zeroobj;
-
-setuwep(obj) struct obj *obj; {
- setworn(obj, W_WEP);
-}
-
-dowield()
-{
- struct obj *wep;
- int res = 0;
-
- multi = 0;
- if(!(wep = getobj("#-)", "wield"))) /* nothing */;
- else if(uwep == wep)
- pline("You are already wielding that!");
- else if(uwep && uwep->cursed)
- pline("The %s welded to your hand!",
- aobjnam(uwep, "are"));
- else if(wep == &zeroobj) {
- if(uwep == 0){
- pline("You are already empty handed.");
- } else {
- setuwep((struct obj *) 0);
- res++;
- pline("You are empty handed.");
- }
- } else if(uarms && wep->otyp == TWO_HANDED_SWORD)
- pline("You cannot wield a two-handed sword and wear a shield.");
- else if(wep->owornmask & (W_ARMOR | W_RING))
- pline("You cannot wield that!");
- else {
- setuwep(wep);
- res++;
- if(uwep->cursed)
- pline("The %s %s to your hand!",
- aobjnam(uwep, "weld"),
- (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */
- else prinv(uwep);
- }
- return(res);
-}
-
-corrode_weapon(){
- if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */
- if(uwep->rustfree)
- pline("Your %s not affected.", aobjnam(uwep, "are"));
- else {
- pline("Your %s!", aobjnam(uwep, "corrode"));
- uwep->spe--;
- }
-}
-
-chwepon(otmp,amount)
-struct obj *otmp;
-int amount;
-{
-char *color = (amount < 0) ? "black" : "green";
-char *time;
- if(!uwep || uwep->olet != WEAPON_SYM) {
- strange_feeling(otmp,
- (amount > 0) ? "Your hands twitch."
- : "Your hands itch.");
- return(0);
- }
-
- if(uwep->otyp == WORM_TOOTH && amount > 0) {
- uwep->otyp = CRYSKNIFE;
- pline("Your weapon seems sharper now.");
- uwep->cursed = 0;
- return(1);
- }
-
- if(uwep->otyp == CRYSKNIFE && amount < 0) {
- uwep->otyp = WORM_TOOTH;
- pline("Your weapon looks duller now.");
- return(1);
- }
-
- /* there is a (soft) upper limit to uwep->spe */
- if(amount > 0 && uwep->spe > 5 && rn2(3)) {
- pline("Your %s violently green for a while and then evaporate%s.",
- aobjnam(uwep, "glow"), plur(uwep->quan));
- while(uwep) /* let all of them disappear */
- /* note: uwep->quan = 1 is nogood if unpaid */
- useup(uwep);
- return(1);
- }
- if(!rn2(6)) amount *= 2;
- time = (amount*amount == 1) ? "moment" : "while";
- pline("Your %s %s for a %s.",
- aobjnam(uwep, "glow"), color, time);
- uwep->spe += amount;
- if(amount > 0) uwep->cursed = 0;
- return(1);
-}
diff --git a/games/hack/hack.wizard.c b/games/hack/hack.wizard.c
deleted file mode 100644
index 2065475..0000000
--- a/games/hack/hack.wizard.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.wizard.c - version 1.0.3 */
-
-/* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "hack.h"
-extern struct permonst pm_wizard;
-extern struct monst *makemon();
-
-#define WIZSHOT 6 /* one chance in WIZSHOT that wizard will try magic */
-#define BOLT_LIM 8 /* from this distance D and 1 will try to hit you */
-
-char wizapp[] = "@DNPTUVXcemntx";
-
-/* If he has found the Amulet, make the wizard appear after some time */
-amulet(){
- struct obj *otmp;
- struct monst *mtmp;
-
- if(!flags.made_amulet || !flags.no_of_wizards)
- return;
- /* find wizard, and wake him if necessary */
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
- if(mtmp->data->mlet == '1' && mtmp->msleep && !rn2(40))
- for(otmp = invent; otmp; otmp = otmp->nobj)
- if(otmp->olet == AMULET_SYM && !otmp->spe) {
- mtmp->msleep = 0;
- if(dist(mtmp->mx,mtmp->my) > 2)
- pline(
- "You get the creepy feeling that somebody noticed your taking the Amulet."
- );
- return;
- }
-}
-
-wiz_hit(mtmp)
-struct monst *mtmp;
-{
- /* if we have stolen or found the amulet, we disappear */
- if(mtmp->minvent && mtmp->minvent->olet == AMULET_SYM &&
- mtmp->minvent->spe == 0) {
- /* vanish -- very primitive */
- fall_down(mtmp);
- return(1);
- }
-
- /* if it is lying around someplace, we teleport to it */
- if(!carrying(AMULET_OF_YENDOR)) {
- struct obj *otmp;
-
- for(otmp = fobj; otmp; otmp = otmp->nobj)
- if(otmp->olet == AMULET_SYM && !otmp->spe) {
- if((u.ux != otmp->ox || u.uy != otmp->oy) &&
- !m_at(otmp->ox, otmp->oy)) {
-
- /* teleport to it and pick it up */
- mtmp->mx = otmp->ox;
- mtmp->my = otmp->oy;
- freeobj(otmp);
- mpickobj(mtmp, otmp);
- pmon(mtmp);
- return(0);
- }
- goto hithim;
- }
- return(0); /* we don't know where it is */
- }
-hithim:
- if(rn2(2)) { /* hit - perhaps steal */
-
- /* if hit 1/20 chance of stealing amulet & vanish
- - amulet is on level 26 again. */
- if(hitu(mtmp, d(mtmp->data->damn,mtmp->data->damd))
- && !rn2(20) && stealamulet(mtmp))
- ;
- }
- else
- inrange(mtmp); /* try magic */
- return(0);
-}
-
-inrange(mtmp)
-struct monst *mtmp;
-{
- schar tx,ty;
-
- /* do nothing if cancelled (but make '1' say something) */
- if(mtmp->data->mlet != '1' && mtmp->mcan)
- return;
-
- /* spit fire only when both in a room or both in a corridor */
- if(inroom(u.ux,u.uy) != inroom(mtmp->mx,mtmp->my)) return;
- tx = u.ux - mtmp->mx;
- ty = u.uy - mtmp->my;
- if((!tx && abs(ty) < BOLT_LIM) || (!ty && abs(tx) < BOLT_LIM)
- || (abs(tx) == abs(ty) && abs(tx) < BOLT_LIM)){
- switch(mtmp->data->mlet) {
- case 'D':
- /* spit fire in the direction of @ (not nec. hitting) */
- buzz(-1,mtmp->mx,mtmp->my,sgn(tx),sgn(ty));
- break;
- case '1':
- if(rn2(WIZSHOT)) break;
- /* if you zapped wizard with wand of cancellation,
- he has to shake off the effects before he can throw
- spells successfully. 1/2 the time they fail anyway */
- if(mtmp->mcan || rn2(2)) {
- if(canseemon(mtmp))
- pline("%s makes a gesture, then curses.",
- Monnam(mtmp));
- else
- pline("You hear mumbled cursing.");
- if(!rn2(3)) {
- mtmp->mspeed = 0;
- mtmp->minvis = 0;
- }
- if(!rn2(3))
- mtmp->mcan = 0;
- } else {
- if(canseemon(mtmp)){
- if(!rn2(6) && !Invis) {
- pline("%s hypnotizes you.", Monnam(mtmp));
- nomul(rn2(3) + 3);
- break;
- } else
- pline("%s chants an incantation.",
- Monnam(mtmp));
- } else
- pline("You hear a mumbled incantation.");
- switch(rn2(Invis ? 5 : 6)) {
- case 0:
- /* create a nasty monster from a deep level */
- /* (for the moment, 'nasty' is not implemented) */
- (void) makemon((struct permonst *)0, u.ux, u.uy);
- break;
- case 1:
- pline("\"Destroy the thief, my pets!\"");
- aggravate(); /* aggravate all the monsters */
- /* FALLTHROUGH */
- case 2:
- if (flags.no_of_wizards == 1 && rnd(5) == 0)
- /* if only 1 wizard, clone himself */
- clonewiz(mtmp);
- break;
- case 3:
- if(mtmp->mspeed == MSLOW)
- mtmp->mspeed = 0;
- else
- mtmp->mspeed = MFAST;
- break;
- case 4:
- mtmp->minvis = 1;
- break;
- case 5:
- /* Only if not Invisible */
- pline("You hear a clap of thunder!");
- /* shoot a bolt of fire or cold, or a sleep ray */
- buzz(-rnd(3),mtmp->mx,mtmp->my,sgn(tx),sgn(ty));
- break;
- }
- }
- }
- if(u.uhp < 1) done_in_by(mtmp);
- }
-}
-
-aggravate()
-{
- struct monst *mtmp;
-
- for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
- mtmp->msleep = 0;
- if(mtmp->mfroz && !rn2(5))
- mtmp->mfroz = 0;
- }
-}
-
-clonewiz(mtmp)
-struct monst *mtmp;
-{
- struct monst *mtmp2;
-
- if(mtmp2 = makemon(PM_WIZARD, mtmp->mx, mtmp->my)) {
- flags.no_of_wizards = 2;
- unpmon(mtmp2);
- mtmp2->mappearance = wizapp[rn2(sizeof(wizapp)-1)];
- pmon(mtmp);
- }
-}
diff --git a/games/hack/hack.worm.c b/games/hack/hack.worm.c
deleted file mode 100644
index 81c0c06..0000000
--- a/games/hack/hack.worm.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.worm.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-#ifndef NOWORM
-#include "def.wseg.h"
-
-struct wseg *wsegs[32]; /* linked list, tail first */
-struct wseg *wheads[32];
-long wgrowtime[32];
-
-getwn(mtmp) struct monst *mtmp; {
-int tmp;
- for(tmp=1; tmp<32; tmp++) if(!wsegs[tmp]) {
- mtmp->wormno = tmp;
- return(1);
- }
- return(0); /* level infested with worms */
-}
-
-/* called to initialize a worm unless cut in half */
-initworm(mtmp) struct monst *mtmp; {
-struct wseg *wtmp;
-int tmp = mtmp->wormno;
- if(!tmp) return;
- wheads[tmp] = wsegs[tmp] = wtmp = newseg();
- wgrowtime[tmp] = 0;
- wtmp->wx = mtmp->mx;
- wtmp->wy = mtmp->my;
-/* wtmp->wdispl = 0; */
- wtmp->nseg = 0;
-}
-
-worm_move(mtmp) struct monst *mtmp; {
-struct wseg *wtmp, *whd;
-int tmp = mtmp->wormno;
- wtmp = newseg();
- wtmp->wx = mtmp->mx;
- wtmp->wy = mtmp->my;
- wtmp->nseg = 0;
-/* wtmp->wdispl = 0; */
- (whd = wheads[tmp])->nseg = wtmp;
- wheads[tmp] = wtmp;
- if(cansee(whd->wx,whd->wy)){
- unpmon(mtmp);
- atl(whd->wx, whd->wy, '~');
- whd->wdispl = 1;
- } else whd->wdispl = 0;
- if(wgrowtime[tmp] <= moves) {
- if(!wgrowtime[tmp]) wgrowtime[tmp] = moves + rnd(5);
- else wgrowtime[tmp] += 2+rnd(15);
- mtmp->mhpmax += 3;
- mtmp->mhp += 3;
- return;
- }
- whd = wsegs[tmp];
- wsegs[tmp] = whd->nseg;
- remseg(whd);
-}
-
-worm_nomove(mtmp) struct monst *mtmp; {
-int tmp;
-struct wseg *wtmp;
- tmp = mtmp->wormno;
- wtmp = wsegs[tmp];
- if(wtmp == wheads[tmp]) return;
- if(wtmp == 0 || wtmp->nseg == 0) panic("worm_nomove?");
- wsegs[tmp] = wtmp->nseg;
- remseg(wtmp);
- mtmp->mhp -= 3; /* mhpmax not changed ! */
-}
-
-wormdead(mtmp) struct monst *mtmp; {
-int tmp = mtmp->wormno;
-struct wseg *wtmp, *wtmp2;
- if(!tmp) return;
- mtmp->wormno = 0;
- for(wtmp = wsegs[tmp]; wtmp; wtmp = wtmp2){
- wtmp2 = wtmp->nseg;
- remseg(wtmp);
- }
- wsegs[tmp] = 0;
-}
-
-wormhit(mtmp) struct monst *mtmp; {
-int tmp = mtmp->wormno;
-struct wseg *wtmp;
- if(!tmp) return; /* worm without tail */
- for(wtmp = wsegs[tmp]; wtmp; wtmp = wtmp->nseg)
- (void) hitu(mtmp,1);
-}
-
-wormsee(tmp) unsigned tmp; {
-struct wseg *wtmp = wsegs[tmp];
- if(!wtmp) panic("wormsee: wtmp==0");
- for(; wtmp->nseg; wtmp = wtmp->nseg)
- if(!cansee(wtmp->wx,wtmp->wy) && wtmp->wdispl){
- newsym(wtmp->wx, wtmp->wy);
- wtmp->wdispl = 0;
- }
-}
-
-pwseg(wtmp) struct wseg *wtmp; {
- if(!wtmp->wdispl){
- atl(wtmp->wx, wtmp->wy, '~');
- wtmp->wdispl = 1;
- }
-}
-
-cutworm(mtmp,x,y,weptyp)
-struct monst *mtmp;
-xchar x,y;
-uchar weptyp; /* uwep->otyp or 0 */
-{
- struct wseg *wtmp, *wtmp2;
- struct monst *mtmp2;
- int tmp,tmp2;
- if(mtmp->mx == x && mtmp->my == y) return; /* hit headon */
-
- /* cutting goes best with axe or sword */
- tmp = rnd(20);
- if(weptyp == LONG_SWORD || weptyp == TWO_HANDED_SWORD ||
- weptyp == AXE) tmp += 5;
- if(tmp < 12) return;
-
- /* if tail then worm just loses a tail segment */
- tmp = mtmp->wormno;
- wtmp = wsegs[tmp];
- if(wtmp->wx == x && wtmp->wy == y){
- wsegs[tmp] = wtmp->nseg;
- remseg(wtmp);
- return;
- }
-
- /* cut the worm in two halves */
- mtmp2 = newmonst(0);
- *mtmp2 = *mtmp;
- mtmp2->mxlth = mtmp2->mnamelth = 0;
-
- /* sometimes the tail end dies */
- if(rn2(3) || !getwn(mtmp2)){
- monfree(mtmp2);
- tmp2 = 0;
- } else {
- tmp2 = mtmp2->wormno;
- wsegs[tmp2] = wsegs[tmp];
- wgrowtime[tmp2] = 0;
- }
- do {
- if(wtmp->nseg->wx == x && wtmp->nseg->wy == y){
- if(tmp2) wheads[tmp2] = wtmp;
- wsegs[tmp] = wtmp->nseg->nseg;
- remseg(wtmp->nseg);
- wtmp->nseg = 0;
- if(tmp2){
- pline("You cut the worm in half.");
- mtmp2->mhpmax = mtmp2->mhp =
- d(mtmp2->data->mlevel, 8);
- mtmp2->mx = wtmp->wx;
- mtmp2->my = wtmp->wy;
- mtmp2->nmon = fmon;
- fmon = mtmp2;
- pmon(mtmp2);
- } else {
- pline("You cut off part of the worm's tail.");
- remseg(wtmp);
- }
- mtmp->mhp /= 2;
- return;
- }
- wtmp2 = wtmp->nseg;
- if(!tmp2) remseg(wtmp);
- wtmp = wtmp2;
- } while(wtmp->nseg);
- panic("Cannot find worm segment");
-}
-
-remseg(wtmp) struct wseg *wtmp; {
- if(wtmp->wdispl)
- newsym(wtmp->wx, wtmp->wy);
- free((char *) wtmp);
-}
-#endif /* NOWORM */
diff --git a/games/hack/hack.worn.c b/games/hack/hack.worn.c
deleted file mode 100644
index f4ae772..0000000
--- a/games/hack/hack.worn.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.worn.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-struct worn {
- long w_mask;
- struct obj **w_obj;
-} worn[] = {
- { W_ARM, &uarm },
- { W_ARM2, &uarm2 },
- { W_ARMH, &uarmh },
- { W_ARMS, &uarms },
- { W_ARMG, &uarmg },
- { W_RINGL, &uleft },
- { W_RINGR, &uright },
- { W_WEP, &uwep },
- { W_BALL, &uball },
- { W_CHAIN, &uchain },
- { 0, 0 }
-};
-
-setworn(obj, mask)
-struct obj *obj;
-long mask;
-{
- struct worn *wp;
- struct obj *oobj;
-
- for(wp = worn; wp->w_mask; wp++) if(wp->w_mask & mask) {
- oobj = *(wp->w_obj);
- if(oobj && !(oobj->owornmask & wp->w_mask))
- impossible("Setworn: mask = %ld.", wp->w_mask);
- if(oobj) oobj->owornmask &= ~wp->w_mask;
- if(obj && oobj && wp->w_mask == W_ARM){
- if(uarm2) {
- impossible("Setworn: uarm2 set?");
- } else
- setworn(uarm, W_ARM2);
- }
- *(wp->w_obj) = obj;
- if(obj) obj->owornmask |= wp->w_mask;
- }
- if(uarm2 && !uarm) {
- uarm = uarm2;
- uarm2 = 0;
- uarm->owornmask ^= (W_ARM | W_ARM2);
- }
-}
-
-/* called e.g. when obj is destroyed */
-setnotworn(obj) struct obj *obj; {
- struct worn *wp;
-
- for(wp = worn; wp->w_mask; wp++)
- if(obj == *(wp->w_obj)) {
- *(wp->w_obj) = 0;
- obj->owornmask &= ~wp->w_mask;
- }
- if(uarm2 && !uarm) {
- uarm = uarm2;
- uarm2 = 0;
- uarm->owornmask ^= (W_ARM | W_ARM2);
- }
-}
diff --git a/games/hack/hack.zap.c b/games/hack/hack.zap.c
deleted file mode 100644
index fd16b3a..0000000
--- a/games/hack/hack.zap.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* hack.zap.c - version 1.0.3 */
-/* $FreeBSD$ */
-
-#include "hack.h"
-
-extern struct obj *mkobj_at();
-extern struct monst *makemon(), *mkmon_at(), youmonst;
-struct monst *bhit();
-char *exclam();
-
-char *fl[]= {
- "magic missile",
- "bolt of fire",
- "sleep ray",
- "bolt of cold",
- "death ray"
-};
-
-/* Routines for IMMEDIATE wands. */
-/* bhitm: monster mtmp was hit by the effect of wand otmp */
-bhitm(mtmp, otmp)
-struct monst *mtmp;
-struct obj *otmp;
-{
- wakeup(mtmp);
- switch(otmp->otyp) {
- case WAN_STRIKING:
- if(u.uswallow || rnd(20) < 10+mtmp->data->ac) {
- int tmp = d(2,12);
- hit("wand", mtmp, exclam(tmp));
- mtmp->mhp -= tmp;
- if(mtmp->mhp < 1) killed(mtmp);
- } else miss("wand", mtmp);
- break;
- case WAN_SLOW_MONSTER:
- mtmp->mspeed = MSLOW;
- break;
- case WAN_SPEED_MONSTER:
- mtmp->mspeed = MFAST;
- break;
- case WAN_UNDEAD_TURNING:
- if(index(UNDEAD,mtmp->data->mlet)) {
- mtmp->mhp -= rnd(8);
- if(mtmp->mhp < 1) killed(mtmp);
- else mtmp->mflee = 1;
- }
- break;
- case WAN_POLYMORPH:
- if( newcham(mtmp,&mons[rn2(CMNUM)]) )
- objects[otmp->otyp].oc_name_known = 1;
- break;
- case WAN_CANCELLATION:
- mtmp->mcan = 1;
- break;
- case WAN_TELEPORTATION:
- rloc(mtmp);
- break;
- case WAN_MAKE_INVISIBLE:
- mtmp->minvis = 1;
- break;
-#ifdef WAN_PROBING
- case WAN_PROBING:
- mstatusline(mtmp);
- break;
-#endif /* WAN_PROBING */
- default:
- impossible("What an interesting wand (%u)", otmp->otyp);
- }
-}
-
-bhito(obj, otmp) /* object obj was hit by the effect of wand otmp */
-struct obj *obj, *otmp; /* returns TRUE if sth was done */
-{
- int res = TRUE;
-
- if(obj == uball || obj == uchain)
- res = FALSE;
- else
- switch(otmp->otyp) {
- case WAN_POLYMORPH:
- /* preserve symbol and quantity, but turn rocks into gems */
- mkobj_at((obj->otyp == ROCK || obj->otyp == ENORMOUS_ROCK)
- ? GEM_SYM : obj->olet,
- obj->ox, obj->oy) -> quan = obj->quan;
- delobj(obj);
- break;
- case WAN_STRIKING:
- if(obj->otyp == ENORMOUS_ROCK)
- fracture_rock(obj);
- else
- res = FALSE;
- break;
- case WAN_CANCELLATION:
- if(obj->spe && obj->olet != AMULET_SYM) {
- obj->known = 0;
- obj->spe = 0;
- }
- break;
- case WAN_TELEPORTATION:
- rloco(obj);
- break;
- case WAN_MAKE_INVISIBLE:
- obj->oinvis = 1;
- break;
- case WAN_UNDEAD_TURNING:
- res = revive(obj);
- break;
- case WAN_SLOW_MONSTER: /* no effect on objects */
- case WAN_SPEED_MONSTER:
-#ifdef WAN_PROBING
- case WAN_PROBING:
-#endif /* WAN_PROBING */
- res = FALSE;
- break;
- default:
- impossible("What an interesting wand (%u)", otmp->otyp);
- }
- return(res);
-}
-
-dozap()
-{
- struct obj *obj;
- xchar zx,zy;
-
- obj = getobj("/", "zap");
- if(!obj) return(0);
- if(obj->spe < 0 || (obj->spe == 0 && rn2(121))) {
- pline("Nothing Happens.");
- return(1);
- }
- if(obj->spe == 0)
- pline("You wrest one more spell from the worn-out wand.");
- if(!(objects[obj->otyp].bits & NODIR) && !getdir(1))
- return(1); /* make him pay for knowing !NODIR */
- obj->spe--;
- if(objects[obj->otyp].bits & IMMEDIATE) {
- if(u.uswallow)
- bhitm(u.ustuck, obj);
- else if(u.dz) {
- if(u.dz > 0) {
- struct obj *otmp = o_at(u.ux, u.uy);
- if(otmp)
- (void) bhito(otmp, obj);
- }
- } else
- (void) bhit(u.dx,u.dy,rn1(8,6),0,bhitm,bhito,obj);
- } else {
- switch(obj->otyp){
- case WAN_LIGHT:
- litroom(TRUE);
- break;
- case WAN_SECRET_DOOR_DETECTION:
- if(!findit()) return(1);
- break;
- case WAN_CREATE_MONSTER:
- { int cnt = 1;
- if(!rn2(23)) cnt += rn2(7) + 1;
- while(cnt--)
- (void) makemon((struct permonst *) 0, u.ux, u.uy);
- }
- break;
- case WAN_WISHING:
- { char buf[BUFSZ];
- struct obj *otmp;
- extern struct obj *readobjnam(), *addinv();
- if(u.uluck + rn2(5) < 0) {
- pline("Unfortunately, nothing happens.");
- break;
- }
- pline("You may wish for an object. What do you want? ");
- getlin(buf);
- if(buf[0] == '\033') buf[0] = 0;
- otmp = readobjnam(buf);
- otmp = addinv(otmp);
- prinv(otmp);
- break;
- }
- case WAN_DIGGING:
- /* Original effect (approximately):
- * from CORR: dig until we pierce a wall
- * from ROOM: piece wall and dig until we reach
- * an ACCESSIBLE place.
- * Currently: dig for digdepth positions;
- * also down on request of Lennart Augustsson.
- */
- { struct rm *room;
- int digdepth;
- if(u.uswallow) {
- struct monst *mtmp = u.ustuck;
-
- pline("You pierce %s's stomach wall!",
- monnam(mtmp));
- mtmp->mhp = 1; /* almost dead */
- unstuck(mtmp);
- mnexto(mtmp);
- break;
- }
- if(u.dz) {
- if(u.dz < 0) {
- pline("You loosen a rock from the ceiling.");
- pline("It falls on your head!");
- losehp(1, "falling rock");
- mksobj_at(ROCK, u.ux, u.uy);
- fobj->quan = 1;
- stackobj(fobj);
- if(Invisible) newsym(u.ux, u.uy);
- } else {
- dighole();
- }
- break;
- }
- zx = u.ux+u.dx;
- zy = u.uy+u.dy;
- digdepth = 8 + rn2(18);
- Tmp_at(-1, '*'); /* open call */
- while(--digdepth >= 0) {
- if(!isok(zx,zy)) break;
- room = &levl[zx][zy];
- Tmp_at(zx,zy);
- if(!xdnstair){
- if(zx < 3 || zx > COLNO-3 ||
- zy < 3 || zy > ROWNO-3)
- break;
- if(room->typ == HWALL ||
- room->typ == VWALL){
- room->typ = ROOM;
- break;
- }
- } else
- if(room->typ == HWALL || room->typ == VWALL ||
- room->typ == SDOOR || room->typ == LDOOR){
- room->typ = DOOR;
- digdepth -= 2;
- } else
- if(room->typ == SCORR || !room->typ) {
- room->typ = CORR;
- digdepth--;
- }
- mnewsym(zx,zy);
- zx += u.dx;
- zy += u.dy;
- }
- mnewsym(zx,zy); /* not always necessary */
- Tmp_at(-1,-1); /* closing call */
- break;
- }
- default:
- buzz((int) obj->otyp - WAN_MAGIC_MISSILE,
- u.ux, u.uy, u.dx, u.dy);
- break;
- }
- if(!objects[obj->otyp].oc_name_known) {
- objects[obj->otyp].oc_name_known = 1;
- more_experienced(0,10);
- }
- }
- return(1);
-}
-
-char *
-exclam(force)
-int force;
-{
- /* force == 0 occurs e.g. with sleep ray */
- /* note that large force is usual with wands so that !! would
- require information about hand/weapon/wand */
- return( (force < 0) ? "?" : (force <= 4) ? "." : "!" );
-}
-
-hit(str,mtmp,force)
-char *str;
-struct monst *mtmp;
-char *force; /* usually either "." or "!" */
-{
- if(!cansee(mtmp->mx,mtmp->my)) pline("The %s hits it.", str);
- else pline("The %s hits %s%s", str, monnam(mtmp), force);
-}
-
-miss(str,mtmp)
-char *str;
-struct monst *mtmp;
-{
- if(!cansee(mtmp->mx,mtmp->my)) pline("The %s misses it.",str);
- else pline("The %s misses %s.",str,monnam(mtmp));
-}
-
-/* bhit: called when a weapon is thrown (sym = obj->olet) or when an
- IMMEDIATE wand is zapped (sym = 0); the weapon falls down at end of
- range or when a monster is hit; the monster is returned, and bhitpos
- is set to the final position of the weapon thrown; the ray of a wand
- may affect several objects and monsters on its path - for each of
- these an argument function is called. */
-/* check !u.uswallow before calling bhit() */
-
-struct monst *
-bhit(ddx,ddy,range,sym,fhitm,fhito,obj)
-int ddx,ddy,range; /* direction and range */
-char sym; /* symbol displayed on path */
-int (*fhitm)(), (*fhito)(); /* fns called when mon/obj hit */
-struct obj *obj; /* 2nd arg to fhitm/fhito */
-{
- struct monst *mtmp;
- struct obj *otmp;
- int typ;
-
- bhitpos.x = u.ux;
- bhitpos.y = u.uy;
-
- if(sym) tmp_at(-1, sym); /* open call */
- while(range-- > 0) {
- bhitpos.x += ddx;
- bhitpos.y += ddy;
- typ = levl[bhitpos.x][bhitpos.y].typ;
- if(mtmp = m_at(bhitpos.x,bhitpos.y)){
- if(sym) {
- tmp_at(-1, -1); /* close call */
- return(mtmp);
- }
- (*fhitm)(mtmp, obj);
- range -= 3;
- }
- if(fhito && (otmp = o_at(bhitpos.x,bhitpos.y))){
- if((*fhito)(otmp, obj))
- range--;
- }
- if(!ZAP_POS(typ)) {
- bhitpos.x -= ddx;
- bhitpos.y -= ddy;
- break;
- }
- if(sym) tmp_at(bhitpos.x, bhitpos.y);
- }
-
- /* leave last symbol unless in a pool */
- if(sym)
- tmp_at(-1, (levl[bhitpos.x][bhitpos.y].typ == POOL) ? -1 : 0);
- return(0);
-}
-
-struct monst *
-boomhit(dx,dy) {
- int i, ct;
- struct monst *mtmp;
- char sym = ')';
- extern schar xdir[], ydir[];
-
- bhitpos.x = u.ux;
- bhitpos.y = u.uy;
-
- for(i=0; i<8; i++) if(xdir[i] == dx && ydir[i] == dy) break;
- tmp_at(-1, sym); /* open call */
- for(ct=0; ct<10; ct++) {
- if(i == 8) i = 0;
- sym = ')' + '(' - sym;
- tmp_at(-2, sym); /* change let call */
- dx = xdir[i];
- dy = ydir[i];
- bhitpos.x += dx;
- bhitpos.y += dy;
- if(mtmp = m_at(bhitpos.x, bhitpos.y)){
- tmp_at(-1,-1);
- return(mtmp);
- }
- if(!ZAP_POS(levl[bhitpos.x][bhitpos.y].typ)) {
- bhitpos.x -= dx;
- bhitpos.y -= dy;
- break;
- }
- if(bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */
- if(rn2(20) >= 10+u.ulevel){ /* we hit ourselves */
- (void) thitu(10, rnd(10), "boomerang");
- break;
- } else { /* we catch it */
- tmp_at(-1,-1);
- pline("Skillfully, you catch the boomerang.");
- return(&youmonst);
- }
- }
- tmp_at(bhitpos.x, bhitpos.y);
- if(ct % 5 != 0) i++;
- }
- tmp_at(-1, -1); /* do not leave last symbol */
- return(0);
-}
-
-char
-dirlet(dx,dy) int dx,dy; {
- return
- (dx == dy) ? '\\' : (dx && dy) ? '/' : dx ? '-' : '|';
-}
-
-/* type == -1: monster spitting fire at you */
-/* type == -1,-2,-3: bolts sent out by wizard */
-/* called with dx = dy = 0 with vertical bolts */
-buzz(type,sx,sy,dx,dy)
-int type;
-xchar sx,sy;
-int dx,dy;
-{
- int abstype = abs(type);
- char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype];
- struct rm *lev;
- xchar range;
- struct monst *mon;
-
- if(u.uswallow) {
- int tmp;
-
- if(type < 0) return;
- tmp = zhit(u.ustuck, type);
- pline("The %s rips into %s%s",
- fltxt, monnam(u.ustuck), exclam(tmp));
- return;
- }
- if(type < 0) pru();
- range = rn1(7,7);
- Tmp_at(-1, dirlet(dx,dy)); /* open call */
- while(range-- > 0) {
- sx += dx;
- sy += dy;
- if((lev = &levl[sx][sy])->typ) Tmp_at(sx,sy);
- else {
- int bounce = 0;
- if(cansee(sx-dx,sy-dy))
- pline("The %s bounces!", fltxt);
- if(ZAP_POS(levl[sx][sy-dy].typ))
- bounce = 1;
- if(ZAP_POS(levl[sx-dx][sy].typ)) {
- if(!bounce || rn2(2)) bounce = 2;
- }
- switch(bounce){
- case 0:
- dx = -dx;
- dy = -dy;
- continue;
- case 1:
- dy = -dy;
- sx -= dx;
- break;
- case 2:
- dx = -dx;
- sy -= dy;
- break;
- }
- Tmp_at(-2,dirlet(dx,dy));
- continue;
- }
- if(lev->typ == POOL && abstype == 1 /* fire */) {
- range -= 3;
- lev->typ = ROOM;
- if(cansee(sx,sy)) {
- mnewsym(sx,sy);
- pline("The water evaporates.");
- } else
- pline("You hear a hissing sound.");
- }
- if((mon = m_at(sx,sy)) &&
- (type != -1 || mon->data->mlet != 'D')) {
- wakeup(mon);
- if(rnd(20) < 18 + mon->data->ac) {
- int tmp = zhit(mon,abstype);
- if(mon->mhp < 1) {
- if(type < 0) {
- if(cansee(mon->mx,mon->my))
- pline("%s is killed by the %s!",
- Monnam(mon), fltxt);
- mondied(mon);
- } else
- killed(mon);
- } else
- hit(fltxt, mon, exclam(tmp));
- range -= 2;
- } else
- miss(fltxt,mon);
- } else if(sx == u.ux && sy == u.uy) {
- nomul(0);
- if(rnd(20) < 18+u.uac) {
- int dam = 0;
- range -= 2;
- pline("The %s hits you!",fltxt);
- switch(abstype) {
- case 0:
- dam = d(2,6);
- break;
- case 1:
- if(Fire_resistance)
- pline("You don't feel hot!");
- else dam = d(6,6);
- if(!rn2(3))
- burn_scrolls();
- break;
- case 2:
- nomul(-rnd(25)); /* sleep ray */
- break;
- case 3:
- if(Cold_resistance)
- pline("You don't feel cold!");
- else dam = d(6,6);
- break;
- case 4:
- u.uhp = -1;
- }
- losehp(dam,fltxt);
- } else pline("The %s whizzes by you!",fltxt);
- stop_occupation();
- }
- if(!ZAP_POS(lev->typ)) {
- int bounce = 0, rmn;
- if(cansee(sx,sy)) pline("The %s bounces!",fltxt);
- range--;
- if(!dx || !dy || !rn2(20)){
- dx = -dx;
- dy = -dy;
- } else {
- if(ZAP_POS(rmn = levl[sx][sy-dy].typ) &&
- (IS_ROOM(rmn) || ZAP_POS(levl[sx+dx][sy-dy].typ)))
- bounce = 1;
- if(ZAP_POS(rmn = levl[sx-dx][sy].typ) &&
- (IS_ROOM(rmn) || ZAP_POS(levl[sx-dx][sy+dy].typ)))
- if(!bounce || rn2(2))
- bounce = 2;
-
- switch(bounce){
- case 0:
- dy = -dy;
- dx = -dx;
- break;
- case 1:
- dy = -dy;
- break;
- case 2:
- dx = -dx;
- break;
- }
- Tmp_at(-2, dirlet(dx,dy));
- }
- }
- }
- Tmp_at(-1,-1);
-}
-
-zhit(mon,type) /* returns damage to mon */
-struct monst *mon;
-int type;
-{
- int tmp = 0;
-
- switch(type) {
- case 0: /* magic missile */
- tmp = d(2,6);
- break;
- case -1: /* Dragon blazing fire */
- case 1: /* fire */
- if(index("Dg", mon->data->mlet)) break;
- tmp = d(6,6);
- if(index("YF", mon->data->mlet)) tmp += 7;
- break;
- case 2: /* sleep*/
- mon->mfroz = 1;
- break;
- case 3: /* cold */
- if(index("YFgf", mon->data->mlet)) break;
- tmp = d(6,6);
- if(mon->data->mlet == 'D') tmp += 7;
- break;
- case 4: /* death*/
- if(index(UNDEAD, mon->data->mlet)) break;
- tmp = mon->mhp+1;
- break;
- }
- mon->mhp -= tmp;
- return(tmp);
-}
-
-#define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\
- ? 'a' + (otyp - DEAD_ACID_BLOB)\
- : '@' + (otyp - DEAD_HUMAN))
-revive(obj)
-struct obj *obj;
-{
- struct monst *mtmp;
-
- if(obj->olet == FOOD_SYM && obj->otyp > CORPSE) {
- /* do not (yet) revive shopkeepers */
- /* Note: this might conceivably produce two monsters
- at the same position - strange, but harmless */
- mtmp = mkmon_at(CORPSE_I_TO_C(obj->otyp),obj->ox,obj->oy);
- delobj(obj);
- }
- return(!!mtmp); /* TRUE if some monster created */
-}
-
-rloco(obj)
-struct obj *obj;
-{
- int tx,ty,otx,oty;
-
- otx = obj->ox;
- oty = obj->oy;
- do {
- tx = rn1(COLNO-3,2);
- ty = rn2(ROWNO);
- } while(!goodpos(tx,ty));
- obj->ox = tx;
- obj->oy = ty;
- if(cansee(otx,oty))
- newsym(otx,oty);
-}
-
-fracture_rock(obj) /* fractured by pick-axe or wand of striking */
-struct obj *obj; /* no texts here! */
-{
- /* unpobj(obj); */
- obj->otyp = ROCK;
- obj->quan = 7 + rn2(60);
- obj->owt = weight(obj);
- obj->olet = WEAPON_SYM;
- if(cansee(obj->ox,obj->oy))
- prl(obj->ox,obj->oy);
-}
-
-burn_scrolls()
-{
- struct obj *obj, *obj2;
- int cnt = 0;
-
- for(obj = invent; obj; obj = obj2) {
- obj2 = obj->nobj;
- if(obj->olet == SCROLL_SYM) {
- cnt++;
- useup(obj);
- }
- }
- if(cnt > 1) {
- pline("Your scrolls catch fire!");
- losehp(cnt, "burning scrolls");
- } else if(cnt) {
- pline("Your scroll catches fire!");
- losehp(1, "burning scroll");
- }
-}
diff --git a/games/hack/help b/games/hack/help
deleted file mode 100644
index 24b22a5..0000000
--- a/games/hack/help
+++ /dev/null
@@ -1,132 +0,0 @@
- Welcome to HACK! ( description of version 1.0.3 )
-
- Hack is a Dungeons and Dragons like game where you (the adventurer)
-descend into the depths of the dungeon in search of the Amulet of Yendor
-(reputed to be hidden on the twentieth level). You are accompanied by a
-little dog that can help you in many ways and can be trained to do all
-sorts of things. On the way you will find useful (or useless) items, (quite
-possibly with magic properties) and assorted monsters. You attack a monster
-by trying to move into the space a monster is in (but often it is much
-wiser to leave it alone).
-
- Unlike most adventure games, which give you a verbal description of
-your location, hack gives you a visual image of the dungeon level you are on.
-
- Hack uses the following symbols:
- A to Z and a to z: monsters. You can find out what a letter
-represents by saying "/ (letter)", as in "/A", which will tell you that 'A'
-is a giant ant.
- - and | These form the walls of a room (or maze).
- . this is the floor of a room.
- # this is a corridor.
- > this is the staircase to the next level.
- < the staircase to the previous level.
- ` A large boulder.
- @ You (usually).
- ^ A trap.
- ) A weapon of some sort.
- ( Some other useful object (key, rope, dynamite, camera, ...)
- [ A suit of armor.
- % A piece of food (not necessarily healthy ...).
- / A wand.
- = A ring.
- ? A scroll.
- ! A magic potion.
- $ A pile or pot of gold.
-
-Commands:
- Hack knows the following commands:
- ? help: print this list.
- Q Quit the game.
- S Save the game.
- ! Escape to a shell.
- ^Z Suspend the game.
- < up: go up the staircase (if you are standing on it).
- > down: go down (just like up).
- kjhlyubn - go one step in the direction indicated.
- k: north (i.e., to the top of the screen),
- j: south, h: west, l: east, y: ne, u: nw, b: se, n: sw.
- KJHLYUBN - Go in that direction until you hit a wall or run
- into something.
- m (followed by one of kjhlyubn): move without picking up
- any objects.
- M (followed by one of KJHLYUBN): Move far, no pickup.
- f (followed by one of kjhlyubn): move until something
- interesting is found.
- F (followed by one of KJHLYUBN): as previous, but forking
- of corridors is not considered interesting.
- i print your inventory.
- I print selected parts of your inventory, like in
- I* - print all gems in inventory;
- IU - print all unpaid items;
- IX - print all used up items that are on your shopping bill;
- I$ - count your money.
- s search for secret doors and traps around you.
- ^ ask for the type of a trap you found earlier.
- ) ask for current wielded weapon.
- [ ask for current armor.
- = ask for current rings.
- $ count how many gold pieces you are carrying.
- . rest, do nothing.
- , pick up some things.
- : look at what is here.
- ^T teleport.
- ^R redraw the screen.
- ^P repeat last message
- (subsequent ^P's repeat earlier messages).
- / (followed by any symbol): tell what this symbol represents.
- \ tell what has been discovered.
- e eat food.
- w wield weapon. w- means: wield nothing, use bare hands.
- q drink (quaff) a potion.
- r read a scroll.
- T Takeoff armor.
- R Remove Ring.
- W Wear armor.
- P Put on a ring.
- z zap a wand.
- t throw an object or shoot an arrow.
- p pay your shopping bill.
- d drop something. d7a: drop seven items of object a.
- D Drop several things.
- In answer to the question "What kinds of things do you
- want to drop? [!%= au]" you should give zero or more
- object symbols possibly followed by 'a' and/or 'u'.
- 'a' means: drop all such objects, without asking for
- confirmation.
- 'u' means: drop only unpaid objects (when in a shop).
- a use, apply - Generic command for using a key to lock
- or unlock a door, using a camera, using a rope, etc.
- c call: name a certain object or class of objects.
- C Call: Name an individual monster.
- E Engrave: Write a message in the dust on the floor.
- E- means: use fingers for writing.
- O Set options. You will be asked to enter an option line.
- If this is empty, the current options are reported.
- Otherwise it should be a list of options separated by commas.
- Possible boolean options are: oneline, time, news, tombstone,
- rest_on_space, fixinvlet, beginner, male, female.
- They can be negated by prefixing them with '!' or "no".
- A string option is name; it supplies the answer to the question
- "Who are you?"; it may have a suffix.
- A compound option is endgame; it is followed by a description
- of what parts of the list of topscorers should be printed
- when the game is finished.
- Usually one will not want to use the 'O' command, but instead
- put a HACKOPTIONS="...." line in one's environment.
- v print version number.
-
- You can put a number before a command to repeat it that many times,
- as in "20s" or "40.".
-
- At present, some information is displayed on the bottom line.
- (It is expected that this information will go away in future versions.)
- You see on what dungeon level you are, how many hit points you have
- now (and will have when fully recovered), what your armor class is
- (the lower the better), your strength, experience level and the
- state of your stomach.
-
- Have Fun, and Good Hacking!
-
-
-
diff --git a/games/hack/hh b/games/hack/hh
deleted file mode 100644
index d777102..0000000
--- a/games/hack/hh
+++ /dev/null
@@ -1,55 +0,0 @@
-y k u Move commands:
- \|/ hykulnjb: single move in specified direction
-h-+-l HYKULNJB: repeated move in specified direction
- /|\ (until stopped by e.g. a wall)
-b j n f<dir>: fast movement in direction <dir>
- (until something interesting is seen)
- m<dir>: move without picking up objects
-
-Meta commands:
-Q quit leave the game
-S save save the game (to be continued later)
-! sh escape to some SHELL
-^Z suspend suspend the game (independent of your current suspend char)
-O set set options
-? help print information
-/ whatis give name (and sometimes more info) of specified monster
-\ known print list of what's been discovered
-v version print version number
-^R redraw redraw the screen (^R denotes the symbol CTRL/R)
-^P print repeat last message (subsequent ^P's repeat earlier messages)
-# introduces a long command; not really implemented
-
-Game commands:
-^T teleport teleport
-a apply, use use something (a key, camera, etc.)
-c call give a name to a class of objects
-d drop drop an object. d7a: drop seven items of object a.
-e eat eat something
-i invent list the inventory (all objects you are carrying)
-I invent list selected parts of the inventory
- IU: list unpaid objects
- IX: list unpaid but used up items
- I$: count your money
-p pay pay your bill
-q drink quaff a potion
-r read read a scroll
-s search search for secret doors, hidden traps and monsters
-t throw throw or shoot a weapon
-w wield wield a weapon (w- wield nothing)
-z zap zap a wand
-C name name an individual monster (e.g., baptize your dog)
-D Drop drop several things
-E Engrave write a message in the dust on the floor (E- use fingers)
-P wear put on a ring
-R remove remove a ring
-T remove take off some armor
-W wear put on some armor
-< up go up the stairs
-> down go down the stairs
-^ trap_id identify a previously found trap
-),[,= ask for current weapon, armor, rings, respectively
-$ gold count your gold
-. rest wait a moment
-, pickup pick up all you can carry
-: look look at what is here
diff --git a/games/hack/makedefs.c b/games/hack/makedefs.c
deleted file mode 100644
index add5f1b..0000000
--- a/games/hack/makedefs.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* makedefs.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include <stdio.h>
-#include <string.h>
-
-/* construct definitions of object constants */
-#define LINSZ 1000
-#define STRSZ 40
-
-int fd;
-char string[STRSZ];
-
-main(argc, argv)
- int argc;
- char **argv;
-{
-int index = 0;
-int propct = 0;
-char *sp;
- if (argc != 2) {
- (void)fprintf(stderr, "usage: makedefs file\n");
- exit(1);
- }
- if ((fd = open(argv[1], 0)) < 0) {
- perror(argv[1]);
- exit(1);
- }
- skipuntil("objects[] = {");
- while(getentry()) {
- if(!*string){
- index++;
- continue;
- }
- for(sp = string; *sp; sp++)
- if(*sp == ' ' || *sp == '\t' || *sp == '-')
- *sp = '_';
- if(!strncmp(string, "RIN_", 4)){
- capitalize(string+4);
- printf("#define %s u.uprops[%d].p_flgs\n",
- string+4, propct++);
- }
- for(sp = string; *sp; sp++) capitalize(sp);
- /* avoid trouble with stupid C preprocessors */
- if(!strncmp(string, "WORTHLESS_PIECE_OF_", 19))
- printf("/* #define %s %d */\n", string, index);
- else
- printf("#define %s %d\n", string, index);
- index++;
- }
- printf("\n#define CORPSE DEAD_HUMAN\n");
- printf("#define LAST_GEM (JADE+1)\n");
- printf("#define LAST_RING %d\n", propct);
- printf("#define NROFOBJECTS %d\n", index-1);
- exit(0);
-}
-
-char line[LINSZ], *lp = line, *lp0 = line, *lpe = line;
-int eof;
-
-readline(){
-int n = read(fd, lp0, (line+LINSZ)-lp0);
- if(n < 0){
- printf("Input error.\n");
- exit(1);
- }
- if(n == 0) eof++;
- lpe = lp0+n;
-}
-
-char
-nextchar(){
- if(lp == lpe){
- readline();
- lp = lp0;
- }
- return((lp == lpe) ? 0 : *lp++);
-}
-
-skipuntil(s) char *s; {
-char *sp0, *sp1;
-loop:
- while(*s != nextchar())
- if(eof) {
- printf("Cannot skipuntil %s\n", s);
- exit(1);
- }
- if(strlen(s) > lpe-lp+1){
- char *lp1, *lp2;
- lp2 = lp;
- lp1 = lp = lp0;
- while(lp2 != lpe) *lp1++ = *lp2++;
- lp2 = lp0; /* save value */
- lp0 = lp1;
- readline();
- lp0 = lp2;
- if(strlen(s) > lpe-lp+1) {
- printf("error in skipuntil");
- exit(1);
- }
- }
- sp0 = s+1;
- sp1 = lp;
- while(*sp0 && *sp0 == *sp1) sp0++, sp1++;
- if(!*sp0){
- lp = sp1;
- return(1);
- }
- goto loop;
-}
-
-getentry(){
-int inbraces = 0, inparens = 0, stringseen = 0, commaseen = 0;
-int prefix = 0;
-char ch;
-#define NSZ 10
-char identif[NSZ], *ip;
- string[0] = string[4] = 0;
- /* read until {...} or XXX(...) followed by ,
- skip comment and #define lines
- deliver 0 on failure
- */
- while(1) {
- ch = nextchar();
- swi:
- if(letter(ch)){
- ip = identif;
- do {
- if(ip < identif+NSZ-1) *ip++ = ch;
- ch = nextchar();
- } while(letter(ch) || digit(ch));
- *ip = 0;
- while(ch == ' ' || ch == '\t') ch = nextchar();
- if(ch == '(' && !inparens && !stringseen)
- if(!strcmp(identif, "WAND") ||
- !strcmp(identif, "RING") ||
- !strcmp(identif, "POTION") ||
- !strcmp(identif, "SCROLL"))
- (void) strncpy(string, identif, 3),
- string[3] = '_',
- prefix = 4;
- }
- switch(ch) {
- case '/':
- /* watch for comment */
- if((ch = nextchar()) == '*')
- skipuntil("*/");
- goto swi;
- case '{':
- inbraces++;
- continue;
- case '(':
- inparens++;
- continue;
- case '}':
- inbraces--;
- if(inbraces < 0) return(0);
- continue;
- case ')':
- inparens--;
- if(inparens < 0) {
- printf("too many ) ?");
- exit(1);
- }
- continue;
- case '\n':
- /* watch for #define at begin of line */
- if((ch = nextchar()) == '#'){
- char pch;
- /* skip until '\n' not preceded by '\\' */
- do {
- pch = ch;
- ch = nextchar();
- } while(ch != '\n' || pch == '\\');
- continue;
- }
- goto swi;
- case ',':
- if(!inparens && !inbraces){
- if(prefix && !string[prefix])
- string[0] = 0;
- if(stringseen) return(1);
- printf("unexpected ,\n");
- exit(1);
- }
- commaseen++;
- continue;
- case '\'':
- if((ch = nextchar()) == '\\') ch = nextchar();
- if(nextchar() != '\''){
- printf("strange character denotation?\n");
- exit(1);
- }
- continue;
- case '"':
- {
- char *sp = string + prefix;
- char pch;
- int store = (inbraces || inparens)
- && !stringseen++ && !commaseen;
- do {
- pch = ch;
- ch = nextchar();
- if(store && sp < string+STRSZ)
- *sp++ = ch;
- } while(ch != '"' || pch == '\\');
- if(store) *--sp = 0;
- continue;
- }
- }
- }
-}
-
-capitalize(sp) char *sp; {
- if('a' <= *sp && *sp <= 'z') *sp += 'A'-'a';
-}
-
-letter(ch) char ch; {
- return( ('a' <= ch && ch <= 'z') ||
- ('A' <= ch && ch <= 'Z') );
-}
-
-digit(ch) char ch; {
- return( '0' <= ch && ch <= '9' );
-}
diff --git a/games/hack/pathnames.h b/games/hack/pathnames.h
deleted file mode 100644
index b4dc37c..0000000
--- a/games/hack/pathnames.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_MAIL "/usr/bin/mail"
-#define _PATH_QUEST "/var/games/questdir"
-#define _PATH_HACK "/var/games/hackdir"
-
diff --git a/games/hack/rnd.c b/games/hack/rnd.c
deleted file mode 100644
index 037b2d9..0000000
--- a/games/hack/rnd.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* rnd.c - version 1.0.2 */
-/* $FreeBSD$ */
-
-#include <stdlib.h>
-
-#define RND(x) (random() % x)
-
-rn1(x,y)
-int x,y;
-{
- return(RND(x)+y);
-}
-
-rn2(x)
-int x;
-{
- return(RND(x));
-}
-
-rnd(x)
-int x;
-{
- return(RND(x)+1);
-}
-
-d(n,x)
-int n,x;
-{
- int tmp = n;
-
- while(n--) tmp += RND(x);
- return(tmp);
-}
diff --git a/games/hack/rumors b/games/hack/rumors
deleted file mode 100644
index 9435a5f..0000000
--- a/games/hack/rumors
+++ /dev/null
@@ -1,505 +0,0 @@
-"Quit" is a four letter word.
-"So when I die, the first thing I will see in Heaven is a score list?"
--- more --
-...and rings may protect your fingers.
-...and sometimes a piercer drops by.
-A Quasit is even faster than a jaguar!
-A chameleon imitating a postman often delivers scrolls of fire.
-A chameleon imitating a postman sometimes delivers scrolls of punishment.
-A clove of garlic a day keeps your best friends away.
-A cockatrice's corpse is guaranteed to be untainted!
-A confused acid blob may attack.
-A dead lizard is a good thing to turn undead.
-A dragon is just a Snake that ate a scroll of fire.
-A fading corridor enlightens your insight.
-A glowing potion is too hot to drink.
-A good amulet may protect you against guards.
-A homunculus wouldnt want to hurt a wizard.
-A jaguar shouldn't frighten you.
-A long worm can be defined recursively. So how should you attack it?
-A long worm hits with all of its length.
-A magic vomit pump is a necessity for gourmands.
-A monstrous mind is a toy for ever.
-A nurse a day keeps the doctor away.
-A potion of blindness makes you see invisible things.
-A ring is just a wound wand.
-A ring of adornment protects against Nymphs.
-A ring of conflict is a bad thing if there is a nurse in the room.
-A ring of extra ringfinger is useless if not enchanted.
-A ring of stealth can be recognised by that it does not teleport you.
-A rope may form a trail in a maze.
-A rumour has it that rumours are just rumours.
-A scroll of enchant amulet is only useful on your way back.
-A smoky potion surely affects your vision.
-A spear might hit a nurse.
-A spear will hit an ettin.
-A staff may recharge if you drop it for awhile.
-A tin of smoked eel is a wonderful find.
-A truly wise man never plays leapfrog with a unicorn.
-A two-handed sword usually misses.
-A unicorn can be tamed only by a fair maiden.
-A visit to the Zoo is very educational; you meet interesting animals.
-A wand of deaf is a more dangerous weapon than a wand of sheep.
-A wand of vibration might bring the whole cave crashing about your ears.
-A winner never quits. A quitter never wins.
-A xan is a small animal. It doesn't reach higher than your leg.
-Acid blobs should be attacked bare-handed.
-Affairs with Nymphs are often very expensive.
-Afraid of Mimics? Try to wear a ring of true seeing.
-Afraid of falling piercers? Wear a helmet!
-After being attacked by a Harpy you have a lot of arrows.
-All monsters are created evil, but some are more evil than others.
-Always attack a floating Eye from behind!
-Always be aware of the phase of the moon!
-Always read the info about a monster before dealing with it.
-Always sweep the floor before engraving important messages.
-Amulets are hard to make. Even for a wand of wishing.
-An Umber hulk can be a confusing sight.
-An elven cloak is always the height of fashion.
-An elven cloak protects against magic.
-An ettin is hard to kill; an imp is hard to hit. See the difference?
-Any small object that is accidentally dropped will hide under a larger object.
-Are you blind? Catch a floating Eye!
-Asking about monsters may be very useful.
-Attack long worms from the rear - that is so much safer!
-Attacking an eel when there is none usually is a fatal mistake!
-Balrogs only appear on the deeper levels.
-Be careful when eating bananas. Monsters might slip on the peels.
-Be careful when eating salmon - your fingers might become greasy.
-Be careful when the moon is in its last quarter.
-Be careful when throwing a boomerang - you might hit the back of your head.
-Be nice to a nurse: put away your weapon and take off your clothes.
-Being digested is a painfully slow process.
-Better go home and hit your kids. They are just little monsters!
-Better go home and play with your kids. They are just little monsters!
-Better leave the dungeon, otherwise you might get hurt badly.
-Beware of dark rooms - they may be the Morgue.
-Beware of death rays!
-Beware of falling rocks, wear a helmet!
-Beware of hungry dogs!
-Beware of the minotaur. He's very horny!
-Beware of the potion of Nitroglycerine - it's not for the weak of heart.
-Beware of wands of instant disaster.
-Beware: there's always a chance that your wand explodes as you try to zap it!
-Beyond the 23-rd level lies a happy retirement in a room of your own.
-Blank scrolls make more interesting reading.
-Blind? Eat a carrot!
-Booksellers never read scrolls; it might carry them too far away.
-Booksellers never read scrolls; it might leave their shop unguarded.
-Changing your suit without dropping your sword? You must be kidding!
-Cockatrices might turn themselves to stone faced with a mirror.
-Consumption of home-made food is strictly forbidden in this dungeon.
-Dark gems are just coloured glass.
-Dark room? Just flash often with your camera.
-Dark room? Your chance to develop your photographs!
-Dark rooms are not *completely* dark: just wait and let your eyes adjust...
-Dead lizards protect against a cockatrice.
-Death is just around the next door.
-Death is life's way of telling you you've been fired.
-Descend in order to meet more decent monsters.
-Did you know worms had teeth?
-Didn't you forget to pay?
-Didn't you forget to pay?
-Direct a direct hit on your direct opponent, directing in the right direction.
-Do something big today: lift a boulder.
-Do you want to visit hell? Dig a *very* deep hole.
-Dogs are attracted by the smell of tripe.
-Dogs do not eat when the moon is full.
-Dogs never step on cursed items.
-Dogs of ghosts aren't angry, just hungry.
-Don't bother about money: only Leprechauns and shopkeepers are interested.
-Don't create fireballs: they might turn against you.
-Don't eat too much: you might start hiccoughing!
-Don't forget! Large dogs are MUCH harder to kill than little dogs.
-Don't play hack at your work, your boss might hit you!
-Don't swim with weapons or armour: they might rust!
-Don't tell a soul you found a secret door, otherwise it isn't secret anymore.
-Don't throw gems. They are so precious! Besides, you might hit a roommate.
-Drinking might affect your health.
-Drop your vanity and get rid of your jewels! Pickpockets about!
-Dungeon expects every monster to do his duty.
-Dust is an armor of poor quality.
-Eat 10 cloves of garlic and keep all humans at a two-square distance.
-Eat a homunculus if you want to avoid sickness.
-Eating a Wraith is a rewarding experience!
-Eating a freezing sphere is like eating a yeti.
-Eating a killer bee is like eating a scorpion.
-Eating a tengu is like eating a Nymph.
-Eating unpaid Leprechauns may be advantageous.
-Eels hide under mud. Use a unicorn to clear the water and make them visible.
-Elven cloaks cannot rust.
-Engrave your wishes with a wand of wishing.
-Eventually all wands of striking do strike.
-Eventually you will come to admire the swift elegance of a retreating nymph.
-Ever fought with an enchanted tooth?
-Ever heard hissing outside? I *knew* you hadn't!
-Ever seen a leocrotta dancing the tengu?
-Ever slept in the arms of a homunculus?
-Ever tamed a shopkeeper?
-Ever tried digging through a Vault Guard?
-Ever tried enchanting a rope?
-Ever tried to catch a flying boomerang?
-Ever tried to put a Troll into a large box?
-Ever wondered why one would want to dip something in a potion?
-Every dog should be a domesticated one.
-Every hand has only one finger to put a ring on. You've got only two hands. So?
-Every level contains a shop; only the entrance is often hidden.
-Everybody should have tasted a scorpion at least once in his life.
-Expensive cameras have penetrating flashlights.
-Feeding the animals is strictly prohibited. The Management.
-Feeling lousy? Why don't you drink a potion of tea?
-Fiery letters might deter monsters.
-First Law of Hacking: leaving is much more difficult than entering.
-For any remedy there is a misery.
-Fourth Law of Hacking: you will find the exit at the entrance.
-Gems are the droppings of other inmates.
-Gems do get a burden.
-Genocide on shopkeepers is punishable.
-Getting Hungry? Stop wearing rings!
-Getting Hungry? Wear an amulet!
-Ghosts always empty the fridge.
-Ghosts are visible because they don't leave a trace.
-Giant beetles make giant holes in giant trees!
-Giving head to a long worm is like a long lasting reception.
-Gold is a heavy metal.
-Good day for overcoming obstacles. Try a steeplechase.
-Gossip is the opiate of the depressed.
-Hackers do it with bugs.
-Half Moon tonight. (At least it's better than no Moon at all.)
-Handle your flasks carefully - there might be a ghost inside!
-Have a good meal today: eat a minotaur.
-Hey guys, you *WIELD* a dead lizard against a cocatrice! [David London]
-Hissing is a sound I hate.
-Hitting is the lingua franca in these regions.
-Humans use walking canes when they grow old.
-Hunger is a confusing experience for a dog!
-Hungry dogs are unreliable.
-Hungry? There is an abundance of food on the next level.
-Hungry? Wear an amulet!
-I doubt whether nurses are virgins.
-I guess you have never hit a postman with an Amulet of Yendor yet...
-I once knew a hacker who ate too fast and choked to death.....
-I smell a maze of twisty little passages.
-I wished, I never wished a wand of wishing. (Wishful thinking)
-If "nothing happens", something *has* happened anyway!!
-If a chameleon mimics a mace, it really mimics a Mimic mimicking a mace.
-If a shopkeeper kicks you out of his shop, he'll kick you out of the dungeon.
-If you are being punished, it's done with a deadly weapon.
-If you are the shopkeeper you can take things for free.
-If you are too cute some monsters might be tempted to embrace you.
-If you can't learn to do it well, learn to enjoy doing it badly.
-If you need a wand of digging, kindly ask the minotaur.
-If you see nurses you better start looking somewhere for a doctor.
-If you turn blind: don't expect your dog to be turned into a seeing-eye dog.
-If you want to feal great, you must eat something real big.
-If you want to float you'd better eat a floating eye.
-If you want to genocide nurses, genocide @'s.
-If you want to hit, use a dagger.
-If you want to rob a shop, train your dog.
-If you're afraid of trapdoors, just cover the floor with all you've got.
-If you're lost, try buying a map next time you're in a shop.
-If your ghost kills a player, it increases your score.
-Important mail? Be careful that it isn't stolen!
-Improve your environment, using a wand of rearrangement.
-In a hurry? Try a ride on a fast moving quasit!
-In a way, a scorpion is like a snake.
-In need of a rest? Quaff a potion of sickness!
-In total, there are eight sorts of shops.
-Increase mindpower: Tame your own ghost!
-Inside a shop you better take a look at the price tags before buying anything.
-It furthers one to see the great man.
-It is bad manners to use a wand in a shop.
-It is not always a good idea to whistle for your dog.
-It is said that Giant Rabbits can be tamed with carrots only.
-It is said that purple worms and trappers fill the same niche.
-It might be a good idea to offer the unicorn a ruby.
-It seems you keep overlooking a sign reading "No trespassing"!
-It would be peculiarly sad were your dog turned to stone.
-It's all a matter of life and death, so beware of the undead.
-It's bad luck to drown a postman.
-It's bad luck, being punished.
-It's easy to overlook a monster in a wood.
-It's not safe to Save.
-Jackals are intrinsically rotten.
-Just below any trapdoor there may be another one. Just keep falling!
-Keep a clear mind: quaff clear potions.
-Keep your armours away from rust.
-Keep your weaponry away from acids.
-Kicking the terminal doesn't hurt the monsters.
-Kill a unicorn and you kill your luck.
-Killer bees keep appearing till you kill their queen.
-Large dogs make larger turds than little ones.
-Latest news? Put 'net.games.hack' in your .newsrc !
-Latest news? Put newsgroup 'netUNX.indoor.hackers-scroll' in your .newsrc!
-Learn how to spell. Play Hack!
-Leather armour cannot rust.
-Leprechauns are the most skilled cutpurses in this dungeon.
-Leprechauns hide their gold in a secret room.
-Let your fingers do the walking on the yulkjhnb keys.
-Let's face it: this time you're not going to win.
-Let's have a party, drink a lot of booze.
-Liquor sellers do not drink; they hate to see you twice.
-Looking for a monster -- use a staff of monster summoning.
-Looking pale? Quaff a red potion!
-M.M.Vault cashiers teleport any amount of gold to the next local branch.
-Many monsters make a murdering mob.
-Meet yourself! Commit suicide and type "hack"
-Meeting your own ghost decreases your luck considerably!
-Memory flaw - core dumped.
-Money is the root of all evil.
-Money to invest? Take it to the local branch of the Magic Memory Vault!
-Monsters come from nowhere to hit you everywhere.
-Monsters sleep because you are boring, not because they ever get tired.
-Most monsters can't swim.
-Most monsters prefer minced meat. That's why they are hitting you!
-Most rumors are just as misleading as this one.
-Much ado Nothing Happens.
-Murder complaint? Mail to 'netnix!devil!gamble!freak!trap!lastwill!rip'.
-Need money? Sell your corpses to a tin factory.
-Never ask a shopkeeper for a price list.
-Never attack a guard.
-Never drop a crysknife! No, never even unwield it, until...
-Never eat with glowing hands!
-Never fight a monster: you might get killed.
-Never go into the dungeon at midnight.
-Never kick a sleeping dog.
-Never kiss an animal. It may cause kissing disease.
-Never map the labyrinth.
-Never mind the monsters hitting you: they just replace the charwomen.
-Never ride a long worm.
-Never step on a cursed engraving.
-Never swim with a camera: there's nothing to take pictures of.
-Never trust a random generator in magic fields.
-Never use a wand of death.
-Never use your best weapon to engrave a curse.
-Never vomit on a door mat.
-No easy fighting with a heavy load!
-No level contains two shops. The maze is no level. So...
-No part of this fortune may be reproduced, stored in a retrieval system, ...
-No weapon is better than a crysknife.
-Not all rumors are as misleading as this one.
-Not even a spear will hit a Xorn.
-Now what is it that cures digestion?
-Nurses are accustomed to touch naked persons: they don't harm them.
-Nurses prefer undressed hackers.
-Nymphs and nurses like beautiful rings.
-Nymphs are blondes. Are you a gentleman?
-Nymphs are very pleased when you call them by their real name: Lorelei.
-Offering a unicorn a worthless piece of glass might prove to be fatal!
-Old hackers never die: young ones do.
-Old trees sometimes fall without a warning!
-Once your little dog will be a big dog, and you will be proud of it.
-One can even choke in a fortune cookie!
-One has to leave shops before closing time.
-One homunculus a day keeps the doctor away.
-One level further down somebody is getting killed, right now.
-One wand of concentration equals eight scrolls of create monster.
-Only Today! A dramatic price-cut on slightly used wands.
-Only a Nymph knows how to unlock chains.
-Only a dragon will never get a cold from a wand of cold.
-Only a real dummy would ever call his sword 'Elbereth'.
-Only a wizard can use a magic whistle.
-Only adventurers of evil alignment think of killing their dog.
-Only cave-women can catch a unicorn. And then only with a golden rope.
-Only chaotic evils kill sleeping monsters.
-Only david can find the zoo!
-Only real trappers escape traps.
-Only real wizards can write scrolls.
-Only wizards are able to zap a wand.
-Opening a tin is difficult, especially when you are not so strong!
-Opening a tin is difficult, especially when you attempt this bare handed!
-Operation coded OVERKILL has started now.
-Orcs and killer bees share their lifestyle.
-Orcs do not procreate in dark rooms.
-PLEASE ignore previous rumour.
-Plain nymphs are harmless.
-Playing billiards pays when you are in a shop.
-Polymorphing your dog probably makes you safer.
-Praying will frighten Demons.
-Punishment is a thing you call over yourself. So why complain?
-Pursue the monsters and you will be had indeed.
-Put on a ring of teleportation: it will take you away from onslaught.
-Rays aren't boomerangs, of course, but still...
-Read the manual before entering the cave - You might get killed otherwise.
-Reading Herbert will disgust you, but in one case it might be enlightening.
-Reading Tolkien might help you.
-Reading might change your vision.
-Reading might improve your scope.
-Relying on a dog might turn you in a dog addict.
-Reward your doggie with a giant Bat.
-Ropes are made from the long, blond hairs of dead Nymphs.
-Row (3x) that boat gently down the stream, Charon (4x), death is but a dream.
-Running is good for your legs.
-Rust monsters love water. There are potions they hate, however.
-Savings do include amnesia.
-Scorpions often hide under tripe rations.
-Screw up your courage! You've screwed up everything else.
-Scrolls of fire are useful against fog clouds.
-Second Law of Hacking: first in, first out.
-Selling and rebuying a wand will recharge it.
-Shopkeepers accept creditcards, as long as you pay cash.
-Shopkeepers are vegetarians: they only eat Swedes.
-Shopkeepers can't read, so what use is engraving in a shop?
-Shopkeepers can't swim.
-Shopkeepers have incredible patience.
-Shopkeepers often have strange names.
-Shopkeepers sometimes die from old age.
-Sleeping may increase your strength.
-Snakes are often found under worthless objects.
-Some Balrogs don't attack if you offer them a ring.
-Some mazes (especially small ones) have no solutions, says man 6 maze.
-Some monsters can be tamed. I once saw a hacker with a tame Dragon!
-Some potions are quite mind-expanding.
-Some questions Sphynxes ask just *don't* have any answers.
-Sometimes "mu" is the answer.
-Sometimes monsters are more likely to fight each other than attack you.
-Sorry, no fortune this time. Better luck next cookie!
-Spare your scrolls of make-edible until it's really necessary!
-Speed Kills (The Doors)
-Spinach, carrot, and a melon - a meal fit for a nurse!
-Stay clear of the level of no return.
-Suddenly the dungeon will collapse ...
-Surprise your dog with an acid blob!
-Tainted meat is even more sickening than poison!
-Take a long worm from the rear, according to its mate it's a lot more fun.
-Tame a troll and it will learn you fighting.
-Taming a postman may cause a system security violation.
-Taming is a gradual process of excercising and rewarding.
-Telepathy is just a trick: once you know how to do it, it's easy.
-Teleportation lessens your orientation.
-The "pray" command is not yet implemented.
-The Jackal only eats bad food.
-The Leprechaun Gold Tru$t is no division of the Magic Memory Vault.
-The Leprechauns hide their treasure in a small hidden room.
-The air is positively magic in here. Better wear a negative armor.
-The best equipment for your work is, of course, the most expensive.
-The emptiness of a ghost is too heavy to bear.
-The key to this game is that there are no keys.
-The longer the wand the better.
-The moon is not the only heavenly body to influence this game.
-The postman always rings twice.
-The proof of the quivering blob is in the eating thereof.
-The secret of wands of Nothing Happens: try again!
-The use of dynamite is dangerous.
-There are better information sources than fortune cookies.
-There are monsters of softening penetration.
-There are monsters of striking charity.
-There have been people like you in here; their ghosts seek revenge on you.
-There is a VIP-lounge on this level. Only first-class travellers admitted.
-There is a big treasure hidden in the zoo!
-There is a message concealed in each fortune cookie.
-There is a trap on this level!
-There is more magic in this cave than meets the eye.
-There is no business like throw business.
-There is no harm in praising a large dog.
-There is nothing like eating a Mimic.
-There seem to be monsters of touching benevolence.
-They say a gelatinous cube can paralyse you...
-They say that Elven cloaks absorb enchantments.
-They say that a dagger hits.
-They say that a dog avoids traps.
-They say that a dog can be trained to fetch objects.
-They say that a dog never steps on a cursed object.
-They say that a spear will hit a Dragon.
-They say that a spear will hit a Xorn.
-They say that a spear will hit a neo-otyugh. (Do YOU know what that is?)
-They say that a spear will hit an ettin.
-They say that a two-handed sword misses.
-They say that a unicorn might bring you luck.
-They say that an elven cloak may be worn over your armor.
-They say that an elven cloak protects against magic.
-They say that cavemen seldom find tins in the dungeon.
-They say that dead lizards protect against a cockatrice.
-They say that killing a shopkeeper brings bad luck.
-They say that monsters never step on a scare monster scroll.
-They say that only david can find the zoo!
-They say that shopkeepers often have a large amount of money in their purse.
-They say that the owner of the dungeon might change it slightly.
-They say that the use of dynamite is dangerous.
-They say that the walls in shops are made of extra hard material.
-They say that there is a big treasure hidden in the zoo!
-They say that there is a message concealed in each fortune cookie.
-They say that there is a trap on this level!
-They say that throwing food at a wild dog might tame him.
-They say that you can meet old friends in the caves.
-They say that you can't take your pick-axe into a shop.
-They say that you cannot trust scrolls of rumour.
-They say that you need a key in order to open locked doors.
-Third Law of Hacking: the last blow counts most.
-This dungeon is restroom equipped (for your convenience).
-This fortune cookie is property of Fortune Cookies, Inc.
-This is not a fortune.
-This is the Leprechaun Law: every purse has a price.
-Throwing food at a wild dog might tame him.
-Tin openers are rare indeed.
-Tired of irritating bats? Try a scroll of silence.
-To hit or not to hit, that is the question.
-To reach heaven, escape the dungeon while wearing a ring of levitation.
-Tranquillizers might get you killed.
-Travel fast, use some magic speed!
-Tripe on its own is revolting, but with onions it's delicious!
-Try hacking in the wee hours: you will have more room.
-Try the fall back end run play against ghosts.
-Ulch, that meat was painted.
-Unwanted mail? Sell it to the bookshop!
-Vampires hate garlic.
-Vault guards always make sure you aren't a shopkeeper.
-Vault guards never disturb their Lords.
-Visitors are requested not to apply genocide to shopkeepers.
-WARNING from H.M. Govt: Quaffing may be dangerous to your health.
-Wanna fly? Eat a bat.
-Want a hint? Zap a wand of make invisible on your weapon!
-Want fun? Throw a potion in a pool and go swimming!
-Want to conserve your dead corpses? Go to the tin factory!
-Wanted: shopkeepers. Send a scroll of mail to: Mage of Yendor/Level 35/Dungeon.
-Warning: end of file 'fortunes' reached.
-Warning: people who eat dragons can go to hell!!
-Watch your steps on staircases.
-Wear armor, going naked seems to offend public decency in here.
-What a pity, you cannot read it!
-What do you think is the use of dead lizards?
-What do you think would be the use of a two handed sword called "Orcrist" ?
-When a piercer drops in on you, you will be tempted to hit the ceiling!
-When in a maze follow the right wall and you will never get lost.
-When in a shop, do as shopkeepers do.
-When punished, watch your steps on the stairs!
-When you have a key, you don't have to wait for the guard.
-When you have seen one killer bee, you have seen them all.
-When your dog follows you through a trap door, don't hit it!
-Where do you think all those demons come from? From Hell, of course.
-Where do you think the hell is located? It must be deep, deep down.
-Who should ever have thought one could live from eating fog clouds?
-Why a "2" for the postman? Well, how many times does he ring?
-Why should one ever throw an egg to a cockatrice?
-Why would anybody in his sane mind engrave "Elbereth" ?
-Wish for a master key and open the Magic Memory Vault!
-Wish for a pass-key and pass all obstacles!
-Wish for a skeleton-key and open all doors!
-Wishing too much may bring you too little.
-Wizards do not sleep.
-You are heading for head-stone for sure.
-You are just the kind of bad food some monsters like to digest.
-You can always wear an elven cloak.
-You can eat what your dog can eat.
-You can get a genuine Amulet of Yendor by doing the following: -- more --
-You can't get rid of a cursed plate mail with a can-opener.
-You can't leave a shop through the back door: there ain't one!
-You cannot ride a long worm.
-You cannot trust scrolls of rumour.
-You die...
-You feel greedy and want more gold? Why don't you try digging?
-You feel like someone is pulling your leg.
-You have to outwit a Sphynx or pay her.
-You may get rich selling letters, but beware of being blackmailed!
-You may have a kick from kicking a little dog.
-You might choke on your food by eating fortune cookies.
-You might cut yourself on a long sword.
-You might trick a shopkeeper if you're invisible.
-You need a key in order to open locked doors.
-You offend Shai-Hulud by sheathing your crysknife without having drawn blood.
-You want to regain strength? Two levels ahead is a guesthouse!
-You'll need a spear if you want to attack a Dragon.
-You've got to know how to put out a yellow light.
-Your dog can buy cheaper than you do.
-Zapping a wand of Nothing Happens doesn't harm you a bit.
-Zapping a wand of undead turning might bring your dog back to life.
diff --git a/games/hangman/Makefile b/games/hangman/Makefile
deleted file mode 100644
index acabd3d..0000000
--- a/games/hangman/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= hangman
-SRCS= endgame.c extern.c getguess.c getword.c main.c playgame.c \
- prdata.c prman.c prword.c setup.c
-MAN= hangman.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
-
-
diff --git a/games/hangman/endgame.c b/games/hangman/endgame.c
deleted file mode 100644
index a04908a..0000000
--- a/games/hangman/endgame.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)endgame.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * endgame:
- * Do what's necessary at the end of the game
- */
-void
-endgame()
-{
- char ch;
-
- prman();
- if (Errors >= MAXERRS)
- Errors = MAXERRS + 2;
- prword();
- prdata();
- move(MESGY, MESGX);
- if (Errors > MAXERRS)
- printw("Sorry, the word was \"%s\"\n", Word);
- else
- printw("You got it!\n");
-
- for (;;) {
- mvaddstr(MESGY + 1, MESGX, "Another word? ");
- leaveok(stdscr, FALSE);
- refresh();
- if ((ch = readch()) == 'n')
- die(0);
- else if (ch == 'y')
- break;
- mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'");
- }
-
- leaveok(stdscr, TRUE);
- move(MESGY, MESGX);
- deleteln();
- deleteln();
- deleteln();
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/games/hangman/extern.c b/games/hangman/extern.c
deleted file mode 100644
index 5561adc..0000000
--- a/games/hangman/extern.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-bool Guessed[26];
-
-char Word[BUFSIZ],
- Known[BUFSIZ],
- *Noose_pict[] = {
- " ______",
- " | |",
- " |",
- " |",
- " |",
- " |",
- " __|_____",
- " | |___",
- " |_________|",
- NULL
- };
-
-int Errors,
- Wordnum = 0;
-
-double Average = 0.0;
-
-ERR_POS Err_pos[MAXERRS] = {
- { 2, 10, 'O' },
- { 3, 10, '|' },
- { 4, 10, '|' },
- { 5, 9, '/' },
- { 3, 9, '/' },
- { 3, 11, '\\' },
- { 5, 11, '\\' }
-};
-
-FILE *Dict = NULL;
-
-off_t Dict_size;
diff --git a/games/hangman/getguess.c b/games/hangman/getguess.c
deleted file mode 100644
index 4caaf0e..0000000
--- a/games/hangman/getguess.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)getguess.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/ttydefaults.h>
-#include "hangman.h"
-
-/*
- * getguess:
- * Get another guess
- */
-void
-getguess()
-{
- int i;
- int ch;
- bool correct;
-
- leaveok(stdscr, FALSE);
- for (;;) {
- move(PROMPTY, PROMPTX + sizeof "Guess: ");
- refresh();
- ch = readch();
- if (isalpha(ch)) {
- if (isupper(ch))
- ch = tolower(ch);
- if (Guessed[ch - 'a'])
- mvprintw(MESGY, MESGX, "Already guessed '%c'", ch);
- else
- break;
- }
- else if (ch == CTRL('D'))
- die(0);
- else
- mvprintw(MESGY, MESGX, "Not a valid guess: '%s'",
- unctrl(ch));
- }
- leaveok(stdscr, TRUE);
- move(MESGY, MESGX);
- clrtoeol();
-
- Guessed[ch - 'a'] = TRUE;
- correct = FALSE;
- for (i = 0; Word[i] != '\0'; i++)
- if (Word[i] == ch) {
- Known[i] = ch;
- correct = TRUE;
- }
- if (!correct)
- Errors++;
-}
-
-/*
- * readch;
- * Read a character from the input
- */
-char
-readch()
-{
- int cnt;
- auto char ch;
-
- cnt = 0;
- for (;;) {
- if (read(0, &ch, sizeof ch) <= 0)
- {
- if (++cnt > 100)
- die(0);
- }
- else if (ch == CTRL('L')) {
- wrefresh(curscr);
- mvcur(0, 0, curscr->_cury, curscr->_curx);
- }
- else
- return ch;
- }
-}
diff --git a/games/hangman/getword.c b/games/hangman/getword.c
deleted file mode 100644
index 00246aa..0000000
--- a/games/hangman/getword.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)getword.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "hangman.h"
-#include <stdlib.h>
-
-/*
- * getword:
- * Get a valid word out of the dictionary file
- */
-void
-getword()
-{
- FILE *inf;
- char *wp, *gp;
- long pos;
-
- inf = Dict;
- for (;;) {
- pos = (double)random() / (RAND_MAX + 1.0) * (double)Dict_size;
- fseek(inf, pos, 0);
- if (fgets(Word, BUFSIZ, inf) == NULL)
- continue;
- if (fgets(Word, BUFSIZ, inf) == NULL)
- continue;
- Word[strlen(Word) - 1] = '\0';
- if (strlen(Word) < MINLEN)
- continue;
- for (wp = Word; *wp; wp++)
- if (!islower(*wp))
- goto cont;
- break;
-cont: ;
- }
- gp = Known;
- wp = Word;
- while (*wp) {
- *gp++ = '-';
- wp++;
- }
- *gp = '\0';
-}
diff --git a/games/hangman/hangman.6 b/games/hangman/hangman.6
deleted file mode 100644
index e1ab323..0000000
--- a/games/hangman/hangman.6
+++ /dev/null
@@ -1,51 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)hangman.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH HANGMAN 6 "May 31, 1993"
-.UC 4
-.SH NAME
-hangman \- the game of hangman
-.SH SYNOPSIS
-.B /usr/games/hangman
-.SH DESCRIPTION
-In
-.I hangman,
-the computer picks a word from the on-line word list
-and you must try to guess it.
-The computer keeps track of which letters have been guessed
-and how many wrong guesses you have made on the screen in a graphic fashion.
-.SH FILES
-/usr/share/dict/words On-line word list
-.SH AUTHOR
-Ken Arnold
diff --git a/games/hangman/hangman.h b/games/hangman/hangman.h
deleted file mode 100644
index b8dacd9..0000000
--- a/games/hangman/hangman.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hangman.h 8.1 (Berkeley) 5/31/93
- * $FreeBSD$
- */
-
-# include <stdlib.h>
-# include <string.h>
-# include <curses.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <ctype.h>
-# include <signal.h>
-# include <unistd.h>
-# include "pathnames.h"
-
-# define MINLEN 6
-# define MAXERRS 7
-
-# define MESGY 12
-# define MESGX 0
-# define PROMPTY 11
-# define PROMPTX 0
-# define KNOWNY 10
-# define KNOWNX 1
-# define NUMBERY 4
-# define NUMBERX (COLS - 1 - 26)
-# define AVGY 5
-# define AVGX (COLS - 1 - 26)
-# define GUESSY 2
-# define GUESSX (COLS - 1 - 26)
-
-
-typedef struct {
- short y, x;
- char ch;
-} ERR_POS;
-
-extern bool Guessed[];
-
-extern char Word[], Known[], *Noose_pict[];
-
-extern int Errors, Wordnum;
-
-extern double Average;
-
-extern ERR_POS Err_pos[];
-
-extern FILE *Dict;
-
-extern off_t Dict_size;
-
-void die(int);
-void endgame(void);
-void getguess(void);
-void getword(void);
-void playgame(void);
-void prdata(void);
-void prman(void);
-void prword(void);
-char readch(void);
-void setup(void);
diff --git a/games/hangman/main.c b/games/hangman/main.c
deleted file mode 100644
index a948eea..0000000
--- a/games/hangman/main.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * This game written by Ken Arnold.
- */
-int
-main()
-{
-
- /* revoke */
- setgid(getgid());
-
- initscr();
- signal(SIGINT, die);
- setup();
- for (;;) {
- Wordnum++;
- playgame();
- Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
- }
- /* NOTREACHED */
- exit(EXIT_FAILURE);
-}
-
-/*
- * die:
- * Die properly.
- */
-void
-die(sig)
-int sig;
-{
- mvcur(0, COLS - 1, LINES - 1, 0);
- endwin();
- putchar('\n');
- exit(0);
-}
diff --git a/games/hangman/pathnames.h b/games/hangman/pathnames.h
deleted file mode 100644
index 41a7846..0000000
--- a/games/hangman/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_DICT "/usr/share/dict/words"
diff --git a/games/hangman/playgame.c b/games/hangman/playgame.c
deleted file mode 100644
index 2059e39..0000000
--- a/games/hangman/playgame.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)playgame.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * playgame:
- * play a game
- */
-void
-playgame()
-{
- bool *bp;
-
- getword();
- Errors = 0;
- bp = Guessed;
- while (bp < &Guessed[26])
- *bp++ = FALSE;
- while (Errors < MAXERRS && index(Known, '-') != NULL) {
- prword();
- prdata();
- prman();
- getguess();
- }
- endgame();
-}
diff --git a/games/hangman/prdata.c b/games/hangman/prdata.c
deleted file mode 100644
index be9feff..0000000
--- a/games/hangman/prdata.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)prdata.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * prdata:
- * Print out the current guesses
- */
-void
-prdata()
-{
- bool *bp;
-
- move(GUESSY, GUESSX + sizeof "Guessed: ");
- bp = Guessed;
- while (bp < &Guessed[26])
- if (*bp++)
- addch((bp - Guessed) + 'a' - 1);
- clrtoeol();
- mvprintw(NUMBERY, NUMBERX + sizeof "Word #: ", "%d", Wordnum);
- mvprintw(AVGY, AVGX + sizeof "Current Average: ", "%.3f",
- (Average * (Wordnum - 1) + Errors) / Wordnum);
- mvprintw(AVGY + 1, AVGX + sizeof "Overall Average: ", "%.3f", Average);
-}
diff --git a/games/hangman/prman.c b/games/hangman/prman.c
deleted file mode 100644
index 8e4f63f..0000000
--- a/games/hangman/prman.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)prman.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * prman:
- * Print out the man appropriately for the give number
- * of incorrect guesses.
- */
-void
-prman()
-{
- int i;
-
- for (i = 0; i < Errors; i++)
- mvaddch(Err_pos[i].y, Err_pos[i].x, Err_pos[i].ch);
- while (i < MAXERRS) {
- mvaddch(Err_pos[i].y, Err_pos[i].x, ' ');
- i++;
- }
-}
diff --git a/games/hangman/prword.c b/games/hangman/prword.c
deleted file mode 100644
index ddc3ed3..0000000
--- a/games/hangman/prword.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)prword.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "hangman.h"
-
-/*
- * prword:
- * Print out the current state of the word
- */
-void
-prword()
-{
- move(KNOWNY, KNOWNX + sizeof "Word: ");
- addstr(Known);
- clrtoeol();
-}
diff --git a/games/hangman/setup.c b/games/hangman/setup.c
deleted file mode 100644
index 6889f8c..0000000
--- a/games/hangman/setup.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdlib.h>
-# include "hangman.h"
-
-/*
- * setup:
- * Set up the strings on the screen.
- */
-void
-setup()
-{
- char **sp;
- static struct stat sbuf;
-
- noecho();
- crmode();
-
- mvaddstr(PROMPTY, PROMPTX, "Guess:");
- mvaddstr(GUESSY, GUESSX, "Guessed:");
- mvaddstr(NUMBERY, NUMBERX, "Word #:");
- mvaddstr(AVGY, AVGX, "Current Average:");
- mvaddstr(AVGY + 1, AVGX, "Overall Average:");
- mvaddstr(KNOWNY, KNOWNX, "Word: ");
-
- for (sp = Noose_pict; *sp != NULL; sp++) {
- move(sp - Noose_pict, 0);
- addstr(*sp);
- }
-
- srandomdev();
- if ((Dict = fopen(_PATH_DICT, "r")) == NULL) {
- perror(_PATH_DICT);
- endwin();
- exit(1);
- }
- fstat(fileno(Dict), &sbuf);
- Dict_size = sbuf.st_size;
-}
diff --git a/games/larn/COPYRIGHT b/games/larn/COPYRIGHT
deleted file mode 100644
index 43ff637..0000000
--- a/games/larn/COPYRIGHT
+++ /dev/null
@@ -1,6 +0,0 @@
-This entire subtree is copyright by Noah Morgan.
-The following copyright notice applies to all files found here. None of
-these files contain AT&T proprietary source code.
-_____________________________________________________________________________
-
-/* Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/games/larn/Fixed.Bugs b/games/larn/Fixed.Bugs
deleted file mode 100644
index d2acae0..0000000
--- a/games/larn/Fixed.Bugs
+++ /dev/null
@@ -1,216 +0,0 @@
-This is a list of the fixes/enhancements made to larn V11.0 in Version 12.0.
-(Version numbers consist of 2 parts: ver.subver. When the save file format
-changes, ver must be bumped. This is why the next release of Larn is 12.0
-and not 11.1. This is used in the savefile routines to check for out-of-date
-save files). This list was mainly meant to be a record of what changed,
-for my own sanity. It's included for your benefit (Warning: SPOILER!):
-
-0. lprintf() in fileio.c (now called io.c) has been changed to use varargs
- so that its variable number of arguments usage is now portable. Pyramids
- primarily had this problem.
-
-1. Panic handler was added to signal.c. This routine catches fatal errors
- like segmentation faults, bus errors, illegal instructions, etc., and
- trys to performs a savegame() before dumping core. This helps prevent
- the loss of a good game due to a game malfunction. Also, the name of the
- signal received is printed, instead of just its number.
-
-2. The version number of the program is now selectable from the Makefile.
- see the symbols VER and SUBVER.
-
-3. When at an altar, pray and donate 3000000000 gp. and ye used to receive
- a whopping amount of gold due to a wraparound problem with the signed
- ints. This has been fixed by using unsigned longs when asking for money
- amounts.
-
-4. It was possible that when compiled with work hours checking, checkpointing
- enabled, and having "play-day-play" in the .larnopts file a segmentation
- fault would occur at its first attempt to do a checkpoint. This was due
- to an improperly declared savefilename array in tok.c. This has been fixed.
-
-5. on level H, casting a missile weapon (mle cld ssp bal lit) off the edge of
- the level would mess up the display, as it didn't know when to stop. This
- is needless to say, fixed. Absolute bounds are now in effect for missile
- type spells, see godirect() in monster.c.
-
-6. The create monster routine will now create monsters in random positions
- around the player. Before, the 1st one would always be created to the
- upper left.
-
-7. If you vpr or lit at a throne, it would summon a gnome king that you
- would have to deal with. However, as each throne has only one king with it,
- successive vpr's should not create more gnome kings. Presently, successive
- vpr's will create more kings. This has been fixed.
-
-8. The mechanism to manage spheres of annihilation has been reworked to provide
- a cleaner design and to eliminate some possible problems.
-
-9. The spell gen (genocide monsters) has been implemented.
-
-10. When dropping a ring of strength and having been weakened to STR=3 the
- player might end up with a negative strength. Strength is now stored
- in 2 variables, real strength, and strength bonuses. Only real strength
- can now be weakened down to a minimum of 3, so unless you have a ring of
- strength -3 or less, strengths below 3 should not occur.
-
-11. larn -h will now print out a list of all available command line options.
-
-12. larn -o<optsfile> now lets you specify a .larnopts file on the command
- line. This was necessary as part of the solution to number 14 below.
-
-13. The "savefile:" statement has been aded to the .larnopts format to allow
- specifying the savefilename (full path) for the savegame operation.
- This too was needed as part of # 14 below.
-
-14. A player id facility has been added to larn. The complaint was that
- the game used the userid to order the scoreboard, thus only one scoreboard
- entry was allowed for each userid. If the compile time symbol UIDSCORE
- is defined at compilation time (see Makefile), this will still be true.
- However, if this define is omitted, the game will create and manage a
- file called ".playerids" where names are taken from the specified
- .larnopts file (now a command line option) and assigned a unique playerid.
- playerid's will now be used to govern scoreboard entry posting. This
- feature makes it easy for one person to have many characters, each
- appearing on the scoreboard. Be kind to your fellow players!
- The philosophy of one score per player gives more players the opportunity
- to bask in glory for all to see!
-
-15. It is no longer required that the player be WIZID to create the scoreboard
- or to examine the logfile. Anyone with the correct wizard's password can
- now use these command line options (password is only needed to create/clear
- the scoreboard). If you want to prevent players from zeroing the
- scoreboard, change the wizard's password. (in config.c) By the way, wizards
- may be alot of fun, but they are prevented from being placed on any
- scoreboard. (for clarification)
-
-16. Monsters now have intelligence, that is some of them. This determines if
- the monster moves using the previously stupid movement method, or by using
- the new IMM (intelligent monster movement) algorithm. With IMM, monsters
- will move around corners, avoid pits, traps, etc. With increasing levels
- of difficulty, more monsters will be using IMM. Beware of IMM when
- aggravated! Those little beasties can really find you!
-
-17. Added the scroll of life protection.
-
-18. Larn now consults the file ".holiday" to check for holidays if the TIMECHECK
- option (no playing during working hours) is enabled. Before, larn knew
- nothing about holidays. It should now let people play if it is a holiday.
- The format for a .holiday entry is: "mmm dd yyyy comments . . .".
-
-19. In nap() and napms() it is possible that with nap(0) or napms(0) there
- would be an infinite loop and the game would hang. The case of nap(0)
- is now looked for.
-
-20. The granularity of gold piles has been increased. iarg[] has been changed
- from char's to short's, so instead of 255 x 10^n granularity we now have
- 32767 x 10^n granularity. This also means more than 255000 gp can be
- dropped in one place. Not realistic, but it prevents a worthless
- annoyance. Who said games were supposed to be realistic?
-
-21. Termcap capability has been added to larn. If the symbol VT100 is defined
- in the makefile, the game will be compiled to use only VT100 compatible
- terminals (Much more efficient). If the symbol VT100 is omitted, the game
- will be compiled to use the termcap entry for whatever terminal you are
- using. This involves an extra layer of output interpretation, as every
- byte sent to the terminal must be inspected for control tokens.
- Only 3 termcap entries need be found for the game to be functional:
- CM (cursor movement), CE (clear to end of line), and CL (clear screen).
- For a better display, the following are optional: AL (insert line), DL
- (delete line), SO (Standout begin), SE (Standout end), and CD (clear to end
- of screen). The .larn.help file was left as is, with VT100 escape
- sequences in it. If the termcap version of larn reads it, it is translated
- for the desired terminal type. The .mail60* files have been removed, and
- their text is now included in bill.c so it can be used with any terminal.
- Note: If compiled for termcap, and using a VT100, the display will act
- a little different. This is because the VT100 does not have insert line/
- delete line codes, and the scrolling region must be simulated with vertical
- wraparound instead of scrolling. Thanks goes to Michiel Huisjes for the
- original termcap patch.
-
-22. When playing as wizard, if you go down stairs on 10 or V3, or up stairs
- on H, 1, or V1, etc. you would be placed in a phantom zone where the display
- was really weird ([-1] subscripting), and would eventually lead to a
- segmentation fault. Stairs and volcano shafts now check for the level
- they are being used on.
-
-23. In response to some sites having only unsigned chars (flame the
- manufacturer), the chars that were used to store positive and negative
- numbers have been changed to shorts. This includes diroffx[], diroffy[],
- iarg[][][], ivenarg[], and some others. I believe the changes are correct,
- but I have none of these machines to try it out on. (Volunteers?)
-
-24. The function fullhit(n) in monster.c was supposed to return the damage
- done by n full hits on a monster. It only returned the damage for ONE hit,
- thus severely limiting the usefulness of the web and sle spells.
-
-25. Someone said that they were getting segmentation faults when they were
- reading scrolls as the wizard. I couldn't find the problem, which may
- have had something to do with the signed char problem mentioned above.
- However, I've added a check in read_scroll() and quaff_potion() to trap
- any scroll or potion types that are not in the game.
-
-26. "vt125" has been added to the acceptable terminal list
- (checked only if compiled with -DVT100).
-
-27. In savegame() and restoregame(), there was a 6 hardwired into the i/o
- statements which assumed the size of struct cel was 6. On some machines
- this caused the rightmost part of each level to not be saved in a savefile.
- These 6's have been replaced with sizeof(struct cel), and should now be
- portable.
-
-28. The option "no-beep" has been added to the .larnopts file. When specified,
- beeping is inhibited at the terminal.
-
-29. When becoming wizard, no longer to you wear the ring of protection, and
- null scrolls and potions are no longer created.
-
-30. Many spelling errors have been fixed, both in player messages, and in the
- code itself. A thanks goes to Mars Gralia who sent me a detailed list of
- the mistakes.
-
-31. When a player wins a game, if getlogin() fails, a segmentation fault will
- result, because the NULL returned from getlogin() is used as a pointer.
- This call has been replaced (now using loginname already determined).
- Also, the mail creation upon winning has been rewritten, mainly to allow
- termcapping of the text.
-
-32. The Larn Revenue Service will now always appear on level H. Before, it
- was only created if the player had outstanding taxes. In that multiple
- save files per player are now more possible, this was seen as incorrect.
-
-33. Input buffer flushing is now in effect. If the input char queue exceeds
- 5 bytes, the excess is discarded. Also, if the player hits or gets hit
- all input bytes are flushed (within 1). This relieves the situation
- where many moves have been typed ahead of the display and the player keeps
- getting hit while the queue of moves is processed.
-
-34. When a savefile has been altered, a warning message is displayed to the
- effect that you've cheated, and you will not be placed on the normal
- scoreboard. If you then save the game, and start 'er up again, memory
- of the cheating was lost. This has been fixed, by letting the scoreboard
- routines consult the cheating flag. Also, the I node number of the
- savefile is written into the savefile, so cp'ing, etc., will avail the
- cheater not. If high security is needed, the game should be run suid.
- This suid mode has not been made the default because most installations
- do not want to install it that way.
-
-35. The sources have been run through lint, and most of lint's complaints have
- been taken care of. An attempt was made to adjust the code for 16 bit int
- machines. Many casts to long have been put in. I don't know if it will
- run on a 16 bitter, but it should be closer to that end.
-
-36. When larn starts up, if it can't find the scoreboard, it will now make a
- blank one instead of complaining that there is no scoreboard. It is not
- necessary to do "larn -c" to initially create the scoreboard.
-
-37. When listing out the logfile (larn -l), the error message "error reading
- from input file" has been fixed. Also, the date & time of a player's
- demise is now included in the logfile.
-
-38. When casting web or sle into a mirror, the game will no longer bash the
- player. Instead, the player will either fall asleep or get stuck in his
- web.
-
-39. Items like cookies, books, chests, swords of slashing, and Bessmann's
- flailing hammer can now be sold at the trading post.
-
diff --git a/games/larn/Makefile b/games/larn/Makefile
deleted file mode 100644
index b74886f..0000000
--- a/games/larn/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# @(#)Makefile 5.12 (Berkeley) 5/30/93
-# $FreeBSD$
-
-# EXTRA
-# Incorporates code to gather additional performance statistics
-# SYSV
-# Use system III/V (instead of V7) type ioctl calls
-# BSD
-# Use BSD specific features (mostly timer and signal stuff)
-# BSD4.1
-# Use BSD4.1 to avoid some 4.2 dependencies (must be used with
-# BSD above; do not mix with SYSV)
-# HIDEBYLINK
-# If defined, the program attempts to hide from ps
-# DOCHECKPOINTS
-# If not defined, checkpoint files are periodically written by the
-# larn process (no forking) if enabled in the .larnopts description
-# file. Checkpointing is handy on an unreliable system, but takes
-# CPU. Inclusion of DOCHECKPOINTS will cause fork()ing to perform the
-# checkpoints (again if enabled in the .larnopts file). This usually
-# avoids pauses in larn while the checkpointing is being done (on
-# large machines).
-# VER
-# This is the version of the software, example: 12
-# SUBVER
-# This is the revision of the software, example: 1
-# FLUSHNO=#
-# Set the input queue excess flushing threshold (default 5)
-# NOVARARGS
-# Define for systems that don't have varargs (a default varargs will
-# be used).
-# MACRORND
-# Define to use macro version of rnd() and rund() (fast and big)
-# UIDSCORE
-# Define to use user id's to manage scoreboard. Leaving this out will
-# cause player id's from the file ".playerids" to be used instead.
-# (.playerids is created upon demand). Only one entry per id # is
-# allowed in each scoreboard (winning & non-winning).
-# VT100
-# Compile for using vt100 family of terminals. Omission of this
-# define will cause larn to use termcap, but it will be MUCH slower
-# due to an extra layer of output interpretation. Also, only VT100
-# mode allows 2 different standout modes, inverse video, and bold video.
-# And only in VT100 mode is the scrolling region of the terminal used
-# (much nicer than insert/delete line sequences to simulate it, if
-# VT100 is omitted).
-# NONAP
-# This causes napms() to return immediately instead of delaying n
-# milliseconds. This define may be needed on some systems if the nap
-# stuff does not work correctly (possible hang). nap() is primarilly
-# used to delay for effect when casting missile type spells.
-# NOLOG
-# Turn off logging.
-
-PROG= larn
-MAN= larn.6
-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings
-SRCS= main.c object.c create.c tok.c display.c global.c data.c io.c \
- monster.c store.c diag.c help.c config.c nap.c bill.c scores.c \
- signal.c moreobj.c movem.c regen.c fortune.c savelev.c
-DPADD= ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD= -ltermcap -lcompat
-FILES= larnmaze larnopts larn.help
-FILESDIR= ${SHAREDIR}/games/larn
-HIDEGAME=hidegame
-
-.PATH: ${.CURDIR}/datfiles
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/larn/lscore12.0)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
- ${DESTDIR}/var/games/larn/lscore12.0
-.endif
-.if !exists(${DESTDIR}/var/games/larn/llog12.0)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
- ${DESTDIR}/var/games/larn/llog12.0
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/larn/OWNER b/games/larn/OWNER
deleted file mode 100644
index 06aaf47..0000000
--- a/games/larn/OWNER
+++ /dev/null
@@ -1,3 +0,0 @@
- Noah Morgan
- panda!condor!noah
- GenRad Inc. Bolton, MA
diff --git a/games/larn/README b/games/larn/README
deleted file mode 100644
index 71e477b..0000000
--- a/games/larn/README
+++ /dev/null
@@ -1,148 +0,0 @@
-Larn is a dungeon type game program. Larn is a adventure/action game similar
-in concept to rogue or hack, but with a much different feel.
-Try it, you'll like it!
-
-You will have to edit the Makefile to reflect your configuration. Define
-LARNHOME as the place where the larn auxiliary files will reside, and
-BINDIR as the place where the larn executable should be placed. Type
-"make" to compile, or "make all" to compile and install ("make install"
-does just the install).
-
-Here's a list of what is in each of the various source files:
-
-Fixed.Bugs this is a list of the things that were changed
- since ver 11.0
-Makefile makefile script to compile the program
-Make.lint makefile script to run larn sources through lint
-README this is what you are now reading
-bill.c code for the letters of praise if player wins
-config.c data definitions for the installation dependent data --
- savefilenames, where the scorefiles are, etc.
-create.c code to create the dungeon and all objects
-data.c data definitions for the game -- no code here
-diag.c code to produce diagnostic data for wizards, & savegame stuff
-display.c code to update the display on the screen
-fortune.c code for the fortune cookies
-global.c code for globally used functions that are specific to larn
-header.h constant and structure definitions
-help.c code for the help screens in the game of larn
-.holidays data file which lists upcoming holidays
-io.c code to handle file and terminal i/o
-.larn.help.uue larn help file (UUENCODED)
-.larnmaze data file for pre-made mazes
-.larnopts a sample .larnopts option data file
-.lfortune data file which contains the hints
-main.c code for the main command control and parsing
-monster.c code to handle attack and defense modes with monsters
-moreobj.c code for the fountains, altars, thrones
-movem.c code to move the monsters around the dungeon
-nap.c code to sleep for less than a second
-object.c code to handle objects in the dungeon
-regen.c code to regenerate the player and advance game time
-savelev.c code to get/put a level from level storage into working
- level memory
-scores.c code to process and manage the scoreboard
-signal.c code to handle UNIX signals that are trapped
-store.c code for the larn thrift shoppe, bank, trading post, lrs
-tok.c code for the input front end and options file processing
-
-To find out how to play the game, run it and type in a '?' to get the help
-screens. By the way, the wizards password is "pvnert(x)" and to become wizard
-type in an underscore, you are then prompted for the password. Wizards are
-non-scoring characters that get enlightenment, everlasting expanded
-awareness, and one of every object in the game. They help the author to debug
-the game.
-
-Note regarding the wizard id: If you are using userid's, then WIZID must be
-set to the userid of the person who can become wizard. If you are using
-player id's, WIZID must be set to the playerid (edit file .playerids if needed)
-of the player who can become wizard.
-
-You may want to clear out the scoreboard. The command "larn -c" will make a
-new scoreboard. It will prompt you for the wizards password.
-
-BUGS & FIXES:
-
-James McNamara has volunteered to maintain the latest sources, and provide
-latest bug fixes to anyone who asks. Both James and I will field requests for
-sources, for those who ask.
-
- ___ Prince of Gems (alias Noah Morgan)
- /. \ USENET: panda!condor!noah
- \ / at GenRad Inc. Bolton MA
- \ /
- v
-
-Below is some additional info about the installation of larn:
-
-Install: Notes on the game LARN installation.
-Larn is copyrighted 1986 by Noah Morgan.
-This file (below) originally by James D. McNamara, last update 7/27/86 by nm
-
-THIS DISTRIBUTION:
-
- You should receive six (6) shar files, which are:
-
- larn.part-1
- larn.part-2
- larn.part-3
- larn.part-4
- larn.part-5
- larn.part-6
-
-I. Use /bin/sh (or your system equivalent) to "unravel" shar files
- larn.part-1, ..., larn.part-6. I suggest you do this directly
- into $LARNHOME (See Section III.). Notable files:
-
- README - The author's how-to.
- MANIFEST - Files you should have.
-
-III. Edit a copy of "Makefile" and leave the edited version in $LARNHOME.
-
-All the "configuration" options are tidily near the top of the "Makefile."
-Here are the ones you probably will want to edit:
-
-LARNHOME I specified (literally) the directory, with path from root,
- where "larn" will reside. This included where I put the *.c files,
- it is where the *.o files ended up, as well as all data and *.h files.
- i suspect the *.c and intallation-documentation files can be moved off,
- but the data and bits must all remain here for execution.
-
-BINDIR I specified (literally) the directory, with path from root,
- where the executable "larn" will reside. The "Makefile" will dump
- the "a.out", named "larn", in this directory. My BINDIR was not
- my LARNHOME, so $BINDIR/larn was the ONLY file dumed here. You'll
- probably have to chmod it for public execute, etc.
-
-
-OPTIONS This is how *I* specified them... they are documented in-line:
- OPTIONS = -DWIZZARD -DWIZID=157 -DEXTRA -DBSD -DSAVEINHOME
-
-IV. Compile the bugger. Read "README" before you do. You have a couple
- of options here:
-
- make - will not install, suspect good for updates.
- make all - compile (and) intall
- make install - just install
-
- I did "make" and then "make install" -- seems to work "ok", but
- "make all" probably safer, if I had known. Note that "Makefile"
- is the default file for "make."
-
-V. Execute and have fun. If wizard code "ok", larn -c will refresh the
- scoreboard. Play and win (or get killed) to put somebody on the
- scoreboard.
-
-VI. BUGS and FIXES.
-
- Please forward any bug-fixes in these regards to me (or Noah), so I may
- compile a fix-list for other installers. Thanks.
-
-Regards,
-===============================================================================
-James D. McNamara CSNET: jim@bu-cs
- ARPANET: jim%bu-cs@csnet-relay
- UUCP: ...harvard!bu-cs!jim
- BITNET: jim%bu-cs%csnet-relay.arpa@wiscvm
-===============================================================================
-
diff --git a/games/larn/bill.c b/games/larn/bill.c
deleted file mode 100644
index eff826d..0000000
--- a/games/larn/bill.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)bill.c 5.2 (Berkeley) 5/28/91";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#include "header.h"
-
-/* bill.c Larn is copyrighted 1986 by Noah Morgan. */
-
-char *mail[] = {
- "From: dev-null (the LRS - Larn Revenue Service)\n",
- "Subject: undeclared income\n",
- "\n We have heard you survived the caverns of Larn. Let me be the",
- "\nfirst to congratulate you on your success. It was quite a feat.",
- "\nIt was also very profitable for you...",
- "\n\n The Dungeon Master has informed us that you brought",
- "1",
- "\ncounty of Larn is in dire need of funds, we have spared no time",
- "2",
- "\nof this notice, and is due within 5 days. Failure to pay will",
- "\nmean penalties. Once again, congratulations, We look forward",
- "\nto your future successful expeditions.\n",
- NULL,
- "From: dev-null (His Majesty King Wilfred of Larndom)\n",
- "Subject: a noble deed\n",
- "\n I have heard of your magnificent feat, and I, King Wilfred,",
- "\nforthwith declare today to be a national holiday. Furthermore,",
- "\nhence three days, ye be invited to the castle to receive the",
- "\nhonour of Knight of the realm. Upon thy name shall it be written...",
- "\n\nBravery and courage be yours.",
- "\n\nMay you live in happiness forevermore...\n",
- NULL,
- "From: dev-null (Count Endelford)\n",
- "Subject: You Bastard!\n",
- "\n I have heard (from sources) of your journey. Congratulations!",
- "\nYou Bastard! With several attempts I have yet to endure the",
- " caves,\nand you, a nobody, makes the journey! From this time",
- " onward, bewarned\nupon our meeting you shall pay the price!\n",
- NULL,
- "From: dev-null (Mainair, Duke of Larnty)\n",
- "Subject: High Praise\n",
- "\n With certainty, a hero I declare to be amongst us! A nod of",
- "\nfavour I send to thee. Me thinks Count Endelford this day of",
- "\nright breath'eth fire as of dragon of whom ye are slayer. I",
- "\nyearn to behold his anger and jealously. Should ye choose to",
- "\nunleash some of thy wealth upon those who be unfortunate, I,",
- "\nDuke Mainair, shall equal thy gift also.\n",
- NULL,
- "From: dev-null (St. Mary's Children's Home)\n",
- "Subject: these poor children\n",
- "\n News of your great conquests has spread to all of Larndom.",
- "\nMight I have a moment of a great adventurers's time? We here at",
- "\nSt. Mary's Children's Home are very poor, and many children are",
- "\nstarving. Disease is widespread and very often fatal without",
- "\ngood food. Could you possibly find it in your heart to help us",
- "\nin our plight? Whatever you could give will help much.",
- "\n(your gift is tax deductible)\n",
- NULL,
- "From: dev-null (The National Cancer Society of Larn)\n",
- "Subject: hope\n",
- "\nCongratulations on your successful expedition. We are sure much",
- "\ncourage and determination were needed on your quest. There are",
- "\nmany though, that could never hope to undertake such a journey",
- "\ndue to an enfeebling disease -- cancer. We at the National",
- "\nCancer Society of Larn wish to appeal to your philanthropy in",
- "\norder to save many good people -- possibly even yourself a few",
- "\nyears from now. Much work needs to be done in researching this",
- "\ndreaded disease, and you can help today. Could you please see it",
- "\nin your heart to give generously? Your continued good health",
- "\ncan be your everlasting reward.\n",
- NULL
-};
-
-/*
- * function to mail the letters to the player if a winner
- */
-
-void
-mailbill()
-{
- int i;
- char fname[32];
- char buf[128];
- char **cp;
- int fd;
-
- wait(0);
- if (fork() == 0) {
- resetscroll();
- cp = mail;
- sprintf(fname, "/tmp/#%dlarnmail", getpid());
- for (i = 0; i < 6; i++) {
- if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT),
- 0660) == -1)
- exit(0);
- while (*cp != NULL) {
- if (*cp[0] == '1') {
- sprintf(buf, "\n%ld gold pieces back with you from your journey. As the",
- (long)c[GOLD]);
- write(fd, buf, strlen(buf));
- } else if (*cp[0] == '2') {
- sprintf(buf, "\nin preparing your tax bill. You owe %ld gold pieces as", (long)c[GOLD]*TAXRATE);
- write(fd, buf, strlen(buf));
- } else
- write(fd, *cp, strlen(*cp));
- cp++;
- }
- cp++;
-
- close(fd);
- sprintf(buf, "/usr/sbin/sendmail %s < %s > /dev/null",
- loginname, fname);
- system(buf);
- unlink(fname);
- }
- }
- exit(0);
-}
diff --git a/games/larn/config.c b/games/larn/config.c
deleted file mode 100644
index ccdd6d5..0000000
--- a/games/larn/config.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * config.c -- This defines the installation dependent variables.
- * Some strings are modified later. ANSI C would
- * allow compile time string concatenation, we must
- * do runtime concatenation, in main.
- *
- * Larn is copyrighted 1986 by Noah Morgan.
- */
-#include "header.h"
-#include "pathnames.h"
-
-/*
- * All these strings will be appended to in main() to be complete filenames
- */
-
-/* the game save filename */
-char savefilename[1024];
-
-/* the logging file */
-char logfile[] = _PATH_LOG;
-
-/* the help text file */
-char helpfile[] = _PATH_HELP;
-
-/* the score file */
-char scorefile[] = _PATH_SCORE;
-
-/* the maze data file */
-char larnlevels[] = _PATH_LEVELS;
-
-/* the fortune data file */
-char fortfile[] = _PATH_FORTS;
-
-/* the .larnopts filename */
-char optsfile[1024] ="/.larnopts";
-
-/* the player id datafile name */
-char playerids[] = _PATH_PLAYERIDS;
-
-char diagfile[] ="Diagfile"; /* the diagnostic filename */
-char ckpfile[] ="Larn12.0.ckp"; /* the checkpoint filename */
-char *password ="pvnert(x)"; /* the wizards password <=32 */
-char psname[PSNAMESIZE]="larn"; /* the process name */
-
-#define WIZID 1
-int wisid=0; /* the user id of the only person who can be wizard */
-
diff --git a/games/larn/create.c b/games/larn/create.c
deleted file mode 100644
index 1bfa1ee..0000000
--- a/games/larn/create.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/* create.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-extern char spelknow[],larnlevels[];
-extern char beenhere[],wizard,level;
-extern short oldx,oldy;
-/*
- makeplayer()
-
- subroutine to create the player and the players attributes
- this is called at the beginning of a game and at no other time
- */
-makeplayer()
- {
- int i;
- scbr(); clear();
- c[HPMAX]=c[HP]=10; /* start player off with 15 hit points */
- c[LEVEL]=1; /* player starts at level one */
- c[SPELLMAX]=c[SPELLS]=1; /* total # spells starts off as 3 */
- c[REGENCOUNTER]=16; c[ECOUNTER]=96; /*start regeneration correctly*/
- c[SHIELD] = c[WEAR] = c[WIELD] = -1;
- for (i=0; i<26; i++) iven[i]=0;
- spelknow[0]=spelknow[1]=1; /*he knows protection, magic missile*/
- if (c[HARDGAME]<=0)
- {
- iven[0]=OLEATHER; iven[1]=ODAGGER;
- ivenarg[1]=ivenarg[0]=c[WEAR]=0; c[WIELD]=1;
- }
- playerx=rnd(MAXX-2); playery=rnd(MAXY-2);
- oldx=0; oldy=25;
- gtime=0; /* time clock starts at zero */
- cbak[SPELLS] = -50;
- for (i=0; i<6; i++) c[i]=12; /* make the attributes, ie str, int, etc. */
- recalc();
- }
-
-/*
- newcavelevel(level)
- int level;
-
- function to enter a new level. This routine must be called anytime the
- player changes levels. If that level is unknown it will be created.
- A new set of monsters will be created for a new level, and existing
- levels will get a few more monsters.
- Note that it is here we remove genocided monsters from the present level.
- */
-newcavelevel(x)
- int x;
- {
- int i,j;
- if (beenhere[level]) savelevel(); /* put the level back into storage */
- level = x; /* get the new level and put in working storage */
- if (beenhere[x]==0) for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=mitem[j][i]=0;
- else { getlevel(); sethp(0); goto chgn; }
- makemaze(x); makeobject(x); beenhere[x]=1; sethp(1);
-
-#if WIZID
- if (wizard || x==0)
-#else
- if (x==0)
-#endif
-
- for (j=0; j<MAXY; j++)
- for (i=0; i<MAXX; i++)
- know[i][j]=1;
-chgn: checkgen(); /* wipe out any genocided monsters */
- }
-
-/*
- makemaze(level)
- int level;
-
- subroutine to make the caverns for a given level. only walls are made.
- */
-static int mx,mxl,mxh,my,myl,myh,tmp2;
- makemaze(k)
- int k;
- {
- int i,j,tmp;
- int z;
- if (k > 1 && (rnd(17)<=4 || k==MAXLEVEL-1 || k==MAXLEVEL+MAXVLEVEL-1))
- {
- if (cannedlevel(k)); return; /* read maze from data file */
- }
- if (k==0) tmp=0; else tmp=OWALL;
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) item[j][i]=tmp;
- if (k==0) return; eat(1,1);
- if (k==1) item[33][MAXY-1]=0; /* exit from dungeon */
-
-/* now for open spaces -- not on level 10 */
- if (k != MAXLEVEL-1)
- {
- tmp2 = rnd(3)+3;
- for (tmp=0; tmp<tmp2; tmp++)
- {
- my = rnd(11)+2; myl = my - rnd(2); myh = my + rnd(2);
- if (k < MAXLEVEL)
- {
- mx = rnd(44)+5; mxl = mx - rnd(4); mxh = mx + rnd(12)+3;
- z=0;
- }
- else
- {
- mx = rnd(60)+3; mxl = mx - rnd(2); mxh = mx + rnd(2);
- z = makemonst(k);
- }
- for (i=mxl; i<mxh; i++) for (j=myl; j<myh; j++)
- { item[i][j]=0;
- if ((mitem[i][j]=z)) hitp[i][j]=monster[z].hitpoints;
- }
- }
- }
- if (k!=MAXLEVEL-1) { my=rnd(MAXY-2); for (i=1; i<MAXX-1; i++) item[i][my] = 0; }
- if (k>1) treasureroom(k);
- }
-
-/*
- function to eat away a filled in maze
- */
-eat(xx,yy)
- int xx,yy;
- {
- int dir,try;
- dir = rnd(4); try=2;
- while (try)
- {
- switch(dir)
- {
- case 1: if (xx <= 2) break; /* west */
- if ((item[xx-1][yy]!=OWALL) || (item[xx-2][yy]!=OWALL)) break;
- item[xx-1][yy] = item[xx-2][yy] = 0;
- eat(xx-2,yy); break;
-
- case 2: if (xx >= MAXX-3) break; /* east */
- if ((item[xx+1][yy]!=OWALL) || (item[xx+2][yy]!=OWALL)) break;
- item[xx+1][yy] = item[xx+2][yy] = 0;
- eat(xx+2,yy); break;
-
- case 3: if (yy <= 2) break; /* south */
- if ((item[xx][yy-1]!=OWALL) || (item[xx][yy-2]!=OWALL)) break;
- item[xx][yy-1] = item[xx][yy-2] = 0;
- eat(xx,yy-2); break;
-
- case 4: if (yy >= MAXY-3 ) break; /* north */
- if ((item[xx][yy+1]!=OWALL) || (item[xx][yy+2]!=OWALL)) break;
- item[xx][yy+1] = item[xx][yy+2] = 0;
- eat(xx,yy+2); break;
- };
- if (++dir > 4) { dir=1; --try; }
- }
- }
-
-/*
- * function to read in a maze from a data file
- *
- * Format of maze data file: 1st character = # of mazes in file (ascii digit)
- * For each maze: 18 lines (1st 17 used) 67 characters per line
- *
- * Special characters in maze data file:
- *
- * # wall D door . random monster
- * ~ eye of larn ! cure dianthroritis
- * - random object
- */
-cannedlevel(k)
- int k;
- {
- char *row,*lgetl();
- int i,j;
- int it,arg,mit,marg;
- if (lopen(larnlevels)<0)
- {
- write(1,"Can't open the maze data file\n",30); died(-282); return(0);
- }
- i=lgetc(); if (i<='0') { died(-282); return(0); }
- for (i=18*rund(i-'0'); i>0; i--) lgetl(); /* advance to desired maze */
- for (i=0; i<MAXY; i++)
- {
- row = lgetl();
- for (j=0; j<MAXX; j++)
- {
- it = mit = arg = marg = 0;
- switch(*row++)
- {
- case '#': it = OWALL; break;
- case 'D': it = OCLOSEDDOOR; arg = rnd(30); break;
- case '~': if (k!=MAXLEVEL-1) break;
- it = OLARNEYE;
- mit = rund(8)+DEMONLORD;
- marg = monster[mit].hitpoints; break;
- case '!': if (k!=MAXLEVEL+MAXVLEVEL-1) break;
- it = OPOTION; arg = 21;
- mit = DEMONLORD+7;
- marg = monster[mit].hitpoints; break;
- case '.': if (k<MAXLEVEL) break;
- mit = makemonst(k+1);
- marg = monster[mit].hitpoints; break;
- case '-': it = newobject(k+1,&arg); break;
- };
- item[j][i] = it; iarg[j][i] = arg;
- mitem[j][i] = mit; hitp[j][i] = marg;
-
-#if WIZID
- know[j][i] = (wizard) ? 1 : 0;
-#else
- know[j][i] = 0;
-#endif
- }
- }
- lrclose();
- return(1);
- }
-
-/*
- function to make a treasure room on a level
- level 10's treasure room has the eye in it and demon lords
- level V3 has potion of cure dianthroritis and demon prince
- */
-treasureroom(lv)
- int lv;
- {
- int tx,ty,xsize,ysize;
-
- for (tx=1+rnd(10); tx<MAXX-10; tx+=10)
- if ( (lv==MAXLEVEL-1) || (lv==MAXLEVEL+MAXVLEVEL-1) || rnd(13)==2)
- {
- xsize = rnd(6)+3; ysize = rnd(3)+3;
- ty = rnd(MAXY-9)+1; /* upper left corner of room */
- if (lv==MAXLEVEL-1 || lv==MAXLEVEL+MAXVLEVEL-1)
- troom(lv,xsize,ysize,tx=tx+rnd(MAXX-24),ty,rnd(3)+6);
- else troom(lv,xsize,ysize,tx,ty,rnd(9));
- }
- }
-
-/*
- * subroutine to create a treasure room of any size at a given location
- * room is filled with objects and monsters
- * the coordinate given is that of the upper left corner of the room
- */
-troom(lv,xsize,ysize,tx,ty,glyph)
- int lv,xsize,ysize,tx,ty,glyph;
- {
- int i,j;
- int tp1,tp2;
- for (j=ty-1; j<=ty+ysize; j++)
- for (i=tx-1; i<=tx+xsize; i++) /* clear out space for room */
- item[i][j]=0;
- for (j=ty; j<ty+ysize; j++)
- for (i=tx; i<tx+xsize; i++) /* now put in the walls */
- {
- item[i][j]=OWALL; mitem[i][j]=0;
- }
- for (j=ty+1; j<ty+ysize-1; j++)
- for (i=tx+1; i<tx+xsize-1; i++) /* now clear out interior */
- item[i][j]=0;
-
- switch(rnd(2)) /* locate the door on the treasure room */
- {
- case 1: item[i=tx+rund(xsize)][j=ty+(ysize-1)*rund(2)]=OCLOSEDDOOR;
- iarg[i][j] = glyph; /* on horizontal walls */
- break;
- case 2: item[i=tx+(xsize-1)*rund(2)][j=ty+rund(ysize)]=OCLOSEDDOOR;
- iarg[i][j] = glyph; /* on vertical walls */
- break;
- };
-
- tp1=playerx; tp2=playery; playery=ty+(ysize>>1);
- if (c[HARDGAME]<2)
- for (playerx=tx+1; playerx<=tx+xsize-2; playerx+=2)
- for (i=0, j=rnd(6); i<=j; i++)
- { something(lv+2); createmonster(makemonst(lv+1)); }
- else
- for (playerx=tx+1; playerx<=tx+xsize-2; playerx+=2)
- for (i=0, j=rnd(4); i<=j; i++)
- { something(lv+2); createmonster(makemonst(lv+3)); }
-
- playerx=tp1; playery=tp2;
- }
-
-static void fillroom();
-
-/*
- ***********
- MAKE_OBJECT
- ***********
- subroutine to create the objects in the maze for the given level
- */
-makeobject(j)
- int j;
- {
- int i;
- if (j==0)
- {
- fillroom(OENTRANCE,0); /* entrance to dungeon */
- fillroom(ODNDSTORE,0); /* the DND STORE */
- fillroom(OSCHOOL,0); /* college of Larn */
- fillroom(OBANK,0); /* 1st national bank of larn */
- fillroom(OVOLDOWN,0); /* volcano shaft to temple */
- fillroom(OHOME,0); /* the players home & family */
- fillroom(OTRADEPOST,0); /* the trading post */
- fillroom(OLRS,0); /* the larn revenue service */
- return;
- }
-
- if (j==MAXLEVEL) fillroom(OVOLUP,0); /* volcano shaft up from the temple */
-
-/* make the fixed objects in the maze STAIRS */
- if ((j>0) && (j != MAXLEVEL-1) && (j != MAXLEVEL+MAXVLEVEL-1))
- fillroom(OSTAIRSDOWN,0);
- if ((j > 1) && (j != MAXLEVEL)) fillroom(OSTAIRSUP,0);
-
-/* make the random objects in the maze */
-
- fillmroom(rund(3),OBOOK,j); fillmroom(rund(3),OALTAR,0);
- fillmroom(rund(3),OSTATUE,0); fillmroom(rund(3),OPIT,0);
- fillmroom(rund(3),OFOUNTAIN,0); fillmroom( rnd(3)-2,OIVTELETRAP,0);
- fillmroom(rund(2),OTHRONE,0); fillmroom(rund(2),OMIRROR,0);
- fillmroom(rund(2),OTRAPARROWIV,0); fillmroom( rnd(3)-2,OIVDARTRAP,0);
- fillmroom(rund(3),OCOOKIE,0);
- if (j==1) fillmroom(1,OCHEST,j);
- else fillmroom(rund(2),OCHEST,j);
- if ((j != MAXLEVEL-1) && (j != MAXLEVEL+MAXVLEVEL-1))
- fillmroom(rund(2),OIVTRAPDOOR,0);
- if (j<=10)
- {
- fillmroom((rund(2)),ODIAMOND,rnd(10*j+1)+10);
- fillmroom(rund(2),ORUBY,rnd(6*j+1)+6);
- fillmroom(rund(2),OEMERALD,rnd(4*j+1)+4);
- fillmroom(rund(2),OSAPPHIRE,rnd(3*j+1)+2);
- }
- for (i=0; i<rnd(4)+3; i++)
- fillroom(OPOTION,newpotion()); /* make a POTION */
- for (i=0; i<rnd(5)+3; i++)
- fillroom(OSCROLL,newscroll()); /* make a SCROLL */
- for (i=0; i<rnd(12)+11; i++)
- fillroom(OGOLDPILE,12*rnd(j+1)+(j<<3)+10); /* make GOLD */
- if (j==5) fillroom(OBANK2,0); /* branch office of the bank */
- froom(2,ORING,0); /* a ring mail */
- froom(1,OSTUDLEATHER,0); /* a studded leather */
- froom(3,OSPLINT,0); /* a splint mail */
- froom(5,OSHIELD,rund(3)); /* a shield */
- froom(2,OBATTLEAXE,rund(3)); /* a battle axe */
- froom(5,OLONGSWORD,rund(3)); /* a long sword */
- froom(5,OFLAIL,rund(3)); /* a flail */
- froom(4,OREGENRING,rund(3)); /* ring of regeneration */
- froom(1,OPROTRING,rund(3)); /* ring of protection */
- froom(2,OSTRRING,4); /* ring of strength + 4 */
- froom(7,OSPEAR,rnd(5)); /* a spear */
- froom(3,OORBOFDRAGON,0); /* orb of dragon slaying*/
- froom(4,OSPIRITSCARAB,0); /*scarab of negate spirit*/
- froom(4,OCUBEofUNDEAD,0); /* cube of undead control */
- froom(2,ORINGOFEXTRA,0); /* ring of extra regen */
- froom(3,ONOTHEFT,0); /* device of antitheft */
- froom(2,OSWORDofSLASHING,0); /* sword of slashing */
- if (c[BESSMANN]==0)
- {
- froom(4,OHAMMER,0);/*Bessman's flailing hammer*/ c[BESSMANN]=1;
- }
- if (c[HARDGAME]<3 || (rnd(4)==3))
- {
- if (j>3)
- {
- froom(3,OSWORD,3); /* sunsword + 3 */
- froom(5,O2SWORD,rnd(4)); /* a two handed sword */
- froom(3,OBELT,4); /* belt of striking */
- froom(3,OENERGYRING,3); /* energy ring */
- froom(4,OPLATE,5); /* platemail + 5 */
- }
- }
- }
-
-/*
- subroutine to fill in a number of objects of the same kind
- */
-
-fillmroom(n,what,arg)
- int n,arg;
- char what;
- {
- int i;
- for (i=0; i<n; i++) fillroom(what,arg);
- }
-froom(n,itm,arg)
- int n,arg;
- char itm;
- { if (rnd(151) < n) fillroom(itm,arg); }
-
-/*
- subroutine to put an object into an empty room
- * uses a random walk
- */
-static void
-fillroom(what,arg)
- int arg;
- char what;
- {
- int x,y;
-
-#ifdef EXTRA
- c[FILLROOM]++;
-#endif
-
- x=rnd(MAXX-2); y=rnd(MAXY-2);
- while (item[x][y])
- {
-
-#ifdef EXTRA
- c[RANDOMWALK]++; /* count up these random walks */
-#endif
-
- x += rnd(3)-2; y += rnd(3)-2;
- if (x > MAXX-2) x=1; if (x < 1) x=MAXX-2;
- if (y > MAXY-2) y=1; if (y < 1) y=MAXY-2;
- }
- item[x][y]=what; iarg[x][y]=arg;
- }
-
-/*
- subroutine to put monsters into an empty room without walls or other
- monsters
- */
-fillmonst(what)
- char what;
- {
- int x,y,trys;
- for (trys=5; trys>0; --trys) /* max # of creation attempts */
- {
- x=rnd(MAXX-2); y=rnd(MAXY-2);
- if ((item[x][y]==0) && (mitem[x][y]==0) && ((playerx!=x) || (playery!=y)))
- {
- mitem[x][y] = what; know[x][y]=0;
- hitp[x][y] = monster[what].hitpoints; return(0);
- }
- }
- return(-1); /* creation failure */
- }
-
-/*
- creates an entire set of monsters for a level
- must be done when entering a new level
- if sethp(1) then wipe out old monsters else leave them there
- */
-sethp(flg)
- int flg;
- {
- int i,j;
- if (flg) for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) stealth[j][i]=0;
- if (level==0) { c[TELEFLAG]=0; return; } /* if teleported and found level 1 then know level we are on */
- if (flg) j = rnd(12) + 2 + (level>>1); else j = (level>>1) + 1;
- for (i=0; i<j; i++) fillmonst(makemonst(level));
- positionplayer();
- }
-
-/*
- * Function to destroy all genocided monsters on the present level
- */
-checkgen()
- {
- int x,y;
- for (y=0; y<MAXY; y++)
- for (x=0; x<MAXX; x++)
- if (monster[mitem[x][y]].genocided)
- mitem[x][y]=0; /* no more monster */
- }
diff --git a/games/larn/data.c b/games/larn/data.c
deleted file mode 100644
index a09d55c..0000000
--- a/games/larn/data.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*-
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)data.c 5.3 (Berkeley) 5/13/91";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* data.c Larn is copyrighted 1986 by Noah Morgan. */
-#define NODEFS
-#include "header.h"
-
-/*
- class[c[LEVEL]-1] gives the correct name of the players experience level
- */
-static char aa1[] = " mighty evil master";
-static char aa2[] = "apprentice demi-god";
-static char aa3[] = " minor demi-god ";
-static char aa4[] = " major demi-god ";
-static char aa5[] = " minor deity ";
-static char aa6[] = " major deity ";
-static char aa7[] = " novice guardian ";
-static char aa8[] = "apprentice guardian";
-static char aa9[] = " The Creator ";
-char *class[]=
-{ " novice explorer ", "apprentice explorer", " practiced explorer",/* -3*/
- " expert explorer ", " novice adventurer", " adventurer ",/* -6*/
- "apprentice conjurer", " conjurer ", " master conjurer ",/* -9*/
- " apprentice mage ", " mage ", " experienced mage ",/* -12*/
- " master mage ", " apprentice warlord", " novice warlord ",/* -15*/
- " expert warlord ", " master warlord ", " apprentice gorgon ",/* -18*/
- " gorgon ", " practiced gorgon ", " master gorgon ",/* -21*/
- " demi-gorgon ", " evil master ", " great evil master ",/* -24*/
- aa1 , aa1 , aa1 ,/* -27*/
- aa1 , aa1 , aa1 ,/* -30*/
- aa1 , aa1 , aa1 ,/* -33*/
- aa1 , aa1 , aa1 ,/* -36*/
- aa1 , aa1 , aa1 ,/* -39*/
- aa2 , aa2 , aa2 ,/* -42*/
- aa2 , aa2 , aa2 ,/* -45*/
- aa2 , aa2 , aa2 ,/* -48*/
- aa3 , aa3 , aa3 ,/* -51*/
- aa3 , aa3 , aa3 ,/* -54*/
- aa3 , aa3 , aa3 ,/* -57*/
- aa4 , aa4 , aa4 ,/* -60*/
- aa4 , aa4 , aa4 ,/* -63*/
- aa4 , aa4 , aa4 ,/* -66*/
- aa5 , aa5 , aa5 ,/* -69*/
- aa5 , aa5 , aa5 ,/* -72*/
- aa5 , aa5 , aa5 ,/* -75*/
- aa6 , aa6 , aa6 ,/* -78*/
- aa6 , aa6 , aa6 ,/* -81*/
- aa6 , aa6 , aa6 ,/* -84*/
- aa7 , aa7 , aa7 ,/* -87*/
- aa8 , aa8 , aa8 ,/* -90*/
- aa8 , aa8 , aa8 ,/* -93*/
- " earth guardian ", " air guardian ", " fire guardian ",/* -96*/
- " water guardian ", " time guardian ", " ethereal guardian ",/* -99*/
- aa9 , aa9 , aa9 ,/* -102*/
-};
-
-/*
- table of experience needed to be a certain level of player
- skill[c[LEVEL]] is the experience required to attain the next level
- */
-#define MEG 1000000
-long skill[] = {
-0, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, /* 1-11 */
-10240, 20480, 40960, 100000, 200000, 400000, 700000, 1*MEG, /* 12-19 */
-2*MEG,3*MEG,4*MEG,5*MEG,6*MEG,8*MEG,10*MEG, /* 20-26 */
-12*MEG,14*MEG,16*MEG,18*MEG,20*MEG,22*MEG,24*MEG,26*MEG,28*MEG, /* 27-35 */
-30*MEG,32*MEG,34*MEG,36*MEG,38*MEG,40*MEG,42*MEG,44*MEG,46*MEG, /* 36-44 */
-48*MEG,50*MEG,52*MEG,54*MEG,56*MEG,58*MEG,60*MEG,62*MEG,64*MEG, /* 45-53 */
-66*MEG,68*MEG,70*MEG,72*MEG,74*MEG,76*MEG,78*MEG,80*MEG,82*MEG, /* 54-62 */
-84*MEG,86*MEG,88*MEG,90*MEG,92*MEG,94*MEG,96*MEG,98*MEG,100*MEG, /* 63-71 */
-105*MEG,110*MEG,115*MEG,120*MEG, 125*MEG, 130*MEG, 135*MEG, 140*MEG, /* 72-79 */
-145*MEG,150*MEG,155*MEG,160*MEG, 165*MEG, 170*MEG, 175*MEG, 180*MEG, /* 80-87 */
-185*MEG,190*MEG,195*MEG,200*MEG, 210*MEG, 220*MEG, 230*MEG, 240*MEG, /* 88-95 */
-250*MEG,260*MEG,270*MEG,280*MEG, 290*MEG, 300*MEG /* 96-101*/
-};
-#undef MEG
-
-char *lpbuf,*lpnt,*inbuffer,*lpend; /* input/output pointers to the buffers */
-struct cel *cell; /* pointer to the dungeon storage */
-short hitp[MAXX][MAXY]; /* monster hp on level */
-short iarg[MAXX][MAXY]; /* arg for the item array */
-char item[MAXX][MAXY]; /* objects in maze if any */
-char know[MAXX][MAXY]; /* 1 or 0 if here before */
-char mitem[MAXX][MAXY]; /* monster item array */
-char moved[MAXX][MAXY]; /* monster movement flags */
-char stealth[MAXX][MAXY]; /* 0=sleeping 1=awake monst*/
-char iven[26]; /* inventory for player */
-short ivenarg[26]; /* inventory for player */
-char lastmonst[40]; /* this has the name of the current monster */
-char beenhere[MAXLEVEL+MAXVLEVEL]={0}; /* 1 if have been on this level */
-char VERSION=VER; /* this is the present version # of the program */
-char SUBVERSION=SUBVER;
-char nosignal=0; /* set to 1 to disable the signals from doing anything */
-char predostuff=0; /* 2 means that the trap handling routines must do a
- showplayer() after a trap. 0 means don't showplayer()
- 0 - we are in create player screen
- 1 - we are in welcome screen
- 2 - we are in the normal game */
-char loginname[20]; /* players login name */
-char logname[LOGNAMESIZE]; /* players name storage for scoring */
-char sex=1; /* default is a man 0=woman */
-char boldon=1; /* 1=bold objects 0=inverse objects */
-char ckpflag=0; /* 1 if want checkpointing of game, 0 otherwise */
-char cheat=0; /* 1 if the player has fudged save file */
-char level=0; /* cavelevel player is on = c[CAVELEVEL] */
-char wizard=0; /* the wizard mode flag */
-short lastnum=0; /* the number of the monster last hitting player */
-short hitflag=0; /* flag for if player has been hit when running */
-short hit2flag=0; /* flag for if player has been hit when running */
-short hit3flag=0; /* flag for if player has been hit flush input */
-short playerx,playery; /* the room on the present level of the player */
-short lastpx,lastpy; /* 0 --- MAXX-1 or 0 --- MAXY-1 */
-short oldx,oldy;
-short lasthx=0,lasthy=0; /* location of monster last hit by player */
-short nobeep=0; /* true if program is not to beep */
-/* unsigned long randx=33601; /* the random number seed */
-time_t initialtime=0; /* time playing began */
-long gtime=0; /* the clock for the game */
-long outstanding_taxes=0; /* present tax bill from score file */
-long c[100],cbak[100]; /* the character description arrays */
-int enable_scroll=0; /* constant for enabled/disabled scrolling regn */
-char aborted[] = " aborted";
-struct sphere *spheres=0; /*pointer to linked list for spheres of annihilation*/
-char *levelname[]=
-{ " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
-
-char objnamelist[]=" ATOP%^F&^+M=%^$$f*OD#~][[)))(((||||||||{?!BC}o:@.<<<<EVV))([[]]](^ [H*** ^^ S tsTLc............................................";
-char monstnamelist[]=" BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV pqsyUkMwDDPxnDDuD ...............................................................";
-char *objectname[]=
-{ 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
- "a staircase leading upwards","an elevator going up","a bubbling fountain",
- "a great marble statue","a teleport trap","the college of Larn",
- "a mirror","the DND store","a staircase going down","an elevator going down",
- "the bank of Larn","the 5th branch of the Bank of Larn",
- "a dead fountain","gold","an open door","a closed door",
- "a wall","The Eye of Larn","plate mail","chain mail","leather armor",
- "a sword of slashing","Bessman's flailing hammer","a sunsword",
- "a two handed sword","a spear","a dagger",
- "ring of extra regeneration","a ring of regeneration","a ring of protection",
- "an energy ring","a ring of dexterity","a ring of strength",
- "a ring of cleverness","a ring of increase damage","a belt of striking",
- "a magic scroll","a magic potion","a book","a chest",
- "an amulet of invisibility","an orb of dragon slaying",
- "a scarab of negate spirit","a cube of undead control",
- "device of theft prevention","a brilliant diamond","a ruby",
- "an enchanting emerald","a sparkling sapphire","the dungeon entrance",
- "a volcanic shaft leaning downward","the base of a volcanic shaft",
- "a battle axe","a longsword","a flail","ring mail","studded leather armor",
- "splint mail","plate armor","stainless plate armor","a lance of death",
- "an arrow trap","an arrow trap","a shield","your home",
- "gold","gold","gold","a dart trap",
- "a dart trap","a trapdoor","a trapdoor","the local trading post",
- "a teleport trap", "a massive throne",
- "a sphere of annihilation","a handsome jewel encrusted throne",
- "the Larn Revenue Service","a fortune cookie","","","","","","",
- "","","","","","","","","","","","","","","","","","","",""
- };
-
-
-/*
- * for the monster data
- *
- * array to do rnd() to create monsters <= a given level
- */
-char monstlevel[] = { 5, 11, 17, 22, 27, 33, 39, 42, 46, 50, 53, 56, 59 };
-
-struct monst monster[] = {
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
------------------------------------------------------------------ */
-{ "", 0, 0, 0, 0, 0, 0, 3, 0, 0, 0 },
-{ "bat", 1, 0, 1, 0, 0, 0, 3, 0, 1, 1 },
-{ "gnome", 1, 10, 1, 0, 0, 0, 8, 30, 2, 2 },
-{ "hobgoblin", 1, 14, 2, 0, 0, 0, 5, 25, 3, 2 },
-{ "jackal", 1, 17, 1, 0, 0, 0, 4, 0, 1, 1 },
-{ "kobold", 1, 20, 1, 0, 0, 0, 7, 10, 1, 1 },
-
-{ "orc", 2, 12, 1, 0, 0, 0, 9, 40, 4, 2 },
-{ "snake", 2, 15, 1, 0, 0, 0, 3, 0, 3, 1 },
-{ "giant centipede",2, 14, 0, 4, 0, 0, 3, 0, 1, 2 },
-{ "jaculi", 2, 20, 1, 0, 0, 0, 3, 0, 2, 1 },
-{ "troglodyte", 2, 10, 2, 0, 0, 0, 5, 80, 4, 3 },
-{ "giant ant", 2, 8, 1, 4, 0, 0, 4, 0, 5, 5 },
-
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
------------------------------------------------------------------ */
-
-{ "floating eye", 3, 8, 1, 0, 0, 0, 3, 0, 5, 2 },
-{ "leprechaun", 3, 3, 0, 8, 0, 0, 3,1500, 13, 45 },
-{ "nymph", 3, 3, 0, 14, 0, 0, 9, 0, 18, 45 },
-{ "quasit", 3, 5, 3, 0, 0, 0, 3, 0, 10, 15 },
-{ "rust monster", 3, 4, 0, 1, 0, 0, 3, 0, 18, 25 },
-{ "zombie", 3, 12, 2, 0, 0, 0, 3, 0, 6, 7 },
-
-{ "assassin bug", 4, 9, 3, 0, 0, 0, 3, 0, 20, 15 },
-{ "bugbear", 4, 5, 4, 15, 0, 0, 5, 40, 20, 35 },
-{ "hell hound", 4, 5, 2, 2, 0, 0, 6, 0, 16, 35 },
-{ "ice lizard", 4, 11, 2, 10, 0, 0, 6, 50, 16, 25 },
-{ "centaur", 4, 6, 4, 0, 0, 0, 10, 40, 24, 45 },
-
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
------------------------------------------------------------------ */
-
-{ "troll", 5, 4, 5, 0, 0, 0, 9, 80, 50, 300 },
-{ "yeti", 5, 6, 4, 0, 0, 0, 5, 50, 35, 100 },
-{ "white dragon", 5, 2, 4, 5, 0, 0, 16, 500, 55, 1000},
-{ "elf", 5, 8, 1, 0, 0, 0, 15, 50, 22, 35 },
-{ "gelatinous cube",5, 9, 1, 0, 0, 0, 3, 0, 22, 45 },
-
-{ "metamorph", 6, 7, 3, 0, 0, 0, 3, 0, 30, 40 },
-{ "vortex", 6, 4, 3, 0, 0, 0, 3, 0, 30, 55 },
-{ "ziller", 6, 15, 3, 0, 0, 0, 3, 0, 30, 35 },
-{ "violet fungi", 6, 12, 3, 0, 0, 0, 3, 0, 38, 100 },
-{ "wraith", 6, 3, 1, 6, 0, 0, 3, 0, 30, 325 },
-{ "forvalaka", 6, 2, 5, 0, 0, 0, 7, 0, 50, 280 },
-
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
------------------------------------------------------------------ */
-
-{ "lama nobe", 7, 7, 3, 0, 0, 0, 6, 0, 35, 80 },
-{ "osequip", 7, 4, 3, 16, 0, 0, 4, 0, 35, 100 },
-{ "rothe", 7, 15, 5, 0, 0, 0, 3, 100, 50, 250 },
-{ "xorn", 7, 0, 6, 0, 0, 0, 13, 0, 60, 300 },
-{ "vampire", 7, 3, 4, 6, 0, 0, 17, 0, 50, 1000},
-{ "invisible stalker",7,3, 6, 0, 0, 0, 5, 0, 50, 350 },
-
-{ "poltergeist", 8, 1, 4, 0, 0, 0, 3, 0, 50, 450 },
-{ "disenchantress", 8, 3, 0, 9, 0, 0, 3, 0, 50, 500 },
-{ "shambling mound",8, 2, 5, 0, 0, 0, 6, 0, 45, 400 },
-{ "yellow mold", 8, 12, 4, 0, 0, 0, 3, 0, 35, 250 },
-{ "umber hulk", 8, 3, 7, 11, 0, 0, 14, 0, 65, 600 },
-
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
------------------------------------------------------------------ */
-
-{ "gnome king", 9, -1, 10, 0, 0, 0, 18, 2000, 100,3000 },
-{ "mimic", 9, 5, 6, 0, 0, 0, 8, 0, 55, 99 },
-{ "water lord", 9, -10, 15, 7, 0, 0, 20, 0, 150,15000 },
-{ "bronze dragon", 9, 2, 9, 3, 0, 0, 16, 300, 80, 4000 },
-{ "green dragon", 9, 3, 8, 10, 0, 0, 15, 200, 70, 2500 },
-{ "purple worm", 9, -1, 11, 0, 0, 0, 3, 100, 120,15000 },
-{ "xvart", 9, -2, 12, 0, 0, 0, 13, 0, 90, 1000 },
-
-{ "spirit naga", 10, -20,12, 12, 0, 0, 23, 0, 95, 20000 },
-{ "silver dragon", 10, -1, 12, 3, 0, 0, 20, 700, 100,10000 },
-{ "platinum dragon",10, -5, 15, 13, 0, 0, 22, 1000, 130,24000 },
-{ "green urchin", 10, -3, 12, 0, 0, 0, 3, 0, 85, 5000 },
-{ "red dragon", 10, -2, 13, 3, 0, 0, 19, 800, 110,14000 },
-
-{ "type I demon lord", 12,-30, 18, 0, 0, 0, 20, 0, 140,50000 },
-{ "type II demon lord", 13,-30, 18, 0, 0, 0, 21, 0, 160,75000 },
-{ "type III demon lord",14,-30, 18, 0, 0, 0, 22, 0, 180,100000 },
-{ "type IV demon lord", 15,-35, 20, 0, 0, 0, 23, 0, 200,125000 },
-{ "type V demon lord", 16,-40, 22, 0, 0, 0, 24, 0, 220,150000 },
-{ "type VI demon lord", 17,-45, 24, 0, 0, 0, 25, 0, 240,175000 },
-{ "type VII demon lord",18,-70, 27, 6, 0, 0, 26, 0, 260,200000 },
-{ "demon prince", 25,-127,30, 6, 0, 0, 28, 0, 345,300000 }
-
-/* NAME LV AC DAM ATT DEF GEN INT GOLD HP EXP
---------------------------------------------------------------------- */
- };
-
-/* name array for scrolls */
-
-char *scrollname[] = {
-"\0enchant armor",
-"\0enchant weapon",
-"\0enlightenment",
-"\0blank paper",
-"\0create monster",
-"\0create artifact",
-"\0aggravate monsters",
-"\0time warp",
-"\0teleportation",
-"\0expanded awareness",
-"\0haste monsters",
-"\0monster healing",
-"\0spirit protection",
-"\0undead protection",
-"\0stealth",
-"\0magic mapping",
-"\0hold monsters",
-"\0gem perfection",
-"\0spell extension",
-"\0identify",
-"\0remove curse",
-"\0annihilation",
-"\0pulverization",
-"\0life protection",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 "
- };
-
-/* name array for magic potions */
-char *potionname[] = {
-"\0sleep",
-"\0healing",
-"\0raise level",
-"\0increase ability",
-"\0wisdom",
-"\0strength",
-"\0raise charisma",
-"\0dizziness",
-"\0learning",
-"\0gold detection",
-"\0monster detection",
-"\0forgetfulness",
-"\0water",
-"\0blindness",
-"\0confusion",
-"\0heroism",
-"\0sturdiness",
-"\0giant strength",
-"\0fire resistance",
-"\0treasure finding",
-"\0instant healing",
-" cure dianthroritis",
-"\0poison",
-"\0see invisible",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 ",
-"\0 "
- };
-
-
-/*
- spell data
- */
-char spelknow[SPNUM]={0};
-char splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
-
-char *spelcode[]={
- "pro", "mle", "dex", "sle", "chm", "ssp",
- "web", "str", "enl", "hel", "cbl", "cre", "pha", "inv",
- "bal", "cld", "ply", "can", "has", "ckl", "vpr",
- "dry", "lit", "drl", "glo", "flo", "fgr",
- "sca", "hld", "stp", "tel", "mfi", /* 31 */
- "sph", "gen", "sum", "wtw", "alt", "per"
- };
-
-char *spelname[]={
- "protection", "magic missile", "dexterity",
- "sleep", "charm monster", "sonic spear",
-
- "web", "strength", "enlightenment",
- "healing", "cure blindness", "create monster",
- "phantasmal forces", "invisibility",
-
- "fireball", "cold", "polymorph",
- "cancellation", "haste self", "cloud kill",
- "vaporize rock",
-
- "dehydration", "lightning", "drain life",
- "invulnerability", "flood", "finger of death",
-
- "scare monster", "hold monster", "time stop",
- "teleport away", "magic fire",
-
- "sphere of annihilation", "genocide", "summon demon",
- "walk through walls", "alter reality", "permanence",
- ""
- };
-
-char *speldescript[]={
-/* 1 */
- "generates a +2 protection field",
- "creates and hurls a magic missile equivalent to a + 1 magic arrow",
- "adds +2 to the casters dexterity",
- "causes some monsters to go to sleep",
- "some monsters may be awed at your magnificence",
- "causes your hands to emit a screeching sound toward what they point",
-/* 7 */
- "causes strands of sticky thread to entangle an enemy",
- "adds +2 to the casters strength for a short term",
- "the caster becomes aware of things around him",
- "restores some hp to the caster",
- "restores sight to one so unfortunate as to be blinded",
- "creates a monster near the caster appropriate for the location",
- "creates illusions, and if believed, monsters die",
- "the caster becomes invisible",
-/* 15 */
- "makes a ball of fire that burns on what it hits",
- "sends forth a cone of cold which freezes what it touches",
- "you can find out what this does for yourself",
- "negates the ability of a monster to use his special abilities",
- "speeds up the casters movements",
- "creates a fog of poisonous gas which kills all that is within it",
- "this changes rock to air",
-/* 22 */
- "dries up water in the immediate vicinity",
- "you finger will emit a lightning bolt when this spell is cast",
- "subtracts hit points from both you and a monster",
- "this globe helps to protect the player from physical attack",
- "this creates an avalanche of H2O to flood the immediate chamber",
- "this is a holy spell and calls upon your god to back you up",
-/* 28 */
- "terrifies the monster so that hopefully he wont hit the magic user",
- "the monster is frozen in his tracks if this is successful",
- "all movement in the caverns ceases for a limited duration",
- "moves a particular monster around in the dungeon (hopefully away from you)",
- "this causes a curtain of fire to appear all around you",
-/* 33 */
- "anything caught in this sphere is instantly killed. Warning -- dangerous",
- "eliminates a species of monster from the game -- use sparingly",
- "summons a demon who hopefully helps you out",
- "allows the player to walk through walls for a short period of time",
- "god only knows what this will do",
- "makes a character spell permanent, i. e. protection, strength, etc.",
- ""
- };
-
-char spelweird[MAXMONST+8][SPNUM] = {
-/* p m d s c s w s e h c c p i b c p c h c v d l d g f f s h s t m s g s w a p */
-/* r l e l h s e t n e b r h n a l l a a k p r i r l l g c l t e f p e u t l e */
-/* o e x e m p b r l l l e a v l d y n s l r y t l o o r a d p l i h n m w t r */
-
-
-/* bat */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* gnome */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* hobgoblin */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* jackal */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* kobold */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* orc */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 4,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* snake */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/*giant centipede */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* jaculi */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* troglodyte */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* giant ant */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* floating eye */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* leprechaun */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* nymph */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* quasit */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* rust monster */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 4,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* zombie */ { 0,0,0,8,0,4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 4,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* assassin bug */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* bugbear */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* hell hound */ { 0,6,0,0,0,0, 12,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* ice lizard */ { 0,0,0,0,0,0, 11,0,0,0,0,0,0,0, 0,15,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* centaur */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* troll */ { 0,7,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 4,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* yeti */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,15,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* white dragon */ { 0,0,0,0,0,0, 0,0,0,0,0,0,14,0, 0,15,0,0,0,0,0, 4,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* elf */ { 0,0,0,0,0,0, 0,0,0,0,0,0,14,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/*gelatinous cube */ { 0,0,0,0,0,0, 2,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 0,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* metamorph */ { 0,13,0,0,0,0, 2,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 4,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* vortex */ { 0,13,0,0,0,10, 1,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* ziller */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* violet fungi */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* wraith */ { 0,0,0,8,0,4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 4,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* forvalaka */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* lama nobe */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* osequip */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* rothe */ { 0,7,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* xorn */ { 0,7,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 4,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* vampire */ { 0,0,0,8,0,4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,4,0, 0,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/*invisible staker*/ { 0,0,0,0,0,0, 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* poltergeist */ { 0,13,0,8,0,4, 1,0,0,0,0,0,0,0, 0,4,0,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* disenchantress */ { 0,0,0,8,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/*shambling mound */ { 0,0,0,0,0,10, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* yellow mold */ { 0,0,0,8,0,0, 1,0,0,0,0,0,4,0, 0,0,0,0,0,4,0, 0,0,0,0,0,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* umber hulk */ { 0,7,0,0,0,0, 0,0,0,0,0,0,0,5, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* gnome king */ { 0,7,0,0,3,0, 0,0,0,0,0,0,0,5, 0,0,9,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* mimic */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* water lord */ { 0,13,0,8,3,4, 1,0,0,0,0,0,0,0, 0,0,9,0,0,4,0, 0,0,0,0,16,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* bronze dragon */ { 0,7,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* green dragon */ { 0,7,0,0,0,0, 11,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* purple worm */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* xvart */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* spirit naga */ { 0,13,0,8,3,4, 1,0,0,0,0,0,0,5, 0,4,9,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* silver dragon */ { 0,6,0,9,0,0, 12,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/*platinum dragon */ { 0,7,0,9,0,0, 11,0,0,0,0,0,14,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* green urchin */ { 0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-/* red dragon */ { 0,6,0,0,0,0, 12,0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0 },
-
-/* p m d s c s w s e h c c p i b c p c h c v d l d g f f s h s t m s g s w a p */
-/* r l e l h s e t n e b r h n a l l a a k p r i r l l g c l t e f p e u t l e */
-/* o e x e m p b r l l l e a v l d y n s l r y t l o o r a d p l i h n m w t r */
-
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon lord */ { 0,7,0,4,3,0, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 0,0,0,0,0, 9,0,0,0,0,0 },
-/* demon prince */ { 0,7,0,4,3,9, 1,0,0,0,0,0,14,5, 0,0,4,0,0,4,0, 4,0,0,0,4,4, 4,0,0,0,4, 9,0,0,0,0,0 }
-
- };
-
-char *spelmes[] = { "",
-/* 1 */ "the web had no effect on the %s",
-/* 2 */ "the %s changed shape to avoid the web",
-/* 3 */ "the %s isn't afraid of you",
-/* 4 */ "the %s isn't affected",
-/* 5 */ "the %s can see you with his infravision",
-/* 6 */ "the %s vaporizes your missile",
-/* 7 */ "your missile bounces off the %s",
-/* 8 */ "the %s doesn't sleep",
-/* 9 */ "the %s resists",
-/* 10 */ "the %s can't hear the noise",
-/* 11 */ "the %s's tail cuts it free of the web",
-/* 12 */ "the %s burns through the web",
-/* 13 */ "your missiles pass right through the %s",
-/* 14 */ "the %s sees through your illusions",
-/* 15 */ "the %s loves the cold!",
-/* 16 */ "the %s loves the water!"
- };
-
-char to_lower[]= /* tolower[character] = lower case converted character */
- {
- 0000,0001,0002,0003,0004,0005,0006,0007,0010,0011,0012,0013,0014,0015,0016,0017, /* NUL-SI*/
- 0020,0021,0022,0023,0024,0025,0026,0027,0030,0031,0032,0033,0034,0035,0036,0037, /* DLE-US*/
- 0040,0041,0042,0043,0044,0045,0046,0047,0050,0051,0052,0053,0054,0055,0056,0057, /* SP-/ */
- 0060,0061,0062,0063,0064,0065,0066,0067,0070,0071,0072,0073,0074,0075,0076,0077, /* 0-? */
- 0100,0141,0142,0143,0144,0145,0146,0147,0150,0151,0152,0153,0154,0155,0156,0157, /* @-O */
- 0160,0161,0162,0163,0164,0165,0166,0167,0170,0171,0172,0133,0134,0135,0136,0137, /* P-_ */
- 0140,0141,0142,0143,0144,0145,0146,0147,0150,0151,0152,0153,0154,0155,0156,0157, /* `-o */
- 0160,0161,0162,0163,0164,0165,0166,0167,0170,0171,0172,0173,0174,0175,0176,0177, /* p-DEL */
- };
-
-char to_upper[]= /* toupper[character] = upper case converted character */
- {
- 0000,0001,0002,0003,0004,0005,0006,0007,0010,0011,0012,0013,0014,0015,0016,0017, /* NUL-SI*/
- 0020,0021,0022,0023,0024,0025,0026,0027,0030,0031,0032,0033,0034,0035,0036,0037, /* DLE-US*/
- 0040,0041,0042,0043,0044,0045,0046,0047,0050,0051,0052,0053,0054,0055,0056,0057, /* SP-/ */
- 0060,0061,0062,0063,0064,0065,0066,0067,0070,0071,0072,0073,0074,0075,0076,0077, /* 0-? */
- 0100,0101,0102,0103,0104,0105,0106,0107,0110,0111,0112,0113,0114,0115,0116,0117, /* @-O */
- 0120,0121,0122,0123,0124,0125,0126,0127,0130,0131,0132,0133,0134,0135,0136,0137, /* P-_ */
- 0140,0101,0102,0103,0104,0105,0106,0107,0110,0111,0112,0113,0114,0115,0116,0117, /* `-o */
- 0120,0121,0122,0123,0124,0125,0126,0127,0130,0131,0132,0173,0174,0175,0176,0177, /* p-DEL */
- };
-
-char is_digit[]= /* isdigit[character] = TRUE || FALSE */
- {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* NUL-SI*/
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* DLE-US*/
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* SP-/ */
- 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0-? */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* @-O */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* P-_ */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* `-o */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* p-DEL */
- };
-
-char is_alpha[]= /* isalpha[character] = TRUE || FALSE */
- {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* NUL-SI*/
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* DLE-US*/
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* SP-/ */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0-? */
- 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* @-O */
- 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* P-_ */
- 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `-o */
- 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* p-DEL */
- };
-
-/*
- * function to create scroll numbers with appropriate probability of
- * occurrence
- *
- * 0 - armor 1 - weapon 2 - enlightenment 3 - paper
- * 4 - create monster 5 - create item 6 - aggravate 7 - time warp
- * 8 - teleportation 9 - expanded awareness 10 - haste monst
- * 11 - heal monster 12 - spirit protection 13 - undead protection
- * 14 - stealth 15 - magic mapping 16 - hold monster
- * 17 - gem perfection 18 - spell extension 19 - identify
- * 20 - remove curse 21 - annihilation 22 - pulverization
- * 23 - life protection
- */
-char scprob[]= { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
- 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
- 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 22,
- 22, 22, 23 };
-
-/*
- * function to return a potion number created with appropriate probability
- * of occurrence
- *
- * 0 - sleep 1 - healing 2 - raise level
- * 3 - increase ability 4 - gain wisdom 5 - gain strength
- * 6 - charismatic character 7 - dizziness 8 - learning
- * 9 - gold detection 10 - monster detection 11 - forgetfulness
- * 12 - water 13 - blindness 14 - confusion
- * 15 - heroism 16 - sturdiness 17 - giant strength
- * 18 - fire resistance 19 - treasure finding 20 - instant healing
- * 21 - cure dianthroritis 22 - poison 23 - see invisible
- */
-char potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23 };
-
-char nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
-char nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
-char nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
-char ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
-char nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
diff --git a/games/larn/datfiles/larn.help b/games/larn/datfiles/larn.help
deleted file mode 100644
index 0e5edc5..0000000
--- a/games/larn/datfiles/larn.help
+++ /dev/null
@@ -1,140 +0,0 @@
-5 Welcome to the game of Larn. At this moment, you face a great problem.
-Your daughter has contracted a strange disease, and none of your home remedies
-seem to have any effect. You sense that she is in mortal danger, and you must
-try to save her. Time ago you heard of a land of great danger and opportunity.
-Perhaps here is the solution you need.
-
- It has been said that there once was a great magician who called himself
-Polinneaus. Many years ago, after having many miraculous successes, Polinneaus
-retired to the caverns of Larn, where he devoted most of his time to the
-creation of magic. Rumors have it that one day Polinneaus set out to dispel
-an attacking army in a forest some distance to the north. It is believed that
-here he met his demise.
-
- The caverns of Larn, it is thought, must be magnificent in design,
-and contain much magic and treasure. One option you have is to undertake a
-journey into these caverns.
-
-
- Good Luck! You're going to need it!
-
-
-
-
- Help File for The Caverns of Larn
-
-h move to the left H run left . stay here
-j move down J run down Z teleport yourself
-k move up K run up c cast a spell
-l move to the right L run right r read a scroll
-y move northwest Y run northwest q quaff a potion
-u move northeast U run northeast W wear armor
-b move southwest B run southwest T take off armor
-n move southeast N run southeast w wield a weapon
-^ identify a trap g give present pack weight P give tax status
-d drop an item i inventory your pockets Q quit the game
-v print program version S save the game D list all items found
-? this help screen A create diagnostic file e eat something
- (wizards only)
-larn ++ restore checkpointed game
-larn -s list the scoreboard
-larn -i list scores with inventories
-larn -n suppress welcome message when beginning a game
-larn -h print out all the command line options
-larn -<number> specify difficulty of the game (may be used with -n)
-larn -o<optsfile> specify the .larnopts file to be used
-larn -c create new scoreboards -- prompts for a password
- Special Notes
-
-When dropping gold, if you type '*' as your amount, all your gold gets dropped.
-In general, typing in '*' means all of what your interested in. This is true
-when visiting the bank, or when contributing at altars.
-
-Larn may need a VT100 to operate. A check is made of the environment variable
-"TERM" and it must be equal to "vt100". This only applies if
-the game has been compiled with "VT100" defined in the Makefile. If compiled
-to use termcap, there are no terminal restrictions, save needing cm, ce, & cl
-termcap entries.
-
-When in the store, trading post, school, or home, an <escape> will get you out.
-
-larn -l print out the larn log file
-
-When casting a spell, if you need a list of spells you can cast, type 'D' as
-the first letter of your spell. The available list of spells will be shown,
-after which you may enter the spell code. This only works on the 1st letter
-of the spell you are casting.
-
-The Author of Larn is Noah Morgan (1982-3), Copying for Profit is Prohibited
-Copyright 1986 by Noah Morgan, All Rights Reserved.
- Background Information for Larn
-
- Welcome to the game of Larn. At this moment, you face a great problem.
-Your daughter has contracted a strange disease, and none of your home remedies
-seem to have any effect. You sense that she is in mortal danger, and you must
-try to save her. Time ago you heard of a land of great danger and opportunity.
-Perhaps here is the solution you need.
-
- It has been said that there once was a great magician who called himself
-Polinneaus. Many years ago, after having many miraculous successes, Polinneaus
-retired to the caverns of Larn, where he devoted most of his time to the
-creation of magic. Rumors have it that one day Polinneaus set out to dispel
-an attacking army in a forest some distance to the north. It is believed that
-here he met his demise.
-
- The caverns of Larn, it is thought, must be magnificent in design,
-and contain much magic and treasure. One option you have is to undertake a
-journey into these caverns.
-
- Good Luck! You're going to need it!
-
-
-
- How to use the .larnopts option file
-
-The file ".larnopts", if used, should be in your home directory (see -o).
-A sequence of words terminated by whitespace is used to specify options.
-
- Word Meaning
-
- bold-objects select bold display of objects
- inverse-objects select inverse video display of objects
- no-introduction do not display intro message
- enable-checkpointing turn on periodic checkpointing
- no-beep disable beeping of the terminal
- male choose your sex to be a man
- female choose your sex to be a woman
- name: "your name" choose your playing name
- monster: "monst name" choose a name for a monster
- savefile: "save-file-name" define what the savegame filename will be
-
-Your name and monster names must be enclosed in double quotation marks and may
-be up to 34 characters long. Longer names are truncated. Anything enclosed in
-quotation marks is considered one word, and must be separated from other words
-by whitespace.
-
- Explanation of the Larn scoreboard facility
-
- Larn supports TWO scoreboards, one for winners, and one for deceased
-characters. Each player (by userid or playerid, see UIDSCORE in Makefile)
-is allowed one slot on each scoreboard, if the score is in the top ten for
-that scoreboard. This design helps insure that frequent players of Larn
-do not hog the scoreboard, and gives more players a chance for glory. Level
-of difficulty is also noted on the scoreboards, and this takes precedence
-over score for determining what entry is on the scoreboard. For example:
-if "Yar, the Bug Slayer" has a score of 128003 on the scoreboard at diff 0,
-then his game at diff 1 and a score of 4112 would replace his previous
-entry on the scoreboard. Note that when a player dies, his inventory is
-stored in the scoreboard so that everyone can see what items the player had
-at the time of his death.
-
-
-
-
-
-
-
-
-
-
-
diff --git a/games/larn/datfiles/larnmaze b/games/larn/datfiles/larnmaze
deleted file mode 100644
index 37a89c3..0000000
--- a/games/larn/datfiles/larnmaze
+++ /dev/null
@@ -1,288 +0,0 @@
-@###################################################################
-# # . # # # # # . #
-# D D . . D . #
-###D########################################## # # ###D###
-# -# #. # # ################ . .#
-# ####### ######## ############ D #### # # #
-# ... #.# # # # . # # # #### # ############ # ###D###
-# #.# # # ## # # # ############ #### # #- # # # #. #
-# . # # # # ## #- # # # - D #### # # . D # #.# # ... #
-# # #.# # # # # # . . # # # # # # #-# # ~.! #
-###D### ### #######D## # ############ ###### ########## ### #######
-# # @ .# # ..... ...#
-###D###########################################################D###
-# . #.....# # # # -# # # # # #
-# ..... . D D D D. #
-# #.....# # # # # # .# # # #
-###################################################################
-
-###################################################################
-#.. . D # . # #- #
-############# ######### # ## ### ##### ## #### ###### ####### ### #
-#.#!#~# # # .-# # #- # # # # -# # # #
-# # #.# . # ####### # # # # # # # # # #####
-# # ..# ##### # # # #### # ## ## ## # ###### ####### # #
-# - ..D # D # . D # # # #.##### ## ## # #. #.# #..# # ### #
-####### ####### ### # # # # # # D # D D #..D # #
-#- # # # #### # ###### # ## # #. # #..# #####
-### #######################- # # # ###################### # #
-# ... # . #..# ### # - .. . #. ### #
-# # # # ### #################### # # #
-# ### #
-################################################################# #
-#- D ### # # # #
-# . # # # D #
-###################################################################
-
-###################################################################
-# .. #
-# ############## ############################################## # #
-# # # # # .. # # #
-# #D## # # ############D################# ########### # # #
-######### #- # # # #- D # # ~ # # # # # # #
-# # # # # # # ### # # # D - # # ####### # # # #
-# .... # #### # # # #!# # # ###### .. #.# # # # # # #
-# .... # # # # ### # # # # #########D#### # ### # # # # #
-# .... ######## # # D # #- # #.. # ...#.# # #.# # # # # #
-# # # ### # #### #.- D - #.# #.#.# # # # # #
-#####DD## ######## # # D D. # # # #...# # # # # #
-# # ..# # # # ############################## # ##### # # # # #
-# ......# # # # # # # # # #
-# ####### ###### ################################ ######### # ### #
-# .D. # #
-###################################################################
-
-###################################################################
-# ## ## ### ## #
-# ##### ## ..- ## ##.## ## #
-# # ! ## ## . ## ## .## .. ## #
-# #....###### ## ## ## . ## ## #
-# # - # ## ##D# ## . ## ## #
-# #####D ~ ####### ###........ ## ... ## ## #
-# # # ## ## .... ## . ## ## #
-# #. ######## ## ## . - ####D#### - #
-# #.- #...## ## ... ## ### ...... ## ## #
-# #. #..## ## ######### ## ... ## ### ## .. #
-# #.. #.## ## ## - ## . #### ## ## ##### ## #
-# #####D## ## ## ###### ## ## ####### ## #
-# D -.## #### ######## ##DD## ######## #D #
-# ###### ... ## ########## ## #
-#### . . ###
-###################################################################
-
-###################################################################
-# #
-# ####.########################################## ## ##########
-# # #.#.#.# #.. #. # # #
-####### # # # # # ##### #! # ########### # ### #
-# # # # # # # ##...## # # # # # #-# #
-# ..- D # # # # # ## . ## ####D##### .. ### # # # #
-# # # # ##. ~ .## # # ### # # ##### # #
-############ # # # # ## . . .## #...# .. #.# # # # #
-# .. .# # # # # ## - ## # # D.D # ######### #
-# . D # # # # ##.......## ####D#####.# # #
-# - . # # # # # ## ## # . # ### ########### #
-############ #.#.# # ###D### # . #....# # #
-# # #-# D .. # .# ###....## ##-### #
-#### ########################################## ###### ### #
-# . #
-###################################################################
-
-###################################################################
-# #
-# ###########################D####### ## #
-# ####################### # ##...... ## ## #
-# ########D###### # # !##.... ## ## #
-# ############ ## ## ... # # #...## ~ ## ###### #
-# # # # # ...... # # # .. ##### ## #
-# # - .. # # # ########### # # . ######### ## #
-# ##### ##### # # # # #... ## ## #
-# # # ########## ######## ########DD#### ####### #
-# # # .... # # # # # ## ## #
-# ##### # # ....# # ######### # # ##### ## #
-# #- ######D##########..# # ######### # - #.. ## ## #
-# ##### # # # #... #.....## #
-# # ################### ###############... #### # ######
-# # #
-###################################################################
-
-###################################################################
-# #
-########### ##### ##### #####D#### ##### ###### #
-#.. # #-..D ###### ## # ## # ## ..## ### #### #
-# #### ### ##### # ## # ##### # ## ### ## # # #
-# # # # # # ##### # ## # # #### # #..##### - ### #
-# # # ####### ### #...# # ######## # # #~. .... # #
-# # # # #...# # # ######### ############## #
-# # ###### ####### # ### ### # .. # #
-# # # - # #-#####!# # # #### ## #### # #
-# ###### # ########## #.. ....# # ######## # # # ## ## #
-# -.# ##### ####...## # . .# #..# # ## # #
-# #### ###### #.### #####.#### #### ### ## # #
-# #- #######....#### ...... #.# . # ## # #
-# ####### ##### ###########.############### ### #
-# . #
-###################################################################
-
-###################################################################
-# # #- . # # # # # # # # #
-# # # #####.##### # # # # # # # # # # ###########D########### #
-# # ##### # # ### # # # # # # # # # ### #.... # # # #
-# # # # # # # # # # # # # # #.!. -.. #.##.# # #
-# # . - # # ####### # # # # # # # # # ########## ## # #
-#.####### # # D # . # # #
-#. -# ################################################### #
-# ##### D. . #
-# # ### ###D### ### ### ###D### ### ### ###D### ###.### #
-# # ###### ### .# .# #. # # # # # # # # . # #
-# ### # -# ### .#. - .# # # #...- # # .. # # -..# # . # #
-# # # ### #. ~ .# # # # # # # # .. .# # # #
-#.###### # ### # # #.....# # # # # # # # # #
-# # ####### ####### ####### ####### ####### ####### ####### #
-# # ... .. #
-###################################################################
-
-###################################################################
-# # . # ### # # # # . #
-# D D . # . D . #
-############################################### # # ###D###
-# -# #. # # ################ . .#
-# #######D######## ############ # #### # # #
-# ... #. # #!~ . # # # #--# # ############ #####D###
-# #.# # # ## # # # ############ #--# # #- # # # #. #
-# . # #-# # ## #- # # # - D ## # # # . D #### #.# # ... #
-# # #-# # # # # # . . # # # # # # #-# # -.- #
-###D### ### ####### ## # ############ ###### ########## ### ###D###
-# # @ . ..... ...#
-##################################### ###############D###
-# . #.....# # # # -# # # # #
-# ..... . D D D D. #
-# #.....# # # # # .# # # #
-###################################################################
-
-###################################################################
-#.. . # D . #- #
-### ######### ######### # ## ### ##### ## ########### ####### ### #
-#.# # # # .-# # #- # # # # -# # # #
-# # #.# . # ####### # # # # # # # # # #####
-# # ..####### # # # #### # ## ## ##!# ###### ####### # #
-# - ..D # D # . D # # # #.##### ## ## # #. #.# #..# # ### #
-####### ####### ### # # # # # # D # D D #..D # #
-#- # # # #### # ###### # ## # #. # #..# #####
-### #######################- # # # ###################### # #
-# ... # . #..# ### # - .. . #. ### #
-# # # # #-# #################### # # #
-# # -# #
-################################-################################ #
-#-..... # ####D ### # # # #
-#~..... # # # # D #
-###################################################################
-
-###################################################################
-# .. #
-# ############## ############################################## # #
-# # # # # .. # # #
-# #D## # # ############D################# ########### # # #
-######### #- # # # #- D # #.!..# # # # # # #
-# # # # # # # # ### ## # #....D - # # ####### # # # #
-# .... # #### # # # #~# # # ###### .. #.# # # # # # #
-###....## # # # ###.# # # #########D## # # ### # # # # #
-# .... ######## # # D .# #- # .. # ...#.# # #.# # # # # #
-# # ## # ### .# #### .- D - #.# #.#.# # # # # #
-#####DD## ######## #... .# . # # # #.#. # # # # #
-# # ..# # # ############################## # # ##### # # # #
-# ......# # # # # # # # # # #
-# ####### ###### ################################D# ######### ### #
-# .D. #-.-#
-###################################################################
-
-###################################################################
-# ## ## ## ## ## #
-# ############## ## ..- ## ## . ## ## #
-# # # ## ## . ## ## . ##.. ## #
-# #....###### ## ## ######## ####### . ## ## #
-# # - # ## ## ##D# ## . ## ## #
-# # D###### ###........ ## ... ## ###### #
-# # # ## ## .... ## . ## ## - # #
-# #. ######## ## ## . - ####D####.. D #
-# #.- #...## ## ... ## ### ...... ## ##### #
-# #. #..## ## ######### ## ... ## ### ## .. #
-# #.. #.## ## ## - ## . #### ## ## ##### ## #
-# #####D####### # ## ## ##..## ## ## ## ## ## #
-# D -.## # # #### ##.-.-## ##DD## ### #### ## #
-# ######. ...# #### ## #### ##### ## ##D#
-####~!.... D . . #
-###################################################################
-
-###################################################################
-# #
-# ####.########################################## ## ##########
-# # #.#.#.# #.. . # # #
-####### # # # # # ############# # ########### # ### #
-# # # # # # # --##...##-- # # # # #-# #
-# ..- D # # # # # #-## . ##-# ####D##### .. ### # # # #
-# # # # ###. .### # ~ # ### ### ##### # #
-############ # # # # ## . . .## #...# .. #.# # #
-# .. .# # # # # ## - ## # # D. # ######### #
-# . D # # # # ###.......### ####D#####.# # #
-# - . # # # # # -## ##- # . ### ########### #
-############ #.#.# # ######D###### # . ....# # #
-# #!#-# # .. # . ###....## ##-### #
-#### ############################## ########## ###### ### #
-# D . #
-###################################################################
-
-###################################################################
-# #
-# ###############D####################D# #
-# ####################### # ##...... # #
-# ########D###### # # ##.... # #
-# ############### ## ## ... # # #...## ##### #
-# # ~ # # #!...... # # # .. ##### # #
-# # - .. # # # ########### # # . ######### # #
-# ##### ######## # # # # # #... ## # #
-# # # # ########## ######## ########D #### ###### #
-# # # ....# # # # # # ## # #
-# ##### # ###### # ....# # ######### # # #####D# #
-# #- ## # #######..# # ######### # - #.. #
-# ##### # # # #... #..... #
-# # ################### ###############... #### ######
-# # #
-###################################################################
-
-###################################################################
-# # #
-########### ##### # #####D#### ##### ###### #
-#.. # #~..D ###### ## # ## # ## ..## ### #### #
-# #### ### ##### # ## # ##### # ## ### ## # # #
-# # # # # # ##### # ## # # #### # #..##### - ### #
-# # # ####### ### #...# # ######## # # #!. .... # #
-# # # # #...# # # ######### ############## #
-# # ###### ####### # ### ### # .. # #
-# # # - # #- # # # ######## #### # #
-# # # ########## #.. ....# # ######## # ## ## #
-# # -. ##### ####...## # . .# .. # # #
-# # ###### ##### #####.#### ####### # #
-# # - #######....#### ...... #.# . # ## # #
-# ######### ##### ###########.############### ### #
-# . #
-###################################################################
-
-###################################################################
-# D D #-..........# # # # # #
-#D#D# #####.#####.# # # # # # #############D########### #
-# # ##### #.#~###.# # # # # # ### .... # # # #
-#D# # #.......# # # # # # # . . -.. #. #.# # #
-# # . - # #.####### # # # # # ################## # #
-#D####### #. # D # . # # #
-#. D D -# ################################################### #
-# ###### . . #
-# # D ### ###D### ####### ###D### ####### ###D### ####### #
-# # ###### # # .# .# #. # # # # # # # # . # #
-# ### -# # # .#. - .# # # #...- # # .. # # -..# # . # #
-#DD# # # # #. .# # # # # # # # .. .# # # #
-#.###### # # # # #.....# # # # # # ! # # # #
-# # ####### ####### ### ### ####### ### ### ####### ### ### #
-# # ... .. #
-###################################################################
-
diff --git a/games/larn/datfiles/larnopts b/games/larn/datfiles/larnopts
deleted file mode 100644
index 17216ed..0000000
--- a/games/larn/datfiles/larnopts
+++ /dev/null
@@ -1,12 +0,0 @@
-process-name: "Winnie-the-Pooh"
-enable-checkpointing
-bold-objects
-male
-play-day-play
-no-introduction
-name: "King of the Realm"
-monster: "abominable snowman"
-monster: "tooth fairy"
-monster: "Yaccerous Lexicous"
-savefile: "/save/noah/games/Larn12.0.sav"
-
diff --git a/games/larn/diag.c b/games/larn/diag.c
deleted file mode 100644
index 12ea765..0000000
--- a/games/larn/diag.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* diag.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include <sys/types.h>
-#include <sys/times.h>
-#include <sys/stat.h>
-#include "header.h"
-extern int rmst,maxitm,lasttime;
-extern char nosignal;
-static struct tms cputime;
-/*
- ***************************
- DIAG -- dungeon diagnostics
- ***************************
-
- subroutine to print out data for debugging
- */
-#ifdef EXTRA
-static int rndcount[16];
-diag()
- {
- int i,j;
- int hit,dam;
- cursors(); lwclose();
- if (lcreat(diagfile) < 0) /* open the diagnostic file */
- {
- lcreat((char*)0); lprcat("\ndiagnostic failure\n"); return(-1);
- }
-
- write(1,"\nDiagnosing . . .\n",18);
- lprcat("\n\nBeginning of DIAG diagnostics ----------\n");
-
-/* for the character attributes */
-
- lprintf("\n\nPlayer attributes:\n\nHit points: %2d(%2d)",(long)c[HP],(long)c[HPMAX]);
- lprintf("\ngold: %d Experience: %d Character level: %d Level in caverns: %d",
- (long)c[GOLD],(long)c[EXPERIENCE],(long)c[LEVEL],(long)level);
- lprintf("\nTotal types of monsters: %d",(long)MAXMONST+8);
-
- lprcat("\f\nHere's the dungeon:\n\n");
-
- i=level;
- for (j=0; j<MAXLEVEL+MAXVLEVEL; j++)
- {
- newcavelevel(j);
- lprintf("\nMaze for level %s:\n",levelname[level]);
- diagdrawscreen();
- }
- newcavelevel(i);
-
- lprcat("\f\nNow for the monster data:\n\n");
- lprcat(" Monster Name LEV AC DAM ATT DEF GOLD HP EXP \n");
- lprcat("--------------------------------------------------------------------------\n");
- for (i=0; i<=MAXMONST+8; i++)
- {
- lprintf("%19s %2d %3d ",monster[i].name,(long)monster[i].level,(long)monster[i].armorclass);
- lprintf(" %3d %3d %3d ",(long)monster[i].damage,(long)monster[i].attack,(long)monster[i].defense);
- lprintf("%6d %3d %6d\n",(long)monster[i].gold,(long)monster[i].hitpoints,(long)monster[i].experience);
- }
-
- lprcat("\n\nHere's a Table for the to hit percentages\n");
- lprcat("\n We will be assuming that players level = 2 * monster level");
- lprcat("\n and that the players dexterity and strength are 16.");
- lprcat("\n to hit: if (rnd(22) < (2[monst AC] + your level + dex + WC/8 -1)/2) then hit");
- lprcat("\n damage = rund(8) + WC/2 + STR - c[HARDGAME] - 4");
- lprcat("\n to hit: if rnd(22) < to hit then player hits\n");
- lprcat("\n Each entry is as follows: to hit / damage / number hits to kill\n");
- lprcat("\n monster WC = 4 WC = 20 WC = 40");
- lprcat("\n---------------------------------------------------------------");
- for (i=0; i<=MAXMONST+8; i++)
- {
- hit = 2*monster[i].armorclass+2*monster[i].level+16;
- dam = 16 - c[HARDGAME];
- lprintf("\n%20s %2d/%2d/%2d %2d/%2d/%2d %2d/%2d/%2d",
- monster[i].name,
- (long)(hit/2),(long)max(0,dam+2),(long)(monster[i].hitpoints/(dam+2)+1),
- (long)((hit+2)/2),(long)max(0,dam+10),(long)(monster[i].hitpoints/(dam+10)+1),
- (long)((hit+5)/2),(long)max(0,dam+20),(long)(monster[i].hitpoints/(dam+20)+1));
- }
-
- lprcat("\n\nHere's the list of available potions:\n\n");
- for (i=0; i<MAXPOTION; i++) lprintf("%20s\n",&potionname[i][1]);
- lprcat("\n\nHere's the list of available scrolls:\n\n");
- for (i=0; i<MAXSCROLL; i++) lprintf("%20s\n",&scrollname[i][1]);
- lprcat("\n\nHere's the spell list:\n\n");
- lprcat("spell name description\n");
- lprcat("-------------------------------------------------------------------------------------------\n\n");
- for (j=0; j<SPNUM; j++)
- {
- lprc(' '); lprcat(spelcode[j]);
- lprintf(" %21s %s\n",spelname[j],speldescript[j]);
- }
-
- lprcat("\n\nFor the c[] array:\n");
- for (j=0; j<100; j+=10)
- {
- lprintf("\nc[%2d] = ",(long)j); for (i=0; i<9; i++) lprintf("%5d ",(long)c[i+j]);
- }
-
- lprcat("\n\nTest of random number generator ----------------");
- lprcat("\n for 25,000 calls divided into 16 slots\n\n");
-
- for (i=0; i<16; i++) rndcount[i]=0;
- for (i=0; i<25000; i++) rndcount[rund(16)]++;
- for (i=0; i<16; i++) { lprintf(" %5d",(long)rndcount[i]); if (i==7) lprc('\n'); }
-
- lprcat("\n\n"); lwclose();
- lcreat((char*)0); lprcat("Done Diagnosing . . .");
- return(0);
- }
-/*
- subroutine to count the number of occurrences of an object
- */
-dcount(l)
- int l;
- {
- int i,j,p;
- int k;
- k=0;
- for (i=0; i<MAXX; i++)
- for (j=0; j<MAXY; j++)
- for (p=0; p<MAXLEVEL; p++)
- if (cell[p*MAXX*MAXY+i*MAXY+j].item == l) k++;
- return(k);
- }
-
-/*
- subroutine to draw the whole screen as the player knows it
- */
-diagdrawscreen()
- {
- int i,j,k;
-
- for (i=0; i<MAXY; i++)
-
-/* for the east west walls of this line */
- {
- for (j=0; j<MAXX; j++) if (k=mitem[j][i]) lprc(monstnamelist[k]); else
- lprc(objnamelist[item[j][i]]);
- lprc('\n');
- }
- }
-#endif
-
-/*
- to save the game in a file
- */
-static time_t zzz=0;
-savegame(fname)
- char *fname;
- {
- int i,k;
- struct sphere *sp;
- struct stat statbuf;
- nosignal=1; lflush(); savelevel();
- ointerest();
- if (lcreat(fname) < 0)
- {
- lcreat((char*)0); lprintf("\nCan't open file <%s> to save game\n",fname);
- nosignal=0; return(-1);
- }
-
- set_score_output();
- lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL);
- for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
- if (beenhere[k])
- lwrite((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
- times(&cputime); /* get cpu time */
- c[CPUTIME] += (cputime.tms_utime+cputime.tms_stime)/60;
- lwrite((char*)&c[0],100*sizeof(long));
- lprint((long)gtime); lprc(level);
- lprc(playerx); lprc(playery);
- lwrite((char*)iven,26); lwrite((char*)ivenarg,26*sizeof(short));
- for (k=0; k<MAXSCROLL; k++) lprc(scrollname[k][0]);
- for (k=0; k<MAXPOTION; k++) lprc(potionname[k][0]);
- lwrite((char*)spelknow,SPNUM); lprc(wizard);
- lprc(rmst); /* random monster generation counter */
- for (i=0; i<90; i++) lprc(itm[i].qty);
- lwrite((char*)course,25); lprc(cheat); lprc(VERSION);
- for (i=0; i<MAXMONST; i++) lprc(monster[i].genocided); /* genocide info */
- for (sp=spheres; sp; sp=sp->p)
- lwrite((char*)sp,sizeof(struct sphere)); /* save spheres of annihilation */
- time(&zzz); lprint((long)(zzz-initialtime));
- lwrite((char*)&zzz,sizeof(long));
- if (fstat(lfd,&statbuf)< 0) lprint(0L);
- else lprint((long)statbuf.st_ino); /* inode # */
- lwclose(); lastmonst[0] = 0;
-#ifndef VT100
- setscroll();
-#endif /* VT100 */
- lcreat((char*)0); nosignal=0;
- return(0);
- }
-
-restoregame(fname)
- char *fname;
- {
- int i,k;
- struct sphere *sp,*sp2;
- struct stat filetimes;
- cursors(); lprcat("\nRestoring . . ."); lflush();
- if (lopen(fname) <= 0)
- {
- lcreat((char*)0); lprintf("\nCan't open file <%s>to restore game\n",fname);
- nap(2000); c[GOLD]=c[BANKACCOUNT]=0; died(-265); return;
- }
-
- lrfill((char*)beenhere,MAXLEVEL+MAXVLEVEL);
- for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
- if (beenhere[k])
- lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
-
- lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint();
- level = c[CAVELEVEL] = lgetc();
- playerx = lgetc(); playery = lgetc();
- lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short));
- for (k=0; k<MAXSCROLL; k++) scrollname[k][0] = lgetc();
- for (k=0; k<MAXPOTION; k++) potionname[k][0] = lgetc();
- lrfill((char*)spelknow,SPNUM); wizard = lgetc();
- rmst = lgetc(); /* random monster creation flag */
-
- for (i=0; i<90; i++) itm[i].qty = lgetc();
- lrfill((char*)course,25); cheat = lgetc();
- if (VERSION != lgetc()) /* version number */
- {
- cheat=1;
- lprcat("Sorry, But your save file is for an older version of larn\n");
- nap(2000); c[GOLD]=c[BANKACCOUNT]=0; died(-266); return;
- }
-
- for (i=0; i<MAXMONST; i++) monster[i].genocided=lgetc(); /* genocide info */
- for (sp=0,i=0; i<c[SPHCAST]; i++)
- {
- sp2 = sp;
- sp = (struct sphere *)malloc(sizeof(struct sphere));
- if (sp==0) { write(2,"Can't malloc() for sphere space\n",32); break; }
- lrfill((char*)sp,sizeof(struct sphere)); /* get spheres of annihilation */
- sp->p=0; /* null out pointer */
- if (i==0) spheres=sp; /* beginning of list */
- else sp2->p = sp;
- }
-
- time(&zzz);
- initialtime = zzz-lrint();
- fstat(fd,&filetimes); /* get the creation and modification time of file */
- lrfill((char*)&zzz,sizeof(long)); zzz += 6;
- if (filetimes.st_ctime > zzz) fsorry(); /* file create time */
- else if (filetimes.st_mtime > zzz) fsorry(); /* file modify time */
- if (c[HP]<0) { died(284); return; } /* died a post mortem death */
-
- oldx = oldy = 0;
- i = lrint(); /* inode # */
- if (i && (filetimes.st_ino!=i)) fsorry();
- lrclose();
- if (strcmp(fname,ckpfile) == 0)
- {
- if (lappend(fname) < 0) fcheat(); else { lprc(' '); lwclose(); }
- lcreat((char*)0);
- }
- else if (unlink(fname) < 0) fcheat(); /* can't unlink save file */
-/* for the greedy cheater checker */
- for (k=0; k<6; k++) if (c[k]>99) greedy();
- if (c[HPMAX]>999 || c[SPELLMAX]>125) greedy();
- if (c[LEVEL]==25 && c[EXPERIENCE]>skill[24]) /* if patch up lev 25 player */
- {
- long tmp;
- tmp = c[EXPERIENCE]-skill[24]; /* amount to go up */
- c[EXPERIENCE] = skill[24];
- raiseexperience((long)tmp);
- }
- getlevel(); lasttime=gtime;
- }
-
-/*
- subroutine to not allow greedy cheaters
- */
-greedy()
- {
-#if WIZID
- if (wizard) return;
-#endif
-
- lprcat("\n\nI am so sorry, but your character is a little TOO good! Since this\n");
- lprcat("cannot normally happen from an honest game, I must assume that you cheated.\n");
- lprcat("In that you are GREEDY as well as a CHEATER, I cannot allow this game\n");
- lprcat("to continue.\n"); nap(5000); c[GOLD]=c[BANKACCOUNT]=0; died(-267); return;
- }
-
-/*
- subroutine to not allow altered save files and terminate the attempted
- restart
- */
-fsorry()
- {
- lprcat("\nSorry, but your savefile has been altered.\n");
- lprcat("However, seeing as I am a good sport, I will let you play.\n");
- lprcat("Be advised though, you won't be placed on the normal scoreboard.");
- cheat = 1; nap(4000);
- }
-
-/*
- subroutine to not allow game if save file can't be deleted
- */
-fcheat()
- {
-#if WIZID
- if (wizard) return;
-#endif
-
- lprcat("\nSorry, but your savefile can't be deleted. This can only mean\n");
- lprcat("that you tried to CHEAT by protecting the directory the savefile\n");
- lprcat("is in. Since this is unfair to the rest of the larn community, I\n");
- lprcat("cannot let you play this game.\n");
- nap(5000); c[GOLD]=c[BANKACCOUNT]=0; died(-268); return;
- }
diff --git a/games/larn/display.c b/games/larn/display.c
deleted file mode 100644
index 0c30590..0000000
--- a/games/larn/display.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/* display.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-#define makecode(_a,_b,_c) (((_a)<<16) + ((_b)<<8) + (_c))
-
-static int minx,maxx,miny,maxy,k,m;
-static char bot1f=0,bot2f=0,bot3f=0;
-char always=0;
-/*
- bottomline()
-
- now for the bottom line of the display
- */
-bottomline()
- { recalc(); bot1f=1; }
-bottomhp()
- { bot2f=1; }
-bottomspell()
- { bot3f=1; }
-bottomdo()
- {
- if (bot1f) { bot3f=bot1f=bot2f=0; bot_linex(); return; }
- if (bot2f) { bot2f=0; bot_hpx(); }
- if (bot3f) { bot3f=0; bot_spellx(); }
- }
-
-static void botsub();
-
-bot_linex()
- {
- int i;
- if (cbak[SPELLS] <= -50 || (always))
- {
- cursor( 1,18);
- if (c[SPELLMAX]>99) lprintf("Spells:%3d(%3d)",(long)c[SPELLS],(long)c[SPELLMAX]);
- else lprintf("Spells:%3d(%2d) ",(long)c[SPELLS],(long)c[SPELLMAX]);
- lprintf(" AC: %-3d WC: %-3d Level",(long)c[AC],(long)c[WCLASS]);
- if (c[LEVEL]>99) lprintf("%3d",(long)c[LEVEL]);
- else lprintf(" %-2d",(long)c[LEVEL]);
- lprintf(" Exp: %-9d %s\n",(long)c[EXPERIENCE],class[c[LEVEL]-1]);
- lprintf("HP: %3d(%3d) STR=%-2d INT=%-2d ",
- (long)c[HP],(long)c[HPMAX],(long)(c[STRENGTH]+c[STREXTRA]),(long)c[INTELLIGENCE]);
- lprintf("WIS=%-2d CON=%-2d DEX=%-2d CHA=%-2d LV:",
- (long)c[WISDOM],(long)c[CONSTITUTION],(long)c[DEXTERITY],(long)c[CHARISMA]);
-
- if ((level==0) || (wizard)) c[TELEFLAG]=0;
- if (c[TELEFLAG]) lprcat(" ?"); else lprcat(levelname[level]);
- lprintf(" Gold: %-6d",(long)c[GOLD]);
- always=1; botside();
- c[TMP] = c[STRENGTH]+c[STREXTRA];
- for (i=0; i<100; i++) cbak[i]=c[i];
- return;
- }
-
- botsub(makecode(SPELLS,8,18),"%3d");
- if (c[SPELLMAX]>99) botsub(makecode(SPELLMAX,12,18),"%3d)");
- else botsub(makecode(SPELLMAX,12,18),"%2d) ");
- botsub(makecode(HP,5,19),"%3d");
- botsub(makecode(HPMAX,9,19),"%3d");
- botsub(makecode(AC,21,18),"%-3d");
- botsub(makecode(WCLASS,30,18),"%-3d");
- botsub(makecode(EXPERIENCE,49,18),"%-9d");
- if (c[LEVEL] != cbak[LEVEL])
- { cursor(59,18); lprcat(class[c[LEVEL]-1]); }
- if (c[LEVEL]>99) botsub(makecode(LEVEL,40,18),"%3d");
- else botsub(makecode(LEVEL,40,18)," %-2d");
- c[TMP] = c[STRENGTH]+c[STREXTRA]; botsub(makecode(TMP,18,19),"%-2d");
- botsub(makecode(INTELLIGENCE,25,19),"%-2d");
- botsub(makecode(WISDOM,32,19),"%-2d");
- botsub(makecode(CONSTITUTION,39,19),"%-2d");
- botsub(makecode(DEXTERITY,46,19),"%-2d");
- botsub(makecode(CHARISMA,53,19),"%-2d");
- if ((level != cbak[CAVELEVEL]) || (c[TELEFLAG] != cbak[TELEFLAG]))
- {
- if ((level==0) || (wizard)) c[TELEFLAG]=0;
- cbak[TELEFLAG] = c[TELEFLAG];
- cbak[CAVELEVEL] = level; cursor(59,19);
- if (c[TELEFLAG]) lprcat(" ?"); else lprcat(levelname[level]);
- }
- botsub(makecode(GOLD,69,19),"%-6d");
- botside();
- }
-
-/*
- special subroutine to update only the gold number on the bottomlines
- called from ogold()
- */
-bottomgold()
- {
- botsub(makecode(GOLD,69,19),"%-6d");
-/* botsub(GOLD,"%-6d",69,19); */
- }
-
-/*
- special routine to update hp and level fields on bottom lines
- called in monster.c hitplayer() and spattack()
- */
-bot_hpx()
- {
- if (c[EXPERIENCE] != cbak[EXPERIENCE])
- {
- recalc(); bot_linex();
- }
- else botsub(makecode(HP,5,19),"%3d");
- }
-
-/*
- special routine to update number of spells called from regen()
- */
-bot_spellx()
- {
- botsub(makecode(SPELLS,9,18),"%2d");
- }
-
-/*
- common subroutine for a more economical bottomline()
- */
-static struct bot_side_def
- {
- int typ;
- char *string;
- }
- bot_data[] =
- {
- STEALTH,"stealth", UNDEADPRO,"undead pro", SPIRITPRO,"spirit pro",
- CHARMCOUNT,"Charm", TIMESTOP,"Time Stop", HOLDMONST,"Hold Monst",
- GIANTSTR,"Giant Str", FIRERESISTANCE,"Fire Resit", DEXCOUNT,"Dexterity",
- STRCOUNT,"Strength", SCAREMONST,"Scare", HASTESELF,"Haste Self",
- CANCELLATION,"Cancel", INVISIBILITY,"Invisible", ALTPRO,"Protect 3",
- PROTECTIONTIME,"Protect 2", WTW,"Wall-Walk"
- };
-
-botside()
- {
- int i,idx;
- for (i=0; i<17; i++)
- {
- idx = bot_data[i].typ;
- if ((always) || (c[idx] != cbak[idx]))
- {
- if ((always) || (cbak[idx] == 0))
- { if (c[idx]) { cursor(70,i+1); lprcat(bot_data[i].string); } } else
- if (c[idx]==0) { cursor(70,i+1); lprcat(" "); }
- cbak[idx]=c[idx];
- }
- }
- always=0;
- }
-
-static void
-botsub(idx,str)
- int idx;
- char *str;
- {
- int x,y;
- y = idx & 0xff; x = (idx>>8) & 0xff; idx >>= 16;
- if (c[idx] != cbak[idx])
- { cbak[idx]=c[idx]; cursor(x,y); lprintf(str,(long)c[idx]); }
- }
-
-/*
- * subroutine to draw only a section of the screen
- * only the top section of the screen is updated. If entire lines are being
- * drawn, then they will be cleared first.
- */
-int d_xmin=0,d_xmax=MAXX,d_ymin=0,d_ymax=MAXY; /* for limited screen drawing */
-draws(xmin,xmax,ymin,ymax)
- int xmin,xmax,ymin,ymax;
- {
- int i,idx;
- if (xmin==0 && xmax==MAXX) /* clear section of screen as needed */
- {
- if (ymin==0) cl_up(79,ymax);
- else for (i=ymin; i<ymin; i++) cl_line(1,i+1);
- xmin = -1;
- }
- d_xmin=xmin; d_xmax=xmax; d_ymin=ymin; d_ymax=ymax; /* for limited screen drawing */
- drawscreen();
- if (xmin<=0 && xmax==MAXX) /* draw stuff on right side of screen as needed*/
- {
- for (i=ymin; i<ymax; i++)
- {
- idx = bot_data[i].typ;
- if (c[idx])
- {
- cursor(70,i+1); lprcat(bot_data[i].string);
- }
- cbak[idx]=c[idx];
- }
- }
- }
-
-/*
- drawscreen()
-
- subroutine to redraw the whole screen as the player knows it
- */
-char screen[MAXX][MAXY],d_flag; /* template for the screen */
-drawscreen()
- {
- int i,j,k;
- int lastx,lasty; /* variables used to optimize the object printing */
- if (d_xmin==0 && d_xmax==MAXX && d_ymin==0 && d_ymax==MAXY)
- {
- d_flag=1; clear(); /* clear the screen */
- }
- else
- {
- d_flag=0; cursor(1,1);
- }
- if (d_xmin<0)
- d_xmin=0; /* d_xmin=-1 means display all without bottomline */
-
- for (i=d_ymin; i<d_ymax; i++)
- for (j=d_xmin; j<d_xmax; j++)
- if (know[j][i]==0) screen[j][i] = ' '; else
- if (k=mitem[j][i]) screen[j][i] = monstnamelist[k]; else
- if ((k=item[j][i])==OWALL) screen[j][i] = '#';
- else screen[j][i] = ' ';
-
- for (i=d_ymin; i<d_ymax; i++)
- {
- j=d_xmin; while ((screen[j][i]==' ') && (j<d_xmax)) j++;
- /* was m=0 */
- if (j >= d_xmax) m=d_xmin; /* don't search backwards if blank line */
- else
- { /* search backwards for end of line */
- m=d_xmax-1; while ((screen[m][i]==' ') && (m>d_xmin)) --m;
- if (j<=m) cursor(j+1,i+1); else continue;
- }
- while (j <= m)
- {
- if (j <= m-3)
- {
- for (k=j; k<=j+3; k++) if (screen[k][i] != ' ') k=1000;
- if (k < 1000)
- { while(screen[j][i]==' ' && j<=m) j++; cursor(j+1,i+1); }
- }
- lprc(screen[j++][i]);
- }
- }
- setbold(); /* print out only bold objects now */
-
- for (lastx=lasty=127, i=d_ymin; i<d_ymax; i++)
- for (j=d_xmin; j<d_xmax; j++)
- {
- if (k=item[j][i])
- if (k != OWALL)
- if ((know[j][i]) && (mitem[j][i]==0))
- if (objnamelist[k]!=' ')
- {
- if (lasty!=i+1 || lastx!=j)
- cursor(lastx=j+1,lasty=i+1); else lastx++;
- lprc(objnamelist[k]);
- }
- }
-
- resetbold(); if (d_flag) { always=1; botside(); always=1; bot_linex(); }
- oldx=99;
- d_xmin = 0 , d_xmax = MAXX , d_ymin = 0 , d_ymax = MAXY; /* for limited screen drawing */
- }
-
-/*
- showcell(x,y)
-
- subroutine to display a cell location on the screen
- */
-showcell(x,y)
- int x,y;
- {
- int i,j,k,m;
- if (c[BLINDCOUNT]) return; /* see nothing if blind */
- if (c[AWARENESS]) { minx = x-3; maxx = x+3; miny = y-3; maxy = y+3; }
- else { minx = x-1; maxx = x+1; miny = y-1; maxy = y+1; }
-
- if (minx < 0) minx=0; if (maxx > MAXX-1) maxx = MAXX-1;
- if (miny < 0) miny=0; if (maxy > MAXY-1) maxy = MAXY-1;
-
- for (j=miny; j<=maxy; j++)
- for (m=minx; m<=maxx; m++)
- if (know[m][j]==0)
- {
- cursor(m+1,j+1);
- x=maxx; while (know[x][j]) --x;
- for (i=m; i<=x; i++)
- {
- if ((k=mitem[i][j]) != 0) lprc(monstnamelist[k]);
- else switch(k=item[i][j])
- {
- case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV:
- case OIVDARTRAP: case OIVTRAPDOOR:
- lprc(objnamelist[k]); break;
-
- default: setbold(); lprc(objnamelist[k]); resetbold();
- };
- know[i][j]=1;
- }
- m = maxx;
- }
- }
-
-/*
- this routine shows only the spot that is given it. the spaces around
- these coordinated are not shown
- used in godirect() in monster.c for missile weapons display
- */
-show1cell(x,y)
- int x,y;
- {
- if (c[BLINDCOUNT]) return; /* see nothing if blind */
- cursor(x+1,y+1);
- if ((k=mitem[x][y]) != 0) lprc(monstnamelist[k]);
- else switch(k=item[x][y])
- {
- case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV:
- case OIVDARTRAP: case OIVTRAPDOOR:
- lprc(objnamelist[k]); break;
-
- default: setbold(); lprc(objnamelist[k]); resetbold();
- };
- know[x][y]|=1; /* we end up knowing about it */
- }
-
-/*
- showplayer()
-
- subroutine to show where the player is on the screen
- cursor values start from 1 up
- */
-showplayer()
- {
- cursor(playerx+1,playery+1);
- oldx=playerx; oldy=playery;
- }
-
-/*
- moveplayer(dir)
-
- subroutine to move the player from one room to another
- returns 0 if can't move in that direction or hit a monster or on an object
- else returns 1
- nomove is set to 1 to stop the next move (inadvertent monsters hitting
- players when walking into walls) if player walks off screen or into wall
- */
-short diroffx[] = { 0, 0, 1, 0, -1, 1, -1, 1, -1 };
-short diroffy[] = { 0, 1, 0, -1, 0, -1, -1, 1, 1 };
-moveplayer(dir)
- int dir; /* from = present room # direction = [1-north]
- [2-east] [3-south] [4-west] [5-northeast]
- [6-northwest] [7-southeast] [8-southwest]
- if direction=0, don't move--just show where he is */
- {
- int k,m,i,j;
- if (c[CONFUSE]) if (c[LEVEL]<rnd(30)) dir=rund(9); /*if confused any dir*/
- k = playerx + diroffx[dir]; m = playery + diroffy[dir];
- if (k<0 || k>=MAXX || m<0 || m>=MAXY) { nomove=1; return(yrepcount = 0); }
- i = item[k][m]; j = mitem[k][m];
- if (i==OWALL && c[WTW]==0) { nomove=1; return(yrepcount = 0); } /* hit a wall */
- if (k==33 && m==MAXY-1 && level==1)
- {
- newcavelevel(0); for (k=0; k<MAXX; k++) for (m=0; m<MAXY; m++)
- if (item[k][m]==OENTRANCE)
- { playerx=k; playery=m; positionplayer(); drawscreen(); return(0); }
- }
- if (j>0) { hitmonster(k,m); return(yrepcount = 0); } /* hit a monster*/
- lastpx = playerx; lastpy = playery;
- playerx = k; playery = m;
- if (i && i!=OTRAPARROWIV && i!=OIVTELETRAP && i!=OIVDARTRAP && i!=OIVTRAPDOOR) return(yrepcount = 0); else return(1);
- }
-
-/*
- * function to show what magic items have been discovered thus far
- * enter with -1 for just spells, anything else will give scrolls & potions
- */
-static int lincount,count;
-seemagic(arg)
- int arg;
- {
- int i,number;
- count = lincount = 0; nosignal=1;
-
- if (arg== -1) /* if display spells while casting one */
- {
- for (number=i=0; i<SPNUM; i++) if (spelknow[i]) number++;
- number = (number+2)/3 + 4; /* # lines needed to display */
- cl_up(79,number); cursor(1,1);
- }
- else
- {
- resetscroll(); clear();
- }
-
- lprcat("The magic spells you have discovered thus far:\n\n");
- for (i=0; i<SPNUM; i++)
- if (spelknow[i])
- { lprintf("%s %-20s ",spelcode[i],spelname[i]); seepage(); }
-
- if (arg== -1)
- {
- seepage(); more(); nosignal=0;
- draws(0,MAXX,0,number); return;
- }
-
- lincount += 3; if (count!=0) { count=2; seepage(); }
-
- lprcat("\nThe magic scrolls you have found to date are:\n\n");
- count=0;
- for (i=0; i<MAXSCROLL; i++)
- if (scrollname[i][0])
- if (scrollname[i][1]!=' ')
- { lprintf("%-26s",&scrollname[i][1]); seepage(); }
-
- lincount += 3; if (count!=0) { count=2; seepage(); }
-
- lprcat("\nThe magic potions you have found to date are:\n\n");
- count=0;
- for (i=0; i<MAXPOTION; i++)
- if (potionname[i][0])
- if (potionname[i][1]!=' ')
- { lprintf("%-26s",&potionname[i][1]); seepage(); }
-
- if (lincount!=0) more(); nosignal=0; setscroll(); drawscreen();
- }
-
-/*
- * subroutine to paginate the seemagic function
- */
-seepage()
- {
- if (++count==3)
- {
- lincount++; count=0; lprc('\n');
- if (lincount>17) { lincount=0; more(); clear(); }
- }
- }
diff --git a/games/larn/fortune.c b/games/larn/fortune.c
deleted file mode 100644
index 798aa2e..0000000
--- a/games/larn/fortune.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)fortune.c 5.5 (Berkeley) 6/10/91";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* fortune.c Larn is copyrighted 1986 by Noah Morgan. */
-
-/*
- * function to return a random fortune from the fortune file
- */
-
-char *flines[] = {
- "gem value = gem * 2 ^ perfection",
- "sitting down can have unexpected results",
- "don't pry into the affairs of others",
- "drinking can be hazardous to your health",
- "beware of the gusher!",
- "some monsters are greedy",
- "nymphs have light fingers",
- "try kissing a disenchantress!",
- "hammers and brains don't mix",
- "what does a potion of cure dianthroritis taste like?",
- "hit point gain/loss when raising a level depends on constitution",
- "healing a mighty wizard can be exhilarating",
- "be sure to pay your taxes",
- "are Vampires afraid of something?",
- "some dragons can fly",
- "dos thou strive for perfection?",
- "patience is a virtue, unless your daughter dies",
- "what does the Eye of Larn see in its guardian?",
- "a level 25 player casts like crazy!",
- "energy rings affect spell regeneration",
- "difficulty affects regeneration",
- "control of the pesty spirits is most helpful",
- "don't fall into a bottomless pit",
- "dexterity allows you to carry more",
- "you can get 2 points of WC for the price of one",
- "never enter the dungeon naked! the monsters will laugh at you!",
- "did someone put itching powder in your armor?",
- "you klutz!",
- "avoid opening doors. you never know whats on the other side.",
- "infinite regeneration ---> temptation",
- "the greatest weapon in the game has not the highest Weapon Class",
- "you can't buy the most powerful scroll",
- "identify things before you use them",
- "there's more than one way through a wall"
-};
-
-#define NFORTUNES 34
-
-char *
-fortune()
-{
- return (flines[random() % NFORTUNES]);
-}
diff --git a/games/larn/global.c b/games/larn/global.c
deleted file mode 100644
index c595053..0000000
--- a/games/larn/global.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/* global.c Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * raiselevel() subroutine to raise the player one level
- * loselevel() subroutine to lower the player by one level
- * raiseexperience(x) subroutine to increase experience points
- * loseexperience(x) subroutine to lose experience points
- * losehp(x) subroutine to remove hit points from the player
- * losemhp(x) subroutine to remove max # hit points from the player
- * raisehp(x) subroutine to gain hit points
- * raisemhp(x) subroutine to gain maximum hit points
- * losespells(x) subroutine to lose spells
- * losemspells(x) subroutine to lose maximum spells
- * raisespells(x) subroutine to gain spells
- * raisemspells(x) subroutine to gain maximum spells
- * recalc() function to recalculate the armor class of the player
- * makemonst(lev) function to return monster number for a randomly selected monster
- * positionplayer() function to be sure player is not in a wall
- * quit() subroutine to ask if the player really wants to quit
- *
- */
-
-#include "header.h"
-extern int score[],srcount,dropflag;
-extern short playerx,playery,lastnum;
-extern char cheat,level,monstnamelist[];
-extern char lastmonst[],*what[],*who[];
-extern char winner[];
-extern char logname[],monstlevel[];
-extern char sciv[SCORESIZE+1][26][2],*potionname[],*scrollname[];
-/*
- ***********
- RAISE LEVEL
- ***********
- raiselevel()
-
- subroutine to raise the player one level
- uses the skill[] array to find level boundarys
- uses c[EXPERIENCE] c[LEVEL]
- */
-raiselevel()
- {
- if (c[LEVEL] < MAXPLEVEL) raiseexperience((long)(skill[c[LEVEL]]-c[EXPERIENCE]));
- }
-
-/*
- ***********
- LOOSE LEVEL
- ***********
- loselevel()
-
- subroutine to lower the players character level by one
- */
-loselevel()
- {
- if (c[LEVEL] > 1) loseexperience((long)(c[EXPERIENCE] - skill[c[LEVEL]-1] + 1));
- }
-
-/*
- ****************
- RAISE EXPERIENCE
- ****************
- raiseexperience(x)
-
- subroutine to increase experience points
- */
-raiseexperience(x)
- long x;
- {
- int i,tmp;
- i=c[LEVEL]; c[EXPERIENCE]+=x;
- while (c[EXPERIENCE] >= skill[c[LEVEL]] && (c[LEVEL] < MAXPLEVEL))
- {
- tmp = (c[CONSTITUTION]-c[HARDGAME])>>1;
- c[LEVEL]++; raisemhp((int)(rnd(3)+rnd((tmp>0)?tmp:1)));
- raisemspells((int)rund(3));
- if (c[LEVEL] < 7-c[HARDGAME]) raisemhp((int)(c[CONSTITUTION]>>2));
- }
- if (c[LEVEL] != i)
- {
- cursors();
- beep(); lprintf("\nWelcome to level %d",(long)c[LEVEL]); /* if we changed levels */
- }
- bottomline();
- }
-
-/*
- ****************
- LOOSE EXPERIENCE
- ****************
- loseexperience(x)
-
- subroutine to lose experience points
- */
-loseexperience(x)
- long x;
- {
- int i,tmp;
- i=c[LEVEL]; c[EXPERIENCE]-=x;
- if (c[EXPERIENCE] < 0) c[EXPERIENCE]=0;
- while (c[EXPERIENCE] < skill[c[LEVEL]-1])
- {
- if (--c[LEVEL] <= 1) c[LEVEL]=1; /* down one level */
- tmp = (c[CONSTITUTION]-c[HARDGAME])>>1; /* lose hpoints */
- losemhp((int)rnd((tmp>0)?tmp:1)); /* lose hpoints */
- if (c[LEVEL] < 7-c[HARDGAME]) losemhp((int)(c[CONSTITUTION]>>2));
- losemspells((int)rund(3)); /* lose spells */
- }
- if (i!=c[LEVEL])
- {
- cursors();
- beep(); lprintf("\nYou went down to level %d!",(long)c[LEVEL]);
- }
- bottomline();
- }
-
-/*
- ********
- LOOSE HP
- ********
- losehp(x)
- losemhp(x)
-
- subroutine to remove hit points from the player
- warning -- will kill player if hp goes to zero
- */
-losehp(x)
- int x;
- {
- if ((c[HP] -= x) <= 0)
- {
- beep(); lprcat("\n"); nap(3000); died(lastnum);
- }
- }
-
-losemhp(x)
- int x;
- {
- c[HP] -= x; if (c[HP] < 1) c[HP]=1;
- c[HPMAX] -= x; if (c[HPMAX] < 1) c[HPMAX]=1;
- }
-
-/*
- ********
- RAISE HP
- ********
- raisehp(x)
- raisemhp(x)
-
- subroutine to gain maximum hit points
- */
-raisehp(x)
- int x;
- {
- if ((c[HP] += x) > c[HPMAX]) c[HP] = c[HPMAX];
- }
-
-raisemhp(x)
- int x;
- {
- c[HPMAX] += x; c[HP] += x;
- }
-
-/*
- ************
- RAISE SPELLS
- ************
- raisespells(x)
- raisemspells(x)
-
- subroutine to gain maximum spells
- */
-raisespells(x)
- int x;
- {
- if ((c[SPELLS] += x) > c[SPELLMAX]) c[SPELLS] = c[SPELLMAX];
- }
-
-raisemspells(x)
- int x;
- {
- c[SPELLMAX]+=x; c[SPELLS]+=x;
- }
-
-/*
- ************
- LOOSE SPELLS
- ************
- losespells(x)
- losemspells(x)
-
- subroutine to lose maximum spells
- */
-losespells(x)
- int x;
- {
- if ((c[SPELLS] -= x) < 0) c[SPELLS]=0;
- }
-
-losemspells(x)
- int x;
- {
- if ((c[SPELLMAX] -= x) < 0) c[SPELLMAX]=0;
- if ((c[SPELLS] -= x) < 0) c[SPELLS]=0;
- }
-
-/*
- makemonst(lev)
- int lev;
-
- function to return monster number for a randomly selected monster
- for the given cave level
- */
-makemonst(lev)
- int lev;
- {
- int tmp,x;
- if (lev < 1) lev = 1; if (lev > 12) lev = 12;
- tmp=WATERLORD;
- if (lev < 5)
- while (tmp==WATERLORD) tmp=rnd((x=monstlevel[lev-1])?x:1);
- else while (tmp==WATERLORD)
- tmp=rnd((x=monstlevel[lev-1]-monstlevel[lev-4])?x:1)+monstlevel[lev-4];
-
- while (monster[tmp].genocided && tmp<MAXMONST) tmp++; /* genocided? */
- return(tmp);
- }
-
-/*
- positionplayer()
-
- function to be sure player is not in a wall
- */
-positionplayer()
- {
- int try;
- try = 2;
- while ((item[playerx][playery] || mitem[playerx][playery]) && (try))
- if (++playerx >= MAXX-1)
- {
- playerx = 1;
- if (++playery >= MAXY-1)
- { playery = 1; --try; }
- }
- if (try==0) lprcat("Failure in positionplayer\n");
- }
-
-/*
- recalc() function to recalculate the armor class of the player
- */
-recalc()
- {
- int i,j,k;
- c[AC] = c[MOREDEFENSES];
- if (c[WEAR] >= 0)
- switch(iven[c[WEAR]])
- {
- case OSHIELD: c[AC] += 2 + ivenarg[c[WEAR]]; break;
- case OLEATHER: c[AC] += 2 + ivenarg[c[WEAR]]; break;
- case OSTUDLEATHER: c[AC] += 3 + ivenarg[c[WEAR]]; break;
- case ORING: c[AC] += 5 + ivenarg[c[WEAR]]; break;
- case OCHAIN: c[AC] += 6 + ivenarg[c[WEAR]]; break;
- case OSPLINT: c[AC] += 7 + ivenarg[c[WEAR]]; break;
- case OPLATE: c[AC] += 9 + ivenarg[c[WEAR]]; break;
- case OPLATEARMOR: c[AC] += 10 + ivenarg[c[WEAR]]; break;
- case OSSPLATE: c[AC] += 12 + ivenarg[c[WEAR]]; break;
- }
-
- if (c[SHIELD] >= 0) if (iven[c[SHIELD]] == OSHIELD) c[AC] += 2 + ivenarg[c[SHIELD]];
- if (c[WIELD] < 0) c[WCLASS] = 0; else
- {
- i = ivenarg[c[WIELD]];
- switch(iven[c[WIELD]])
- {
- case ODAGGER: c[WCLASS] = 3 + i; break;
- case OBELT: c[WCLASS] = 7 + i; break;
- case OSHIELD: c[WCLASS] = 8 + i; break;
- case OSPEAR: c[WCLASS] = 10 + i; break;
- case OFLAIL: c[WCLASS] = 14 + i; break;
- case OBATTLEAXE: c[WCLASS] = 17 + i; break;
- case OLANCE: c[WCLASS] = 19 + i; break;
- case OLONGSWORD: c[WCLASS] = 22 + i; break;
- case O2SWORD: c[WCLASS] = 26 + i; break;
- case OSWORD: c[WCLASS] = 32 + i; break;
- case OSWORDofSLASHING: c[WCLASS] = 30 + i; break;
- case OHAMMER: c[WCLASS] = 35 + i; break;
- default: c[WCLASS] = 0;
- }
- }
- c[WCLASS] += c[MOREDAM];
-
-/* now for regeneration abilities based on rings */
- c[REGEN]=1; c[ENERGY]=0;
- j=0; for (k=25; k>0; k--) if (iven[k]) {j=k; k=0; }
- for (i=0; i<=j; i++)
- {
- switch(iven[i])
- {
- case OPROTRING: c[AC] += ivenarg[i] + 1; break;
- case ODAMRING: c[WCLASS] += ivenarg[i] + 1; break;
- case OBELT: c[WCLASS] += ((ivenarg[i]<<1)) + 2; break;
-
- case OREGENRING: c[REGEN] += ivenarg[i] + 1; break;
- case ORINGOFEXTRA: c[REGEN] += 5 * (ivenarg[i]+1); break;
- case OENERGYRING: c[ENERGY] += ivenarg[i] + 1; break;
- }
- }
- }
-
-
-/*
- quit()
-
- subroutine to ask if the player really wants to quit
- */
-quit()
- {
- int i;
- cursors(); strcpy(lastmonst,"");
- lprcat("\n\nDo you really want to quit?");
- while (1)
- {
- i=getchar();
- if (i == 'y') { died(300); return; }
- if ((i == 'n') || (i == '\33')) { lprcat(" no"); lflush(); return; }
- lprcat("\n"); setbold(); lprcat("Yes"); resetbold(); lprcat(" or ");
- setbold(); lprcat("No"); resetbold(); lprcat(" please? Do you want to quit? ");
- }
- }
-
-/*
- function to ask --more-- then the user must enter a space
- */
-more()
- {
- lprcat("\n --- press "); standout("space"); lprcat(" to continue --- ");
- while (getchar() != ' ');
- }
-
-/*
- function to put something in the players inventory
- returns 0 if success, 1 if a failure
- */
-take(itm,arg)
- int itm,arg;
- {
- int i,limit;
-/* cursors(); */
- if ((limit = 15+(c[LEVEL]>>1)) > 26) limit=26;
- for (i=0; i<limit; i++)
- if (iven[i]==0)
- {
- iven[i] = itm; ivenarg[i] = arg; limit=0;
- switch(itm)
- {
- case OPROTRING: case ODAMRING: case OBELT: limit=1; break;
- case ODEXRING: c[DEXTERITY] += ivenarg[i]+1; limit=1; break;
- case OSTRRING: c[STREXTRA] += ivenarg[i]+1; limit=1; break;
- case OCLEVERRING: c[INTELLIGENCE] += ivenarg[i]+1; limit=1; break;
- case OHAMMER: c[DEXTERITY] += 10; c[STREXTRA]+=10;
- c[INTELLIGENCE]-=10; limit=1; break;
-
- case OORBOFDRAGON: c[SLAYING]++; break;
- case OSPIRITSCARAB: c[NEGATESPIRIT]++; break;
- case OCUBEofUNDEAD: c[CUBEofUNDEAD]++; break;
- case ONOTHEFT: c[NOTHEFT]++; break;
- case OSWORDofSLASHING: c[DEXTERITY] +=5; limit=1; break;
- };
- lprcat("\nYou pick up:"); srcount=0; show3(i);
- if (limit) bottomline(); return(0);
- }
- lprcat("\nYou can't carry anything else"); return(1);
- }
-
-/*
- subroutine to drop an object returns 1 if something there already else 0
- */
-drop_object(k)
- int k;
- {
- int itm;
- if ((k<0) || (k>25)) return(0);
- itm = iven[k]; cursors();
- if (itm==0) { lprintf("\nYou don't have item %c! ",k+'a'); return(1); }
- if (item[playerx][playery])
- { beep(); lprcat("\nThere's something here already"); return(1); }
- if (playery==MAXY-1 && playerx==33) return(1); /* not in entrance */
- item[playerx][playery] = itm;
- iarg[playerx][playery] = ivenarg[k];
- srcount=0; lprcat("\n You drop:"); show3(k); /* show what item you dropped*/
- know[playerx][playery] = 0; iven[k]=0;
- if (c[WIELD]==k) c[WIELD]= -1; if (c[WEAR]==k) c[WEAR] = -1;
- if (c[SHIELD]==k) c[SHIELD]= -1;
- adjustcvalues(itm,ivenarg[k]);
- dropflag=1; /* say dropped an item so wont ask to pick it up right away */
- return(0);
- }
-
-/*
- function to enchant armor player is currently wearing
- */
-enchantarmor()
- {
- int tmp;
- if (c[WEAR]<0) { if (c[SHIELD] < 0)
- { cursors(); beep(); lprcat("\nYou feel a sense of loss"); return; }
- else { tmp=iven[c[SHIELD]]; if (tmp != OSCROLL) if (tmp != OPOTION) { ivenarg[c[SHIELD]]++; bottomline(); } } }
- tmp = iven[c[WEAR]];
- if (tmp!=OSCROLL) if (tmp!=OPOTION) { ivenarg[c[WEAR]]++; bottomline(); }
- }
-
-/*
- function to enchant a weapon presently being wielded
- */
-enchweapon()
- {
- int tmp;
- if (c[WIELD]<0)
- { cursors(); beep(); lprcat("\nYou feel a sense of loss"); return; }
- tmp = iven[c[WIELD]];
- if (tmp!=OSCROLL) if (tmp!=OPOTION)
- { ivenarg[c[WIELD]]++;
- if (tmp==OCLEVERRING) c[INTELLIGENCE]++; else
- if (tmp==OSTRRING) c[STREXTRA]++; else
- if (tmp==ODEXRING) c[DEXTERITY]++; bottomline(); }
- }
-
-/*
- routine to tell if player can carry one more thing
- returns 1 if pockets are full, else 0
- */
-pocketfull()
- {
- int i,limit;
- if ((limit = 15+(c[LEVEL]>>1)) > 26) limit=26;
- for (i=0; i<limit; i++) if (iven[i]==0) return(0);
- return(1);
- }
-
-/*
- function to return 1 if a monster is next to the player else returns 0
- */
-nearbymonst()
- {
- int tmp,tmp2;
- for (tmp=playerx-1; tmp<playerx+2; tmp++)
- for (tmp2=playery-1; tmp2<playery+2; tmp2++)
- if (mitem[tmp][tmp2]) return(1); /* if monster nearby */
- return(0);
- }
-
-/*
- function to steal an item from the players pockets
- returns 1 if steals something else returns 0
- */
-stealsomething()
- {
- int i,j;
- j=100;
- while (1)
- {
- i=rund(26);
- if (iven[i]) if (c[WEAR]!=i) if (c[WIELD]!=i) if (c[SHIELD]!=i)
- {
- srcount=0; show3(i);
- adjustcvalues(iven[i],ivenarg[i]); iven[i]=0; return(1);
- }
- if (--j <= 0) return(0);
- }
- }
-
-/*
- function to return 1 is player carrys nothing else return 0
- */
-emptyhanded()
- {
- int i;
- for (i=0; i<26; i++)
- if (iven[i]) if (i!=c[WIELD]) if (i!=c[WEAR]) if (i!=c[SHIELD]) return(0);
- return(1);
- }
-
-/*
- function to create a gem on a square near the player
- */
-creategem()
- {
- int i,j;
- switch(rnd(4))
- {
- case 1: i=ODIAMOND; j=50; break;
- case 2: i=ORUBY; j=40; break;
- case 3: i=OEMERALD; j=30; break;
- default: i=OSAPPHIRE; j=20; break;
- };
- createitem(i,rnd(j)+j/10);
- }
-
-/*
- function to change character levels as needed when dropping an object
- that affects these characteristics
- */
-adjustcvalues(itm,arg)
- int itm,arg;
- {
- int flag;
- flag=0;
- switch(itm)
- {
- case ODEXRING: c[DEXTERITY] -= arg+1; flag=1; break;
- case OSTRRING: c[STREXTRA] -= arg+1; flag=1; break;
- case OCLEVERRING: c[INTELLIGENCE] -= arg+1; flag=1; break;
- case OHAMMER: c[DEXTERITY] -= 10; c[STREXTRA] -= 10;
- c[INTELLIGENCE] += 10; flag=1; break;
- case OSWORDofSLASHING: c[DEXTERITY] -= 5; flag=1; break;
- case OORBOFDRAGON: --c[SLAYING]; return;
- case OSPIRITSCARAB: --c[NEGATESPIRIT]; return;
- case OCUBEofUNDEAD: --c[CUBEofUNDEAD]; return;
- case ONOTHEFT: --c[NOTHEFT]; return;
- case OLANCE: c[LANCEDEATH]=0; return;
- case OPOTION: case OSCROLL: return;
-
- default: flag=1;
- };
- if (flag) bottomline();
- }
-
-/*
- function to read a string from token input "string"
- returns a pointer to the string
- */
-gettokstr(str)
- char *str;
- {
- int i,j;
- i=50;
- while ((getchar() != '"') && (--i > 0));
- i=36;
- while (--i > 0)
- {
- if ((j=getchar()) != '"') *str++ = j; else i=0;
- }
- *str = 0;
- i=50;
- if (j != '"') while ((getchar() != '"') && (--i > 0)); /* if end due to too long, then find closing quote */
- }
-
-/*
- function to ask user for a password (no echo)
- returns 1 if entered correctly, 0 if not
- */
-static char gpwbuf[33];
-getpassword()
- {
- int i,j;
- char *gpwp;
- extern char *password;
- scbr(); /* system("stty -echo cbreak"); */
- gpwp = gpwbuf; lprcat("\nEnter Password: "); lflush();
- i = strlen(password);
- for (j=0; j<i; j++) read(0,gpwp++,1); gpwbuf[i]=0;
- sncbr(); /* system("stty echo -cbreak"); */
- if (strcmp(gpwbuf,password) != 0)
- { lprcat("\nSorry\n"); lflush(); return(0); }
- else return(1);
- }
-
-/*
- subroutine to get a yes or no response from the user
- returns y or n
- */
-getyn()
- {
- int i;
- i=0; while (i!='y' && i!='n' && i!='\33') i=getchar();
- return(i);
- }
-
-/*
- function to calculate the pack weight of the player
- returns the number of pounds the player is carrying
- */
-packweight()
- {
- int i,j,k;
- k=c[GOLD]/1000; j=25; while ((iven[j]==0) && (j>0)) --j;
- for (i=0; i<=j; i++)
- switch(iven[i])
- {
- case 0: break;
- case OSSPLATE: case OPLATEARMOR: k += 40; break;
- case OPLATE: k += 35; break;
- case OHAMMER: k += 30; break;
- case OSPLINT: k += 26; break;
- case OSWORDofSLASHING: case OCHAIN:
- case OBATTLEAXE: case O2SWORD: k += 23; break;
- case OLONGSWORD: case OSWORD:
- case ORING: case OFLAIL: k += 20; break;
- case OLANCE: case OSTUDLEATHER: k += 15; break;
- case OLEATHER: case OSPEAR: k += 8; break;
- case OORBOFDRAGON: case OBELT: k += 4; break;
- case OSHIELD: k += 7; break;
- case OCHEST: k += 30 + ivenarg[i]; break;
- default: k++;
- };
- return(k);
- }
-
-#ifndef MACRORND
- /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
-rnd(x)
- int x;
- {
- return((random()%x)+1);
- }
-
-rund(x)
- int x;
- {
- return(random()%x);
- }
-#endif /* MACRORND */
diff --git a/games/larn/header.h b/games/larn/header.h
deleted file mode 100644
index 07f8660..0000000
--- a/games/larn/header.h
+++ /dev/null
@@ -1,442 +0,0 @@
-/* header.h Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-
-#include <stdlib.h>
-#include <string.h>
-#include <termcap.h>
-#include <time.h>
-#include <unistd.h>
-
-#define MAXLEVEL 11
- /* max # levels in the dungeon */
-#define MAXVLEVEL 3
- /* max # of levels in the temple of the luran */
-#define MAXX 67
-#define MAXY 17
-
-#define SCORESIZE 10
- /* this is the number of people on a scoreboard max */
-#define MAXPLEVEL 100
- /* maximum player level allowed */
-#define MAXMONST 56
- /* maximum # monsters in the dungeon */
-#define SPNUM 38
- /* maximum number of spells in existance */
-#define MAXSCROLL 28
- /* maximum number of scrolls that are possible */
-#define MAXPOTION 35
- /* maximum number of potions that are possible */
-#define TIMELIMIT 30000
- /* the maximum number of moves before the game is called */
-#define TAXRATE 1/20
- /* the tax rate for the LRS */
-#define MAXOBJ 93
- /* the maximum number of objects n < MAXOBJ */
-
-/* this is the structure definition of the monster data */
-struct monst
- {
- char *name;
- char level;
- short armorclass;
- char damage;
- char attack;
- char defense;
- char genocided;
- char intelligence; /* monsters intelligence -- used to choose movement */
- short gold;
- short hitpoints;
- unsigned long experience;
- };
-
-/* this is the structure definition for the items in the dnd store */
-struct _itm
- {
- short price;
- char **mem;
- char obj;
- char arg;
- char qty;
- };
-
-/* this is the structure that holds the entire dungeon specifications */
-struct cel
- {
- short hitp; /* monster's hit points */
- char mitem; /* the monster ID */
- char item; /* the object's ID */
- short iarg; /* the object's argument */
- char know; /* have we been here before*/
- };
-
-/* this is the structure for maintaining & moving the spheres of annihilation */
-struct sphere
- {
- struct sphere *p; /* pointer to next structure */
- char x,y,lev; /* location of the sphere */
- char dir; /* direction sphere is going in */
- char lifetime; /* duration of the sphere */
- };
-
-/* defines for the character attribute array c[] */
-#define STRENGTH 0 /* characters physical strength not due to objects */
-#define INTELLIGENCE 1
-#define WISDOM 2
-#define CONSTITUTION 3
-#define DEXTERITY 4
-#define CHARISMA 5
-#define HPMAX 6
-#define HP 7
-#define GOLD 8
-#define EXPERIENCE 9
-#define LEVEL 10
-#define REGEN 11
-#define WCLASS 12
-#define AC 13
-#define BANKACCOUNT 14
-#define SPELLMAX 15
-#define SPELLS 16
-#define ENERGY 17
-#define ECOUNTER 18
-#define MOREDEFENSES 19
-#define WEAR 20
-#define PROTECTIONTIME 21
-#define WIELD 22
-#define AMULET 23
-#define REGENCOUNTER 24
-#define MOREDAM 25
-#define DEXCOUNT 26
-#define STRCOUNT 27
-#define BLINDCOUNT 28
-#define CAVELEVEL 29
-#define CONFUSE 30
-#define ALTPRO 31
-#define HERO 32
-#define CHARMCOUNT 33
-#define INVISIBILITY 34
-#define CANCELLATION 35
-#define HASTESELF 36
-#define EYEOFLARN 37
-#define AGGRAVATE 38
-#define GLOBE 39
-#define TELEFLAG 40
-#define SLAYING 41
-#define NEGATESPIRIT 42
-#define SCAREMONST 43
-#define AWARENESS 44
-#define HOLDMONST 45
-#define TIMESTOP 46
-#define HASTEMONST 47
-#define CUBEofUNDEAD 48
-#define GIANTSTR 49
-#define FIRERESISTANCE 50
-#define BESSMANN 51
-#define NOTHEFT 52
-#define HARDGAME 53
-#define CPUTIME 54
-#define BYTESIN 55
-#define BYTESOUT 56
-#define MOVESMADE 57
-#define MONSTKILLED 58
-#define SPELLSCAST 59
-#define LANCEDEATH 60
-#define SPIRITPRO 61
-#define UNDEADPRO 62
-#define SHIELD 63
-#define STEALTH 64
-#define ITCHING 65
-#define LAUGHING 66
-#define DRAINSTRENGTH 67
-#define CLUMSINESS 68
-#define INFEEBLEMENT 69
-#define HALFDAM 70
-#define SEEINVISIBLE 71
-#define FILLROOM 72
-#define RANDOMWALK 73
-#define SPHCAST 74 /* nz if an active sphere of annihilation */
-#define WTW 75 /* walk through walls */
-#define STREXTRA 76 /* character strength due to objects or enchantments */
-#define TMP 77 /* misc scratch space */
-#define LIFEPROT 78 /* life protection counter */
-
-/* defines for the objects in the game */
-
-#define OALTAR 1
-#define OTHRONE 2
-#define OORB 3
-#define OPIT 4
-#define OSTAIRSUP 5
-#define OELEVATORUP 6
-#define OFOUNTAIN 7
-#define OSTATUE 8
-#define OTELEPORTER 9
-#define OSCHOOL 10
-#define OMIRROR 11
-#define ODNDSTORE 12
-#define OSTAIRSDOWN 13
-#define OELEVATORDOWN 14
-#define OBANK2 15
-#define OBANK 16
-#define ODEADFOUNTAIN 17
-#define OMAXGOLD 70
-#define OGOLDPILE 18
-#define OOPENDOOR 19
-#define OCLOSEDDOOR 20
-#define OWALL 21
-#define OTRAPARROW 66
-#define OTRAPARROWIV 67
-
-#define OLARNEYE 22
-
-#define OPLATE 23
-#define OCHAIN 24
-#define OLEATHER 25
-#define ORING 60
-#define OSTUDLEATHER 61
-#define OSPLINT 62
-#define OPLATEARMOR 63
-#define OSSPLATE 64
-#define OSHIELD 68
-#define OELVENCHAIN 92
-
-#define OSWORDofSLASHING 26
-#define OHAMMER 27
-#define OSWORD 28
-#define O2SWORD 29
-#define OSPEAR 30
-#define ODAGGER 31
-#define OBATTLEAXE 57
-#define OLONGSWORD 58
-#define OFLAIL 59
-#define OLANCE 65
-#define OVORPAL 90
-#define OSLAYER 91
-
-#define ORINGOFEXTRA 32
-#define OREGENRING 33
-#define OPROTRING 34
-#define OENERGYRING 35
-#define ODEXRING 36
-#define OSTRRING 37
-#define OCLEVERRING 38
-#define ODAMRING 39
-
-#define OBELT 40
-
-#define OSCROLL 41
-#define OPOTION 42
-#define OBOOK 43
-#define OCHEST 44
-#define OAMULET 45
-
-#define OORBOFDRAGON 46
-#define OSPIRITSCARAB 47
-#define OCUBEofUNDEAD 48
-#define ONOTHEFT 49
-
-#define ODIAMOND 50
-#define ORUBY 51
-#define OEMERALD 52
-#define OSAPPHIRE 53
-
-#define OENTRANCE 54
-#define OVOLDOWN 55
-#define OVOLUP 56
-#define OHOME 69
-
-#define OKGOLD 71
-#define ODGOLD 72
-#define OIVDARTRAP 73
-#define ODARTRAP 74
-#define OTRAPDOOR 75
-#define OIVTRAPDOOR 76
-#define OTRADEPOST 77
-#define OIVTELETRAP 78
-#define ODEADTHRONE 79
-#define OANNIHILATION 80 /* sphere of annihilation */
-#define OTHRONE2 81
-#define OLRS 82 /* Larn Revenue Service */
-#define OCOOKIE 83
-#define OURN 84
-#define OBRASSLAMP 85
-#define OHANDofFEAR 86 /* hand of fear */
-#define OSPHTAILSMAN 87 /* tailsman of the sphere */
-#define OWWAND 88 /* wand of wonder */
-#define OPSTAFF 89 /* staff of power */
-/* used up to 92 */
-
-/* defines for the monsters as objects */
-
-#define BAT 1
-#define GNOME 2
-#define HOBGOBLIN 3
-#define JACKAL 4
-#define KOBOLD 5
-#define ORC 6
-#define SNAKE 7
-#define CENTIPEDE 8
-#define JACULI 9
-#define TROGLODYTE 10
-#define ANT 11
-#define EYE 12
-#define LEPRECHAUN 13
-#define NYMPH 14
-#define QUASIT 15
-#define RUSTMONSTER 16
-#define ZOMBIE 17
-#define ASSASSINBUG 18
-#define BUGBEAR 19
-#define HELLHOUND 20
-#define ICELIZARD 21
-#define CENTAUR 22
-#define TROLL 23
-#define YETI 24
-#define WHITEDRAGON 25
-#define ELF 26
-#define CUBE 27
-#define METAMORPH 28
-#define VORTEX 29
-#define ZILLER 30
-#define VIOLETFUNGI 31
-#define WRAITH 32
-#define FORVALAKA 33
-#define LAMANOBE 34
-#define OSEQUIP 35
-#define ROTHE 36
-#define XORN 37
-#define VAMPIRE 38
-#define INVISIBLESTALKER 39
-#define POLTERGEIST 40
-#define DISENCHANTRESS 41
-#define SHAMBLINGMOUND 42
-#define YELLOWMOLD 43
-#define UMBERHULK 44
-#define GNOMEKING 45
-#define MIMIC 46
-#define WATERLORD 47
-#define BRONZEDRAGON 48
-#define GREENDRAGON 49
-#define PURPLEWORM 50
-#define XVART 51
-#define SPIRITNAGA 52
-#define SILVERDRAGON 53
-#define PLATINUMDRAGON 54
-#define GREENURCHIN 55
-#define REDDRAGON 56
-#define DEMONLORD 57
-#define DEMONPRINCE 64
-
-#define NULL 0
-#define BUFBIG 4096 /* size of the output buffer */
-#define MAXIBUF 4096 /* size of the input buffer */
-#define LOGNAMESIZE 40 /* max size of the players name */
-#define PSNAMESIZE 40 /* max size of the process name */
-
-#ifndef NODEFS
-extern char VERSION,SUBVERSION;
-extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
-extern char *class[],course[],diagfile[],fortfile[],helpfile[];
-extern char *inbuffer,is_alpha[],is_digit[];
-extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
-extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
-extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
-extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
-extern char nplt[],nsw[],*objectname[];
-extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
-extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
-extern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[];
-extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM];
-extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard;
-extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
-extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
-extern short nobeep,oldx,oldy,playerx,playery;
-extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
-extern time_t initialtime;
-extern long outstanding_taxes,skill[],gtime,c[],cbak[];
-extern struct cel *cell;
-extern struct monst monster[];
-extern struct sphere *spheres;
-extern struct _itm itm[];
-
-char *fortune(),*lgetw(),*lgetl();
-char *tmcapcnv();
-long paytaxes(),lgetc(),lrint();
-unsigned long readnum();
-
- /* macro to create scroll #'s with probability of occurrence */
-#define newscroll() (scprob[rund(81)])
- /* macro to return a potion # created with probability of occurrence */
-#define newpotion() (potprob[rund(41)])
- /* macro to return the + points on created leather armor */
-#define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
- /* macro to return the + points on chain armor */
-#define newchain() (nch[rund(10)])
- /* macro to return + points on plate armor */
-#define newplate() (nplt[rund(c[HARDGAME]?4:12)])
- /* macro to return + points on new daggers */
-#define newdagger() (ndgg[rund(13)])
- /* macro to return + points on new swords */
-#define newsword() (nsw[rund(c[HARDGAME]?6:13)])
- /* macro to destroy object at present location */
-#define forget() (item[playerx][playery]=know[playerx][playery]=0)
- /* macro to wipe out a monster at a location */
-#define disappear(x,y) (mitem[x][y]=know[x][y]=0)
-
-#ifdef VT100
- /* macro to turn on bold display for the terminal */
-#define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
- /* macro to turn off bold display for the terminal */
-#define resetbold() (lprcat("\33[m"))
- /* macro to setup the scrolling region for the terminal */
-#define setscroll() (lprcat("\33[20;24r"))
- /* macro to clear the scrolling region for the terminal */
-#define resetscroll() (lprcat("\33[;24r"))
- /* macro to clear the screen and home the cursor */
-#define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
-#define cltoeoln() lprcat("\33[K")
-#else /* VT100 */
- /* defines below are for use in the termcap mode only */
-#define ST_START 1
-#define ST_END 2
-#define BOLD 3
-#define END_BOLD 4
-#define CLEAR 5
-#define CL_LINE 6
-#define CL_DOWN 14
-#define CURSOR 15
- /* macro to turn on bold display for the terminal */
-#define setbold() (*lpnt++ = ST_START)
- /* macro to turn off bold display for the terminal */
-#define resetbold() (*lpnt++ = ST_END)
- /* macro to setup the scrolling region for the terminal */
-#define setscroll() enable_scroll=1
- /* macro to clear the scrolling region for the terminal */
-#define resetscroll() enable_scroll=0
- /* macro to clear the screen and home the cursor */
-#define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
- /* macro to clear to end of line */
-#define cltoeoln() (*lpnt++ = CL_LINE)
-#endif /* VT100 */
-
- /* macro to output one byte to the output buffer */
-#define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
-
-#ifdef MACRORND
-extern unsigned long randx;
- /* macro to seed the random number generator */
-#define srand(x) (randx=x)
- /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
-#define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
-#define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
-#endif /* MACRORND */
- /* macros for miscellaneous data conversion */
-#define min(x,y) (((x)>(y))?(y):(x))
-#define max(x,y) (((x)>(y))?(x):(y))
-#define isalpha(x) (is_alpha[x])
-#define isdigit(x) (is_digit[x])
-#define tolower(x) (to_lower[x])
-#define toupper(x) (to_upper[x])
-#define lcc(x) (to_lower[x])
-#define ucc(x) (to_upper[x])
-#endif /* NODEFS */
-
diff --git a/games/larn/help.c b/games/larn/help.c
deleted file mode 100644
index 5bb04bb..0000000
--- a/games/larn/help.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* help.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-/*
- * help function to display the help info
- *
- * format of the .larn.help file
- *
- * 1st character of file: # of pages of help available (ascii digit)
- * page (23 lines) for the introductory message (not counted in above)
- * pages of help text (23 lines per page)
- */
-extern char helpfile[];
-help()
- {
- int i,j;
-#ifndef VT100
- char tmbuf[128]; /* intermediate translation buffer when not a VT100 */
-#endif /* VT100 */
- if ((j=openhelp()) < 0) return; /* open the help file and get # pages */
- for (i=0; i<23; i++) lgetl(); /* skip over intro message */
- for (; j>0; j--)
- {
- clear();
- for (i=0; i<23; i++)
-#ifdef VT100
- lprcat(lgetl()); /* print out each line that we read in */
-#else /* VT100 */
- { tmcapcnv(tmbuf,lgetl()); lprcat(tmbuf); } /* intercept \33's */
-#endif /* VT100 */
- if (j>1)
- {
- lprcat(" ---- Press "); standout("return");
- lprcat(" to exit, "); standout("space");
- lprcat(" for more help ---- ");
- i=0; while ((i!=' ') && (i!='\n') && (i!='\33')) i=getchar();
- if ((i=='\n') || (i=='\33'))
- {
- lrclose(); setscroll(); drawscreen(); return;
- }
- }
- }
- lrclose(); retcont(); drawscreen();
- }
-
-/*
- * function to display the welcome message and background
- */
-welcome()
- {
- int i;
-#ifndef VT100
- char tmbuf[128]; /* intermediate translation buffer when not a VT100 */
-#endif /* VT100 */
- if (openhelp() < 0) return; /* open the help file */
- clear();
- for(i=0; i<23; i++)
-#ifdef VT100
- lprcat(lgetl()); /* print out each line that we read in */
-#else /* VT100 */
- { tmcapcnv(tmbuf,lgetl()); lprcat(tmbuf); } /* intercept \33's */
-#endif /* VT100 */
- lrclose(); retcont(); /* press return to continue */
- }
-
-/*
- * function to say press return to continue and reset scroll when done
- */
-retcont()
- {
- cursor(1,24); lprcat("Press "); standout("return");
- lprcat(" to continue: "); while (getchar() != '\n');
- setscroll();
- }
-
-/*
- * routine to open the help file and return the first character - '0'
- */
-openhelp()
- {
- if (lopen(helpfile)<0)
- {
- lprintf("Can't open help file \"%s\" ",helpfile);
- lflush(); sleep(4); drawscreen(); setscroll(); return(-1);
- }
- resetscroll(); return(lgetc() - '0');
- }
-
diff --git a/games/larn/holidays b/games/larn/holidays
deleted file mode 100644
index 3071ea4..0000000
--- a/games/larn/holidays
+++ /dev/null
@@ -1,66 +0,0 @@
-"Nov 27 1986 Thanksgiving"
-"Dec 25 1986 Christmas"
-
-"Jan 01 1987 New Years Day."
-"Feb 16 1987 Washingtons Birthday (Presidents Day)"
-"May 25 1987 Memorial Day"
-"Jul 04 1987 Independence Day"
-"Sep 07 1987 Labor Day"
-"Oct 12 1987 Columbus Day"
-"Nov 26 1987 Thanksgiving"
-"Dec 25 1987 Christmas"
-
-"Jan 01 1988 New Years Day."
-"Feb 15 1988 Washingtons Birthday (Presidents Day)"
-"May 30 1988 Memorial Day"
-"Jul 04 1988 Independence Day"
-"Sep 05 1988 Labor Day"
-"Oct 10 1988 Columbus Day"
-"Nov 24 1988 Thanksgiving"
-"Dec 25 1988 Christmas"
-
-"Jan 01 1989 New Years Day."
-"Feb 13 1989 Washingtons Birthday (Presidents Day)"
-"May 28 1989 Memorial Day"
-"Jul 04 1989 Independence Day"
-"Sep 03 1989 Labor Day"
-"Oct 15 1989 Columbus Day"
-"Nov 29 1989 Thanksgiving"
-"Dec 25 1989 Christmas"
-
-"Jan 01 1990 New Years Day."
-"Feb 12 1990 Washingtons Birthday (Presidents Day)"
-"May 27 1990 Memorial Day"
-"Jul 04 1990 Independence Day"
-"Sep 02 1990 Labor Day"
-"Oct 14 1990 Columbus Day"
-"Nov 28 1990 Thanksgiving"
-"Dec 25 1990 Christmas"
-
-"Jan 01 1991 New Years Day."
-"Feb 11 1991 Washingtons Birthday (Presidents Day)"
-"May 26 1991 Memorial Day"
-"Jul 04 1991 Independence Day"
-"Sep 01 1991 Labor Day"
-"Oct 10 1991 Columbus Day"
-"Nov 27 1991 Thanksgiving"
-"Dec 25 1991 Christmas"
-
-"Jan 01 1992 New Years Day."
-"Feb 10 1992 Washingtons Birthday (Presidents Day)"
-"May 25 1992 Memorial Day"
-"Jul 04 1992 Independence Day"
-"Sep 07 1992 Labor Day"
-"Oct 12 1992 Columbus Day"
-"Nov 26 1992 Thanksgiving"
-"Dec 25 1992 Christmas"
-
-"Jan 01 1993 New Years Day."
-"Feb 15 1993 Washingtons Birthday (Presidents Day)"
-"May 30 1993 Memorial Day"
-"Jul 04 1993 Independence Day"
-"Sep 05 1993 Labor Day"
-"Oct 10 1993 Columbus Day"
-"Nov 24 1993 Thanksgiving"
-"Dec 25 1993 Christmas"
-
diff --git a/games/larn/io.c b/games/larn/io.c
deleted file mode 100644
index 0a130b4..0000000
--- a/games/larn/io.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/* io.c Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * Below are the functions in this file:
- *
- * setupvt100() Subroutine to set up terminal in correct mode for game
- * clearvt100() Subroutine to clean up terminal when the game is over
- * getchar() Routine to read in one character from the terminal
- * scbr() Function to set cbreak -echo for the terminal
- * sncbr() Function to set -cbreak echo for the terminal
- * newgame() Subroutine to save the initial time and seed rnd()
- *
- * FILE OUTPUT ROUTINES
- *
- * lprintf(format,args . . .) printf to the output buffer
- * lprint(integer) send binary integer to output buffer
- * lwrite(buf,len) write a buffer to the output buffer
- * lprcat(str) sent string to output buffer
- *
- * FILE OUTPUT MACROS (in header.h)
- *
- * lprc(character) put the character into the output buffer
- *
- * FILE INPUT ROUTINES
- *
- * long lgetc() read one character from input buffer
- * long lrint() read one integer from input buffer
- * lrfill(address,number) put input bytes into a buffer
- * char *lgetw() get a whitespace ended word from input
- * char *lgetl() get a \n or EOF ended line from input
- *
- * FILE OPEN / CLOSE ROUTINES
- *
- * lcreat(filename) create a new file for write
- * lopen(filename) open a file for read
- * lappend(filename) open for append to an existing file
- * lrclose() close the input file
- * lwclose() close output file
- * lflush() flush the output buffer
- *
- * Other Routines
- *
- * cursor(x,y) position cursor at [x,y]
- * cursors() position cursor at [1,24] (saves memory)
- * cl_line(x,y) Clear line at [1,y] and leave cursor at [x,y]
- * cl_up(x,y) Clear screen from [x,1] to current line.
- * cl_dn(x,y) Clear screen from [1,y] to end of display.
- * standout(str) Print the string in standout mode.
- * set_score_output() Called when output should be literally printed.
- ** putchar(ch) Print one character in decoded output buffer.
- ** flush_buf() Flush buffer with decoded output.
- ** init_term() Terminal initialization -- setup termcap info
- ** char *tmcapcnv(sd,ss) Routine to convert VT100 \33's to termcap format
- * beep() Routine to emit a beep if enabled (see no-beep in .larnopts)
- *
- * Note: ** entries are available only in termcap mode.
- */
-
-#include "header.h"
-
-#ifdef SYSV /* system III or system V */
-#include <termio.h>
-#define sgttyb termio
-#define stty(_a,_b) ioctl(_a,TCSETA,_b)
-#define gtty(_a,_b) ioctl(_a,TCGETA,_b)
-static int rawflg = 0;
-static char saveeof,saveeol;
-#define doraw(_a) if(!rawflg){++rawflg;saveeof=_a.c_cc[VMIN];saveeol=_a.c_cc[VTIME];}\
- _a.c_cc[VMIN]=1;_a.c_cc[VTIME]=1;_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL)
-#define unraw(_a) _a.c_cc[VMIN]=saveeof;_a.c_cc[VTIME]=saveeol;_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL
-
-#else /* not SYSV */
-
-#ifndef BSD
-#define CBREAK RAW /* V7 has no CBREAK */
-#endif
-
-#define doraw(_a) (_a.sg_flags |= CBREAK,_a.sg_flags &= ~ECHO)
-#define unraw(_a) (_a.sg_flags &= ~CBREAK,_a.sg_flags |= ECHO)
-#include <sgtty.h>
-#endif /* not SYSV */
-
-#ifndef NOVARARGS /* if we have varargs */
-#include <varargs.h>
-#else /* NOVARARGS *//* if we don't have varargs */
-typedef char *va_list;
-#define va_dcl int va_alist;
-#define va_start(plist) plist = (char *) &va_alist
-#define va_end(plist)
-#define va_arg(plist,mode) ((mode *)(plist += sizeof(mode)))[-1]
-#endif /* NOVARARGS */
-
-#define LINBUFSIZE 128 /* size of the lgetw() and lgetl() buffer */
-int lfd; /* output file numbers */
-int fd; /* input file numbers */
-static struct sgttyb ttx; /* storage for the tty modes */
-static int ipoint=MAXIBUF,iepoint=MAXIBUF; /* input buffering pointers */
-static char lgetwbuf[LINBUFSIZE]; /* get line (word) buffer */
-
-/*
- * setupvt100() Subroutine to set up terminal in correct mode for game
- *
- * Attributes off, clear screen, set scrolling region, set tty mode
- */
-setupvt100()
- {
- clear(); setscroll(); scbr(); /* system("stty cbreak -echo"); */
- }
-
-/*
- * clearvt100() Subroutine to clean up terminal when the game is over
- *
- * Attributes off, clear screen, unset scrolling region, restore tty mode
- */
-clearvt100()
- {
- resetscroll(); clear(); sncbr(); /* system("stty -cbreak echo"); */
- }
-
-/*
- * getchar() Routine to read in one character from the terminal
- */
-getchar()
- {
- char byt;
-#ifdef EXTRA
- c[BYTESIN]++;
-#endif
- lflush(); /* be sure output buffer is flushed */
- read(0,&byt,1); /* get byte from terminal */
- return(byt);
- }
-
-/*
- * scbr() Function to set cbreak -echo for the terminal
- *
- * like: system("stty cbreak -echo")
- */
-scbr()
- {
- gtty(0,&ttx); doraw(ttx); stty(0,&ttx);
- }
-
-/*
- * sncbr() Function to set -cbreak echo for the terminal
- *
- * like: system("stty -cbreak echo")
- */
-sncbr()
- {
- gtty(0,&ttx); unraw(ttx); stty(0,&ttx);
- }
-
-/*
- * newgame() Subroutine to save the initial time and seed rnd()
- */
-newgame()
- {
- long *p,*pe;
- for (p=c,pe=c+100; p<pe; *p++ =0);
- time(&initialtime); srandomdev();
- lcreat((char*)0); /* open buffering for output to terminal */
- }
-
-/*
- * lprintf(format,args . . .) printf to the output buffer
- * char *format;
- * ??? args . . .
- *
- * Enter with the format string in "format", as per printf() usage
- * and any needed arguments following it
- * Note: lprintf() only supports %s, %c and %d, with width modifier and left
- * or right justification.
- * No correct checking for output buffer overflow is done, but flushes
- * are done beforehand if needed.
- * Returns nothing of value.
- */
-#ifdef lint
-/*VARARGS*/
-lprintf(str)
- char *str;
- {
- char *str2;
- str2 = str;
- str = str2; /* to make lint happy */
- }
-/*VARARGS*/
-sprintf(str)
- char *str;
- {
- char *str2;
- str2 = str;
- str = str2; /* to make lint happy */
- }
-#else /* lint */
-/*VARARGS*/
-lprintf(va_alist)
-va_dcl
- {
- va_list ap; /* pointer for variable argument list */
- char *fmt;
- char *outb,*tmpb;
- long wide,left,cont,n; /* data for lprintf */
- char db[12]; /* %d buffer in lprintf */
-
- va_start(ap); /* initialize the var args pointer */
- fmt = va_arg(ap, char *); /* pointer to format string */
- if (lpnt >= lpend) lflush();
- outb = lpnt;
- for ( ; ; )
- {
- while (*fmt != '%')
- if (*fmt) *outb++ = *fmt++; else { lpnt=outb; return; }
- wide = 0; left = 1; cont=1;
- while (cont)
- switch(*(++fmt))
- {
- case 'd': n = va_arg(ap, long);
- if (n<0) { n = -n; *outb++ = '-'; if (wide) --wide; }
- tmpb = db+11; *tmpb = (char)(n % 10 + '0');
- while (n>9) *(--tmpb) = (char)((n /= 10) % 10 + '0');
- if (wide==0) while (tmpb < db+12) *outb++ = *tmpb++;
- else
- {
- wide -= db-tmpb+12;
- if (left) while (wide-- > 0) *outb++ = ' ';
- while (tmpb < db+12) *outb++ = *tmpb++;
- if (left==0) while (wide-- > 0) *outb++ = ' ';
- }
- cont=0; break;
-
- case 's': tmpb = va_arg(ap, char *);
- if (wide==0) { while (*outb++ = *tmpb++); --outb; }
- else
- {
- n = wide - strlen(tmpb);
- if (left) while (n-- > 0) *outb++ = ' ';
- while (*outb++ = *tmpb++); --outb;
- if (left==0) while (n-- > 0) *outb++ = ' ';
- }
- cont=0; break;
-
- case 'c': *outb++ = va_arg(ap, int); cont=0; break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': wide = 10*wide + *fmt - '0'; break;
-
- case '-': left = 0; break;
-
- default: *outb++ = *fmt; cont=0; break;
- };
- fmt++;
- }
- va_end(ap);
- }
-#endif /* lint */
-
-/*
- * lprint(long-integer) send binary integer to output buffer
- * long integer;
- *
- * +---------+---------+---------+---------+
- * | high | | | low |
- * | order | | | order |
- * | byte | | | byte |
- * +---------+---------+---------+---------+
- * 31 --- 24 23 --- 16 15 --- 8 7 --- 0
- *
- * The save order is low order first, to high order (4 bytes total)
- * and is written to be system independent.
- * No checking for output buffer overflow is done, but flushes if needed!
- * Returns nothing of value.
- */
-lprint(x)
- long x;
- {
- if (lpnt >= lpend) lflush();
- *lpnt++ = 255 & x; *lpnt++ = 255 & (x>>8);
- *lpnt++ = 255 & (x>>16); *lpnt++ = 255 & (x>>24);
- }
-
-/*
- * lwrite(buf,len) write a buffer to the output buffer
- * char *buf;
- * int len;
- *
- * Enter with the address and number of bytes to write out
- * Returns nothing of value
- */
-lwrite(buf,len)
- char *buf;
- int len;
- {
- char *str;
- int num2;
- if (len > 399) /* don't copy data if can just write it */
- {
-#ifdef EXTRA
- c[BYTESOUT] += len;
-#endif
-
-#ifndef VT100
- for (str=buf; len>0; --len)
- lprc(*str++);
-#else /* VT100 */
- lflush();
- write(lfd,buf,len);
-#endif /* VT100 */
- }
- else while (len)
- {
- if (lpnt >= lpend) lflush(); /* if buffer is full flush it */
- num2 = lpbuf+BUFBIG-lpnt; /* # bytes left in output buffer */
- if (num2 > len) num2=len;
- str = lpnt; len -= num2;
- while (num2--) *str++ = *buf++; /* copy in the bytes */
- lpnt = str;
- }
- }
-
-/*
- * long lgetc() Read one character from input buffer
- *
- * Returns 0 if EOF, otherwise the character
- */
-long lgetc()
- {
- int i;
- if (ipoint != iepoint) return(inbuffer[ipoint++]);
- if (iepoint!=MAXIBUF) return(0);
- if ((i=read(fd,inbuffer,MAXIBUF))<=0)
- {
- if (i!=0) write(1,"error reading from input file\n",30);
- iepoint = ipoint = 0; return(0);
- }
- ipoint=1; iepoint=i; return(*inbuffer);
- }
-
-/*
- * long lrint() Read one integer from input buffer
- *
- * +---------+---------+---------+---------+
- * | high | | | low |
- * | order | | | order |
- * | byte | | | byte |
- * +---------+---------+---------+---------+
- * 31 --- 24 23 --- 16 15 --- 8 7 --- 0
- *
- * The save order is low order first, to high order (4 bytes total)
- * Returns the int read
- */
-long lrint()
- {
- unsigned long i;
- i = 255 & lgetc(); i |= (255 & lgetc()) << 8;
- i |= (255 & lgetc()) << 16; i |= (255 & lgetc()) << 24;
- return(i);
- }
-
-/*
- * lrfill(address,number) put input bytes into a buffer
- * char *address;
- * int number;
- *
- * Reads "number" bytes into the buffer pointed to by "address".
- * Returns nothing of value
- */
-lrfill(adr,num)
- char *adr;
- int num;
- {
- char *pnt;
- int num2;
- while (num)
- {
- if (iepoint == ipoint)
- {
- if (num>5) /* fast way */
- {
- if (read(fd,adr,num) != num)
- write(2,"error reading from input file\n",30);
- num=0;
- }
- else { *adr++ = lgetc(); --num; }
- }
- else
- {
- num2 = iepoint-ipoint; /* # of bytes left in the buffer */
- if (num2 > num) num2=num;
- pnt = inbuffer+ipoint; num -= num2; ipoint += num2;
- while (num2--) *adr++ = *pnt++;
- }
- }
- }
-
-/*
- * char *lgetw() Get a whitespace ended word from input
- *
- * Returns pointer to a buffer that contains word. If EOF, returns a NULL
- */
-char *lgetw()
- {
- char *lgp,cc;
- int n=LINBUFSIZE,quote=0;
- lgp = lgetwbuf;
- do cc=lgetc(); while ((cc <= 32) && (cc > NULL)); /* eat whitespace */
- for ( ; ; --n,cc=lgetc())
- {
- if ((cc==NULL) && (lgp==lgetwbuf)) return(NULL); /* EOF */
- if ((n<=1) || ((cc<=32) && (quote==0))) { *lgp=NULL; return(lgetwbuf); }
- if (cc != '"') *lgp++ = cc; else quote ^= 1;
- }
- }
-
-/*
- * char *lgetl() Function to read in a line ended by newline or EOF
- *
- * Returns pointer to a buffer that contains the line. If EOF, returns NULL
- */
-char *lgetl()
- {
- int i=LINBUFSIZE,ch;
- char *str=lgetwbuf;
- for ( ; ; --i)
- {
- if ((*str++ = ch = lgetc()) == NULL)
- {
- if (str == lgetwbuf+1) return(NULL); /* EOF */
- ot: *str = NULL; return(lgetwbuf); /* line ended by EOF */
- }
- if ((ch=='\n') || (i<=1)) goto ot; /* line ended by \n */
- }
- }
-
-/*
- * lcreat(filename) Create a new file for write
- * char *filename;
- *
- * lcreat((char*)0); means to the terminal
- * Returns -1 if error, otherwise the file descriptor opened.
- */
-lcreat(str)
- char *str;
- {
- lpnt = lpbuf; lpend = lpbuf+BUFBIG;
- if (str==NULL) return(lfd=1);
- if ((lfd=creat(str,0644)) < 0)
- {
- lfd=1; lprintf("error creating file <%s>\n",str); lflush(); return(-1);
- }
- return(lfd);
- }
-
-/*
- * lopen(filename) Open a file for read
- * char *filename;
- *
- * lopen(0) means from the terminal
- * Returns -1 if error, otherwise the file descriptor opened.
- */
-lopen(str)
- char *str;
- {
- ipoint = iepoint = MAXIBUF;
- if (str==NULL) return(fd=0);
- if ((fd=open(str,0)) < 0)
- {
- lwclose(); lfd=1; lpnt=lpbuf; return(-1);
- }
- return(fd);
- }
-
-/*
- * lappend(filename) Open for append to an existing file
- * char *filename;
- *
- * lappend(0) means to the terminal
- * Returns -1 if error, otherwise the file descriptor opened.
- */
-lappend(str)
- char *str;
- {
- lpnt = lpbuf; lpend = lpbuf+BUFBIG;
- if (str==NULL) return(lfd=1);
- if ((lfd=open(str,2)) < 0)
- {
- lfd=1; return(-1);
- }
- lseek(lfd,0,2); /* seek to end of file */
- return(lfd);
- }
-
-/*
- * lrclose() close the input file
- *
- * Returns nothing of value.
- */
-lrclose()
- {
- if (fd > 0) close(fd);
- }
-
-/*
- * lwclose() close output file flushing if needed
- *
- * Returns nothing of value.
- */
-lwclose()
- {
- lflush(); if (lfd > 2) close(lfd);
- }
-
-/*
- * lprcat(string) append a string to the output buffer
- * avoids calls to lprintf (time consuming)
- */
-lprcat(str)
- char *str;
- {
- char *str2;
- if (lpnt >= lpend) lflush();
- str2 = lpnt;
- while (*str2++ = *str++);
- lpnt = str2 - 1;
- }
-
-#ifdef VT100
-/*
- * cursor(x,y) Subroutine to set the cursor position
- *
- * x and y are the cursor coordinates, and lpbuff is the output buffer where
- * escape sequence will be placed.
- */
-static char *y_num[]= { "\33[","\33[","\33[2","\33[3","\33[4","\33[5","\33[6",
- "\33[7","\33[8","\33[9","\33[10","\33[11","\33[12","\33[13","\33[14",
- "\33[15","\33[16","\33[17","\33[18","\33[19","\33[20","\33[21","\33[22",
- "\33[23","\33[24" };
-
-static char *x_num[]= { "H","H",";2H",";3H",";4H",";5H",";6H",";7H",";8H",";9H",
- ";10H",";11H",";12H",";13H",";14H",";15H",";16H",";17H",";18H",";19H",
- ";20H",";21H",";22H",";23H",";24H",";25H",";26H",";27H",";28H",";29H",
- ";30H",";31H",";32H",";33H",";34H",";35H",";36H",";37H",";38H",";39H",
- ";40H",";41H",";42H",";43H",";44H",";45H",";46H",";47H",";48H",";49H",
- ";50H",";51H",";52H",";53H",";54H",";55H",";56H",";57H",";58H",";59H",
- ";60H",";61H",";62H",";63H",";64H",";65H",";66H",";67H",";68H",";69H",
- ";70H",";71H",";72H",";73H",";74H",";75H",";76H",";77H",";78H",";79H",
- ";80H" };
-
-cursor(x,y)
- int x,y;
- {
- char *p;
- if (lpnt >= lpend) lflush();
-
- p = y_num[y]; /* get the string to print */
- while (*p) *lpnt++ = *p++; /* print the string */
-
- p = x_num[x]; /* get the string to print */
- while (*p) *lpnt++ = *p++; /* print the string */
- }
-#else /* VT100 */
-/*
- * cursor(x,y) Put cursor at specified coordinates staring at [1,1] (termcap)
- */
-cursor (x,y)
- int x,y;
- {
- if (lpnt >= lpend) lflush ();
-
- *lpnt++ = CURSOR; *lpnt++ = x; *lpnt++ = y;
- }
-#endif /* VT100 */
-
-/*
- * Routine to position cursor at beginning of 24th line
- */
-cursors()
- {
- cursor(1,24);
- }
-
-#ifndef VT100
-/*
- * Warning: ringing the bell is control code 7. Don't use in defines.
- * Don't change the order of these defines.
- * Also used in helpfiles. Codes used in helpfiles should be \E[1 to \E[7 with
- * obvious meanings.
- */
-
-static char cap[256];
-char *CM, *CE, *CD, *CL, *SO, *SE, *AL, *DL;/* Termcap capabilities */
-static char *outbuf=0; /* translated output buffer */
-
-int putchar ();
-
-/*
- * init_term() Terminal initialization -- setup termcap info
- */
-init_term()
- {
- char termbuf[1024];
- char *capptr = cap+10;
- char *term;
- struct sgttyb tt;
-
- switch (tgetent(termbuf, term = getenv("TERM")))
- {
- case -1:
- write(2, "Cannot open termcap file.\n", 26); exit(1);
- case 0:
- write(2, "Cannot find entry of ", 21);
- write(2, term, strlen (term));
- write(2, " in termcap\n", 12);
- exit(1);
- };
-
- if (gtty(0, &tt) == 0)
- /* ospeed = tt.sg_ospeed */ ;
-
- CM = tgetstr("cm", &capptr); /* Cursor motion */
- CE = tgetstr("ce", &capptr); /* Clear to eoln */
- CL = tgetstr("cl", &capptr); /* Clear screen */
-
-/* OPTIONAL */
- AL = tgetstr("al", &capptr); /* Insert line */
- DL = tgetstr("dl", &capptr); /* Delete line */
- SO = tgetstr("so", &capptr); /* Begin standout mode */
- SE = tgetstr("se", &capptr); /* End standout mode */
- CD = tgetstr("cd", &capptr); /* Clear to end of display */
-
- if (!CM) /* can't find cursor motion entry */
- {
- write(2, "Sorry, for a ",13); write(2, term, strlen(term));
- write(2, ", I can't find the cursor motion entry in termcap\n",50);
- exit(1);
- }
- if (!CE) /* can't find clear to end of line entry */
- {
- write(2, "Sorry, for a ",13); write(2, term, strlen(term));
- write(2,", I can't find the clear to end of line entry in termcap\n",57);
- exit(1);
- }
- if (!CL) /* can't find clear entire screen entry */
- {
- write(2, "Sorry, for a ",13); write(2, term, strlen(term));
- write(2, ", I can't find the clear entire screen entry in termcap\n",56);
- exit(1);
- }
- if ((outbuf=malloc(BUFBIG+16))==0) /* get memory for decoded output buffer*/
- {
- write(2,"Error malloc'ing memory for decoded output buffer\n",50);
- died(-285); /* malloc() failure */
- }
- }
-#endif /* VT100 */
-
-/*
- * cl_line(x,y) Clear the whole line indicated by 'y' and leave cursor at [x,y]
- */
-cl_line(x,y)
- int x,y;
- {
-#ifdef VT100
- cursor(x,y); lprcat("\33[2K");
-#else /* VT100 */
- cursor(1,y); *lpnt++ = CL_LINE; cursor(x,y);
-#endif /* VT100 */
- }
-
-/*
- * cl_up(x,y) Clear screen from [x,1] to current position. Leave cursor at [x,y]
- */
-cl_up(x,y)
- int x,y;
- {
-#ifdef VT100
- cursor(x,y); lprcat("\33[1J\33[2K");
-#else /* VT100 */
- int i;
- cursor(1,1);
- for (i=1; i<=y; i++) { *lpnt++ = CL_LINE; *lpnt++ = '\n'; }
- cursor(x,y);
-#endif /* VT100 */
- }
-
-/*
- * cl_dn(x,y) Clear screen from [1,y] to end of display. Leave cursor at [x,y]
- */
-cl_dn(x,y)
- int x,y;
- {
-#ifdef VT100
- cursor(x,y); lprcat("\33[J\33[2K");
-#else /* VT100 */
- int i;
- cursor(1,y);
- if (!CD)
- {
- *lpnt++ = CL_LINE;
- for (i=y; i<=24; i++) { *lpnt++ = CL_LINE; if (i!=24) *lpnt++ = '\n'; }
- cursor(x,y);
- }
- else
- *lpnt++ = CL_DOWN;
- cursor(x,y);
-#endif /* VT100 */
- }
-
-/*
- * standout(str) Print the argument string in inverse video (standout mode).
- */
-standout(str)
- char *str;
- {
-#ifdef VT100
- setbold();
- while (*str)
- *lpnt++ = *str++;
- resetbold();
-#else /* VT100 */
- *lpnt++ = ST_START;
- while (*str)
- *lpnt++ = *str++;
- *lpnt++ = ST_END;
-#endif /* VT100 */
- }
-
-/*
- * set_score_output() Called when output should be literally printed.
- */
-set_score_output()
- {
- enable_scroll = -1;
- }
-
-/*
- * lflush() Flush the output buffer
- *
- * Returns nothing of value.
- * for termcap version: Flush output in output buffer according to output
- * status as indicated by `enable_scroll'
- */
-#ifndef VT100
-static int scrline=18; /* line # for wraparound instead of scrolling if no DL */
-lflush ()
- {
- int lpoint;
- char *str;
- static int curx = 0;
- static int cury = 0;
-
- if ((lpoint = lpnt - lpbuf) > 0)
- {
-#ifdef EXTRA
- c[BYTESOUT] += lpoint;
-#endif
- if (enable_scroll <= -1)
- {
- flush_buf();
- if (write(lfd,lpbuf,lpoint) != lpoint)
- write(2,"error writing to output file\n",29);
- lpnt = lpbuf; /* point back to beginning of buffer */
- return;
- }
- for (str = lpbuf; str < lpnt; str++)
- {
- if (*str>=32) { putchar (*str); curx++; }
- else switch (*str)
- {
- case CLEAR: tputs (CL, 0, putchar); curx = cury = 0;
- break;
-
- case CL_LINE: tputs (CE, 0, putchar);
- break;
-
- case CL_DOWN: tputs (CD, 0, putchar);
- break;
-
- case ST_START: tputs (SO, 0, putchar);
- break;
-
- case ST_END: tputs (SE, 0, putchar);
- break;
-
- case CURSOR: curx = *++str - 1; cury = *++str - 1;
- tputs (tgoto (CM, curx, cury), 0, putchar);
- break;
-
- case '\n': if ((cury == 23) && enable_scroll)
- {
- if (!DL || !AL) /* wraparound or scroll? */
- {
- if (++scrline > 23) scrline=19;
-
- if (++scrline > 23) scrline=19;
- tputs (tgoto (CM, 0, scrline), 0, putchar);
- tputs (CE, 0, putchar);
-
- if (--scrline < 19) scrline=23;
- tputs (tgoto (CM, 0, scrline), 0, putchar);
- tputs (CE, 0, putchar);
- }
- else
- {
- tputs (tgoto (CM, 0, 19), 0, putchar);
- tputs (DL, 0, putchar);
- tputs (tgoto (CM, 0, 23), 0, putchar);
- /* tputs (AL, 0, putchar); */
- }
- }
- else
- {
- putchar ('\n'); cury++;
- }
- curx = 0;
- break;
-
- default: putchar (*str); curx++;
- };
- }
- }
- lpnt = lpbuf;
- flush_buf(); /* flush real output buffer now */
- }
-#else /* VT100 */
-/*
- * lflush() flush the output buffer
- *
- * Returns nothing of value.
- */
-lflush()
- {
- int lpoint;
- if ((lpoint = lpnt - lpbuf) > 0)
- {
-#ifdef EXTRA
- c[BYTESOUT] += lpoint;
-#endif
- if (write(lfd,lpbuf,lpoint) != lpoint)
- write(2,"error writing to output file\n",29);
- }
- lpnt = lpbuf; /* point back to beginning of buffer */
- }
-#endif /* VT100 */
-
-#ifndef VT100
-static int pindex=0;
-/*
- * putchar(ch) Print one character in decoded output buffer.
- */
-int putchar(c)
-int c;
- {
- outbuf[pindex++] = c;
- if (pindex >= BUFBIG) flush_buf();
- }
-
-/*
- * flush_buf() Flush buffer with decoded output.
- */
-flush_buf()
- {
- if (pindex) write(lfd, outbuf, pindex);
- pindex = 0;
- }
-
-/*
- * char *tmcapcnv(sd,ss) Routine to convert VT100 escapes to termcap format
- *
- * Processes only the \33[#m sequence (converts . files for termcap use
- */
-char *tmcapcnv(sd,ss)
- char *sd,*ss;
- {
- int tmstate=0; /* 0=normal, 1=\33 2=[ 3=# */
- char tmdigit=0; /* the # in \33[#m */
- while (*ss)
- {
- switch(tmstate)
- {
- case 0: if (*ss=='\33') { tmstate++; break; }
- ign: *sd++ = *ss;
- ign2: tmstate = 0;
- break;
- case 1: if (*ss!='[') goto ign;
- tmstate++;
- break;
- case 2: if (isdigit(*ss)) { tmdigit= *ss-'0'; tmstate++; break; }
- if (*ss == 'm') { *sd++ = ST_END; goto ign2; }
- goto ign;
- case 3: if (*ss == 'm')
- {
- if (tmdigit) *sd++ = ST_START;
- else *sd++ = ST_END;
- goto ign2;
- }
- default: goto ign;
- };
- ss++;
- }
- *sd=0; /* NULL terminator */
- return(sd);
- }
-#endif /* VT100 */
-
-/*
- * beep() Routine to emit a beep if enabled (see no-beep in .larnopts)
- */
-beep()
- {
- if (!nobeep) *lpnt++ = '\7';
- }
diff --git a/games/larn/larn.6 b/games/larn/larn.6
deleted file mode 100644
index 29080d7..0000000
--- a/games/larn/larn.6
+++ /dev/null
@@ -1,159 +0,0 @@
-.\" Copyright (c) 1990 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)larn.6 5.5 (Berkeley) 12/30/93
-.\" $FreeBSD$
-.\"
-.Dd December 30, 1993
-.Dt LARN 6
-.Os
-.Sh NAME
-.Nm larn
-.Nd exploring the caverns of Larn
-.Sh SYNOPSIS
-.Nm
-.Op Fl r
-.Op Fl H Ar number
-.Op Fl n
-.Op Fl h
-.Op Fl o Ar optsfile
-.Sh DESCRIPTION
-.Nm Larn
-is a fantasy games in which your child has contracted
-a strange disease, and none of your home remedies
-seem to have any effect. You set out to find a remedy in a limited
-amount of time, and to collect gold along the way of course!
-.Pp
-The options are:
-.Pp
-.Bl -tag -width flag
-.It Fl r
-The
-.Fl r
-option restores a checkpointed game after it has died.
-.It Fl H
-The
-.Fl H
-option sets the hardness of the game.
-.It Fl n
-The
-.Fl n
-option suppresses the welcome message at start up, putting you directly
-into the game.
-.It Fl h
-The
-.Fl h
-option prints the command line options.
-.It Fl o
-The
-.Fl o
-option specifies a different options file than
-.Pa ~/.larnopts .
-.El
-.Sh COMMANDS
-These are the movement commands:
-.Bl -column "v print program version" "g give present pack weight"
-h move to the left H run left . stay here
-j move down J run down Z teleport yourself
-k move up K run up c cast a spell
-l move to the right L run right r read a scroll
-y move northwest Y run northwest q quaff a potion
-u move northeast U run northeast W wear armor
-b move southwest B run southwest T take off armor
-n move southeast N run southeast w wield a weapon
-^ identify a trap g give present pack weight P give tax status
-d drop an item i inventory your pockets Q quit the game
-v print program version S save the game D list all items found
-? this help screen A create diagnostic file e eat something
- (wizards only)
-.El
-.Sh OPTIONS FILE
-The file
-.Pa ~/.larnopts
-may be used to set a few options for
-.Nm Larn .
-A sequence of words terminated by whitespace is used to specify options.
-.Pp
-.Bl -tag -width "savefile: xsave-file-namex" -compact
-.It Sy " Word
-.Sy " Meaning
-.Pp
-.It bold-objects
-Select bold display of objects.
-.It inverse-objects
-Select inverse video display of objects.
-.It no-introduction
-Do not display intro message.
-.It enable-checkpointing
-Turn on periodic checkpointing.
-.It no-beep
-Disable beeping of the terminal.
-.It male
-Choose your sex to be a man.
-.It female
-Choose your sex to be a woman.
-.It name: \*qyour name\*q
-Choose your playing name.
-.It monster: \*qmonst name\*q
-Choose a name for a monster.
-.It savefile: \*qsave-file-name\*q
-Define what the savegame filename will be.
-.El
-.Pp
-Your name and monster names must be enclosed in double quotation marks and may
-be up to 34 characters long. Longer names are truncated.
-Anything enclosed in quotation marks is considered one word, and must be
-separated from other words by whitespace.
-.Sh SPECIAL NOTES
-When
-.Sy dropping gold ,
-if you type '*' as your amount, all your gold gets dropped.
-In general, typing in '*' means all of what you are interested in.
-This is true when visiting the bank, or when contributing at altars.
-.Pp
-You can get out of the store, trading post, school, or home by hitting
-.Sy <esc> .
-.Pp
-When casting a spell, if you need a list of spells you can cast, type \fBD\fP
-as the first letter of your spell. The available list of spells will be shown,
-after which you may enter the spell code. This only works on the 1st letter
-of the spell you are casting.
-.Sh AUTHORS
-.An Noah Morgan
-.Sh FILES
-.Bl -tag -width "/var/games/larn/lscore12.0" -compact
-.It Pa /var/games/larn/lscore12.0
-Score file.
-.It Pa /var/games/larn/llog12.0
-Log file.
-.It Pa ~/.larnopts
-Options file.
-.El
diff --git a/games/larn/main.c b/games/larn/main.c
deleted file mode 100644
index aae3c03..0000000
--- a/games/larn/main.c
+++ /dev/null
@@ -1,883 +0,0 @@
-/* main.c */
-/* $FreeBSD$ */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "header.h"
-#include <pwd.h>
-static const char copyright[]="\nLarn is copyrighted 1986 by Noah Morgan.\n";
-int srcount=0; /* line counter for showstr() */
-int dropflag=0; /* if 1 then don't lookforobject() next round */
-int rmst=80; /* random monster creation counter */
-int userid; /* the players login user id number */
-char nowelcome=0,nomove=0; /* if (nomove) then don't count next iteration as a move */
-static char viewflag=0;
- /* if viewflag then we have done a 99 stay here and don't showcell in the main loop */
-char restorflag=0; /* 1 means restore has been done */
-static char cmdhelp[] = "\
-Cmd line format: larn [-slicnh] [-o<optsifle>] [-##] [++]\n\
- -s show the scoreboard\n\
- -l show the logfile (wizard id only)\n\
- -i show scoreboard with inventories of dead characters\n\
- -c create new scoreboard (wizard id only)\n\
- -n suppress welcome message on starting game\n\
- -## specify level of difficulty (example: -5)\n\
- -h print this help text\n\
- ++ restore game from checkpoint file\n\
- -o<optsfile> specify .larnopts filename to be used instead of \"~/.larnopts\"\n\
-";
-#ifdef VT100
-static char *termtypes[] = { "vt100", "vt101", "vt102", "vt103", "vt125",
- "vt131", "vt140", "vt180", "vt220", "vt240", "vt241", "vt320", "vt340",
- "vt341" };
-#endif /* VT100 */
-/*
- ************
- MAIN PROGRAM
- ************
- */
-main(argc,argv)
- int argc;
- char **argv;
- {
- int i,j;
- int hard;
- char *ptr=0,*ttype;
- struct passwd *pwe;
- struct stat sb;
-
-/*
- * first task is to identify the player
- */
-#ifndef VT100
- init_term(); /* setup the terminal (find out what type) for termcap */
-#endif /* VT100 */
- if (((ptr = getlogin()) == 0) || (*ptr==0)) { /* try to get login name */
- if (pwe=getpwuid(getuid())) /* can we get it from /etc/passwd? */
- ptr = pwe->pw_name;
- else
- if ((ptr = getenv("USER")) == 0)
- if ((ptr = getenv("LOGNAME")) == 0)
- {
- noone: write(2, "Can't find your logname. Who Are You?\n",39);
- exit(1);
- }
- }
- if (ptr==0) goto noone;
- if (strlen(ptr)==0) goto noone;
-/*
- * second task is to prepare the pathnames the player will need
- */
- strcpy(loginname,ptr); /* save loginname of the user for logging purposes */
- strcpy(logname,ptr); /* this will be overwritten with the players name */
- if ((ptr = getenv("HOME")) == 0) ptr = ".";
- strcpy(savefilename, ptr);
- strcat(savefilename, "/Larn.sav"); /* save file name in home directory */
- sprintf(optsfile, "%s/.larnopts",ptr); /* the .larnopts filename */
-
-/*
- * now malloc the memory for the dungeon
- */
- cell = (struct cel *)malloc(sizeof(struct cel)*(MAXLEVEL+MAXVLEVEL)*MAXX*MAXY);
- if (cell == 0) died(-285); /* malloc failure */
- lpbuf = malloc((5* BUFBIG)>>2); /* output buffer */
- inbuffer = malloc((5*MAXIBUF)>>2); /* output buffer */
- if ((lpbuf==0) || (inbuffer==0)) died(-285); /* malloc() failure */
-
- lcreat((char*)0); newgame(); /* set the initial clock */ hard= -1;
-
-#ifdef VT100
-/*
- * check terminal type to avoid users who have not vt100 type terminals
- */
- ttype = getenv("TERM");
- for (j=1, i=0; i<sizeof(termtypes)/sizeof(char *); i++)
- if (strcmp(ttype,termtypes[i]) == 0) { j=0; break; }
- if (j)
- {
- lprcat("Sorry, Larn needs a VT100 family terminal for all it's features.\n"); lflush();
- exit(1);
- }
-#endif /* VT100 */
-
-/*
- * now make scoreboard if it is not there (don't clear)
- */
- if (stat(scorefile,&sb) < 0 || sb.st_size == 0) /* not there */
- makeboard();
-
-/*
- * now process the command line arguments
- */
- for (i=1; i<argc; i++)
- {
- if (argv[i][0] == '-')
- switch(argv[i][1])
- {
- case 's': showscores(); exit(0); /* show scoreboard */
-
- case 'l': /* show log file */
- diedlog(); exit(0);
-
- case 'i': showallscores(); exit(0); /* show all scoreboard */
-
- case 'c': /* anyone with password can create scoreboard */
- lprcat("Preparing to initialize the scoreboard.\n");
- if (getpassword() != 0) /*make new scoreboard*/
- {
- makeboard(); lprc('\n'); showscores();
- }
- exit(0);
-
- case 'n': /* no welcome msg */ nowelcome=1; argv[i][0]=0; break;
-
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9': /* for hardness */
- sscanf(&argv[i][1],"%d",&hard);
- break;
-
- case 'h': /* print out command line arguments */
- write(1,cmdhelp,sizeof(cmdhelp)); exit(0);
-
- case 'o': /* specify a .larnopts filename */
- strncpy(optsfile,argv[i]+2,127); break;
-
- default: printf("Unknown option <%s>\n",argv[i]); exit(1);
- };
-
- if (argv[i][0] == '+')
- {
- clear(); restorflag = 1;
- if (argv[i][1] == '+')
- {
- hitflag=1; restoregame(ckpfile); /* restore checkpointed game */
- }
- i = argc;
- }
- }
-
- readopts(); /* read the options file if there is one */
-
-
-#ifdef UIDSCORE
- userid = geteuid(); /* obtain the user's effective id number */
-#else /* UIDSCORE */
- userid = getplid(logname); /* obtain the players id number */
-#endif /* UIDSCORE */
- if (userid < 0) { write(2,"Can't obtain playerid\n",22); exit(1); }
-
-#ifdef HIDEBYLINK
-/*
- * this section of code causes the program to look like something else to ps
- */
- if (strcmp(psname,argv[0])) /* if a different process name only */
- {
- if ((i=access(psname,1)) < 0)
- { /* link not there */
- if (link(argv[0],psname)>=0)
- {
- argv[0] = psname; execv(psname,argv);
- }
- }
- else
- unlink(psname);
- }
-
- for (i=1; i<argc; i++)
- {
- szero(argv[i]); /* zero the argument to avoid ps snooping */
- }
-#endif /* HIDEBYLINK */
-
- if (access(savefilename,0)==0) /* restore game if need to */
- {
- clear(); restorflag = 1;
- hitflag=1; restoregame(savefilename); /* restore last game */
- }
- sigsetup(); /* trap all needed signals */
- sethard(hard); /* set up the desired difficulty */
- setupvt100(); /* setup the terminal special mode */
- if (c[HP]==0) /* create new game */
- {
- makeplayer(); /* make the character that will play */
- newcavelevel(0);/* make the dungeon */
- predostuff = 1; /* tell signals that we are in the welcome screen */
- if (nowelcome==0) welcome(); /* welcome the player to the game */
- }
- drawscreen(); /* show the initial dungeon */
- predostuff = 2; /* tell the trap functions that they must do a showplayer()
- from here on */
- /* nice(1); */ /* games should be run niced */
- yrepcount = hit2flag = 0;
- while (1)
- {
- if (dropflag==0) lookforobject(); /* see if there is an object here */
- else dropflag=0; /* don't show it just dropped an item */
- if (hitflag==0) { if (c[HASTEMONST]) movemonst(); movemonst(); } /* move the monsters */
- if (viewflag==0) showcell(playerx,playery); else viewflag=0; /* show stuff around player */
- if (hit3flag) flushall();
- hitflag=hit3flag=0; nomove=1;
- bot_linex(); /* update bottom line */
- while (nomove)
- {
- if (hit3flag) flushall();
- nomove=0; parse();
- } /* get commands and make moves */
- regen(); /* regenerate hp and spells */
- if (c[TIMESTOP]==0)
- if (--rmst <= 0)
- { rmst = 120-(level<<2); fillmonst(makemonst(level)); }
- }
- }
-
-/*
- showstr()
-
- show character's inventory
- */
-showstr()
- {
- int i,number;
- for (number=3, i=0; i<26; i++)
- if (iven[i]) number++; /* count items in inventory */
- t_setup(number); qshowstr(); t_endup(number);
- }
-
-qshowstr()
- {
- int i,j,k,sigsav;
- srcount=0; sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- if (c[GOLD]) { lprintf(".) %d gold pieces",(long)c[GOLD]); srcount++; }
- for (k=26; k>=0; k--)
- if (iven[k])
- { for (i=22; i<84; i++)
- for (j=0; j<=k; j++) if (i==iven[j]) show3(j); k=0; }
-
- lprintf("\nElapsed time is %d. You have %d mobuls left",(long)((gtime+99)/100+1),(long)((TIMELIMIT-gtime)/100));
- more(); nosignal=sigsav;
- }
-
-/*
- * subroutine to clear screen depending on # lines to display
- */
-t_setup(count)
- int count;
- {
- if (count<20) /* how do we clear the screen? */
- {
- cl_up(79,count); cursor(1,1);
- }
- else
- {
- resetscroll(); clear();
- }
- }
-
-/*
- * subroutine to restore normal display screen depending on t_setup()
- */
-t_endup(count)
- int count;
- {
- if (count<18) /* how did we clear the screen? */
- draws(0,MAXX,0,(count>MAXY) ? MAXY : count);
- else
- {
- drawscreen(); setscroll();
- }
- }
-
-/*
- function to show the things player is wearing only
- */
-showwear()
- {
- int i,j,sigsav,count;
- sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- srcount=0;
-
- for (count=2,j=0; j<=26; j++) /* count number of items we will display */
- if (i=iven[j])
- switch(i)
- {
- case OLEATHER: case OPLATE: case OCHAIN:
- case ORING: case OSTUDLEATHER: case OSPLINT:
- case OPLATEARMOR: case OSSPLATE: case OSHIELD:
- count++;
- };
-
- t_setup(count);
-
- for (i=22; i<84; i++)
- for (j=0; j<=26; j++)
- if (i==iven[j])
- switch(i)
- {
- case OLEATHER: case OPLATE: case OCHAIN:
- case ORING: case OSTUDLEATHER: case OSPLINT:
- case OPLATEARMOR: case OSSPLATE: case OSHIELD:
- show3(j);
- };
- more(); nosignal=sigsav; t_endup(count);
- }
-
-/*
- function to show the things player can wield only
- */
-showwield()
- {
- int i,j,sigsav,count;
- sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- srcount=0;
-
- for (count=2,j=0; j<=26; j++) /* count how many items */
- if (i=iven[j])
- switch(i)
- {
- case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE:
- case OBOOK: case OCHEST: case OLARNEYE: case ONOTHEFT:
- case OSPIRITSCARAB: case OCUBEofUNDEAD:
- case OPOTION: case OSCROLL: break;
- default: count++;
- };
-
- t_setup(count);
-
- for (i=22; i<84; i++)
- for (j=0; j<=26; j++)
- if (i==iven[j])
- switch(i)
- {
- case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE:
- case OBOOK: case OCHEST: case OLARNEYE: case ONOTHEFT:
- case OSPIRITSCARAB: case OCUBEofUNDEAD:
- case OPOTION: case OSCROLL: break;
- default: show3(j);
- };
- more(); nosignal=sigsav; t_endup(count);
- }
-
-/*
- * function to show the things player can read only
- */
-showread()
- {
- int i,j,sigsav,count;
- sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- srcount=0;
-
- for (count=2,j=0; j<=26; j++)
- switch(iven[j])
- {
- case OBOOK: case OSCROLL: count++;
- };
- t_setup(count);
-
- for (i=22; i<84; i++)
- for (j=0; j<=26; j++)
- if (i==iven[j])
- switch(i)
- {
- case OBOOK: case OSCROLL: show3(j);
- };
- more(); nosignal=sigsav; t_endup(count);
- }
-
-/*
- * function to show the things player can eat only
- */
-showeat()
- {
- int i,j,sigsav,count;
- sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- srcount=0;
-
- for (count=2,j=0; j<=26; j++)
- switch(iven[j])
- {
- case OCOOKIE: count++;
- };
- t_setup(count);
-
- for (i=22; i<84; i++)
- for (j=0; j<=26; j++)
- if (i==iven[j])
- switch(i)
- {
- case OCOOKIE: show3(j);
- };
- more(); nosignal=sigsav; t_endup(count);
- }
-
-/*
- function to show the things player can quaff only
- */
-showquaff()
- {
- int i,j,sigsav,count;
- sigsav=nosignal; nosignal=1; /* don't allow ^c etc */
- srcount=0;
-
- for (count=2,j=0; j<=26; j++)
- switch(iven[j])
- {
- case OPOTION: count++;
- };
- t_setup(count);
-
- for (i=22; i<84; i++)
- for (j=0; j<=26; j++)
- if (i==iven[j])
- switch(i)
- {
- case OPOTION: show3(j);
- };
- more(); nosignal=sigsav; t_endup(count);
- }
-
-show1(idx,str2)
- int idx;
- char *str2[];
- {
- if (str2==0) lprintf("\n%c) %s",idx+'a',objectname[iven[idx]]);
- else if (*str2[ivenarg[idx]]==0) lprintf("\n%c) %s",idx+'a',objectname[iven[idx]]);
- else lprintf("\n%c) %s of%s",idx+'a',objectname[iven[idx]],str2[ivenarg[idx]]);
- }
-
-show3(index)
- int index;
- {
- switch(iven[index])
- {
- case OPOTION: show1(index,potionname); break;
- case OSCROLL: show1(index,scrollname); break;
-
- case OLARNEYE: case OBOOK: case OSPIRITSCARAB:
- case ODIAMOND: case ORUBY: case OCUBEofUNDEAD:
- case OEMERALD: case OCHEST: case OCOOKIE:
- case OSAPPHIRE: case ONOTHEFT: show1(index,(char **)0); break;
-
- default: lprintf("\n%c) %s",index+'a',objectname[iven[index]]);
- if (ivenarg[index]>0) lprintf(" + %d",(long)ivenarg[index]);
- else if (ivenarg[index]<0) lprintf(" %d",(long)ivenarg[index]);
- break;
- }
- if (c[WIELD]==index) lprcat(" (weapon in hand)");
- if ((c[WEAR]==index) || (c[SHIELD]==index)) lprcat(" (being worn)");
- if (++srcount>=22) { srcount=0; more(); clear(); }
- }
-
-/*
- subroutine to randomly create monsters if needed
- */
-randmonst()
- {
- if (c[TIMESTOP]) return; /* don't make monsters if time is stopped */
- if (--rmst <= 0)
- {
- rmst = 120 - (level<<2); fillmonst(makemonst(level));
- }
- }
-
-
-/*
- parse()
-
- get and execute a command
- */
-parse()
- {
- int i,j,k,flag;
- while (1)
- {
- k = yylex();
- switch(k) /* get the token from the input and switch on it */
- {
- case 'h': moveplayer(4); return; /* west */
- case 'H': run(4); return; /* west */
- case 'l': moveplayer(2); return; /* east */
- case 'L': run(2); return; /* east */
- case 'j': moveplayer(1); return; /* south */
- case 'J': run(1); return; /* south */
- case 'k': moveplayer(3); return; /* north */
- case 'K': run(3); return; /* north */
- case 'u': moveplayer(5); return; /* northeast */
- case 'U': run(5); return; /* northeast */
- case 'y': moveplayer(6); return; /* northwest */
- case 'Y': run(6); return; /* northwest */
- case 'n': moveplayer(7); return; /* southeast */
- case 'N': run(7); return; /* southeast */
- case 'b': moveplayer(8); return; /* southwest */
- case 'B': run(8); return; /* southwest */
-
- case '.': if (yrepcount) viewflag=1; return; /* stay here */
-
- case 'w': yrepcount=0; wield(); return; /* wield a weapon */
-
- case 'W': yrepcount=0; wear(); return; /* wear armor */
-
- case 'r': yrepcount=0;
- if (c[BLINDCOUNT]) { cursors(); lprcat("\nYou can't read anything when you're blind!"); } else
- if (c[TIMESTOP]==0) readscr(); return; /* to read a scroll */
-
- case 'q': yrepcount=0; if (c[TIMESTOP]==0) quaff(); return; /* quaff a potion */
-
- case 'd': yrepcount=0; if (c[TIMESTOP]==0) dropobj(); return; /* to drop an object */
-
- case 'c': yrepcount=0; cast(); return; /* cast a spell */
-
- case 'i': yrepcount=0; nomove=1; showstr(); return; /* status */
-
- case 'e': yrepcount=0;
- if (c[TIMESTOP]==0) eatcookie(); return; /* to eat a fortune cookie */
-
- case 'D': yrepcount=0; seemagic(0); nomove=1; return; /* list spells and scrolls */
-
- case '?': yrepcount=0; help(); nomove=1; return; /* give the help screen*/
-
- case 'S': clear(); lprcat("Saving . . ."); lflush();
- savegame(savefilename); wizard=1; died(-257); /* save the game - doesn't return */
-
- case 'Z': yrepcount=0; if (c[LEVEL]>9) { oteleport(1); return; }
- cursors(); lprcat("\nAs yet, you don't have enough experience to use teleportation");
- return; /* teleport yourself */
-
- case '^': /* identify traps */ flag=yrepcount=0; cursors();
- lprc('\n'); for (j=playery-1; j<playery+2; j++)
- {
- if (j < 0) j=0; if (j >= MAXY) break;
- for (i=playerx-1; i<playerx+2; i++)
- {
- if (i < 0) i=0; if (i >= MAXX) break;
- switch(item[i][j])
- {
- case OTRAPDOOR: case ODARTRAP:
- case OTRAPARROW: case OTELEPORTER:
- lprcat("\nIts "); lprcat(objectname[item[i][j]]); flag++;
- };
- }
- }
- if (flag==0) lprcat("\nNo traps are visible");
- return;
-
-#if WIZID
- case '_': /* this is the fudge player password for wizard mode*/
- yrepcount=0; cursors(); nomove=1;
- if (userid!=wisid)
- {
- lprcat("Sorry, you are not empowered to be a wizard.\n");
- scbr(); /* system("stty -echo cbreak"); */
- lflush(); return;
- }
- if (getpassword()==0)
- {
- scbr(); /* system("stty -echo cbreak"); */ return;
- }
- wizard=1; scbr(); /* system("stty -echo cbreak"); */
- for (i=0; i<6; i++) c[i]=70; iven[0]=iven[1]=0;
- take(OPROTRING,50); take(OLANCE,25); c[WIELD]=1;
- c[LANCEDEATH]=1; c[WEAR] = c[SHIELD] = -1;
- raiseexperience(6000000L); c[AWARENESS] += 25000;
- {
- int i,j;
- for (i=0; i<MAXY; i++)
- for (j=0; j<MAXX; j++) know[j][i]=1;
- for (i=0; i<SPNUM; i++) spelknow[i]=1;
- for (i=0; i<MAXSCROLL; i++) scrollname[i][0]=' ';
- for (i=0; i<MAXPOTION; i++) potionname[i][0]=' ';
- }
- for (i=0; i<MAXSCROLL; i++)
- if (strlen(scrollname[i])>2) /* no null items */
- { item[i][0]=OSCROLL; iarg[i][0]=i; }
- for (i=MAXX-1; i>MAXX-1-MAXPOTION; i--)
- if (strlen(potionname[i-MAXX+MAXPOTION])>2) /* no null items */
- { item[i][0]=OPOTION; iarg[i][0]=i-MAXX+MAXPOTION; }
- for (i=1; i<MAXY; i++)
- { item[0][i]=i; iarg[0][i]=0; }
- for (i=MAXY; i<MAXY+MAXX; i++)
- { item[i-MAXY][MAXY-1]=i; iarg[i-MAXY][MAXY-1]=0; }
- for (i=MAXX+MAXY; i<MAXX+MAXY+MAXY; i++)
- { item[MAXX-1][i-MAXX-MAXY]=i; iarg[MAXX-1][i-MAXX-MAXY]=0; }
- c[GOLD]+=25000; drawscreen(); return;
-#endif
-
- case 'T': yrepcount=0; cursors(); if (c[SHIELD] != -1) { c[SHIELD] = -1; lprcat("\nYour shield is off"); bottomline(); } else
- if (c[WEAR] != -1) { c[WEAR] = -1; lprcat("\nYour armor is off"); bottomline(); }
- else lprcat("\nYou aren't wearing anything");
- return;
-
- case 'g': cursors();
- lprintf("\nThe stuff you are carrying presently weighs %d pounds",(long)packweight());
- case ' ': yrepcount=0; nomove=1; return;
-
- case 'v': yrepcount=0; cursors();
- lprintf("\nCaverns of Larn, Version %d.%d, Diff=%d",(long)VERSION,(long)SUBVERSION,(long)c[HARDGAME]);
- if (wizard) lprcat(" Wizard"); nomove=1;
- if (cheat) lprcat(" Cheater");
- lprcat(copyright);
- return;
-
- case 'Q': yrepcount=0; quit(); nomove=1; return; /* quit */
-
- case 'L'-64: yrepcount=0; drawscreen(); nomove=1; return; /* look */
-
-#if WIZID
-#ifdef EXTRA
- case 'A': yrepcount=0; nomove=1; if (wizard) { diag(); return; } /* create diagnostic file */
- return;
-#endif
-#endif
- case 'P': cursors();
- if (outstanding_taxes>0)
- lprintf("\nYou presently owe %d gp in taxes.",(long)outstanding_taxes);
- else
- lprcat("\nYou do not owe any taxes.");
- return;
- };
- }
- }
-
-parse2()
- {
- if (c[HASTEMONST]) movemonst(); movemonst(); /* move the monsters */
- randmonst(); regen();
- }
-
-run(dir)
- int dir;
- {
- int i;
- i=1; while (i)
- {
- i=moveplayer(dir);
- if (i>0) { if (c[HASTEMONST]) movemonst(); movemonst(); randmonst(); regen(); }
- if (hitflag) i=0;
- if (i!=0) showcell(playerx,playery);
- }
- }
-
-/*
- function to wield a weapon
- */
-wield()
- {
- int i;
- while (1)
- {
- if ((i = whatitem("wield"))=='\33') return;
- if (i != '.')
- {
- if (i=='*') showwield();
- else if (iven[i-'a']==0) { ydhi(i); return; }
- else if (iven[i-'a']==OPOTION) { ycwi(i); return; }
- else if (iven[i-'a']==OSCROLL) { ycwi(i); return; }
- else if ((c[SHIELD]!= -1) && (iven[i-'a']==O2SWORD)) { lprcat("\nBut one arm is busy with your shield!"); return; }
- else { c[WIELD]=i-'a'; if (iven[i-'a'] == OLANCE) c[LANCEDEATH]=1; else c[LANCEDEATH]=0; bottomline(); return; }
- }
- }
- }
-
-/*
- common routine to say you don't have an item
- */
-ydhi(x)
- int x;
- { cursors(); lprintf("\nYou don't have item %c!",x); }
-ycwi(x)
- int x;
- { cursors(); lprintf("\nYou can't wield item %c!",x); }
-
-/*
- function to wear armor
- */
-wear()
- {
- int i;
- while (1)
- {
- if ((i = whatitem("wear"))=='\33') return;
- if (i != '.')
- {
- if (i=='*') showwear(); else
- switch(iven[i-'a'])
- {
- case 0: ydhi(i); return;
- case OLEATHER: case OCHAIN: case OPLATE: case OSTUDLEATHER:
- case ORING: case OSPLINT: case OPLATEARMOR: case OSSPLATE:
- if (c[WEAR] != -1) { lprcat("\nYou're already wearing some armor"); return; }
- c[WEAR]=i-'a'; bottomline(); return;
- case OSHIELD: if (c[SHIELD] != -1) { lprcat("\nYou are already wearing a shield"); return; }
- if (iven[c[WIELD]]==O2SWORD) { lprcat("\nYour hands are busy with the two handed sword!"); return; }
- c[SHIELD] = i-'a'; bottomline(); return;
- default: lprcat("\nYou can't wear that!");
- };
- }
- }
- }
-
-/*
- function to drop an object
- */
-dropobj()
- {
- int i;
- char *p;
- long amt;
- p = &item[playerx][playery];
- while (1)
- {
- if ((i = whatitem("drop"))=='\33') return;
- if (i=='*') showstr(); else
- {
- if (i=='.') /* drop some gold */
- {
- if (*p) { lprcat("\nThere's something here already!"); return; }
- lprcat("\n\n");
- cl_dn(1,23);
- lprcat("How much gold do you drop? ");
- if ((amt=readnum((long)c[GOLD])) == 0) return;
- if (amt>c[GOLD])
- { lprcat("\nYou don't have that much!"); return; }
- if (amt<=32767)
- { *p=OGOLDPILE; i=amt; }
- else if (amt<=327670L)
- { *p=ODGOLD; i=amt/10; amt = 10*i; }
- else if (amt<=3276700L)
- { *p=OMAXGOLD; i=amt/100; amt = 100*i; }
- else if (amt<=32767000L)
- { *p=OKGOLD; i=amt/1000; amt = 1000*i; }
- else
- { *p=OKGOLD; i=32767; amt = 32767000L; }
- c[GOLD] -= amt;
- lprintf("You drop %d gold pieces",(long)amt);
- iarg[playerx][playery]=i; bottomgold();
- know[playerx][playery]=0; dropflag=1; return;
- }
- drop_object(i-'a');
- return;
- }
- }
- }
-
-/*
- * readscr() Subroutine to read a scroll one is carrying
- */
-readscr()
- {
- int i;
- while (1)
- {
- if ((i = whatitem("read"))=='\33') return;
- if (i != '.')
- {
- if (i=='*') showread(); else
- {
- if (iven[i-'a']==OSCROLL) { read_scroll(ivenarg[i-'a']); iven[i-'a']=0; return; }
- if (iven[i-'a']==OBOOK) { readbook(ivenarg[i-'a']); iven[i-'a']=0; return; }
- if (iven[i-'a']==0) { ydhi(i); return; }
- lprcat("\nThere's nothing on it to read"); return;
- }
- }
- }
- }
-
-/*
- * subroutine to eat a cookie one is carrying
- */
-eatcookie()
-{
-int i;
-char *p;
-while (1)
- {
- if ((i = whatitem("eat"))=='\33') return;
- if (i != '.') {
- if (i=='*') showeat(); else
- {
- if (iven[i-'a']==OCOOKIE)
- {
- lprcat("\nThe cookie was delicious.");
- iven[i-'a']=0;
- if (!c[BLINDCOUNT])
- {
- if (p=fortune(fortfile))
- {
- lprcat(" Inside you find a scrap of paper that says:\n");
- lprcat(p);
- }
- }
- return;
- }
- if (iven[i-'a']==0) { ydhi(i); return; }
- lprcat("\nYou can't eat that!"); return;
- }
- }
- }
-}
-
-/*
- * subroutine to quaff a potion one is carrying
- */
-quaff()
- {
- int i;
- while (1)
- {
- if ((i = whatitem("quaff"))=='\33') return;
- if (i != '.')
- {
- if (i=='*') showquaff(); else
- {
- if (iven[i-'a']==OPOTION) { quaffpotion(ivenarg[i-'a']); iven[i-'a']=0; return; }
- if (iven[i-'a']==0) { ydhi(i); return; }
- lprcat("\nYou wouldn't want to quaff that, would you? "); return;
- }
- }
- }
- }
-
-/*
- function to ask what player wants to do
- */
-whatitem(str)
- char *str;
- {
- int i;
- cursors(); lprintf("\nWhat do you want to %s [* for all] ? ",str);
- i=0; while (i>'z' || (i<'a' && i!='*' && i!='\33' && i!='.')) i=getchar();
- if (i=='\33') lprcat(" aborted");
- return(i);
- }
-
-/*
- subroutine to get a number from the player
- and allow * to mean return amt, else return the number entered
- */
-unsigned long readnum(mx)
- long mx;
- {
- int i;
- unsigned long amt=0;
- sncbr();
- if ((i=getchar()) == '*') amt = mx; /* allow him to say * for all gold */
- else
- while (i != '\n')
- {
- if (i=='\033') { scbr(); lprcat(" aborted"); return(0); }
- if ((i <= '9') && (i >= '0') && (amt<99999999))
- amt = amt*10+i-'0';
- i = getchar();
- }
- scbr(); return(amt);
- }
-
-#ifdef HIDEBYLINK
-/*
- * routine to zero every byte in a string
- */
-szero(str)
- char *str;
- {
- while (*str)
- *str++ = 0;
- }
-#endif /* HIDEBYLINK */
diff --git a/games/larn/monster.c b/games/larn/monster.c
deleted file mode 100644
index 2e8874c..0000000
--- a/games/larn/monster.c
+++ /dev/null
@@ -1,1394 +0,0 @@
-/*
- * monster.c Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * This file contains the following functions:
- * ----------------------------------------------------------------------------
- *
- * createmonster(monstno) Function to create a monster next to the player
- * int monstno;
- *
- * int cgood(x,y,itm,monst) Function to check location for emptiness
- * int x,y,itm,monst;
- *
- * createitem(it,arg) Routine to place an item next to the player
- * int it,arg;
- *
- * cast() Subroutine called by parse to cast a spell for the user
- *
- * speldamage(x) Function to perform spell functions cast by the player
- * int x;
- *
- * loseint() Routine to decrement your int (intelligence) if > 3
- *
- * isconfuse() Routine to check to see if player is confused
- *
- * nospell(x,monst) Routine to return 1 if a spell doesn't affect a monster
- * int x,monst;
- *
- * fullhit(xx) Function to return full damage against a monst (aka web)
- * int xx;
- *
- * direct(spnum,dam,str,arg) Routine to direct spell damage 1 square in 1 dir
- * int spnum,dam,arg;
- * char *str;
- *
- * godirect(spnum,dam,str,delay,cshow) Function to perform missile attacks
- * int spnum,dam,delay;
- * char *str,cshow;
- *
- * ifblind(x,y) Routine to put "monster" or the monster name into lastmosnt
- * int x,y;
- *
- * tdirect(spnum) Routine to teleport away a monster
- * int spnum;
- *
- * omnidirect(sp,dam,str) Routine to damage all monsters 1 square from player
- * int sp,dam;
- * char *str;
- *
- * dirsub(x,y) Routine to ask for direction, then modify x,y for it
- * int *x,*y;
- *
- * vxy(x,y) Routine to verify/fix (*x,*y) for being within bounds
- * int *x,*y;
- *
- * dirpoly(spnum) Routine to ask for a direction and polymorph a monst
- * int spnum;
- *
- * hitmonster(x,y) Function to hit a monster at the designated coordinates
- * int x,y;
- *
- * hitm(x,y,amt) Function to just hit a monster at a given coordinates
- * int x,y,amt;
- *
- * hitplayer(x,y) Function for the monster to hit the player from (x,y)
- * int x,y;
- *
- * dropsomething(monst) Function to create an object when a monster dies
- * int monst;
- *
- * dropgold(amount) Function to drop some gold around player
- * int amount;
- *
- * something(level) Function to create a random item around player
- * int level;
- *
- * newobject(lev,i) Routine to return a randomly selected new object
- * int lev,*i;
- *
- * spattack(atckno,xx,yy) Function to process special attacks from monsters
- * int atckno,xx,yy;
- *
- * checkloss(x) Routine to subtract hp from user and flag bottomline display
- * int x;
- *
- * annihilate() Routine to annihilate monsters around player, playerx,playery
- *
- * newsphere(x,y,dir,lifetime) Function to create a new sphere of annihilation
- * int x,y,dir,lifetime;
- *
- * rmsphere(x,y) Function to delete a sphere of annihilation from list
- * int x,y;
- *
- * sphboom(x,y) Function to perform the effects of a sphere detonation
- * int x,y;
- *
- * genmonst() Function to ask for monster and genocide from game
- *
- */
-#include "header.h"
-
-struct isave /* used for altar reality */
- {
- char type; /* 0=item, 1=monster */
- char id; /* item number or monster number */
- short arg; /* the type of item or hitpoints of monster */
- };
-
-/*
- * createmonster(monstno) Function to create a monster next to the player
- * int monstno;
- *
- * Enter with the monster number (1 to MAXMONST+8)
- * Returns no value.
- */
-createmonster(mon)
- int mon;
- {
- int x,y,k,i;
- if (mon<1 || mon>MAXMONST+8) /* check for monster number out of bounds */
- {
- beep(); lprintf("\ncan't createmonst(%d)\n",(long)mon); nap(3000); return;
- }
- while (monster[mon].genocided && mon<MAXMONST) mon++; /* genocided? */
- for (k=rnd(8), i= -8; i<0; i++,k++) /* choose direction, then try all */
- {
- if (k>8) k=1; /* wraparound the diroff arrays */
- x = playerx + diroffx[k]; y = playery + diroffy[k];
- if (cgood(x,y,0,1)) /* if we can create here */
- {
- mitem[x][y] = mon;
- hitp[x][y] = monster[mon].hitpoints;
- stealth[x][y]=know[x][y]=0;
- switch(mon)
- {
- case ROTHE: case POLTERGEIST: case VAMPIRE: stealth[x][y]=1;
- };
- return;
- }
- }
- }
-
-/*
- * int cgood(x,y,itm,monst) Function to check location for emptiness
- * int x,y,itm,monst;
- *
- * Routine to return TRUE if a location does not have itm or monst there
- * returns FALSE (0) otherwise
- * Enter with itm or monst TRUE or FALSE if checking it
- * Example: if itm==TRUE check for no item at this location
- * if monst==TRUE check for no monster at this location
- * This routine will return FALSE if at a wall or the dungeon exit on level 1
- */
-int cgood(x,y,itm,monst)
- int x,y;
- int itm,monst;
- {
- if ((y>=0) && (y<=MAXY-1) && (x>=0) && (x<=MAXX-1)) /* within bounds? */
- if (item[x][y]!=OWALL) /* can't make anything on walls */
- if (itm==0 || (item[x][y]==0)) /* is it free of items? */
- if (monst==0 || (mitem[x][y]==0)) /* is it free of monsters? */
- if ((level!=1) || (x!=33) || (y!=MAXY-1)) /* not exit to level 1 */
- return(1);
- return(0);
- }
-
-/*
- * createitem(it,arg) Routine to place an item next to the player
- * int it,arg;
- *
- * Enter with the item number and its argument (iven[], ivenarg[])
- * Returns no value, thus we don't know about createitem() failures.
- */
-createitem(it,arg)
- int it,arg;
- {
- int x,y,k,i;
- if (it >= MAXOBJ) return; /* no such object */
- for (k=rnd(8), i= -8; i<0; i++,k++) /* choose direction, then try all */
- {
- if (k>8) k=1; /* wraparound the diroff arrays */
- x = playerx + diroffx[k]; y = playery + diroffy[k];
- if (cgood(x,y,1,0)) /* if we can create here */
- {
- item[x][y] = it; know[x][y]=0; iarg[x][y]=arg; return;
- }
- }
- }
-
-/*
- * cast() Subroutine called by parse to cast a spell for the user
- *
- * No arguments and no return value.
- */
-static char eys[] = "\nEnter your spell: ";
-cast()
- {
- int i,j,a,b,d;
- cursors();
- if (c[SPELLS]<=0) { lprcat("\nYou don't have any spells!"); return; }
- lprcat(eys); --c[SPELLS];
- while ((a=getchar())=='D')
- { seemagic(-1); cursors(); lprcat(eys); }
- if (a=='\33') goto over; /* to escape casting a spell */
- if ((b=getchar())=='\33') goto over; /* to escape casting a spell */
- if ((d=getchar())=='\33')
- { over: lprcat(aborted); c[SPELLS]++; return; } /* to escape casting a spell */
-#ifdef EXTRA
- c[SPELLSCAST]++;
-#endif
- for (lprc('\n'),j= -1,i=0; i<SPNUM; i++) /*seq search for his spell, hash?*/
- if ((spelcode[i][0]==a) && (spelcode[i][1]==b) && (spelcode[i][2]==d))
- if (spelknow[i])
- { speldamage(i); j = 1; i=SPNUM; }
-
- if (j == -1) lprcat(" Nothing Happened ");
- bottomline();
- }
-
-static int dirsub();
-
-/*
- * speldamage(x) Function to perform spell functions cast by the player
- * int x;
- *
- * Enter with the spell number, returns no value.
- * Please insure that there are 2 spaces before all messages here
- */
-speldamage(x)
- int x;
- {
- int i,j,clev;
- int xl,xh,yl,yh;
- char *p,*kn,*pm;
- if (x>=SPNUM) return; /* no such spell */
- if (c[TIMESTOP]) { lprcat(" It didn't seem to work"); return; } /* not if time stopped */
- clev = c[LEVEL];
- if ((rnd(23)==7) || (rnd(18) > c[INTELLIGENCE]))
- { lprcat(" It didn't work!"); return; }
- if (clev*3+2 < x) { lprcat(" Nothing happens. You seem inexperienced at this"); return; }
-
- switch(x)
- {
-/* ----- LEVEL 1 SPELLS ----- */
-
- case 0: if (c[PROTECTIONTIME]==0) c[MOREDEFENSES]+=2; /* protection field +2 */
- c[PROTECTIONTIME] += 250; return;
-
- case 1: i = rnd(((clev+1)<<1)) + clev + 3;
- godirect(x,i,(clev>=2)?" Your missiles hit the %s":" Your missile hit the %s",100,'+'); /* magic missile */
-
- return;
-
- case 2: if (c[DEXCOUNT]==0) c[DEXTERITY]+=3; /* dexterity */
- c[DEXCOUNT] += 400; return;
-
- case 3: i=rnd(3)+1;
- p=" While the %s slept, you smashed it %d times";
- ws: direct(x,fullhit(i),p,i); /* sleep */ return;
-
- case 4: /* charm monster */ c[CHARMCOUNT] += c[CHARISMA]<<1; return;
-
- case 5: godirect(x,rnd(10)+15+clev," The sound damages the %s",70,'@'); /* sonic spear */
- return;
-
-/* ----- LEVEL 2 SPELLS ----- */
-
- case 6: i=rnd(3)+2; p=" While the %s is entangled, you hit %d times";
- goto ws; /* web */
-
- case 7: if (c[STRCOUNT]==0) c[STREXTRA]+=3; /* strength */
- c[STRCOUNT] += 150+rnd(100); return;
-
- case 8: yl = playery-5; /* enlightenment */
- yh = playery+6; xl = playerx-15; xh = playerx+16;
- vxy(&xl,&yl); vxy(&xh,&yh); /* check bounds */
- for (i=yl; i<=yh; i++) /* enlightenment */
- for (j=xl; j<=xh; j++) know[j][i]=1;
- draws(xl,xh+1,yl,yh+1); return;
-
- case 9: raisehp(20+(clev<<1)); return; /* healing */
-
- case 10: c[BLINDCOUNT]=0; return; /* cure blindness */
-
- case 11: createmonster(makemonst(level+1)+8); return;
-
- case 12: if (rnd(11)+7 <= c[WISDOM]) direct(x,rnd(20)+20+clev," The %s believed!",0);
- else lprcat(" It didn't believe the illusions!");
- return;
-
- case 13: /* if he has the amulet of invisibility then add more time */
- for (j=i=0; i<26; i++)
- if (iven[i]==OAMULET) j+= 1+ivenarg[i];
- c[INVISIBILITY] += (j<<7)+12; return;
-
-/* ----- LEVEL 3 SPELLS ----- */
-
- case 14: godirect(x,rnd(25+clev)+25+clev," The fireball hits the %s",40,'*'); return; /* fireball */
-
- case 15: godirect(x,rnd(25)+20+clev," Your cone of cold strikes the %s",60,'O'); /* cold */
- return;
-
- case 16: dirpoly(x); return; /* polymorph */
-
- case 17: c[CANCELLATION]+= 5+clev; return; /* cancellation */
-
- case 18: c[HASTESELF]+= 7+clev; return; /* haste self */
-
- case 19: omnidirect(x,30+rnd(10)," The %s gasps for air"); /* cloud kill */
- return;
-
- case 20: xh = min(playerx+1,MAXX-2); yh = min(playery+1,MAXY-2);
- for (i=max(playerx-1,1); i<=xh; i++) /* vaporize rock */
- for (j=max(playery-1,1); j<=yh; j++)
- {
- kn = &know[i][j]; pm = &mitem[i][j];
- switch(*(p= &item[i][j]))
- {
- case OWALL: if (level < MAXLEVEL+MAXVLEVEL-1)
- *p = *kn = 0;
- break;
-
- case OSTATUE: if (c[HARDGAME]<3)
- {
- *p=OBOOK; iarg[i][j]=level; *kn=0;
- }
- break;
-
- case OTHRONE: *pm=GNOMEKING; *kn=0; *p= OTHRONE2;
- hitp[i][j]=monster[GNOMEKING].hitpoints; break;
-
- case OALTAR: *pm=DEMONPRINCE; *kn=0;
- hitp[i][j]=monster[DEMONPRINCE].hitpoints; break;
- };
- switch(*pm)
- {
- case XORN: ifblind(i,j); hitm(i,j,200); break; /* Xorn takes damage from vpr */
- }
- }
- return;
-
-/* ----- LEVEL 4 SPELLS ----- */
-
- case 21: direct(x,100+clev," The %s shrivels up",0); /* dehydration */
- return;
-
- case 22: godirect(x,rnd(25)+20+(clev<<1)," A lightning bolt hits the %s",1,'~'); /* lightning */
- return;
-
- case 23: i=min(c[HP]-1,c[HPMAX]/2); /* drain life */
- direct(x,i+i,"",0); c[HP] -= i; return;
-
- case 24: if (c[GLOBE]==0) c[MOREDEFENSES] += 10;
- c[GLOBE] += 200; loseint(); /* globe of invulnerability */
- return;
-
- case 25: omnidirect(x,32+clev," The %s struggles for air in your flood!"); /* flood */
- return;
-
- case 26: if (rnd(151)==63) { beep(); lprcat("\nYour heart stopped!\n"); nap(4000); died(270); return; }
- if (c[WISDOM]>rnd(10)+10) direct(x,2000," The %s's heart stopped",0); /* finger of death */
- else lprcat(" It didn't work"); return;
-
-/* ----- LEVEL 5 SPELLS ----- */
-
- case 27: c[SCAREMONST] += rnd(10)+clev; return; /* scare monster */
-
- case 28: c[HOLDMONST] += rnd(10)+clev; return; /* hold monster */
-
- case 29: c[TIMESTOP] += rnd(20)+(clev<<1); return; /* time stop */
-
- case 30: tdirect(x); return; /* teleport away */
-
- case 31: omnidirect(x,35+rnd(10)+clev," The %s cringes from the flame"); /* magic fire */
- return;
-
-/* ----- LEVEL 6 SPELLS ----- */
-
- case 32: if ((rnd(23)==5) && (wizard==0)) /* sphere of annihilation */
- {
- beep(); lprcat("\nYou have been enveloped by the zone of nothingness!\n");
- nap(4000); died(258); return;
- }
- xl=playerx; yl=playery;
- loseint();
- i=dirsub(&xl,&yl); /* get direction of sphere */
- newsphere(xl,yl,i,rnd(20)+11); /* make a sphere */
- return;
-
- case 33: genmonst(); spelknow[33]=0; /* genocide */
- loseint();
- return;
-
- case 34: /* summon demon */
- if (rnd(100) > 30) { direct(x,150," The demon strikes at the %s",0); return; }
- if (rnd(100) > 15) { lprcat(" Nothing seems to have happened"); return; }
- lprcat(" The demon turned on you and vanished!"); beep();
- i=rnd(40)+30; lastnum=277;
- losehp(i); /* must say killed by a demon */ return;
-
- case 35: /* walk through walls */
- c[WTW] += rnd(10)+5; return;
-
- case 36: /* alter reality */
- {
- struct isave *save; /* pointer to item save structure */
- int sc; sc=0; /* # items saved */
- save = (struct isave *)malloc(sizeof(struct isave)*MAXX*MAXY*2);
- for (j=0; j<MAXY; j++)
- for (i=0; i<MAXX; i++) /* save all items and monsters */
- {
- xl = item[i][j];
- if (xl && xl!=OWALL && xl!=OANNIHILATION)
- {
- save[sc].type=0; save[sc].id=item[i][j];
- save[sc++].arg=iarg[i][j];
- }
- if (mitem[i][j])
- {
- save[sc].type=1; save[sc].id=mitem[i][j];
- save[sc++].arg=hitp[i][j];
- }
- item[i][j]=OWALL; mitem[i][j]=0;
- if (wizard) know[i][j]=1; else know[i][j]=0;
- }
- eat(1,1); if (level==1) item[33][MAXY-1]=0;
- for (j=rnd(MAXY-2), i=1; i<MAXX-1; i++) item[i][j]=0;
- while (sc>0) /* put objects back in level */
- {
- --sc;
- if (save[sc].type == 0)
- {
- int trys;
- for (trys=100, i=j=1; --trys>0 && item[i][j]; i=rnd(MAXX-1), j=rnd(MAXY-1));
- if (trys) { item[i][j]=save[sc].id; iarg[i][j]=save[sc].arg; }
- }
- else
- { /* put monsters back in */
- int trys;
- for (trys=100, i=j=1; --trys>0 && (item[i][j]==OWALL || mitem[i][j]); i=rnd(MAXX-1), j=rnd(MAXY-1));
- if (trys) { mitem[i][j]=save[sc].id; hitp[i][j]=save[sc].arg; }
- }
- }
- loseint();
- draws(0,MAXX,0,MAXY); if (wizard==0) spelknow[36]=0;
- free((char*)save); positionplayer(); return;
- }
-
- case 37: /* permanence */ adjtime(-99999L); spelknow[37]=0; /* forget */
- loseint();
- return;
-
- default: lprintf(" spell %d not available!",(long)x); beep(); return;
- };
- }
-
-/*
- * loseint() Routine to subtract 1 from your int (intelligence) if > 3
- *
- * No arguments and no return value
- */
-loseint()
- {
- if (--c[INTELLIGENCE]<3) c[INTELLIGENCE]=3;
- }
-
-/*
- * isconfuse() Routine to check to see if player is confused
- *
- * This routine prints out a message saying "You can't aim your magic!"
- * returns 0 if not confused, non-zero (time remaining confused) if confused
- */
-isconfuse()
- {
- if (c[CONFUSE]) { lprcat(" You can't aim your magic!"); beep(); }
- return(c[CONFUSE]);
- }
-
-/*
- * nospell(x,monst) Routine to return 1 if a spell doesn't affect a monster
- * int x,monst;
- *
- * Subroutine to return 1 if the spell can't affect the monster
- * otherwise returns 0
- * Enter with the spell number in x, and the monster number in monst.
- */
-nospell(x,monst)
- int x,monst;
- {
- int tmp;
- if (x>=SPNUM || monst>=MAXMONST+8 || monst<0 || x<0) return(0); /* bad spell or monst */
- if ((tmp=spelweird[monst-1][x])==0) return(0);
- cursors(); lprc('\n'); lprintf(spelmes[tmp],monster[monst].name); return(1);
- }
-
-/*
- * fullhit(xx) Function to return full damage against a monster (aka web)
- * int xx;
- *
- * Function to return hp damage to monster due to a number of full hits
- * Enter with the number of full hits being done
- */
-fullhit(xx)
- int xx;
- {
- int i;
- if (xx<0 || xx>20) return(0); /* fullhits are out of range */
- if (c[LANCEDEATH]) return(10000); /* lance of death */
- i = xx * ((c[WCLASS]>>1)+c[STRENGTH]+c[STREXTRA]-c[HARDGAME]-12+c[MOREDAM]);
- return( (i>=1) ? i : xx );
- }
-
-/*
- * direct(spnum,dam,str,arg) Routine to direct spell damage 1 square in 1 dir
- * int spnum,dam,arg;
- * char *str;
- *
- * Routine to ask for a direction to a spell and then hit the monster
- * Enter with the spell number in spnum, the damage to be done in dam,
- * lprintf format string in str, and lprintf's argument in arg.
- * Returns no value.
- */
-direct(spnum,dam,str,arg)
- int spnum,dam,arg;
- char *str;
- {
- int x,y;
- int m;
- if (spnum<0 || spnum>=SPNUM || str==0) return; /* bad arguments */
- if (isconfuse()) return;
- dirsub(&x,&y);
- m = mitem[x][y];
- if (item[x][y]==OMIRROR)
- {
- if (spnum==3) /* sleep */
- {
- lprcat("You fall asleep! "); beep();
- fool:
- arg += 2;
- while (arg-- > 0) { parse2(); nap(1000); }
- return;
- }
- else if (spnum==6) /* web */
- {
- lprcat("You get stuck in your own web! "); beep();
- goto fool;
- }
- else
- {
- lastnum=278;
- lprintf(str,"spell caster (thats you)",(long)arg);
- beep(); losehp(dam); return;
- }
- }
- if (m==0)
- { lprcat(" There wasn't anything there!"); return; }
- ifblind(x,y);
- if (nospell(spnum,m)) { lasthx=x; lasthy=y; return; }
- lprintf(str,lastmonst,(long)arg); hitm(x,y,dam);
- }
-
-/*
- * godirect(spnum,dam,str,delay,cshow) Function to perform missile attacks
- * int spnum,dam,delay;
- * char *str,cshow;
- *
- * Function to hit in a direction from a missile weapon and have it keep
- * on going in that direction until its power is exhausted
- * Enter with the spell number in spnum, the power of the weapon in hp,
- * lprintf format string in str, the # of milliseconds to delay between
- * locations in delay, and the character to represent the weapon in cshow.
- * Returns no value.
- */
-godirect(spnum,dam,str,delay,cshow)
- int spnum,dam,delay;
- char *str,cshow;
- {
- char *p;
- int x,y,m;
- int dx,dy;
- if (spnum<0 || spnum>=SPNUM || str==0 || delay<0) return; /* bad args */
- if (isconfuse()) return;
- dirsub(&dx,&dy); x=dx; y=dy;
- dx = x-playerx; dy = y-playery; x = playerx; y = playery;
- while (dam>0)
- {
- x += dx; y += dy;
- if ((x > MAXX-1) || (y > MAXY-1) || (x < 0) || (y < 0))
- {
- dam=0; break; /* out of bounds */
- }
- if ((x==playerx) && (y==playery)) /* if energy hits player */
- {
- cursors(); lprcat("\nYou are hit my your own magic!"); beep();
- lastnum=278; losehp(dam); return;
- }
- if (c[BLINDCOUNT]==0) /* if not blind show effect */
- {
- cursor(x+1,y+1); lprc(cshow); nap(delay); show1cell(x,y);
- }
- if ((m=mitem[x][y])) /* is there a monster there? */
- {
- ifblind(x,y);
- if (nospell(spnum,m)) { lasthx=x; lasthy=y; return; }
- cursors(); lprc('\n');
- lprintf(str,lastmonst); dam -= hitm(x,y,dam);
- show1cell(x,y); nap(1000); x -= dx; y -= dy;
- }
- else switch (*(p= &item[x][y]))
- {
- case OWALL: cursors(); lprc('\n'); lprintf(str,"wall");
- if (dam>=50+c[HARDGAME]) /* enough damage? */
- if (level<MAXLEVEL+MAXVLEVEL-1) /* not on V3 */
- if ((x<MAXX-1) && (y<MAXY-1) && (x) && (y))
- {
- lprcat(" The wall crumbles");
- god3: *p=0;
- god: know[x][y]=0;
- show1cell(x,y);
- }
- god2: dam = 0; break;
-
- case OCLOSEDDOOR: cursors(); lprc('\n'); lprintf(str,"door");
- if (dam>=40)
- {
- lprcat(" The door is blasted apart");
- goto god3;
- }
- goto god2;
-
- case OSTATUE: cursors(); lprc('\n'); lprintf(str,"statue");
- if (c[HARDGAME]<3)
- if (dam>44)
- {
- lprcat(" The statue crumbles");
- *p=OBOOK; iarg[x][y]=level;
- goto god;
- }
- goto god2;
-
- case OTHRONE: cursors(); lprc('\n'); lprintf(str,"throne");
- if (dam>39)
- {
- mitem[x][y]=GNOMEKING; hitp[x][y]=monster[GNOMEKING].hitpoints;
- *p = OTHRONE2;
- goto god;
- }
- goto god2;
-
- case OMIRROR: dx *= -1; dy *= -1; break;
- };
- dam -= 3 + (c[HARDGAME]>>1);
- }
- }
-
-/*
- * ifblind(x,y) Routine to put "monster" or the monster name into lastmosnt
- * int x,y;
- *
- * Subroutine to copy the word "monster" into lastmonst if the player is blind
- * Enter with the coordinates (x,y) of the monster
- * Returns no value.
- */
-ifblind(x,y)
- int x,y;
- {
- char *p;
- vxy(&x,&y); /* verify correct x,y coordinates */
- if (c[BLINDCOUNT]) { lastnum=279; p="monster"; }
- else { lastnum=mitem[x][y]; p=monster[lastnum].name; }
- strcpy(lastmonst,p);
- }
-
-/*
- * tdirect(spnum) Routine to teleport away a monster
- * int spnum;
- *
- * Routine to ask for a direction to a spell and then teleport away monster
- * Enter with the spell number that wants to teleport away
- * Returns no value.
- */
-tdirect(spnum)
- int spnum;
- {
- int x,y;
- int m;
- if (spnum<0 || spnum>=SPNUM) return; /* bad args */
- if (isconfuse()) return;
- dirsub(&x,&y);
- if ((m=mitem[x][y])==0)
- { lprcat(" There wasn't anything there!"); return; }
- ifblind(x,y);
- if (nospell(spnum,m)) { lasthx=x; lasthy=y; return; }
- fillmonst(m); mitem[x][y]=know[x][y]=0;
- }
-
-/*
- * omnidirect(sp,dam,str) Routine to damage all monsters 1 square from player
- * int sp,dam;
- * char *str;
- *
- * Routine to cast a spell and then hit the monster in all directions
- * Enter with the spell number in sp, the damage done to wach square in dam,
- * and the lprintf string to identify the spell in str.
- * Returns no value.
- */
-omnidirect(spnum,dam,str)
- int spnum,dam;
- char *str;
- {
- int x,y,m;
- if (spnum<0 || spnum>=SPNUM || str==0) return; /* bad args */
- for (x=playerx-1; x<playerx+2; x++)
- for (y=playery-1; y<playery+2; y++)
- {
- if (m=mitem[x][y])
- {
- if (nospell(spnum,m) == 0)
- {
- ifblind(x,y);
- cursors(); lprc('\n'); lprintf(str,lastmonst);
- hitm(x,y,dam); nap(800);
- }
- else { lasthx=x; lasthy=y; }
- }
- }
- }
-
-/*
- * static dirsub(x,y) Routine to ask for direction, then modify x,y for it
- * int *x,*y;
- *
- * Function to ask for a direction and modify an x,y for that direction
- * Enter with the origination coordinates in (x,y).
- * Returns index into diroffx[] (0-8).
- */
-static int
-dirsub(x,y)
- int *x,*y;
- {
- int i;
- lprcat("\nIn What Direction? ");
- for (i=0; ; )
- switch(getchar())
- {
- case 'b': i++;
- case 'n': i++;
- case 'y': i++;
- case 'u': i++;
- case 'h': i++;
- case 'k': i++;
- case 'l': i++;
- case 'j': i++; goto out;
- };
-out:
- *x = playerx+diroffx[i]; *y = playery+diroffy[i];
- vxy(x,y); return(i);
- }
-
-/*
- * vxy(x,y) Routine to verify/fix coordinates for being within bounds
- * int *x,*y;
- *
- * Function to verify x & y are within the bounds for a level
- * If *x or *y is not within the absolute bounds for a level, fix them so that
- * they are on the level.
- * Returns TRUE if it was out of bounds, and the *x & *y in the calling
- * routine are affected.
- */
-vxy(x,y)
- int *x,*y;
- {
- int flag=0;
- if (*x<0) { *x=0; flag++; }
- if (*y<0) { *y=0; flag++; }
- if (*x>=MAXX) { *x=MAXX-1; flag++; }
- if (*y>=MAXY) { *y=MAXY-1; flag++; }
- return(flag);
- }
-
-/*
- * dirpoly(spnum) Routine to ask for a direction and polymorph a monst
- * int spnum;
- *
- * Subroutine to polymorph a monster and ask for the direction its in
- * Enter with the spell number in spmun.
- * Returns no value.
- */
-dirpoly(spnum)
- int spnum;
- {
- int x,y,m;
- if (spnum<0 || spnum>=SPNUM) return; /* bad args */
- if (isconfuse()) return; /* if he is confused, he can't aim his magic */
- dirsub(&x,&y);
- if (mitem[x][y]==0)
- { lprcat(" There wasn't anything there!"); return; }
- ifblind(x,y);
- if (nospell(spnum,mitem[x][y])) { lasthx=x; lasthy=y; return; }
- while ( monster[m = mitem[x][y] = rnd(MAXMONST+7)].genocided );
- hitp[x][y] = monster[m].hitpoints;
- show1cell(x,y); /* show the new monster */
- }
-
-/*
- * hitmonster(x,y) Function to hit a monster at the designated coordinates
- * int x,y;
- *
- * This routine is used for a bash & slash type attack on a monster
- * Enter with the coordinates of the monster in (x,y).
- * Returns no value.
- */
-hitmonster(x,y)
- int x,y;
- {
- int tmp,monst,damag,flag;
- if (c[TIMESTOP]) return; /* not if time stopped */
- vxy(&x,&y); /* verify coordinates are within range */
- if ((monst = mitem[x][y]) == 0) return;
- hit3flag=1; ifblind(x,y);
- tmp = monster[monst].armorclass + c[LEVEL] + c[DEXTERITY] + c[WCLASS]/4 - 12;
- cursors();
- if ((rnd(20) < tmp-c[HARDGAME]) || (rnd(71) < 5)) /* need at least random chance to hit */
- {
- lprcat("\nYou hit"); flag=1;
- damag = fullhit(1);
- if (damag<9999) damag=rnd(damag)+1;
- }
- else
- {
- lprcat("\nYou missed"); flag=0;
- }
- lprcat(" the "); lprcat(lastmonst);
- if (flag) /* if the monster was hit */
- if ((monst==RUSTMONSTER) || (monst==DISENCHANTRESS) || (monst==CUBE))
- if (c[WIELD]>0)
- if (ivenarg[c[WIELD]] > -10)
- {
- lprintf("\nYour weapon is dulled by the %s",lastmonst); beep();
- --ivenarg[c[WIELD]];
- }
- if (flag) hitm(x,y,damag);
- if (monst == VAMPIRE) if (hitp[x][y]<25) { mitem[x][y]=BAT; know[x][y]=0; }
- }
-
-/*
- * hitm(x,y,amt) Function to just hit a monster at a given coordinates
- * int x,y,amt;
- *
- * Returns the number of hitpoints the monster absorbed
- * This routine is used to specifically damage a monster at a location (x,y)
- * Called by hitmonster(x,y)
- */
-hitm(x,y,amt)
- int x,y;
- int amt;
- {
- int monst;
- int hpoints,amt2;
- vxy(&x,&y); /* verify coordinates are within range */
- amt2 = amt; /* save initial damage so we can return it */
- monst = mitem[x][y];
- if (c[HALFDAM]) amt >>= 1; /* if half damage curse adjust damage points */
- if (amt<=0) amt2 = amt = 1;
- lasthx=x; lasthy=y;
- stealth[x][y]=1; /* make sure hitting monst breaks stealth condition */
- c[HOLDMONST]=0; /* hit a monster breaks hold monster spell */
- switch(monst) /* if a dragon and orb(s) of dragon slaying */
- {
- case WHITEDRAGON: case REDDRAGON: case GREENDRAGON:
- case BRONZEDRAGON: case PLATINUMDRAGON: case SILVERDRAGON:
- amt *= 1+(c[SLAYING]<<1); break;
- }
-/* invincible monster fix is here */
- if (hitp[x][y] > monster[monst].hitpoints)
- hitp[x][y] = monster[monst].hitpoints;
- if ((hpoints = hitp[x][y]) <= amt)
- {
-#ifdef EXTRA
- c[MONSTKILLED]++;
-#endif
- lprintf("\nThe %s died!",lastmonst);
- raiseexperience((long)monster[monst].experience);
- amt = monster[monst].gold; if (amt>0) dropgold(rnd(amt)+amt);
- dropsomething(monst); disappear(x,y); bottomline();
- return(hpoints);
- }
- hitp[x][y] = hpoints-amt; return(amt2);
- }
-
-/*
- * hitplayer(x,y) Function for the monster to hit the player from (x,y)
- * int x,y;
- *
- * Function for the monster to hit the player with monster at location x,y
- * Returns nothing of value.
- */
-hitplayer(x,y)
- int x,y;
- {
- int dam,tmp,mster,bias;
- vxy(&x,&y); /* verify coordinates are within range */
- lastnum = mster = mitem[x][y];
-/* spirit naga's and poltergeist's do nothing if scarab of negate spirit */
- if (c[NEGATESPIRIT] || c[SPIRITPRO]) if ((mster ==POLTERGEIST) || (mster ==SPIRITNAGA)) return;
-/* if undead and cube of undead control */
- if (c[CUBEofUNDEAD] || c[UNDEADPRO]) if ((mster ==VAMPIRE) || (mster ==WRAITH) || (mster ==ZOMBIE)) return;
- if ((know[x][y]&1) == 0)
- {
- know[x][y]=1; show1cell(x,y);
- }
- bias = (c[HARDGAME]) + 1;
- hitflag = hit2flag = hit3flag = 1;
- yrepcount=0;
- cursors(); ifblind(x,y);
- if (c[INVISIBILITY]) if (rnd(33)<20)
- {
- lprintf("\nThe %s misses wildly",lastmonst); return;
- }
- if (c[CHARMCOUNT]) if (rnd(30)+5*monster[mster].level-c[CHARISMA]<30)
- {
- lprintf("\nThe %s is awestruck at your magnificence!",lastmonst);
- return;
- }
- if (mster==BAT) dam=1;
- else
- {
- dam = monster[mster].damage;
- dam += rnd((int)((dam<1)?1:dam)) + monster[mster].level;
- }
- tmp = 0;
- if (monster[mster].attack>0)
- if (((dam + bias + 8) > c[AC]) || (rnd((int)((c[AC]>0)?c[AC]:1))==1))
- { if (spattack(monster[mster].attack,x,y)) { flushall(); return; }
- tmp = 1; bias -= 2; cursors(); }
- if (((dam + bias) > c[AC]) || (rnd((int)((c[AC]>0)?c[AC]:1))==1))
- {
- lprintf("\n The %s hit you ",lastmonst); tmp = 1;
- if ((dam -= c[AC]) < 0) dam=0;
- if (dam > 0) { losehp(dam); bottomhp(); flushall(); }
- }
- if (tmp == 0) lprintf("\n The %s missed ",lastmonst);
- }
-
-/*
- * dropsomething(monst) Function to create an object when a monster dies
- * int monst;
- *
- * Function to create an object near the player when certain monsters are killed
- * Enter with the monster number
- * Returns nothing of value.
- */
-dropsomething(monst)
- int monst;
- {
- switch(monst)
- {
- case ORC: case NYMPH: case ELF: case TROGLODYTE:
- case TROLL: case ROTHE: case VIOLETFUNGI:
- case PLATINUMDRAGON: case GNOMEKING: case REDDRAGON:
- something(level); return;
-
- case LEPRECHAUN: if (rnd(101)>=75) creategem();
- if (rnd(5)==1) dropsomething(LEPRECHAUN); return;
- }
- }
-
-/*
- * dropgold(amount) Function to drop some gold around player
- * int amount;
- *
- * Enter with the number of gold pieces to drop
- * Returns nothing of value.
- */
-dropgold(amount)
- int amount;
- {
- if (amount > 250) createitem(OMAXGOLD,amount/100); else createitem(OGOLDPILE,amount);
- }
-
-/*
- * something(level) Function to create a random item around player
- * int level;
- *
- * Function to create an item from a designed probability around player
- * Enter with the cave level on which something is to be dropped
- * Returns nothing of value.
- */
-something(level)
- int level;
- {
- int j;
- int i;
- if (level<0 || level>MAXLEVEL+MAXVLEVEL) return; /* correct level? */
- if (rnd(101)<8) something(level); /* possibly more than one item */
- j = newobject(level,&i); createitem(j,i);
- }
-
-/*
- * newobject(lev,i) Routine to return a randomly selected new object
- * int lev,*i;
- *
- * Routine to return a randomly selected object to be created
- * Returns the object number created, and sets *i for its argument
- * Enter with the cave level and a pointer to the items arg
- */
-static char nobjtab[] = { 0, OSCROLL, OSCROLL, OSCROLL, OSCROLL, OPOTION,
- OPOTION, OPOTION, OPOTION, OGOLDPILE, OGOLDPILE, OGOLDPILE, OGOLDPILE,
- OBOOK, OBOOK, OBOOK, OBOOK, ODAGGER, ODAGGER, ODAGGER, OLEATHER, OLEATHER,
- OLEATHER, OREGENRING, OPROTRING, OENERGYRING, ODEXRING, OSTRRING, OSPEAR,
- OBELT, ORING, OSTUDLEATHER, OSHIELD, OFLAIL, OCHAIN, O2SWORD, OPLATE,
- OLONGSWORD };
-
-newobject(lev,i)
- int lev,*i;
- {
- int tmp=32,j;
- if (level<0 || level>MAXLEVEL+MAXVLEVEL) return(0); /* correct level? */
- if (lev>6) tmp=37; else if (lev>4) tmp=35;
- j = nobjtab[tmp=rnd(tmp)]; /* the object type */
- switch(tmp)
- {
- case 1: case 2: case 3: case 4: *i=newscroll(); break;
- case 5: case 6: case 7: case 8: *i=newpotion(); break;
- case 9: case 10: case 11: case 12: *i=rnd((lev+1)*10)+lev*10+10; break;
- case 13: case 14: case 15: case 16: *i=lev; break;
- case 17: case 18: case 19: if (!(*i=newdagger())) return(0); break;
- case 20: case 21: case 22: if (!(*i=newleather())) return(0); break;
- case 23: case 32: case 35: *i=rund(lev/3+1); break;
- case 24: case 26: *i=rnd(lev/4+1); break;
- case 25: *i=rund(lev/4+1); break;
- case 27: *i=rnd(lev/2+1); break;
- case 30: case 33: *i=rund(lev/2+1); break;
- case 28: *i=rund(lev/3+1); if (*i==0) return(0); break;
- case 29: case 31: *i=rund(lev/2+1); if (*i==0) return(0); break;
- case 34: *i=newchain(); break;
- case 36: *i=newplate(); break;
- case 37: *i=newsword(); break;
- }
- return(j);
- }
-
-/*
- * spattack(atckno,xx,yy) Function to process special attacks from monsters
- * int atckno,xx,yy;
- *
- * Enter with the special attack number, and the coordinates (xx,yy)
- * of the monster that is special attacking
- * Returns 1 if must do a show1cell(xx,yy) upon return, 0 otherwise
- *
- * atckno monster effect
- * ---------------------------------------------------
- * 0 none
- * 1 rust monster eat armor
- * 2 hell hound breathe light fire
- * 3 dragon breathe fire
- * 4 giant centipede weakening sing
- * 5 white dragon cold breath
- * 6 wraith drain level
- * 7 waterlord water gusher
- * 8 leprechaun steal gold
- * 9 disenchantress disenchant weapon or armor
- * 10 ice lizard hits with barbed tail
- * 11 umber hulk confusion
- * 12 spirit naga cast spells taken from special attacks
- * 13 platinum dragon psionics
- * 14 nymph steal objects
- * 15 bugbear bite
- * 16 osequip bite
- *
- * char rustarm[ARMORTYPES][2];
- * special array for maximum rust damage to armor from rustmonster
- * format is: { armor type , minimum attribute
- */
-#define ARMORTYPES 6
-static char rustarm[ARMORTYPES][2] = { OSTUDLEATHER,-2, ORING,-4, OCHAIN,-5,
- OSPLINT,-6, OPLATE,-8, OPLATEARMOR,-9 };
-static char spsel[] = { 1, 2, 3, 5, 6, 8, 9, 11, 13, 14 };
-spattack(x,xx,yy)
- int x,xx,yy;
- {
- int i,j=0,k,m;
- char *p=0;
- if (c[CANCELLATION]) return(0);
- vxy(&xx,&yy); /* verify x & y coordinates */
- switch(x)
- {
- case 1: /* rust your armor, j=1 when rusting has occurred */
- m = k = c[WEAR];
- if ((i=c[SHIELD]) != -1)
- {
- if (--ivenarg[i] < -1) ivenarg[i]= -1; else j=1;
- }
- if ((j==0) && (k != -1))
- {
- m = iven[k];
- for (i=0; i<ARMORTYPES; i++)
- if (m == rustarm[i][0]) /* find his armor in table */
- {
- if (--ivenarg[k]< rustarm[i][1])
- ivenarg[k]= rustarm[i][1]; else j=1;
- break;
- }
- }
- if (j==0) /* if rusting did not occur */
- switch(m)
- {
- case OLEATHER: p = "\nThe %s hit you -- Your lucky you have leather on";
- break;
- case OSSPLATE: p = "\nThe %s hit you -- Your fortunate to have stainless steel armor!";
- break;
- }
- else { beep(); p = "\nThe %s hit you -- your armor feels weaker"; }
- break;
-
- case 2: i = rnd(15)+8-c[AC];
- spout: p="\nThe %s breathes fire at you!";
- if (c[FIRERESISTANCE])
- p="\nThe %s's flame doesn't phase you!";
- else
- spout2: if (p) { lprintf(p,lastmonst); beep(); }
- checkloss(i);
- return(0);
-
- case 3: i = rnd(20)+25-c[AC]; goto spout;
-
- case 4: if (c[STRENGTH]>3)
- {
- p="\nThe %s stung you! You feel weaker"; beep();
- --c[STRENGTH];
- }
- else p="\nThe %s stung you!";
- break;
-
- case 5: p="\nThe %s blasts you with his cold breath";
- i = rnd(15)+18-c[AC]; goto spout2;
-
- case 6: lprintf("\nThe %s drains you of your life energy!",lastmonst);
- loselevel(); beep(); return(0);
-
- case 7: p="\nThe %s got you with a gusher!";
- i = rnd(15)+25-c[AC]; goto spout2;
-
- case 8: if (c[NOTHEFT]) return(0); /* he has a device of no theft */
- if (c[GOLD])
- {
- p="\nThe %s hit you -- Your purse feels lighter";
- if (c[GOLD]>32767) c[GOLD]>>=1;
- else c[GOLD] -= rnd((int)(1+(c[GOLD]>>1)));
- if (c[GOLD] < 0) c[GOLD]=0;
- }
- else p="\nThe %s couldn't find any gold to steal";
- lprintf(p,lastmonst); disappear(xx,yy); beep();
- bottomgold(); return(1);
-
- case 9: for(j=50; ; ) /* disenchant */
- {
- i=rund(26); m=iven[i]; /* randomly select item */
- if (m>0 && ivenarg[i]>0 && m!=OSCROLL && m!=OPOTION)
- {
- if ((ivenarg[i] -= 3)<0) ivenarg[i]=0;
- lprintf("\nThe %s hits you -- you feel a sense of loss",lastmonst);
- srcount=0; beep(); show3(i); bottomline(); return(0);
- }
- if (--j<=0)
- {
- p="\nThe %s nearly misses"; break;
- }
- break;
- }
- break;
-
- case 10: p="\nThe %s hit you with his barbed tail";
- i = rnd(25)-c[AC]; goto spout2;
-
- case 11: p="\nThe %s has confused you"; beep();
- c[CONFUSE]+= 10+rnd(10); break;
-
- case 12: /* performs any number of other special attacks */
- return(spattack(spsel[rund(10)],xx,yy));
-
- case 13: p="\nThe %s flattens you with his psionics!";
- i = rnd(15)+30-c[AC]; goto spout2;
-
- case 14: if (c[NOTHEFT]) return(0); /* he has device of no theft */
- if (emptyhanded()==1)
- {
- p="\nThe %s couldn't find anything to steal";
- break;
- }
- lprintf("\nThe %s picks your pocket and takes:",lastmonst);
- beep();
- if (stealsomething()==0) lprcat(" nothing"); disappear(xx,yy);
- bottomline(); return(1);
-
- case 15: i= rnd(10)+ 5-c[AC];
- spout3: p="\nThe %s bit you!";
- goto spout2;
-
- case 16: i= rnd(15)+10-c[AC]; goto spout3;
- };
- if (p) { lprintf(p,lastmonst); bottomline(); }
- return(0);
- }
-
-/*
- * checkloss(x) Routine to subtract hp from user and flag bottomline display
- * int x;
- *
- * Routine to subtract hitpoints from the user and flag the bottomline display
- * Enter with the number of hit points to lose
- * Note: if x > c[HP] this routine could kill the player!
- */
-checkloss(x)
- int x;
- {
- if (x>0) { losehp(x); bottomhp(); }
- }
-
-/*
- * annihilate() Routine to annihilate all monsters around player (playerx,playery)
- *
- * Gives player experience, but no dropped objects
- * Returns the experience gained from all monsters killed
- */
-annihilate()
- {
- int i,j;
- long k;
- char *p;
- for (k=0, i=playerx-1; i<=playerx+1; i++)
- for (j=playery-1; j<=playery+1; j++)
- if (!vxy(&i,&j)) /* if not out of bounds */
- {
- if (*(p= &mitem[i][j])) /* if a monster there */
- if (*p<DEMONLORD+2)
- {
- k += monster[*p].experience; *p=know[i][j]=0;
- }
- else
- {
- lprintf("\nThe %s barely escapes being annihilated!",monster[*p].name);
- hitp[i][j] = (hitp[i][j]>>1) + 1; /* lose half hit points*/
- }
- }
- if (k>0)
- {
- lprcat("\nYou hear loud screams of agony!"); raiseexperience((long)k);
- }
- return(k);
- }
-
-/*
- * newsphere(x,y,dir,lifetime) Function to create a new sphere of annihilation
- * int x,y,dir,lifetime;
- *
- * Enter with the coordinates of the sphere in x,y
- * the direction (0-8 diroffx format) in dir, and the lifespan of the
- * sphere in lifetime (in turns)
- * Returns the number of spheres currently in existence
- */
-newsphere(x,y,dir,life)
- int x,y,dir,life;
- {
- int m;
- struct sphere *sp;
- if (((sp=(struct sphere *)malloc(sizeof(struct sphere)))) == 0)
- return(c[SPHCAST]); /* can't malloc, therefore failure */
- if (dir>=9) dir=0; /* no movement if direction not found */
- if (level==0) vxy(&x,&y); /* don't go out of bounds */
- else
- {
- if (x<1) x=1; if (x>=MAXX-1) x=MAXX-2;
- if (y<1) y=1; if (y>=MAXY-1) y=MAXY-2;
- }
- if ((m=mitem[x][y]) >= DEMONLORD+4) /* demons dispel spheres */
- {
- know[x][y]=1; show1cell(x,y); /* show the demon (ha ha) */
- cursors(); lprintf("\nThe %s dispels the sphere!",monster[m].name);
- beep(); rmsphere(x,y); /* remove any spheres that are here */
- return(c[SPHCAST]);
- }
- if (m==DISENCHANTRESS) /* disenchantress cancels spheres */
- {
- cursors(); lprintf("\nThe %s causes cancellation of the sphere!",monster[m].name); beep();
-boom: sphboom(x,y); /* blow up stuff around sphere */
- rmsphere(x,y); /* remove any spheres that are here */
- return(c[SPHCAST]);
- }
- if (c[CANCELLATION]) /* cancellation cancels spheres */
- {
- cursors(); lprcat("\nAs the cancellation takes effect, you hear a great earth shaking blast!"); beep();
- goto boom;
- }
- if (item[x][y]==OANNIHILATION) /* collision of spheres detonates spheres */
- {
- cursors(); lprcat("\nTwo spheres of annihilation collide! You hear a great earth shaking blast!"); beep();
- rmsphere(x,y);
- goto boom;
- }
- if (playerx==x && playery==y) /* collision of sphere and player! */
- {
- cursors();
- lprcat("\nYou have been enveloped by the zone of nothingness!\n");
- beep(); rmsphere(x,y); /* remove any spheres that are here */
- nap(4000); died(258);
- }
- item[x][y]=OANNIHILATION; mitem[x][y]=0; know[x][y]=1;
- show1cell(x,y); /* show the new sphere */
- sp->x=x; sp->y=y; sp->lev=level; sp->dir=dir; sp->lifetime=life; sp->p=0;
- if (spheres==0) spheres=sp; /* if first node in the sphere list */
- else /* add sphere to beginning of linked list */
- {
- sp->p = spheres; spheres = sp;
- }
- return(++c[SPHCAST]); /* one more sphere in the world */
- }
-
-/*
- * rmsphere(x,y) Function to delete a sphere of annihilation from list
- * int x,y;
- *
- * Enter with the coordinates of the sphere (on current level)
- * Returns the number of spheres currently in existence
- */
-rmsphere(x,y)
- int x,y;
- {
- struct sphere *sp,*sp2=0;
- for (sp=spheres; sp; sp2=sp,sp=sp->p)
- if (level==sp->lev) /* is sphere on this level? */
- if ((x==sp->x) && (y==sp->y)) /* locate sphere at this location */
- {
- item[x][y]=mitem[x][y]=0; know[x][y]=1;
- show1cell(x,y); /* show the now missing sphere */
- --c[SPHCAST];
- if (sp==spheres) { sp2=sp; spheres=sp->p; free((char*)sp2); }
- else
- { sp2->p = sp->p; free((char*)sp); }
- break;
- }
- return(c[SPHCAST]); /* return number of spheres in the world */
- }
-
-/*
- * sphboom(x,y) Function to perform the effects of a sphere detonation
- * int x,y;
- *
- * Enter with the coordinates of the blast, Returns no value
- */
-sphboom(x,y)
- int x,y;
- {
- int i,j;
- if (c[HOLDMONST]) c[HOLDMONST]=1;
- if (c[CANCELLATION]) c[CANCELLATION]=1;
- for (j=max(1,x-2); j<min(x+3,MAXX-1); j++)
- for (i=max(1,y-2); i<min(y+3,MAXY-1); i++)
- {
- item[j][i]=mitem[j][i]=0;
- show1cell(j,i);
- if (playerx==j && playery==i)
- {
- cursors(); beep();
- lprcat("\nYou were too close to the sphere!");
- nap(3000);
- died(283); /* player killed in explosion */
- }
- }
- }
-
-/*
- * genmonst() Function to ask for monster and genocide from game
- *
- * This is done by setting a flag in the monster[] structure
- */
-genmonst()
- {
- int i,j;
- cursors(); lprcat("\nGenocide what monster? ");
- for (i=0; (!isalpha(i)) && (i!=' '); i=getchar());
- lprc(i);
- for (j=0; j<MAXMONST; j++) /* search for the monster type */
- if (monstnamelist[j]==i) /* have we found it? */
- {
- monster[j].genocided=1; /* genocided from game */
- lprintf(" There will be no more %s's",monster[j].name);
- /* now wipe out monsters on this level */
- newcavelevel(level); draws(0,MAXX,0,MAXY); bot_linex();
- return;
- }
- lprcat(" You sense failure!");
- }
-
diff --git a/games/larn/moreobj.c b/games/larn/moreobj.c
deleted file mode 100644
index ddad0d6..0000000
--- a/games/larn/moreobj.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * Routines in this file:
- *
- * oaltar()
- * othrone()
- * ochest()
- * ofountain()
- */
-#include "header.h"
-
-static void ohear();
-
-/*
- * ******
- * OALTAR
- * ******
- *
- * subroutine to process an altar object
- */
-oaltar()
- {
- unsigned long k;
-
- lprcat("\nDo you (p) pray (d) desecrate"); iopts();
- while (1)
- {
- while (1) switch(getchar())
- {
- case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? ");
- while (1) switch(getchar())
- {
- case 'j': if (rnd(100)<75)
- lprcat("\nnothing happens");
- else if (rnd(13)<4) ohear();
- else if (rnd(43) == 10)
- {
- if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment");
- enchantarmor(); return;
- }
- else if (rnd(43) == 10)
- {
- if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment");
- enchweapon(); return;
- }
- else createmonster(makemonst(level+1));
- return;
-
- case 'm': lprcat("\n\n"); cursor(1,24); cltoeoln();
- cursor(1,23); cltoeoln();
- lprcat("how much do you donate? ");
- k = readnum((long)c[GOLD]);
- if (c[GOLD]<k)
- {
- lprcat("\nYou don't have that much!");
- return;
- }
- c[GOLD] -= k;
- if (k < c[GOLD]/10 || k<rnd(50))
- { createmonster(makemonst(level+1)); c[AGGRAVATE] += 200; }
- else if (rnd(101) > 50) { ohear(); return; }
- else if (rnd(43) == 5)
- {
- if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment");
- enchantarmor(); return;
- }
- else if (rnd(43) == 8)
- {
- if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment");
- enchweapon(); return;
- }
- else lprcat("\nThank You.");
- bottomline(); return;
-
- case '\33': return;
- };
-
- case 'd': lprcat(" desecrate");
- if (rnd(100)<60)
- { createmonster(makemonst(level+2)+8); c[AGGRAVATE] += 2500; }
- else
- if (rnd(101)<30)
- {
- lprcat("\nThe altar crumbles into a pile of dust before your eyes");
- forget(); /* remember to destroy the altar */
- }
- else
- lprcat("\nnothing happens");
- return;
-
- case 'i':
- case '\33': ignore();
- if (rnd(100)<30) { createmonster(makemonst(level+1)); c[AGGRAVATE] += rnd(450); }
- else lprcat("\nnothing happens");
- return;
- };
- }
- }
-
-/*
- function to cast a +3 protection on the player
- */
-static void
-ohear()
- {
- lprcat("\nYou have been heard!");
- if (c[ALTPRO]==0) c[MOREDEFENSES]+=3;
- c[ALTPRO] += 500; /* protection field */
- bottomline();
- }
-
-/*
- *******
- OTHRONE
- *******
-
- subroutine to process a throne object
- */
-othrone(arg)
- int arg;
- {
- int i,k;
-
- lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts();
- while (1)
- {
- while (1) switch(getchar())
- {
- case 'p': lprcat(" pry off"); k=rnd(101);
- if (k<25)
- {
- for (i=0; i<rnd(4); i++) creategem(); /* gems pop off the throne */
- item[playerx][playery]=ODEADTHRONE;
- know[playerx][playery]=0;
- }
- else if (k<40 && arg==0)
- {
- createmonster(GNOMEKING);
- item[playerx][playery]=OTHRONE2;
- know[playerx][playery]=0;
- }
- else lprcat("\nnothing happens");
- return;
-
- case 's': lprcat(" sit down"); k=rnd(101);
- if (k<30 && arg==0)
- {
- createmonster(GNOMEKING);
- item[playerx][playery]=OTHRONE2;
- know[playerx][playery]=0;
- }
- else if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
- else lprcat("\nnothing happens");
- return;
-
- case 'i':
- case '\33': ignore(); return;
- };
- }
- }
-
-odeadthrone()
- {
- int k;
-
- lprcat("\nDo you (s) sit down"); iopts();
- while (1)
- {
- while (1) switch(getchar())
- {
- case 's': lprcat(" sit down"); k=rnd(101);
- if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
- else lprcat("\nnothing happens");
- return;
-
- case 'i':
- case '\33': ignore(); return;
- };
- }
- }
-
-/*
- ******
- OCHEST
- ******
-
- subroutine to process a throne object
- */
-ochest()
- {
- int i,k;
- lprcat("\nDo you (t) take it, (o) try to open it"); iopts();
- while (1)
- {
- while (1) switch(getchar())
- {
- case 'o': lprcat(" open it"); k=rnd(101);
- if (k<40)
- {
- lprcat("\nThe chest explodes as you open it"); beep();
- i = rnd(10); lastnum=281; /* in case he dies */
- lprintf("\nYou suffer %d hit points damage!",(long)i);
- checkloss(i);
- switch(rnd(10)) /* see if he gets a curse */
- {
- case 1: c[ITCHING]+= rnd(1000)+100;
- lprcat("\nYou feel an irritation spread over your skin!");
- beep();
- break;
-
- case 2: c[CLUMSINESS]+= rnd(1600)+200;
- lprcat("\nYou begin to lose hand to eye coordination!");
- beep();
- break;
-
- case 3: c[HALFDAM]+= rnd(1600)+200;
- beep();
- lprcat("\nA sickness engulfs you!"); break;
- };
- item[playerx][playery]=know[playerx][playery]=0;
- if (rnd(100)<69) creategem(); /* gems from the chest */
- dropgold(rnd(110*iarg[playerx][playery]+200));
- for (i=0; i<rnd(4); i++) something(iarg[playerx][playery]+2);
- }
- else lprcat("\nnothing happens");
- return;
-
- case 't': lprcat(" take");
- if (take(OCHEST,iarg[playerx][playery])==0)
- item[playerx][playery]=know[playerx][playery]=0;
- return;
-
- case 'i':
- case '\33': ignore(); return;
- };
- }
- }
-
-/*
- *********
- OFOUNTAIN
- *********
- */
-
-ofountain()
- {
- int x;
- cursors();
- lprcat("\nDo you (d) drink, (w) wash yourself"); iopts();
- while (1) switch(getchar())
- {
- case 'd': lprcat("drink");
- if (rnd(1501)<2)
- {
- lprcat("\nOops! You seem to have caught the dreadful sleep!");
- beep(); lflush(); sleep(3); died(280); return;
- }
- x = rnd(100);
- if (x<7)
- {
- c[HALFDAM] += 200+rnd(200);
- lprcat("\nYou feel a sickness coming on");
- }
- else if (x<13) quaffpotion(23); /* see invisible */
- else if (x < 45)
- lprcat("\nnothing seems to have happened");
- else if (rnd(3) != 2)
- fntchange(1); /* change char levels upward */
- else
- fntchange(-1); /* change char levels downward */
- if (rnd(12)<3)
- {
- lprcat("\nThe fountains bubbling slowly quiets");
- item[playerx][playery]=ODEADFOUNTAIN; /* dead fountain */
- know[playerx][playery]=0;
- }
- return;
-
- case '\33':
- case 'i': ignore(); return;
-
- case 'w': lprcat("wash yourself");
- if (rnd(100) < 11)
- {
- x=rnd((level<<2)+2);
- lprintf("\nOh no! The water was foul! You suffer %d hit points!",(long)x);
- lastnum=273; losehp(x); bottomline(); cursors();
- }
- else
- if (rnd(100) < 29)
- lprcat("\nYou got the dirt off!");
- else
- if (rnd(100) < 31)
- lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
- else
- if (rnd(100) < 34)
- createmonster(WATERLORD); /* make water lord */
- else
- lprcat("\nnothing seems to have happened");
- return;
- }
- }
-
-/*
- ***
- FCH
- ***
-
- subroutine to process an up/down of a character attribute for ofountain
- */
-static void
-fch(how,x)
- int how;
- long *x;
- {
- if (how < 0) { lprcat(" went down by one!"); --(*x); }
- else { lprcat(" went up by one!"); (*x)++; }
- bottomline();
- }
-
-/*
- a subroutine to raise or lower character levels
- if x > 0 they are raised if x < 0 they are lowered
- */
-fntchange(how)
- int how;
- {
- long j;
- lprc('\n');
- switch(rnd(9))
- {
- case 1: lprcat("Your strength"); fch(how,&c[0]); break;
- case 2: lprcat("Your intelligence"); fch(how,&c[1]); break;
- case 3: lprcat("Your wisdom"); fch(how,&c[2]); break;
- case 4: lprcat("Your constitution"); fch(how,&c[3]); break;
- case 5: lprcat("Your dexterity"); fch(how,&c[4]); break;
- case 6: lprcat("Your charm"); fch(how,&c[5]); break;
- case 7: j=rnd(level+1);
- if (how < 0)
- { lprintf("You lose %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); losemhp((int)j); }
- else
- { lprintf("You gain %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); raisemhp((int)j); }
- bottomline(); break;
-
- case 8: j=rnd(level+1);
- if (how > 0)
- {
- lprintf("You just gained %d spell",(long)j); raisemspells((int)j);
- if (j>1) lprcat("s!"); else lprc('!');
- }
- else
- {
- lprintf("You just lost %d spell",(long)j); losemspells((int)j);
- if (j>1) lprcat("s!"); else lprc('!');
- }
- bottomline(); break;
-
- case 9: j = 5*rnd((level+1)*(level+1));
- if (how < 0)
- {
- lprintf("You just lost %d experience point",(long)j);
- if (j>1) lprcat("s!"); else lprc('!'); loseexperience((long)j);
- }
- else
- {
- lprintf("You just gained %d experience point",(long)j);
- if (j>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j);
- }
- break;
- }
- cursors();
- }
diff --git a/games/larn/movem.c b/games/larn/movem.c
deleted file mode 100644
index 8ae1358..0000000
--- a/games/larn/movem.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * movem.c (move monster) Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * Here are the functions in this file:
- *
- * movemonst() Routine to move the monsters toward the player
- * movemt(x,y) Function to move a monster at (x,y) -- must determine where
- * mmove(x,y,xd,yd) Function to actually perform the monster movement
- * movsphere() Function to look for and move spheres of annihilation
- */
-#include "header.h"
-
-/*
- * movemonst() Routine to move the monsters toward the player
- *
- * This routine has the responsibility to determine which monsters are to
- * move, and call movemt() to do the move.
- * Returns no value.
- */
-static short w1[9],w1x[9],w1y[9];
-static int tmp1,tmp2,tmp3,tmp4,distance;
-movemonst()
- {
- int i,j;
- if (c[TIMESTOP]) return; /* no action if time is stopped */
- if (c[HASTESELF]) if ((c[HASTESELF]&1)==0) return;
- if (spheres) movsphere(); /* move the spheres of annihilation if any */
- if (c[HOLDMONST]) return; /* no action if monsters are held */
-
- if (c[AGGRAVATE]) /* determine window of monsters to move */
- {
- tmp1=playery-5; tmp2=playery+6; tmp3=playerx-10; tmp4=playerx+11;
- distance=40; /* depth of intelligent monster movement */
- }
- else
- {
- tmp1=playery-3; tmp2=playery+4; tmp3=playerx-5; tmp4=playerx+6;
- distance=17; /* depth of intelligent monster movement */
- }
-
- if (level == 0) /* if on outside level monsters can move in perimeter */
- {
- if (tmp1 < 0) tmp1=0; if (tmp2 > MAXY) tmp2=MAXY;
- if (tmp3 < 0) tmp3=0; if (tmp4 > MAXX) tmp4=MAXX;
- }
- else /* if in a dungeon monsters can't be on the perimeter (wall there) */
- {
- if (tmp1 < 1) tmp1=1; if (tmp2 > MAXY-1) tmp2=MAXY-1;
- if (tmp3 < 1) tmp3=1; if (tmp4 > MAXX-1) tmp4=MAXX-1;
- }
-
- for (j=tmp1; j<tmp2; j++) /* now reset monster moved flags */
- for (i=tmp3; i<tmp4; i++)
- moved[i][j] = 0;
- moved[lasthx][lasthy]=0;
-
- if (c[AGGRAVATE] || !c[STEALTH]) /* who gets moved? split for efficiency */
- {
- for (j=tmp1; j<tmp2; j++) /* look thru all locations in window */
- for (i=tmp3; i<tmp4; i++)
- if (mitem[i][j]) /* if there is a monster to move */
- if (moved[i][j]==0) /* if it has not already been moved */
- movemt(i,j); /* go and move the monster */
- }
- else /* not aggravated and not stealth */
- {
- for (j=tmp1; j<tmp2; j++) /* look thru all locations in window */
- for (i=tmp3; i<tmp4; i++)
- if (mitem[i][j]) /* if there is a monster to move */
- if (moved[i][j]==0) /* if it has not already been moved */
- if (stealth[i][j]) /* if it is asleep due to stealth */
- movemt(i,j); /* go and move the monster */
- }
-
- if (mitem[lasthx][lasthy]) /* now move monster last hit by player if not already moved */
- {
- if (moved[lasthx][lasthy]==0) /* if it has not already been moved */
- {
- movemt(lasthx,lasthy);
- lasthx = w1x[0]; lasthy = w1y[0];
- }
- }
- }
-
-/*
- * movemt(x,y) Function to move a monster at (x,y) -- must determine where
- * int x,y;
- *
- * This routine is responsible for determining where one monster at (x,y) will
- * move to. Enter with the monsters coordinates in (x,y).
- * Returns no value.
- */
-static int tmpitem,xl,xh,yl,yh;
-movemt(i,j)
- int i,j;
- {
- int k,m,z,tmp,xtmp,ytmp,monst;
- switch(monst=mitem[i][j]) /* for half speed monsters */
- {
- case TROGLODYTE: case HOBGOBLIN: case METAMORPH: case XVART:
- case INVISIBLESTALKER: case ICELIZARD: if ((gtime & 1) == 1) return;
- };
-
- if (c[SCAREMONST]) /* choose destination randomly if scared */
- {
- if ((xl = i+rnd(3)-2) < 0) xl=0; if (xl >= MAXX) xl=MAXX-1;
- if ((yl = j+rnd(3)-2) < 0) yl=0; if (yl >= MAXY) yl=MAXY-1;
- if ((tmp=item[xl][yl]) != OWALL)
- if (mitem[xl][yl] == 0)
- if ((mitem[i][j] != VAMPIRE) || (tmpitem != OMIRROR))
- if (tmp != OCLOSEDDOOR) mmove(i,j,xl,yl);
- return;
- }
-
- if (monster[monst].intelligence > 10-c[HARDGAME]) /* if smart monster */
-/* intelligent movement here -- first setup screen array */
- {
- xl=tmp3-2; yl=tmp1-2; xh=tmp4+2; yh=tmp2+2;
- vxy(&xl,&yl); vxy(&xh,&yh);
- for (k=yl; k<yh; k++)
- for (m=xl; m<xh; m++)
- {
- switch(item[m][k])
- {
- case OWALL: case OPIT: case OTRAPARROW: case ODARTRAP:
- case OCLOSEDDOOR: case OTRAPDOOR: case OTELEPORTER:
- smm: screen[m][k]=127; break;
- case OMIRROR: if (mitem[m][k]==VAMPIRE) goto smm;
- default: screen[m][k]= 0; break;
- };
- }
- screen[playerx][playery]=1;
-
-/* now perform proximity ripple from playerx,playery to monster */
- xl=tmp3-1; yl=tmp1-1; xh=tmp4+1; yh=tmp2+1;
- vxy(&xl,&yl); vxy(&xh,&yh);
- for (tmp=1; tmp<distance; tmp++) /* only up to 20 squares away */
- for (k=yl; k<yh; k++)
- for (m=xl; m<xh; m++)
- if (screen[m][k]==tmp) /* if find proximity n advance it */
- for (z=1; z<9; z++) /* go around in a circle */
- {
- if (screen[xtmp=m+diroffx[z]][ytmp=k+diroffy[z]]==0)
- screen[xtmp][ytmp]=tmp+1;
- if (xtmp==i && ytmp==j) goto out;
- }
-
-out: if (tmp<distance) /* did find connectivity */
- /* now select lowest value around playerx,playery */
- for (z=1; z<9; z++) /* go around in a circle */
- if (screen[xl=i+diroffx[z]][yl=j+diroffy[z]]==tmp)
- if (!mitem[xl][yl]) { mmove(i,j,w1x[0]=xl,w1y[0]=yl); return; }
- }
-
- /* dumb monsters move here */
- xl=i-1; yl=j-1; xh=i+2; yh=j+2;
- if (i<playerx) xl++; else if (i>playerx) --xh;
- if (j<playery) yl++; else if (j>playery) --yh;
- for (k=0; k<9; k++) w1[k] = 10000;
-
- for (k=xl; k<xh; k++)
- for (m=yl; m<yh; m++) /* for each square compute distance to player */
- {
- tmp = k-i+4+3*(m-j);
- tmpitem = item[k][m];
- if (tmpitem!=OWALL || (k==playerx && m==playery))
- if (mitem[k][m]==0)
- if ((mitem[i][j] != VAMPIRE) || (tmpitem != OMIRROR))
- if (tmpitem!=OCLOSEDDOOR)
- {
- w1[tmp] = (playerx-k)*(playerx-k)+(playery-m)*(playery-m);
- w1x[tmp] = k; w1y[tmp] = m;
- }
- }
-
- tmp = 0;
- for (k=1; k<9; k++) if (w1[tmp] > w1[k]) tmp=k;
-
- if (w1[tmp] < 10000)
- if ((i!=w1x[tmp]) || (j!=w1y[tmp]))
- mmove(i,j,w1x[tmp],w1y[tmp]);
- }
-
-/*
- * mmove(x,y,xd,yd) Function to actually perform the monster movement
- * int x,y,xd,yd;
- *
- * Enter with the from coordinates in (x,y) and the destination coordinates
- * in (xd,yd).
- */
-mmove(aa,bb,cc,dd)
- int aa,bb,cc,dd;
- {
- int tmp,i,flag;
- char *who,*p;
- flag=0; /* set to 1 if monster hit by arrow trap */
- if ((cc==playerx) && (dd==playery))
- {
- hitplayer(aa,bb); moved[aa][bb] = 1; return;
- }
- i=item[cc][dd];
- if ((i==OPIT) || (i==OTRAPDOOR))
- switch(mitem[aa][bb])
- {
- case SPIRITNAGA: case PLATINUMDRAGON: case WRAITH:
- case VAMPIRE: case SILVERDRAGON: case POLTERGEIST:
- case DEMONLORD: case DEMONLORD+1: case DEMONLORD+2:
- case DEMONLORD+3: case DEMONLORD+4: case DEMONLORD+5:
- case DEMONLORD+6: case DEMONPRINCE: break;
-
- default: mitem[aa][bb]=0; /* fell in a pit or trapdoor */
- };
- tmp = mitem[cc][dd] = mitem[aa][bb];
- if (i==OANNIHILATION)
- {
- if (tmp>=DEMONLORD+3) /* demons dispel spheres */
- {
- cursors();
- lprintf("\nThe %s dispels the sphere!",monster[tmp].name);
- rmsphere(cc,dd); /* delete the sphere */
- }
- else i=tmp=mitem[cc][dd]=0;
- }
- stealth[cc][dd]=1;
- if ((hitp[cc][dd] = hitp[aa][bb]) < 0) hitp[cc][dd]=1;
- mitem[aa][bb] = 0; moved[cc][dd] = 1;
- if (tmp == LEPRECHAUN)
- switch(i)
- {
- case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD:
- case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE:
- item[cc][dd] = 0; /* leprechaun takes gold */
- };
-
- if (tmp == TROLL) /* if a troll regenerate him */
- if ((gtime & 1) == 0)
- if (monster[tmp].hitpoints > hitp[cc][dd]) hitp[cc][dd]++;
-
- if (i==OTRAPARROW) /* arrow hits monster */
- { who = "An arrow"; if ((hitp[cc][dd] -= rnd(10)+level) <= 0)
- { mitem[cc][dd]=0; flag=2; } else flag=1; }
- if (i==ODARTRAP) /* dart hits monster */
- { who = "A dart"; if ((hitp[cc][dd] -= rnd(6)) <= 0)
- { mitem[cc][dd]=0; flag=2; } else flag=1; }
- if (i==OTELEPORTER) /* monster hits teleport trap */
- { flag=3; fillmonst(mitem[cc][dd]); mitem[cc][dd]=0; }
- if (c[BLINDCOUNT]) return; /* if blind don't show where monsters are */
- if (know[cc][dd] & 1)
- {
- p=0;
- if (flag) cursors();
- switch(flag)
- {
- case 1: p="\n%s hits the %s"; break;
- case 2: p="\n%s hits and kills the %s"; break;
- case 3: p="\nThe %s%s gets teleported"; who=""; break;
- };
- if (p) { lprintf(p,who,monster[tmp].name); beep(); }
- }
-/* if (yrepcount>1) { know[aa][bb] &= 2; know[cc][dd] &= 2; return; } */
- if (know[aa][bb] & 1) show1cell(aa,bb);
- if (know[cc][dd] & 1) show1cell(cc,dd);
- }
-
-/*
- * movsphere() Function to look for and move spheres of annihilation
- *
- * This function works on the sphere linked list, first duplicating the list
- * (the act of moving changes the list), then processing each sphere in order
- * to move it. They eat anything in their way, including stairs, volcanic
- * shafts, potions, etc, except for upper level demons, who can dispel
- * spheres.
- * No value is returned.
- */
-#define SPHMAX 20 /* maximum number of spheres movsphere can handle */
-movsphere()
- {
- int x,y,dir,len;
- struct sphere *sp,*sp2;
- struct sphere sph[SPHMAX];
-
- /* first duplicate sphere list */
- for (sp=0,x=0,sp2=spheres; sp2; sp2=sp2->p) /* look through sphere list */
- if (sp2->lev == level) /* only if this level */
- {
- sph[x] = *sp2; sph[x++].p = 0; /* copy the struct */
- if (x>1) sph[x-2].p = &sph[x-1]; /* link pointers */
- }
- if (x) sp= sph; /* if any spheres, point to them */
- else return; /* no spheres */
-
- for (sp=sph; sp; sp=sp->p) /* look through sphere list */
- {
- x = sp->x; y = sp->y;
- if (item[x][y]!=OANNIHILATION) continue; /* not really there */
- if (--(sp->lifetime) < 0) /* has sphere run out of gas? */
- {
- rmsphere(x,y); /* delete sphere */
- continue;
- }
- switch(rnd((int)max(7,c[INTELLIGENCE]>>1))) /* time to move the sphere */
- {
- case 1:
- case 2: /* change direction to a random one */
- sp->dir = rnd(8);
- default: /* move in normal direction */
- dir = sp->dir; len = sp->lifetime;
- rmsphere(x,y);
- newsphere(x+diroffx[dir],y+diroffy[dir],dir,len);
- };
- }
- }
diff --git a/games/larn/nap.c b/games/larn/nap.c
deleted file mode 100644
index f297604..0000000
--- a/games/larn/nap.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* nap.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include <signal.h>
-#include <sys/types.h>
-#ifdef SYSV
-#include <sys/times.h>
-#else
-#ifdef BSD
-#include <sys/timeb.h>
-#endif /* BSD */
-#endif /* SYSV */
-
-/*
- * routine to take a nap for n milliseconds
- */
-nap(x)
- int x;
- {
- if (x<=0) return; /* eliminate chance for infinite loop */
- lflush();
-#if 0
- if (x > 999) sleep(x/1000); else napms(x);
-#else
- usleep(x*1000);
-#endif
- }
-
-#ifdef NONAP
-napms(x) /* do nothing */
- int x;
- {
- }
-#else /* NONAP */
-#ifdef SYSV
-/* napms - sleep for time milliseconds - uses times() */
-/* this assumes that times returns a relative time in 60ths of a second */
-/* this will do horrible things if your times() returns seconds! */
-napms(time)
- int time;
- {
- long matchclock, times();
- struct tms stats;
-
- if (time<=0) time=1; /* eliminate chance for infinite loop */
- if ((matchclock = times(&stats)) == -1 || matchclock == 0)
- return; /* error, or BSD style times() */
- matchclock += (time / 17); /*17 ms/tic is 1000 ms/sec / 60 tics/sec */
-
- while(matchclock < times(&stats))
- ;
- }
-
-#else not SYSV
-#ifdef BSD
-#ifdef SIGVTALRM
-/* This must be BSD 4.2! */
-#include <sys/time.h>
-#define bit(_a) (1<<((_a)-1))
-
-static nullf()
- {
- }
-
-/* napms - sleep for time milliseconds - uses setitimer() */
-napms(time)
- int time;
- {
- struct itimerval timeout;
- int (*oldhandler) ();
- int oldsig;
-
- if (time <= 0) return;
-
- timerclear(&timeout.it_interval);
- timeout.it_value.tv_sec = time / 1000;
- timeout.it_value.tv_usec = (time % 1000) * 1000;
-
- oldsig = sigblock(bit(SIGALRM));
- setitimer(ITIMER_REAL, &timeout, (struct itimerval *)0);
- oldhandler = signal(SIGALRM, nullf);
- sigpause(oldsig);
- signal(SIGALRM, oldhandler);
- sigsetmask(oldsig);
- }
-
-#else
-/* napms - sleep for time milliseconds - uses ftime() */
-
-static napms(time)
- int time;
- {
- /* assumed to be BSD UNIX */
- struct timeb _gtime;
- time_t matchtime;
- unsigned short matchmilli;
- struct timeb *tp = & _gtime;
-
- if (time <= 0) return;
- ftime(tp);
- matchmilli = tp->millitm + time;
- matchtime = tp->time;
- while (matchmilli >= 1000)
- {
- ++matchtime;
- matchmilli -= 1000;
- }
-
- while(1)
- {
- ftime(tp);
- if ((tp->time > matchtime) ||
- ((tp->time == matchtime) && (tp->millitm >= matchmilli)))
- break;
- }
- }
-#endif
-#else /* not BSD */
-static napms(time) int time; {} /* do nothing, forget it */
-#endif /* BSD */
-#endif /* SYSV */
-#endif /* NONAP */
diff --git a/games/larn/object.c b/games/larn/object.c
deleted file mode 100644
index 76b16ae..0000000
--- a/games/larn/object.c
+++ /dev/null
@@ -1,808 +0,0 @@
-/* object.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-
-/*
- ***************
- LOOK_FOR_OBJECT
- ***************
-
- subroutine to look for an object and give the player his options
- if an object was found.
- */
-lookforobject()
-{
-int i,j;
-if (c[TIMESTOP]) return; /* can't find objects is time is stopped */
-i=item[playerx][playery]; if (i==0) return;
-showcell(playerx,playery); cursors(); yrepcount=0;
-switch(i)
- {
- case OGOLDPILE: case OMAXGOLD:
- case OKGOLD: case ODGOLD: lprcat("\n\nYou have found some gold!"); ogold(i); break;
-
- case OPOTION: lprcat("\n\nYou have found a magic potion");
- i = iarg[playerx][playery];
- if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]); opotion(i); break;
-
- case OSCROLL: lprcat("\n\nYou have found a magic scroll");
- i = iarg[playerx][playery];
- if (scrollname[i][0]) lprintf(" of %s",&scrollname[i][1]);
- oscroll(i); break;
-
- case OALTAR: if (nearbymonst()) return;
- lprcat("\n\nThere is a Holy Altar here!"); oaltar(); break;
-
- case OBOOK: lprcat("\n\nYou have found a book."); obook(); break;
-
- case OCOOKIE: lprcat("\n\nYou have found a fortune cookie."); ocookie(); break;
-
- case OTHRONE: if (nearbymonst()) return;
- lprintf("\n\nThere is %s here!",objectname[i]); othrone(0); break;
-
- case OTHRONE2: if (nearbymonst()) return;
- lprintf("\n\nThere is %s here!",objectname[i]); othrone(1); break;
-
- case ODEADTHRONE: lprintf("\n\nThere is %s here!",objectname[i]); odeadthrone(); break;
-
- case OORB: lprcat("\n\nYou have found the Orb!!!!!"); oorb(); break;
-
- case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break;
-
- case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here"); ostairs(1); /* up */ break;
-
- case OELEVATORUP: lprcat("\n\nYou feel heavy for a moment, but the feeling disappears");
- oelevator(1); /* up */ break;
-
- case OFOUNTAIN: if (nearbymonst()) return;
- lprcat("\n\nThere is a fountain here"); ofountain(); break;
-
- case OSTATUE: if (nearbymonst()) return;
- lprcat("\n\nYou are standing in front of a statue"); ostatue(); break;
-
- case OCHEST: lprcat("\n\nThere is a chest here"); ochest(); break;
-
- case OIVTELETRAP: if (rnd(11)<6) return;
- item[playerx][playery] = OTELEPORTER;
- know[playerx][playery] = 1;
-
- case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n");
- beep(); nap(3000); oteleport(0);
- break;
-
- case OSCHOOL: if (nearbymonst()) return;
- lprcat("\n\nYou have found the College of Larn.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g') { oschool(); /* the college of larn */ }
- else lprcat(" stay here");
- break;
-
- case OMIRROR: if (nearbymonst()) return;
- lprcat("\n\nThere is a mirror here"); omirror(); break;
-
- case OBANK2:
- case OBANK: if (nearbymonst()) return;
- if (i==OBANK) lprcat("\n\nYou have found the bank of Larn.");
- else lprcat("\n\nYou have found a branch office of the bank of Larn.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- j=0; while ((j!='g') && (j!='i') && (j!='\33')) j=getchar();
- if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ }
- else lprcat(" stay here");
- break;
-
- case ODEADFOUNTAIN: if (nearbymonst()) return;
- lprcat("\n\nThere is a dead fountain here"); break;
-
- case ODNDSTORE: if (nearbymonst()) return;
- lprcat("\n\nThere is a DND store here.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g')
- dndstore(); /* the dnd adventurers store */
- else lprcat(" stay here");
- break;
-
- case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here"); ostairs(-1); /* down */ break;
-
- case OELEVATORDOWN: lprcat("\n\nYou feel light for a moment, but the feeling disappears");
- oelevator(-1); /* down */
- break;
-
- case OOPENDOOR: lprintf("\n\nYou have found %s",objectname[i]);
- lprcat("\nDo you (c) close it"); iopts();
- i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
- if ((i=='\33') || (i=='i')) { ignore(); break; }
- lprcat("close"); forget();
- item[playerx][playery]=OCLOSEDDOOR;
- iarg[playerx][playery]=0;
- playerx = lastpx; playery = lastpy;
- break;
-
- case OCLOSEDDOOR: lprintf("\n\nYou have found %s",objectname[i]);
- lprcat("\nDo you (o) try to open it"); iopts();
- i=0; while ((i!='o') && (i!='i') && (i!='\33')) i=getchar();
- if ((i=='\33') || (i=='i'))
- { ignore(); playerx = lastpx;
- playery = lastpy; break; }
- else
- {
- lprcat("open");
- if (rnd(11)<7)
- {
- switch(iarg[playerx][playery])
- {
- case 6: c[AGGRAVATE] += rnd(400); break;
-
- case 7: lprcat("\nYou are jolted by an electric shock ");
- lastnum=274; losehp(rnd(20)); bottomline(); break;
-
- case 8: loselevel(); break;
-
- case 9: lprcat("\nYou suddenly feel weaker ");
- if (c[STRENGTH]>3) c[STRENGTH]--;
- bottomline(); break;
-
- default: break;
- }
- playerx = lastpx; playery = lastpy;
- }
- else
- {
- forget(); item[playerx][playery]=OOPENDOOR;
- }
- }
- break;
-
- case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]);
- lprcat("\nDo you (g) go inside"); iopts();
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g')
- {
- newcavelevel(1); playerx=33; playery=MAXY-2;
- item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0;
- draws(0,MAXX,0,MAXY); bot_linex(); return;
- }
- else ignore();
- break;
-
- case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]);
- lprcat("\nDo you (c) climb down"); iopts();
- i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
- if ((i=='\33') || (i=='i')) { ignore(); break; }
- if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; }
- if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
- lastnum=275; losehp(30+rnd(20)); bottomhp(); }
-
- else lprcat("climb down"); nap(3000); newcavelevel(MAXLEVEL);
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */
- if (item[j][i]==OVOLUP) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
- draws(0,MAXX,0,MAXY); bot_linex(); return;
-
- case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]);
- lprcat("\nDo you (c) climb up"); iopts();
- i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
- if ((i=='\33') || (i=='i')) { ignore(); break; }
- if (level!=11) { lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); return; }
- if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
- lastnum=275; losehp(15+rnd(20)); bottomhp(); return; }
- lprcat("climb up"); lflush(); nap(3000); newcavelevel(0);
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */
- if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
- draws(0,MAXX,0,MAXY); bot_linex(); return;
-
- case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */
- item[playerx][playery] = OTRAPARROW;
- know[playerx][playery] = 0;
-
- case OTRAPARROW: lprcat("\nYou are hit by an arrow"); beep(); /* for an arrow trap */
- lastnum=259; losehp(rnd(10)+level);
- bottomhp(); return;
-
- case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */
- item[playerx][playery] = ODARTRAP;
- know[playerx][playery] = 0;
-
- case ODARTRAP: lprcat("\nYou are hit by a dart"); beep(); /* for a dart trap */
- lastnum=260; losehp(rnd(5));
- if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3;
- bottomline(); return;
-
- case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */
- item[playerx][playery] = OTRAPDOOR;
- know[playerx][playery] = 1;
-
- case OTRAPDOOR: lastnum = 272; /* a trap door */
- if ((level==MAXLEVEL-1) || (level==MAXLEVEL+MAXVLEVEL-1))
- { lprcat("\nYou fell through a bottomless trap door!"); beep(); nap(3000); died(271); }
- lprcat("\nYou fall through a trap door!"); beep(); /* for a trap door */
- losehp(rnd(5+level));
- nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex();
- return;
-
-
- case OTRADEPOST: if (nearbymonst()) return;
- lprcat("\nYou have found the Larn trading Post.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g') otradepost(); else lprcat("stay here");
- return;
-
- case OHOME: if (nearbymonst()) return;
- lprcat("\nYou have found your way home.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g') ohome(); else lprcat("stay here");
- return;
-
- case OWALL: break;
-
- case OANNIHILATION: died(283); return; /* annihilated by sphere of annihilation */
-
- case OLRS: if (nearbymonst()) return;
- lprcat("\n\nThere is an LRS office here.");
- lprcat("\nDo you (g) go inside, or (i) stay here? ");
- i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
- if (i == 'g')
- olrs(); /* the larn revenue service */
- else lprcat(" stay here");
- break;
-
- default: finditem(i); break;
- };
-}
-
-/*
- function to say what object we found and ask if player wants to take it
- */
-finditem(itm)
- int itm;
- {
- int tmp,i;
- lprintf("\n\nYou have found %s ",objectname[itm]);
- tmp=iarg[playerx][playery];
- switch(itm)
- {
- case ODIAMOND: case ORUBY: case OEMERALD:
- case OSAPPHIRE: case OSPIRITSCARAB: case OORBOFDRAGON:
- case OCUBEofUNDEAD: case ONOTHEFT: break;
-
- default:
- if (tmp>0) lprintf("+ %d",(long)tmp); else if (tmp<0) lprintf(" %d",(long)tmp);
- }
- lprcat("\nDo you want to (t) take it"); iopts();
- i=0; while (i!='t' && i!='i' && i!='\33') i=getchar();
- if (i == 't')
- { lprcat("take"); if (take(itm,tmp)==0) forget(); return; }
- ignore();
- }
-
-
-/*
- *******
- OSTAIRS
- *******
-
- subroutine to process the stair cases
- if dir > 0 the up else down
- */
-ostairs(dir)
- int dir;
- {
- int k;
- lprcat("\nDo you (s) stay here ");
- if (dir > 0) lprcat("(u) go up "); else lprcat("(d) go down ");
- lprcat("or (f) kick stairs? ");
-
- while (1) switch(getchar())
- {
- case '\33':
- case 's': case 'i': lprcat("stay here"); return;
-
- case 'f': lprcat("kick stairs");
- if (rnd(2) == 1)
- lprcat("\nI hope you feel better. Showing anger rids you of frustration.");
- else
- {
- k=rnd((level+1)<<1);
- lprintf("\nYou hurt your foot dumb dumb! You suffer %d hit points",(long)k);
- lastnum=276; losehp(k); bottomline();
- }
- return;
-
- case 'u': lprcat("go up");
- if (dir < 0) lprcat("\nThe stairs don't go up!");
- else
- if (level>=2 && level!=11)
- {
- k = level; newcavelevel(level-1);
- draws(0,MAXX,0,MAXY); bot_linex();
- }
- else lprcat("\nThe stairs lead to a dead end!");
- return;
-
- case 'd': lprcat("go down");
- if (dir > 0) lprcat("\nThe stairs don't go down!");
- else
- if (level!=0 && level!=10 && level!=13)
- {
- k = level; newcavelevel(level+1);
- draws(0,MAXX,0,MAXY); bot_linex();
- }
- else lprcat("\nThe stairs lead to a dead end!");
- return;
- };
- }
-
-
-/*
- *********
- OTELEPORTER
- *********
-
- subroutine to handle a teleport trap +/- 1 level maximum
- */
-oteleport(err)
- int err;
- {
- int tmp;
- if (err) if (rnd(151)<3) died(264); /* stuck in a rock */
- c[TELEFLAG]=1; /* show ?? on bottomline if been teleported */
- if (level==0) tmp=0;
- else if (level < MAXLEVEL)
- { tmp=rnd(5)+level-3; if (tmp>=MAXLEVEL) tmp=MAXLEVEL-1;
- if (tmp<1) tmp=1; }
- else
- { tmp=rnd(3)+level-2; if (tmp>=MAXLEVEL+MAXVLEVEL) tmp=MAXLEVEL+MAXVLEVEL-1;
- if (tmp<MAXLEVEL) tmp=MAXLEVEL; }
- playerx = rnd(MAXX-2); playery = rnd(MAXY-2);
- if (level != tmp) newcavelevel(tmp); positionplayer();
- draws(0,MAXX,0,MAXY); bot_linex();
- }
-
-/*
- *******
- OPOTION
- *******
-
- function to process a potion
- */
-opotion(pot)
- int pot;
- {
- lprcat("\nDo you (d) drink it, (t) take it"); iopts();
- while (1) switch(getchar())
- {
- case '\33':
- case 'i': ignore(); return;
-
- case 'd': lprcat("drink\n"); forget(); /* destroy potion */
- quaffpotion(pot); return;
-
- case 't': lprcat("take\n"); if (take(OPOTION,pot)==0) forget();
- return;
- };
- }
-
-/*
- function to drink a potion
- */
-quaffpotion(pot)
- int pot;
- {
- int i,j,k;
- if (pot<0 || pot>=MAXPOTION) return; /* check for within bounds */
- potionname[pot][0] = ' ';
- switch(pot)
- {
- case 9: lprcat("\nYou feel greedy . . ."); nap(2000);
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
- if ((item[j][i]==OGOLDPILE) || (item[j][i]==OMAXGOLD))
- {
- know[j][i]=1; show1cell(j,i);
- }
- showplayer(); return;
-
- case 19: lprcat("\nYou feel greedy . . ."); nap(2000);
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
- {
- k=item[j][i];
- if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) || (k==OMAXGOLD)
- || (k==OSAPPHIRE) || (k==OLARNEYE) || (k==OGOLDPILE))
- {
- know[j][i]=1; show1cell(j,i);
- }
- }
- showplayer(); return;
-
- case 20: c[HP] = c[HPMAX]; break; /* instant healing */
-
- case 1: lprcat("\nYou feel better");
- if (c[HP] == c[HPMAX]) raisemhp(1);
- else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX]) c[HP]=c[HPMAX]; break;
-
- case 2: lprcat("\nSuddenly, you feel much more skillful!");
- raiselevel(); raisemhp(1); return;
-
- case 3: lprcat("\nYou feel strange for a moment");
- c[rund(6)]++; break;
-
- case 4: lprcat("\nYou feel more self confident!");
- c[WISDOM] += rnd(2); break;
-
- case 5: lprcat("\nWow! You feel great!");
- if (c[STRENGTH]<12) c[STRENGTH]=12; else c[STRENGTH]++; break;
-
- case 6: lprcat("\nYour charm went up by one!"); c[CHARISMA]++; break;
-
- case 8: lprcat("\nYour intelligence went up by one!");
- c[INTELLIGENCE]++; break;
-
- case 10: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
- if (mitem[j][i])
- {
- know[j][i]=1; show1cell(j,i);
- }
- /* monster detection */ return;
-
- case 12: lprcat("\nThis potion has no taste to it"); return;
-
- case 15: lprcat("\nWOW!!! You feel Super-fantastic!!!");
- if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11;
- c[HERO] += 250; break;
-
- case 16: lprcat("\nYou have a greater intestinal constitude!");
- c[CONSTITUTION]++; break;
-
- case 17: lprcat("\nYou now have incredibly bulging muscles!!!");
- if (c[GIANTSTR]==0) c[STREXTRA] += 21;
- c[GIANTSTR] += 700; break;
-
- case 18: lprcat("\nYou feel a chill run up your spine!");
- c[FIRERESISTANCE] += 1000; break;
-
- case 0: lprcat("\nYou fall asleep. . .");
- i=rnd(11)-(c[CONSTITUTION]>>2)+2; while(--i>0) { parse2(); nap(1000); }
- cursors(); lprcat("\nYou woke up!"); return;
-
- case 7: lprcat("\nYou become dizzy!");
- if (--c[STRENGTH] < 3) c[STRENGTH]=3; break;
-
- case 11: lprcat("\nYou stagger for a moment . .");
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
- know[j][i]=0;
- nap(2000); draws(0,MAXX,0,MAXY); /* potion of forgetfulness */ return;
-
- case 13: lprcat("\nYou can't see anything!"); /* blindness */
- c[BLINDCOUNT]+=500; return;
-
- case 14: lprcat("\nYou feel confused"); c[CONFUSE]+= 20+rnd(9); return;
-
- case 21: lprcat("\nYou don't seem to be affected"); return; /* cure dianthroritis */
-
- case 22: lprcat("\nYou feel a sickness engulf you"); /* poison */
- c[HALFDAM] += 200 + rnd(200); return;
-
- case 23: lprcat("\nYou feel your vision sharpen"); /* see invisible */
- c[SEEINVISIBLE] += rnd(1000)+400;
- monstnamelist[INVISIBLESTALKER] = 'I'; return;
- };
- bottomline(); /* show new stats */ return;
- }
-
-/*
- *******
- OSCROLL
- *******
-
- function to process a magic scroll
- */
-oscroll(typ)
- int typ;
- {
- lprcat("\nDo you ");
- if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
- while (1) switch(getchar())
- {
- case '\33':
- case 'i': ignore(); return;
-
- case 'r': if (c[BLINDCOUNT]) break;
- lprcat("read"); forget();
- if (typ==2 || typ==15) { show1cell(playerx,playery); cursors(); }
- /* destroy it */ read_scroll(typ); return;
-
- case 't': lprcat("take"); if (take(OSCROLL,typ)==0) forget(); /* destroy it */
- return;
- };
- }
-
-/*
- data for the function to read a scroll
- */
-static int xh,yh,yl,xl;
-static char curse[] = { BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING,
- LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };
-static char exten[] = { PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT,
- INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };
-char time_change[] = { HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT,
- STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION,
- HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST,
- FIRERESISTANCE,GLOBE,SPIRITPRO,UNDEADPRO,HALFDAM,SEEINVISIBLE,
- ITCHING,CLUMSINESS, WTW };
-/*
- * function to adjust time when time warping and taking courses in school
- */
-adjtime(tim)
- long tim;
- {
- int j;
- for (j=0; j<26; j++) /* adjust time related parameters */
- if (c[time_change[j]])
- if ((c[time_change[j]] -= tim) < 1) c[time_change[j]]=1;
- regen();
- }
-
-/*
- function to read a scroll
- */
-read_scroll(typ)
- int typ;
- {
- int i,j;
- if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */
- scrollname[typ][0] = ' ';
- switch(typ)
- {
- case 0: lprcat("\nYour armor glows for a moment"); enchantarmor(); return;
-
- case 1: lprcat("\nYour weapon glows for a moment"); enchweapon(); return; /* enchant weapon */
-
- case 2: lprcat("\nYou have been granted enlightenment!");
- yh = min(playery+7,MAXY); xh = min(playerx+25,MAXX);
- yl = max(playery-7,0); xl = max(playerx-25,0);
- for (i=yl; i<yh; i++) for (j=xl; j<xh; j++) know[j][i]=1;
- nap(2000); draws(xl,xh,yl,yh); return;
-
- case 3: lprcat("\nThis scroll seems to be blank"); return;
-
- case 4: createmonster(makemonst(level+1)); return; /* this one creates a monster */
-
- case 5: something(level); /* create artifact */ return;
-
- case 6: c[AGGRAVATE]+=800; return; /* aggravate monsters */
-
- case 7: gtime += (i = rnd(1000) - 850); /* time warp */
- if (i>=0) lprintf("\nYou went forward in time by %d mobuls",(long)((i+99)/100));
- else lprintf("\nYou went backward in time by %d mobuls",(long)(-(i+99)/100));
- adjtime((long)i); /* adjust time for time warping */
- return;
-
- case 8: oteleport(0); return; /* teleportation */
-
- case 9: c[AWARENESS] += 1800; return; /* expanded awareness */
-
- case 10: c[HASTEMONST] += rnd(55)+12; return; /* haste monster */
-
- case 11: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
- if (mitem[j][i])
- hitp[j][i] = monster[mitem[j][i]].hitpoints;
- return; /* monster healing */
- case 12: c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; /* spirit protection */
-
- case 13: c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; /* undead protection */
-
- case 14: c[STEALTH] += 250 + rnd(250); bottomline(); return; /* stealth */
-
- case 15: lprcat("\nYou have been granted enlightenment!"); /* magic mapping */
- for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=1;
- nap(2000); draws(0,MAXX,0,MAXY); return;
-
- case 16: c[HOLDMONST] += 30; bottomline(); return; /* hold monster */
-
- case 17: for (i=0; i<26; i++) /* gem perfection */
- switch(iven[i])
- {
- case ODIAMOND: case ORUBY:
- case OEMERALD: case OSAPPHIRE:
- j = ivenarg[i]; j &= 255; j <<= 1;
- if (j > 255) j=255; /* double value */
- ivenarg[i] = j; break;
- }
- break;
-
- case 18: for (i=0; i<11; i++) c[exten[i]] <<= 1; /* spell extension */
- break;
-
- case 19: for (i=0; i<26; i++) /* identify */
- {
- if (iven[i]==OPOTION) potionname[ivenarg[i]][0] = ' ';
- if (iven[i]==OSCROLL) scrollname[ivenarg[i]][0] = ' ';
- }
- break;
-
- case 20: for (i=0; i<10; i++) /* remove curse */
- if (c[curse[i]]) c[curse[i]] = 1;
- break;
-
- case 21: annihilate(); break; /* scroll of annihilation */
-
- case 22: godirect(22,150,"The ray hits the %s",0,' '); /* pulverization */
- break;
- case 23: c[LIFEPROT]++; break; /* life protection */
- };
- }
-
-
-oorb()
- {
- }
-
-opit()
- {
- int i;
- if (rnd(101)<81)
- if (rnd(70) > 9*c[DEXTERITY]-packweight() || rnd(101)<5)
- if (level==MAXLEVEL-1) obottomless(); else
- if (level==MAXLEVEL+MAXVLEVEL-1) obottomless(); else
- {
- if (rnd(101)<20)
- {
- i=0; lprcat("\nYou fell into a pit! Your fall is cushioned by an unknown force\n");
- }
- else
- {
- i = rnd(level*3+3);
- lprintf("\nYou fell into a pit! You suffer %d hit points damage",(long)i);
- lastnum=261; /* if he dies scoreboard will say so */
- }
- losehp(i); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY);
- }
- }
-
-obottomless()
- {
- lprcat("\nYou fell into a bottomless pit!"); beep(); nap(3000); died(262);
- }
-oelevator(dir)
- int dir;
- {
-#ifdef lint
- int x;
- x=dir;
- dir=x;
-#endif /* lint */
- }
-
-ostatue()
- {
- }
-
-omirror()
- {
- }
-
-obook()
- {
- lprcat("\nDo you ");
- if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
- while (1) switch(getchar())
- {
- case '\33':
- case 'i': ignore(); return;
-
- case 'r': if (c[BLINDCOUNT]) break;
- lprcat("read");
- /* no more book */ readbook(iarg[playerx][playery]); forget(); return;
-
- case 't': lprcat("take"); if (take(OBOOK,iarg[playerx][playery])==0) forget(); /* no more book */
- return;
- };
- }
-
-/*
- function to read a book
- */
-readbook(lev)
- int lev;
- {
- int i,tmp;
- if (lev<=3) i = rund((tmp=splev[lev])?tmp:1); else
- i = rnd((tmp=splev[lev]-9)?tmp:1) + 9;
- spelknow[i]=1;
- lprintf("\nSpell \"%s\": %s\n%s",spelcode[i],spelname[i],speldescript[i]);
- if (rnd(10)==4)
- { lprcat("\nYour int went up by one!"); c[INTELLIGENCE]++; bottomline(); }
- }
-
-ocookie()
- {
- char *p;
- lprcat("\nDo you (e) eat it, (t) take it"); iopts();
- while (1) switch(getchar())
- {
- case '\33':
- case 'i': ignore(); return;
-
- case 'e': lprcat("eat\nThe cookie tasted good.");
- forget(); /* no more cookie */
- if (c[BLINDCOUNT]) return;
- if (!(p=fortune(fortfile))) return;
- lprcat(" A message inside the cookie reads:\n"); lprcat(p);
- return;
-
- case 't': lprcat("take"); if (take(OCOOKIE,0)==0) forget(); /* no more book */
- return;
- };
- }
-
-
-/* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
-ogold(arg)
- int arg;
- {
- long i;
- i = iarg[playerx][playery];
- if (arg==OMAXGOLD) i *= 100;
- else if (arg==OKGOLD) i *= 1000;
- else if (arg==ODGOLD) i *= 10;
- lprintf("\nIt is worth %d!",(long)i); c[GOLD] += i; bottomgold();
- item[playerx][playery] = know[playerx][playery] = 0; /* destroy gold */
- }
-
-ohome()
- {
- int i;
- nosignal = 1; /* disable signals */
- for (i=0; i<26; i++) if (iven[i]==OPOTION) if (ivenarg[i]==21)
- {
- iven[i]=0; /* remove the potion of cure dianthroritis from inventory */
- clear(); lprcat("Congratulations. You found a potion of cure dianthroritis.\n");
- lprcat("\nFrankly, No one thought you could do it. Boy! Did you surprise them!\n");
- if (gtime>TIMELIMIT)
- {
- lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
- lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n");
- nap(5000); died(269);
- }
- else
- {
- lprcat("\nThe doctor is now administering the potion, and in a few moments\n");
- lprcat("Your daughter should be well on her way to recovery.\n");
- nap(6000);
- lprcat("\nThe potion is"); nap(3000); lprcat(" working! The doctor thinks that\n");
- lprcat("your daughter will recover in a few days. Congratulations!\n");
- beep(); nap(5000); died(263);
- }
- }
-
- while (1)
- {
- clear(); lprintf("Welcome home %s. Latest word from the doctor is not good.\n",logname);
-
- if (gtime>TIMELIMIT)
- {
- lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
- lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n");
- nap(5000); died(269);
- }
-
- lprcat("\nThe diagnosis is confirmed as dianthroritis. He guesses that\n");
- lprintf("your daughter has only %d mobuls left in this world. It's up to you,\n",(long)((TIMELIMIT-gtime+99)/100));
- lprintf("%s, to find the only hope for your daughter, the very rare\n",logname);
- lprcat("potion of cure dianthroritis. It is rumored that only deep in the\n");
- lprcat("depths of the caves can this potion be found.\n\n\n");
- lprcat("\n ----- press "); standout("return");
- lprcat(" to continue, "); standout("escape");
- lprcat(" to leave ----- ");
- i=getchar(); while (i!='\33' && i!='\n') i=getchar();
- if (i=='\33') { drawscreen(); nosignal = 0; /* enable signals */ return; }
- }
- }
-
-/* routine to save program space */
-iopts()
- { lprcat(", or (i) ignore it? "); }
-ignore()
- { lprcat("ignore\n"); }
-
diff --git a/games/larn/pathnames.h b/games/larn/pathnames.h
deleted file mode 100644
index 1871fd7..0000000
--- a/games/larn/pathnames.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 5.2 (Berkeley) 5/27/95
- */
-
-#define _PATH_LOG "/var/games/larn/llog12.0"
-#define _PATH_SCORE "/var/games/larn/lscore12.0"
-#define _PATH_HELP "/usr/share/games/larn/larn.help"
-#define _PATH_LEVELS "/usr/share/games/larn/larnmaze"
-#define _PATH_FORTS "/usr/share/games/larn/lfortune"
-#define _PATH_PLAYERIDS "/var/games/larn/playerids"
diff --git a/games/larn/regen.c b/games/larn/regen.c
deleted file mode 100644
index 40b84f6..0000000
--- a/games/larn/regen.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* regen.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-/*
- *******
- REGEN()
- *******
- regen()
-
- subroutine to regenerate player hp and spells
- */
-regen()
- {
- int i,flag;
- long *d;
- d = c;
-#ifdef EXTRA
- d[MOVESMADE]++;
-#endif
- if (d[TIMESTOP]) { if(--d[TIMESTOP]<=0) bottomline(); return; } /* for stop time spell */
- flag=0;
-
- if (d[STRENGTH]<3) { d[STRENGTH]=3; flag=1; }
- if ((d[HASTESELF]==0) || ((d[HASTESELF] & 1) == 0))
- gtime++;
-
- if (d[HP] != d[HPMAX])
- if (d[REGENCOUNTER]-- <= 0) /* regenerate hit points */
- {
- d[REGENCOUNTER] = 22 + (d[HARDGAME]<<1) - d[LEVEL];
- if ((d[HP] += d[REGEN]) > d[HPMAX]) d[HP] = d[HPMAX];
- bottomhp();
- }
-
- if (d[SPELLS] < d[SPELLMAX]) /* regenerate spells */
- if (d[ECOUNTER]-- <= 0)
- {
- d[ECOUNTER] = 100+4*(d[HARDGAME]-d[LEVEL]-d[ENERGY]);
- d[SPELLS]++; bottomspell();
- }
-
- if (d[HERO]) if (--d[HERO]<=0) { for (i=0; i<6; i++) d[i] -= 10; flag=1; }
- if (d[ALTPRO]) if (--d[ALTPRO]<=0) { d[MOREDEFENSES]-=3; flag=1; }
- if (d[PROTECTIONTIME]) if (--d[PROTECTIONTIME]<=0) { d[MOREDEFENSES]-=2; flag=1; }
- if (d[DEXCOUNT]) if (--d[DEXCOUNT]<=0) { d[DEXTERITY]-=3; flag=1; }
- if (d[STRCOUNT]) if (--d[STRCOUNT]<=0) { d[STREXTRA]-=3; flag=1; }
- if (d[BLINDCOUNT]) if (--d[BLINDCOUNT]<=0) { cursors(); lprcat("\nThe blindness lifts "); beep(); }
- if (d[CONFUSE]) if (--d[CONFUSE]<=0) { cursors(); lprcat("\nYou regain your senses"); beep(); }
- if (d[GIANTSTR]) if (--d[GIANTSTR]<=0) { d[STREXTRA] -= 20; flag=1; }
- if (d[CHARMCOUNT]) if ((--d[CHARMCOUNT]) <= 0) flag=1;
- if (d[INVISIBILITY]) if ((--d[INVISIBILITY]) <= 0) flag=1;
- if (d[CANCELLATION]) if ((--d[CANCELLATION]) <= 0) flag=1;
- if (d[WTW]) if ((--d[WTW]) <= 0) flag=1;
- if (d[HASTESELF]) if ((--d[HASTESELF]) <= 0) flag=1;
- if (d[AGGRAVATE]) --d[AGGRAVATE];
- if (d[SCAREMONST]) if ((--d[SCAREMONST]) <= 0) flag=1;
- if (d[STEALTH]) if ((--d[STEALTH]) <= 0) flag=1;
- if (d[AWARENESS]) --d[AWARENESS];
- if (d[HOLDMONST]) if ((--d[HOLDMONST]) <= 0) flag=1;
- if (d[HASTEMONST]) --d[HASTEMONST];
- if (d[FIRERESISTANCE]) if ((--d[FIRERESISTANCE]) <= 0) flag=1;
- if (d[GLOBE]) if (--d[GLOBE]<=0) { d[MOREDEFENSES]-=10; flag=1; }
- if (d[SPIRITPRO]) if (--d[SPIRITPRO] <= 0) flag=1;
- if (d[UNDEADPRO]) if (--d[UNDEADPRO] <= 0) flag=1;
- if (d[HALFDAM]) if (--d[HALFDAM]<=0) { cursors(); lprcat("\nYou now feel better "); beep(); }
- if (d[SEEINVISIBLE])
- if (--d[SEEINVISIBLE]<=0)
- { monstnamelist[INVISIBLESTALKER] = ' ';
- cursors(); lprcat("\nYou feel your vision return to normal"); beep(); }
- if (d[ITCHING])
- {
- if (d[ITCHING]>1)
- if ((d[WEAR]!= -1) || (d[SHIELD]!= -1))
- if (rnd(100)<50)
- {
- d[WEAR]=d[SHIELD]= -1; cursors();
- lprcat("\nThe hysteria of itching forces you to remove your armor!");
- beep(); recalc(); bottomline();
- }
- if (--d[ITCHING]<=0) { cursors(); lprcat("\nYou now feel the irritation subside!"); beep(); }
- }
- if (d[CLUMSINESS])
- {
- if (d[WIELD] != -1)
- if (d[CLUMSINESS]>1)
- if (item[playerx][playery]==0) /* only if nothing there */
- if (rnd(100)<33) /* drop your weapon due to clumsiness */
- drop_object((int)d[WIELD]);
- if (--d[CLUMSINESS]<=0) { cursors(); lprcat("\nYou now feel less awkward!"); beep(); }
- }
- if (flag) bottomline();
- }
-
diff --git a/games/larn/savelev.c b/games/larn/savelev.c
deleted file mode 100644
index 1ef873f..0000000
--- a/games/larn/savelev.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include "header.h"
-extern struct cel *cell;
-
-/*
- * routine to save the present level into storage
- */
-savelevel()
- {
- struct cel *pcel;
- char *pitem,*pknow,*pmitem;
- short *phitp,*piarg;
- struct cel *pecel;
- pcel = &cell[level*MAXX*MAXY]; /* pointer to this level's cells */
- pecel = pcel + MAXX*MAXY; /* pointer to past end of this level's cells */
- pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
- while (pcel < pecel)
- {
- pcel->mitem = *pmitem++;
- pcel->hitp = *phitp++;
- pcel->item = *pitem++;
- pcel->know = *pknow++;
- pcel++->iarg = *piarg++;
- }
- }
-
-/*
- * routine to restore a level from storage
- */
-getlevel()
- {
- struct cel *pcel;
- char *pitem,*pknow,*pmitem;
- short *phitp,*piarg;
- struct cel *pecel;
- pcel = &cell[level*MAXX*MAXY]; /* pointer to this level's cells */
- pecel = pcel + MAXX*MAXY; /* pointer to past end of this level's cells */
- pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
- while (pcel < pecel)
- {
- *pmitem++ = pcel->mitem;
- *phitp++ = pcel->hitp;
- *pitem++ = pcel->item;
- *pknow++ = pcel->know;
- *piarg++ = pcel++->iarg;
- }
- }
diff --git a/games/larn/scores.c b/games/larn/scores.c
deleted file mode 100644
index 85a4932..0000000
--- a/games/larn/scores.c
+++ /dev/null
@@ -1,654 +0,0 @@
-/* scores.c Larn is copyrighted 1986 by Noah Morgan.
- * $FreeBSD$
- *
- * Functions in this file are:
- *
- * readboard() Function to read in the scoreboard into a static buffer
- * writeboard() Function to write the scoreboard from readboard()'s buffer
- * makeboard() Function to create a new scoreboard (wipe out old one)
- * hashewon() Function to return 1 if player has won a game before, else 0
- * long paytaxes(x) Function to pay taxes if any are due
- * winshou() Subroutine to print out the winning scoreboard
- * shou(x) Subroutine to print out the non-winners scoreboard
- * showscores() Function to show the scoreboard on the terminal
- * showallscores() Function to show scores and the iven lists that go with them
- * sortboard() Function to sort the scoreboard
- * newscore(score, whoo, whyded, winner) Function to add entry to scoreboard
- * new1sub(score,i,whoo,taxes) Subroutine to put player into a
- * new2sub(score,i,whoo,whyded) Subroutine to put player into a
- * died(x) Subroutine to record who played larn, and what the score was
- * diedsub(x) Subroutine to print out a line showing player when he is killed
- * diedlog() Subroutine to read a log file and print it out in ascii format
- * getplid(name) Function to get players id # from id file
- *
- */
-#include <sys/types.h>
-#include <sys/times.h>
-#include <sys/stat.h>
-#include "header.h"
-
-struct scofmt /* This is the structure for the scoreboard */
- {
- long score; /* the score of the player */
- long suid; /* the user id number of the player */
- short what; /* the number of the monster that killed player */
- short level; /* the level player was on when he died */
- short hardlev; /* the level of difficulty player played at */
- short order; /* the relative ordering place of this entry */
- char who[40]; /* the name of the character */
- char sciv[26][2]; /* this is the inventory list of the character */
- };
-struct wscofmt /* This is the structure for the winning scoreboard */
- {
- long score; /* the score of the player */
- long timeused; /* the time used in mobuls to win the game */
- long taxes; /* taxes he owes to LRS */
- long suid; /* the user id number of the player */
- short hardlev; /* the level of difficulty player played at */
- short order; /* the relative ordering place of this entry */
- char who[40]; /* the name of the character */
- };
-
-struct log_fmt /* 102 bytes struct for the log file */
- {
- long score; /* the players score */
- time_t diedtime; /* time when game was over */
- short cavelev; /* level in caves */
- short diff; /* difficulty player played at */
-#ifdef EXTRA
- long elapsedtime; /* real time of game in seconds */
- long bytout; /* bytes input and output */
- long bytin;
- long moves; /* number of moves made by player */
- short ac; /* armor class of player */
- short hp,hpmax; /* players hitpoints */
- short cputime; /* cpu time needed in seconds */
- short killed,spused;/* monsters killed and spells cast */
- short usage; /* usage of the cpu in % */
- short lev; /* player level */
-#endif
- char who[12]; /* player name */
- char what[46]; /* what happened to player */
- };
-
-static struct scofmt sco[SCORESIZE]; /* the structure for the scoreboard */
-static struct wscofmt winr[SCORESIZE]; /* struct for the winning scoreboard */
-static struct log_fmt logg; /* structure for the log file */
-static char *whydead[] = {
- "quit", "suspended", "self - annihilated", "shot by an arrow",
- "hit by a dart", "fell into a pit", "fell into a bottomless pit",
- "a winner", "trapped in solid rock", "killed by a missing save file",
- "killed by an old save file", "caught by the greedy cheater checker trap",
- "killed by a protected save file","killed his family and committed suicide",
- "erased by a wayward finger", "fell through a bottomless trap door",
- "fell through a trap door", "drank some poisonous water",
- "fried by an electric shock", "slipped on a volcano shaft",
- "killed by a stupid act of frustration", "attacked by a revolting demon",
- "hit by his own magic", "demolished by an unseen attacker",
- "fell into the dreadful sleep", "killed by an exploding chest",
-/*26*/ "killed by a missing maze data file", "annihilated in a sphere",
- "died a post mortem death","wasted by a malloc() failure"
- };
-
-/*
- * readboard() Function to read in the scoreboard into a static buffer
- *
- * returns -1 if unable to read in the scoreboard, returns 0 if all is OK
- */
-readboard()
- {
- if (lopen(scorefile)<0)
- { lprcat("Can't read scoreboard\n"); lflush(); return(-1); }
- lrfill((char*)sco,sizeof(sco)); lrfill((char*)winr,sizeof(winr));
- lrclose(); lcreat((char*)0); return(0);
- }
-
-/*
- * writeboard() Function to write the scoreboard from readboard()'s buffer
- *
- * returns -1 if unable to write the scoreboard, returns 0 if all is OK
- */
-writeboard()
- {
- set_score_output();
- if (lcreat(scorefile)<0)
- { lprcat("Can't write scoreboard\n"); lflush(); return(-1); }
- lwrite((char*)sco,sizeof(sco)); lwrite((char*)winr,sizeof(winr));
- lwclose(); lcreat((char*)0); return(0);
- }
-
-/*
- * makeboard() Function to create a new scoreboard (wipe out old one)
- *
- * returns -1 if unable to write the scoreboard, returns 0 if all is OK
- */
-makeboard()
- {
- int i;
- for (i=0; i<SCORESIZE; i++)
- {
- winr[i].taxes = winr[i].score = sco[i].score = 0;
- winr[i].order = sco[i].order = i;
- }
- if (writeboard()) return(-1);
- chmod(scorefile,0660);
- return(0);
- }
-
-/*
- * hashewon() Function to return 1 if player has won a game before, else 0
- *
- * This function also sets c[HARDGAME] to appropriate value -- 0 if not a
- * winner, otherwise the next level of difficulty listed in the winners
- * scoreboard. This function also sets outstanding_taxes to the value in
- * the winners scoreboard.
- */
-hashewon()
- {
- int i;
- c[HARDGAME] = 0;
- if (readboard() < 0) return(0); /* can't find scoreboard */
- for (i=0; i<SCORESIZE; i++) /* search through winners scoreboard */
- if (winr[i].suid == userid)
- if (winr[i].score > 0)
- {
- c[HARDGAME]=winr[i].hardlev+1; outstanding_taxes=winr[i].taxes;
- return(1);
- }
- return(0);
- }
-
-/*
- * long paytaxes(x) Function to pay taxes if any are due
- *
- * Enter with the amount (in gp) to pay on the taxes.
- * Returns amount actually paid.
- */
-long paytaxes(x)
- long x;
- {
- int i;
- long amt;
- if (x<0) return(0L);
- if (readboard()<0) return(0L);
- for (i=0; i<SCORESIZE; i++)
- if (winr[i].suid == userid) /* look for players winning entry */
- if (winr[i].score>0) /* search for a winning entry for the player */
- {
- amt = winr[i].taxes;
- if (x < amt) amt=x; /* don't overpay taxes (Ughhhhh) */
- winr[i].taxes -= amt;
- outstanding_taxes -= amt;
- if (writeboard()<0) return(0);
- return(amt);
- }
- return(0L); /* couldn't find user on winning scoreboard */
- }
-
-/*
- * winshou() Subroutine to print out the winning scoreboard
- *
- * Returns the number of players on scoreboard that were shown
- */
-winshou()
- {
- struct wscofmt *p;
- int i,j,count;
- for (count=j=i=0; i<SCORESIZE; i++) /* is there anyone on the scoreboard? */
- if (winr[i].score != 0)
- { j++; break; }
- if (j)
- {
- lprcat("\n Score Difficulty Time Needed Larn Winners List\n");
-
- for (i=0; i<SCORESIZE; i++) /* this loop is needed to print out the */
- for (j=0; j<SCORESIZE; j++) /* winners in order */
- {
- p = &winr[j]; /* pointer to the scoreboard entry */
- if (p->order == i)
- {
- if (p->score)
- {
- count++;
- lprintf("%10d %2d %5d Mobuls %s \n",
- (long)p->score,(long)p->hardlev,(long)p->timeused,p->who);
- }
- break;
- }
- }
- }
- return(count); /* return number of people on scoreboard */
- }
-
-/*
- * shou(x) Subroutine to print out the non-winners scoreboard
- * int x;
- *
- * Enter with 0 to list the scores, enter with 1 to list inventories too
- * Returns the number of players on scoreboard that were shown
- */
-shou(x)
- int x;
- {
- int i,j,n,k;
- int count;
- for (count=j=i=0; i<SCORESIZE; i++) /* is the scoreboard empty? */
- if (sco[i].score!= 0)
- { j++; break; }
- if (j)
- {
- lprcat("\n Score Difficulty Larn Visitor Log\n");
- for (i=0; i<SCORESIZE; i++) /* be sure to print them out in order */
- for (j=0; j<SCORESIZE; j++)
- if (sco[j].order == i)
- {
- if (sco[j].score)
- {
- count++;
- lprintf("%10d %2d %s ",
- (long)sco[j].score,(long)sco[j].hardlev,sco[j].who);
- if (sco[j].what < 256) lprintf("killed by a %s",monster[sco[j].what].name);
- else lprintf("%s",whydead[sco[j].what - 256]);
- if (x != 263) lprintf(" on %s",levelname[sco[j].level]);
- if (x)
- {
- for (n=0; n<26; n++) { iven[n]=sco[j].sciv[n][0]; ivenarg[n]=sco[j].sciv[n][1]; }
- for (k=1; k<99; k++)
- for (n=0; n<26; n++)
- if (k==iven[n]) { srcount=0; show3(n); }
- lprcat("\n\n");
- }
- else lprc('\n');
- }
- j=SCORESIZE;
- }
- }
- return(count); /* return the number of players just shown */
- }
-
-/*
- * showscores() Function to show the scoreboard on the terminal
- *
- * Returns nothing of value
- */
-static char esb[] = "The scoreboard is empty.\n";
-showscores()
- {
- int i,j;
- lflush(); lcreat((char*)0); if (readboard()<0) return;
- i=winshou(); j=shou(0);
- if (i+j == 0) lprcat(esb); else lprc('\n');
- lflush();
- }
-
-/*
- * showallscores() Function to show scores and the iven lists that go with them
- *
- * Returns nothing of value
- */
-showallscores()
- {
- int i,j;
- lflush(); lcreat((char*)0); if (readboard()<0) return;
- c[WEAR] = c[WIELD] = c[SHIELD] = -1; /* not wielding or wearing anything */
- for (i=0; i<MAXPOTION; i++) potionname[i][0]=' ';
- for (i=0; i<MAXSCROLL; i++) scrollname[i][0]=' ';
- i=winshou(); j=shou(1);
- if (i+j==0) lprcat(esb); else lprc('\n');
- lflush();
- }
-
-/*
- * sortboard() Function to sort the scoreboard
- *
- * Returns 0 if no sorting done, else returns 1
- */
-sortboard()
- {
- int i,j,pos;
- long jdat;
- for (i=0; i<SCORESIZE; i++) sco[i].order = winr[i].order = -1;
- pos=0; while (pos < SCORESIZE)
- {
- jdat=0;
- for (i=0; i<SCORESIZE; i++)
- if ((sco[i].order < 0) && (sco[i].score >= jdat))
- { j=i; jdat=sco[i].score; }
- sco[j].order = pos++;
- }
- pos=0; while (pos < SCORESIZE)
- {
- jdat=0;
- for (i=0; i<SCORESIZE; i++)
- if ((winr[i].order < 0) && (winr[i].score >= jdat))
- { j=i; jdat=winr[i].score; }
- winr[j].order = pos++;
- }
- return(1);
- }
-
-/*
- * newscore(score, whoo, whyded, winner) Function to add entry to scoreboard
- * int score, winner, whyded;
- * char *whoo;
- *
- * Enter with the total score in gp in score, players name in whoo,
- * died() reason # in whyded, and TRUE/FALSE in winner if a winner
- * ex. newscore(1000, "player 1", 32, 0);
- */
-newscore(score, whoo, whyded, winner)
- long score;
- int winner, whyded;
- char *whoo;
- {
- int i;
- long taxes;
- if (readboard() < 0) return; /* do the scoreboard */
- /* if a winner then delete all non-winning scores */
- if (cheat) winner=0; /* if he cheated, don't let him win */
- if (winner)
- {
- for (i=0; i<SCORESIZE; i++) if (sco[i].suid == userid) sco[i].score=0;
- taxes = score*TAXRATE;
- score += 100000*c[HARDGAME]; /* bonus for winning */
- /* if he has a slot on the winning scoreboard update it if greater score */
- for (i=0; i<SCORESIZE; i++) if (winr[i].suid == userid)
- { new1sub(score,i,whoo,taxes); return; }
- /* he had no entry. look for last entry and see if he has a greater score */
- for (i=0; i<SCORESIZE; i++) if (winr[i].order == SCORESIZE-1)
- { new1sub(score,i,whoo,taxes); return; }
- }
- else if (!cheat) /* for not winning scoreboard */
- {
- /* if he has a slot on the scoreboard update it if greater score */
- for (i=0; i<SCORESIZE; i++) if (sco[i].suid == userid)
- { new2sub(score,i,whoo,whyded); return; }
- /* he had no entry. look for last entry and see if he has a greater score */
- for (i=0; i<SCORESIZE; i++) if (sco[i].order == SCORESIZE-1)
- { new2sub(score,i,whoo,whyded); return; }
- }
- }
-
-/*
- * new1sub(score,i,whoo,taxes) Subroutine to put player into a
- * int score,i,whyded,taxes; winning scoreboard entry if his score
- * char *whoo; is high enough
- *
- * Enter with the total score in gp in score, players name in whoo,
- * died() reason # in whyded, and TRUE/FALSE in winner if a winner
- * slot in scoreboard in i, and the tax bill in taxes.
- * Returns nothing of value
- */
-new1sub(score,i,whoo,taxes)
- long score,taxes;
- int i;
- char *whoo;
- {
- struct wscofmt *p;
- p = &winr[i];
- p->taxes += taxes;
- if ((score >= p->score) || (c[HARDGAME] > p->hardlev))
- {
- strcpy(p->who,whoo); p->score=score;
- p->hardlev=c[HARDGAME]; p->suid=userid;
- p->timeused=gtime/100;
- }
- }
-
-/*
- * new2sub(score,i,whoo,whyded) Subroutine to put player into a
- * int score,i,whyded,taxes; non-winning scoreboard entry if his
- * char *whoo; score is high enough
- *
- * Enter with the total score in gp in score, players name in whoo,
- * died() reason # in whyded, and slot in scoreboard in i.
- * Returns nothing of value
- */
-new2sub(score,i,whoo,whyded)
- long score;
- int i,whyded;
- char *whoo;
- {
- int j;
- struct scofmt *p;
- p = &sco[i];
- if ((score >= p->score) || (c[HARDGAME] > p->hardlev))
- {
- strcpy(p->who,whoo); p->score=score;
- p->what=whyded; p->hardlev=c[HARDGAME];
- p->suid=userid; p->level=level;
- for (j=0; j<26; j++)
- { p->sciv[j][0]=iven[j]; p->sciv[j][1]=ivenarg[j]; }
- }
- }
-
-/*
- * died(x) Subroutine to record who played larn, and what the score was
- * int x;
- *
- * if x < 0 then don't show scores
- * died() never returns! (unless c[LIFEPROT] and a reincarnatable death!)
- *
- * < 256 killed by the monster number
- * 256 quit
- * 257 suspended
- * 258 self - annihilated
- * 259 shot by an arrow
- * 260 hit by a dart
- * 261 fell into a pit
- * 262 fell into a bottomless pit
- * 263 a winner
- * 264 trapped in solid rock
- * 265 killed by a missing save file
- * 266 killed by an old save file
- * 267 caught by the greedy cheater checker trap
- * 268 killed by a protected save file
- * 269 killed his family and killed himself
- * 270 erased by a wayward finger
- * 271 fell through a bottomless trap door
- * 272 fell through a trap door
- * 273 drank some poisonous water
- * 274 fried by an electric shock
- * 275 slipped on a volcano shaft
- * 276 killed by a stupid act of frustration
- * 277 attacked by a revolting demon
- * 278 hit by his own magic
- * 279 demolished by an unseen attacker
- * 280 fell into the dreadful sleep
- * 281 killed by an exploding chest
- * 282 killed by a missing maze data file
- * 283 killed by a sphere of annihilation
- * 284 died a post mortem death
- * 285 malloc() failure
- * 300 quick quit -- don't put on scoreboard
- */
-
-static int scorerror;
-died(x)
- int x;
- {
- int f,win;
- char ch,*mod;
- time_t zzz;
- long i;
- struct tms cputime;
- if (c[LIFEPROT]>0) /* if life protection */
- {
- switch((x>0) ? x : -x)
- {
- case 256: case 257: case 262: case 263: case 265: case 266:
- case 267: case 268: case 269: case 271: case 282: case 284:
- case 285: case 300: goto invalid; /* can't be saved */
- };
- --c[LIFEPROT]; c[HP]=1; --c[CONSTITUTION];
- cursors(); lprcat("\nYou feel wiiieeeeerrrrrd all over! "); beep();
- lflush(); sleep(4);
- return; /* only case where died() returns */
- }
-invalid:
- clearvt100(); lflush(); f=0;
- if (ckpflag) unlink(ckpfile); /* remove checkpoint file if used */
- if (x<0) { f++; x = -x; } /* if we are not to display the scores */
- if ((x == 300) || (x == 257)) exit(0); /* for quick exit or saved game */
- if (x == 263) win = 1; else win = 0;
- c[GOLD] += c[BANKACCOUNT]; c[BANKACCOUNT] = 0;
- /* now enter the player at the end of the scoreboard */
- newscore(c[GOLD], logname, x, win);
- diedsub(x); /* print out the score line */ lflush();
-
- set_score_output();
- if ((wizard == 0) && (c[GOLD] > 0)) /* wizards can't score */
- {
-#ifndef NOLOG
- if (lappend(logfile)<0) /* append to file */
- {
- if (lcreat(logfile)<0) /* and can't create new log file */
- {
- lcreat((char*)0);
- lprcat("\nCan't open record file: I can't post your score.\n");
- sncbr(); resetscroll(); lflush(); exit(1);
- }
- chmod(logfile,0660);
- }
- strcpy(logg.who,loginname);
- logg.score = c[GOLD]; logg.diff = c[HARDGAME];
- if (x < 256)
- {
- ch = *monster[x].name;
- if (ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
- mod="an"; else mod="a";
- sprintf(logg.what,"killed by %s %s",mod,monster[x].name);
- }
- else sprintf(logg.what,"%s",whydead[x - 256]);
- logg.cavelev=level;
- time(&zzz); /* get cpu time -- write out score info */
- logg.diedtime=zzz;
-#ifdef EXTRA
- times(&cputime); /* get cpu time -- write out score info */
- logg.cputime = i = (cputime.tms_utime + cputime.tms_stime)/60 + c[CPUTIME];
- logg.lev=c[LEVEL]; logg.ac=c[AC];
- logg.hpmax=c[HPMAX]; logg.hp=c[HP];
- logg.elapsedtime=(zzz-initialtime+59)/60;
- logg.usage=(10000*i)/(zzz-initialtime);
- logg.bytin=c[BYTESIN]; logg.bytout=c[BYTESOUT];
- logg.moves=c[MOVESMADE]; logg.spused=c[SPELLSCAST];
- logg.killed=c[MONSTKILLED];
-#endif
- lwrite((char*)&logg,sizeof(struct log_fmt)); lwclose();
-#endif /* NOLOG */
-
-/* now for the scoreboard maintenance -- not for a suspended game */
- if (x != 257)
- {
- if (sortboard()) scorerror = writeboard();
- }
- }
- if ((x==256) || (x==257) || (f != 0)) exit(0);
- if (scorerror == 0) showscores(); /* if we updated the scoreboard */
- if (x == 263) mailbill(); exit(0);
- }
-
-/*
- * diedsub(x) Subroutine to print out the line showing the player when he is killed
- * int x;
- */
-diedsub(x)
-int x;
- {
- char ch,*mod;
- lprintf("Score: %d, Diff: %d, %s ",(long)c[GOLD],(long)c[HARDGAME],logname);
- if (x < 256)
- {
- ch = *monster[x].name;
- if (ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
- mod="an"; else mod="a";
- lprintf("killed by %s %s",mod,monster[x].name);
- }
- else lprintf("%s",whydead[x - 256]);
- if (x != 263) lprintf(" on %s\n",levelname[level]); else lprc('\n');
- }
-
-/*
- * diedlog() Subroutine to read a log file and print it out in ascii format
- */
-diedlog()
- {
- int n;
- char *p;
- struct stat stbuf;
- lcreat((char*)0);
- if (lopen(logfile)<0)
- {
- lprintf("Can't locate log file <%s>\n",logfile);
- return;
- }
- if (fstat(fd,&stbuf) < 0)
- {
- lprintf("Can't stat log file <%s>\n",logfile);
- return;
- }
- for (n=stbuf.st_size/sizeof(struct log_fmt); n>0; --n)
- {
- lrfill((char*)&logg,sizeof(struct log_fmt));
- p = ctime(&logg.diedtime); p[16]='\n'; p[17]=0;
- lprintf("Score: %d, Diff: %d, %s %s on %d at %s",(long)(logg.score),(long)(logg.diff),logg.who,logg.what,(long)(logg.cavelev),p+4);
-#ifdef EXTRA
- if (logg.moves<=0) logg.moves=1;
- lprintf(" Experience Level: %d, AC: %d, HP: %d/%d, Elapsed Time: %d minutes\n",(long)(logg.lev),(long)(logg.ac),(long)(logg.hp),(long)(logg.hpmax),(long)(logg.elapsedtime));
- lprintf(" CPU time used: %d seconds, Machine usage: %d.%02d%%\n",(long)(logg.cputime),(long)(logg.usage/100),(long)(logg.usage%100));
- lprintf(" BYTES in: %d, out: %d, moves: %d, deaths: %d, spells cast: %d\n",(long)(logg.bytin),(long)(logg.bytout),(long)(logg.moves),(long)(logg.killed),(long)(logg.spused));
- lprintf(" out bytes per move: %d, time per move: %d ms\n",(long)(logg.bytout/logg.moves),(long)((logg.cputime*1000)/logg.moves));
-#endif
- }
- lflush(); lrclose(); return;
- }
-
-#ifndef UIDSCORE
-/*
- * getplid(name) Function to get players id # from id file
- *
- * Enter with the name of the players character in name.
- * Returns the id # of the players character, or -1 if failure.
- * This routine will try to find the name in the id file, if its not there,
- * it will try to make a new entry in the file. Only returns -1 if can't
- * find him in the file, and can't make a new entry in the file.
- * Format of playerids file:
- * Id # in ascii \n character name \n
- */
-static int havepid= -1; /* playerid # if previously done */
-getplid(nam)
- char *nam;
- {
- int fd7,high=999,no;
- char *p,*p2;
- char name[80];
- if (havepid != -1) return(havepid); /* already did it */
- lflush(); /* flush any pending I/O */
- sprintf(name,"%s\n",nam); /* append a \n to name */
- if (lopen(playerids) < 0) /* no file, make it */
- {
- if ((fd7=creat(playerids,0666)) < 0) return(-1); /* can't make it */
- close(fd7); goto addone; /* now append new playerid record to file */
- }
- for (;;) /* now search for the name in the player id file */
- {
- p = lgetl(); if (p==NULL) break; /* EOF? */
- no = atoi(p); /* the id # */
- p2= lgetl(); if (p2==NULL) break; /* EOF? */
- if (no>high) high=no; /* accumulate highest id # */
- if (strcmp(p2,name)==0) /* we found him */
- {
- return(no); /* his id number */
- }
- }
- lrclose();
- /* if we get here, we didn't find him in the file -- put him there */
-addone:
- if (lappend(playerids) < 0) return(-1); /* can't open file for append */
- lprintf("%d\n%s",(long)++high,name); /* new id # and name */
- lwclose();
- lcreat((char*)0); /* re-open terminal channel */
- return(high);
- }
-#endif /* UIDSCORE */
-
diff --git a/games/larn/signal.c b/games/larn/signal.c
deleted file mode 100644
index 44e8468..0000000
--- a/games/larn/signal.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $FreeBSD$ */
-
-#include <signal.h>
-#include "header.h" /* "Larn is copyrighted 1986 by Noah Morgan.\n" */
-
-#define BIT(a) (1<<((a)-1))
-extern char savefilename[],wizard,predostuff,nosignal;
-static s2choose() /* text to be displayed if ^C during intro screen */
- {
- cursor(1,24); lprcat("Press "); setbold(); lprcat("return"); resetbold();
- lprcat(" to continue: "); lflush();
- }
-
-static void
-cntlc() /* what to do for a ^C */
- {
- if (nosignal) return; /* don't do anything if inhibited */
- signal(SIGQUIT,SIG_IGN); signal(SIGINT,SIG_IGN);
- quit(); if (predostuff==1) s2choose(); else showplayer();
- lflush();
- signal(SIGQUIT,cntlc); signal(SIGINT,cntlc);
- }
-
-/*
- * subroutine to save the game if a hangup signal
- */
-static void
-sgam()
- {
- savegame(savefilename); wizard=1; died(-257); /* hangup signal */
- }
-
-#ifdef SIGTSTP
-static void
-tstop() /* control Y */
- {
- if (nosignal) return; /* nothing if inhibited */
- lcreat((char*)0); clearvt100(); lflush(); signal(SIGTSTP,SIG_DFL);
-#ifdef SIGVTALRM
- /* looks like BSD4.2 or higher - must clr mask for signal to take effect*/
- sigsetmask(sigblock(0)& ~BIT(SIGTSTP));
-#endif
- kill(getpid(),SIGTSTP);
-
- setupvt100(); signal(SIGTSTP,tstop);
- if (predostuff==1) s2choose(); else drawscreen();
- showplayer(); lflush();
- }
-#endif /* SIGTSTP */
-
-/*
- * subroutine to issue the needed signal traps called from main()
- */
-static void sigpanic();
-static void sigill() { sigpanic(SIGILL); }
-static void sigtrap() { sigpanic(SIGTRAP); }
-static void sigiot() { sigpanic(SIGIOT); }
-static void sigemt() { sigpanic(SIGEMT); }
-static void sigfpe() { sigpanic(SIGFPE); }
-static void sigbus() { sigpanic(SIGBUS); }
-static void sigsegv() { sigpanic(SIGSEGV); }
-static void sigsys() { sigpanic(SIGSYS); }
-static void sigpipe() { sigpanic(SIGPIPE); }
-static void sigterm() { sigpanic(SIGTERM); }
-sigsetup()
- {
- signal(SIGQUIT, cntlc); signal(SIGINT, cntlc);
- signal(SIGKILL, SIG_IGN); signal(SIGHUP, sgam);
- signal(SIGILL, sigill); signal(SIGTRAP, sigtrap);
- signal(SIGIOT, sigiot); signal(SIGEMT, sigemt);
- signal(SIGFPE, sigfpe); signal(SIGBUS, sigbus);
- signal(SIGSEGV, sigsegv); signal(SIGSYS, sigsys);
- signal(SIGPIPE, sigpipe); signal(SIGTERM, sigterm);
-#ifdef SIGTSTP
- signal(SIGTSTP,tstop); signal(SIGSTOP,tstop);
-#endif /* SIGTSTP */
- }
-
-#ifdef BSD /* for BSD UNIX? */
-
-static char *signame[NSIG] = { "",
-"SIGHUP", /* 1 hangup */
-"SIGINT", /* 2 interrupt */
-"SIGQUIT", /* 3 quit */
-"SIGILL", /* 4 illegal instruction (not reset when caught) */
-"SIGTRAP", /* 5 trace trap (not reset when caught) */
-"SIGIOT", /* 6 IOT instruction */
-"SIGEMT", /* 7 EMT instruction */
-"SIGFPE", /* 8 floating point exception */
-"SIGKILL", /* 9 kill (cannot be caught or ignored) */
-"SIGBUS", /* 10 bus error */
-"SIGSEGV", /* 11 segmentation violation */
-"SIGSYS", /* 12 bad argument to system call */
-"SIGPIPE", /* 13 write on a pipe with no one to read it */
-"SIGALRM", /* 14 alarm clock */
-"SIGTERM", /* 15 software termination signal from kill */
-"SIGURG", /* 16 urgent condition on IO channel */
-"SIGSTOP", /* 17 sendable stop signal not from tty */
-"SIGTSTP", /* 18 stop signal from tty */
-"SIGCONT", /* 19 continue a stopped process */
-"SIGCHLD", /* 20 to parent on child stop or exit */
-"SIGTTIN", /* 21 to readers pgrp upon background tty read */
-"SIGTTOU", /* 22 like TTIN for output if (tp->t_local&LTOSTOP) */
-"SIGIO", /* 23 input/output possible signal */
-"SIGXCPU", /* 24 exceeded CPU time limit */
-"SIGXFSZ", /* 25 exceeded file size limit */
-"SIGVTALRM",/* 26 virtual time alarm */
-"SIGPROF", /* 27 profiling time alarm */
-"","","","" };
-
-#else /* BSD */ /* for system V? */
-
-static char *signame[NSIG] = { "",
-"SIGHUP", /* 1 hangup */
-"SIGINT", /* 2 interrupt */
-"SIGQUIT", /* 3 quit */
-"SIGILL", /* 4 illegal instruction (not reset when caught) */
-"SIGTRAP", /* 5 trace trap (not reset when caught) */
-"SIGIOT", /* 6 IOT instruction */
-"SIGEMT", /* 7 EMT instruction */
-"SIGFPE", /* 8 floating point exception */
-"SIGKILL", /* 9 kill (cannot be caught or ignored) */
-"SIGBUS", /* 10 bus error */
-"SIGSEGV", /* 11 segmentation violation */
-"SIGSYS", /* 12 bad argument to system call */
-"SIGPIPE", /* 13 write on a pipe with no one to read it */
-"SIGALRM", /* 14 alarm clock */
-"SIGTERM", /* 15 software termination signal from kill */
-"SIGUSR1", /* 16 user defines signal 1 */
-"SIGUSR2", /* 17 user defines signal 2 */
-"SIGCLD", /* 18 child death */
-"SIGPWR", /* 19 power fail */
-"","","","","","","","","","","","" };
-
-#endif /* BSD */
-
-/*
- * routine to process a fatal error signal
- */
-static void
-sigpanic(sig)
- int sig;
- {
- char buf[128];
- signal(sig,SIG_DFL);
- sprintf(buf,"\nLarn - Panic! Signal %d received [%s]",sig,signame[sig]);
- write(2,buf,strlen(buf)); sleep(2);
- sncbr();
- savegame(savefilename);
- kill(getpid(),sig); /* this will terminate us */
- }
diff --git a/games/larn/store.c b/games/larn/store.c
deleted file mode 100644
index 0036c87..0000000
--- a/games/larn/store.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*-
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)store.c 5.4 (Berkeley) 5/13/91";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/* store.c Larn is copyrighted 1986 by Noah Morgan. */
-#include "header.h"
-static int dndcount=0,dnditm=0;
-
-/* this is the data for the stuff in the dnd store */
-int maxitm=83; /* number of items in the dnd inventory table */
-struct _itm itm[90] = {
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 2, 0, OLEATHER, 0, 3 },
-{ 10, 0, OSTUDLEATHER, 0, 2 },
-{ 40, 0, ORING, 0, 2 },
-{ 85, 0, OCHAIN, 0, 2 },
-{ 220, 0, OSPLINT, 0, 1 },
-{ 400, 0, OPLATE, 0, 1 },
-{ 900, 0, OPLATEARMOR, 0, 1 },
-{ 2600, 0, OSSPLATE, 0, 1 },
-{ 150, 0, OSHIELD, 0, 1 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 2, 0, ODAGGER, 0, 3 },
-{ 20, 0, OSPEAR, 0, 3 },
-{ 80, 0, OFLAIL, 0, 2 },
-{ 150, 0, OBATTLEAXE, 0, 2 },
-{ 450, 0, OLONGSWORD, 0, 2 },
-{ 1000, 0, O2SWORD, 0, 2 },
-{ 5000, 0, OSWORD, 0, 1 },
-{ 16500, 0, OLANCE, 0, 1 },
-{ 6000, 0, OSWORDofSLASHING, 0, 0 },
-{ 10000, 0, OHAMMER, 0, 0 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 150, 0, OPROTRING, 1, 1 },
-{ 85, 0, OSTRRING, 1, 1 },
-{ 120, 0, ODEXRING, 1, 1 },
-{ 120, 0, OCLEVERRING, 1, 1 },
-{ 180, 0, OENERGYRING, 0, 1 },
-{ 125, 0, ODAMRING, 0, 1 },
-{ 220, 0, OREGENRING, 0, 1 },
-{ 1000, 0, ORINGOFEXTRA, 0, 1 },
-
-{ 280, 0, OBELT, 0, 1 },
-
-{ 400, 0, OAMULET, 0, 1 },
-
-{ 6500, 0, OORBOFDRAGON, 0, 0 },
-{ 5500, 0, OSPIRITSCARAB, 0, 0 },
-{ 5000, 0, OCUBEofUNDEAD, 0, 0 },
-{ 6000, 0, ONOTHEFT, 0, 0 },
-
-{ 590, 0, OCHEST, 6, 1 },
-{ 200, 0, OBOOK, 8, 1 },
-{ 10, 0, OCOOKIE, 0, 3 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 20, potionname, OPOTION, 0, 6 },
-{ 90, potionname, OPOTION, 1, 5 },
-{ 520, potionname, OPOTION, 2, 1 },
-{ 100, potionname, OPOTION, 3, 2 },
-{ 50, potionname, OPOTION, 4, 2 },
-{ 150, potionname, OPOTION, 5, 2 },
-{ 70, potionname, OPOTION, 6, 1 },
-{ 30, potionname, OPOTION, 7, 7 },
-{ 200, potionname, OPOTION, 8, 1 },
-{ 50, potionname, OPOTION, 9, 1 },
-{ 80, potionname, OPOTION, 10, 1 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 30, potionname, OPOTION, 11, 3 },
-{ 20, potionname, OPOTION, 12, 5 },
-{ 40, potionname, OPOTION, 13, 3 },
-{ 35, potionname, OPOTION, 14, 2 },
-{ 520, potionname, OPOTION, 15, 1 },
-{ 90, potionname, OPOTION, 16, 2 },
-{ 200, potionname, OPOTION, 17, 2 },
-{ 220, potionname, OPOTION, 18, 4 },
-{ 80, potionname, OPOTION, 19, 6 },
-{ 370, potionname, OPOTION, 20, 3 },
-{ 50, potionname, OPOTION, 22, 1 },
-{ 150, potionname, OPOTION, 23, 3 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 100, scrollname, OSCROLL, 0, 2 },
-{ 125, scrollname, OSCROLL, 1, 2 },
-{ 60, scrollname, OSCROLL, 2, 4 },
-{ 10, scrollname, OSCROLL, 3, 4 },
-{ 100, scrollname, OSCROLL, 4, 3 },
-{ 200, scrollname, OSCROLL, 5, 2 },
-{ 110, scrollname, OSCROLL, 6, 1 },
-{ 500, scrollname, OSCROLL, 7, 2 },
-{ 200, scrollname, OSCROLL, 8, 2 },
-{ 250, scrollname, OSCROLL, 9, 4 },
-{ 20, scrollname, OSCROLL, 10, 5 },
-{ 30, scrollname, OSCROLL, 11, 3 },
-
-/*cost memory iven name iven arg how
- gp pointer iven[] ivenarg[] many */
-
-{ 340, scrollname, OSCROLL, 12, 1 },
-{ 340, scrollname, OSCROLL, 13, 1 },
-{ 300, scrollname, OSCROLL, 14, 2 },
-{ 400, scrollname, OSCROLL, 15, 2 },
-{ 500, scrollname, OSCROLL, 16, 2 },
-{ 1000, scrollname, OSCROLL, 17, 1 },
-{ 500, scrollname, OSCROLL, 18, 1 },
-{ 340, scrollname, OSCROLL, 19, 2 },
-{ 220, scrollname, OSCROLL, 20, 3 },
-{ 3900, scrollname, OSCROLL, 21, 0 },
-{ 610, scrollname, OSCROLL, 22, 1 },
-{ 3000, scrollname, OSCROLL, 23, 0 }
- };
-
-/*
- function for the dnd store
- */
-dnd_2hed()
- {
- lprcat("Welcome to the Larn Thrift Shoppe. We stock many items explorers find useful\n");
- lprcat(" in their adventures. Feel free to browse to your hearts content.\n");
- lprcat("Also be advised, if you break 'em, you pay for 'em.");
- }
-
-static void dnditem();
-
-dnd_hed()
- {
- int i;
- for (i=dnditm; i<26+dnditm; i++) dnditem(i);
- cursor(50,18); lprcat("You have ");
- }
-
-static void
-handsfull()
-{
- lprcat("\nYou can't carry anything more!");
- lflush();
- nap(2200);
-}
-
-static void
-outofstock()
-{
- lprcat("\nSorry, but we are out of that item.");
- lflush();
- nap(2200);
-}
-
-static void nogold()
-{
- lprcat("\nYou don't have enough gold to pay for that!");
- lflush();
- nap(2200);
-}
-
-dndstore()
- {
- int i;
- dnditm = 0;
- nosignal = 1; /* disable signals */
- clear(); dnd_2hed();
- if (outstanding_taxes>0)
- {
- lprcat("\n\nThe Larn Revenue Service has ordered us to not do business with tax evaders.\n"); beep();
- lprintf("They have also told us that you owe %d gp in back taxes, and as we must\n",(long)outstanding_taxes);
- lprcat("comply with the law, we cannot serve you at this time. Soo Sorry.\n");
- cursors();
- lprcat("\nPress "); standout("escape"); lprcat(" to leave: "); lflush();
- i=0;
- while (i!='\33') i=getchar();
- drawscreen(); nosignal = 0; /* enable signals */ return;
- }
-
- dnd_hed();
- while (1)
- {
- cursor(59,18); lprintf("%d gold pieces",(long)c[GOLD]);
- cltoeoln(); cl_dn(1,20); /* erase to eod */
- lprcat("\nEnter your transaction ["); standout("space");
- lprcat(" for more, "); standout("escape");
- lprcat(" to leave]? ");
- i=0;
- while ((i<'a' || i>'z') && (i!=' ') && (i!='\33') && (i!=12)) i=getchar();
- if (i==12) { clear(); dnd_2hed(); dnd_hed(); }
- else if (i=='\33')
- { drawscreen(); nosignal = 0; /* enable signals */ return; }
- else if (i==' ')
- {
- cl_dn(1,4);
- if ((dnditm += 26) >= maxitm) dnditm=0; dnd_hed();
- }
- else
- { /* buy something */
- lprc(i); /* echo the byte */
- i += dnditm - 'a';
- if (i>=maxitm) outofstock(); else
- if (itm[i].qty <= 0) outofstock(); else
- if (pocketfull()) handsfull(); else
- if (c[GOLD] < itm[i].price*10) nogold(); else
- {
- if (itm[i].mem != 0) *itm[i].mem[itm[i].arg] = ' ';
- c[GOLD] -= itm[i].price*10;
- itm[i].qty--; take(itm[i].obj,itm[i].arg);
- if (itm[i].qty==0) dnditem(i); nap(1001);
- }
- }
-
- }
- }
-
-/*
- dnditem(index)
-
- to print the item list; used in dndstore() enter with the index into itm
- */
-static void
-dnditem(i)
- int i;
- {
- int j,k;
- if (i >= maxitm) return;
- cursor( (j=(i&1)*40+1) , (k=((i%26)>>1)+5) );
- if (itm[i].qty == 0) { lprintf("%39s",""); return; }
- lprintf("%c) ",(i%26)+'a');
- if (itm[i].obj == OPOTION)
- { lprcat("potion of "); lprintf("%s",&potionname[itm[i].arg][1]); }
- else if (itm[i].obj == OSCROLL)
- { lprcat("scroll of "); lprintf("%s",&scrollname[itm[i].arg][1]); }
- else lprintf("%s",objectname[itm[i].obj]);
- cursor( j+31,k ); lprintf("%6d",(long)(itm[i].price*10));
- }
-
-
-/*
- for the college of larn
- */
-char course[26]={0}; /* the list of courses taken */
-char coursetime[] = { 10, 15, 10, 20, 10, 10, 10, 5 };
-/*
- function to display the header info for the school
- */
-sch_hed()
- {
- clear();
- lprcat("The College of Larn offers the exciting opportunity of higher education to\n");
- lprcat("all inhabitants of the caves. Here is a list of the class schedule:\n\n\n");
- lprcat("\t\t Course Name \t Time Needed\n\n");
-
- if (course[0]==0) lprcat("\t\ta) Fighters Training I 10 mobuls"); /*line 7 of crt*/
- lprc('\n');
- if (course[1]==0) lprcat("\t\tb) Fighters Training II 15 mobuls");
- lprc('\n');
- if (course[2]==0) lprcat("\t\tc) Introduction to Wizardry 10 mobuls");
- lprc('\n');
- if (course[3]==0) lprcat("\t\td) Applied Wizardry 20 mobuls");
- lprc('\n');
- if (course[4]==0) lprcat("\t\te) Behavioral Psychology 10 mobuls");
- lprc('\n');
- if (course[5]==0) lprcat("\t\tf) Faith for Today 10 mobuls");
- lprc('\n');
- if (course[6]==0) lprcat("\t\tg) Contemporary Dance 10 mobuls");
- lprc('\n');
- if (course[7]==0) lprcat("\t\th) History of Larn 5 mobuls");
-
- lprcat("\n\n\t\tAll courses cost 250 gold pieces.");
- cursor(30,18);
- lprcat("You are presently carrying ");
- }
-
-oschool()
- {
- int i;
- long time_used;
- nosignal = 1; /* disable signals */
- sch_hed();
- while (1)
- {
- cursor(57,18); lprintf("%d gold pieces. ",(long)c[GOLD]); cursors();
- lprcat("\nWhat is your choice ["); standout("escape");
- lprcat(" to leave] ? "); yrepcount=0;
- i=0; while ((i<'a' || i>'h') && (i!='\33') && (i!=12)) i=getchar();
- if (i==12) { sch_hed(); continue; }
- else if (i=='\33')
- { nosignal = 0; drawscreen(); /* enable signals */ return; }
- lprc(i);
- if (c[GOLD] < 250) nogold(); else
- if (course[i-'a'])
- { lprcat("\nSorry, but that class is filled."); nap(1000); }
- else
- if (i <= 'h')
- {
- c[GOLD] -= 250; time_used=0;
- switch(i)
- {
- case 'a': c[STRENGTH] += 2; c[CONSTITUTION]++;
- lprcat("\nYou feel stronger!");
- cl_line(16,7);
- break;
-
- case 'b': if (course[0]==0)
- {
- lprcat("\nSorry, but this class has a prerequisite of Fighters Training I");
- c[GOLD]+=250; time_used= -10000; break;
- }
- lprcat("\nYou feel much stronger!");
- cl_line(16,8);
- c[STRENGTH] += 2; c[CONSTITUTION] += 2; break;
-
- case 'c': c[INTELLIGENCE] += 2;
- lprcat("\nThe task before you now seems more attainable!");
- cl_line(16,9); break;
-
- case 'd': if (course[2]==0)
- {
- lprcat("\nSorry, but this class has a prerequisite of Introduction to Wizardry");
- c[GOLD]+=250; time_used= -10000; break;
- }
- lprcat("\nThe task before you now seems very attainable!");
- cl_line(16,10);
- c[INTELLIGENCE] += 2; break;
-
- case 'e': c[CHARISMA] += 3;
- lprcat("\nYou now feel like a born leader!");
- cl_line(16,11); break;
-
- case 'f': c[WISDOM] += 2;
- lprcat("\nYou now feel more confident that you can find the potion in time!");
- cl_line(16,12); break;
-
- case 'g': c[DEXTERITY] += 3;
- lprcat("\nYou feel like dancing!");
- cl_line(16,13); break;
-
- case 'h': c[INTELLIGENCE]++;
- lprcat("\nYour instructor told you that the Eye of Larn is rumored to be guarded\n");
- lprcat("by a platinum dragon who possesses psionic abilities. ");
- cl_line(16,14); break;
- }
- time_used += coursetime[i-'a']*100;
- if (time_used > 0)
- {
- gtime += time_used;
- course[i-'a']++; /* remember that he has taken that course */
- c[HP] = c[HPMAX]; c[SPELLS] = c[SPELLMAX]; /* he regenerated */
-
- if (c[BLINDCOUNT]) c[BLINDCOUNT]=1; /* cure blindness too! */
- if (c[CONFUSE]) c[CONFUSE]=1; /* end confusion */
- adjtime((long)time_used); /* adjust parameters for time change */
- }
- nap(1000);
- }
- }
- }
-
-/*
- * for the first national bank of Larn
- */
-int lasttime=0; /* last time he was in bank */
-static void banktitle();
-
-obank()
- {
- banktitle(" Welcome to the First National Bank of Larn.");
- }
-obank2()
- {
- banktitle("Welcome to the 5th level branch office of the First National Bank of Larn.");
- }
-static void
-banktitle(str)
- char *str;
- {
- nosignal = 1; /* disable signals */
- clear(); lprcat(str);
- if (outstanding_taxes>0)
- {
- int i;
- lprcat("\n\nThe Larn Revenue Service has ordered that your account be frozen until all\n"); beep();
- lprintf("levied taxes have been paid. They have also told us that you owe %d gp in\n",(long)outstanding_taxes);
- lprcat("taxes, and we must comply with them. We cannot serve you at this time. Sorry.\n");
- lprcat("We suggest you go to the LRS office and pay your taxes.\n");
- cursors();
- lprcat("\nPress "); standout("escape"); lprcat(" to leave: "); lflush();
- i=0;
- while (i!='\33') i=getchar();
- drawscreen(); nosignal = 0; /* enable signals */ return;
- }
- lprcat("\n\n\tGemstone\t Appraisal\t\tGemstone\t Appraisal");
- obanksub(); nosignal = 0; /* enable signals */
- drawscreen();
- }
-
-/*
- * function to put interest on your bank account
- */
-ointerest()
- {
- int i;
- if (c[BANKACCOUNT]<0) c[BANKACCOUNT] = 0;
- else if ((c[BANKACCOUNT]>0) && (c[BANKACCOUNT]<500000))
- {
- i = (gtime-lasttime)/100; /* # mobuls elapsed */
- while ((i-- > 0) && (c[BANKACCOUNT]<500000))
- c[BANKACCOUNT] += c[BANKACCOUNT]/250;
- if (c[BANKACCOUNT]>500000) c[BANKACCOUNT]=500000; /* interest limit */
- }
- lasttime = (gtime/100)*100;
- }
-
-static short gemorder[26]={0}; /* the reference to screen location for each */
-static long gemvalue[26]={0}; /* the appraisal of the gems */
-obanksub()
- {
- unsigned long amt;
- int i,k;
- ointerest(); /* credit any needed interest */
-
- for (k=i=0; i<26; i++)
- switch(iven[i])
- {
- case OLARNEYE: case ODIAMOND: case OEMERALD:
- case ORUBY: case OSAPPHIRE:
-
- if (iven[i]==OLARNEYE)
- {
- gemvalue[i]=250000-((gtime*7)/100)*100;
- if (gemvalue[i]<50000) gemvalue[i]=50000;
- }
- else gemvalue[i] = (255&ivenarg[i])*100;
- gemorder[i]=k;
- cursor( (k%2)*40+1 , (k>>1)+4 );
- lprintf("%c) %s",i+'a',objectname[iven[i]]);
- cursor( (k%2)*40+33 , (k>>1)+4 );
- lprintf("%5d",(long)gemvalue[i]); k++;
- };
- cursor(31,17); lprintf("You have %8d gold pieces in the bank.",(long)c[BANKACCOUNT]);
- cursor(40,18); lprintf("You have %8d gold pieces",(long)c[GOLD]);
- if (c[BANKACCOUNT]+c[GOLD] >= 500000)
- lprcat("\nNote: Larndom law states that only deposits under 500,000gp can earn interest.");
- while (1)
- {
- cl_dn(1,20);
- lprcat("\nYour wish? [("); standout("d"); lprcat(") deposit, (");
- standout("w"); lprcat(") withdraw, ("); standout("s");
- lprcat(") sell a stone, or "); standout("escape"); lprcat("] ");
- yrepcount=0;
- i=0; while (i!='d' && i!='w' && i!='s' && i!='\33') i=getchar();
- switch(i)
- {
- case 'd': lprcat("deposit\nHow much? "); amt = readnum((long)c[GOLD]);
- if (amt<0) { lprcat("\nSorry, but we can't take negative gold!"); nap(2000); amt=0; } else
- if (amt>c[GOLD])
- { lprcat(" You don't have that much."); nap(2000); }
- else { c[GOLD] -= amt; c[BANKACCOUNT] += amt; }
- break;
-
- case 'w': lprcat("withdraw\nHow much? "); amt = readnum((long)c[BANKACCOUNT]);
- if (amt<0) { lprcat("\nSorry, but we don't have any negative gold!"); nap(2000); amt=0; }
- else if (amt > c[BANKACCOUNT])
- { lprcat("\nYou don't have that much in the bank!"); nap(2000); }
- else { c[GOLD] += amt; c[BANKACCOUNT] -= amt; }
- break;
-
- case 's': lprcat("\nWhich stone would you like to sell? ");
- i=0; while ((i<'a' || i>'z') && i!='*') i=getchar();
- if (i=='*')
- for (i=0; i<26; i++)
- {
- if (gemvalue[i])
- {
- c[GOLD]+=gemvalue[i]; iven[i]=0;
- gemvalue[i]=0; k = gemorder[i];
- cursor( (k%2)*40+1 , (k>>1)+4 );
- lprintf("%39s","");
- }
- }
- else
- {
- if (gemvalue[i=i-'a']==0)
- {
- lprintf("\nItem %c is not a gemstone!",i+'a');
- nap(2000); break;
- }
- c[GOLD]+=gemvalue[i]; iven[i]=0;
- gemvalue[i]=0; k = gemorder[i];
- cursor( (k%2)*40+1 , (k>>1)+4 ); lprintf("%39s","");
- }
- break;
-
- case '\33': return;
- };
- cursor(40,17); lprintf("%8d",(long)c[BANKACCOUNT]);
- cursor(49,18); lprintf("%8d",(long)c[GOLD]);
- }
- }
-
-/*
- subroutine to appraise any stone for the bank
- */
-appraise(gemstone)
- int gemstone;
- {
- int j,amt;
- for (j=0; j<26; j++)
- if (iven[j]==gemstone)
- {
- lprintf("\nI see you have %s",objectname[gemstone]);
- if (gemstone==OLARNEYE) lprcat(" I must commend you. I didn't think\nyou could get it.");
- lprcat(" Shall I appraise it for you? "); yrepcount=0;
- if (getyn()=='y')
- {
- lprcat("yes.\n Just one moment please \n"); nap(1000);
- if (gemstone==OLARNEYE)
- {
- amt = 250000-((gtime*7)/100)*100;
- if (amt<50000) amt=50000;
- }
- else amt = (255 & ivenarg[j]) * 100;
- lprintf("\nI can see this is an excellent stone, It is worth %d",(long)amt);
- lprcat("\nWould you like to sell it to us? "); yrepcount=0;
- if (getyn()=='y') { lprcat("yes\n"); c[GOLD]+=amt; iven[j]=0; }
- else lprcat("no thank you.\n");
- if (gemstone==OLARNEYE) lprcat("It is, of course, your privilege to keep the stone\n");
- }
- else lprcat("no\nO. K.\n");
- }
- }
-/*
- function for the trading post
- */
-static otradhead()
- {
- clear();
- lprcat("Welcome to the Larn Trading Post. We buy items that explorers no longer find\n");
- lprcat("useful. Since the condition of the items you bring in is not certain,\n");
- lprcat("and we incur great expense in reconditioning the items, we usually pay\n");
- lprcat("only 20% of their value were they to be new. If the items are badly\n");
- lprcat("damaged, we will pay only 10% of their new value.\n\n");
- }
-
-otradepost()
- {
- int i,j,value,isub,izarg;
- dnditm = dndcount = 0;
- nosignal = 1; /* disable signals */
- resetscroll(); otradhead();
- while (1)
- {
- lprcat("\nWhat item do you want to sell to us ["); standout("*");
- lprcat(" for list, or "); standout("escape"); lprcat("] ? ");
- i=0; while (i>'z' || (i<'a' && i!='*' && i!='\33' && i!='.')) i=getchar();
- if (i == '\33')
- { setscroll(); recalc(); drawscreen(); nosignal=0; /* enable signals */ return; }
- isub = i - 'a'; j=0;
- if (iven[isub]==OSCROLL) if (scrollname[ivenarg[isub]][0]==0)
- { j=1; cnsitm(); } /* can't sell unidentified item */
- if (iven[isub]==OPOTION) if (potionname[ivenarg[isub]][0]==0)
- { j=1; cnsitm(); } /* can't sell unidentified item */
- if (!j)
- if (i=='*') { clear(); qshowstr(); otradhead(); }
- else if (iven[isub]==0) lprintf("\nYou don't have item %c!",isub+'a');
- else
- {
- for (j=0; j<maxitm; j++)
- if ((itm[j].obj == iven[isub]) || (iven[isub] == ODIAMOND) || (iven[isub] == ORUBY) || (iven[isub] == OEMERALD) || (iven[isub] == OSAPPHIRE))
- {
- srcount=0; show3(isub); /* show what the item was */
- if ((iven[isub] == ODIAMOND) || (iven[isub] == ORUBY)
- || (iven[isub] == OEMERALD) || (iven[isub] == OSAPPHIRE))
- value = 20*ivenarg[isub];
- else
- if ((itm[j].obj == OSCROLL) || (itm[j].obj == OPOTION)) value = 2*itm[j+ivenarg[isub]].price;
- else
- {
- izarg=ivenarg[isub]; value = itm[j].price; /* appreciate if a +n object */
- if (izarg >= 0) value *= 2;
- while ((izarg-- > 0) && ((value=14*(67+value)/10) < 500000));
- }
- lprintf("\nItem (%c) is worth %d gold pieces to us. Do you want to sell it? ",i,(long)value);
- yrepcount=0;
- if (getyn()=='y')
- {
- lprcat("yes\n"); c[GOLD]+=value;
- if (c[WEAR] == isub) c[WEAR] = -1;
- if (c[WIELD] == isub) c[WIELD] = -1;
- if (c[SHIELD] == isub) c[SHIELD] = -1;
- adjustcvalues(iven[isub],ivenarg[isub]);
- iven[isub]=0;
- }
- else lprcat("no thanks.\n");
- j = maxitm+100; /* get out of the inner loop */
- }
- if (j <= maxitm+2) lprcat("\nSo sorry, but we are not authorized to accept that item.");
- }
- }
- }
-
-cnsitm()
- { lprcat("\nSorry, we can't accept unidentified objects."); }
-
-/*
- * for the Larn Revenue Service
- */
-olrs()
- {
- int i,first;
- unsigned long amt;
- first = nosignal = 1; /* disable signals */
- clear(); resetscroll(); cursor(1,4);
- lprcat("Welcome to the Larn Revenue Service district office. How can we help you?");
- while (1)
- {
- if (first) { first=0; goto nxt; }
- cursors();
- lprcat("\n\nYour wish? [(");
- standout("p");
- lprcat(") pay taxes, or ");
- standout("escape");
- lprcat("] "); yrepcount=0;
- i=0; while (i!='p' && i!='\33') i=getchar();
- switch(i)
- {
- case 'p': lprcat("pay taxes\nHow much? "); amt = readnum((long)c[GOLD]);
- if (amt<0) { lprcat("\nSorry, but we can't take negative gold\n"); amt=0; } else
- if (amt>c[GOLD]) lprcat(" You don't have that much.\n");
- else c[GOLD] -= paytaxes((long)amt);
- break;
-
- case '\33': nosignal = 0; /* enable signals */
- setscroll(); drawscreen(); return;
- };
-
-nxt: cursor(1,6);
- if (outstanding_taxes>0)
- lprintf("You presently owe %d gp in taxes. ",(long)outstanding_taxes);
- else
- lprcat("You do not owe us any taxes. ");
- cursor(1,8);
- if (c[GOLD]>0)
- lprintf("You have %6d gp. ",(long)c[GOLD]);
- else
- lprcat("You have no gold pieces. ");
- }
- }
diff --git a/games/larn/tok.c b/games/larn/tok.c
deleted file mode 100644
index 19991ec..0000000
--- a/games/larn/tok.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* tok.c Larn is copyrighted 1986 by Noah Morgan. */
-/* $FreeBSD$ */
-#include <sys/types.h>
-#ifdef SYSV
-#include <fcntl.h>
-#include <termio.h>
-#else /* SYSV */
-#include <sys/ioctl.h>
-#endif /* SYSV */
-#include "header.h"
-
-static char lastok=0;
-int yrepcount=0,dayplay=0;
-#ifndef FLUSHNO
-#define FLUSHNO 5
-#endif /* FLUSHNO */
-static int flushno=FLUSHNO; /* input queue flushing threshold */
-#define MAXUM 52 /* maximum number of user re-named monsters */
-#define MAXMNAME 40 /* max length of a monster re-name */
-static char usermonster[MAXUM][MAXMNAME]; /* the user named monster name goes here */
-static char usermpoint=0; /* the user monster pointer */
-
-/*
- lexical analyzer for larn
- */
-yylex()
- {
- char cc;
- int ic;
- if (hit2flag) { hit2flag=0; yrepcount=0; return(' '); }
- if (yrepcount>0) { --yrepcount; return(lastok); } else yrepcount=0;
- if (yrepcount==0) { bottomdo(); showplayer(); } /* show where the player is */
- lflush();
- while (1)
- {
- c[BYTESIN]++;
- if (ckpflag)
- if ((c[BYTESIN] % 400) == 0) /* check for periodic checkpointing */
- {
-#ifndef DOCHECKPOINTS
- savegame(ckpfile);
-#else
- wait(0); /* wait for other forks to finish */
- if (fork() == 0) { savegame(ckpfile); exit(0); }
-#endif
-
-
-#ifdef TIMECHECK
- if (dayplay==0)
- if (playable())
- {
- cursor(1,19);
- lprcat("\nSorry, but it is now time for work. Your game has been saved.\n"); beep();
- lflush(); savegame(savefilename); wizard=nomove=1; sleep(4);
- died(-257);
- }
-#endif /* TIMECHECK */
-
- }
-
- do /* if keyboard input buffer is too big, flush some of it */
- {
- ioctl(0,FIONREAD,&ic);
- if (ic>flushno) read(0,&cc,1);
- }
- while (ic>flushno);
-
- if (read(0,&cc,1) != 1) return(lastok = -1);
-
- if (cc == 'Y'-64) /* control Y -- shell escape */
- {
- resetscroll(); clear(); /* scrolling region, home, clear, no attributes */
- if ((ic=fork())==0) /* child */
- {
- /* revoke */
- setgid(getgid());
- execl("/bin/csh",(char *)0); exit(1);
- }
- wait(0);
- if (ic<0) /* error */
- {
- write(2,"Can't fork off a shell!\n",25); sleep(2);
- }
-
- setscroll();
- return(lastok = 'L'-64); /* redisplay screen */
- }
-
- if ((cc <= '9') && (cc >= '0'))
- { yrepcount = yrepcount*10 + cc - '0'; }
- else { if (yrepcount>0) --yrepcount; return(lastok = cc); }
- }
- }
-
-/*
- * flushall() Function to flush all type-ahead in the input buffer
- */
-flushall()
- {
- char cc;
- int ic;
- for (;;) /* if keyboard input buffer is too big, flush some of it */
- {
- ioctl(0,FIONREAD,&ic);
- if (ic<=0) return;
- while (ic>0) { read(0,&cc,1); --ic; } /* gobble up the byte */
- }
- }
-
-/*
- function to set the desired hardness
- enter with hard= -1 for default hardness, else any desired hardness
- */
-sethard(hard)
- int hard;
- {
- int j,k,i;
- j=c[HARDGAME]; hashewon();
- if (restorflag==0) /* don't set c[HARDGAME] if restoring game */
- {
- if (hard >= 0) c[HARDGAME]= hard;
- }
- else c[HARDGAME]=j; /* set c[HARDGAME] to proper value if restoring game */
-
- if (k=c[HARDGAME])
- for (j=0; j<=MAXMONST+8; j++)
- {
- i = ((6+k)*monster[j].hitpoints+1)/6;
- monster[j].hitpoints = (i<0) ? 32767 : i;
- i = ((6+k)*monster[j].damage+1)/5;
- monster[j].damage = (i>127) ? 127 : i;
- i = (10*monster[j].gold)/(10+k);
- monster[j].gold = (i>32767) ? 32767 : i;
- i = monster[j].armorclass - k;
- monster[j].armorclass = (i< -127) ? -127 : i;
- i = (7*monster[j].experience)/(7+k) + 1;
- monster[j].experience = (i<=0) ? 1 : i;
- }
- }
-
-/*
- function to read and process the larn options file
- */
-readopts()
- {
- char *i;
- int j,k;
- int flag;
- flag=1; /* set to 0 if he specifies a name for his character */
- if (lopen(optsfile) < 0)
- {
- strcpy(logname,loginname); return; /* user name if no character name */
- }
- i = " ";
- while (*i)
- {
- if ((i=(char *)lgetw()) == 0) break; /* check for EOF */
- while ((*i==' ') || (*i=='\t')) i++; /* eat leading whitespace */
- switch(*i)
- {
- case 'b': if (strcmp(i,"bold-objects") == 0) boldon=1;
- break;
-
- case 'e': if (strcmp(i,"enable-checkpointing") == 0) ckpflag=1;
- break;
-
- case 'i': if (strcmp(i,"inverse-objects") == 0) boldon=0;
- break;
-
- case 'f': if (strcmp(i,"female") == 0) sex=0; /* male or female */
- break;
-
- case 'm': if (strcmp(i,"monster:")== 0) /* name favorite monster */
- {
- if ((i=lgetw())==0) break;
- if (strlen(i)>=MAXMNAME) i[MAXMNAME-1]=0;
- strcpy(usermonster[usermpoint],i);
- if (usermpoint >= MAXUM) break; /* defined all of em */
- if (isalpha(j=usermonster[usermpoint][0]))
- {
- for (k=1; k<MAXMONST+8; k++) /* find monster */
- if (monstnamelist[k] == j)
- {
- monster[k].name = &usermonster[usermpoint++][0];
- break;
- }
- }
- }
- else if (strcmp(i,"male") == 0) sex=1;
- break;
-
- case 'n': if (strcmp(i,"name:") == 0) /* defining players name */
- {
- if ((i=lgetw())==0) break;
- if (strlen(i)>=LOGNAMESIZE) i[LOGNAMESIZE-1]=0;
- strcpy(logname,i); flag=0;
- }
- else if (strcmp(i,"no-introduction") == 0) nowelcome=1;
- else if (strcmp(i,"no-beep") == 0) nobeep=1;
- break;
-
- case 'p': if (strcmp(i,"process-name:")== 0)
- {
- if ((i=lgetw())==0) break;
- if (strlen(i)>=PSNAMESIZE) i[PSNAMESIZE-1]=0;
- strcpy(psname,i);
- }
- else if (strcmp(i,"play-day-play") == 0) dayplay=1;
- break;
-
- case 's': if (strcmp(i,"savefile:") == 0) /* defining savefilename */
- {
- if ((i=lgetw())==0) break;
- strcpy(savefilename,i); flag=0;
- }
- break;
- };
- }
- if (flag) strcpy(logname,loginname);
- }
-
diff --git a/games/mille/Makefile b/games/mille/Makefile
deleted file mode 100644
index eed1465..0000000
--- a/games/mille/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= mille
-SRCS= comp.c end.c extern.c init.c mille.c misc.c move.c print.c \
- roll.c save.c types.c varpush.c
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-MAN= mille.6
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
-
diff --git a/games/mille/comp.c b/games/mille/comp.c
deleted file mode 100644
index 2cbf896..0000000
--- a/games/mille/comp.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)comp.c 1.1 (Berkeley) 4/1/82
- */
-
-# define V_VALUABLE 40
-
-void
-calcmove(void)
-{
- CARD card;
- int *value;
- PLAY *pp, *op;
- bool foundend, cango, canstop, foundlow;
- unsgn int i, count200, badcount, nummin, nummax, diff;
- int curmin, curmax;
- CARD safe, oppos;
- int valbuf[HAND_SZ], count[NUM_CARDS];
- bool playit[HAND_SZ];
-
- wmove(Score, ERR_Y, ERR_X); /* get rid of error messages */
- wclrtoeol(Score);
- pp = &Player[COMP];
- op = &Player[PLAYER];
- safe = 0;
- cango = 0;
- canstop = FALSE;
- foundend = FALSE;
-
- /* Try for a Coup Forre, and see what we have. */
- for (i = 0; i < NUM_CARDS; i++)
- count[i] = 0;
- for (i = 0; i < HAND_SZ; i++) {
- card = pp->hand[i];
- switch (card) {
- case C_STOP: case C_CRASH:
- case C_FLAT: case C_EMPTY:
- if ((playit[i] = canplay(pp, op, card)) != NULL)
- canstop = TRUE;
- goto norm;
- case C_LIMIT:
- if ((playit[i] = canplay(pp, op, card))
- && Numseen[C_25] == Numcards[C_25]
- && Numseen[C_50] == Numcards[C_50])
- canstop = TRUE;
- goto norm;
- case C_25: case C_50: case C_75:
- case C_100: case C_200:
- if ((playit[i] = canplay(pp, op, card))
- && pp->mileage + Value[card] == End)
- foundend = TRUE;
- goto norm;
- default:
- playit[i] = canplay(pp, op, card);
-norm:
- if (playit[i])
- ++cango;
- break;
- case C_GAS_SAFE: case C_DRIVE_SAFE:
- case C_SPARE_SAFE: case C_RIGHT_WAY:
- if (pp->battle == opposite(card) ||
- (pp->speed == C_LIMIT && card == C_RIGHT_WAY)) {
- Movetype = M_PLAY;
- Card_no = i;
- return;
- }
- ++safe;
- playit[i] = TRUE;
- break;
- }
- if (card >= 0)
- ++count[card];
- }
-
- /* No Coup Forre. Draw to fill hand, then restart, as needed. */
- if (pp->hand[0] == C_INIT && Topcard > Deck) {
- Movetype = M_DRAW;
- return;
- }
-
-#ifdef DEBUG
- if (Debug)
- fprintf(outf, "CALCMOVE: cango = %d, canstop = %d, safe = %d\n",
- cango, canstop, safe);
-#endif
- if (foundend)
- foundend = !check_ext(TRUE);
- for (i = 0; safe && i < HAND_SZ; i++) {
- if (issafety(pp->hand[i])) {
- if (onecard(op) || (foundend && cango && !canstop)) {
-#ifdef DEBUG
- if (Debug)
- fprintf(outf,
- "CALCMOVE: onecard(op) = %d, foundend = %d\n",
- onecard(op), foundend);
-#endif
-playsafe:
- Movetype = M_PLAY;
- Card_no = i;
- return;
- }
- oppos = opposite(pp->hand[i]);
- if (Numseen[oppos] == Numcards[oppos] &&
- !(pp->hand[i] == C_RIGHT_WAY &&
- Numseen[C_LIMIT] != Numcards[C_LIMIT]))
- goto playsafe;
- else if (!cango
- && (op->can_go || !pp->can_go || Topcard < Deck)) {
- card = (Topcard - Deck) - roll(1, 10);
- if ((!pp->mileage) != (!op->mileage))
- card -= 7;
-#ifdef DEBUG
- if (Debug)
- fprintf(outf,
- "CALCMOVE: card = %d, DECK_SZ / 4 = %d\n",
- card, DECK_SZ / 4);
-#endif
- if (card < DECK_SZ / 4)
- goto playsafe;
- }
- safe--;
- playit[i] = cango;
- }
- }
- if (!pp->can_go && !isrepair(pp->battle))
- Numneed[opposite(pp->battle)]++;
-redoit:
- foundlow = (cango || count[C_END_LIMIT] != 0
- || Numseen[C_LIMIT] == Numcards[C_LIMIT]
- || pp->safety[S_RIGHT_WAY] != S_UNKNOWN);
- foundend = FALSE;
- count200 = pp->nummiles[C_200];
- badcount = 0;
- curmax = -1;
- curmin = 101;
- nummin = -1;
- nummax = -1;
- value = valbuf;
- for (i = 0; i < HAND_SZ; i++) {
- card = pp->hand[i];
- if (issafety(card) || playit[i] == (cango != 0)) {
-#ifdef DEBUG
- if (Debug)
- fprintf(outf, "CALCMOVE: switch(\"%s\")\n",
- C_name[card]);
-#endif
- switch (card) {
- case C_25: case C_50:
- diff = End - pp->mileage;
- /* avoid getting too close */
- if (Topcard > Deck && cango && diff <= 100
- && diff / Value[card] > count[card]
- && (card == C_25 || diff % 50 == 0)) {
- if (card == C_50 && diff - 50 == 25
- && count[C_25] > 0)
- goto okay;
- *value = 0;
- if (--cango <= 0)
- goto redoit;
- break;
- }
-okay:
- *value = (Value[card] >> 3);
- if (pp->speed == C_LIMIT)
- ++*value;
- else
- --*value;
- if (!foundlow
- && (card == C_50 || count[C_50] == 0)) {
- *value = (pp->mileage ? 10 : 20);
- foundlow = TRUE;
- }
- goto miles;
- case C_200:
- if (++count200 > 2) {
- *value = 0;
- break;
- }
- case C_75: case C_100:
- *value = (Value[card] >> 3);
- if (pp->speed == C_LIMIT)
- --*value;
- else
- ++*value;
-miles:
- if (pp->mileage + Value[card] > End)
- *value = (End == 700 ? card : 0);
- else if (pp->mileage + Value[card] == End) {
- *value = (foundend ? card : V_VALUABLE);
- foundend = TRUE;
- }
- break;
- case C_END_LIMIT:
- if (pp->safety[S_RIGHT_WAY] != S_UNKNOWN)
- *value = (pp->safety[S_RIGHT_WAY] ==
- S_PLAYED ? -1 : 1);
- else if (pp->speed == C_LIMIT &&
- End - pp->mileage <= 50)
- *value = 1;
- else if (pp->speed == C_LIMIT
- || Numseen[C_LIMIT] != Numcards[C_LIMIT]) {
- safe = S_RIGHT_WAY;
- oppos = C_LIMIT;
- goto repair;
- }
- else {
- *value = 0;
- --count[C_END_LIMIT];
- }
- break;
- case C_REPAIRS: case C_SPARE: case C_GAS:
- safe = safety(card) - S_CONV;
- oppos = opposite(card);
- if (pp->safety[safe] != S_UNKNOWN)
- *value = (pp->safety[safe] ==
- S_PLAYED ? -1 : 1);
- else if (pp->battle != oppos
- && (Numseen[oppos] == Numcards[oppos] ||
- Numseen[oppos] + count[card] >
- Numcards[oppos])) {
- *value = 0;
- --count[card];
- }
- else {
-repair:
- *value = Numcards[oppos] * 6;
- *value += Numseen[card] -
- Numseen[oppos];
- if (!cango)
- *value /= (count[card]*count[card]);
- count[card]--;
- }
- break;
- case C_GO:
- if (pp->safety[S_RIGHT_WAY] != S_UNKNOWN)
- *value = (pp->safety[S_RIGHT_WAY] ==
- S_PLAYED ? -1 : 2);
- else if (pp->can_go
- && Numgos + count[C_GO] == Numneed[C_GO]) {
- *value = 0;
- --count[C_GO];
- }
- else {
- *value = Numneed[C_GO] * 3;
- *value += (Numseen[C_GO] - Numgos);
- *value /= (count[C_GO] * count[C_GO]);
- count[C_GO]--;
- }
- break;
- case C_LIMIT:
- if (op->mileage + 50 >= End) {
- *value = (End == 700 && !cango);
- break;
- }
- if (canstop || (cango && !op->can_go))
- *value = 1;
- else {
- *value = (pp->safety[S_RIGHT_WAY] !=
- S_UNKNOWN ? 2 : 3);
- safe = S_RIGHT_WAY;
- oppos = C_END_LIMIT;
- goto normbad;
- }
- break;
- case C_CRASH: case C_EMPTY: case C_FLAT:
- safe = safety(card) - S_CONV;
- oppos = opposite(card);
- *value = (pp->safety[safe]!=S_UNKNOWN ? 3 : 4);
-normbad:
- if (op->safety[safe] == S_PLAYED)
- *value = -1;
- else {
- *value *= Numneed[oppos] +
- Numseen[oppos] + 2;
- if (!pp->mileage || foundend ||
- onecard(op))
- *value += 5;
- if (op->mileage == 0 || onecard(op))
- *value += 5;
- if (op->speed == C_LIMIT)
- *value -= 3;
- if (cango &&
- pp->safety[safe] != S_UNKNOWN)
- *value += 3;
- if (!cango)
- *value /= ++badcount;
- }
- break;
- case C_STOP:
- if (op->safety[S_RIGHT_WAY] == S_PLAYED)
- *value = -1;
- else {
- *value = (pp->safety[S_RIGHT_WAY] !=
- S_UNKNOWN ? 3 : 4);
- *value *= Numcards[C_STOP] +
- Numseen[C_GO];
- if (!pp->mileage || foundend ||
- onecard(op))
- *value += 5;
- if (!cango)
- *value /= ++badcount;
- if (op->mileage == 0)
- *value += 5;
- if ((card == C_LIMIT &&
- op->speed == C_LIMIT) ||
- !op->can_go)
- *value -= 5;
- if (cango && pp->safety[S_RIGHT_WAY] !=
- S_UNKNOWN)
- *value += 5;
- }
- break;
- case C_GAS_SAFE: case C_DRIVE_SAFE:
- case C_SPARE_SAFE: case C_RIGHT_WAY:
- *value = cango ? 0 : 101;
- break;
- case C_INIT:
- *value = 0;
- break;
- }
- }
- else
- *value = cango ? 0 : 101;
- if (card != C_INIT) {
- if (*value >= curmax) {
- nummax = i;
- curmax = *value;
- }
- if (*value <= curmin) {
- nummin = i;
- curmin = *value;
- }
- }
-#ifdef DEBUG
- if (Debug)
- mvprintw(i + 6, 2, "%3d %-14s", *value,
- C_name[pp->hand[i]]);
-#endif
- value++;
- }
- if (!pp->can_go && !isrepair(pp->battle))
- Numneed[opposite(pp->battle)]++;
- if (cango) {
-play_it:
- mvaddstr(MOVE_Y + 1, MOVE_X, "PLAY\n");
- Movetype = M_PLAY;
- Card_no = nummax;
- }
- else {
- if (issafety(pp->hand[nummin])) { /* NEVER discard a safety */
- nummax = nummin;
- goto play_it;
- }
- mvaddstr(MOVE_Y + 1, MOVE_X, "DISCARD\n");
- Movetype = M_DISCARD;
- Card_no = nummin;
- }
- mvprintw(MOVE_Y + 2, MOVE_X, "%16s", C_name[pp->hand[Card_no]]);
-}
-
-/*
- * Return true if the given player could conceivably win with his next card.
- */
-bool
-onecard(PLAY *pp)
-{
- CARD bat, spd, card;
-
- bat = pp->battle;
- spd = pp->speed;
- card = -1;
- if (pp->can_go || ((isrepair(bat) || bat == C_STOP || spd == C_LIMIT) &&
- Numseen[S_RIGHT_WAY] != 0) ||
- (bat >= 0 && Numseen[safety(bat)] != 0))
- switch (End - pp->mileage) {
- case 200:
- if (pp->nummiles[C_200] == 2)
- return FALSE;
- card = C_200;
- /* FALLTHROUGH */
- case 100:
- case 75:
- if (card == -1)
- card = (End - pp->mileage == 75 ? C_75 : C_100);
- if (spd == C_LIMIT)
- return Numseen[S_RIGHT_WAY] == 0;
- case 50:
- case 25:
- if (card == -1)
- card = (End - pp->mileage == 25 ? C_25 : C_50);
- return Numseen[card] != Numcards[card];
- }
- return FALSE;
-}
-
-bool
-canplay(PLAY *pp, PLAY *op, CARD card)
-{
- switch (card) {
- case C_200:
- if (pp->nummiles[C_200] == 2)
- break;
- /* FALLTHROUGH */
- case C_75: case C_100:
- if (pp->speed == C_LIMIT)
- break;
- /* FALLTHROUGH */
- case C_50:
- if (pp->mileage + Value[card] > End)
- break;
- /* FALLTHROUGH */
- case C_25:
- if (pp->can_go)
- return TRUE;
- break;
- case C_EMPTY: case C_FLAT: case C_CRASH:
- case C_STOP:
- if (op->can_go && op->safety[safety(card) - S_CONV] != S_PLAYED)
- return TRUE;
- break;
- case C_LIMIT:
- if (op->speed != C_LIMIT &&
- op->safety[S_RIGHT_WAY] != S_PLAYED &&
- op->mileage + 50 < End)
- return TRUE;
- break;
- case C_GAS: case C_SPARE: case C_REPAIRS:
- if (pp->battle == opposite(card))
- return TRUE;
- break;
- case C_GO:
- if (!pp->can_go &&
- (isrepair(pp->battle) || pp->battle == C_STOP))
- return TRUE;
- break;
- case C_END_LIMIT:
- if (pp->speed == C_LIMIT)
- return TRUE;
- }
- return FALSE;
-}
diff --git a/games/mille/end.c b/games/mille/end.c
deleted file mode 100644
index 90a0668..0000000
--- a/games/mille/end.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)end.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)end.c 1.1 (Berkeley) 4/1/82
- */
-
-#ifndef EXTRAP
-void extrapolate(PLAY *);
-void undoex(void);
-#endif
-
-/*
- * print out the score as if it was final, and add the totals for
- * the end-of-games points to the user who deserves it (if any).
- */
-void
-finalscore(PLAY *pp)
-{
- int temp, tot, num;
-
- if (pp->was_finished == Finished)
- return;
-
- pp->was_finished = Finished;
- num = pp - Player;
- temp = num * 6 + 21 + 1;
- for (tot = 5; tot <= 9; tot++)
- mvaddstr(tot, temp, " 0");
- if (pp->mileage == End) {
- mvaddstr(5, temp, "40");
- tot = SC_TRIP;
- if (pp->nummiles[C_200] == 0) {
- mvaddstr(6, temp, "30");
- tot = SC_TRIP + SC_SAFE;
- }
- if (Topcard <= Deck) {
- mvaddstr(7, temp, "30");
- tot += SC_DELAY;
- }
- if (End == 1000) {
- mvaddstr(8, temp, "20");
- tot += SC_EXTENSION;
- }
- if (Player[other(num)].mileage == 0) {
- mvaddstr(9, temp, "50");
- tot += SC_SHUT_OUT;
- }
- pp->total += tot;
- pp->hand_tot += tot;
- }
-}
-
-# ifdef EXTRAP
-static int Last_tot[2]; /* last tot used for extrapolate */
-
-/*
- * print out the score as if it was final, and add the totals for
- * the end-of-games points to the user who deserves it (if any).
- */
-void
-extrapolate(PLAY *pp)
-{
- int x, num, tot, count;
-
- num = pp - Player;
- tot += SC_TRIP + SC_DELAY + SC_EXT;
- x = num * 6 + 21 + 3;
- for (tot = 5; tot <= 9; tot++)
- mvaddch(tot, x, '0');
- x -= 2;
- pp = &Player[other(num)];
- for (count = 0, tot = 0; tot < NUM_SAFE; tot++)
- if (pp->safety[tot] != S_PLAYED)
- count += SC_SAFE;
- mvprintw(3, x, "%3d", count);
- tot += count;
- if (count == 400) {
- mvaddstr(4, x, "30");
- tot += SC_ALL_SAFE;
- }
- pp = &Player[num];
- for (count = 0, tot = 0; tot < NUM_SAFE; tot++)
- if (pp->safety[tot] != S_PLAYED)
- count += SC_COUP / 10;
- mvprintw(4, x - 1, "%3d", count);
- tot += count;
- tot += 1000 - pp->mileage;
- mvaddstr(5, x, "40");
- mvaddstr(7, x, "30");
- mvaddstr(8, x, "20");
- if (pp->nummiles[C_200] == 0) {
- mvaddstr(6, x, "30");
- tot = SC_TRIP + SC_SAFE;
- }
- if (Player[other(num)].mileage == 0) {
- mvaddstr(9, x, "50");
- tot += SC_SHUT_OUT;
- }
- pp->total += tot;
- pp->hand_tot += tot;
- Last_tot[num] = tot;
-}
-
-void
-undoex(void)
-{
- reg PLAY *pp;
- reg int i;
-
- i = 0;
- for (pp = Player; pp < &Player[2]; pp++) {
- pp->total -= Last_tot[i];
- pp->hand_tot -= Last_tot[i++];
- }
-}
-# endif
-
diff --git a/games/mille/extern.c b/games/mille/extern.c
deleted file mode 100644
index 7eda243..0000000
--- a/games/mille/extern.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)extern.c 1.1 (Berkeley) 4/1/82
- */
-
-bool Debug, /* set if debugging code on */
- Finished, /* set if current hand is finished */
- Next, /* set if changing players */
- On_exit, /* set if game saved on exiting */
- Order, /* set if hand should be sorted */
- Saved; /* set if game just saved */
-
-char *Fromfile = NULL, /* startup file for game */
- Initstr[100]; /* initial string for error field */
-
-const char *C_fmt = "%-18.18s", /* format for printing cards */
- *_cn[NUM_CARDS] = { /* Card name buffer */
- "",
- "25",
- "50",
- "75",
- "100",
- "200",
- "Out of Gas",
- "Flat Tire",
- "Accident",
- "Stop",
- "Speed Limit",
- "Gasoline",
- "Spare Tire",
- "Repairs",
- "Go",
- "End of Limit",
- "Extra Tank",
- "Puncture Proof",
- "Driving Ace",
- "Right of Way"
- },
- **C_name = &_cn[1]; /* Card names */
-
-int Card_no, /* Card number for current move */
- End, /* End value for current hand */
- Handstart = COMP, /* Player who starts hand */
- Movetype, /* Current move type */
- Play, /* Current player */
- Numgos, /* Number of Go cards used by computer */
- Window = W_SMALL, /* Current window wanted */
- Numseen[NUM_CARDS], /* Number of cards seen in current hand */
- Value[NUM_MILES] = { /* Value of mileage cards */
- 25, 50, 75, 100, 200
- },
- Numcards[NUM_CARDS] = { /* Number of cards in deck */
- 10, /* C_25 */
- 10, /* C_50 */
- 10, /* C_75 */
- 12, /* C_100 */
- 4, /* C_200 */
- 2, /* C_EMPTY */
- 2, /* C_FLAT */
- 2, /* C_CRASH */
- 4, /* C_STOP */
- 3, /* C_LIMIT */
- 6, /* C_GAS */
- 6, /* C_SPARE */
- 6, /* C_REPAIRS */
- 14, /* C_GO */
- 6, /* C_END_LIMIT */
- 1, /* C_GAS_SAFE */
- 1, /* C_SPARE_SAFE */
- 1, /* C_DRIVE_SAFE */
- 1, /* C_RIGHT_WAY */
- 0 /* C_INIT */
- },
- Numneed[NUM_CARDS] = { /* number of cards needed per hand */
- 0, /* C_25 */
- 0, /* C_50 */
- 0, /* C_75 */
- 0, /* C_100 */
- 0, /* C_200 */
- 2, /* C_EMPTY */
- 2, /* C_FLAT */
- 2, /* C_CRASH */
- 4, /* C_STOP */
- 3, /* C_LIMIT */
- 2, /* C_GAS */
- 2, /* C_SPARE */
- 2, /* C_REPAIRS */
- 10, /* C_GO */
- 3, /* C_END_LIMIT */
- 1, /* C_GAS_SAFE */
- 1, /* C_SPARE_SAFE */
- 1, /* C_DRIVE_SAFE */
- 1, /* C_RIGHT_WAY */
- 0 /* C_INIT */
- };
-
-CARD Discard, /* Top of discard pile */
- Sh_discard, /* Last discard card shown */
- *Topcard, /* Pointer to next card to be picked */
- Opposite[NUM_CARDS] = { /* Opposites of each card */
- C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
- C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
- C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
- },
- Deck[DECK_SZ] = { /* Current deck */
- C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
- C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
- C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
- C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100,
- C_100, C_100, C_100,
- C_200, C_200, C_200, C_200,
- C_EMPTY, C_EMPTY,
- C_FLAT, C_FLAT,
- C_CRASH, C_CRASH,
- C_STOP, C_STOP, C_STOP, C_STOP,
- C_LIMIT, C_LIMIT, C_LIMIT,
- C_GAS, C_GAS, C_GAS, C_GAS, C_GAS, C_GAS,
- C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE,
- C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS,
- C_REPAIRS,
- C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT,
- C_END_LIMIT,
- C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO,
- C_GO, C_GO, C_GO, C_GO,
- C_GAS_SAFE, C_SPARE_SAFE, C_DRIVE_SAFE, C_RIGHT_WAY
- };
-
-FILE *outf;
-
-PLAY Player[2]; /* Player descriptions */
-
-WINDOW *Board, /* Playing field screen */
- *Miles, /* Mileage screen */
- *Score; /* Score screen */
-
diff --git a/games/mille/init.c b/games/mille/init.c
deleted file mode 100644
index e84da96..0000000
--- a/games/mille/init.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)init.c 1.1 (Berkeley) 4/1/82
- */
-
-void
-init(void)
-{
- PLAY *pp;
- int i, j;
- CARD card;
-
- bzero(Numseen, sizeof Numseen);
- Numgos = 0;
-
- for (i = 0; i < 2; i++) {
- pp = &Player[i];
- pp->hand[0] = C_INIT;
- for (j = 0; j < NUM_SAFE; j++) {
- pp->safety[j] = S_UNKNOWN;
- pp->coups[j] = FALSE;
- }
- for (j = 1; j < HAND_SZ; j++) {
- pp->hand[j] = *--Topcard;
- if (i == COMP) {
- account(card = *Topcard);
- if (issafety(card))
- pp->safety[card - S_CONV] = S_IN_HAND;
- }
- }
- pp->mileage = 0;
- pp->hand_tot = 0;
- pp->safescore = 0;
- pp->coupscore = 0;
- pp->can_go = FALSE;
- pp->speed = C_INIT;
- pp->battle = C_INIT;
- pp->new_speed = FALSE;
- pp->new_battle = FALSE;
- for (j = 0; j < NUM_MILES; j++)
- pp->nummiles[j] = 0;
- }
- if (Order)
- sort(Player[PLAYER].hand);
- Discard = C_INIT;
- Finished = FALSE;
- End = 700;
-}
-
-void
-shuffle(void)
-{
- int i, r;
- CARD temp;
-
- for (i = 0; i < DECK_SZ; i++) {
- r = roll(1, DECK_SZ) - 1;
- if (r < 0 || r > DECK_SZ - 1) {
- fprintf(stderr, "shuffle: card no. error: %d\n", r);
- die(1);
- }
- temp = Deck[r];
- Deck[r] = Deck[i];
- Deck[i] = temp;
- }
- Topcard = &Deck[DECK_SZ];
-}
-
-void
-newboard(void)
-{
- int i;
- PLAY *pp;
- static int first = TRUE;
-
- if (first) {
- werase(Board);
- werase(Score);
- mvaddstr(5, 0, "--HAND--");
- mvaddch(6, 0, 'P');
- mvaddch(7, 0, '1');
- mvaddch(8, 0, '2');
- mvaddch(9, 0, '3');
- mvaddch(10, 0, '4');
- mvaddch(11, 0, '5');
- mvaddch(12, 0, '6');
- mvaddstr(13, 0, "--BATTLE--");
- mvaddstr(15, 0, "--SPEED--");
- mvaddstr(5, 20, "--DECK--");
- mvaddstr(7, 20, "--DISCARD--");
- mvaddstr(13, 20, "--BATTLE--");
- mvaddstr(15, 20, "--SPEED--");
- mvwaddstr(Miles, 0, 0, "--MILEAGE--");
- mvwaddstr(Miles, 0, 41, "--MILEAGE--");
- Sh_discard = -1;
- for (pp = Player; pp <= &Player[COMP]; pp++) {
- for (i = 0; i < HAND_SZ; i++)
- pp->sh_hand[i] = -1;
- pp->sh_battle = -1;
- pp->sh_speed = -1;
- pp->sh_mileage = -1;
- }
- first = FALSE;
- }
- else {
- for (i = 0; i < 5; i++) {
- move(i, 0);
- clrtoeol();
- }
- wmove(Miles, 1, 0);
- wclrtobot(Miles);
- wmove(Board, MOVE_Y + 1, MOVE_X);
- wclrtoeol(Board);
- wmove(Board, MOVE_Y + 2, MOVE_X);
- wclrtoeol(Board);
- }
- Sh_discard = -1;
- for (pp = Player; pp <= &Player[COMP]; pp++) {
- for (i = 0; i < NUM_SAFE; i++)
- pp->sh_safety[i] = FALSE;
- for (i = 0; i < NUM_MILES; i++)
- pp->sh_nummiles[i] = 0;
- pp->sh_safescore = -1;
- }
- newscore();
-}
-
-void
-newscore(void)
-{
- int i, new;
- PLAY *pp;
- static int was_full = -1;
- static int last_win = -1;
-
- if (was_full < 0)
- was_full = (Window != W_FULL);
- stdscr = Score;
- move(0, 22);
- new = FALSE;
- if (inch() != 'Y') {
- erase();
- mvaddstr(0, 22, "You Comp Value");
- mvaddstr(1, 2, "Milestones Played");
- mvaddstr(2, 8, "Each Safety");
- mvaddstr(3, 5, "All 4 Safeties");
- mvaddstr(4, 3, "Each Coup Fourre");
- mvaddstr(2, 37, "100");
- mvaddstr(3, 37, "300");
- mvaddstr(4, 37, "300");
- new = TRUE;
- }
- else if ((Window == W_FULL || Finished) ^ was_full) {
- move(5, 1);
- clrtobot();
- new = TRUE;
- }
- else if (Window != last_win)
- new = TRUE;
- if (new) {
- for (i = 0; i < SCORE_Y; i++)
- mvaddch(i, 0, '|');
- move(SCORE_Y - 1, 1);
- for (i = 0; i < SCORE_X; i++)
- addch('_');
- for (pp = Player; pp <= &Player[COMP]; pp++) {
- pp->sh_hand_tot = -1;
- pp->sh_total = -1;
- pp->sh_games = -1;
- pp->sh_safescore = -1;
- }
- }
- Player[PLAYER].was_finished = !Finished;
- Player[COMP].was_finished = !Finished;
- if (Window == W_FULL || Finished) {
- if (!was_full || new) {
- mvaddstr(5, 5, "Trip Completed");
- mvaddstr(6, 10, "Safe Trip");
- mvaddstr(7, 5, "Delayed Action");
- mvaddstr(8, 10, "Extension");
- mvaddstr(9, 11, "Shut-Out");
- mvaddstr(10, 21, "---- ---- -----");
- mvaddstr(11, 9, "Hand Total");
- mvaddstr(12, 20, "----- -----");
- mvaddstr(13, 6, "Overall Total");
- mvaddstr(14, 15, "Games");
- mvaddstr(5, 37, "400");
- mvaddstr(6, 37, "300");
- mvaddstr(7, 37, "300");
- mvaddstr(8, 37, "200");
- mvaddstr(9, 37, "500");
- }
- }
- else
- if (was_full || new) {
- mvaddstr(5, 21, "---- ---- -----");
- mvaddstr(6, 9, "Hand Total");
- mvaddstr(7, 20, "----- -----");
- mvaddstr(8, 6, "Overall Total");
- mvaddstr(9, 15, "Games");
- mvaddstr(11, 2, "p: pick");
- mvaddstr(12, 2, "u: use #");
- mvaddstr(13, 2, "d: discard #");
- mvaddstr(14, 2, "w: toggle window");
- mvaddstr(11, 21, "q: quit");
- if (!Order)
- mvaddstr(12, 21, "o: order hand");
- else
- mvaddstr(12, 21, "o: stop ordering");
- mvaddstr(13, 21, "s: save");
- mvaddstr(14, 21, "r: reprint");
- }
- stdscr = Board;
- was_full = (Window == W_FULL || Finished);
- last_win = Window;
-}
diff --git a/games/mille/mille.6 b/games/mille/mille.6
deleted file mode 100644
index 039b4d0..0000000
--- a/games/mille/mille.6
+++ /dev/null
@@ -1,378 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)mille.6 8.2 (Berkeley) 12/30/93
-.\" $FreeBSD$
-.\"
-.TH MILLE 6 "December 30, 1993"
-.UC 4
-.SH NAME
-mille \- play Mille Bornes
-.SH SYNOPSIS
-.B /usr/games/mille
-[ file ]
-.SH DESCRIPTION
-.I Mille
-plays a two-handed game reminiscent of
-the Parker Brother's game of Mille Bornes with you.
-The rules are described below.
-If a file name is given on the command line,
-the game saved in that file is started.
-.PP
-When a game is started up,
-the bottom of the score window will contain a list of commands.
-They are:
-.IP P
-Pick a card from the deck.
-This card is placed in the `P' slot in your hand.
-.IP D
-Discard a card from your hand.
-To indicate which card, type the number of the card in the hand
-(or \*(lqP\*(rq for the just-picked card) followed by a <RETURN> or <SPACE>.
-The <RETURN or <SPACE> is required to allow recovery from typos
-which can be very expensive, like discarding safeties.
-.IP U
-Use a card.
-The card is again indicated by its number, followed by a <RETURN> or <SPACE>.
-.IP O
-Toggle ordering the hand.
-By default off, if turned on it will sort the cards in your hand appropriately.
-This is not recommended for the impatient on slow terminals.
-.IP Q
-Quit the game.
-This will ask for confirmation, just to be sure.
-Hitting <DELETE> (or <RUBOUT>) is equivalent.
-.IP S
-Save the game in a file.
-If the game was started from a file,
-you will be given an opportunity to save it on the same file.
-If you don't wish to, or you did not start from a file,
-you will be asked for the file name.
-If you type a <RETURN> without a name,
-the save will be terminated and the game resumed.
-.IP R
-Redraw the screen from scratch.
-The command ^L (control `L') will also work.
-.IP W
-Toggle window type.
-This switches the score window between the startup window
-(with all the command names) and the end-of-game window.
-Using the end-of-game window
-saves time by eliminating the switch at the end of the game
-to show the final score.
-Recommended for hackers and other miscreants.
-.PP
-If you make a mistake, an error message will be printed
-on the last line of the score window, and a bell will beep.
-.PP
-At the end of each hand or game,
-you will be asked if you wish to play another.
-If not, it will ask you if you want to save the game.
-If you do, and the save is unsuccessful,
-play will be resumed as if you had said you wanted to play another hand/game.
-This allows you to use the
-.RB \*(lq S \*(rq
-command to reattempt the save.
-.SH AUTHOR
-Ken Arnold
-.br
-(The game itself is a product of Parker Brothers, Inc.)
-.SH "SEE ALSO"
-curses(3),
-.I "Screen Updating and Cursor Movement Optimization:"
-.IR "A Library Package" ,
-Ken Arnold
-.SH CARDS
-Here is some useful information.
-The number in parentheses after the card name
-is the number of that card in the deck:
-.sp
-.nf
-.ne 10
-.ta \w'Speed Limit (3)'u+3n \w'Speed Limit (3)'u+\w'End of Limit (6)'u+6n
-Hazard Repair Safety
-.sp
-Out of Gas (2) Gasoline (6) Extra Tank (1)
-Flat Tire (2) Spare Tire (6) Puncture Proof (1)
-Accident (2) Repairs (6) Driving Ace (1)
-Stop (4) Go (14) Right of Way (1)
-Speed Limit (3) End of Limit (6)
-.sp
-.ce
-25 \- (10), 50 \- (10), 75 \- (10), 100 \- (12), 200 \- (4)
-.sp
-.fi
-.DT
-.SH RULES
-.BR Object :
-The point of this game is to get a total of 5000 points in several hands.
-Each hand is a race to put down exactly 700 miles before your opponent does.
-Beyond the points gained by putting down milestones,
-there are several other ways of making points.
-.PP
-.BR Overview :
-The game is played with a deck of 101 cards.
-.I Distance
-cards represent a number of miles traveled.
-They come in denominations of 25, 50, 75, 100, and 200.
-When one is played,
-it adds that many miles to the player's trip so far this hand.
-.I Hazard
-cards are used to prevent your opponent from putting down Distance cards.
-They can only be played if your opponent has a
-.I Go
-card on top of the Battle pile.
-The cards are
-.IR "Out of Gas" ,
-.IR "Accident" ,
-.IR "Flat Tire" ,
-.IR "Speed Limit" ,
-and
-.IR "Stop" .
-.I Remedy
-cards fix problems caused by Hazard cards played on you by your opponent.
-The cards are
-.IR "Gasoline" ,
-.IR "Repairs" ,
-.IR "Spare Tire" ,
-.IR "End of Limit" ,
-and
-.IR "Go" .
-.I Safety
-cards prevent your opponent from putting specific Hazard cards on you
-in the first place.
-They are
-.IR "Extra Tank" ,
-.IR "Driving Ace" ,
-.IR "Puncture Proof" ,
-and
-.IR "Right of Way" ,
-and there are only one of each in the deck.
-.PP
-.BR "Board Layout" :
-The board is split into several areas.
-From top to bottom, they are:
-.B "SAFETY AREA"
-(unlabeled): This is where the safeties will be placed as they are played.
-.BR HAND :
-These are the cards in your hand.
-.BR BATTLE :
-This is the Battle pile.
-All the Hazard and Remedy Cards are played here, except the
-.I "Speed Limit"
-and
-.I "End of Limit"
-cards. Only the top card is displayed, as it is the only effective one.
-.BR SPEED :
-The Speed pile. The
-.I "Speed Limit"
-and
-.I "End of Limit"
-cards are played here
-to control the speed at which the player is allowed to put down miles.
-.BR MILEAGE :
-Miles are placed here.
-The total of the numbers shown here is the distance traveled so far.
-.PP
-.BR Play :
-The first pick alternates between the two players.
-Each turn usually starts with a pick from the deck.
-The player then plays a card, or if this is not possible or desirable,
-discards one. Normally, a play or discard of a single card
-constitutes a turn. If the card played is a safety, however,
-the same player takes another turn immediately.
-.PP
-This repeats until one of the players reaches 700 points or the deck runs out.
-If someone reaches 700, they have the option of going for an
-.IR Extension ,
-which means that the play continues until someone reaches 1000 miles.
-.PP
-.BR "Hazard and Remedy Cards" :
-Hazard Cards are played on your opponent's Battle and Speed piles.
-Remedy Cards are used for undoing the effects of your opponent's nastiness.
-.PP
-.RB "\ \ \ \ " Go
-(Green Light)
-must be the top card on your Battle pile for you to play any mileage,
-unless you have played the
-.I "Right of Way"
-card (see below).
-.br
-.RB "\ \ \ \ " Stop
-is played on your opponent's
-.I Go
-card to prevent them from playing mileage until they play a
-.I Go
-card.
-.br
-.RB "\ \ \ \ " "Speed Limit"
-is played on your opponent's Speed pile.
-Until they play an
-.I "End of Limit"
-they can only play 25 or 50 mile cards, presuming their
-.I Go
-card allows them to do even that.
-.br
-.RB "\ \ \ \ " "End of Limit"
-is played on your Speed pile to nullify a
-.I "Speed Limit"
-played by your opponent.
-.br
-.RB "\ \ \ \ " "Out of Gas"
-is played on your opponent's
-.I Go
-card. They must then play a
-.I Gasoline
-card, and then a
-.I Go
-card before they can play any more mileage.
-.br
-.RB "\ \ \ \ " "Flat Tire"
-is played on your opponent's
-.I Go
-card. They must then play a
-.I "Spare Tire"
-card, and then a
-.I Go
-card before they can play any more mileage.
-.br
-.RB "\ \ \ \ " "Accident"
-is played on your opponent's
-.I Go
-card. They must then play a
-.I Repairs
-card, and then a
-.I Go
-card before they can play any more mileage.
-.br
-.PP
-.BR "Safety Cards" :
-Safety cards prevent your opponent
-from playing the corresponding Hazard cards on you for the rest of the hand.
-It cancels an attack in progress, and
-.IR "always entitles the player to an extra turn" .
-.br
-.RB "\ \ \ \ " "Right of Way"
-prevents your opponent from playing both
-.I Stop
-and
-.I "Speed Limit"
-cards on you. It also acts as a permanent
-.I Go
-card for the rest of the hand, so you can play mileage
-as long as there is not a Hazard card on top of your Battle pile.
-In this case only, your opponent can play Hazard cards directly on a Remedy card
-other than a Go card.
-.br
-.RB "\ \ \ \ " "Extra Tank"
-When played, your opponent cannot play an
-.I "Out of Gas"
-on your Battle Pile.
-.br
-.RB "\ \ \ \ " "Puncture Proof"
-When played, your opponent cannot play a
-.I "Flat Tire"
-on your Battle Pile.
-.br
-.RB "\ \ \ \ " "Driving Ace"
-When played, your opponent cannot play an
-.I Accident
-on your Battle Pile.
-.PP
-.BR "Distance Cards" :
-Distance cards are played when you have a
-.I Go
-card on your Battle pile,
-or a Right of Way in your Safety area and are not stopped by a Hazard Card.
-They can be played in any combination that totals exactly 700 miles,
-except that
-.IR "you cannot play more than two 200 mile cards in one hand" .
-A hand ends whenever one player gets exactly 700 miles or the deck runs out.
-In that case, play continues until neither someone reaches 700,
-or neither player can use any cards in their hand.
-If the trip is completed after the deck runs out, this is called
-.IR "Delayed Action" .
-.PP
-.BR "Coup Fourr\o'\(aae'" :
-This is a French fencing term for a counter-thrust move as part of a parry
-to an opponent's attack.
-In current French colloquial language it means a sneaky, underhanded blow.
-In Mille Bornes, it is used as follows:
-If an opponent plays a Hazard card,
-and you have the corresponding Safety in your hand,
-you play it immediately, even
-.I before
-you draw. This immediately removes the Hazard card from your Battle pile,
-and protects you from that card for the rest of the game. This
-gives you more points (see \*(lqScoring\*(rq below).
-.PP
-.BR Scoring :
-Scores are totaled at the end of each hand,
-whether or not anyone completed the trip.
-The terms used in the Score window have the following meanings:
-.br
-.RB "\ \ \ \ " "Milestones Played" :
-Each player scores as many miles as they played before the trip ended.
-.br
-.RB "\ \ \ \ " "Each Safety" :
-100 points for each safety in the Safety area.
-.br
-.RB "\ \ \ \ " "All 4 Safeties" :
-300 points if all four safeties are played.
-.br
-.RB "\ \ \ \ " "Each Coup Fourr\o'\(aae'" :
-300 points for each Coup Fourr\o'\(aae' accomplished.
-.PP
-The following bonus scores can apply only to the winning player.
-.br
-.RB "\ \ \ \ " "Trip Completed" :
-400 points bonus for completing the trip to 700 or 1000.
-.br
-.RB "\ \ \ \ " "Safe Trip" :
-300 points bonus for completing the trip without using any 200 mile cards.
-.br
-.RB "\ \ \ \ " "Delayed Action" :
-300 points bonus for finishing after the deck was exhausted.
-.br
-.RB "\ \ \ \ " "Extension" :
-200 points bonus for completing a 1000 mile trip.
-.br
-.RB "\ \ \ \ " "Shut-Out" :
-500 points bonus for completing the trip
-before your opponent played any mileage cards.
-.PP
-Running totals are also kept for the current score for each player
-for the hand
-.RB ( "Hand Total" ),
-the game
-.RB ( "Overall Total" ),
-and number of games won
-.RB ( Games ).
diff --git a/games/mille/mille.c b/games/mille/mille.c
deleted file mode 100644
index e51c175..0000000
--- a/games/mille/mille.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1982, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mille.c 8.1 (Berkeley) 5/31/93";
-#else
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-#endif /* not lint */
-
-# include "mille.h"
-# include <signal.h>
-# ifdef attron
-# include <term.h>
-# endif /* attron */
-
-/*
- * @(#)mille.c 1.3 (Berkeley) 5/10/83
- */
-
-static void usage(void);
-
-int
-main(int ac, char *av[])
-{
-
- bool restore;
-
- /* revoke */
- setgid(getgid());
-
- if (strcmp(av[0], "a.out") == 0) {
- outf = fopen("q", "w");
- setbuf(outf, (char *)NULL);
- Debug = TRUE;
- }
- restore = FALSE;
- switch (ac) {
- case 2:
- rest_f(av[1]);
- restore = TRUE;
- case 1:
- break;
- default:
- usage();
- /* NOTREACHED */
- }
- Play = PLAYER;
- initscr();
- delwin(stdscr);
- stdscr = Board = newwin(BOARD_Y, BOARD_X, 0, 0);
- Score = newwin(SCORE_Y, SCORE_X, 0, 40);
- Miles = newwin(MILES_Y, MILES_X, 17, 0);
-#ifdef attron
- idlok(Board, TRUE);
- idlok(Score, TRUE);
- idlok(Miles, TRUE);
-#endif
- leaveok(Score, TRUE);
- leaveok(Miles, TRUE);
- clearok(curscr, TRUE);
- srandomdev();
- crmode();
- noecho();
- signal(SIGINT, rub);
- for (;;) {
- if (!restore || (Player[PLAYER].total >= 5000
- || Player[COMP].total >= 5000)) {
- if (Player[COMP].total < Player[PLAYER].total)
- Player[PLAYER].games++;
- else if (Player[COMP].total > Player[PLAYER].total)
- Player[COMP].games++;
- Player[COMP].total = 0;
- Player[PLAYER].total = 0;
- }
- do {
- if (!restore)
- Handstart = Play = other(Handstart);
- if (!restore || On_exit) {
- shuffle();
- init();
- }
- newboard();
- if (restore)
- mvwaddstr(Score, ERR_Y, ERR_X, Initstr);
- prboard();
- do {
- domove();
- if (Finished)
- newscore();
- prboard();
- } while (!Finished);
- check_more();
- restore = On_exit = FALSE;
- } while (Player[COMP].total < 5000
- && Player[PLAYER].total < 5000);
- }
-}
-
-static void
-usage(void)
-{
- fprintf(stderr, "usage: mille [restore_file]\n");
- exit(1);
-}
-
-/*
- * Routine to trap rubouts, and make sure they really want to
- * quit.
- */
-void
-rub(int sig __unused)
-{
-
- (void)signal(SIGINT, SIG_IGN);
- if (getyn(REALLYPROMPT))
- die(0);
- (void)signal(SIGINT, rub);
-}
-
-/*
- * Time to go beddy-by
- */
-void
-die(int code)
-{
-
- (void)signal(SIGINT, SIG_IGN);
- if (outf)
- fflush(outf);
- mvcur(0, COLS - 1, LINES - 1, 0);
- endwin();
- exit(code);
-}
diff --git a/games/mille/mille.h b/games/mille/mille.h
deleted file mode 100644
index f58d47e..0000000
--- a/games/mille/mille.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mille.h 8.1 (Berkeley) 5/31/93
- *
- * $FreeBSD$
- */
-
-# include <sys/types.h>
-# include <sys/uio.h>
-# include <ctype.h>
-# include <curses.h>
-# include <string.h>
-# include <stdlib.h>
-# include <unistd.h>
-
-/*
- * @(#)mille.h 1.1 (Berkeley) 4/1/82
- */
-
-/*
- * Miscellaneous constants
- */
-
-# define unsgn unsigned
-# define CARD short
-
-# define HAND_SZ 7 /* number of cards in a hand */
-# define DECK_SZ 101 /* number of cards in decks */
-# define NUM_SAFE 4 /* number of saftey cards */
-# define NUM_MILES 5 /* number of milestones types */
-# define NUM_CARDS 20 /* number of types of cards */
-# define BOARD_Y 17 /* size of board screen */
-# define BOARD_X 40
-# define MILES_Y 7 /* size of mileage screen */
-# define MILES_X 80
-# define SCORE_Y 17 /* size of score screen */
-# define SCORE_X 40
-# define MOVE_Y 10 /* Where to print move prompt */
-# define MOVE_X 20
-# define ERR_Y 15 /* Where to print errors */
-# define ERR_X 5
-# define EXT_Y 4 /* Where to put Extension */
-# define EXT_X 9
-
-# define PLAYER 0
-# define COMP 1
-
-# define W_SMALL 0 /* Small (initial) window */
-# define W_FULL 1 /* Full (final) window */
-
-/*
- * Move types
- */
-
-# define M_DISCARD 0
-# define M_DRAW 1
-# define M_PLAY 2
-# define M_ORDER 3
-
-/*
- * Scores
- */
-
-# define SC_SAFETY 100
-# define SC_ALL_SAFE 300
-# define SC_COUP 300
-# define SC_TRIP 400
-# define SC_SAFE 300
-# define SC_DELAY 300
-# define SC_EXTENSION 200
-# define SC_SHUT_OUT 500
-
-/*
- * safety descriptions
- */
-
-# define S_UNKNOWN 0 /* location of safety unknown */
-# define S_IN_HAND 1 /* safety in player's hand */
-# define S_PLAYED 2 /* safety has been played */
-# define S_GAS_SAFE 0 /* Gas safety card index */
-# define S_SPARE_SAFE 1 /* Tire safety card index */
-# define S_DRIVE_SAFE 2 /* Driveing safety card index */
-# define S_RIGHT_WAY 3 /* Right-of-Way card index */
-# define S_CONV 15 /* conversion from C_ to S_ */
-
-/*
- * card numbers
- */
-
-# define C_INIT -1
-# define C_25 0
-# define C_50 1
-# define C_75 2
-# define C_100 3
-# define C_200 4
-# define C_EMPTY 5
-# define C_FLAT 6
-# define C_CRASH 7
-# define C_STOP 8
-# define C_LIMIT 9
-# define C_GAS 10
-# define C_SPARE 11
-# define C_REPAIRS 12
-# define C_GO 13
-# define C_END_LIMIT 14
-# define C_GAS_SAFE 15
-# define C_SPARE_SAFE 16
-# define C_DRIVE_SAFE 17
-# define C_RIGHT_WAY 18
-
-/*
- * prompt types
- */
-
-# define MOVEPROMPT 0
-# define REALLYPROMPT 1
-# define ANOTHERHANDPROMPT 2
-# define ANOTHERGAMEPROMPT 3
-# define SAVEGAMEPROMPT 4
-# define SAMEFILEPROMPT 5
-# define FILEPROMPT 6
-# define EXTENSIONPROMPT 7
-# define OVERWRITEFILEPROMPT 8
-
-# ifdef SYSV
-# define srandom(x) srand(x)
-# define random() rand()
-# endif
-
-# if defined(SYSV) || defined(__FreeBSD__)
-# ifndef attron
-# define erasechar() _tty.c_cc[VERASE]
-# define killchar() _tty.c_cc[VKILL]
-# endif
-# else
-# ifndef erasechar
-# define erasechar() _tty.sg_erase
-# define killchar() _tty.sg_kill
-# endif
-# endif /* SYSV */
-
-typedef struct {
- bool coups[NUM_SAFE];
- bool can_go;
- bool new_battle;
- bool new_speed;
- short safety[NUM_SAFE];
- short sh_safety[NUM_SAFE];
- short nummiles[NUM_MILES];
- short sh_nummiles[NUM_MILES];
- CARD hand[HAND_SZ];
- CARD sh_hand[HAND_SZ];
- CARD battle;
- CARD sh_battle;
- CARD speed;
- CARD sh_speed;
- int mileage;
- int sh_mileage;
- int hand_tot;
- int sh_hand_tot;
- int safescore;
- int sh_safescore;
- int coupscore;
- int total;
- int sh_total;
- int games;
- int sh_games;
- int was_finished;
-} PLAY;
-
-/*
- * macros
- */
-
-# define other(x) (1 - x)
-# define nextplay() (Play = other(Play))
-# define nextwin(x) (1 - x)
-# define opposite(x) (Opposite[x])
-# define issafety(x) (x >= C_GAS_SAFE)
-
-/*
- * externals
- */
-
-extern bool Debug, Finished, Next, On_exit, Order, Saved;
-
-extern const char *C_fmt, **C_name;
-extern char *Fromfile, Initstr[];
-
-extern int Card_no, End, Handstart, Movetype, Numcards[], Numgos,
- Numneed[], Numseen[NUM_CARDS], Play, Value[], Window;
-
-extern CARD Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard,
- *Topcard;
-
-extern FILE *outf;
-
-extern PLAY Player[2];
-
-extern WINDOW *Board, *Miles, *Score;
-
-/*
- * functions
- */
-
-void account(CARD);
-void calcmove(void);
-bool canplay(PLAY *, PLAY *, CARD);
-bool check_ext(bool);
-void check_more(void);
-void die(int);
-void domove(void);
-bool error(const char *, ...);
-#ifdef EXTRAP
-void extrapolate(PLAY *);
-#endif
-void finalscore(PLAY *);
-CARD getcard(void);
-bool getyn(int);
-void init(void);
-int isrepair(CARD);
-void newboard(void);
-void newscore(void);
-bool onecard(PLAY *);
-void prboard(void);
-void prompt(int);
-void prscore(void);
-char readch(void);
-bool rest_f(char *);
-int roll(int, int);
-void rub(int);
-CARD safety(CARD);
-bool save(void);
-void shuffle(void);
-void sort(CARD *);
-void varpush(int, int (*)(int, void *, size_t));
-#ifdef EXTRAP
-void undoex(void);
-#endif
diff --git a/games/mille/misc.c b/games/mille/misc.c
deleted file mode 100644
index aded942..0000000
--- a/games/mille/misc.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/file.h>
-#include <stdarg.h>
-#include <termios.h>
-
-#include "mille.h"
-
-
-# ifdef attron
-# include <term.h>
-# define _tty cur_term->Nttyb
-# endif /* attron */
-
-/*
- * @(#)misc.c 1.2 (Berkeley) 3/28/83
- */
-
-#define NUMSAFE 4
-
-/* VARARGS1 */
-bool
-error(const char *str, ...)
-{
- va_list arg;
-
- va_start(arg, str);
- stdscr = Score;
- move(ERR_Y, ERR_X);
- vw_printw(stdscr, str, arg);
- va_end(arg);
- clrtoeol();
- putchar('\07');
- refresh();
- stdscr = Board;
- return FALSE;
-}
-
-CARD
-getcard(void)
-{
- int c, c1;
-
- for (;;) {
- while ((c = readch()) == '\n' || c == '\r' || c == ' ')
- continue;
- if (islower(c))
- c = toupper(c);
- if (c == killchar() || c == erasechar())
- return -1;
- addstr(unctrl(c));
- clrtoeol();
- switch (c) {
- case '1': case '2': case '3':
- case '4': case '5': case '6':
- c -= '0';
- break;
- case '0': case 'P': case 'p':
- c = 0;
- break;
- default:
- putchar('\07');
- addch('\b');
- if (!isprint(c))
- addch('\b');
- c = -1;
- break;
- }
- refresh();
- if (c >= 0) {
- while ((c1=readch()) != '\r' && c1 != '\n' && c1 != ' ')
- if (c1 == killchar())
- return -1;
- else if (c1 == erasechar()) {
- addch('\b');
- clrtoeol();
- refresh();
- goto cont;
- }
- else
- write(0, "\07", 1);
- return c;
- }
-cont: ;
- }
-}
-
-bool
-check_ext(bool forcomp)
-{
-
- if (End == 700)
- if (Play == PLAYER) {
- if (getyn(EXTENSIONPROMPT)) {
-extend:
- if (!forcomp)
- End = 1000;
- return TRUE;
- }
- else {
-done:
- if (!forcomp)
- Finished = TRUE;
- return FALSE;
- }
- }
- else {
- PLAY *pp, *op;
- int i, safe, miles;
-
- pp = &Player[COMP];
- op = &Player[PLAYER];
- for (safe = 0, i = 0; i < NUMSAFE; i++)
- if (pp->safety[i] != S_UNKNOWN)
- safe++;
- if (safe < 2)
- goto done;
- if (op->mileage == 0 || onecard(op)
- || (op->can_go && op->mileage >= 500))
- goto done;
- for (miles = 0, i = 0; i < NUMSAFE; i++)
- if (op->safety[i] != S_PLAYED
- && pp->safety[i] == S_UNKNOWN)
- miles++;
- if (miles + safe == NUMSAFE)
- goto extend;
- for (miles = 0, i = 0; i < HAND_SZ; i++)
- if ((safe = pp->hand[i]) <= C_200)
- miles += Value[safe];
- if (miles + (Topcard - Deck) * 3 > 1000)
- goto extend;
- goto done;
- }
- else
- goto done;
-}
-
-/*
- * Get a yes or no answer to the given question. Saves are
- * also allowed. Return TRUE if the answer was yes, FALSE if no.
- */
-bool
-getyn(int promptno)
-{
- char c;
-
- Saved = FALSE;
- for (;;) {
- leaveok(Board, FALSE);
- prompt(promptno);
- clrtoeol();
- refresh();
- switch (c = readch()) {
- case 'n': case 'N':
- addch('N');
- refresh();
- leaveok(Board, TRUE);
- return FALSE;
- case 'y': case 'Y':
- addch('Y');
- refresh();
- leaveok(Board, TRUE);
- return TRUE;
- case 's': case 'S':
- addch('S');
- refresh();
- Saved = save();
- continue;
- case CTRL('L'):
- wrefresh(curscr);
- break;
- default:
- addstr(unctrl(c));
- refresh();
- putchar('\07');
- break;
- }
- }
-}
-
-/*
- * Check to see if more games are desired. If not, and game
- * came from a saved file, make sure that they don't want to restore
- * it. Exit appropriately.
- */
-void
-check_more(void)
-{
-
- On_exit = TRUE;
- if (Player[PLAYER].total >= 5000 || Player[COMP].total >= 5000)
- if (getyn(ANOTHERGAMEPROMPT))
- return;
- else {
- /*
- * must do accounting normally done in main()
- */
- if (Player[PLAYER].total > Player[COMP].total)
- Player[PLAYER].games++;
- else if (Player[PLAYER].total < Player[COMP].total)
- Player[COMP].games++;
- Player[COMP].total = 0;
- Player[PLAYER].total = 0;
- }
- else
- if (getyn(ANOTHERHANDPROMPT))
- return;
- if (!Saved && getyn(SAVEGAMEPROMPT))
- if (!save())
- return;
- die(0);
-}
-
-char
-readch(void)
-{
- int cnt;
- static char c;
-
- for (cnt = 0; read(0, &c, 1) <= 0; cnt++)
- if (cnt > 100)
- exit(1);
- return c;
-}
diff --git a/games/mille/move.c b/games/mille/move.c
deleted file mode 100644
index 25aa3b5..0000000
--- a/games/mille/move.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <termios.h>
-
-#include "mille.h"
-#include <unctrl.h>
-
-# ifdef attron
-# include <term.h>
-# define _tty cur_term->Nttyb
-# endif /* attron */
-
-/*
- * @(#)move.c 1.2 (Berkeley) 3/28/83
- */
-
-#undef CTRL
-#define CTRL(c) (c - 'A' + 1)
-
-const char *Movenames[] = {
- "M_DISCARD", "M_DRAW", "M_PLAY", "M_ORDER"
- };
-
-static void check_go(void);
-static void getmove(void);
-static int haspicked(PLAY *);
-static bool playcard(PLAY *);
-
-void
-domove(void)
-{
- PLAY *pp;
- int i, j;
- bool goodplay;
-
- pp = &Player[Play];
- if (Play == PLAYER)
- getmove();
- else
- calcmove();
- Next = FALSE;
- goodplay = TRUE;
- switch (Movetype) {
- case M_DISCARD:
- if (haspicked(pp)) {
- if (pp->hand[Card_no] == C_INIT)
- if (Card_no == 6)
- Finished = TRUE;
- else
- error("no card there");
- else {
- if (issafety(pp->hand[Card_no])) {
- error("discard a safety?");
- goodplay = FALSE;
- break;
- }
- Discard = pp->hand[Card_no];
- pp->hand[Card_no] = C_INIT;
- Next = TRUE;
- if (Play == PLAYER)
- account(Discard);
- }
- }
- else
- error("must pick first");
- break;
- case M_PLAY:
- goodplay = playcard(pp);
- break;
- case M_DRAW:
- Card_no = 0;
- if (Topcard <= Deck)
- error("no more cards");
- else if (haspicked(pp))
- error("already picked");
- else {
- pp->hand[0] = *--Topcard;
-#ifdef DEBUG
- if (Debug)
- fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
-#endif
-acc:
- if (Play == COMP) {
- account(*Topcard);
- if (issafety(*Topcard))
- pp->safety[*Topcard-S_CONV] = S_IN_HAND;
- }
- if (pp->hand[1] == C_INIT && Topcard > Deck) {
- Card_no = 1;
- pp->hand[1] = *--Topcard;
-#ifdef DEBUG
- if (Debug)
- fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
-#endif
- goto acc;
- }
- pp->new_battle = FALSE;
- pp->new_speed = FALSE;
- }
- break;
-
- case M_ORDER:
- break;
- }
- /*
- * move blank card to top by one of two methods. If the
- * computer's hand was sorted, the randomness for picking
- * between equally valued cards would be lost
- */
- if (Order && Movetype != M_DRAW && goodplay && pp == &Player[PLAYER])
- sort(pp->hand);
- else
- for (i = 1; i < HAND_SZ; i++)
- if (pp->hand[i] == C_INIT) {
- for (j = 0; pp->hand[j] == C_INIT; j++)
- if (j >= HAND_SZ) {
- j = 0;
- break;
- }
- pp->hand[i] = pp->hand[j];
- pp->hand[j] = C_INIT;
- }
- if (Topcard <= Deck)
- check_go();
- if (Next)
- nextplay();
-}
-
-/*
- * Check and see if either side can go. If they cannot,
- * the game is over
- */
-static void
-check_go(void)
-{
- CARD card;
- PLAY *pp, *op;
- int i;
-
- for (pp = Player; pp < &Player[2]; pp++) {
- op = (pp == &Player[COMP] ? &Player[PLAYER] : &Player[COMP]);
- for (i = 0; i < HAND_SZ; i++) {
- card = pp->hand[i];
- if (issafety(card) || canplay(pp, op, card)) {
-#ifdef DEBUG
- if (Debug) {
- fprintf(outf, "CHECK_GO: can play %s (%d), ", C_name[card], card);
- fprintf(outf, "issafety(card) = %d, ", issafety(card));
- fprintf(outf, "canplay(pp, op, card) = %d\n", canplay(pp, op, card));
- }
-#endif
- return;
- }
-#ifdef DEBUG
- else if (Debug)
- fprintf(outf, "CHECK_GO: cannot play %s\n",
- C_name[card]);
-#endif
- }
- }
- Finished = TRUE;
-}
-
-static bool
-playcard(PLAY *pp)
-{
- int v;
- CARD card;
-
- /*
- * check and see if player has picked
- */
- switch (pp->hand[Card_no]) {
- default:
- if (!haspicked(pp))
-mustpick:
- return error("must pick first");
- case C_GAS_SAFE: case C_SPARE_SAFE:
- case C_DRIVE_SAFE: case C_RIGHT_WAY:
- break;
- }
-
- card = pp->hand[Card_no];
-#ifdef DEBUG
- if (Debug)
- fprintf(outf, "PLAYCARD: Card = %s\n", C_name[card]);
-#endif
- Next = FALSE;
- switch (card) {
- case C_200:
- if (pp->nummiles[C_200] == 2)
- return error("only two 200's per hand");
- case C_100: case C_75:
- if (pp->speed == C_LIMIT)
- return error("limit of 50");
- case C_50:
- if (pp->mileage + Value[card] > End)
- return error("puts you over %d", End);
- case C_25:
- if (!pp->can_go)
- return error("cannot move now");
- pp->nummiles[card]++;
- v = Value[card];
- pp->total += v;
- pp->hand_tot += v;
- if ((pp->mileage += v) == End)
- check_ext(FALSE);
- break;
-
- case C_GAS: case C_SPARE: case C_REPAIRS:
- if (pp->battle != opposite(card))
- return error("can't play \"%s\"", C_name[card]);
- pp->battle = card;
- if (pp->safety[S_RIGHT_WAY] == S_PLAYED)
- pp->can_go = TRUE;
- break;
-
- case C_GO:
- if (pp->battle != C_INIT && pp->battle != C_STOP
- && !isrepair(pp->battle))
- return error("cannot play \"Go\" on a \"%s\"",
- C_name[pp->battle]);
- pp->battle = C_GO;
- pp->can_go = TRUE;
- break;
-
- case C_END_LIMIT:
- if (pp->speed != C_LIMIT)
- return error("not limited");
- pp->speed = C_END_LIMIT;
- break;
-
- case C_EMPTY: case C_FLAT: case C_CRASH:
- case C_STOP:
- pp = &Player[other(Play)];
- if (!pp->can_go)
- return error("opponent cannot go");
- else if (pp->safety[safety(card) - S_CONV] == S_PLAYED)
-protected:
- return error("opponent is protected");
- pp->battle = card;
- pp->new_battle = TRUE;
- pp->can_go = FALSE;
- pp = &Player[Play];
- break;
-
- case C_LIMIT:
- pp = &Player[other(Play)];
- if (pp->speed == C_LIMIT)
- return error("opponent has limit");
- if (pp->safety[S_RIGHT_WAY] == S_PLAYED)
- goto protected;
- pp->speed = C_LIMIT;
- pp->new_speed = TRUE;
- pp = &Player[Play];
- break;
-
- case C_GAS_SAFE: case C_SPARE_SAFE:
- case C_DRIVE_SAFE: case C_RIGHT_WAY:
- if (pp->battle == opposite(card)
- || (card == C_RIGHT_WAY && pp->speed == C_LIMIT)) {
- if (!(card == C_RIGHT_WAY && !isrepair(pp->battle))) {
- pp->battle = C_GO;
- pp->can_go = TRUE;
- }
- if (card == C_RIGHT_WAY && pp->speed == C_LIMIT)
- pp->speed = C_INIT;
- if (pp->new_battle
- || (pp->new_speed && card == C_RIGHT_WAY)) {
- pp->coups[card - S_CONV] = TRUE;
- pp->total += SC_COUP;
- pp->hand_tot += SC_COUP;
- pp->coupscore += SC_COUP;
- }
- }
- /*
- * if not coup, must pick first
- */
- else if (pp->hand[0] == C_INIT && Topcard > Deck)
- goto mustpick;
- pp->safety[card - S_CONV] = S_PLAYED;
- pp->total += SC_SAFETY;
- pp->hand_tot += SC_SAFETY;
- if ((pp->safescore += SC_SAFETY) == NUM_SAFE * SC_SAFETY) {
- pp->total += SC_ALL_SAFE;
- pp->hand_tot += SC_ALL_SAFE;
- }
- if (card == C_RIGHT_WAY) {
- if (pp->speed == C_LIMIT)
- pp->speed = C_INIT;
- if (pp->battle == C_STOP || pp->battle == C_INIT) {
- pp->can_go = TRUE;
- pp->battle = C_INIT;
- }
- if (!pp->can_go && isrepair(pp->battle))
- pp->can_go = TRUE;
- }
- Next = -1;
- break;
-
- case C_INIT:
- error("no card there");
- Next = -1;
- break;
- }
- if (pp == &Player[PLAYER])
- account(card);
- pp->hand[Card_no] = C_INIT;
- Next = (Next == -1 ? FALSE : TRUE);
- return TRUE;
-}
-
-static void
-getmove(void)
-{
- char c;
-#ifdef DEBUG
- char *sp;
-#endif
-#ifdef EXTRAP
- static bool last_ex = FALSE; /* set if last command was E */
-
- if (last_ex) {
- undoex();
- prboard();
- last_ex = FALSE;
- }
-#endif
- for (;;) {
- prompt(MOVEPROMPT);
- leaveok(Board, FALSE);
- refresh();
- while ((c = readch()) == killchar() || c == erasechar())
- continue;
- if (islower(c))
- c = toupper(c);
- if (isprint(c) && !isspace(c)) {
- addch(c);
- refresh();
- }
- switch (c) {
- case 'P': /* Pick */
- Movetype = M_DRAW;
- goto ret;
- case 'U': /* Use Card */
- case 'D': /* Discard Card */
- if ((Card_no = getcard()) < 0)
- break;
- Movetype = (c == 'U' ? M_PLAY : M_DISCARD);
- goto ret;
- case 'O': /* Order */
- Order = !Order;
- if (Window == W_SMALL) {
- if (!Order)
- mvwaddstr(Score, 12, 21,
- "o: order hand");
- else
- mvwaddstr(Score, 12, 21,
- "o: stop ordering");
- wclrtoeol(Score);
- }
- Movetype = M_ORDER;
- goto ret;
- case 'Q': /* Quit */
- rub(0); /* Same as a rubout */
- break;
- case 'W': /* Window toggle */
- Window = nextwin(Window);
- newscore();
- prscore();
- wrefresh(Score);
- break;
- case 'R': /* Redraw screen */
- case CTRL('L'):
- wrefresh(curscr);
- break;
- case 'S': /* Save game */
- On_exit = FALSE;
- save();
- break;
- case 'E': /* Extrapolate */
-#ifdef EXTRAP
- if (last_ex)
- break;
- Finished = TRUE;
- if (Window != W_FULL)
- newscore();
- prscore(FALSE);
- wrefresh(Score);
- last_ex = TRUE;
- Finished = FALSE;
-#else
- error("%c: command not implemented", c);
-#endif
- break;
- case '\r': /* Ignore RETURNs and */
- case '\n': /* Line Feeds */
- case ' ': /* Spaces */
- case '\0': /* and nulls */
- break;
-#ifdef DEBUG
- case 'Z': /* Debug code */
- if (!Debug && outf == NULL) {
- char buf[MAXPATHLEN];
-
- prompt(FILEPROMPT);
- leaveok(Board, FALSE);
- refresh();
- sp = buf;
- while ((*sp = readch()) != '\n') {
- if (*sp == killchar())
- goto over;
- else if (*sp == erasechar()) {
- if (--sp < buf)
- sp = buf;
- else {
- addch('\b');
- if (*sp < ' ')
- addch('\b');
- clrtoeol();
- }
- }
- else
- addstr(unctrl(*sp++));
- refresh();
- }
- *sp = '\0';
- leaveok(Board, TRUE);
- if ((outf = fopen(buf, "w")) == NULL)
- perror(buf);
- setbuf(outf, (char *)NULL);
- }
- Debug = !Debug;
- break;
-#endif
- default:
- error("unknown command: %s", unctrl(c));
- break;
- }
- }
-ret:
- leaveok(Board, TRUE);
-}
-/*
- * return whether or not the player has picked
- */
-static int
-haspicked(PLAY *pp)
-{
- int card;
-
- if (Topcard <= Deck)
- return TRUE;
- switch (pp->hand[Card_no]) {
- case C_GAS_SAFE: case C_SPARE_SAFE:
- case C_DRIVE_SAFE: case C_RIGHT_WAY:
- card = 1;
- break;
- default:
- card = 0;
- break;
- }
- return (pp->hand[card] != C_INIT);
-}
-
-void
-account(CARD card)
-{
- CARD oppos;
-
- if (card == C_INIT)
- return;
- ++Numseen[card];
- if (Play == COMP)
- switch (card) {
- case C_GAS_SAFE:
- case C_SPARE_SAFE:
- case C_DRIVE_SAFE:
- oppos = opposite(card);
- Numgos += Numcards[oppos] - Numseen[oppos];
- break;
- case C_CRASH:
- case C_FLAT:
- case C_EMPTY:
- case C_STOP:
- Numgos++;
- break;
- }
-}
-
-void
-prompt(int promptno)
-{
- static const char *names[] = {
- ">>:Move:",
- "Really?",
- "Another hand?",
- "Another game?",
- "Save game?",
- "Same file?",
- "file:",
- "Extension?",
- "Overwrite file?",
- };
- static int last_prompt = -1;
-
- if (promptno == last_prompt)
- move(MOVE_Y, MOVE_X + strlen(names[promptno]) + 1);
- else {
- move(MOVE_Y, MOVE_X);
- if (promptno == MOVEPROMPT)
- standout();
- addstr(names[promptno]);
- if (promptno == MOVEPROMPT)
- standend();
- addch(' ');
- last_prompt = promptno;
- }
- clrtoeol();
-}
-
-void
-sort(CARD *hand)
-{
- CARD *cp, *tp;
- CARD temp;
-
- cp = hand;
- hand += HAND_SZ;
- for ( ; cp < &hand[-1]; cp++)
- for (tp = cp + 1; tp < hand; tp++)
- if (*cp > *tp) {
- temp = *cp;
- *cp = *tp;
- *tp = temp;
- }
-}
diff --git a/games/mille/print.c b/games/mille/print.c
deleted file mode 100644
index 45f567b..0000000
--- a/games/mille/print.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)print.c 1.1 (Berkeley) 4/1/82
- */
-
-# define COMP_STRT 20
-# define CARD_STRT 2
-
-static void show_card(int, int, CARD, CARD *);
-static void show_score(int, int, int, int *);
-
-void
-prboard(void)
-{
- PLAY *pp;
- int i, j, k, temp;
-
- for (k = 0; k < 2; k++) {
- pp = &Player[k];
- temp = k * COMP_STRT + CARD_STRT;
- for (i = 0; i < NUM_SAFE; i++)
- if (pp->safety[i] == S_PLAYED && !pp->sh_safety[i]) {
- mvaddstr(i, temp, C_name[i + S_CONV]);
- if (pp->coups[i])
- mvaddch(i, temp - CARD_STRT, '*');
- pp->sh_safety[i] = TRUE;
- }
- show_card(14, temp, pp->battle, &pp->sh_battle);
- show_card(16, temp, pp->speed, &pp->sh_speed);
- for (i = C_25; i <= C_200; i++) {
- const char *name;
- int end;
-
- if (pp->nummiles[i] == pp->sh_nummiles[i])
- continue;
-
- name = C_name[i];
- temp = k * 40;
- end = pp->nummiles[i];
- for (j = pp->sh_nummiles[i]; j < end; j++)
- mvwaddstr(Miles, i + 1, (j << 2) + temp, name);
- pp->sh_nummiles[i] = end;
- }
- }
- prscore();
- temp = CARD_STRT;
- pp = &Player[PLAYER];
- for (i = 0; i < HAND_SZ; i++)
- show_card(i + 6, temp, pp->hand[i], &pp->sh_hand[i]);
- mvprintw(6, COMP_STRT + CARD_STRT, "%2d", Topcard - Deck);
- show_card(8, COMP_STRT + CARD_STRT, Discard, &Sh_discard);
- if (End == 1000) {
- move(EXT_Y, EXT_X);
- standout();
- addstr("Extension");
- standend();
- }
- wrefresh(Board);
- wrefresh(Miles);
- wrefresh(Score);
-}
-
-/*
- * show_card:
- * Show the given card if it is different from the last one shown
- */
-static void
-show_card(int y, int x, CARD c, CARD *lc)
-{
-
- if (c == *lc)
- return;
-
- mvprintw(y, x, C_fmt, C_name[c]);
- *lc = c;
-}
-
-static char Score_fmt[] = "%4d";
-
-void
-prscore(void)
-{
- PLAY *pp;
- int x;
-
- stdscr = Score;
- for (pp = Player; pp < &Player[2]; pp++) {
- x = (pp - Player) * 6 + 21;
- show_score(1, x, pp->mileage, &pp->sh_mileage);
- if (pp->safescore != pp->sh_safescore) {
- mvprintw(2, x, Score_fmt, pp->safescore);
- if (pp->safescore == 400)
- mvaddstr(3, x + 1, "300");
- else
- mvaddstr(3, x + 1, " 0");
- mvprintw(4, x, Score_fmt, pp->coupscore);
- pp->sh_safescore = pp->safescore;
- }
- if (Window == W_FULL || Finished) {
-#ifdef EXTRAP
- if (for_real)
- finalscore(pp);
- else
- extrapolate(pp);
-#else
- finalscore(pp);
-#endif
- show_score(11, x, pp->hand_tot, &pp->sh_hand_tot);
- show_score(13, x, pp->total, &pp->sh_total);
- show_score(14, x, pp->games, &pp->sh_games);
- }
- else {
- show_score(6, x, pp->hand_tot, &pp->sh_hand_tot);
- show_score(8, x, pp->total, &pp->sh_total);
- show_score(9, x, pp->games, &pp->sh_games);
- }
- }
- stdscr = Board;
-}
-
-/*
- * show_score:
- * Show a score value if it is different from the last time we
- * showed it.
- */
-static void
-show_score(int y, int x, int s, int *ls)
-{
-
- if (s == *ls)
- return;
-
- mvprintw(y, x, Score_fmt, s);
- *ls = s;
-}
diff --git a/games/mille/roll.c b/games/mille/roll.c
deleted file mode 100644
index 74b8cb2..0000000
--- a/games/mille/roll.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)roll.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * This routine rolls ndie nside-sided dice.
- *
- * @(#)roll.c 1.1 (Berkeley) 4/1/82
- *
- */
-
-int
-roll(int ndie, int nsides)
-{
- int tot;
-
- tot = 0;
- while (ndie--)
- tot += random() % nsides + 1;
- return tot;
-}
diff --git a/games/mille/save.c b/games/mille/save.c
deleted file mode 100644
index f52fbf7..0000000
--- a/games/mille/save.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <fcntl.h>
-#include <string.h>
-#include <termios.h>
-#include <time.h>
-#include <unctrl.h>
-#include <unistd.h>
-
-#include "mille.h"
-
-# ifdef attron
-# include <term.h>
-# define _tty cur_term->Nttyb
-# endif /* attron */
-
-/*
- * @(#)save.c 1.2 (Berkeley) 3/28/83
- */
-
-typedef struct stat STAT;
-
-/*
- * This routine saves the current game for use at a later date
- */
-
-bool
-save(void)
-{
- extern int errno;
- char *sp;
- int loutf;
- time_t *tp;
- char buf[80];
- time_t tme;
- STAT junk;
-
- sp = NULL;
- tp = &tme;
- if (Fromfile && getyn(SAMEFILEPROMPT))
- strcpy(buf, Fromfile);
- else {
-over:
- prompt(FILEPROMPT);
- leaveok(Board, FALSE);
- refresh();
- sp = buf;
- while ((*sp = readch()) != '\n') {
- if (*sp == killchar())
- goto over;
- else if (*sp == erasechar()) {
- if (--sp < buf)
- sp = buf;
- else {
- addch('\b');
- /*
- * if the previous char was a control
- * char, cover up two characters.
- */
- if (*sp < ' ')
- addch('\b');
- clrtoeol();
- }
- }
- else {
- addstr(unctrl(*sp));
- ++sp;
- }
- refresh();
- }
- *sp = '\0';
- leaveok(Board, TRUE);
- }
-
- /*
- * check for existing files, and confirm overwrite if needed
- */
-
- if (sp == buf || (!Fromfile && stat(buf, &junk) > -1
- && getyn(OVERWRITEFILEPROMPT) == FALSE))
- return FALSE;
-
- if ((loutf = creat(buf, 0644)) < 0) {
- error(strerror(errno));
- return FALSE;
- }
- mvwaddstr(Score, ERR_Y, ERR_X, buf);
- wrefresh(Score);
- time(tp); /* get current time */
- strcpy(buf, ctime(tp));
- sp = buf;
- for (; *sp != '\n'; sp++)
- continue;
- *sp = '\0';
- varpush(loutf, write);
- close(loutf);
- wprintw(Score, " [%s]", buf);
- wclrtoeol(Score);
- wrefresh(Score);
- return TRUE;
-}
-
-/*
- * This does the actual restoring. It returns TRUE if the
- * backup was made on exiting, in which case certain things must
- * be cleaned up before the game starts.
- */
-bool
-rest_f(char *file)
-{
- char *sp;
- int inf;
- char buf[80];
- STAT sbuf;
-
- if ((inf = open(file, 0)) < 0) {
- perror(file);
- exit(1);
- }
- if (fstat(inf, &sbuf) < 0) { /* get file stats */
- perror(file);
- exit(1);
- }
- varpush(inf, read);
- close(inf);
- strcpy(buf, ctime(&sbuf.st_mtime));
- for (sp = buf; *sp != '\n'; sp++)
- continue;
- *sp = '\0';
- /*
- * initialize some necessary values
- */
- (void)sprintf(Initstr, "%s [%s]\n", file, buf);
- Fromfile = file;
- return !On_exit;
-}
-
diff --git a/games/mille/types.c b/games/mille/types.c
deleted file mode 100644
index 2c3839b..0000000
--- a/games/mille/types.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)types.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "mille.h"
-
-/*
- * @(#)types.c 1.1 (Berkeley) 4/1/82
- */
-
-int
-isrepair(CARD card)
-{
-
- return card == C_GAS || card == C_SPARE || card == C_REPAIRS || card == C_INIT;
-}
-
-CARD
-safety(CARD card)
-{
-
- switch (card) {
- case C_EMPTY:
- case C_GAS:
- case C_GAS_SAFE:
- return C_GAS_SAFE;
- case C_FLAT:
- case C_SPARE:
- case C_SPARE_SAFE:
- return C_SPARE_SAFE;
- case C_CRASH:
- case C_REPAIRS:
- case C_DRIVE_SAFE:
- return C_DRIVE_SAFE;
- case C_GO:
- case C_STOP:
- case C_RIGHT_WAY:
- case C_LIMIT:
- case C_END_LIMIT:
- return C_RIGHT_WAY;
- }
- /* NOTREACHED */
- exit(EXIT_FAILURE);
-}
-
diff --git a/games/mille/varpush.c b/games/mille/varpush.c
deleted file mode 100644
index ba98123..0000000
--- a/games/mille/varpush.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)varpush.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <paths.h>
-# include "mille.h"
-
-/*
- * @(#)varpush.c 1.1 (Berkeley) 4/1/82
- */
-
-/*
- * push variables around via the routine func() on the file
- * channel file. func() is either read or write.
- */
-void
-varpush(int file, int (*func)())
-{
- int temp;
-
- (*func)(file, (char *) &Debug, sizeof Debug);
- (*func)(file, (char *) &Finished, sizeof Finished);
- (*func)(file, (char *) &Order, sizeof Order);
- (*func)(file, (char *) &End, sizeof End);
- (*func)(file, (char *) &On_exit, sizeof On_exit);
- (*func)(file, (char *) &Handstart, sizeof Handstart);
- (*func)(file, (char *) &Numgos, sizeof Numgos);
- (*func)(file, (char *) Numseen, sizeof Numseen);
- (*func)(file, (char *) &Play, sizeof Play);
- (*func)(file, (char *) &Window, sizeof Window);
- (*func)(file, (char *) Deck, sizeof Deck);
- (*func)(file, (char *) &Discard, sizeof Discard);
- (*func)(file, (char *) Player, sizeof Player);
- if (func == read) {
- read(file, (char *) &temp, sizeof temp);
- Topcard = &Deck[temp];
-#ifdef DEBUG
- if (Debug) {
- char buf[80];
-over:
- printf("Debug file:");
- fgets(buf, 80, stdin);
- if ((outf = fopen(buf, "w")) == NULL) {
- perror(buf);
- goto over;
- }
- if (strcmp(buf, _PATH_DEVNULL) != 0)
- setbuf(outf, (char *)NULL);
- }
-#endif
- }
- else {
- temp = Topcard - Deck;
- write(file, (char *) &temp, sizeof temp);
- }
-}
diff --git a/games/phantasia/COPYRIGHT b/games/phantasia/COPYRIGHT
deleted file mode 100644
index 71a58b3..0000000
--- a/games/phantasia/COPYRIGHT
+++ /dev/null
@@ -1,24 +0,0 @@
-This entire subtree is explicitly not copyrighted.
-The following notice applies to all files found here. None of
-these files contain AT&T proprietary source code.
-_____________________________________________________________________________
-
-/* DISCLAIMER:
- *
- * This game is distributed for free as is. It is not guaranteed to work
- * in every conceivable environment. It is not even guaranteed to work
- * in ANY environment.
- *
- * This game is distributed without notice of copyright, therefore it
- * may be used in any manner the recipient sees fit. However, the
- * author assumes no responsibility for maintaining or revising this
- * game, in its original form, or any derivitives thereof.
- *
- * The author shall not be responsible for any loss, cost, or damage,
- * including consequential damage, caused by reliance on this material.
- *
- * The author makes no warranties, express or implied, including warranties
- * of merchantability or fitness for a particular purpose or use.
- *
- * AT&T is in no way connected with this game.
- */
diff --git a/games/phantasia/Makefile b/games/phantasia/Makefile
deleted file mode 100644
index 8c79652..0000000
--- a/games/phantasia/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= phantasia
-SRCS= main.c fight.c io.c interplayer.c gamesupport.c misc.c phantglobs.c
-DPADD= ${LIBM} ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lm -lcurses -lcompat
-DATAFILES=characs gold lastdead mess monsters motd scoreboard void
-HIDEGAME=hidegame
-MAN= phantasia.6
-CLEANFILES=${DATAFILES} cross-phantglobs.o map setup setup.o stamp.setuprun
-
-all: stamp.setuprun
-
-build-tools: setup
-
-cross-phantglobs.o: phantglobs.c
- ${CC} ${CFLAGS} -c -o ${.TARGET} ${.ALLSRC}
-
-stamp.setuprun: monsters.asc setup
- ./setup -m ${.CURDIR}/monsters.asc
- touch ${.TARGET}
-
-setup: cross-phantglobs.o setup.o ${LIBM}
- ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC:M*.o} -lm
-
-beforeinstall:
-.for file in ${DATAFILES}
-.if !exists(${DESTDIR}/var/games/phantasia/${file})
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 660 \
- ${file} ${DESTDIR}/var/games/phantasia
-.endif
-.endfor
-
-# Make Phantasia map. Change the map commands reflect your installation.
-# PLOTDEVICE is used for plotting the map. Change as appropriate.
-map: map.c
- ${CC} -static -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
- ./map | plot > /dev/tty
-
-.include <bsd.prog.mk>
diff --git a/games/phantasia/OWNER b/games/phantasia/OWNER
deleted file mode 100644
index 28387fe..0000000
--- a/games/phantasia/OWNER
+++ /dev/null
@@ -1,6 +0,0 @@
- Edward Estes
- AT&T
- 5555 Touhy Ave.
- Skokie, IL 60077
- (312) 982-3969
- ihnp4!ttrde!estes
diff --git a/games/phantasia/README b/games/phantasia/README
deleted file mode 100644
index d56a621..0000000
--- a/games/phantasia/README
+++ /dev/null
@@ -1,82 +0,0 @@
-June 25, 1986
-
-
-This is a much modified version of Phantasia. It is intended to fix
-all reported bug fixes, enhance the game, and speed up the game.
-
-I have to thank Chris Robertson for many ideas which have made the game
-faster, and more user-friendly. Most of her changes/additions are
-incorporated in this latest versions, although perhaps not in the exact
-manner of her design. I left out a few items which were not in keeping
-with the spirit of the game. (For example, I didn't like the extra lives
-and the pausing of the game. I think it's too easy even WITHOUT that stuff.)
-
-CHANGES:
-
- - Wormholes have been deleted (I never liked them anyway).
- - The source code has been greatly enhanced for speed, size, readability,
- and maintainability.
- fight.c should no longer cause optimizers to run out of space.
- - A few loopholes have been tightened to make the game more enjoyable.
- (Except for those who are in the habit of exercising those loopholes.)
- - Chris' map is enclosed.
- - The "charac" file is not compatible with older versions of Phantasia
- (3.3.1 and 3.3.1+). A 'convert' program is provided to convert your
- old file to the new format. See Makefile for details.
- - Movements can be made with HJKL for WSNE, respectively.
- - Players may examine others while playing ('x') option.
- - Monsters are now stored in a binary data base, to speed calling
- monsters, and to ease formatting of monster listings.
- - Taxes are collected on all gold and gems.
- - Dead players can be resurrected by the 'wizard'.
- - 'setup' is smarter, although not as smart as it should be.
- - Players can change their names and passwords
-
-PORTABILTY:
-
- I have tried to make this as non-machine/system specific as possible.
-
- All identifiers are unique to 7 characters or less, dual case.
-
- The code WILL NOT fit on a 16-bit machine without separate I/D.
-
- Stdio MUST support fopen() with mode "r+". I think this is true
- for all Version 7 and later.
-
- 'curses' library functions are required.
-
- All problems/solutions with portability should be reported to me,
- and fixes will be included in subsequent versions of this software.
-
-
-Please send me any bugs, (of which I am sure there are many), you may find,
-but PLEASE be specific. I cannot correct a bug which is described as:
-
- "When I choose a character type, it blows up."
-
- (What blows up? What exactly was printed at the terminal?
- Which character type was chosen? Etc. . . ?)
-
-Also, please tell me which version of UN*X you are running, and upon
-which type of hardware.
-
-I will also do my best to help anyone with problems just trying to
-get the game running. Again, I need to know which version of UN*X
-and what type of CPU. Also, a copy of the output from 'make'
-would be extremely useful.
-
-Any and all ideas/suggestions/additions are more than welcome. If
-you feel strongly enough about it, write the change and send it to me,
-and I will do my best to incorporate it in the next version of Phantasia.
-Otherwise, I will give serious thought to adding it myself.
-
-Follow the directions in the Makefile CAREFULLY to set up the game.
-Read the comments at the beginning of 'main.c', if you haven't already.
-
-Enjoy.
-
-Ted Estes
-AT&T Information Systems
-Skokie, IL 60077
-
-...!ihnp4!ttrdc!ttrda!estes
diff --git a/games/phantasia/fight.c b/games/phantasia/fight.c
deleted file mode 100644
index 030b29b..0000000
--- a/games/phantasia/fight.c
+++ /dev/null
@@ -1,1693 +0,0 @@
-/*
- * fight.c Phantasia monster fighting routines
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include "include.h"
-
-/************************************************************************
-/
-/ FUNCTION NAME: encounter()
-/
-/ FUNCTION: monster battle routine
-/
-/ AUTHOR: E. A. Estes, 2/20/86
-/
-/ ARGUMENTS:
-/ int particular - particular monster to fight if >= 0
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: monsthits(), playerhits(), readmessage(), callmonster(),
-/ writerecord(), pickmonster(), displaystats(), pow(), cancelmonster(),
-/ awardtreasure(), more(), death(), wmove(), setjmp(), drandom(), printw(),
-/ longjmp(), wrefresh(), mvprintw(), wclrtobot()
-/
-/ GLOBAL INPUTS: Curmonster, Whichmonster, LINES, Lines, Circle, Shield,
-/ Player, *stdscr, Fileloc, Fightenv[], *Enemyname
-/
-/ GLOBAL OUTPUTS: Curmonster, Whichmonster, Lines, Shield, Player, Luckout
-/
-/ DESCRIPTION:
-/ Choose a monster and check against some special types.
-/ Arbitrate between monster and player. Watch for either
-/ dying.
-/
-*************************************************************************/
-
-encounter(particular)
-int particular;
-{
-bool firsthit = Player.p_blessing; /* set if player gets the first hit */
-int flockcnt = 1; /* how many time flocked */
-
- /* let others know what we are doing */
- Player.p_status = S_MONSTER;
- writerecord(&Player, Fileloc);
-
-#ifdef SYS5
- flushinp();
-#endif
-
- Shield = 0.0; /* no shield up yet */
-
- if (particular >= 0)
- /* monster is specified */
- Whichmonster = particular;
- else
- /* pick random monster */
- Whichmonster = pickmonster();
-
- setjmp(Fightenv); /* this is to enable changing fight state */
-
- move(6, 0);
- clrtobot(); /* clear bottom area of screen */
-
- Lines = 9;
- callmonster(Whichmonster); /* set up monster to fight */
-
- Luckout = FALSE; /* haven't tried to luckout yet */
-
- if (Curmonster.m_type == SM_MORGOTH)
- mvprintw(4, 0, "You've encountered %s, Bane of the Council and Valar.\n",
- Enemyname);
-
- if (Curmonster.m_type == SM_UNICORN)
- {
- if (Player.p_virgin)
- {
- printw("You just subdued %s, thanks to the virgin.\n", Enemyname);
- Player.p_virgin = FALSE;
- }
- else
- {
- printw("You just saw %s running away!\n", Enemyname);
- Curmonster.m_experience = 0.0;
- Curmonster.m_treasuretype = 0;
- }
- }
- else
- /* not a special monster */
- for (;;)
- /* print header, and arbitrate between player and monster */
- {
- mvprintw(6, 0, "You are being attacked by %s, EXP: %.0f (Size: %.0f)\n",
- Enemyname, Curmonster.m_experience, Circle);
-
- displaystats();
- mvprintw(1, 26, "%20.0f", Player.p_energy + Shield); /* overprint energy */
- readmessage();
-
- if (Curmonster.m_type == SM_DARKLORD
- && Player.p_blessing
- && Player.p_charms > 0)
- /* overpower Dark Lord with blessing and charm */
- {
- mvprintw(7, 0, "You just overpowered %s!", Enemyname);
- Lines = 8;
- Player.p_blessing = FALSE;
- --Player.p_charms;
- break;
- }
-
- /* allow paralyzed monster to wake up */
- Curmonster.m_speed = MIN(Curmonster.m_speed + 1.0, Curmonster.m_maxspeed);
-
- if (drandom() * Curmonster.m_speed > drandom() * Player.p_speed
- /* monster is faster */
- && Curmonster.m_type != SM_DARKLORD
- /* not D. L. */
- && Curmonster.m_type != SM_SHRIEKER
- /* not mimic */
- && !firsthit)
- /* monster gets a hit */
- monsthits();
- else
- /* player gets a hit */
- {
- firsthit = FALSE;
- playerhits();
- }
-
- refresh();
-
- if (Lines > LINES - 2)
- /* near bottom of screen - pause */
- {
- more(Lines);
- move(Lines = 8, 0);
- clrtobot();
- }
-
- if (Player.p_energy <= 0.0)
- /* player died */
- {
- more(Lines);
- death(Enemyname);
- cancelmonster();
- break; /* fight ends if the player is saved from death */
- }
-
- if (Curmonster.m_energy <= 0.0)
- /* monster died */
- break;
- }
-
- /* give player credit for killing monster */
- Player.p_experience += Curmonster.m_experience;
-
- if (drandom() < Curmonster.m_flock / 100.0)
- /* monster flocks */
- {
- more(Lines);
- ++flockcnt;
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
- }
- else if (Circle > 1.0
- && Curmonster.m_treasuretype > 0
- && drandom() > 0.2 + pow(0.4, (double) (flockcnt / 3 + Circle / 3.0)))
- /* monster has treasure; this takes # of flocks and size into account */
- {
- more(Lines);
- awardtreasure();
- }
-
- /* pause before returning */
- getyx(stdscr, Lines, flockcnt);
- more(Lines + 1);
-
- Player.p_ring.ring_inuse = FALSE; /* not using ring */
-
- /* clean up the screen */
- move(4, 0);
- clrtobot();
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: pickmonster()
-/
-/ FUNCTION: choose a monster based upon where we are
-/
-/ AUTHOR: E. A. Estes, 2/20/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: monster number to call
-/
-/ MODULES CALLED: floor(), drandom()
-/
-/ GLOBAL INPUTS: Marsh, Circle, Player
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Certain monsters can be found in certain areas of the grid.
-/ We take care of rolling them here.
-/ Unfortunately, this routine assumes that the monster data
-/ base is arranged in a particular order. If the data base
-/ is altered (to add monsters, or make them tougher), this
-/ routine may also need to be changed.
-/
-*************************************************************************/
-
-pickmonster()
-{
- if (Player.p_specialtype == SC_VALAR)
- /* even chance of any monster */
- return((int) ROLL(0.0, 100.0));
-
- if (Marsh)
- /* water monsters */
- return((int) ROLL(0.0, 15.0));
-
- else if (Circle > 24)
- /* even chance of all non-water monsters */
- return((int) ROLL(14.0, 86.0));
-
- else if (Circle > 15)
- /* chance of all non-water monsters, weighted toward middle */
- return((int) (ROLL(0.0, 50.0) + ROLL(14.0, 37.0)));
-
- else if (Circle > 8)
- /* not all non-water monsters, weighted toward middle */
- return((int) (ROLL(0.0, 50.0) + ROLL(14.0, 26.0)));
-
- else if (Circle > 3)
- /* even chance of some tamer non-water monsters */
- return((int) ROLL(14.0, 50.0));
-
- else
- /* even chance of some of the tamest non-water monsters */
- return((int) ROLL(14.0, 25.0));
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: playerhits()
-/
-/ FUNCTION: prompt player for action in monster battle, and process
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: hitmonster(), throwspell(), inputoption(), cancelmonster(),
-/ floor(), wmove(), drandom(), altercoordinates(), waddstr(), mvprintw(),
-/ wclrtoeol(), wclrtobot()
-/
-/ GLOBAL INPUTS: Curmonster, Lines, Player, *stdscr, Luckout, *Enemyname
-/
-/ GLOBAL OUTPUTS: Curmonster, Lines, Player, Luckout
-/
-/ DESCRIPTION:
-/ Process all monster battle options.
-/
-*************************************************************************/
-
-playerhits()
-{
-double inflict; /* damage inflicted */
-int ch; /* input */
-
- mvaddstr(7, 0, "1:Melee 2:Skirmish 3:Evade 4:Spell 5:Nick ");
-
- if (!Luckout) {
- /* haven't tried to luckout yet */
- if (Curmonster.m_type == SM_MORGOTH)
- /* cannot luckout against Morgoth */
- addstr("6:Ally ");
- else
- addstr("6:Luckout ");
- }
-
- if (Player.p_ring.ring_type != R_NONE)
- /* player has a ring */
- addstr("7:Use Ring ");
- else
- clrtoeol();
-
- ch = inputoption();
-
- move(8, 0);
- clrtobot(); /* clear any messages from before */
- Lines = 9;
- mvaddstr(4, 0, "\n\n"); /* clear status area */
-
- switch (ch)
- {
- case 'T': /* timeout; lose turn */
- break;
-
- case ' ':
- case '1': /* melee */
- /* melee affects monster's energy and strength */
- inflict = ROLL(Player.p_might / 2.0 + 5.0, 1.3 * Player.p_might)
- + (Player.p_ring.ring_inuse ? Player.p_might : 0.0);
-
- Curmonster.m_melee += inflict;
- Curmonster.m_strength = Curmonster.m_o_strength
- - Curmonster.m_melee / Curmonster.m_o_energy
- * Curmonster.m_o_strength / 4.0;
- hitmonster(inflict);
- break;
-
- case '2': /* skirmish */
- /* skirmish affects monter's energy and speed */
- inflict = ROLL(Player.p_might / 3.0 + 3.0, 1.1 * Player.p_might)
- + (Player.p_ring.ring_inuse ? Player.p_might : 0.0);
-
- Curmonster.m_skirmish += inflict;
- Curmonster.m_maxspeed = Curmonster.m_o_speed
- - Curmonster.m_skirmish / Curmonster.m_o_energy
- * Curmonster.m_o_speed / 4.0;
- hitmonster(inflict);
- break;
-
- case '3': /* evade */
- /* use brains and speed to try to evade */
- if ((Curmonster.m_type == SM_DARKLORD
- || Curmonster.m_type == SM_SHRIEKER
- /* can always run from D. L. and shrieker */
- || drandom() * Player.p_speed * Player.p_brains
- > drandom() * Curmonster.m_speed * Curmonster.m_brains)
- && (Curmonster.m_type != SM_MIMIC))
- /* cannot run from mimic */
- {
- mvaddstr(Lines++, 0, "You got away!");
- cancelmonster();
- altercoordinates(0.0, 0.0, A_NEAR);
- }
- else
- mvprintw(Lines++, 0, "%s is still after you!", Enemyname);
-
- break;
-
- case 'M':
- case '4': /* magic spell */
- throwspell();
- break;
-
- case '5': /* nick */
- /* hit 1 plus sword; give some experience */
- inflict = 1.0 + Player.p_sword;
- Player.p_experience += floor(Curmonster.m_experience / 10.0);
- Curmonster.m_experience *= 0.92;
- /* monster gets meaner */
- Curmonster.m_maxspeed += 2.0;
- Curmonster.m_speed = (Curmonster.m_speed < 0.0) ? 0.0 : Curmonster.m_speed + 2.0;
- if (Curmonster.m_type == SM_DARKLORD)
- /* Dark Lord; doesn't like to be nicked */
- {
- mvprintw(Lines++, 0,
- "You hit %s %.0f times, and made him mad!", Enemyname, inflict);
- Player.p_quickness /= 2.0;
- altercoordinates(0.0, 0.0, A_FAR);
- cancelmonster();
- }
- else
- hitmonster(inflict);
- break;
-
- case 'B':
- case '6': /* luckout */
- if (Luckout)
- mvaddstr(Lines++, 0, "You already tried that.");
- else
- {
- Luckout = TRUE;
- if (Curmonster.m_type == SM_MORGOTH)
- /* Morgoth; ally */
- {
- if (drandom() < Player.p_sin / 100.0)
- {
- mvprintw(Lines++, 0, "%s accepted!", Enemyname);
- cancelmonster();
- }
- else
- mvaddstr(Lines++, 0, "Nope, he's not interested.");
- }
- else
- /* normal monster; use brains for success */
- {
- if ((drandom() + 0.333) * Player.p_brains
- < (drandom() + 0.333) * Curmonster.m_brains)
- mvprintw(Lines++, 0, "You blew it, %s.", Player.p_name);
- else
- {
- mvaddstr(Lines++, 0, "You made it!");
- Curmonster.m_energy = 0.0;
- }
- }
- }
- break;
-
- case '7': /* use ring */
- if (Player.p_ring.ring_type != R_NONE)
- {
- mvaddstr(Lines++, 0, "Now using ring.");
- Player.p_ring.ring_inuse = TRUE;
- if (Player.p_ring.ring_type != R_DLREG)
- /* age ring */
- --Player.p_ring.ring_duration;
- }
- break;
- }
-
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: monsthits()
-/
-/ FUNCTION: process a monster hitting the player
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: cancelmonster(), scramblestats(), more(), floor(), wmove(),
-/ drandom(), altercoordinates(), longjmp(), waddstr(), mvprintw(),
-/ getanswer()
-/
-/ GLOBAL INPUTS: Curmonster, Lines, Circle, Shield, Player, *stdscr,
-/ Fightenv[], *Enemyname
-/
-/ GLOBAL OUTPUTS: Curmonster, Whichmonster, Lines, Shield, Player,
-/ *Enemyname
-/
-/ DESCRIPTION:
-/ Handle all special monsters here. If the monster is not a special
-/ one, simply roll a hit against the player.
-/
-*************************************************************************/
-
-monsthits()
-{
-double inflict; /* damage inflicted */
-int ch; /* input */
-
- switch (Curmonster.m_type)
- /* may be a special monster */
- {
- case SM_DARKLORD:
- /* hits just enough to kill player */
- inflict = (Player.p_energy + Shield) * 1.02;
- goto SPECIALHIT;
-
- case SM_SHRIEKER:
- /* call a big monster */
- mvaddstr(Lines++, 0,
- "Shrieeeek!! You scared it, and it called one of its friends.");
- more(Lines);
- Whichmonster = (int) ROLL(70.0, 30.0);
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
-
- case SM_BALROG:
- /* take experience away */
- inflict = ROLL(10.0, Curmonster.m_strength);
- inflict = MIN(Player.p_experience, inflict);
- mvprintw(Lines++, 0,
- "%s took away %.0f experience points.", Enemyname, inflict);
- Player.p_experience -= inflict;
- return;
-
- case SM_FAERIES:
- if (Player.p_holywater > 0)
- /* holy water kills when monster tries to hit */
- {
- mvprintw(Lines++, 0, "Your holy water killed it!");
- --Player.p_holywater;
- Curmonster.m_energy = 0.0;
- return;
- }
- break;
-
- case SM_NONE:
- /* normal hit */
- break;
-
- default:
- if (drandom() > 0.2)
- /* normal hit */
- break;
-
- /* else special things */
- switch (Curmonster.m_type)
- {
- case SM_LEANAN:
- /* takes some of the player's strength */
- inflict = ROLL(1.0, (Circle - 1.0) / 2.0);
- inflict = MIN(Player.p_strength, inflict);
- mvprintw(Lines++, 0, "%s sapped %0.f of your strength!",
- Enemyname, inflict);
- Player.p_strength -= inflict;
- Player.p_might -= inflict;
- break;
-
- case SM_SARUMAN:
- if (Player.p_palantir)
- /* take away palantir */
- {
- mvprintw(Lines++, 0, "Wormtongue stole your palantir!");
- Player.p_palantir = FALSE;
- }
- else if (drandom() > 0.5)
- /* gems turn to gold */
- {
- mvprintw(Lines++, 0,
- "%s transformed your gems into gold!", Enemyname);
- Player.p_gold += Player.p_gems;
- Player.p_gems = 0.0;
- }
- else
- /* scramble some stats */
- {
- mvprintw(Lines++, 0, "%s scrambled your stats!", Enemyname);
- scramblestats();
- }
- break;
-
- case SM_THAUMATURG:
- /* transport player */
- mvprintw(Lines++, 0, "%s transported you!", Enemyname);
- altercoordinates(0.0, 0.0, A_FAR);
- cancelmonster();
- break;
-
- case SM_VORTEX:
- /* suck up some mana */
- inflict = ROLL(0, 7.5 * Circle);
- inflict = MIN(Player.p_mana, floor(inflict));
- mvprintw(Lines++, 0,
- "%s sucked up %.0f of your mana!", Enemyname, inflict);
- Player.p_mana -= inflict;
- break;
-
- case SM_NAZGUL:
- /* try to take ring if player has one */
- if (Player.p_ring.ring_type != R_NONE)
- /* player has a ring */
- {
- mvaddstr(Lines++, 0, "Will you relinguish your ring ? ");
- ch = getanswer("YN", FALSE);
- if (ch == 'Y')
- /* take ring away */
- {
- Player.p_ring.ring_type = R_NONE;
- Player.p_ring.ring_inuse = FALSE;
- cancelmonster();
- break;
- }
- }
-
- /* otherwise, take some brains */
- mvprintw(Lines++, 0,
- "%s neutralized 1/5 of your brain!", Enemyname);
- Player.p_brains *= 0.8;
- break;
-
- case SM_TIAMAT:
- /* take some gold and gems */
- mvprintw(Lines++, 0,
- "%s took half your gold and gems and flew off.", Enemyname);
- Player.p_gold /= 2.0;
- Player.p_gems /= 2.0;
- cancelmonster();
- break;
-
- case SM_KOBOLD:
- /* steal a gold piece and run */
- mvprintw(Lines++, 0,
- "%s stole one gold piece and ran away.", Enemyname);
- Player.p_gold = MAX(0.0, Player.p_gold - 1.0);
- cancelmonster();
- break;
-
- case SM_SHELOB:
- /* bite and (medium) poison */
- mvprintw(Lines++, 0,
- "%s has bitten and poisoned you!", Enemyname);
- Player.p_poison -= 1.0;
- break;
-
- case SM_LAMPREY:
- /* bite and (small) poison */
- mvprintw(Lines++, 0, "%s bit and poisoned you!", Enemyname);
- Player.p_poison += 0.25;
- break;
-
- case SM_BONNACON:
- /* fart and run */
- mvprintw(Lines++, 0, "%s farted and scampered off.", Enemyname);
- Player.p_energy /= 2.0; /* damage from fumes */
- cancelmonster();
- break;
-
- case SM_SMEAGOL:
- if (Player.p_ring.ring_type != R_NONE)
- /* try to steal ring */
- {
- mvprintw(Lines++, 0,
- "%s tried to steal your ring, ", Enemyname);
- if (drandom() > 0.1)
- addstr("but was unsuccessful.");
- else
- {
- addstr("and ran away with it!");
- Player.p_ring.ring_type = R_NONE;
- cancelmonster();
- }
- }
- break;
-
- case SM_SUCCUBUS:
- /* inflict damage through shield */
- inflict = ROLL(15.0, Circle * 10.0);
- inflict = MIN(inflict, Player.p_energy);
- mvprintw(Lines++, 0, "%s sapped %.0f of your energy.",
- Enemyname, inflict);
- Player.p_energy -= inflict;
- break;
-
- case SM_CERBERUS:
- /* take all metal treasures */
- mvprintw(Lines++, 0,
- "%s took all your metal treasures!", Enemyname);
- Player.p_crowns = 0;
- Player.p_sword =
- Player.p_shield =
- Player.p_gold = 0.0;
- cancelmonster();
- break;
-
- case SM_UNGOLIANT:
- /* (large) poison and take a quickness */
- mvprintw(Lines++, 0,
- "%s poisoned you, and took one quik.", Enemyname);
- Player.p_poison += 5.0;
- Player.p_quickness -= 1.0;
- break;
-
- case SM_JABBERWOCK:
- /* fly away, and leave either a Jubjub bird or Bonnacon */
- mvprintw(Lines++, 0,
- "%s flew away, and left you to contend with one of its friends.",
- Enemyname);
- Whichmonster = 55 + (drandom() > 0.5) ? 22 : 0;
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
-
- case SM_TROLL:
- /* partially regenerate monster */
- mvprintw(Lines++, 0,
- "%s partially regenerated his energy.!", Enemyname);
- Curmonster.m_energy +=
- floor((Curmonster.m_o_energy - Curmonster.m_energy) / 2.0);
- Curmonster.m_strength = Curmonster.m_o_strength;
- Curmonster.m_melee = Curmonster.m_skirmish = 0.0;
- Curmonster.m_maxspeed = Curmonster.m_o_speed;
- break;
-
- case SM_WRAITH:
- if (!Player.p_blindness)
- /* make blind */
- {
- mvprintw(Lines++, 0, "%s blinded you!", Enemyname);
- Player.p_blindness = TRUE;
- Enemyname = "A monster";
- }
- break;
- }
- return;
- }
-
- /* fall through to here if monster inflicts a normal hit */
- inflict = drandom() * Curmonster.m_strength + 0.5;
-SPECIALHIT:
- mvprintw(Lines++, 0, "%s hit you %.0f times!", Enemyname, inflict);
-
- if ((Shield -= inflict) < 0)
- {
- Player.p_energy += Shield;
- Shield = 0.0;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: cancelmonster()
-/
-/ FUNCTION: mark current monster as no longer active
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: none
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: Curmonster
-/
-/ DESCRIPTION:
-/ Clear current monster's energy, experience, treasure type, and
-/ flock. This is the same as having the monster run away.
-/
-*************************************************************************/
-
-cancelmonster()
-{
- Curmonster.m_energy = 0.0;
- Curmonster.m_experience = 0.0;
- Curmonster.m_treasuretype = 0;
- Curmonster.m_flock = 0.0;
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: hitmonster()
-/
-/ FUNCTION: inflict damage upon current monster
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ double inflict - damage to inflict upon monster
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: monsthits(), wmove(), strcmp(), waddstr(), mvprintw()
-/
-/ GLOBAL INPUTS: Curmonster, Lines, Player, *stdscr, *Enemyname
-/
-/ GLOBAL OUTPUTS: Curmonster, Lines
-/
-/ DESCRIPTION:
-/ Hit monster specified number of times. Handle when monster dies,
-/ and a few special monsters.
-/
-*************************************************************************/
-
-hitmonster(inflict)
-double inflict;
-{
- mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, inflict);
- Curmonster.m_energy -= inflict;
- if (Curmonster.m_energy > 0.0)
- {
- if (Curmonster.m_type == SM_DARKLORD || Curmonster.m_type == SM_SHRIEKER)
- /* special monster didn't die */
- monsthits();
- }
- else
- /* monster died. print message. */
- {
- if (Curmonster.m_type == SM_MORGOTH)
- mvaddstr(Lines++, 0, "You have defeated Morgoth, but he may return. . .");
- else
- /* all other types of monsters */
- {
- mvprintw(Lines++, 0, "You killed it. Good work, %s.", Player.p_name);
-
- if (Curmonster.m_type == SM_MIMIC
- && strcmp(Curmonster.m_name, "A Mimic") != 0
- && !Player.p_blindness)
- mvaddstr(Lines++, 0, "The body slowly changes into the form of a mimic.");
- }
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: throwspell()
-/
-/ FUNCTION: throw a magic spell
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: hitmonster(), cancelmonster(), sqrt(), floor(), wmove(),
-/ drandom(), altercoordinates(), longjmp(), infloat(), waddstr(), mvprintw(),
-/ getanswer()
-/
-/ GLOBAL INPUTS: Curmonster, Whichmonster, Nomana[], Player, *stdscr,
-/ Fightenv[], Illspell[], *Enemyname
-/
-/ GLOBAL OUTPUTS: Curmonster, Whichmonster, Shield, Player
-/
-/ DESCRIPTION:
-/ Prompt player and process magic spells.
-/
-*************************************************************************/
-
-throwspell()
-{
-double inflict; /* damage inflicted */
-double dtemp; /* for dtemporary calculations */
-int ch; /* input */
-
- mvaddstr(7, 0, "\n\n"); /* clear menu area */
-
- if (Player.p_magiclvl >= ML_ALLORNOTHING)
- mvaddstr(7, 0, "1:All or Nothing ");
- if (Player.p_magiclvl >= ML_MAGICBOLT)
- addstr("2:Magic Bolt ");
- if (Player.p_magiclvl >= ML_FORCEFIELD)
- addstr("3:Force Field ");
- if (Player.p_magiclvl >= ML_XFORM)
- addstr("4:Transform ");
- if (Player.p_magiclvl >= ML_INCRMIGHT)
- addstr("5:Increase Might\n");
- if (Player.p_magiclvl >= ML_INVISIBLE)
- mvaddstr(8, 0, "6:Invisibility ");
- if (Player.p_magiclvl >= ML_XPORT)
- addstr("7:Transport ");
- if (Player.p_magiclvl >= ML_PARALYZE)
- addstr("8:Paralyze ");
- if (Player.p_specialtype >= SC_COUNCIL)
- addstr("9:Specify");
- mvaddstr(4, 0, "Spell ? ");
-
- ch = getanswer(" ", TRUE);
-
- mvaddstr(7, 0, "\n\n"); /* clear menu area */
-
- if (Curmonster.m_type == SM_MORGOTH && ch != '3')
- /* can only throw force field against Morgoth */
- ILLSPELL();
- else
- switch (ch)
- {
- case '1': /* all or nothing */
- if (drandom() < 0.25)
- /* success */
- {
- inflict = Curmonster.m_energy * 1.01 + 1.0;
-
- if (Curmonster.m_type == SM_DARKLORD)
- /* all or nothing doesn't quite work against D. L. */
- inflict *= 0.9;
- }
- else
- /* failure -- monster gets stronger and quicker */
- {
- Curmonster.m_o_strength = Curmonster.m_strength *= 2.0;
- Curmonster.m_maxspeed *= 2.0;
- Curmonster.m_o_speed *= 2.0;
-
- /* paralyzed monsters wake up a bit */
- Curmonster.m_speed = MAX(1.0, Curmonster.m_speed * 2.0);
- }
-
- if (Player.p_mana >= MM_ALLORNOTHING)
- /* take a mana if player has one */
- Player.p_mana -= MM_ALLORNOTHING;
-
- hitmonster(inflict);
- break;
-
- case '2': /* magic bolt */
- if (Player.p_magiclvl < ML_MAGICBOLT)
- ILLSPELL();
- else
- {
- do
- /* prompt for amount to expend */
- {
- mvaddstr(4, 0, "How much mana for bolt? ");
- dtemp = floor(infloat());
- }
- while (dtemp < 0.0 || dtemp > Player.p_mana);
-
- Player.p_mana -= dtemp;
-
- if (Curmonster.m_type == SM_DARKLORD)
- /* magic bolts don't work against D. L. */
- inflict = 0.0;
- else
- inflict = dtemp * ROLL(15.0, sqrt(Player.p_magiclvl / 3.0 + 1.0));
- mvaddstr(5, 0, "Magic Bolt fired!\n");
- hitmonster(inflict);
- }
- break;
-
- case '3': /* force field */
- if (Player.p_magiclvl < ML_FORCEFIELD)
- ILLSPELL();
- else if (Player.p_mana < MM_FORCEFIELD)
- NOMANA();
- else
- {
- Player.p_mana -= MM_FORCEFIELD;
- Shield = (Player.p_maxenergy + Player.p_shield) * 4.2 + 45.0;
- mvaddstr(5, 0, "Force Field up.\n");
- }
- break;
-
- case '4': /* transform */
- if (Player.p_magiclvl < ML_XFORM)
- ILLSPELL();
- else if (Player.p_mana < MM_XFORM)
- NOMANA();
- else
- {
- Player.p_mana -= MM_XFORM;
- Whichmonster = (int) ROLL(0.0, 100.0);
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
- }
- break;
-
- case '5': /* increase might */
- if (Player.p_magiclvl < ML_INCRMIGHT)
- ILLSPELL();
- else if (Player.p_mana < MM_INCRMIGHT)
- NOMANA();
- else
- {
- Player.p_mana -= MM_INCRMIGHT;
- Player.p_might +=
- (1.2 * (Player.p_strength + Player.p_sword)
- + 5.0 - Player.p_might) / 2.0;
- mvprintw(5, 0, "New strength: %.0f\n", Player.p_might);
- }
- break;
-
- case '6': /* invisible */
- if (Player.p_magiclvl < ML_INVISIBLE)
- ILLSPELL();
- else if (Player.p_mana < MM_INVISIBLE)
- NOMANA();
- else
- {
- Player.p_mana -= MM_INVISIBLE;
- Player.p_speed +=
- (1.2 * (Player.p_quickness + Player.p_quksilver)
- + 5.0 - Player.p_speed) / 2.0;
- mvprintw(5, 0, "New quickness: %.0f\n", Player.p_speed);
- }
- break;
-
- case '7': /* transport */
- if (Player.p_magiclvl < ML_XPORT)
- ILLSPELL();
- else if (Player.p_mana < MM_XPORT)
- NOMANA();
- else
- {
- Player.p_mana -= MM_XPORT;
- if (Player.p_brains + Player.p_magiclvl
- < Curmonster.m_experience / 200.0 * drandom())
- {
- mvaddstr(5, 0, "Transport backfired!\n");
- altercoordinates(0.0, 0.0, A_FAR);
- cancelmonster();
- }
- else
- {
- mvprintw(5, 0, "%s is transported.\n", Enemyname);
- if (drandom() < 0.3)
- /* monster didn't drop its treasure */
- Curmonster.m_treasuretype = 0;
-
- Curmonster.m_energy = 0.0;
- }
- }
- break;
-
- case '8': /* paralyze */
- if (Player.p_magiclvl < ML_PARALYZE)
- ILLSPELL();
- else if (Player.p_mana < MM_PARALYZE)
- NOMANA();
- else
- {
- Player.p_mana -= MM_PARALYZE;
- if (Player.p_magiclvl >
- Curmonster.m_experience / 1000.0 * drandom())
- {
- mvprintw(5, 0, "%s is held.\n", Enemyname);
- Curmonster.m_speed = -2.0;
- }
- else
- mvaddstr(5, 0, "Monster unaffected.\n");
- }
- break;
-
- case '9': /* specify */
- if (Player.p_specialtype < SC_COUNCIL)
- ILLSPELL();
- else if (Player.p_mana < MM_SPECIFY)
- NOMANA();
- else
- {
- Player.p_mana -= MM_SPECIFY;
- mvaddstr(5, 0, "Which monster do you want [0-99] ? ");
- Whichmonster = (int) infloat();
- Whichmonster = MAX(0, MIN(99, Whichmonster));
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
- }
- break;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: callmonster()
-/
-/ FUNCTION: read monster from file, and fill structure
-/
-/ AUTHOR: E. A. Estes, 2/25/86
-/
-/ ARGUMENTS:
-/ int which - which monster to call
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: truncstring(), fread(), fseek(), floor(), drandom(),
-/ strcpy()
-/
-/ GLOBAL INPUTS: Curmonster, Circle, Player, *Monstfp
-/
-/ GLOBAL OUTPUTS: Curmonster, Player, *Enemyname
-/
-/ DESCRIPTION:
-/ Read specified monster from monster database and fill up
-/ current monster structure.
-/ Adjust statistics based upon current size.
-/ Handle some special monsters.
-/
-*************************************************************************/
-
-callmonster(which)
-int which;
-{
-struct monster Othermonster; /* to find a name for mimics */
-
- which = MIN(which, 99); /* make sure within range */
-
- /* fill structure */
- fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
- fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
-
- /* handle some special monsters */
- if (Curmonster.m_type == SM_MODNAR)
- {
- if (Player.p_specialtype < SC_COUNCIL)
- /* randomize some stats */
- {
- Curmonster.m_strength *= drandom() + 0.5;
- Curmonster.m_brains *= drandom() + 0.5;
- Curmonster.m_speed *= drandom() + 0.5;
- Curmonster.m_energy *= drandom() + 0.5;
- Curmonster.m_experience *= drandom() + 0.5;
- Curmonster.m_treasuretype =
- (int) ROLL(0.0, (double) Curmonster.m_treasuretype);
- }
- else
- /* make Modnar into Morgoth */
- {
- strcpy(Curmonster.m_name, "Morgoth");
- Curmonster.m_strength = drandom() * (Player.p_maxenergy + Player.p_shield) / 1.4
- + drandom() * (Player.p_maxenergy + Player.p_shield) / 1.5;
- Curmonster.m_brains = Player.p_brains;
- Curmonster.m_energy = Player.p_might * 30.0;
- Curmonster.m_type = SM_MORGOTH;
- Curmonster.m_speed = Player.p_speed * 1.1
- + (Player.p_specialtype == SC_EXVALAR) ? Player.p_speed : 0.0;
- Curmonster.m_flock = 0.0;
- Curmonster.m_treasuretype = 0;
- Curmonster.m_experience = 0.0;
- }
- }
- else if (Curmonster.m_type == SM_MIMIC)
- /* pick another name */
- {
- which = (int) ROLL(0.0, 100.0);
- fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
- fread(&Othermonster, SZ_MONSTERSTRUCT, 1, Monstfp);
- strcpy(Curmonster.m_name, Othermonster.m_name);
- }
-
- truncstring(Curmonster.m_name);
-
- if (Curmonster.m_type != SM_MORGOTH)
- /* adjust stats based on which circle player is in */
- {
- Curmonster.m_strength *= (1.0 + Circle / 2.0);
- Curmonster.m_brains *= Circle;
- Curmonster.m_speed += Circle * 1.e-9;
- Curmonster.m_energy *= Circle;
- Curmonster.m_experience *= Circle;
- }
-
- if (Player.p_blindness)
- /* cannot see monster if blind */
- Enemyname = "A monster";
- else
- Enemyname = Curmonster.m_name;
-
- if (Player.p_speed <= 0.0)
- /* make Player.p_speed positive */
- {
- Curmonster.m_speed += -Player.p_speed;
- Player.p_speed = 1.0;
- }
-
- /* fill up the rest of the structure */
- Curmonster.m_o_strength = Curmonster.m_strength;
- Curmonster.m_o_speed = Curmonster.m_maxspeed = Curmonster.m_speed;
- Curmonster.m_o_energy = Curmonster.m_energy;
- Curmonster.m_melee = Curmonster.m_skirmish = 0.0;
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: awardtreasure()
-/
-/ FUNCTION: select a treasure
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: pickmonster(), collecttaxes(), more(), cursedtreasure(),
-/ floor(), wmove(), drandom(), sscanf(), printw(), altercoordinates(),
-/ longjmp(), infloat(), waddstr(), getanswer(), getstring(), wclrtobot()
-/
-/ GLOBAL INPUTS: Somebetter[], Curmonster, Whichmonster, Circle, Player,
-/ *stdscr, Databuf[], *Statptr, Fightenv[]
-/
-/ GLOBAL OUTPUTS: Whichmonster, Shield, Player
-/
-/ DESCRIPTION:
-/ Roll up a treasure based upon monster type and size, and
-/ certain player statistics.
-/ Handle cursed treasure.
-/
-*************************************************************************/
-
-awardtreasure()
-{
-int whichtreasure; /* calculated treasure to grant */
-int temp; /* temporary */
-int ch; /* input */
-double treasuretype; /* monster's treasure type */
-double gold = 0.0; /* gold awarded */
-double gems = 0.0; /* gems awarded */
-double dtemp; /* for temporary calculations */
-
- whichtreasure = (int) ROLL(1.0, 3.0); /* pick a treasure */
- treasuretype = (double) Curmonster.m_treasuretype;
-
- move(4, 0);
- clrtobot();
- move(6, 0);
-
- if (drandom() > 0.65)
- /* gold and gems */
- {
- if (Curmonster.m_treasuretype > 7)
- /* gems */
- {
- gems = ROLL(1.0, (treasuretype - 7.0)
- * (treasuretype - 7.0) * (Circle - 1.0) / 4.0);
- printw("You have discovered %.0f gems!", gems);
- }
- else
- /* gold */
- {
- gold = ROLL(treasuretype * 10.0, treasuretype
- * treasuretype * 10.0 * (Circle - 1.0));
- printw("You have found %.0f gold pieces.", gold);
- }
-
- addstr(" Do you want to pick them up ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
-
- if (ch == 'Y') {
- if (drandom() < treasuretype / 35.0 + 0.04)
- /* cursed */
- {
- addstr("They were cursed!\n");
- cursedtreasure();
- }
- else
- collecttaxes(gold, gems);
- }
-
- return;
- }
- else
- /* other treasures */
- {
- addstr("You have found some treasure. Do you want to inspect it ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
-
- if (ch != 'Y')
- return;
- else
- if (drandom() < 0.08 && Curmonster.m_treasuretype != 4)
- {
- addstr("It was cursed!\n");
- cursedtreasure();
- return;
- }
- else
- switch (Curmonster.m_treasuretype)
- {
- case 1: /* treasure type 1 */
- switch (whichtreasure)
- {
- case 1:
- addstr("You've discovered a power booster!\n");
- Player.p_mana += ROLL(Circle * 4.0, Circle * 30.0);
- break;
-
- case 2:
- addstr("You have encountered a druid.\n");
- Player.p_experience +=
- ROLL(0.0, 2000.0 + Circle * 400.0);
- break;
-
- case 3:
- addstr("You have found a holy orb.\n");
- Player.p_sin = MAX(0.0, Player.p_sin - 0.25);
- break;
- }
- break;
- /* end treasure type 1 */
-
- case 2: /* treasure type 2 */
- switch (whichtreasure)
- {
- case 1:
- addstr("You have found an amulet.\n");
- ++Player.p_amulets;
- break;
-
- case 2:
- addstr("You've found some holy water!\n");
- ++Player.p_holywater;
- break;
-
- case 3:
- addstr("You've met a hermit!\n");
- Player.p_sin *= 0.75;
- Player.p_mana += 12.0 * Circle;
- break;
- }
- break;
- /* end treasure type 2 */
-
- case 3: /* treasure type 3 */
- switch (whichtreasure)
- {
- case 1:
- dtemp = ROLL(7.0, 30.0 + Circle / 10.0);
- printw("You've found a +%.0f shield!\n", dtemp);
- if (dtemp >= Player.p_shield)
- Player.p_shield = dtemp;
- else
- SOMEBETTER();
- break;
-
- case 2:
- addstr("You have rescued a virgin. Will you be honorable ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
- if (ch == 'Y')
- Player.p_virgin = TRUE;
- else
- {
- Player.p_experience += 2000.0 * Circle;
- ++Player.p_sin;
- }
- break;
-
- case 3:
- addstr("You've discovered some athelas!\n");
- --Player.p_poison;
- break;
- }
- break;
- /* end treasure type 3 */
-
- case 4: /* treasure type 4 */
- addstr("You've found a scroll. Will you read it ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
-
- if (ch == 'Y')
- switch ((int) ROLL(1, 6))
- {
- case 1:
- addstr("It throws up a shield for you next monster.\n");
- getyx(stdscr, whichtreasure, ch);
- more(whichtreasure);
- Shield =
- (Player.p_maxenergy + Player.p_energy) * 5.5 + Circle * 50.0;
- Whichmonster = pickmonster();
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
-
- case 2:
- addstr("It makes you invisible for you next monster.\n");
- getyx(stdscr, whichtreasure, ch);
- more(whichtreasure);
- Player.p_speed = 1e6;
- Whichmonster = pickmonster();
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
-
- case 3:
- addstr("It increases your strength ten fold to fight your next monster.\n");
- getyx(stdscr, whichtreasure, ch);
- more(whichtreasure);
- Player.p_might *= 10.0;
- Whichmonster = pickmonster();
- longjmp(Fightenv, 0);
- /*NOTREACHED*/
-
- case 4:
- addstr("It is a general knowledge scroll.\n");
- Player.p_brains += ROLL(2.0, Circle);
- Player.p_magiclvl += ROLL(1.0, Circle / 2.0);
- break;
-
- case 5:
- addstr("It tells you how to pick your next monster.\n");
- addstr("Which monster do you want [0-99] ? ");
- Whichmonster = (int) infloat();
- Whichmonster = MIN(99, MAX(0, Whichmonster));
- longjmp(Fightenv, 0);
-
- case 6:
- addstr("It was cursed!\n");
- cursedtreasure();
- break;
- }
- break;
- /* end treasure type 4 */
-
- case 5: /* treasure type 5 */
- switch (whichtreasure)
- {
- case 1:
- dtemp = ROLL(Circle / 4.0 + 5.0, Circle / 2.0 + 9.0);
- printw("You've discovered a +%.0f dagger.\n", dtemp);
- if (dtemp >= Player.p_sword)
- Player.p_sword = dtemp;
- else
- SOMEBETTER();
- break;
-
- case 2:
- dtemp = ROLL(7.5 + Circle * 3.0, Circle * 2.0 + 160.0);
- printw("You have found some +%.0f armour!\n", dtemp);
- if (dtemp >= Player.p_shield)
- Player.p_shield = dtemp;
- else
- SOMEBETTER();
- break;
-
- case 3:
- addstr("You've found a tablet.\n");
- Player.p_brains += 4.5 * Circle;
- break;
- }
- break;
- /* end treasure type 5 */
-
- case 6: /* treasure type 6 */
- switch (whichtreasure)
- {
- case 1:
- addstr("You've found a priest.\n");
- Player.p_energy = Player.p_maxenergy + Player.p_shield;
- Player.p_sin /= 2.0;
- Player.p_mana += 24.0 * Circle;
- Player.p_brains += Circle;
- break;
-
- case 2:
- addstr("You have come upon Robin Hood!\n");
- Player.p_shield += Circle * 2.0;
- Player.p_strength += Circle / 2.5 + 1.0;
- break;
-
- case 3:
- dtemp = ROLL(2.0 + Circle / 4.0, Circle / 1.2 + 10.0);
- printw("You have found a +%.0f axe!\n", dtemp);
- if (dtemp >= Player.p_sword)
- Player.p_sword = dtemp;
- else
- SOMEBETTER();
- break;
- }
- break;
- /* end treasure type 6 */
-
- case 7: /* treasure type 7 */
- switch (whichtreasure)
- {
- case 1:
- addstr("You've discovered a charm!\n");
- ++Player.p_charms;
- break;
-
- case 2:
- addstr("You have encountered Merlyn!\n");
- Player.p_brains += Circle + 5.0;
- Player.p_magiclvl += Circle / 3.0 + 5.0;
- Player.p_mana += Circle * 10.0;
- break;
-
- case 3:
- dtemp = ROLL(5.0 + Circle / 3.0, Circle / 1.5 + 20.0);
- printw("You have found a +%.0f war hammer!\n", dtemp);
- if (dtemp >= Player.p_sword)
- Player.p_sword = dtemp;
- else
- SOMEBETTER();
- break;
- }
- break;
- /* end treasure type 7 */
-
- case 8: /* treasure type 8 */
- switch (whichtreasure)
- {
- case 1:
- addstr("You have found a healing potion.\n");
- Player.p_poison = MIN(-2.0, Player.p_poison - 2.0);
- break;
-
- case 2:
- addstr("You have discovered a transporter. Do you wish to go anywhere ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
- if (ch == 'Y')
- {
- double x, y;
-
- addstr("X Y Coordinates ? ");
- getstring(Databuf, SZ_DATABUF);
- sscanf(Databuf, "%lf %lf", &x, &y);
- altercoordinates(x, y, A_FORCED);
- }
- break;
-
- case 3:
- dtemp = ROLL(10.0 + Circle / 1.2, Circle * 3.0 + 30.0);
- printw("You've found a +%.0f sword!\n", dtemp);
- if (dtemp >= Player.p_sword)
- Player.p_sword = dtemp;
- else
- SOMEBETTER();
- break;
- }
- break;
- /* end treasure type 8 */
-
- case 10:
- case 11:
- case 12:
- case 13: /* treasure types 10 - 13 */
- if (drandom() < 0.33)
- {
- if (Curmonster.m_treasuretype == 10)
- {
- addstr("You've found a pair of elven boots!\n");
- Player.p_quickness += 2.0;
- break;
- }
- else if (Curmonster.m_treasuretype == 11
- && !Player.p_palantir)
- {
- addstr("You've acquired Saruman's palantir.\n");
- Player.p_palantir = TRUE;
- break;
- }
- else if (Player.p_ring.ring_type == R_NONE
- && Player.p_specialtype < SC_COUNCIL
- && (Curmonster.m_treasuretype == 12
- || Curmonster.m_treasuretype == 13))
- /* roll up a ring */
- {
- if (drandom() < 0.8)
- /* regular rings */
- {
- if (Curmonster.m_treasuretype == 12)
- {
- whichtreasure = R_NAZREG;
- temp = 35;
- }
- else
- {
- whichtreasure = R_DLREG;
- temp = 0;
- }
- }
- else
- /* bad rings */
- {
- whichtreasure = R_BAD;
- temp = 15 + Statptr->c_ringduration + (int) ROLL(0,5);
- }
-
- addstr("You've discovered a ring. Will you pick it up ? ");
- ch = getanswer("NY", FALSE);
- addstr("\n\n");
-
- if (ch == 'Y')
- {
- Player.p_ring.ring_type = whichtreasure;
- Player.p_ring.ring_duration = temp;
- }
-
- break;
- }
- }
- /* end treasure types 10 - 13 */
- /* FALLTHROUGH to treasure type 9 if no treasure from above */
-
- case 9: /* treasure type 9 */
- switch (whichtreasure)
- {
- case 1:
- if (Player.p_level <= 1000.0
- && Player.p_crowns <= 3
- && Player.p_level >= 10.0)
- {
- addstr("You have found a golden crown!\n");
- ++Player.p_crowns;
- break;
- }
- /* FALLTHROUGH */
-
- case 2:
- addstr("You've been blessed!\n");
- Player.p_blessing = TRUE;
- Player.p_sin /= 3.0;
- Player.p_energy = Player.p_maxenergy + Player.p_shield;
- Player.p_mana += 100.0 * Circle;
- break;
-
- case 3:
- dtemp = ROLL(1.0, Circle / 5.0 + 5.0);
- dtemp = MIN(dtemp, 99.0);
- printw("You have discovered some +%.0f quicksilver!\n",dtemp);
- if (dtemp >= Player.p_quksilver)
- Player.p_quksilver = dtemp;
- else
- SOMEBETTER();
- break;
- }
- break;
- /* end treasure type 9 */
- }
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: cursedtreasure()
-/
-/ FUNCTION: take care of cursed treasure
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: waddstr()
-/
-/ GLOBAL INPUTS: Player, *stdscr
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Handle cursed treasure. Look for amulets and charms to save
-/ the player from the curse.
-/
-*************************************************************************/
-
-cursedtreasure()
-{
- if (Player.p_charms > 0)
- {
- addstr("But your charm saved you!\n");
- --Player.p_charms;
- }
- else if (Player.p_amulets > 0)
- {
- addstr("But your amulet saved you!\n");
- --Player.p_amulets;
- }
- else
- {
- Player.p_energy = (Player.p_maxenergy + Player.p_shield) / 10.0;
- Player.p_poison += 0.25;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: scramblestats()
-/
-/ FUNCTION: scramble some selected statistics
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: floor(), drandom()
-/
-/ GLOBAL INPUTS: Player
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Swap a few player statistics randomly.
-/
-*************************************************************************/
-
-scramblestats()
-{
-double dbuf[6]; /* to put statistic in */
-double dtemp1, dtemp2; /* for swapping values */
-int first, second; /* indices for swapping */
-double *dptr; /* pointer for filling and emptying buf[] */
-
- /* fill buffer */
- dptr = &dbuf[0];
- *dptr++ = Player.p_strength;
- *dptr++ = Player.p_mana;
- *dptr++ = Player.p_brains;
- *dptr++ = Player.p_magiclvl;
- *dptr++ = Player.p_energy;
- *dptr = Player.p_sin;
-
- /* pick values to swap */
- first = (int) ROLL(0, 5);
- second = (int) ROLL(0, 5);
-
- /* swap values */
- dptr = &dbuf[0];
- dtemp1 = dptr[first];
- /* this expression is split to prevent a compiler loop on some compilers */
- dtemp2 = dptr[second];
- dptr[first] = dtemp2;
- dptr[second] = dtemp1;
-
- /* empty buffer */
- Player.p_strength = *dptr++;
- Player.p_mana = *dptr++;
- Player.p_brains = *dptr++;
- Player.p_magiclvl = *dptr++;
- Player.p_energy = *dptr++;
- Player.p_sin = *dptr;
-}
diff --git a/games/phantasia/gamesupport.c b/games/phantasia/gamesupport.c
deleted file mode 100644
index 23711d2..0000000
--- a/games/phantasia/gamesupport.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- * gamesupport.c - auxiliary routines for support of Phantasia
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include "include.h"
-
-/************************************************************************
-/
-/ FUNCTION NAME: changestats()
-/
-/ FUNCTION: examine/change statistics for a player
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ bool ingameflag - set if called while playing game (Wizard only)
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: freerecord(), writerecord(), descrstatus(), truncstring(),
-/ time(), more(), wmove(), wclear(), strcmp(), printw(), strcpy(),
-/ infloat(), waddstr(), cleanup(), findname(), userlist(), mvprintw(),
-/ localtime(), getanswer(), descrtype(), getstring()
-/
-/ GLOBAL INPUTS: LINES, *Login, Other, Wizard, Player, *stdscr, Databuf[],
-/ Fileloc
-/
-/ GLOBAL OUTPUTS: Echo
-/
-/ DESCRIPTION:
-/ Prompt for player name to examine/change.
-/ If the name is NULL, print a list of all players.
-/ If we are called from within the game, check for the
-/ desired name being the same as the current player's name.
-/ Only the 'Wizard' may alter players.
-/ Items are changed only if a non-zero value is specified.
-/ To change an item to 0, use 0.1; it will be truncated later.
-/
-/ Players may alter their names and passwords, if the following
-/ are true:
-/ - current login matches the character's logins
-/ - the password is known
-/ - the player is not in the middle of the game (ingameflag == FALSE)
-/
-/ The last condition is imposed for two reasons:
-/ - the game could possibly get a bit hectic if a player were
-/ continually changing his/her name
-/ - another player structure would be necessary to check for names
-/ already in use
-/
-*************************************************************************/
-
-changestats(ingameflag)
-bool ingameflag;
-{
-static char flag[2] = /* for printing values of bools */
- {'F', 'T'};
-struct player *playerp;/* pointer to structure to alter */
-char *prompt; /* pointer to prompt string */
-int c; /* input */
-int today; /* day of year of today */
-int temp; /* temporary variable */
-long loc; /* location in player file */
-time_t now; /* time now */
-double dtemp; /* temporary variable */
-bool *bptr; /* pointer to bool item to change */
-double *dptr; /* pointer to double item to change */
-short *sptr; /* pointer to short item to change */
-
- clear();
-
- for (;;)
- /* get name of player to examine/alter */
- {
- mvaddstr(5, 0, "Which character do you want to look at ? ");
- getstring(Databuf, SZ_DATABUF);
- truncstring(Databuf);
-
- if (Databuf[0] == '\0')
- userlist(ingameflag);
- else
- break;
- }
-
- loc = -1L;
-
- if (!ingameflag)
- /* use 'Player' structure */
- playerp = &Player;
- else if (strcmp(Databuf, Player.p_name) == 0)
- /* alter/examine current player */
- {
- playerp = &Player;
- loc = Fileloc;
- }
- else
- /* use 'Other' structure */
- playerp = &Other;
-
- /* find player on file */
- if (loc < 0L && (loc = findname(Databuf, playerp)) < 0L)
- /* didn't find player */
- {
- clear();
- mvaddstr(11, 0, "Not found.");
- return;
- }
-
- time(&now);
- today = localtime(&now)->tm_yday;
-
- clear();
-
- for (;;)
- /* print player structure, and prompt for action */
- {
- mvprintw(0, 0,"A:Name %s\n", playerp->p_name);
-
- if (Wizard)
- printw("B:Password %s\n", playerp->p_password);
- else
- addstr("B:Password XXXXXXXX\n");
-
- printw(" :Login %s\n", playerp->p_login);
-
- printw("C:Experience %.0f\n", playerp->p_experience);
- printw("D:Level %.0f\n", playerp->p_level);
- printw("E:Strength %.0f\n", playerp->p_strength);
- printw("F:Sword %.0f\n", playerp->p_sword);
- printw(" :Might %.0f\n", playerp->p_might);
- printw("G:Energy %.0f\n", playerp->p_energy);
- printw("H:Max-Energy %.0f\n", playerp->p_maxenergy);
- printw("I:Shield %.0f\n", playerp->p_shield);
- printw("J:Quickness %.0f\n", playerp->p_quickness);
- printw("K:Quicksilver %.0f\n", playerp->p_quksilver);
- printw(" :Speed %.0f\n", playerp->p_speed);
- printw("L:Magic Level %.0f\n", playerp->p_magiclvl);
- printw("M:Mana %.0f\n", playerp->p_mana);
- printw("N:Brains %.0f\n", playerp->p_brains);
-
- if (Wizard || playerp->p_specialtype != SC_VALAR)
- mvaddstr(0, 40, descrstatus(playerp));
-
- mvprintw(1, 40, "O:Poison %0.3f\n", playerp->p_poison);
- mvprintw(2, 40, "P:Gold %.0f\n", playerp->p_gold);
- mvprintw(3, 40, "Q:Gem %.0f\n", playerp->p_gems);
- mvprintw(4, 40, "R:Sin %0.3f\n", playerp->p_sin);
- if (Wizard)
- {
- mvprintw(5, 40, "S:X-coord %.0f\n", playerp->p_x);
- mvprintw(6, 40, "T:Y-coord %.0f\n", playerp->p_y);
- }
- else
- {
- mvaddstr(5, 40, "S:X-coord ?\n");
- mvaddstr(6, 40, "T:Y-coord ?\n");
- }
-
- mvprintw(7, 40, "U:Age %ld\n", playerp->p_age);
- mvprintw(8, 40, "V:Degenerated %d\n", playerp->p_degenerated);
-
- mvprintw(9, 40, "W:Type %d (%s)\n",
- playerp->p_type, descrtype(playerp, FALSE) + 1);
- mvprintw(10, 40, "X:Special Type %d\n", playerp->p_specialtype);
- mvprintw(11, 40, "Y:Lives %d\n", playerp->p_lives);
- mvprintw(12, 40, "Z:Crowns %d\n", playerp->p_crowns);
- mvprintw(13, 40, "0:Charms %d\n", playerp->p_charms);
- mvprintw(14, 40, "1:Amulets %d\n", playerp->p_amulets);
- mvprintw(15, 40, "2:Holy Water %d\n", playerp->p_holywater);
-
- temp = today - playerp->p_lastused;
- if (temp < 0)
- /* last year */
- temp += 365;
- mvprintw(16, 40, "3:Lastused %d (%d)\n", playerp->p_lastused, temp);
-
- mvprintw(18, 8, "4:Palantir %c 5:Blessing %c 6:Virgin %c 7:Blind %c",
- flag[playerp->p_palantir],
- flag[playerp->p_blessing],
- flag[playerp->p_virgin],
- flag[playerp->p_blindness]);
-
- if (!Wizard)
- mvprintw(19, 8, "8:Ring %c",
- flag[playerp->p_ring.ring_type != R_NONE]);
- else
- mvprintw(19, 8, "8:Ring %d 9:Duration %d",
- playerp->p_ring.ring_type, playerp->p_ring.ring_duration);
-
- if (!Wizard
- /* not wizard */
- && (ingameflag || strcmp(Login, playerp->p_login) != 0))
- /* in game or not examining own character */
- {
- if (ingameflag)
- {
- more(LINES - 1);
- clear();
- return;
- }
- else
- cleanup(TRUE);
- /*NOTREACHED*/
- }
-
- mvaddstr(20, 0, "!:Quit ?:Delete");
- mvaddstr(21, 0, "What would you like to change ? ");
-
- if (Wizard)
- c = getanswer(" ", TRUE);
- else
- /* examining own player; allow to change name and password */
- c = getanswer("!BA", FALSE);
-
- switch (c)
- {
- case 'A': /* change name */
- case 'B': /* change password */
- if (!Wizard)
- /* prompt for password */
- {
- mvaddstr(23, 0, "Password ? ");
- Echo = FALSE;
- getstring(Databuf, 9);
- Echo = TRUE;
- if (strcmp(Databuf, playerp->p_password) != 0)
- continue;
- }
-
- if (c == 'A')
- /* get new name */
- {
- mvaddstr(23, 0, "New name: ");
- getstring(Databuf, SZ_NAME);
- truncstring(Databuf);
- if (Databuf[0] != '\0')
- if (Wizard || findname(Databuf, &Other) < 0L)
- strcpy(playerp->p_name, Databuf);
- }
- else
- /* get new password */
- {
- if (!Wizard)
- Echo = FALSE;
-
- do
- /* get two copies of new password until they match */
- {
- /* get first copy */
- mvaddstr(23, 0, "New password ? ");
- getstring(Databuf, SZ_PASSWORD);
- if (Databuf[0] == '\0')
- break;
-
- /* get second copy */
- mvaddstr(23, 0, "One more time ? ");
- getstring(playerp->p_password, SZ_PASSWORD);
- }
- while (strcmp(playerp->p_password, Databuf) != 0);
-
- Echo = TRUE;
- }
-
- continue;
-
- case 'C': /* change experience */
- prompt = "experience";
- dptr = &playerp->p_experience;
- goto DALTER;
-
- case 'D': /* change level */
- prompt = "level";
- dptr = &playerp->p_level;
- goto DALTER;
-
- case 'E': /* change strength */
- prompt = "strength";
- dptr = &playerp->p_strength;
- goto DALTER;
-
- case 'F': /* change swords */
- prompt = "sword";
- dptr = &playerp->p_sword;
- goto DALTER;
-
- case 'G': /* change energy */
- prompt = "energy";
- dptr = &playerp->p_energy;
- goto DALTER;
-
- case 'H': /* change maximum energy */
- prompt = "max energy";
- dptr = &playerp->p_maxenergy;
- goto DALTER;
-
- case 'I': /* change shields */
- prompt = "shield";
- dptr = &playerp->p_shield;
- goto DALTER;
-
- case 'J': /* change quickness */
- prompt = "quickness";
- dptr = &playerp->p_quickness;
- goto DALTER;
-
- case 'K': /* change quicksilver */
- prompt = "quicksilver";
- dptr = &playerp->p_quksilver;
- goto DALTER;
-
- case 'L': /* change magic */
- prompt = "magic level";
- dptr = &playerp->p_magiclvl;
- goto DALTER;
-
- case 'M': /* change mana */
- prompt = "mana";
- dptr = &playerp->p_mana;
- goto DALTER;
-
- case 'N': /* change brains */
- prompt = "brains";
- dptr = &playerp->p_brains;
- goto DALTER;
-
- case 'O': /* change poison */
- prompt = "poison";
- dptr = &playerp->p_poison;
- goto DALTER;
-
- case 'P': /* change gold */
- prompt = "gold";
- dptr = &playerp->p_gold;
- goto DALTER;
-
- case 'Q': /* change gems */
- prompt = "gems";
- dptr = &playerp->p_gems;
- goto DALTER;
-
- case 'R': /* change sin */
- prompt = "sin";
- dptr = &playerp->p_sin;
- goto DALTER;
-
- case 'S': /* change x coord */
- prompt = "x";
- dptr = &playerp->p_x;
- goto DALTER;
-
- case 'T': /* change y coord */
- prompt = "y";
- dptr = &playerp->p_y;
- goto DALTER;
-
- case 'U': /* change age */
- mvprintw(23, 0, "age = %ld; age = ", playerp->p_age);
- dtemp = infloat();
- if (dtemp != 0.0)
- playerp->p_age = (long) dtemp;
- continue;
-
- case 'V': /* change degen */
- mvprintw(23, 0, "degen = %d; degen = ", playerp->p_degenerated);
- dtemp = infloat();
- if (dtemp != 0.0)
- playerp->p_degenerated = (int) dtemp;
- continue;
-
- case 'W': /* change type */
- prompt = "type";
- sptr = &playerp->p_type;
- goto SALTER;
-
- case 'X': /* change special type */
- prompt = "special type";
- sptr = &playerp->p_specialtype;
- goto SALTER;
-
- case 'Y': /* change lives */
- prompt = "lives";
- sptr = &playerp->p_lives;
- goto SALTER;
-
- case 'Z': /* change crowns */
- prompt = "crowns";
- sptr = &playerp->p_crowns;
- goto SALTER;
-
- case '0': /* change charms */
- prompt = "charm";
- sptr = &playerp->p_charms;
- goto SALTER;
-
- case '1': /* change amulet */
- prompt = "amulet";
- sptr = &playerp->p_amulets;
- goto SALTER;
-
- case '2': /* change holy water */
- prompt = "holy water";
- sptr = &playerp->p_holywater;
- goto SALTER;
-
- case '3': /* change last-used */
- prompt = "last-used";
- sptr = &playerp->p_lastused;
- goto SALTER;
-
- case '4': /* change palantir */
- prompt = "palantir";
- bptr = &playerp->p_palantir;
- goto BALTER;
-
- case '5': /* change blessing */
- prompt = "blessing";
- bptr = &playerp->p_blessing;
- goto BALTER;
-
- case '6': /* change virgin */
- prompt = "virgin";
- bptr = &playerp->p_virgin;
- goto BALTER;
-
- case '7': /* change blindness */
- prompt = "blindness";
- bptr = &playerp->p_blindness;
- goto BALTER;
-
- case '8': /* change ring type */
- prompt = "ring-type";
- sptr = &playerp->p_ring.ring_type;
- goto SALTER;
-
- case '9': /* change ring duration */
- prompt = "ring-duration";
- sptr = &playerp->p_ring.ring_duration;
- goto SALTER;
-
- case '!': /* quit, update */
- if (Wizard &&
- (!ingameflag || playerp != &Player))
- /* turn off status if not modifying self */
- {
- playerp->p_status = S_OFF;
- playerp->p_tampered = T_OFF;
- }
-
- writerecord(playerp, loc);
- clear();
- return;
-
- case '?': /* delete player */
- if (ingameflag && playerp == &Player)
- /* cannot delete self */
- continue;
-
- freerecord(playerp, loc);
- clear();
- return;
-
- default:
- continue;
- }
-DALTER:
- mvprintw(23, 0, "%s = %f; %s = ", prompt, *dptr, prompt);
- dtemp = infloat();
- if (dtemp != 0.0)
- *dptr = dtemp;
- continue;
-
-SALTER:
- mvprintw(23, 0, "%s = %d; %s = ", prompt, *sptr, prompt);
- dtemp = infloat();
- if (dtemp != 0.0)
- *sptr = (short) dtemp;
- continue;
-
-BALTER:
- mvprintw(23, 0, "%s = %c; %s = ", prompt, flag[*bptr], prompt);
- c = getanswer("\nTF", TRUE);
- if (c == 'T')
- *bptr = TRUE;
- else if (c == 'F')
- *bptr = FALSE;
- continue;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: monstlist()
-/
-/ FUNCTION: print a monster listing
-/
-/ AUTHOR: E. A. Estes, 2/27/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: puts(), fread(), fseek(), printf()
-/
-/ GLOBAL INPUTS: Curmonster, *Monstfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Read monster file, and print a monster listing on standard output.
-/
-*************************************************************************/
-
-monstlist()
-{
-int count = 0; /* count in file */
-
- puts(" #) Name Str Brain Quick Energy Exper Treas Type Flock%\n");
- fseek(Monstfp, 0L, 0);
- while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
- printf("%2d) %-20.20s%4.0f %4.0f %2.0f %5.0f %5.0f %2d %2d %3.0f\n", count++,
- Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains,
- Curmonster.m_speed, Curmonster.m_energy, Curmonster.m_experience,
- Curmonster.m_treasuretype, Curmonster.m_type, Curmonster.m_flock);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: scorelist()
-/
-/ FUNCTION: print player score board
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fread(), fopen(), printf(), fclose()
-/
-/ GLOBAL INPUTS:
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Read the scoreboard file and print the contents.
-/
-*************************************************************************/
-
-scorelist()
-{
-struct scoreboard sbuf; /* for reading entries */
-FILE *fp; /* to open the file */
-
- if ((fp = fopen(_PATH_SCORE, "r")) != NULL)
- {
- while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
- printf("%-20s (%-9s) Level: %6.0f Type: %s\n",
- sbuf.sb_name, sbuf.sb_login, sbuf.sb_level, sbuf.sb_type);
- fclose(fp);
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: activelist()
-/
-/ FUNCTION: print list of active players to standard output
-/
-/ AUTHOR: E. A. Estes, 3/7/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: descrstatus(), fread(), fseek(), printf(), descrtype()
-/
-/ GLOBAL INPUTS: Other, *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Read player file, and print list of active records to standard output.
-/
-*************************************************************************/
-
-activelist()
-{
- fseek(Playersfp, 0L, 0);
- printf("Current characters on file are:\n\n");
-
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_status != S_NOTUSED)
- printf("%-20s (%-9s) Level: %6.0f %s (%s)\n",
- Other.p_name, Other.p_login, Other.p_level,
- descrtype(&Other, FALSE), descrstatus(&Other));
-
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: purgeoldplayers()
-/
-/ FUNCTION: purge inactive players from player file
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: freerecord(), time(), fread(), fseek(), localtime()
-/
-/ GLOBAL INPUTS: Other, *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Delete characters which have not been used with the last
-/ three weeks.
-/
-*************************************************************************/
-
-purgeoldplayers()
-{
-int today; /* day of year for today */
-int daysold; /* how many days since the character has been used */
-time_t ltime; /* time in seconds */
-long loc = 0L; /* location in file */
-
- time(&ltime);
- today = localtime(&ltime)->tm_yday;
-
- for (;;)
- {
- fseek(Playersfp, loc, 0);
- if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
- break;
-
- daysold = today - Other.p_lastused;
- if (daysold < 0)
- daysold += 365;
-
- if (daysold > N_DAYSOLD)
- /* player hasn't been used in a while; delete */
- freerecord(&Other, loc);
-
- loc += SZ_PLAYERSTRUCT;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: enterscore()
-/
-/ FUNCTION: enter player into scoreboard
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fread(), fseek(), fopen(), error(), strcmp(), fclose(),
-/ strcpy(), fwrite(), descrtype()
-/
-/ GLOBAL INPUTS: Player
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ The scoreboard keeps track of the highest character on a
-/ per-login basis.
-/ Search the scoreboard for an entry for the current login,
-/ if an entry is found, and it is lower than the current player,
-/ replace it, otherwise create an entry.
-/
-*************************************************************************/
-
-enterscore()
-{
-struct scoreboard sbuf; /* buffer to read in scoreboard entries */
-FILE *fp; /* to open scoreboard file */
-long loc = 0L; /* location in scoreboard file */
-bool found = FALSE; /* set if we found an entry for this login */
-
- if ((fp = fopen(_PATH_SCORE, "r+")) != NULL)
- {
- while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
- if (strcmp(Player.p_login, sbuf.sb_login) == 0)
- {
- found = TRUE;
- break;
- }
- else
- loc += SZ_SCORESTRUCT;
- }
- else
- {
- error(_PATH_SCORE);
- /*NOTREACHED*/
- }
-
- /*
- * At this point, 'loc' will either indicate a point beyond
- * the end of file, or the place where the previous entry
- * was found.
- */
-
- if ((!found) || Player.p_level > sbuf.sb_level)
- /* put new entry in for this login */
- {
- strcpy(sbuf.sb_login, Player.p_login);
- strcpy(sbuf.sb_name, Player.p_name);
- sbuf.sb_level = Player.p_level;
- strcpy(sbuf.sb_type, descrtype(&Player, TRUE));
- }
-
- /* update entry */
- fseek(fp, loc, 0);
- fwrite((char *) &sbuf, SZ_SCORESTRUCT, 1, fp);
- fclose(fp);
-}
diff --git a/games/phantasia/include.h b/games/phantasia/include.h
deleted file mode 100644
index 812b5a5..0000000
--- a/games/phantasia/include.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * include.h - includes all important files for Phantasia
- */
-
-#include <ctype.h>
-#include <curses.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <time.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "macros.h"
-#include "phantdefs.h"
-#include "phantstruct.h"
-#include "phantglobs.h"
-#include "pathnames.h"
diff --git a/games/phantasia/interplayer.c b/games/phantasia/interplayer.c
deleted file mode 100644
index 6a7f9ec..0000000
--- a/games/phantasia/interplayer.c
+++ /dev/null
@@ -1,1211 +0,0 @@
-/*
- * interplayer.c - player to player routines for Phantasia
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include "include.h"
-
-/************************************************************************
-/
-/ FUNCTION NAME: checkbattle()
-/
-/ FUNCTION: check to see if current player should battle another
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: battleplayer(), fread(), fseek()
-/
-/ GLOBAL INPUTS: Other, Users, Player, Fileloc, *Playersfp
-/
-/ GLOBAL OUTPUTS: Users
-/
-/ DESCRIPTION:
-/ Seach player file for a foe at the same coordinates as the
-/ current player.
-/ Also update user count.
-/
-*************************************************************************/
-
-checkbattle()
-{
-long foeloc = 0L; /* location in file of person to fight */
-
- Users = 0;
- fseek(Playersfp, 0L, 0);
-
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- {
- if (Other.p_status != S_OFF
- && Other.p_status != S_NOTUSED
- && Other.p_status != S_HUNGUP
- && (Other.p_status != S_CLOAKED || Other.p_specialtype != SC_VALAR))
- /* player is on and not a cloaked valar */
- {
- ++Users;
-
- if (Player.p_x == Other.p_x
- && Player.p_y == Other.p_y
- /* same coordinates */
- && foeloc != Fileloc
- /* not self */
- && Player.p_status == S_PLAYING
- && (Other.p_status == S_PLAYING || Other.p_status == S_INBATTLE)
- /* both are playing */
- && Other.p_specialtype != SC_VALAR
- && Player.p_specialtype != SC_VALAR)
- /* neither is valar */
- {
- battleplayer(foeloc);
- return;
- }
- }
- foeloc += SZ_PLAYERSTRUCT;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: battleplayer()
-/
-/ FUNCTION: inter-terminal battle with another player
-/
-/ AUTHOR: E. A. Estes, 2/15/86
-/
-/ ARGUMENTS:
-/ long foeplace - location in player file of person to battle
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: readrecord(), readmessage(), writerecord(), collecttaxes(),
-/ displaystats(), fabs(), more(), death(), sleep(), wmove(), waddch(), printw(),
-/ myturn(), altercoordinates(), waddstr(), wrefresh(), mvprintw(),
-/ getanswer(), wclrtoeol(), wclrtobot()
-/
-/ GLOBAL INPUTS: Foestrikes, LINES, Lines, Other, Shield, Player, *stdscr,
-/ Fileloc, *Enemyname
-/
-/ GLOBAL OUTPUTS: Foestrikes, Lines, Shield, Player, Luckout, *Enemyname
-/
-/ DESCRIPTION:
-/ Inter-terminal battle is a very fragile and slightly klugy thing.
-/ At any time, one player is master and the other is slave.
-/ We pick who is master first by speed and level. After that,
-/ the slave waits for the master to relinquish its turn, and
-/ the slave becomes master, and so on.
-/
-/ The items in the player structure which control the handshake are:
-/ p_tampered:
-/ master increments this to relinquish control
-/ p_istat:
-/ master sets this to specify particular action
-/ p_1scratch:
-/ set to total damage inflicted so far; changes to indicate action
-/
-*************************************************************************/
-
-battleplayer(foeplace)
-long foeplace;
-{
-double dtemp; /* for temporary calculations */
-double oldhits = 0.0; /* previous damage inflicted by foe */
-int loop; /* for timing out */
-int ch; /* input */
-short oldtampered; /* old value of foe's p_tampered */
-
- Lines = 8;
- Luckout = FALSE;
- mvaddstr(4, 0, "Preparing for battle!\n");
- refresh();
-
-#ifdef SYS5
- flushinp();
-#endif
-
- /* set up variables, file, etc. */
- Player.p_status = S_INBATTLE;
- Shield = Player.p_energy;
-
- /* if p_tampered is not 0, someone else may try to change it (king, etc.) */
- Player.p_tampered = oldtampered = 1;
- Player.p_1scratch = 0.0;
- Player.p_istat = I_OFF;
-
- readrecord(&Other, foeplace);
- if (fabs(Player.p_level - Other.p_level) > 20.0)
- /* see if players are greatly mismatched */
- {
- dtemp = (Player.p_level - Other.p_level) / MAX(Player.p_level, Other.p_level);
- if (dtemp < -0.5)
- /* foe outweighs this one */
- Player.p_speed *= 2.0;
- }
-
- writerecord(&Player, Fileloc); /* write out all our info */
-
- if (Player.p_blindness)
- Enemyname = "someone";
- else
- Enemyname = Other.p_name;
-
- mvprintw(6, 0, "You have encountered %s Level: %.0f\n", Enemyname, Other.p_level);
- refresh();
-
- for (loop = 0; Other.p_status != S_INBATTLE && loop < 30; ++loop)
- /* wait for foe to respond */
- {
- readrecord(&Other, foeplace);
- sleep(1);
- }
-
- if (Other.p_status != S_INBATTLE)
- /* foe did not respond */
- {
- mvprintw(5, 0, "%s is not responding.\n", Enemyname);
- goto LEAVE;
- }
- /* else, we are ready to battle */
-
- move(4, 0);
- clrtoeol();
-
- /*
- * determine who is first master
- * if neither player is faster, check level
- * if neither level is greater, battle is not allowed
- * (this should never happen, but we have to handle it)
- */
- if (Player.p_speed > Other.p_speed)
- Foestrikes = FALSE;
- else if (Other.p_speed > Player.p_speed)
- Foestrikes = TRUE;
- else if (Player.p_level > Other.p_level)
- Foestrikes = FALSE;
- else if (Other.p_level > Player.p_level)
- Foestrikes = TRUE;
- else
- /* no one is faster */
- {
- printw("You can't fight %s yet.", Enemyname);
- goto LEAVE;
- }
-
- for (;;)
- {
- displaystats();
- readmessage();
- mvprintw(1, 26, "%20.0f", Shield); /* overprint energy */
-
- if (!Foestrikes)
- /* take action against foe */
- myturn();
- else
- /* wait for foe to take action */
- {
- mvaddstr(4, 0, "Waiting...\n");
- clrtoeol();
- refresh();
-
- for (loop = 0; loop < 20; ++loop)
- /* wait for foe to act */
- {
- readrecord(&Other, foeplace);
- if (Other.p_1scratch != oldhits)
- /* p_1scratch changes to indicate action */
- break;
- else
- /* wait and try again */
- {
- sleep(1);
- addch('.');
- refresh();
- }
- }
-
- if (Other.p_1scratch == oldhits)
- {
- /* timeout */
- mvaddstr(22, 0, "Timeout: waiting for response. Do you want to wait ? ");
- ch = getanswer("NY", FALSE);
- move(22, 0);
- clrtobot();
- if (ch == 'Y')
- continue;
- else
- break;
- }
- else
- /* foe took action */
- {
- switch (Other.p_istat)
- {
- case I_RAN: /* foe ran away */
- mvprintw(Lines++, 0, "%s ran away!", Enemyname);
- break;
-
- case I_STUCK: /* foe tried to run, but couldn't */
- mvprintw(Lines++, 0, "%s tried to run away.", Enemyname);
- break;
-
- case I_BLEWIT: /* foe tried to luckout, but didn't */
- mvprintw(Lines++, 0, "%s tried to luckout!", Enemyname);
- break;
-
- default:
- dtemp = Other.p_1scratch - oldhits;
- mvprintw(Lines++, 0, "%s hit you %.0f times!", Enemyname, dtemp);
- Shield -= dtemp;
- break;
- }
-
- oldhits = Other.p_1scratch; /* keep track of old hits */
-
- if (Other.p_tampered != oldtampered)
- /* p_tampered changes to relinquish turn */
- {
- oldtampered = Other.p_tampered;
- Foestrikes = FALSE;
- }
- }
- }
-
- /* decide what happens next */
- refresh();
- if (Lines > LINES - 2)
- {
- more(Lines);
- move(Lines = 8, 0);
- clrtobot();
- }
-
- if (Other.p_istat == I_KILLED || Shield < 0.0)
- /* we died */
- {
- Shield = -2.0; /* insure this value is negative */
- break;
- }
-
- if (Player.p_istat == I_KILLED)
- /* we killed foe; award treasre */
- {
- mvprintw(Lines++, 0, "You killed %s!", Enemyname);
- Player.p_experience += Other.p_experience;
- Player.p_crowns += (Player.p_level < 1000.0) ? Other.p_crowns : 0;
- Player.p_amulets += Other.p_amulets;
- Player.p_charms += Other.p_charms;
- collecttaxes(Other.p_gold, Other.p_gems);
- Player.p_sword = MAX(Player.p_sword, Other.p_sword);
- Player.p_shield = MAX(Player.p_shield, Other.p_shield);
- Player.p_quksilver = MAX(Player.p_quksilver, Other.p_quksilver);
- if (Other.p_virgin && !Player.p_virgin)
- {
- mvaddstr(Lines++, 0, "You have rescued a virgin. Will you be honorable ? ");
- if ((ch = getanswer("YN", FALSE)) == 'Y')
- Player.p_virgin = TRUE;
- else
- {
- ++Player.p_sin;
- Player.p_experience += 8000.0;
- }
- }
- sleep(3); /* give other person time to die */
- break;
- }
- else if (Player.p_istat == I_RAN || Other.p_istat == I_RAN)
- /* either player ran away */
- break;
- }
-
-LEAVE:
- /* clean up things and leave */
- writerecord(&Player, Fileloc); /* update a final time */
- altercoordinates(0.0, 0.0, A_NEAR); /* move away from battle site */
- Player.p_energy = Shield; /* set energy to actual value */
- Player.p_tampered = T_OFF; /* clear p_tampered */
-
- more(Lines); /* pause */
-
- move(4, 0);
- clrtobot(); /* clear bottom area of screen */
-
- if (Player.p_energy < 0.0)
- /* we are dead */
- death("Interterminal battle");
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: myturn()
-/
-/ FUNCTION: process players action against foe in battle
-/
-/ AUTHOR: E. A. Estes, 2/7/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), inputoption(), floor(), wmove(), drandom(),
-/ waddstr(), wrefresh(), mvprintw(), wclrtoeol(), wclrtobot()
-/
-/ GLOBAL INPUTS: Lines, Other, Player, *stdscr, Fileloc, Luckout,
-/ *Enemyname
-/
-/ GLOBAL OUTPUTS: Foestrikes, Lines, Player, Luckout
-/
-/ DESCRIPTION:
-/ Take action action against foe, and decide who is master
-/ for next iteration.
-/
-*************************************************************************/
-
-myturn()
-{
-double dtemp; /* for temporary calculations */
-int ch; /* input */
-
- mvaddstr(7, 0, "1:Fight 2:Run Away! 3:Power Blast ");
- if (Luckout)
- clrtoeol();
- else
- addstr("4:Luckout ");
-
- ch = inputoption();
- move(Lines = 8, 0);
- clrtobot();
-
- switch (ch)
- {
- default: /* fight */
- dtemp = ROLL(2.0, Player.p_might);
-HIT:
- mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, dtemp);
- Player.p_sin += 0.5;
- Player.p_1scratch += dtemp;
- Player.p_istat = I_OFF;
- break;
-
- case '2': /* run away */
- Player.p_1scratch -= 1.0; /* change this to indicate action */
- if (drandom() > 0.25)
- {
- mvaddstr(Lines++, 0, "You got away!");
- Player.p_istat = I_RAN;
- }
- else
- {
- mvprintw(Lines++, 0, "%s is still after you!", Enemyname);
- Player.p_istat = I_STUCK;
- }
- break;
-
- case '3': /* power blast */
- dtemp = MIN(Player.p_mana, Player.p_level * 5.0);
- Player.p_mana -= dtemp;
- dtemp *= (drandom() + 0.5) * Player.p_magiclvl * 0.2 + 2.0;
- mvprintw(Lines++, 0, "You blasted %s !", Enemyname);
- goto HIT;
-
- case '4': /* luckout */
- if (Luckout || drandom() > 0.1)
- {
- if (Luckout)
- mvaddstr(Lines++, 0, "You already tried that!");
- else
- {
- mvaddstr(Lines++, 0, "Not this time . . .");
- Luckout = TRUE;
- }
-
- Player.p_1scratch -= 1.0;
- Player.p_istat = I_BLEWIT;
- }
- else
- {
- mvaddstr(Lines++, 0, "You just lucked out!");
- Player.p_1scratch = Other.p_energy * 1.1;
- }
- break;
- }
-
- refresh();
- Player.p_1scratch = floor(Player.p_1scratch); /* clean up any mess */
-
- if (Player.p_1scratch > Other.p_energy)
- Player.p_istat = I_KILLED;
- else if (drandom() * Player.p_speed < drandom() * Other.p_speed)
- /* relinquish control */
- {
- ++Player.p_tampered;
- Foestrikes = TRUE;
- }
-
- writerecord(&Player, Fileloc); /* let foe know what we did */
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: checktampered()
-/
-/ FUNCTION: check if current player has been tampered with
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: readrecord(), fread(), fseek(), tampered(), writevoid()
-/
-/ GLOBAL INPUTS: *Energyvoidfp, Other, Player, Fileloc, Enrgyvoid
-/
-/ GLOBAL OUTPUTS: Enrgyvoid
-/
-/ DESCRIPTION:
-/ Check for energy voids, holy grail, and tampering by other
-/ players.
-/
-*************************************************************************/
-
-checktampered()
-{
-long loc = 0L; /* location in energy void file */
-
- /* first check for energy voids */
- fseek(Energyvoidfp, 0L, 0);
- while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
- if (Enrgyvoid.ev_active
- && Enrgyvoid.ev_x == Player.p_x
- && Enrgyvoid.ev_y == Player.p_y)
- /* sitting on one */
- {
- if (loc > 0L)
- /* not the holy grail; inactivate energy void */
- {
- Enrgyvoid.ev_active = FALSE;
- writevoid(&Enrgyvoid, loc);
- tampered(T_NRGVOID, 0.0, 0.0);
- }
- else if (Player.p_status != S_CLOAKED)
- /* holy grail */
- tampered(T_GRAIL, 0.0, 0.0);
- break;
- }
- else
- loc += SZ_VOIDSTRUCT;
-
- /* now check for other things */
- readrecord(&Other, Fileloc);
- if (Other.p_tampered != T_OFF)
- tampered(Other.p_tampered, Other.p_1scratch, Other.p_2scratch);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: tampered()
-/
-/ FUNCTION: take care of tampering by other players
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ int what - what type of tampering
-/ double arg1, arg2 - rest of tampering info
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), more(), fread(), death(), fseek(), sleep(),
-/ floor(), wmove(), waddch(), drandom(), printw(), altercoordinates(),
-/ waddstr(), wrefresh(), encounter(), writevoid()
-/
-/ GLOBAL INPUTS: Other, Player, *stdscr, Enrgyvoid, *Playersfp
-/
-/ GLOBAL OUTPUTS: Other, Player, Changed, Enrgyvoid
-/
-/ DESCRIPTION:
-/ Take care of energy voids, holy grail, decree and intervention
-/ action on current player.
-/
-*************************************************************************/
-
-tampered(what, arg1, arg2)
-int what;
-double arg1;
-double arg2;
-{
-long loc; /* location in file of other players */
-
- Changed = TRUE;
- move(4,0);
-
- Player.p_tampered = T_OFF; /* no longer tampered with */
-
- switch (what)
- {
- case T_NRGVOID:
- addstr("You've hit an energy void !\n");
- Player.p_mana /= 3.0;
- Player.p_energy /= 2.0;
- Player.p_gold = floor(Player.p_gold/1.25) + 0.1;
- altercoordinates(0.0, 0.0, A_NEAR);
- break;
-
- case T_TRANSPORT:
- addstr("The king transported you ! ");
- if (Player.p_charms > 0)
- {
- addstr("But your charm saved you. . .\n");
- --Player.p_charms;
- }
- else
- {
- altercoordinates(0.0, 0.0, A_FAR);
- addch('\n');
- }
- break;
-
- case T_BESTOW:
- printw("The king has bestowed %.0f gold pieces on you !\n", arg1);
- Player.p_gold += arg1;
- break;
-
- case T_CURSED:
- addstr("You've been cursed ! ");
- if (Player.p_blessing)
- {
- addstr("But your blessing saved you. . .\n");
- Player.p_blessing = FALSE;
- }
- else
- {
- addch('\n');
- Player.p_poison += 2.0;
- Player.p_energy = 10.0;
- Player.p_maxenergy *= 0.95;
- Player.p_status = S_PLAYING; /* no longer cloaked */
- }
- break;
-
- case T_VAPORIZED:
- addstr("You have been vaporized!\n");
- more(7);
- death("Vaporization");
- break;
-
- case T_MONSTER:
- addstr("The Valar zapped you with a monster!\n");
- more(7);
- encounter((int) arg1);
- return;
-
- case T_BLESSED:
- addstr("The Valar has blessed you!\n");
- Player.p_energy = (Player.p_maxenergy *= 1.05) + Player.p_shield;
- Player.p_mana += 500.0;
- Player.p_strength += 0.5;
- Player.p_brains += 0.5;
- Player.p_magiclvl += 0.5;
- Player.p_poison = MIN(0.5, Player.p_poison);
- break;
-
- case T_RELOCATE:
- addstr("You've been relocated. . .\n");
- altercoordinates(arg1, arg2, A_FORCED);
- break;
-
- case T_HEAL:
- addstr("You've been healed!\n");
- Player.p_poison -= 0.25;
- Player.p_energy = Player.p_maxenergy + Player.p_shield;
- break;
-
- case T_EXVALAR:
- addstr("You are no longer Valar!\n");
- Player.p_specialtype = SC_COUNCIL;
- break;
-
- case T_GRAIL:
- addstr("You have found The Holy Grail!!\n");
- if (Player.p_specialtype < SC_COUNCIL)
- /* must be council of wise to behold grail */
- {
- addstr("However, you are not experienced enough to behold it.\n");
- Player.p_sin *= Player.p_sin;
- Player.p_mana += 1000;
- }
- else if (Player.p_specialtype == SC_VALAR
- || Player.p_specialtype == SC_EXVALAR)
- {
- addstr("You have made it to the position of Valar once already.\n");
- addstr("The Grail is of no more use to you now.\n");
- }
- else
- {
- addstr("It is now time to see if you are worthy to behold it. . .\n");
- refresh();
- sleep(4);
-
- if (drandom() / 2.0 < Player.p_sin)
- {
- addstr("You have failed!\n");
- Player.p_strength =
- Player.p_mana =
- Player.p_energy =
- Player.p_maxenergy =
- Player.p_magiclvl =
- Player.p_brains =
- Player.p_experience =
- Player.p_quickness = 1.0;
-
- altercoordinates(1.0, 1.0, A_FORCED);
- Player.p_level = 0.0;
- }
- else
- {
- addstr("You made to position of Valar!\n");
- Player.p_specialtype = SC_VALAR;
- Player.p_lives = 5;
- fseek(Playersfp, 0L, 0);
- loc = 0L;
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- /* search for existing valar */
- if (Other.p_specialtype == SC_VALAR
- && Other.p_status != S_NOTUSED)
- /* found old valar */
- {
- Other.p_tampered = T_EXVALAR;
- writerecord(&Other, loc);
- break;
- }
- else
- loc += SZ_PLAYERSTRUCT;
- }
- }
-
- /* move grail to new location */
- Enrgyvoid.ev_active = TRUE;
- Enrgyvoid.ev_x = ROLL(-1.0e6, 2.0e6);
- Enrgyvoid.ev_y = ROLL(-1.0e6, 2.0e6);
- writevoid(&Enrgyvoid, 0L);
- break;
- }
- refresh();
- sleep(2);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: userlist()
-/
-/ FUNCTION: print list of players and locations
-/
-/ AUTHOR: E. A. Estes, 2/28/86
-/
-/ ARGUMENTS:
-/ bool ingameflag - set if called while playing
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: descrstatus(), descrlocation(), more(), fread(), fseek(),
-/ floor(), wmove(), printw(), waddstr(), distance(), wrefresh(),
-/ descrtype(), wclrtobot()
-/
-/ GLOBAL INPUTS: LINES, Other, Circle, Wizard, Player, *stdscr, *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ We can only see the coordinate of those closer to the origin
-/ from us.
-/ Kings and council of the wise can see and can be seen by everyone.
-/ Palantirs are good for seeing everyone; and the valar can use
-/ one to see through a 'cloak' spell.
-/ The valar has no coordinates, and is completely invisible if
-/ cloaked.
-/
-*************************************************************************/
-
-userlist(ingameflag)
-bool ingameflag;
-{
-int numusers = 0; /* number of users on file */
-
- if (ingameflag && Player.p_blindness)
- {
- mvaddstr(8, 0, "You cannot see anyone.\n");
- return;
- }
-
- fseek(Playersfp, 0L, 0);
- mvaddstr(8, 0,
- "Name X Y Lvl Type Login Status\n");
-
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- {
- if (Other.p_status == S_NOTUSED
- /* record is unused */
- || (Other.p_specialtype == SC_VALAR && Other.p_status == S_CLOAKED))
- /* cloaked valar */
- {
- if (!Wizard)
- /* wizard can see everything on file */
- continue;
- }
-
- ++numusers;
-
- if (ingameflag &&
- /* must be playing for the rest of these conditions */
- (Player.p_specialtype >= SC_KING
- /* kings and higher can see others */
- || Other.p_specialtype >= SC_KING
- /* kings and higher can be seen by others */
- || Circle >= CIRCLE(Other.p_x, Other.p_y)
- /* those nearer the origin can be seen */
- || Player.p_palantir)
- /* palantir enables one to see others */
- && (Other.p_status != S_CLOAKED
- || (Player.p_specialtype == SC_VALAR && Player.p_palantir))
- /* not cloaked; valar can see through cloak with a palantir */
- && Other.p_specialtype != SC_VALAR)
- /* not a valar */
- /* coordinates should be printed */
- printw("%-20s %8.0f %8.0f ",
- Other.p_name, Other.p_x, Other.p_y);
- else
- /* cannot see player's coordinates */
- printw("%-20s %19.19s ",
- Other.p_name, descrlocation(&Other, TRUE));
-
- printw("%6.0f %s %-9.9s%s\n", Other.p_level, descrtype(&Other, TRUE),
- Other.p_login, descrstatus(&Other));
-
- if ((numusers % (LINES - 10)) == 0)
- {
- more(LINES - 1);
- move(9, 0);
- clrtobot();
- }
- }
-
- printw("Total players on file = %d\n", numusers);
- refresh();
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: throneroom()
-/
-/ FUNCTION: king stuff upon entering throne
-/
-/ AUTHOR: E. A. Estes, 12/16/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), fread(), fseek(), fopen(), wmove(), fclose(),
-/ fwrite(), altercoordinates(), waddstr(), fprintf()
-/
-/ GLOBAL INPUTS: *Energyvoidfp, Other, Player, *stdscr,
-/ Enrgyvoid, *Playersfp
-/
-/ GLOBAL OUTPUTS: Other, Player, Changed
-/
-/ DESCRIPTION:
-/ If player is not already king, make him/her so if the old king
-/ is not playing.
-/ Clear energy voids with new king.
-/ Print 'decree' prompt.
-/
-*************************************************************************/
-
-throneroom()
-{
-FILE *fp; /* to clear energy voids */
-long loc = 0L; /* location of old king in player file */
-
- if (Player.p_specialtype < SC_KING)
- /* not already king -- assumes crown */
- {
- fseek(Playersfp, 0L, 0);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED)
- /* found old king */
- {
- if (Other.p_status != S_OFF)
- /* old king is playing */
- {
- mvaddstr( 4, 0, "The king is playing, so you cannot steal his throne\n");
- altercoordinates(0.0, 0.0, A_NEAR);
- move(6, 0);
- return;
- }
- else
- /* old king is not playing - remove him/her */
- {
- Other.p_specialtype = SC_NONE;
- if (Other.p_crowns)
- --Other.p_crowns;
- writerecord(&Other, loc);
- break;
- }
- }
- else
- loc += SZ_PLAYERSTRUCT;
-
- /* make player new king */
- Changed = TRUE;
- Player.p_specialtype = SC_KING;
- mvaddstr(4, 0, "You have become king!\n");
-
- /* let everyone else know */
- fp = fopen(_PATH_MESS, "w");
- fprintf(fp, "All hail the new king!");
- fclose(fp);
-
- /* clear all energy voids; retain location of holy grail */
- fseek(Energyvoidfp, 0L, 0);
- fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
- fp = fopen(_PATH_VOID, "w");
- fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
- fclose(fp);
- }
-
- mvaddstr(6, 0, "0:Decree ");
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: dotampered()
-/
-/ FUNCTION: king and valar special options
-/
-/ AUTHOR: E. A. Estes, 2/28/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), truncstring(), fread(), fseek(), fopen(),
-/ floor(), wmove(), drandom(), fclose(), fwrite(), sscanf(), strcmp(),
-/ infloat(), waddstr(), findname(), distance(), userlist(), mvprintw(),
-/ allocvoid(), getanswer(), getstring(), wclrtoeol(), writevoid()
-/
-/ GLOBAL INPUTS: *Energyvoidfp, Other, Illcmd[], Wizard, Player, *stdscr,
-/ Databuf[], Enrgyvoid
-/
-/ GLOBAL OUTPUTS: Other, Player, Enrgyvoid
-/
-/ DESCRIPTION:
-/ Tamper with other players. Handle king/valar specific options.
-/
-*************************************************************************/
-
-dotampered()
-{
-short tamper; /* value for tampering with other players */
-char *option; /* pointer to option description */
-double temp1 = 0.0, temp2 = 0.0; /* other tampering values */
-int ch; /* input */
-long loc; /* location in energy void file */
-FILE *fp; /* for opening gold file */
-
- move(6, 0);
- clrtoeol();
- if (Player.p_specialtype < SC_COUNCIL && !Wizard)
- /* king options */
- {
- addstr("1:Transport 2:Curse 3:Energy Void 4:Bestow 5:Collect Taxes ");
-
- ch = getanswer(" ", TRUE);
- move(6, 0);
- clrtoeol();
- move(4, 0);
- switch (ch)
- {
- case '1': /* transport someone */
- tamper = T_TRANSPORT;
- option = "transport";
- break;
-
- case '2': /* curse another */
- tamper = T_CURSED;
- option = "curse";
- break;
-
- case '3': /* create energy void */
- if ((loc = allocvoid()) > 20L * SZ_VOIDSTRUCT)
- /* can only have 20 void active at once */
- mvaddstr(5, 0, "Sorry, void creation limit reached.\n");
- else
- {
- addstr("Enter the X Y coordinates of void ? ");
- getstring(Databuf, SZ_DATABUF);
- sscanf(Databuf, "%lf %lf", &temp1, &temp2);
- Enrgyvoid.ev_x = floor(temp1);
- Enrgyvoid.ev_y = floor(temp2);
- Enrgyvoid.ev_active = TRUE;
- writevoid(&Enrgyvoid, loc);
- mvaddstr(5, 0, "It is done.\n");
- }
- return;
-
- case '4': /* bestow gold to subject */
- tamper = T_BESTOW;
- addstr("How much gold to bestow ? ");
- temp1 = infloat();
- if (temp1 > Player.p_gold || temp1 < 0)
- {
- mvaddstr(5, 0, "You don't have that !\n");
- return;
- }
-
- /* adjust gold after we are sure it will be given to someone */
- option = "give gold to";
- break;
-
- case '5': /* collect accumulated taxes */
- if ((fp = fopen(_PATH_GOLD, "r+")) != NULL)
- /* collect taxes */
- {
- fread((char *) &temp1, sizeof(double), 1, fp);
- fseek(fp, 0L, 0);
- /* clear out value */
- temp2 = 0.0;
- fwrite((char *) &temp2, sizeof(double), 1, fp);
- fclose(fp);
- }
-
- mvprintw(4, 0, "You have collected %.0f in gold.\n", temp1);
- Player.p_gold += floor(temp1);
- return;
-
- default:
- return;
- }
- /* end of king options */
- }
- else
- /* council of wise, valar, wizard options */
- {
- addstr("1:Heal ");
- if (Player.p_palantir || Wizard)
- addstr("2:Seek Grail ");
- if (Player.p_specialtype == SC_VALAR || Wizard)
- addstr("3:Throw Monster 4:Relocate 5:Bless ");
- if (Wizard)
- addstr("6:Vaporize ");
-
- ch = getanswer(" ", TRUE);
- if (!Wizard)
- {
- if (ch > '2' && Player.p_specialtype != SC_VALAR)
- {
- ILLCMD();
- return;
- }
-
- if (Player.p_mana < MM_INTERVENE)
- {
- mvaddstr(5, 0, "No mana left.\n");
- return;
- }
- else
- Player.p_mana -= MM_INTERVENE;
- }
-
- switch (ch)
- {
- case '1': /* heal another */
- tamper = T_HEAL;
- option = "heal";
- break;
-
- case '2': /* seek grail */
- if (Player.p_palantir)
- /* need a palantir to seek */
- {
- fseek(Energyvoidfp, 0L, 0);
- fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
- temp1 = distance(Player.p_x, Enrgyvoid.ev_x, Player.p_y, Enrgyvoid.ev_y);
- temp1 += ROLL(-temp1 / 10.0, temp1 / 5.0); /* add some error */
- mvprintw(5, 0, "The palantir says the Grail is about %.0f away.\n", temp1);
- }
- else
- /* no palantir */
- mvaddstr(5, 0, "You need a palantir to seek the Grail.\n");
- return;
-
- case '3': /* lob monster at someone */
- mvaddstr(4, 0, "Which monster [0-99] ? ");
- temp1 = infloat();
- temp1 = MAX(0.0, MIN(99.0, temp1));
- tamper = T_MONSTER;
- option = "throw a monster at";
- break;
-
- case '4': /* move another player */
- mvaddstr(4, 0, "New X Y coordinates ? ");
- getstring(Databuf, SZ_DATABUF);
- sscanf(Databuf, "%lf %lf", &temp1, &temp2);
- tamper = T_RELOCATE;
- option = "relocate";
- break;
-
- case '5': /* bless a player */
- tamper = T_BLESSED;
- option = "bless";
- break;
-
- case '6': /* kill off a player */
- if (Wizard)
- {
- tamper = T_VAPORIZED;
- option = "vaporize";
- break;
- }
- else
- return;
-
- default:
- return;
- }
-
- /* adjust age after we are sure intervention will be done */
- /* end of valar, etc. options */
- }
-
- for (;;)
- /* prompt for player to affect */
- {
- mvprintw(4, 0, "Who do you want to %s ? ", option);
- getstring(Databuf, SZ_DATABUF);
- truncstring(Databuf);
-
- if (Databuf[0] == '\0')
- userlist(TRUE);
- else
- break;
- }
-
- if (strcmp(Player.p_name, Databuf) != 0)
- /* name other than self */
- {
- if ((loc = findname(Databuf, &Other)) >= 0L)
- {
- if (Other.p_tampered != T_OFF)
- {
- mvaddstr(5, 0, "That person has something pending already.\n");
- return;
- }
- else
- {
- if (tamper == T_RELOCATE
- && CIRCLE(temp1, temp2) < CIRCLE(Other.p_x, Other.p_y)
- && !Wizard)
- mvaddstr(5, 0, "Cannot move someone closer to the Lord's Chamber.\n");
- else
- {
- if (tamper == T_BESTOW) Player.p_gold -= floor(temp1);
- if (!Wizard && (tamper == T_HEAL || tamper == T_MONSTER ||
- tamper == T_RELOCATE || tamper == T_BLESSED))
- Player.p_age += N_AGE; /* age penalty */
- Other.p_tampered = tamper;
- Other.p_1scratch = floor(temp1);
- Other.p_2scratch = floor(temp2);
- writerecord(&Other, loc);
- mvaddstr(5, 0, "It is done.\n");
- }
- return;
- }
- }
- else
- /* player not found */
- mvaddstr(5, 0, "There is no one by that name.\n");
- }
- else
- /* self */
- mvaddstr(5, 0, "You may not do it to yourself!\n");
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: writevoid()
-/
-/ FUNCTION: update energy void entry in energy void file
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct energyvoid *vp - pointer to structure to write to file
-/ long loc - location in file to update
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fseek(), fwrite(), fflush()
-/
-/ GLOBAL INPUTS: *Energyvoidfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Write out energy void structure at specified location.
-/
-*************************************************************************/
-
-writevoid(vp, loc)
-struct energyvoid *vp;
-long loc;
-{
-
- fseek(Energyvoidfp, loc, 0);
- fwrite((char *) vp, SZ_VOIDSTRUCT, 1, Energyvoidfp);
- fflush(Energyvoidfp);
- fseek(Energyvoidfp, 0L, 0);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: allocvoid()
-/
-/ FUNCTION: allocate space for a new energy void
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: location of new energy void space
-/
-/ MODULES CALLED: fread(), fseek()
-/
-/ GLOBAL INPUTS: *Energyvoidfp, Enrgyvoid
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Search energy void file for an inactive entry and return its
-/ location.
-/ If no inactive ones are found, return one more than last location.
-/
-*************************************************************************/
-
-long
-allocvoid()
-{
-long loc = 0L; /* location of new energy void */
-
- fseek(Energyvoidfp, 0L, 0);
- while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
- if (Enrgyvoid.ev_active)
- loc += SZ_VOIDSTRUCT;
- else
- break;
-
- return(loc);
-}
diff --git a/games/phantasia/io.c b/games/phantasia/io.c
deleted file mode 100644
index bfd2564..0000000
--- a/games/phantasia/io.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * io.c - input/output routines for Phantasia
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include "include.h"
-
-/************************************************************************
-/
-/ FUNCTION NAME: getstring()
-/
-/ FUNCTION: read a string from operator
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *cp - pointer to buffer area to fill
-/ int mx - maximum number of characters to put in buffer
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: wmove(), _filbuf(), clearok(), waddstr(), wrefresh(),
-/ wclrtoeol()
-/
-/ GLOBAL INPUTS: Echo, _iob[], Wizard, *stdscr
-/
-/ GLOBAL OUTPUTS: _iob[]
-/
-/ DESCRIPTION:
-/ Read a string from the keyboard.
-/ This routine is specially designed to:
-/
-/ - strip non-printing characters (unless Wizard)
-/ - echo, if desired
-/ - redraw the screen if CH_REDRAW is entered
-/ - read in only 'mx - 1' characters or less characters
-/ - nul-terminate string, and throw away newline
-/
-/ 'mx' is assumed to be at least 2.
-/
-*************************************************************************/
-
-getstring(cp, mx)
-char *cp;
-int mx;
-{
-char *inptr; /* pointer into string for next string */
-int x, y; /* original x, y coordinates on screen */
-int ch; /* input */
-
- getyx(stdscr, y, x); /* get coordinates on screen */
- inptr = cp;
- *inptr = '\0'; /* clear string to start */
- --mx; /* reserve room in string for nul terminator */
-
- do
- /* get characters and process */
- {
- if (Echo)
- mvaddstr(y, x, cp); /* print string on screen */
- clrtoeol(); /* clear any data after string */
- refresh(); /* update screen */
-
- ch = getchar(); /* get character */
-
- switch (ch)
- {
- case CH_ERASE: /* back up one character */
- if (inptr > cp)
- --inptr;
- break;
-
- case CH_KILL: /* back up to original location */
- inptr = cp;
- break;
-
- case CH_NEWLINE: /* terminate string */
- break;
-
- case CH_REDRAW: /* redraw screen */
- clearok(stdscr, TRUE);
- continue;
-
- default: /* put data in string */
- if (ch >= ' ' || Wizard)
- /* printing char; put in string */
- *inptr++ = ch;
- }
-
- *inptr = '\0'; /* terminate string */
- }
- while (ch != CH_NEWLINE && inptr < cp + mx);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: more()
-/
-/ FUNCTION: pause and prompt player
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ int where - line on screen on which to pause
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: wmove(), waddstr(), getanswer()
-/
-/ GLOBAL INPUTS: *stdscr
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Print a message, and wait for a space character.
-/
-*************************************************************************/
-
-more(where)
-int where;
-{
- mvaddstr(where, 0, "-- more --");
- getanswer(" ", FALSE);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: infloat()
-/
-/ FUNCTION: input a floating point number from operator
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: floating point number from operator
-/
-/ MODULES CALLED: sscanf(), getstring()
-/
-/ GLOBAL INPUTS: Databuf[]
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Read a string from player, and scan for a floating point
-/ number.
-/ If no valid number is found, return 0.0.
-/
-*************************************************************************/
-
-double
-infloat()
-{
-double result; /* return value */
-
- getstring(Databuf, SZ_DATABUF);
- if (sscanf(Databuf, "%lf", &result) < 1)
- /* no valid number entered */
- result = 0.0;
-
- return(result);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: inputoption()
-/
-/ FUNCTION: input an option value from player
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: floor(), drandom(), getanswer()
-/
-/ GLOBAL INPUTS: Player
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Age increases with every move.
-/ Refresh screen, and get a single character option from player.
-/ Return a random value if player's ring has gone bad.
-/
-*************************************************************************/
-
-inputoption()
-{
- ++Player.p_age; /* increase age */
-
- if (Player.p_ring.ring_type != R_SPOILED)
- /* ring ok */
- return(getanswer("T ", TRUE));
- else
- /* bad ring */
- {
- getanswer(" ", TRUE);
- return((int) ROLL(0.0, 5.0) + '0');
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: interrupt()
-/
-/ FUNCTION: handle interrupt from operator
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fork(), exit(), wait(), death(), alarm(), execl(), wmove(),
-/ getgid(), signal(), getenv(), wclear(), setuid(), getuid(), setgid(),
-/ crmode(), clearok(), waddstr(), cleanup(), wrefresh(), leavegame(),
-/ getanswer()
-/
-/ GLOBAL INPUTS: Player, *stdscr
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Allow player to quit upon hitting the interrupt key.
-/ If the player wants to quit while in battle, he/she automatically
-/ dies.
-/
-*************************************************************************/
-
-interrupt()
-{
-char line[81]; /* a place to store data already on screen */
-int loop; /* counter */
-int x, y; /* coordinates on screen */
-int ch; /* input */
-unsigned savealarm; /* to save alarm value */
-
-#ifdef SYS3
- signal(SIGINT, SIG_IGN);
-#endif
-#ifdef SYS5
- signal(SIGINT, SIG_IGN);
-#endif
-
- savealarm = alarm(0); /* turn off any alarms */
-
- getyx(stdscr, y, x); /* save cursor location */
-
- for (loop = 0; loop < 80; ++loop) /* save line on screen */
- {
- move(4, loop);
- line[loop] = inch();
- }
- line[80] = '\0'; /* nul terminate */
-
- if (Player.p_status == S_INBATTLE || Player.p_status == S_MONSTER)
- /* in midst of fighting */
- {
- mvaddstr(4, 0, "Quitting now will automatically kill your character. Still want to ? ");
- ch = getanswer("NY", FALSE);
- if (ch == 'Y')
- death("Bailing out");
- /*NOTREACHED*/
- }
- else
- {
- mvaddstr(4, 0, "Do you really want to quit ? ");
- ch = getanswer("NY", FALSE);
- if (ch == 'Y')
- leavegame();
- /*NOTREACHED*/
- }
-
- mvaddstr(4, 0, line); /* restore data on screen */
- move(y, x); /* restore cursor */
- refresh();
-
-#ifdef SYS3
- signal(SIGINT, interrupt);
-#endif
-#ifdef SYS5
- signal(SIGINT, interrupt);
-#endif
-
- alarm(savealarm); /* restore alarm */
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: getanswer()
-/
-/ FUNCTION: get an answer from operator
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *choices - string of (upper case) valid choices
-/ bool def - set if default answer
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: alarm(), wmove(), waddch(), signal(), setjmp(), strchr(),
-/ _filbuf(), clearok(), toupper(), wrefresh(), mvprintw(), wclrtoeol()
-/
-/ GLOBAL INPUTS: catchalarm(), Echo, _iob[], _ctype[], *stdscr, Timeout,
-/ Timeoenv[]
-/
-/ GLOBAL OUTPUTS: _iob[]
-/
-/ DESCRIPTION:
-/ Get a single character answer from operator.
-/ Timeout waiting for response. If we timeout, or the
-/ answer in not in the list of valid choices, print choices,
-/ and wait again, otherwise return the first character in ths
-/ list of choices.
-/ Give up after 3 tries.
-/
-*************************************************************************/
-
-getanswer(choices, def)
-char *choices;
-bool def;
-{
-int ch; /* input */
-int loop; /* counter */
-int oldx, oldy; /* original coordinates on screen */
-
- getyx(stdscr, oldy, oldx);
- alarm(0); /* make sure alarm is off */
-
- for (loop = 3; loop; --loop)
- /* try for 3 times */
- {
- if (setjmp(Timeoenv) != 0)
- /* timed out waiting for response */
- {
- if (def || loop <= 1)
- /* return default answer */
- break;
- else
- /* prompt, and try again */
- goto YELL;
- }
- else
- /* wait for response */
- {
- clrtoeol();
- refresh();
-#ifdef BSD41
- sigset(SIGALRM, catchalarm);
-#else
- signal(SIGALRM, catchalarm);
-#endif
- /* set timeout */
- if (Timeout)
- alarm(7); /* short */
- else
- alarm(600); /* long */
-
- ch = getchar();
-
- alarm(0); /* turn off timeout */
-
- if (ch < 0)
- /* caught some signal */
- {
- ++loop;
- continue;
- }
- else if (ch == CH_REDRAW)
- /* redraw screen */
- {
- clearok(stdscr, TRUE); /* force clear screen */
- ++loop; /* don't count this input */
- continue;
- }
- else if (Echo)
- {
- addch(ch); /* echo character */
- refresh();
- }
-
- if (islower(ch))
- /* convert to upper case */
- ch = toupper(ch);
-
- if (def || strchr(choices, ch) != NULL)
- /* valid choice */
- return(ch);
- else if (!def && loop > 1)
- /* bad choice; prompt, and try again */
- {
-YELL: mvprintw(oldy + 1, 0, "Please choose one of : [%s]\n", choices);
- move(oldy, oldx);
- clrtoeol();
- continue;
- }
- else
- /* return default answer */
- break;
- }
- }
-
- return(*choices);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: catchalarm()
-/
-/ FUNCTION: catch timer when waiting for input
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: longjmp()
-/
-/ GLOBAL INPUTS: Timeoenv[]
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Come here when the alarm expires while waiting for input.
-/ Simply longjmp() into getanswer().
-/
-*************************************************************************/
-
-void
-catchalarm()
-{
- longjmp(Timeoenv, 1);
-}
diff --git a/games/phantasia/macros.h b/games/phantasia/macros.h
deleted file mode 100644
index e232742..0000000
--- a/games/phantasia/macros.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * macros.h - macro definitions for Phantasia
- */
-
-#define ROLL(BASE,INTERVAL) floor((BASE) + (INTERVAL) * drandom())
-#define SGN(X) ((X) < 0 ? -1 : 1)
-#define CIRCLE(X, Y) floor(distance(X, 0.0, Y, 0.0) / 125.0 + 1)
-#define MAX(A, B) ((A) > (B) ? (A) : (B))
-#define MIN(A, B) ((A) < (B) ? (A) : (B))
-#define ILLCMD() mvaddstr(5, 0, Illcmd)
-#define MAXMOVE() (Player.p_level * 1.5 + 1)
-#define ILLMOVE() mvaddstr(5, 0, Illmove)
-#define ILLSPELL() mvaddstr(5, 0, Illspell)
-#define NOMANA() mvaddstr(5, 0, Nomana)
-#define SOMEBETTER() addstr(Somebetter)
-#define NOBETTER() mvaddstr(17, 0, Nobetter)
diff --git a/games/phantasia/main.c b/games/phantasia/main.c
deleted file mode 100644
index 8840bae..0000000
--- a/games/phantasia/main.c
+++ /dev/null
@@ -1,1303 +0,0 @@
-/*
- * Phantasia 3.3.2 -- Interterminal fantasy game
- *
- * Edward A. Estes
- * AT&T, March 12, 1986
- *
- * $FreeBSD$
- */
-
-/* DISCLAIMER:
- *
- * This game is distributed for free as is. It is not guaranteed to work
- * in every conceivable environment. It is not even guaranteed to work
- * in ANY environment.
- *
- * This game is distributed without notice of copyright, therefore it
- * may be used in any manner the recipient sees fit. However, the
- * author assumes no responsibility for maintaining or revising this
- * game, in its original form, or any derivitives thereof.
- *
- * The author shall not be responsible for any loss, cost, or damage,
- * including consequential damage, caused by reliance on this material.
- *
- * The author makes no warranties, express or implied, including warranties
- * of merchantability or fitness for a particular purpose or use.
- *
- * AT&T is in no way connected with this game.
- */
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <string.h>
-
-/*
- * The program allocates as much file space as it needs to store characters,
- * so the possibility exists for the character file to grow without bound.
- * The file is purged upon normal entry to try to avoid that problem.
- * A similar problem exists for energy voids. To alleviate the problem here,
- * the void file is cleared with every new king, and a limit is placed
- * on the size of the energy void file.
- */
-
-/*
- * Put one line of text into the file 'motd' for announcements, etc.
- */
-
-/*
- * The scoreboard file is updated when someone dies, and keeps track
- * of the highest character to date for that login.
- * Being purged from the character file does not cause the scoreboard
- * to be updated.
- */
-
-/*
- * All source files are set up for 'vi' with shiftwidth=4, tabstop=8.
- */
-
-/* */
-
-/*
- * main.c Main routines for Phantasia
- */
-
-#include "include.h"
-
-/***************************************************************************
-/ FUNCTION NAME: main()
-/
-/ FUNCTION: initialize state, and call main process
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ int argc - argument count
-/ char **argv - argument vector
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: monstlist(), checkenemy(), activelist(),
-/ throneroom(), checkbattle(), readmessage(), changestats(), writerecord(),
-/ tradingpost(), adjuststats(), recallplayer(), displaystats(), checktampered(),
-/ fabs(), rollnewplayer(), time(), exit(), sqrt(), floor(), wmove(),
-/ signal(), strcat(), purgeoldplayers(), getuid(), isatty(), wclear(),
-/ strcpy(), system(), altercoordinates(), cleanup(), waddstr(), procmain(),
-/ playinit(), leavegame(), localtime(), getanswer(), neatstuff(), initialstate(),
-/ scorelist(), titlelist()
-/
-/ GLOBAL INPUTS: *Login, Throne, Wizard, Player, *stdscr, Changed, Databuf[],
-/ Fileloc, Stattable[]
-/
-/ GLOBAL OUTPUTS: Wizard, Player, Changed, Fileloc, Timeout, *Statptr
-/
-/ DESCRIPTION:
-/ Process arguments, initialize program, and loop forever processing
-/ player input.
-/
-****************************************************************************/
-
-main(argc, argv)
-int argc;
-char **argv;
-{
-bool noheader = FALSE; /* set if don't want header */
-bool headeronly = FALSE; /* set if only want header */
-bool examine = FALSE; /* set if examine a character */
-time_t seconds; /* for time of day */
-double dtemp; /* for temporary calculations */
-
- initialstate(); /* init globals */
-
- /* process arguments */
- while (--argc && (*++argv)[0] == '-')
- switch ((*argv)[1])
- {
- case 's': /* short */
- noheader = TRUE;
- break;
-
- case 'H': /* Header */
- headeronly = TRUE;
- break;
-
- case 'a': /* all users */
- activelist();
- cleanup(TRUE);
- /*NOTREACHED*/
-
- case 'p': /* purge old players */
- purgeoldplayers();
- cleanup(TRUE);
- /*NOTREACHED*/
-
- case 'S': /* set 'Wizard' */
- Wizard = !getuid();
- break;
-
- case 'x': /* examine */
- examine = TRUE;
- break;
-
- case 'm': /* monsters */
- monstlist();
- cleanup(TRUE);
- /*NOTREACHED*/
-
- case 'b': /* scoreboard */
- scorelist();
- cleanup(TRUE);
- /*NOTREACHED*/
- }
-
- if (!isatty(0)) /* don't let non-tty's play */
- cleanup(TRUE);
- /*NOTREACHED*/
-
- playinit(); /* set up to catch signals, init curses */
-
- if (examine)
- {
- changestats(FALSE);
- cleanup(TRUE);
- /*NOTREACHED*/
- }
-
- if (!noheader)
- {
- titlelist();
- purgeoldplayers(); /* clean up old characters */
- }
-
- if (headeronly)
- cleanup(TRUE);
- /*NOTREACHED*/
-
- do
- /* get the player structure filled */
- {
- Fileloc = -1L;
-
- mvaddstr(22, 17, "Do you have a character to run [Q = Quit] ? ");
-
- switch (getanswer("NYQ", FALSE))
- {
- case 'Y':
- Fileloc = recallplayer();
- break;
-
- case 'Q':
- cleanup(TRUE);
- /*NOTREACHED*/
-
- default:
- Fileloc = rollnewplayer();
- break;
- }
- clear();
- }
- while (Fileloc < 0L);
-
- if (Player.p_level > 5.0)
- /* low level players have long timeout */
- Timeout = TRUE;
-
- /* update some important player statistics */
- strcpy(Player.p_login, Login);
- time(&seconds);
- Player.p_lastused = localtime(&seconds)->tm_yday;
- Player.p_status = S_PLAYING;
- writerecord(&Player, Fileloc);
-
- Statptr = &Stattable[Player.p_type]; /* initialize pointer */
-
- /* catch interrupts */
-#ifdef BSD41
- sigset(SIGINT, interrupt);
-#endif
-#ifdef BSD42
- signal(SIGINT, interrupt);
-#endif
-#ifdef SYS3
- signal(SIGINT, interrupt);
-#endif
-#ifdef SYS5
- signal(SIGINT, interrupt);
-#endif
-
- altercoordinates(Player.p_x, Player.p_y, A_FORCED); /* set some flags */
-
- clear();
-
- for (;;)
- /* loop forever, processing input */
- {
-
- adjuststats(); /* cleanup stats */
-
- if (Throne && Player.p_crowns == 0 && Player.p_specialtype != SC_KING)
- /* not allowed on throne -- move */
- {
- mvaddstr(5,0,"You're not allowed in the Lord's Chamber without a crown.\n");
- altercoordinates(0.0, 0.0, A_NEAR);
- }
-
- checktampered(); /* check for energy voids, etc. */
-
- if (Player.p_status != S_CLOAKED
- /* not cloaked */
- && (dtemp = fabs(Player.p_x)) == fabs(Player.p_y)
- /* |x| = |y| */
- && !Throne)
- /* not on throne */
- {
- dtemp = sqrt(dtemp / 100.0);
- if (floor(dtemp) == dtemp)
- /* |x| / 100 == n*n; at a trading post */
- {
- tradingpost();
- clear();
- }
- }
-
- checkbattle(); /* check for player to player battle */
- neatstuff(); /* gurus, medics, etc. */
-
- if (Player.p_status == S_CLOAKED)
- /* costs 3 mana per turn to be cloaked */
- if (Player.p_mana > 3.0)
- Player.p_mana -= 3.0;
- else
- /* ran out of mana, uncloak */
- {
- Player.p_status = S_PLAYING;
- Changed = TRUE;
- }
-
- if (Player.p_status != S_PLAYING && Player.p_status != S_CLOAKED)
- /* change status back to S_PLAYING */
- {
- Player.p_status = S_PLAYING;
- Changed = TRUE;
- }
-
- if (Changed)
- /* update file only if important stuff has changed */
- {
- writerecord(&Player, Fileloc);
- Changed = FALSE;
- continue;
- }
-
- readmessage(); /* read message, if any */
-
- displaystats(); /* print statistics */
-
- move(6, 0);
-
- if (Throne)
- /* maybe make king, print prompt, etc. */
- throneroom();
-
- /* print status line */
- addstr("1:Move 2:Players 3:Talk 4:Stats 5:Quit ");
- if (Player.p_level >= MEL_CLOAK && Player.p_magiclvl >= ML_CLOAK)
- addstr("6:Cloak ");
- if (Player.p_level >= MEL_TELEPORT && Player.p_magiclvl >= ML_TELEPORT)
- addstr("7:Teleport ");
- if (Player.p_specialtype >= SC_COUNCIL || Wizard)
- addstr("8:Intervene ");
-
- procmain(); /* process input */
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: initialstate()
-/
-/ FUNCTION: initialize some important global variable
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: time(), fopen(), srandom(), error(), getuid(), getlogin(),
-/ getpwuid()
-/
-/ GLOBAL INPUTS:
-/
-/ GLOBAL OUTPUTS: *Energyvoidfp, Echo, Marsh, *Login, Users, Beyond,
-/ Throne, Wizard, Changed, Okcount, Timeout, Windows, *Monstfp, *Messagefp,
-/ *Playersfp
-/
-/ DESCRIPTION:
-/ Set global flags, and open files which remain open.
-/
-*************************************************************************/
-
-initialstate()
-{
- Beyond = FALSE;
- Marsh = FALSE;
- Throne = FALSE;
- Changed = FALSE;
- Wizard = FALSE;
- Timeout = FALSE;
- Users = 0;
- Windows = FALSE;
- Echo = TRUE;
-
- /* setup login name */
- if ((Login = getlogin()) == NULL)
- Login = getpwuid(getuid())->pw_name;
-
- /* open some files */
- if ((Playersfp = fopen(_PATH_PEOPLE, "r+")) == NULL)
- error(_PATH_PEOPLE);
- /*NOTREACHED*/
-
- if ((Monstfp = fopen(_PATH_MONST, "r+")) == NULL)
- error(_PATH_MONST);
- /*NOTREACHED*/
-
- if ((Messagefp = fopen(_PATH_MESS, "r")) == NULL)
- error(_PATH_MESS);
- /*NOTREACHED*/
-
- if ((Energyvoidfp = fopen(_PATH_VOID, "r+")) == NULL)
- error(_PATH_VOID);
- /*NOTREACHED*/
-
- srandomdev();
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: rollnewplayer()
-/
-/ FUNCTION: roll up a new character
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: initplayer(), allocrecord(), truncstring(), fabs(), wmove(),
-/ wclear(), sscanf(), strcmp(), genchar(), waddstr(), findname(), mvprintw(),
-/ getanswer(), getstring()
-/
-/ GLOBAL INPUTS: Other, Wizard, Player, *stdscr, Databuf[]
-/
-/ GLOBAL OUTPUTS: Echo
-/
-/ DESCRIPTION:
-/ Prompt player, and roll up new character.
-/
-*************************************************************************/
-
-long
-rollnewplayer()
-{
-int chartype; /* character type */
-int ch; /* input */
-
- initplayer(&Player); /* initialize player structure */
-
- clear();
- mvaddstr(4, 21, "Which type of character do you want:");
- mvaddstr(8, 4, "1:Magic User 2:Fighter 3:Elf 4:Dwarf 5:Halfling 6:Experimento ");
- if (Wizard) {
- addstr("7:Super ? ");
- chartype = getanswer("1234567", FALSE);
- }
- else {
- addstr("? ");
- chartype = getanswer("123456", FALSE);
- }
-
- do
- {
- genchar(chartype); /* roll up a character */
-
- /* print out results */
- mvprintw(12, 14,
- "Strength : %2.0f Quickness: %2.0f Mana : %2.0f\n",
- Player.p_strength, Player.p_quickness, Player.p_mana);
- mvprintw(13, 14,
- "Energy Level: %2.0f Brains : %2.0f Magic Level: %2.0f\n",
- Player.p_energy, Player.p_brains, Player.p_magiclvl);
-
- if (Player.p_type == C_EXPER || Player.p_type == C_SUPER)
- break;
-
- mvaddstr(14, 14, "Type '1' to keep >");
- ch = getanswer(" ", TRUE);
- }
- while (ch != '1');
-
- if (Player.p_type == C_EXPER || Player.p_type == C_SUPER)
- /* get coordinates for experimento */
- for (;;)
- {
- mvaddstr(16, 0, "Enter the X Y coordinates of your experimento ? ");
- getstring(Databuf, SZ_DATABUF);
- sscanf(Databuf, "%lf %lf", &Player.p_x, &Player.p_y);
-
- if (fabs(Player.p_x) > D_EXPER || fabs(Player.p_y) > D_EXPER)
- mvaddstr(17, 0, "Invalid coordinates. Try again.\n");
- else
- break;
- }
-
- for (;;)
- /* name the new character */
- {
- mvprintw(18, 0,
- "Give your character a name [up to %d characters] ? ", SZ_NAME - 1);
- getstring(Player.p_name, SZ_NAME);
- truncstring(Player.p_name); /* remove trailing blanks */
-
- if (Player.p_name[0] == '\0')
- /* no null names */
- mvaddstr(19, 0, "Invalid name.");
- else if (findname(Player.p_name, &Other) >= 0L)
- /* cannot have duplicate names */
- mvaddstr(19, 0, "Name already in use.");
- else
- /* name is acceptable */
- break;
-
- addstr(" Pick another.\n");
- }
-
- /* get a password for character */
- Echo = FALSE;
-
- do
- {
- mvaddstr(20, 0, "Give your character a password [up to 8 characters] ? ");
- getstring(Player.p_password, SZ_PASSWORD);
- mvaddstr(21, 0, "One more time to verify ? ");
- getstring(Databuf, SZ_PASSWORD);
- }
- while (strcmp(Player.p_password, Databuf) != 0);
-
- Echo = TRUE;
-
- return(allocrecord());
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: procmain()
-/
-/ FUNCTION: process input from player
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: dotampered(), changestats(), inputoption(), allstatslist(),
-/ fopen(), wmove(), drandom(), sscanf(), fclose(), altercoordinates(),
-/ waddstr(), fprintf(), distance(), userlist(), leavegame(), encounter(),
-/ getstring(), wclrtobot()
-/
-/ GLOBAL INPUTS: Circle, Illcmd[], Throne, Wizard, Player, *stdscr,
-/ Databuf[], Illmove[]
-/
-/ GLOBAL OUTPUTS: Player, Changed
-/
-/ DESCRIPTION:
-/ Process main menu options.
-/
-*************************************************************************/
-
-procmain()
-{
-int ch; /* input */
-double x; /* desired new x coordinate */
-double y; /* desired new y coordinate */
-double temp; /* for temporary calculations */
-FILE *fp; /* for opening files */
-int loop; /* a loop counter */
-bool hasmoved = FALSE; /* set if player has moved */
-
- ch = inputoption();
- mvaddstr(4, 0, "\n\n"); /* clear status area */
-
- move(7, 0);
- clrtobot(); /* clear data on bottom area of screen */
-
- if (Player.p_specialtype == SC_VALAR && (ch == '1' || ch == '7'))
- /* valar cannot move */
- ch = ' ';
-
- switch (ch)
- {
- case 'K': /* move up/north */
- case 'N':
- x = Player.p_x;
- y = Player.p_y + MAXMOVE();
- hasmoved = TRUE;
- break;
-
- case 'J': /* move down/south */
- case 'S':
- x = Player.p_x;
- y = Player.p_y - MAXMOVE();
- hasmoved = TRUE;
- break;
-
- case 'L': /* move right/east */
- case 'E':
- x = Player.p_x + MAXMOVE();
- y = Player.p_y;
- hasmoved = TRUE;
- break;
-
- case 'H': /* move left/west */
- case 'W':
- x = Player.p_x - MAXMOVE();
- y = Player.p_y;
- hasmoved = TRUE;
- break;
-
- default: /* rest */
- Player.p_energy += (Player.p_maxenergy + Player.p_shield) / 15.0
- + Player.p_level / 3.0 + 2.0;
- Player.p_energy =
- MIN(Player.p_energy, Player.p_maxenergy + Player.p_shield);
-
- if (Player.p_status != S_CLOAKED)
- /* cannot find mana if cloaked */
- {
- Player.p_mana += (Circle + Player.p_level) / 4.0;
-
- if (drandom() < 0.2 && Player.p_status == S_PLAYING && !Throne)
- /* wandering monster */
- encounter(-1);
- }
- break;
-
- case 'X': /* change/examine a character */
- changestats(TRUE);
- break;
-
- case '1': /* move */
- for (loop = 3; loop; --loop)
- {
- mvaddstr(4, 0, "X Y Coordinates ? ");
- getstring(Databuf, SZ_DATABUF);
-
- if (sscanf(Databuf, "%lf %lf", &x, &y) != 2)
- mvaddstr(5, 0, "Try again\n");
- else if (distance(Player.p_x, x, Player.p_y, y) > MAXMOVE())
- ILLMOVE();
- else
- {
- hasmoved = TRUE;
- break;
- }
- }
- break;
-
- case '2': /* players */
- userlist(TRUE);
- break;
-
- case '3': /* message */
- mvaddstr(4, 0, "Message ? ");
- getstring(Databuf, SZ_DATABUF);
- /* we open the file for writing to erase any data which is already there */
- fp = fopen(_PATH_MESS, "w");
- if (Databuf[0] != '\0')
- fprintf(fp, "%s: %s", Player.p_name, Databuf);
- fclose(fp);
- break;
-
- case '4': /* stats */
- allstatslist();
- break;
-
- case '5': /* good-bye */
- leavegame();
- /*NOTREACHED*/
-
- case '6': /* cloak */
- if (Player.p_level < MEL_CLOAK || Player.p_magiclvl < ML_CLOAK)
- ILLCMD();
- else if (Player.p_status == S_CLOAKED)
- Player.p_status = S_PLAYING;
- else if (Player.p_mana < MM_CLOAK)
- mvaddstr(5, 0, "No mana left.\n");
- else
- {
- Changed = TRUE;
- Player.p_mana -= MM_CLOAK;
- Player.p_status = S_CLOAKED;
- }
- break;
-
- case '7': /* teleport */
- /*
- * conditions for teleport
- * - 20 per (level plus magic level)
- * - OR council of the wise or valar or ex-valar
- * - OR transport from throne
- * transports from throne cost no mana
- */
- if (Player.p_level < MEL_TELEPORT || Player.p_magiclvl < ML_TELEPORT)
- ILLCMD();
- else
- for (loop = 3; loop; --loop)
- {
- mvaddstr(4, 0, "X Y Coordinates ? ");
- getstring(Databuf, SZ_DATABUF);
-
- if (sscanf(Databuf, "%lf %lf", &x, &y) == 2)
- {
- temp = distance(Player.p_x, x, Player.p_y, y);
- if (!Throne
- /* can transport anywhere from throne */
- && Player.p_specialtype <= SC_COUNCIL
- /* council, valar can transport anywhere */
- && temp > (Player.p_level + Player.p_magiclvl) * 20.0)
- /* can only move 20 per exp. level + mag. level */
- ILLMOVE();
- else
- {
- temp = (temp / 75.0 + 1.0) * 20.0; /* mana used */
-
- if (!Throne && temp > Player.p_mana)
- mvaddstr(5, 0, "Not enough power for that distance.\n");
- else
- {
- if (!Throne)
- Player.p_mana -= temp;
- hasmoved = TRUE;
- break;
- }
- }
- }
- }
- break;
-
- case 'C':
- case '9': /* monster */
- if (Throne)
- /* no monsters while on throne */
- mvaddstr(5, 0, "No monsters in the chamber!\n");
- else if (Player.p_specialtype != SC_VALAR)
- /* the valar cannot call monsters */
- {
- Player.p_sin += 1e-6;
- encounter(-1);
- }
- break;
-
- case '0': /* decree */
- if (Wizard || Player.p_specialtype == SC_KING && Throne)
- /* kings must be on throne to decree */
- dotampered();
- else
- ILLCMD();
- break;
-
- case '8': /* intervention */
- if (Wizard || Player.p_specialtype >= SC_COUNCIL)
- dotampered();
- else
- ILLCMD();
- break;
- }
-
- if (hasmoved)
- /* player has moved -- alter coordinates, and do random monster */
- {
- altercoordinates(x, y, A_SPECIFIC);
-
- if (drandom() < 0.2 && Player.p_status == S_PLAYING && !Throne)
- encounter(-1);
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: titlelist()
-/
-/ FUNCTION: print title page
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fread(), fseek(), fopen(), fgets(), wmove(), strcpy(),
-/ fclose(), strlen(), waddstr(), sprintf(), wrefresh()
-/
-/ GLOBAL INPUTS: Lines, Other, *stdscr, Databuf[], *Playersfp
-/
-/ GLOBAL OUTPUTS: Lines
-/
-/ DESCRIPTION:
-/ Print important information about game, players, etc.
-/
-*************************************************************************/
-
-titlelist()
-{
-FILE *fp; /* used for opening various files */
-bool councilfound = FALSE; /* set if we find a member of the council */
-bool kingfound = FALSE; /* set if we find a king */
-double hiexp, nxtexp; /* used for finding the two highest players */
-double hilvl, nxtlvl; /* used for finding the two highest players */
-char hiname[21], nxtname[21];/* used for finding the two highest players */
-
- mvaddstr(0, 14, "W e l c o m e t o P h a n t a s i a (vers. 3.3.2)!");
-
- /* print message of the day */
- if ((fp = fopen(_PATH_MOTD, "r")) != NULL
- && fgets(Databuf, SZ_DATABUF, fp) != NULL)
- {
- mvaddstr(2, 40 - strlen(Databuf) / 2, Databuf);
- fclose(fp);
- }
-
- /* search for king */
- fseek(Playersfp, 0L, 0);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED)
- /* found the king */
- {
- sprintf(Databuf, "The present ruler is %s Level:%.0f",
- Other.p_name, Other.p_level);
- mvaddstr(4, 40 - strlen(Databuf) / 2, Databuf);
- kingfound = TRUE;
- break;
- }
-
- if (!kingfound)
- mvaddstr(4, 24, "There is no ruler at this time.");
-
- /* search for valar */
- fseek(Playersfp, 0L, 0);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_specialtype == SC_VALAR && Other.p_status != S_NOTUSED)
- /* found the valar */
- {
- sprintf(Databuf, "The Valar is %s Login: %s", Other.p_name, Other.p_login);
- mvaddstr(6, 40 - strlen(Databuf) / 2 , Databuf);
- break;
- }
-
- /* search for council of the wise */
- fseek(Playersfp, 0L, 0);
- Lines = 10;
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_specialtype == SC_COUNCIL && Other.p_status != S_NOTUSED)
- /* found a member of the council */
- {
- if (!councilfound)
- {
- mvaddstr(8, 30, "Council of the Wise:");
- councilfound = TRUE;
- }
-
- /* This assumes a finite (<=5) number of C.O.W.: */
- sprintf(Databuf, "%s Login: %s", Other.p_name, Other.p_login);
- mvaddstr(Lines++, 40 - strlen(Databuf) / 2, Databuf);
- }
-
- /* search for the two highest players */
- nxtname[0] = hiname[0] = '\0';
- hiexp = 0.0;
- nxtlvl = hilvl = 0;
-
- fseek(Playersfp, 0L, 0);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- if (Other.p_experience > hiexp && Other.p_specialtype <= SC_KING && Other.p_status != S_NOTUSED)
- /* highest found so far */
- {
- nxtexp = hiexp;
- hiexp = Other.p_experience;
- nxtlvl = hilvl;
- hilvl = Other.p_level;
- strcpy(nxtname, hiname);
- strcpy(hiname, Other.p_name);
- }
- else if (Other.p_experience > nxtexp
- && Other.p_specialtype <= SC_KING
- && Other.p_status != S_NOTUSED)
- /* next highest found so far */
- {
- nxtexp = Other.p_experience;
- nxtlvl = Other.p_level;
- strcpy(nxtname, Other.p_name);
- }
-
- mvaddstr(15, 28, "Highest characters are:");
- sprintf(Databuf, "%s Level:%.0f and %s Level:%.0f",
- hiname, hilvl, nxtname, nxtlvl);
- mvaddstr(17, 40 - strlen(Databuf) / 2, Databuf);
-
- /* print last to die */
- if ((fp = fopen(_PATH_LASTDEAD,"r")) != NULL
- && fgets(Databuf, SZ_DATABUF, fp) != NULL)
- {
- mvaddstr(19, 25, "The last character to die was:");
- mvaddstr(20, 40 - strlen(Databuf) / 2,Databuf);
- fclose(fp);
- }
-
- refresh();
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: recallplayer()
-/
-/ FUNCTION: find a character on file
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), truncstring(), more(), death(), wmove(),
-/ wclear(), strcmp(), printw(), cleanup(), waddstr(), findname(), mvprintw(),
-/ getanswer(), getstring()
-/
-/ GLOBAL INPUTS: Player, *stdscr, Databuf[]
-/
-/ GLOBAL OUTPUTS: Echo, Player
-/
-/ DESCRIPTION:
-/ Search for a character of a certain name, and check password.
-/
-*************************************************************************/
-
-long
-recallplayer()
-{
-long loc = 0L; /* location in player file */
-int loop; /* loop counter */
-int ch; /* input */
-
- clear();
- mvprintw(10, 0, "What was your character's name ? ");
- getstring(Databuf, SZ_NAME);
- truncstring(Databuf);
-
- if ((loc = findname(Databuf, &Player)) >= 0L)
- /* found character */
- {
- Echo = FALSE;
-
- for (loop = 0; loop < 2; ++loop)
- {
- /* prompt for password */
- mvaddstr(11, 0, "Password ? ");
- getstring(Databuf, SZ_PASSWORD);
- if (strcmp(Databuf, Player.p_password) == 0)
- /* password good */
- {
- Echo = TRUE;
-
- if (Player.p_status != S_OFF)
- /* player did not exit normally last time */
- {
- clear();
- addstr("Your character did not exit normally last time.\n");
- addstr("If you think you have good cause to have your character saved,\n");
- printw("you may quit and mail your reason to 'root'.\n");
- addstr("Otherwise, continuing spells certain death.\n");
- addstr("Do you want to quit ? ");
- ch = getanswer("YN", FALSE);
- if (ch == 'Y')
- {
- Player.p_status = S_HUNGUP;
- writerecord(&Player, loc);
- cleanup(TRUE);
- /*NOTREACHED*/
- }
- death("Stupidity");
- /*NOTREACHED*/
- }
- return(loc);
- }
- else
- mvaddstr(12, 0, "No good.\n");
- }
-
- Echo = TRUE;
- }
- else
- mvaddstr(11, 0, "Not found.\n");
-
- more(13);
- return(-1L);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: neatstuff()
-/
-/ FUNCTION: do random stuff
-/
-/ AUTHOR: E. A. Estes, 3/3/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: collecttaxes(), floor(), wmove(), drandom(), infloat(),
-/ waddstr(), mvprintw(), getanswer()
-/
-/ GLOBAL INPUTS: Player, *stdscr, *Statptr
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Handle gurus, medics, etc.
-/
-*************************************************************************/
-
-neatstuff()
-{
-double temp; /* for temporary calculations */
-int ch; /* input */
-
- switch ((int) ROLL(0.0, 100.0))
- {
- case 1:
- case 2:
- if (Player.p_poison > 0.0)
- {
- mvaddstr(4, 0, "You've found a medic! How much will you offer to be cured ? ");
- temp = floor(infloat());
- if (temp < 0.0 || temp > Player.p_gold)
- /* negative gold, or more than available */
- {
- mvaddstr(6, 0, "He was not amused, and made you worse.\n");
- Player.p_poison += 1.0;
- }
- else if (drandom() / 2.0 > (temp + 1.0) / MAX(Player.p_gold, 1))
- /* medic wants 1/2 of available gold */
- mvaddstr(5, 0, "Sorry, he wasn't interested.\n");
- else
- {
- mvaddstr(5, 0, "He accepted.");
- Player.p_poison = MAX(0.0, Player.p_poison - 1.0);
- Player.p_gold -= temp;
- }
- }
- break;
-
- case 3:
- mvaddstr(4, 0, "You've been caught raping and pillaging!\n");
- Player.p_experience += 4000.0;
- Player.p_sin += 0.5;
- break;
-
- case 4:
- temp = ROLL(10.0, 75.0);
- mvprintw(4, 0, "You've found %.0f gold pieces, want them ? ", temp);
- ch = getanswer("NY", FALSE);
-
- if (ch == 'Y')
- collecttaxes(temp, 0.0);
- break;
-
- case 5:
- if (Player.p_sin > 1.0)
- {
- mvaddstr(4, 0, "You've found a Holy Orb!\n");
- Player.p_sin -= 0.25;
- }
- break;
-
- case 6:
- if (Player.p_poison < 1.0)
- {
- mvaddstr(4, 0, "You've been hit with a plague!\n");
- Player.p_poison += 1.0;
- }
- break;
-
- case 7:
- mvaddstr(4, 0, "You've found some holy water.\n");
- ++Player.p_holywater;
- break;
-
- case 8:
- mvaddstr(4, 0, "You've met a Guru. . .");
- if (drandom() * Player.p_sin > 1.0)
- addstr("You disgusted him with your sins!\n");
- else if (Player.p_poison > 0.0)
- {
- addstr("He looked kindly upon you, and cured you.\n");
- Player.p_poison = 0.0;
- }
- else
- {
- addstr("He rewarded you for your virtue.\n");
- Player.p_mana += 50.0;
- Player.p_shield += 2.0;
- }
- break;
-
- case 9:
- mvaddstr(4, 0, "You've found an amulet.\n");
- ++Player.p_amulets;
- break;
-
- case 10:
- if (Player.p_blindness)
- {
- mvaddstr(4, 0, "You've regained your sight!\n");
- Player.p_blindness = FALSE;
- }
- break;
-
- default: /* deal with poison */
- if (Player.p_poison > 0.0)
- {
- temp = Player.p_poison * Statptr->c_weakness
- * Player.p_maxenergy / 600.0;
- if (Player.p_energy > Player.p_maxenergy / 10.0
- && temp + 5.0 < Player.p_energy)
- Player.p_energy -= temp;
- }
- break;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: genchar()
-/
-/ FUNCTION: generate a random character
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ int type - ASCII value of character type to generate
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: floor(), drandom()
-/
-/ GLOBAL INPUTS: Wizard, Player, Stattable[]
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Use the lookup table for rolling stats.
-/
-*************************************************************************/
-
-genchar(type)
-int type;
-{
-int subscript; /* used for subscripting into Stattable */
-struct charstats *statptr;/* for pointing into Stattable */
-
- subscript = type - '1';
-
- if (subscript < C_MAGIC || subscript > C_EXPER)
- if (subscript != C_SUPER || !Wizard)
- /* fighter is default */
- subscript = C_FIGHTER;
-
- statptr = &Stattable[subscript];
-
- Player.p_quickness =
- ROLL(statptr->c_quickness.base, statptr->c_quickness.interval);
- Player.p_strength =
- ROLL(statptr->c_strength.base, statptr->c_strength.interval);
- Player.p_mana =
- ROLL(statptr->c_mana.base, statptr->c_mana.interval);
- Player.p_maxenergy =
- Player.p_energy =
- ROLL(statptr->c_energy.base, statptr->c_energy.interval);
- Player.p_brains =
- ROLL(statptr->c_brains.base, statptr->c_brains.interval);
- Player.p_magiclvl =
- ROLL(statptr->c_magiclvl.base, statptr->c_magiclvl.interval);
-
- Player.p_type = subscript;
-
- if (Player.p_type == C_HALFLING)
- /* give halfling some experience */
- Player.p_experience = ROLL(600.0, 200.0);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: playinit()
-/
-/ FUNCTION: initialize for playing game
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: signal(), wclear(), noecho(), crmode(), initscr(),
-/ wrefresh()
-/
-/ GLOBAL INPUTS: *stdscr, ill_sig()
-/
-/ GLOBAL OUTPUTS: Windows
-/
-/ DESCRIPTION:
-/ Catch a bunch of signals, and turn on curses stuff.
-/
-*************************************************************************/
-
-playinit()
-{
- /* catch/ingnore signals */
-
-#ifdef BSD41
- sigignore(SIGQUIT);
- sigignore(SIGALRM);
- sigignore(SIGTERM);
- sigignore(SIGTSTP);
- sigignore(SIGTTIN);
- sigignore(SIGTTOU);
- sighold(SIGINT);
- sigset(SIGHUP, ill_sig);
- sigset(SIGTRAP, ill_sig);
- sigset(SIGIOT, ill_sig);
- sigset(SIGEMT, ill_sig);
- sigset(SIGFPE, ill_sig);
- sigset(SIGBUS, ill_sig);
- sigset(SIGSEGV, ill_sig);
- sigset(SIGSYS, ill_sig);
- sigset(SIGPIPE, ill_sig);
-#endif
-#ifdef BSD42
- signal(SIGQUIT, ill_sig);
- signal(SIGALRM, SIG_IGN);
- signal(SIGTERM, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
- signal(SIGTTIN, SIG_IGN);
- signal(SIGTTOU, SIG_IGN);
- signal(SIGINT, ill_sig);
- signal(SIGHUP, SIG_DFL);
- signal(SIGTRAP, ill_sig);
- signal(SIGIOT, ill_sig);
- signal(SIGEMT, ill_sig);
- signal(SIGFPE, ill_sig);
- signal(SIGBUS, ill_sig);
- signal(SIGSEGV, ill_sig);
- signal(SIGSYS, ill_sig);
- signal(SIGPIPE, ill_sig);
-#endif
-#ifdef SYS3
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGTERM, SIG_IGN);
- signal(SIGALRM, SIG_IGN);
- signal(SIGHUP, ill_sig);
- signal(SIGTRAP, ill_sig);
- signal(SIGIOT, ill_sig);
- signal(SIGEMT, ill_sig);
- signal(SIGFPE, ill_sig);
- signal(SIGBUS, ill_sig);
- signal(SIGSEGV, ill_sig);
- signal(SIGSYS, ill_sig);
- signal(SIGPIPE, ill_sig);
-#endif
-#ifdef SYS5
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGTERM, SIG_IGN);
- signal(SIGALRM, SIG_IGN);
- signal(SIGHUP, ill_sig);
- signal(SIGTRAP, ill_sig);
- signal(SIGIOT, ill_sig);
- signal(SIGEMT, ill_sig);
- signal(SIGFPE, ill_sig);
- signal(SIGBUS, ill_sig);
- signal(SIGSEGV, ill_sig);
- signal(SIGSYS, ill_sig);
- signal(SIGPIPE, ill_sig);
-#endif
-
- initscr(); /* turn on curses */
- noecho(); /* do not echo input */
- crmode(); /* do not process erase, kill */
- clear();
- refresh();
- Windows = TRUE; /* mark the state */
-}
-
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: cleanup()
-/
-/ FUNCTION: close some files, and maybe exit
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ bool doexit - exit flag
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: exit(), wmove(), fclose(), endwin(), nocrmode(), wrefresh()
-/
-/ GLOBAL INPUTS: *Energyvoidfp, LINES, *stdscr, Windows, *Monstfp,
-/ *Messagefp, *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Close all open files. If we are "in curses" terminate curses.
-/ If 'doexit' is set, exit, otherwise return.
-/
-*************************************************************************/
-
-cleanup(doexit)
-bool doexit;
-{
- if (Windows)
- {
- move(LINES - 2, 0);
- refresh();
- nocrmode();
- endwin();
- }
-
- if (Playersfp) {
- fclose(Playersfp);
- Playersfp = NULL;
- }
- if (Monstfp) {
- fclose(Monstfp);
- Monstfp = NULL;
- }
- if (Messagefp) {
- fclose(Messagefp);
- Messagefp = NULL;
- }
- if (Energyvoidfp) {
- fclose(Energyvoidfp);
- Energyvoidfp = NULL;
- }
-
- if (doexit)
- exit(0);
- /*NOTREACHED*/
-}
diff --git a/games/phantasia/map.c b/games/phantasia/map.c
deleted file mode 100644
index be035df..0000000
--- a/games/phantasia/map.c
+++ /dev/null
@@ -1,160 +0,0 @@
-#define minusminus plusplus
-#define minusplus plusminus
-
-main()
-{
- /* Set up */
-
- openpl();
- space(-1400, -1000, 1200, 1200);
-
- /* Big box */
-
- move(-1400, -1000);
- cont(-1400, 1000);
- cont(600, 1000);
- cont(600, -1000);
- cont(-1400, -1000);
-
- /* Grid -- horizontal lines every 200 */
-
- linemod("dotted");
- line(600, -800, -1400, -800);
- line(-1400, -600, 600, -600);
- line(600, -400, -1400, -400);
- line(-1400, -200, 600, -200);
- linemod("solid");
- line(600, 0, -1400, 0);
- linemod("dotted");
- line(-1400, 200, 600, 200);
- line(600, 400, -1400, 400);
- line(-1400, 600, 600, 600);
- line(600, 800, -1400, 800);
-
- /* Grid -- vertical lines every 200 */
-
- line(-1200, 1000, -1200, -1000);
- line(-1000, 1000, -1000, -1000);
- line(-800, 1000, -800, -1000);
- line(-600, 1000, -600, -1000);
- linemod("solid");
- line(-400, 1000, -400, -1000);
- linemod("dotted");
- line(-200, 1000, -200, -1000);
- line(0, 1000, 0, -1000);
- line(200, 1000, 200, -1000);
- line(400, 1000, 400, -1000);
-
- /* Circles radius +250 on "center" */
-
- linemod("solid");
- circle(-400, 0, 250);
- circle(-400, 0, 500);
- circle(-400, 0, 750);
- circle(-400, 0, 1000);
-
- /* A few labels */
-
- move(-670, 1075);
- label("- THE PHANTASIA UNIVERSE -");
- line(-630, 1045, -115, 1045);
- move(-360, 80);
- label("Lorien");
- move(-385, -100);
- label("Ithilien");
- move(-560, 80);
- label("Rohan");
- move(-580, -100);
- label("Anorien");
- plusplus("Rovanion", -250, 320);
- plusplus("The Iron Hills", -100, 560);
- plusplus("Rhun", 250, 570);
- minusplus("Dunland", -700, 160);
- minusplus("Eriador", -920, 300);
- minusplus("The Northern Waste", -1240, 320);
- minusminus("Gondor", -720, -180);
- minusminus("South Gondor", -940, -270);
- minusminus("Far Harad", -1100, -500);
- plusminus("Mordor", -180, -300);
- plusminus("Khand", 0, -500);
- plusminus("Near Harad", 40, -780);
- move(340, 900);
- label("The Moors");
- move(300, 840);
- label("Adventurous");
- move(340, -840);
- label("The Moors");
- move(300, -900);
- label("Adventurous");
- move(-1340, 900);
- label("The Moors");
- move(-1340, 840);
- label("Adventurous");
- move(-1340, -840);
- label("The Moors");
- move(-1340, -900);
- label("Adventurous");
- move(700, 1000);
- label("OUTER CIRCLES:");
- line(690, 970, 1000, 970);
- move(700, 900);
- label("> 9: The Outer Waste");
- move(700, 800);
- label("> 20: The Dead Marshes");
- move(700, 700);
- label("> 35: Kennaquhair");
- move(700, 600);
- label("> 55: Morannon");
- move(700, 300);
- label("(0,0): The Lord's Chamber");
-
- move(700, -400);
- label("Grid squares are 100 x 100");
- move(700, -800);
- label("Created by Ted Estes");
- move(700, -860);
- label("Plotted by Chris Robertson");
- move(700, -920);
- label(" c 1985");
- circle(723, -923, 20);
-
- /* Close down */
-
- move(-1380, 1180);
- closepl();
- exit(0);
-}
-
-plusplus(s, x, y) /* draw strings in plus plus quadrant */
-char *s;
-int x, y;
-{
-char s1[2];
-
- while (*s)
- {
- move(x, y);
- s1[0] = *s++;
- s1[1] = '\0';
- label(s1);
- x += 25;
- y -= 30;
- }
-}
-
-plusminus(s, x, y) /* draw strings in plus minus quadrant */
-char *s;
-int x, y;
-{
-char s1[2];
-
- while (*s)
- {
- move(x, y);
- s1[0] = *s++;
- s1[1] = '\0';
- label(s1);
- x += 25;
- y += 30;
- }
-}
diff --git a/games/phantasia/misc.c b/games/phantasia/misc.c
deleted file mode 100644
index c103e08..0000000
--- a/games/phantasia/misc.c
+++ /dev/null
@@ -1,1708 +0,0 @@
-/*
- * misc.c Phantasia miscellaneous support routines
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include "include.h"
-
-
-/************************************************************************
-/
-/ FUNCTION NAME: movelevel()
-/
-/ FUNCTION: move player to new level
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: death(), floor(), wmove(), drandom(), waddstr(), explevel()
-/
-/ GLOBAL INPUTS: Player, *stdscr, *Statptr, Stattable[]
-/
-/ GLOBAL OUTPUTS: Player, Changed
-/
-/ DESCRIPTION:
-/ Use lookup table to increment important statistics when
-/ progressing to new experience level.
-/ Players are rested to maximum as a bonus for making a new
-/ level.
-/ Check for council of wise, and being too big to be king.
-/
-*************************************************************************/
-
-movelevel()
-{
-struct charstats *statptr; /* for pointing into Stattable */
-double new; /* new level */
-double inc; /* increment between new and old levels */
-
- Changed = TRUE;
-
- if (Player.p_type == C_EXPER)
- /* roll a type to use for increment */
- statptr = &Stattable[(int) ROLL(C_MAGIC, C_HALFLING - C_MAGIC + 1)];
- else
- statptr = Statptr;
-
- new = explevel(Player.p_experience);
- inc = new - Player.p_level;
- Player.p_level = new;
-
- /* add increments to statistics */
- Player.p_strength += statptr->c_strength.increase * inc;
- Player.p_mana += statptr->c_mana.increase * inc;
- Player.p_brains += statptr->c_brains.increase * inc;
- Player.p_magiclvl += statptr->c_magiclvl.increase * inc;
- Player.p_maxenergy += statptr->c_energy.increase * inc;
-
- /* rest to maximum upon reaching new level */
- Player.p_energy = Player.p_maxenergy + Player.p_shield;
-
- if (Player.p_crowns > 0 && Player.p_level >= 1000.0)
- /* no longer able to be king -- turn crowns into cash */
- {
- Player.p_gold += ((double) Player.p_crowns) * 5000.0;
- Player.p_crowns = 0;
- }
-
- if (Player.p_level >= 3000.0 && Player.p_specialtype < SC_COUNCIL)
- /* make a member of the council */
- {
- mvaddstr(6, 0, "You have made it to the Council of the Wise.\n");
- addstr("Good Luck on your search for the Holy Grail.\n");
-
- Player.p_specialtype = SC_COUNCIL;
-
- /* no rings for council and above */
- Player.p_ring.ring_type = R_NONE;
- Player.p_ring.ring_duration = 0;
-
- Player.p_lives = 3; /* three extra lives */
- }
-
- if (Player.p_level > 9999.0 && Player.p_specialtype != SC_VALAR)
- death("Old age");
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: descrlocation()
-/
-/ FUNCTION: return a formatted description of location
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct player playerp - pointer to player structure
-/ bool shortflag - set if short form is desired
-/
-/ RETURN VALUE: pointer to string containing result
-/
-/ MODULES CALLED: fabs(), floor(), sprintf(), distance()
-/
-/ GLOBAL INPUTS: Databuf[]
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Look at coordinates and return an appropriately formatted
-/ string.
-/
-*************************************************************************/
-
-char *
-descrlocation(playerp, shortflag)
-struct player *playerp;
-bool shortflag;
-{
-double circle; /* corresponding circle for coordinates */
-int quadrant; /* quandrant of grid */
-char *label; /* pointer to place name */
-static char *nametable[4][4] = /* names of places */
- {
- "Anorien", "Ithilien", "Rohan", "Lorien",
- "Gondor", "Mordor", "Dunland", "Rovanion",
- "South Gondor", "Khand", "Eriador", "The Iron Hills",
- "Far Harad", "Near Harad", "The Northern Waste", "Rhun"
- };
-
- if (playerp->p_specialtype == SC_VALAR)
- return(" is in Valhala");
- else if ((circle = CIRCLE(playerp->p_x, playerp->p_y)) >= 1000.0)
- {
- if (MAX(fabs(playerp->p_x), fabs(playerp->p_y)) > D_BEYOND)
- label = "The Point of No Return";
- else
- label = "The Ashen Mountains";
- }
- else if (circle >= 55)
- label = "Morannon";
- else if (circle >= 35)
- label = "Kennaquahair";
- else if (circle >= 20)
- label = "The Dead Marshes";
- else if (circle >= 9)
- label = "The Outer Waste";
- else if (circle >= 5)
- label = "The Moors Adventurous";
- else
- {
- if (playerp->p_x == 0.0 && playerp->p_y == 0.0)
- label = "The Lord's Chamber";
- else
- {
- /* this expression is split to prevent compiler loop with some compilers */
- quadrant = ((playerp->p_x > 0.0) ? 1 : 0);
- quadrant += ((playerp->p_y >= 0.0) ? 2 : 0);
- label = nametable[((int) circle) - 1][quadrant];
- }
- }
-
- if (shortflag)
- sprintf(Databuf, "%.29s", label);
- else
- sprintf(Databuf, " is in %s (%.0f,%.0f)", label, playerp->p_x, playerp->p_y);
-
- return(Databuf);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: tradingpost()
-/
-/ FUNCTION: do trading post stuff
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord(), adjuststats(), fabs(), more(), sqrt(),
-/ sleep(), floor(), wmove(), drandom(), wclear(), printw(),
-/ altercoordinates(), infloat(), waddstr(), wrefresh(), mvprintw(), getanswer(),
-/ wclrtoeol(), wclrtobot()
-/
-/ GLOBAL INPUTS: Menu[], Circle, Player, *stdscr, Fileloc, Nobetter[]
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Different trading posts have different items.
-/ Merchants cannot be cheated, but they can be dishonest
-/ themselves.
-/
-/ Shields, swords, and quicksilver are not cumulative. This is
-/ one major area of complaint, but there are two reasons for this:
-/ 1) It becomes MUCH too easy to make very large versions
-/ of these items.
-/ 2) In the real world, one cannot simply weld two swords
-/ together to make a bigger one.
-/
-/ At one time, it was possible to sell old weapons at half the purchase
-/ price. This resulted in huge amounts of gold floating around,
-/ and the game lost much of its challenge.
-/
-/ Also, purchasing gems defeats the whole purpose of gold. Gold
-/ is small change for lower level players. They really shouldn't
-/ be able to accumulate more than enough gold for a small sword or
-/ a few books. Higher level players shouldn't even bother to pick
-/ up gold, except maybe to buy mana once in a while.
-/
-*************************************************************************/
-
-tradingpost()
-{
-double numitems; /* number of items to purchase */
-double cost; /* cost of purchase */
-double blessingcost; /* cost of blessing */
-int ch; /* input */
-int size; /* size of the trading post */
-int loop; /* loop counter */
-int cheat = 0; /* number of times player has tried to cheat */
-bool dishonest = FALSE;/* set when merchant is dishonest */
-
- Player.p_status = S_TRADING;
- writerecord(&Player, Fileloc);
-
- clear();
- addstr("You are at a trading post. All purchases must be made with gold.");
-
- size = sqrt(fabs(Player.p_x / 100)) + 1;
- size = MIN(7, size);
-
- /* set up cost of blessing */
- blessingcost = 1000.0 * (Player.p_level + 5.0);
-
- /* print Menu */
- move(7, 0);
- for (loop = 0; loop < size; ++loop)
- /* print Menu */
- {
- if (loop == 6)
- cost = blessingcost;
- else
- cost = Menu[loop].cost;
- printw("(%d) %-12s: %6.0f\n", loop + 1, Menu[loop].item, cost);
- }
-
- mvprintw(5, 0, "L:Leave P:Purchase S:Sell Gems ? ");
-
- for (;;)
- {
- adjuststats(); /* truncate any bad values */
-
- /* print some important statistics */
- mvprintw(1, 0, "Gold: %9.0f Gems: %9.0f Level: %6.0f Charms: %6d\n",
- Player.p_gold, Player.p_gems, Player.p_level, Player.p_charms);
- printw("Shield: %9.0f Sword: %9.0f Quicksilver:%3.0f Blessed: %s\n",
- Player.p_shield, Player.p_sword, Player.p_quksilver,
- (Player.p_blessing ? " True" : "False"));
- printw("Brains: %9.0f Mana: %9.0f", Player.p_brains, Player.p_mana);
-
- move(5, 36);
- ch = getanswer("LPS", FALSE);
- move(15, 0);
- clrtobot();
- switch(ch)
- {
- case 'L': /* leave */
- case '\n':
- altercoordinates(0.0, 0.0, A_NEAR);
- return;
-
- case 'P': /* make purchase */
- mvaddstr(15, 0, "What what would you like to buy ? ");
- ch = getanswer(" 1234567", FALSE);
- move(15, 0);
- clrtoeol();
-
- if (ch - '0' > size)
- addstr("Sorry, this merchant doesn't have that.");
- else
- switch (ch)
- {
- case '1':
- printw("Mana is one per %.0f gold piece. How many do you want (%.0f max) ? ",
- Menu[0].cost, floor(Player.p_gold / Menu[0].cost));
- cost = (numitems = floor(infloat())) * Menu[0].cost;
-
- if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_mana += numitems;
- }
- break;
-
- case '2':
- printw("Shields are %.0f per +1. How many do you want (%.0f max) ? ",
- Menu[1].cost, floor(Player.p_gold / Menu[1].cost));
- cost = (numitems = floor(infloat())) * Menu[1].cost;
-
- if (numitems == 0.0)
- break;
- else if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else if (numitems < Player.p_shield)
- NOBETTER();
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_shield = numitems;
- }
- break;
-
- case '3':
- printw("A book costs %.0f gp. How many do you want (%.0f max) ? ",
- Menu[2].cost, floor(Player.p_gold / Menu[2].cost));
- cost = (numitems = floor(infloat())) * Menu[2].cost;
-
- if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else if (drandom() * numitems > Player.p_level / 10.0
- && numitems != 1)
- {
- printw("\nYou blew your mind!\n");
- Player.p_brains /= 5;
- }
- else
- {
- Player.p_brains += floor(numitems) * ROLL(20, 8);
- }
- }
- break;
-
- case '4':
- printw("Swords are %.0f gp per +1. How many + do you want (%.0f max) ? ",
- Menu[3].cost, floor(Player.p_gold / Menu[3].cost));
- cost = (numitems = floor(infloat())) * Menu[3].cost;
-
- if (numitems == 0.0)
- break;
- else if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else if (numitems < Player.p_sword)
- NOBETTER();
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_sword = numitems;
- }
- break;
-
- case '5':
- printw("A charm costs %.0f gp. How many do you want (%.0f max) ? ",
- Menu[4].cost, floor(Player.p_gold / Menu[4].cost));
- cost = (numitems = floor(infloat())) * Menu[4].cost;
-
- if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_charms += numitems;
- }
- break;
-
- case '6':
- printw("Quicksilver is %.0f gp per +1. How many + do you want (%.0f max) ? ",
- Menu[5].cost, floor(Player.p_gold / Menu[5].cost));
- cost = (numitems = floor(infloat())) * Menu[5].cost;
-
- if (numitems == 0.0)
- break;
- else if (cost > Player.p_gold || numitems < 0)
- ++cheat;
- else if (numitems < Player.p_quksilver)
- NOBETTER();
- else
- {
- cheat = 0;
- Player.p_gold -= cost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_quksilver = numitems;
- }
- break;
-
- case '7':
- if (Player.p_blessing)
- {
- addstr("You already have a blessing.");
- break;
- }
-
- printw("A blessing requires a %.0f gp donation. Still want one ? ", blessingcost);
- ch = getanswer("NY", FALSE);
-
- if (ch == 'Y')
- {
- if (Player.p_gold < blessingcost)
- ++cheat;
- else
- {
- cheat = 0;
- Player.p_gold -= blessingcost;
- if (drandom() < 0.02)
- dishonest = TRUE;
- else
- Player.p_blessing = TRUE;
- }
- }
- break;
- }
- break;
-
- case 'S': /* sell gems */
- mvprintw(15, 0, "A gem is worth %.0f gp. How many do you want to sell (%.0f max) ? ",
- (double) N_GEMVALUE, Player.p_gems);
- numitems = floor(infloat());
-
- if (numitems > Player.p_gems || numitems < 0)
- ++cheat;
- else
- {
- cheat = 0;
- Player.p_gems -= numitems;
- Player.p_gold += numitems * N_GEMVALUE;
- }
- }
-
- if (cheat == 1)
- mvaddstr(17, 0, "Come on, merchants aren't stupid. Stop cheating.\n");
- else if (cheat == 2)
- {
- mvaddstr(17, 0, "You had your chance. This merchant happens to be\n");
- printw("a %.0f level magic user, and you made %s mad!\n",
- ROLL(Circle * 20.0, 40.0), (drandom() < 0.5) ? "him" : "her");
- altercoordinates(0.0, 0.0, A_FAR);
- Player.p_energy /= 2.0;
- ++Player.p_sin;
- more(23);
- return;
- }
- else if (dishonest)
- {
- mvaddstr(17, 0, "The merchant stole your money!");
- refresh();
- altercoordinates(Player.p_x - Player.p_x / 10.0,
- Player.p_y - Player.p_y / 10.0, A_SPECIFIC);
- sleep(2);
- return;
- }
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: displaystats()
-/
-/ FUNCTION: print out important player statistics
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: descrstatus(), descrlocation(), mvprintw()
-/
-/ GLOBAL INPUTS: Users, Player
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Important player statistics are printed on the screen.
-/
-*************************************************************************/
-
-displaystats()
-{
- mvprintw(0, 0, "%s%s\n", Player.p_name, descrlocation(&Player, FALSE));
- mvprintw(1, 0, "Level :%7.0f Energy :%9.0f(%9.0f) Mana :%9.0f Users:%3d\n",
- Player.p_level, Player.p_energy, Player.p_maxenergy + Player.p_shield,
- Player.p_mana, Users);
- mvprintw(2, 0, "Quick :%3.0f(%3.0f) Strength:%9.0f(%9.0f) Gold :%9.0f %s\n",
- Player.p_speed, Player.p_quickness + Player.p_quksilver, Player.p_might,
- Player.p_strength + Player.p_sword, Player.p_gold, descrstatus(&Player));
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: allstatslist()
-/
-/ FUNCTION: show player items
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: mvprintw(), descrtype()
-/
-/ GLOBAL INPUTS: Player
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Print out some player statistics of lesser importance.
-/
-*************************************************************************/
-
-allstatslist()
-{
-static char *flags[] = /* to print value of some bools */
- {
- "False",
- " True"
- };
-
- mvprintw( 8, 0, "Type: %s\n", descrtype(&Player, FALSE));
-
- mvprintw(10, 0, "Experience: %9.0f", Player.p_experience);
- mvprintw(11, 0, "Brains : %9.0f", Player.p_brains);
- mvprintw(12, 0, "Magic Lvl : %9.0f", Player.p_magiclvl);
- mvprintw(13, 0, "Sin : %9.5f", Player.p_sin);
- mvprintw(14, 0, "Poison : %9.5f", Player.p_poison);
- mvprintw(15, 0, "Gems : %9.0f", Player.p_gems);
- mvprintw(16, 0, "Age : %9d", Player.p_age);
- mvprintw(10, 40, "Holy Water: %9d", Player.p_holywater);
- mvprintw(11, 40, "Amulets : %9d", Player.p_amulets);
- mvprintw(12, 40, "Charms : %9d", Player.p_charms);
- mvprintw(13, 40, "Crowns : %9d", Player.p_crowns);
- mvprintw(14, 40, "Shield : %9.0f", Player.p_shield);
- mvprintw(15, 40, "Sword : %9.0f", Player.p_sword);
- mvprintw(16, 40, "Quickslver: %9.0f", Player.p_quksilver);
-
- mvprintw(18, 0, "Blessing: %s Ring: %s Virgin: %s Palantir: %s",
- flags[Player.p_blessing], flags[Player.p_ring.ring_type != R_NONE],
- flags[Player.p_virgin], flags[Player.p_palantir]);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: descrtype()
-/
-/ FUNCTION: return a string specifying player type
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct player playerp - pointer to structure for player
-/ bool shortflag - set if short form is desired
-/
-/ RETURN VALUE: pointer to string describing player type
-/
-/ MODULES CALLED: strcpy()
-/
-/ GLOBAL INPUTS: Databuf[]
-/
-/ GLOBAL OUTPUTS: Databuf[]
-/
-/ DESCRIPTION:
-/ Return a string describing the player type.
-/ King, council, valar, supercedes other types.
-/ The first character of the string is '*' if the player
-/ has a crown.
-/ If 'shortflag' is TRUE, return a 3 character string.
-/
-*************************************************************************/
-
-char *
-descrtype(playerp, shortflag)
-struct player *playerp;
-bool shortflag;
-{
-int type; /* for caluculating result subscript */
-static char *results[] = /* description table */
- {
- " Magic User", " MU",
- " Fighter", " F ",
- " Elf", " E ",
- " Dwarf", " D ",
- " Halfling", " H ",
- " Experimento", " EX",
- " Super", " S ",
- " King", " K ",
- " Council of Wise", " CW",
- " Ex-Valar", " EV",
- " Valar", " V ",
- " ? ", " ? "
- };
-
- type = playerp->p_type;
-
- switch (playerp->p_specialtype)
- {
- case SC_NONE:
- type = playerp->p_type;
- break;
-
- case SC_KING:
- type = 7;
- break;
-
- case SC_COUNCIL:
- type = 8;
- break;
-
- case SC_EXVALAR:
- type = 9;
- break;
-
- case SC_VALAR:
- type = 10;
- break;
- }
-
- type *= 2; /* calculate offset */
-
- if (type > 20)
- /* error */
- type = 22;
-
- if (shortflag)
- /* use short descriptions */
- ++type;
-
- if (playerp->p_crowns > 0)
- {
- strcpy(Databuf, results[type]);
- Databuf[0] = '*';
- return(Databuf);
- }
- else
- return(results[type]);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: findname()
-/
-/ FUNCTION: find location in player file of given name
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *name - name of character to look for
-/ struct player *playerp - pointer of structure to fill
-/
-/ RETURN VALUE: location of player if found, -1 otherwise
-/
-/ MODULES CALLED: fread(), fseek(), strcmp()
-/
-/ GLOBAL INPUTS: Wizard, *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Search the player file for the player of the given name.
-/ If player is found, fill structure with player data.
-/
-*************************************************************************/
-
-long
-findname(name, playerp)
-char *name;
-struct player *playerp;
-{
-long loc = 0; /* location in the file */
-
- fseek(Playersfp, 0L, 0);
- while (fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- {
- if (strcmp(playerp->p_name, name) == 0)
- {
- if (playerp->p_status != S_NOTUSED || Wizard)
- /* found it */
- return(loc);
- }
- loc += SZ_PLAYERSTRUCT;
- }
-
- return(-1);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: allocrecord()
-/
-/ FUNCTION: find space in the player file for a new character
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: location of free space in file
-/
-/ MODULES CALLED: initplayer(), writerecord(), fread(), fseek()
-/
-/ GLOBAL INPUTS: Other, *Playersfp
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Search the player file for an unused entry. If none are found,
-/ make one at the end of the file.
-/
-*************************************************************************/
-
-long
-allocrecord()
-{
-long loc = 0L; /* location in file */
-
- fseek(Playersfp, 0L, 0);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
- {
- if (Other.p_status == S_NOTUSED)
- /* found an empty record */
- return(loc);
- else
- loc += SZ_PLAYERSTRUCT;
- }
-
- /* make a new record */
- initplayer(&Other);
- Player.p_status = S_OFF;
- writerecord(&Other, loc);
-
- return(loc);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: freerecord()
-/
-/ FUNCTION: free up a record on the player file
-/
-/ AUTHOR: E. A. Estes, 2/7/86
-/
-/ ARGUMENTS:
-/ struct player playerp - pointer to structure to free
-/ long loc - location in file to free
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: writerecord()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Mark structure as not used, and update player file.
-/
-*************************************************************************/
-
-freerecord(playerp, loc)
-struct player *playerp;
-long loc;
-{
- playerp->p_name[0] = CH_MARKDELETE;
- playerp->p_status = S_NOTUSED;
- writerecord(playerp, loc);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: leavegame()
-/
-/ FUNCTION: leave game
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: freerecord(), writerecord(), cleanup()
-/
-/ GLOBAL INPUTS: Player, Fileloc
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Mark player as inactive, and cleanup.
-/ Do not save players below level 1.
-/
-*************************************************************************/
-
-leavegame()
-{
-
- if (Player.p_level < 1.0)
- /* delete character */
- freerecord(&Player, Fileloc);
- else
- {
- Player.p_status = S_OFF;
- writerecord(&Player, Fileloc);
- }
-
- cleanup(TRUE);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: death()
-/
-/ FUNCTION: death routine
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *how - pointer to string describing cause of death
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: freerecord(), enterscore(), more(), exit(), fread(),
-/ fseek(), execl(), fopen(), floor(), wmove(), drandom(), wclear(), strcmp(),
-/ fwrite(), fflush(), printw(), strcpy(), fclose(), waddstr(), cleanup(),
-/ fprintf(), wrefresh(), getanswer(), descrtype()
-/
-/ GLOBAL INPUTS: Curmonster, Wizard, Player, *stdscr, Fileloc, *Monstfp
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Kill off current player.
-/ Handle rings, and multiple lives.
-/ Print an appropriate message.
-/ Update scoreboard, lastdead, and let other players know about
-/ the demise of their comrade.
-/
-*************************************************************************/
-
-death(how)
-char *how;
-{
-FILE *fp; /* for updating various files */
-int ch; /* input */
-static char *deathmesg[] =
- /* add more messages here, if desired */
- {
- "You have been wounded beyond repair. ",
- "You have been disemboweled. ",
- "You've been mashed, mauled, and spit upon. (You're dead.)\n",
- "You died! ",
- "You're a complete failure -- you've died!!\n",
- "You have been dealt a fatal blow! "
- };
-
- clear();
-
- if (strcmp(how, "Stupidity") != 0)
- {
- if (Player.p_level > 9999.0)
- /* old age */
- addstr("Characters must be retired upon reaching level 10000. Sorry.");
- else if (Player.p_lives > 0)
- /* extra lives */
- {
- addstr("You should be more cautious. You've been killed.\n");
- printw("You only have %d more chance(s).\n", --Player.p_lives);
- more(3);
- Player.p_energy = Player.p_maxenergy;
- return;
- }
- else if (Player.p_specialtype == SC_VALAR)
- {
- addstr("You had your chances, but Valar aren't totally\n");
- addstr("immortal. You are now left to wither and die . . .\n");
- more(3);
- Player.p_brains = Player.p_level / 25.0;
- Player.p_energy = Player.p_maxenergy /= 5.0;
- Player.p_quksilver = Player.p_sword = 0.0;
- Player.p_specialtype = SC_COUNCIL;
- return;
- }
- else if (Player.p_ring.ring_inuse &&
- (Player.p_ring.ring_type == R_DLREG || Player.p_ring.ring_type == R_NAZREG))
- /* good ring in use - saved from death */
- {
- mvaddstr(4, 0, "Your ring saved you from death!\n");
- refresh();
- Player.p_ring.ring_type = R_NONE;
- Player.p_energy = Player.p_maxenergy / 12.0 + 1.0;
- if (Player.p_crowns > 0)
- --Player.p_crowns;
- return;
- }
- else if (Player.p_ring.ring_type == R_BAD
- || Player.p_ring.ring_type == R_SPOILED)
- /* bad ring in possession; name idiot after player */
- {
- mvaddstr(4, 0,
- "Your ring has taken control of you and turned you into a monster!\n");
- fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, 0);
- fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
- strcpy(Curmonster.m_name, Player.p_name);
- fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, 0);
- fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
- fflush(Monstfp);
- }
- }
-
- enterscore(); /* update score board */
-
- /* put info in last dead file */
- fp = fopen(_PATH_LASTDEAD, "w");
- fprintf(fp,"%s (%s, run by %s, level %.0f, killed by %s)",
- Player.p_name, descrtype(&Player, TRUE),
- Player.p_login, Player.p_level, how);
- fclose(fp);
-
- /* let other players know */
- fp = fopen(_PATH_MESS, "w");
- fprintf(fp, "%s was killed by %s.", Player.p_name, how);
- fclose(fp);
-
- freerecord(&Player, Fileloc);
-
- clear();
- move(10, 0);
- addstr(deathmesg[(int) ROLL(0.0, (double) sizeof(deathmesg) / sizeof(char *))]);
- addstr("Care to give it another try ? ");
- ch = getanswer("NY", FALSE);
-
- if (ch == 'Y')
- {
- cleanup(FALSE);
- execl(_PATH_GAMEPROG, "phantasia", "-s",
- (Wizard ? "-S": (char *) NULL), (char *)0);
- exit(0);
- /*NOTREACHED*/
- }
-
- cleanup(TRUE);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: writerecord()
-/
-/ FUNCTION: update structure in player file
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct player *playerp - pointer to structure to write out
-/ long place - location in file to updata
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fseek(), fwrite(), fflush()
-/
-/ GLOBAL INPUTS: *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Update location in player file with given structure.
-/
-*************************************************************************/
-
-writerecord(playerp, place)
-struct player *playerp;
-long place;
-{
- fseek(Playersfp, place, 0);
- fwrite((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
- fflush(Playersfp);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: explevel()
-/
-/ FUNCTION: calculate level based upon experience
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ double experience - experience to calculate experience level from
-/
-/ RETURN VALUE: experience level
-/
-/ MODULES CALLED: pow(), floor()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Experience level is a geometric progression. This has been finely
-/ tuned over the years, and probably should not be changed.
-/
-*************************************************************************/
-
-double
-explevel(experience)
-double experience;
-{
- if (experience < 1.1e7)
- return(floor(pow((experience / 1000.0), 0.4875)));
- else
- return(floor(pow((experience / 1250.0), 0.4865)));
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: truncstring()
-/
-/ FUNCTION: truncate trailing blanks off a string
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *string - pointer to null terminated string
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: strlen()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Put nul characters in place of spaces at the end of the string.
-/
-*************************************************************************/
-
-truncstring(string)
-char *string;
-{
-int length; /* length of string */
-
- length = strlen(string);
- while (string[--length] == ' ')
- string[length] = '\0';
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: altercoordinates()
-/
-/ FUNCTION: Alter x, y coordinates and set/check location flags
-/
-/ AUTHOR: E. A. Estes, 12/16/85
-/
-/ ARGUMENTS:
-/ double xnew, ynew - new x, y coordinates
-/ int operation - operation to perform with coordinates
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fabs(), floor(), drandom(), distance()
-/
-/ GLOBAL INPUTS: Circle, Beyond, Player
-/
-/ GLOBAL OUTPUTS: Marsh, Circle, Beyond, Throne, Player, Changed
-/
-/ DESCRIPTION:
-/ This module is called whenever the player's coordinates are altered.
-/ If the player is beyond the point of no return, he/she is forced
-/ to stay there.
-/
-*************************************************************************/
-
-altercoordinates(xnew, ynew, operation)
-double xnew;
-double ynew;
-int operation;
-{
- switch (operation)
- {
- case A_FORCED: /* move with no checks */
- break;
-
- case A_NEAR: /* pick random coordinates near */
- xnew = Player.p_x + ROLL(1.0, 5.0);
- ynew = Player.p_y - ROLL(1.0, 5.0);
- /* FALLTHROUGH for check */
-
- case A_SPECIFIC: /* just move player */
- if (Beyond && fabs(xnew) < D_BEYOND && fabs(ynew) < D_BEYOND)
- /*
- * cannot move back from point of no return
- * pick the largest coordinate to remain unchanged
- */
- {
- if (fabs(xnew) > fabs(ynew))
- xnew = SGN(Player.p_x) * MAX(fabs(Player.p_x), D_BEYOND);
- else
- ynew = SGN(Player.p_y) * MAX(fabs(Player.p_y), D_BEYOND);
- }
- break;
-
- case A_FAR: /* pick random coordinates far */
- xnew = Player.p_x + SGN(Player.p_x) * ROLL(50 * Circle, 250 * Circle);
- ynew = Player.p_y + SGN(Player.p_y) * ROLL(50 * Circle, 250 * Circle);
- break;
- }
-
- /* now set location flags and adjust coordinates */
- Circle = CIRCLE(Player.p_x = floor(xnew), Player.p_y = floor(ynew));
-
- /* set up flags based upon location */
- Throne = Marsh = Beyond = FALSE;
-
- if (Player.p_x == 0.0 && Player.p_y == 0.0)
- Throne = TRUE;
- else if (Circle < 35 && Circle >= 20)
- Marsh = TRUE;
- else if (MAX(fabs(Player.p_x), fabs(Player.p_y)) >= D_BEYOND)
- Beyond = TRUE;
-
- Changed = TRUE;
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: readrecord()
-/
-/ FUNCTION: read a player structure from file
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct player *playerp - pointer to structure to fill
-/ int loc - location of record to read
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fread(), fseek()
-/
-/ GLOBAL INPUTS: *Playersfp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Read structure information from player file.
-/
-*************************************************************************/
-
-readrecord(playerp, loc)
-struct player *playerp;
-long loc;
-{
- fseek(Playersfp, loc, 0);
- fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: adjuststats()
-/
-/ FUNCTION: adjust player statistics
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: death(), floor(), drandom(), explevel(), movelevel()
-/
-/ GLOBAL INPUTS: Player, *Statptr
-/
-/ GLOBAL OUTPUTS: Circle, Player, Timeout
-/
-/ DESCRIPTION:
-/ Handle adjustment and maximums on various player characteristics.
-/
-*************************************************************************/
-
-adjuststats()
-{
-double dtemp; /* for temporary calculations */
-
- if (explevel(Player.p_experience) > Player.p_level)
- /* move one or more levels */
- {
- movelevel();
- if (Player.p_level > 5.0)
- Timeout = TRUE;
- }
-
- if (Player.p_specialtype == SC_VALAR)
- /* valar */
- Circle = Player.p_level / 5.0;
-
- /* calculate effective quickness */
- dtemp = ((Player.p_gold + Player.p_gems / 2.0) - 1000.0) / Statptr->c_goldtote
- - Player.p_level;;
- dtemp = MAX(0.0, dtemp); /* gold slows player down */
- Player.p_speed = Player.p_quickness + Player.p_quksilver - dtemp;
-
- /* calculate effective strength */
- if (Player.p_poison > 0.0)
- /* poison makes player weaker */
- {
- dtemp = 1.0 - Player.p_poison * Statptr->c_weakness / 800.0;
- dtemp = MAX(0.1, dtemp);
- }
- else
- dtemp = 1.0;
- Player.p_might = dtemp * Player.p_strength + Player.p_sword;
-
- /* insure that important things are within limits */
- Player.p_quksilver = MIN(99.0, Player.p_quksilver);
- Player.p_mana = MIN(Player.p_mana,
- Player.p_level * Statptr->c_maxmana + 1000.0);
- Player.p_brains = MIN(Player.p_brains,
- Player.p_level * Statptr->c_maxbrains + 200.0);
- Player.p_charms = MIN(Player.p_charms, Player.p_level + 10.0);
-
- /*
- * some implementations have problems with floating point compare
- * we work around it with this stuff
- */
- Player.p_gold = floor(Player.p_gold) + 0.1;
- Player.p_gems = floor(Player.p_gems) + 0.1;
- Player.p_mana = floor(Player.p_mana) + 0.1;
-
- if (Player.p_ring.ring_type != R_NONE)
- /* do ring things */
- {
- /* rest to max */
- Player.p_energy = Player.p_maxenergy + Player.p_shield;
-
- if (Player.p_ring.ring_duration <= 0)
- /* clean up expired rings */
- switch (Player.p_ring.ring_type)
- {
- case R_BAD: /* ring drives player crazy */
- Player.p_ring.ring_type = R_SPOILED;
- Player.p_ring.ring_duration = (short) ROLL(10.0, 25.0);
- break;
-
- case R_NAZREG: /* ring disappears */
- Player.p_ring.ring_type = R_NONE;
- break;
-
- case R_SPOILED: /* ring kills player */
- death("A cursed ring");
- break;
-
- case R_DLREG: /* this ring doesn't expire */
- Player.p_ring.ring_duration = 0;
- break;
- }
- }
-
- if (Player.p_age / N_AGE > Player.p_degenerated)
- /* age player slightly */
- {
- ++Player.p_degenerated;
- if (Player.p_quickness > 23.0)
- Player.p_quickness *= 0.99;
- Player.p_strength *= 0.97;
- Player.p_brains *= 0.95;
- Player.p_magiclvl *= 0.97;
- Player.p_maxenergy *= 0.95;
- Player.p_quksilver *= 0.95;
- Player.p_sword *= 0.93;
- Player.p_shield *= 0.93;
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: initplayer()
-/
-/ FUNCTION: initialize a character
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ struct player *playerp - pointer to structure to init
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: floor(), drandom()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Put a bunch of default values in the given structure.
-/
-*************************************************************************/
-
-initplayer(playerp)
-struct player *playerp;
-{
- playerp->p_experience =
- playerp->p_level =
- playerp->p_strength =
- playerp->p_sword =
- playerp->p_might =
- playerp->p_energy =
- playerp->p_maxenergy =
- playerp->p_shield =
- playerp->p_quickness =
- playerp->p_quksilver =
- playerp->p_speed =
- playerp->p_magiclvl =
- playerp->p_mana =
- playerp->p_brains =
- playerp->p_poison =
- playerp->p_gems =
- playerp->p_sin =
- playerp->p_1scratch =
- playerp->p_2scratch = 0.0;
-
- playerp->p_gold = ROLL(50.0, 75.0) + 0.1; /* give some gold */
-
- playerp->p_x = ROLL(-125.0, 251.0);
- playerp->p_y = ROLL(-125.0, 251.0); /* give random x, y */
-
- /* clear ring */
- playerp->p_ring.ring_type = R_NONE;
- playerp->p_ring.ring_duration = 0;
- playerp->p_ring.ring_inuse = FALSE;
-
- playerp->p_age = 0L;
-
- playerp->p_degenerated = 1; /* don't degenerate initially */
-
- playerp->p_type = C_FIGHTER; /* default */
- playerp->p_specialtype = SC_NONE;
- playerp->p_lives =
- playerp->p_crowns =
- playerp->p_charms =
- playerp->p_amulets =
- playerp->p_holywater =
- playerp->p_lastused = 0;
- playerp->p_status = S_NOTUSED;
- playerp->p_tampered = T_OFF;
- playerp->p_istat = I_OFF;
-
- playerp->p_palantir =
- playerp->p_blessing =
- playerp->p_virgin =
- playerp->p_blindness = FALSE;
-
- playerp->p_name[0] =
- playerp->p_password[0] =
- playerp->p_login[0] = '\0';
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: readmessage()
-/
-/ FUNCTION: read message from other players
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fseek(), fgets(), wmove(), waddstr(), wclrtoeol()
-/
-/ GLOBAL INPUTS: *stdscr, Databuf[], *Messagefp
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ If there is a message from other players, print it.
-/
-*************************************************************************/
-
-readmessage()
-{
- move(3, 0);
- clrtoeol();
- fseek(Messagefp, 0L, 0);
- if (fgets(Databuf, SZ_DATABUF, Messagefp) != NULL)
- addstr(Databuf);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: error()
-/
-/ FUNCTION: process evironment error
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *whichfile - pointer to name of file which caused error
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: wclear(), cleanup()
-/
-/ GLOBAL INPUTS: errno, *stdscr, printw(), printf(), Windows
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Print message about offending file, and exit.
-/
-*************************************************************************/
-
-error(whichfile)
- char *whichfile;
-{
- int (*funcp)(const char *, ...);
-
- if (Windows)
- {
- funcp = printw;
- clear();
- }
- else
- funcp = printf;
-
- (*funcp)("An unrecoverable error has occurred reading %s. (errno = %d)\n", whichfile, errno);
- (*funcp)("Please run 'setup' to determine the problem.\n");
- cleanup(TRUE);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: distance()
-/
-/ FUNCTION: calculate distance between two points
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ double x1, y1 - x, y coordinates of first point
-/ double x2, y2 - x, y coordinates of second point
-/
-/ RETURN VALUE: distance between the two points
-/
-/ MODULES CALLED: sqrt()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ This function is provided because someone's hypot() library function
-/ fails if x1 == x2 && y1 == y2.
-/
-*************************************************************************/
-
-double
-distance(x1, x2, y1, y2)
-double x1, x2, y1, y2;
-{
-double deltax, deltay;
-
- deltax = x1 - x2;
- deltay = y1 - y2;
- return(sqrt(deltax * deltax + deltay * deltay));
-}
-
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: ill_sig()
-/
-/ FUNCTION: exit upon trapping an illegal signal
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ int whichsig - signal which occured to cause jump to here
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: wclear(), printw(), cleanup()
-/
-/ GLOBAL INPUTS: *stdscr
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ When an illegal signal is caught, print a message, and cleanup.
-/
-*************************************************************************/
-
-ill_sig(whichsig)
-int whichsig;
-{
- clear();
- if (!(whichsig == SIGINT || whichsig == SIGQUIT))
- printw("Error: caught signal # %d.\n", whichsig);
- cleanup(TRUE);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: descrstatus()
-/
-/ FUNCTION: return a string describing the player status
-/
-/ AUTHOR: E. A. Estes, 3/3/86
-/
-/ ARGUMENTS:
-/ struct player playerp - pointer to player structure to describe
-/
-/ RETURN VALUE: string describing player's status
-/
-/ MODULES CALLED: none
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Return verbal description of player status.
-/ If player status is S_PLAYING, check for low energy and blindness.
-/
-*************************************************************************/
-
-char *
-descrstatus(playerp)
-struct player *playerp;
-{
- switch (playerp->p_status)
- {
- case S_PLAYING:
- if (playerp->p_energy < 0.2 * (playerp->p_maxenergy + playerp->p_shield))
- return("Low Energy");
- else if (playerp->p_blindness)
- return("Blind");
- else
- return("In game");
-
- case S_CLOAKED:
- return("Cloaked");
-
- case S_INBATTLE:
- return("In Battle");
-
- case S_MONSTER:
- return("Encounter");
-
- case S_TRADING:
- return("Trading");
-
- case S_OFF:
- return("Off");
-
- case S_HUNGUP:
- return("Hung up");
-
- default:
- return("");
- }
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: drandom()
-/
-/ FUNCTION: return a random floating point number from 0.0 < 1.0
-/
-/ AUTHOR: E. A. Estes, 2/7/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: random()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Convert random integer from library routine into a floating
-/ point number, and divide by the largest possible random number.
-/ We mask large integers with 32767 to handle sites that return
-/ 31 bit random integers.
-/
-*************************************************************************/
-
-double
-drandom()
-{
- if (sizeof(int) != 2)
- /* use only low bits */
- return((double) (random() & 0x7fff) / 32768.0);
- else
- return((double) random() / 32768.0);
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: collecttaxes()
-/
-/ FUNCTION: collect taxes from current player
-/
-/ AUTHOR: E. A. Estes, 2/7/86
-/
-/ ARGUMENTS:
-/ double gold - amount of gold to tax
-/ double gems - amount of gems to tax
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: fread(), fseek(), fopen(), floor(), fwrite(), fclose()
-/
-/ GLOBAL INPUTS: Player
-/
-/ GLOBAL OUTPUTS: Player
-/
-/ DESCRIPTION:
-/ Pay taxes on gold and gems. If the player does not have enough
-/ gold to pay taxes on the added gems, convert some gems to gold.
-/ Add taxes to tax data base; add remaining gold and gems to
-/ player's cache.
-/
-*************************************************************************/
-
-collecttaxes(gold, gems)
-double gold;
-double gems;
-{
-FILE *fp; /* to update Goldfile */
-double dtemp; /* for temporary calculations */
-double taxes; /* tax liability */
-
- /* add to cache */
- Player.p_gold += gold;
- Player.p_gems += gems;
-
- /* calculate tax liability */
- taxes = N_TAXAMOUNT / 100.0 * (N_GEMVALUE * gems + gold);
-
- if (Player.p_gold < taxes)
- /* not enough gold to pay taxes, must convert some gems to gold */
- {
- dtemp = floor(taxes / N_GEMVALUE + 1.0); /* number of gems to convert */
-
- if (Player.p_gems >= dtemp)
- /* player has enough to convert */
- {
- Player.p_gems -= dtemp;
- Player.p_gold += dtemp * N_GEMVALUE;
- }
- else
- /* take everything; this should never happen */
- {
- Player.p_gold += Player.p_gems * N_GEMVALUE;
- Player.p_gems = 0.0;
- taxes = Player.p_gold;
- }
- }
-
- Player.p_gold -= taxes;
-
- if ((fp = fopen(_PATH_GOLD, "r+")) != NULL)
- /* update taxes */
- {
- dtemp = 0.0;
- fread((char *) &dtemp, sizeof(double), 1, fp);
- dtemp += floor(taxes);
- fseek(fp, 0L, 0);
- fwrite((char *) &dtemp, sizeof(double), 1, fp);
- fclose(fp);
- }
-}
diff --git a/games/phantasia/monsters.asc b/games/phantasia/monsters.asc
deleted file mode 100644
index 3d426a9..0000000
--- a/games/phantasia/monsters.asc
+++ /dev/null
@@ -1,100 +0,0 @@
-A Water Leaper 12 14 16 24 59 0 0 62
-A Leech 4 19 29 30 66 0 0 73
-An Urisk 13 30 15 46 127 1 0 3
-Shellycoat 28 21 18 63 226 2 0 0
-A Naiad 21 62 27 58 378 2 0 11
-A Nixie 22 58 28 108 604 3 0 6
-A Glaistig 21 106 25 127 1002 3 0 0
-A Mermaid 18 116 22 108 809 3 0 0
-A Merman 24 115 23 109 808 4 0 0
-A Siren 22 128 31 89 915 4 0 24
-A Lamprey 14 67 33 156 1562 4 15 37
-A Kopoacinth 26 36 26 206 2006 5 0 20
-A Kelpie 61 25 24 223 4025 5 0 0
-An Aspidchelone 114 104 19 898 10041 7 0 2
-An Idiot 13 14 16 28 49 0 0 0
-Some Green Slime 1 5 45 100 57 0 0 26
-A Pixie 11 29 23 26 64 0 0 32
-A Serpent 10 18 25 25 79 0 0 10
-A Cluricaun 12 27 20 30 81 0 14 5
-An Imp 22 30 14 40 92 0 0 1
-A Centipede 3 8 18 15 33 0 0 61
-A Beetle 2 11 21 26 44 0 0 48
-A Fir Darrig 18 22 17 35 107 0 14 1
-Modnar 15 23 20 40 101 7 2 12
-A Gnome 7 45 26 23 111 0 0 21
-A Sprite 9 37 25 31 132 1 0 43
-A Mimic 11 55 29 47 213 1 3 2
-A Kobold 13 10 14 21 121 1 12 68
-A Spider 6 11 28 28 124 1 0 57
-An Uldra 14 37 21 32 93 1 0 6
-A Gnoll 20 25 15 40 166 1 0 61
-A Bogie 23 28 19 57 189 1 0 57
-A Fachan 9 40 15 45 139 1 14 10
-A Moron 3 1 10 10 28 0 0 100
-An Orc 25 13 16 26 141 1 0 92
-A Ghillie Dhu 12 16 13 28 104 2 14 2
-A Bogle 19 15 16 35 157 2 14 15
-A Shrieker 2 62 27 9 213 2 16 0
-A Carrion Crawler 12 20 20 65 142 2 0 42
-A Trow 15 17 23 51 136 2 0 36
-A Warg 20 10 17 45 152 2 0 88
-A Stirge 2 6 35 25 153 2 0 95
-A Crebain 5 11 31 31 82 2 0 81
-A Killmoulis 30 19 8 75 175 3 14 22
-A Hob-goblin 35 20 15 72 246 3 0 18
-A Unicorn 27 57 27 57 627 3 1 0
-A Fenoderee 16 6 21 65 222 3 0 42
-An Ogre 42 14 16 115 409 3 0 19
-A Dodo 62 12 11 76 563 3 0 3
-A Hydra 14 27 33 99 599 3 0 27
-A Hamadryad 23 47 26 62 426 3 0 12
-A Bwca 21 17 19 55 387 3 14 1
-An Owlbear 35 16 18 100 623 4 0 22
-Black Annis 37 52 15 65 786 4 0 2
-A Jello Blob 100 25 7 264 1257 4 0 13
-A Jubjub Bird 45 23 12 114 1191 4 0 0
-A Wichtlein 13 40 25 61 800 4 0 8
-A Cocodrill 39 28 24 206 1438 4 0 38
-A Troll 75 12 20 185 1013 4 24 29
-A Bonnacon 89 26 9 255 1661 4 17 14
-A Gargoyle 22 21 29 200 1753 5 0 7
-A Chaladrius 8 49 37 172 1929 5 0 20
-A Gwyllion 27 73 20 65 1888 5 0 4
-A Cinomulgus 23 2 10 199 263 5 0 18
-A Peridexion 26 32 24 98 1300 5 0 2
-Smeagol 41 33 27 373 2487 5 18 0
-A Wraith 52 102 22 200 3112 5 25 13
-A Snotgurgle 143 19 26 525 4752 6 0 3
-A Phooka 42 63 21 300 4125 5 0 12
-A Vortex 101 30 31 500 6992 6 9 4
-Shelob 147 64 28 628 5003 7 13 0
-A Thaumaturgist 35 200 23 400 7628 6 7 0
-Smaug 251 76 26 1022 9877 7 0 0
-A Cold-drake 301 102 24 1222 10888 7 0 0
-A Red Dragon 342 141 23 1299 11649 8 0 0
-Scatha the Worm 406 208 20 1790 11999 8 0 0
-Tiamat 506 381 29 2000 13001 9 11 0
-A Bandersnatch 105 98 22 450 7981 6 0 3
-A Harpy 103 49 24 263 7582 6 0 2
-A Tigris 182 38 17 809 7777 6 0 3
-A Gryphon 201 45 19 813 8888 7 0 1
-A Coblynau 205 46 18 585 8333 6 0 2
-A Chimaera 173 109 28 947 12006 7 0 0
-A Jack-in-Irons 222 36 12 1000 9119 7 0 0
-Saruman 55 373 17 1500 17101 11 6 0
-A Balrog 500 100 25 705 8103 7 8 0
-Argus 201 87 14 1500 10010 8 0 0
-A Titan 302 1483 12 1625 11011 8 0 0
-Cacus 256 43 19 1750 12012 8 0 0
-Begion 403 154 10 1875 13013 8 0 0
-Grendel 197 262 23 2000 14014 8 0 0
-A Nazgul 250 251 26 1011 9988 12 10 9
-A Succubus 186 1049 27 2007 19984 9 19 0
-Red Cap 143 50 35 1965 23456 9 0 0
-A Nuckelavee 300 75 20 2185 11111 8 0 0
-Cerberus 236 96 29 2600 25862 9 20 0
-A Jabberwock 185 136 25 2265 23256 9 22 0
-Ungoliant 399 2398 37 2784 27849 10 21 0
-Leanan-Sidhe 486 5432 46 3000 30004 9 5 0
-The Dark Lord 9999 9999 31 19999 30005 13 4 0
diff --git a/games/phantasia/pathnames.h b/games/phantasia/pathnames.h
deleted file mode 100644
index cce5475..0000000
--- a/games/phantasia/pathnames.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.2 (Berkeley) 4/2/94
- */
-
-#define _PATH_GAMEPROG "/usr/games/phantasia"
-#define _PATH_GOLD "/var/games/phantasia/gold"
-#define _PATH_LASTDEAD "/var/games/phantasia/lastdead"
-#define _PATH_MESS "/var/games/phantasia/mess"
-#define _PATH_MONST "/var/games/phantasia/monsters"
-#define _PATH_MOTD "/var/games/phantasia/motd"
-#define _PATH_PEOPLE "/var/games/phantasia/characs"
-#define _PATH_SCORE "/var/games/phantasia/scoreboard"
-#define _PATH_VOID "/var/games/phantasia/void"
-#define _SPATH_GOLD "gold"
-#define _SPATH_LASTDEAD "lastdead"
-#define _SPATH_MESS "mess"
-#define _SPATH_MONST "monsters"
-#define _SPATH_MOTD "motd"
-#define _SPATH_PEOPLE "characs"
-#define _SPATH_SCORE "scoreboard"
-#define _SPATH_VOID "void"
diff --git a/games/phantasia/phantasia.6 b/games/phantasia/phantasia.6
deleted file mode 100644
index ceae5a9..0000000
--- a/games/phantasia/phantasia.6
+++ /dev/null
@@ -1,1225 +0,0 @@
-.\" $FreeBSD$
-.\"
-.de sh
-.br
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.TH PHANTASIA 6 "June 1, 1994"
-.UC 4
-.SH NAME
-phantasia \- an interterminal fantasy game
-.SH SYNOPSIS
-phantasia [ \-HSabmpsx ]
-.SH DESCRIPTION
-.I Phantasia
-is a role playing game
-which allows players to roll up characters of various types to fight
-monsters and other players.
-Progression of characters is based upon gaining experience from fighting
-monsters (and other players).
-.PP
-Most of the game is menu driven and self-explanatory (more or less).
-The screen is cursor updated, so be sure to set up the
-.B TERM
-variable in your environment.
-.PP
-The options provide for a variety of functions to support the game.
-They are:
-.PP
-.TP .5i
-.B \-s
-Invokes
-.I phantasia
-without header information.
-.TP .5i
-.B \-m
-Get a monster listing.
-.TP .5i
-.B \-a
-Get a listing of all character names on file.
-.TP .5i
-.B \-x
-Examine/change a particular character on file.
-.TP .5i
-.B \-H
-Print header only.
-.TP .5i
-.B \-p
-Purge old characters.
-.TP .5i
-.B \-b
-Show scoreboard of top characters per login.
-.TP .5i
-.B \-S
-Turn on wizard options, if allowed, if running as ``root''.
-.PP
-The characters are saved on a common file, in order to make the game
-interactive between players. The characters are given a password
-in order to retrieve them later. Only characters above
-.B level
-zero are saved. Characters unused for awhile will be purged.
-Characters are only placed on the scoreboard when they die.
-.SH AUTHOR
-Edward Estes, AT&T Information Systems, Skokie, IL
-.SH PARTICULARS
-.sh "Normal Play"
-A number of the player's more important statistics are almost always
-displayed on the screen, with maximums (where applicable) in
-parentheses.
-.PP
-The character is placed randomly near the center of a cartesian
-system.
-Most commands are selected with a single letter or digit.
-For example, one may move by hitting 'W', 'S', 'N', or 'E',
-(lower case may also be used, at no time is the game case dependent).
-One may also use 'H', 'J', 'K', 'L',
-for movement, similar to
-.IR vi (1).
-To move to a specific (x, y) coordinate, use the
-.B move
-('1') command. The distance a character can move is calculated by
-1 plus 1.5 per
-.B level.
-Moving in a compass direction will move the player the maximum
-allowed distance in that direction.
-.PP
-A player may see who else is playing by using the
-.B players
-('2') option. One may see the coordinates of those who are the same
-distance or closer to the origin as he/she.
-.B Kings,
-and
-.B council of the wise
-can see and can be seen by everyone. A
-.B palantir
-removes these restrictions.
-.PP
-One can talk to other players with the
-.B talk
-('3') option. In general, this is a line or so of text. To remove a current
-message, just type <return> when prompted for a message.
-.PP
-The
-.B stats
-('4') option shows additional characteristics of a player.
-.PP
-One may leave the game either with the
-.B quit
-('5') option.
-.PP
-One may rest by default. Resting lets one regain maximum
-.B energy level,
-and also lets one find
-.B mana
-(more is found for larger levels and further distances from the origin).
-.PP
-One may call a monster by hitting '9' or 'C'.
-.PP
-Use 'X' to examine other players.
-.PP
-One may quit or execute a sub-shell by hitting interrupt.
-Quitting during battle results in death for obvious reasons.
-.PP
-Several other options become available as the player progresses in
-.B level
-and
-.B magic,
-or to other stations in the game (
-.B valar, council of the wise, king
-).
-These are described elsewhere.
-In general, a control-L will force the redrawing of the screen.
-.PP
-Other things which may happen are more or less self-explanatory.
-.sh "Fighting Monsters"
-A player has several options while fighting monsters. They are as follows:
-.TP 1.5i
-.B melee
-Inflicts damage on the monster, based upon
-.B strength.
-Also decreases the monster's
-.B strength
-some.
-.TP 1.5i
-.B skirmish
-Inflicts a little less damage than
-.B melee,
-but decreases the monster's
-.B quickness
-instead.
-.TP 1.5i
-.B evade
-Attempt to run away. Success is based upon both the player's and
-the monster's
-.B brains
-and
-.B quickness.
-.TP 1.5i
-.B spell
-Several options for throwing spells (described elsewhere).
-.TP 1.5i
-.B nick
-Hits the monster one plus the player's
-.B sword,
-and gives the player 10% of the monster's
-.B experience.
-Decreases the monster's
-.B experience
-an amount proportional to the amount granted.
-This also increases the monster's quickness.
-Paralyzed monsters wake up very fast when nicked.
-.TP 1.5i
-.B luckout
-This is essentially a battle of wits with the monster. Success is based
-upon the player's and the monster's
-.B brains.
-The player gets credit for slaying the monster if he/she succeeds.
-Otherwise, nothing happens, and the chance to
-.B luckout
-is lost.
-.sh "Character Statistics"
-.TP 1.5i
-.B strength
-determines how much damage a character can inflict.
-.TP 1.5i
-.B quickness
-determines how many chances a character gets to make decisions while
-fighting.
-.TP 1.5i
-.B energy level
-specifies how much damage a character may endure before dying.
-.TP 1.5i
-.B magic level
-determines which spells a character may throw, and how effective those
-spells will be.
-.TP 1.5i
-.B brains
-basically, the character's intelligence; used for various fighting options
-and spells.
-.TP 1.5i
-.B mana
-used as a power source for throwing spells.
-.TP 1.5i
-.B experience
-gained by fighting monsters and other characters.
-.TP 1.5i
-.B level
-indicative of how much experience a character has accumulated; progresses
-geometrically as
-.B experience
-increases.
-.TP 1.5i
-.B poison
-sickness which degrades a character's performance (affects
-.B energy level
-and
-.B strength
-).
-.TP 1.5i
-.B sin
-accumulated as a character does certain nasty things; used only rarely
-in normal play of the game.
-.TP 1.5i
-.B age
-of player; roughly equivalent to number of turns.
-As
-.B age
-increases, many personal statistics degenerate.
-.sh "Character Types"
-Character statistics are rolled randomly from the above list, according
-to character type. The types are as follows:
-.TP 1.5i
-.B magic user
-strong in
-.B magic level
-and
-.B brains
-, weak in other areas. Must rely on wits and magic to survive.
-.TP 1.5i
-.B fighter
-good in
-.B strength
-and
-.B energy level
-, fairly good in other areas. This adds up to a well-equipped fighter.
-.TP 1.5i
-.B elf
-very high
-.B quickness
-and above average
-.B magic level
-are
-.B elves
-selling points.
-.TP 1.5i
-.B dwarf
-very high
-.B strength
-and
-.B energy level
-, but with a tendency to be rather slow and not too bright.
-.TP 1.5i
-.B halfling
-rather quick and smart, with high
-.B energy level
-, but poor in
-.B magic
-and
-.B strength.
-Born with some
-.B experience.
-.TP 1.5i
-.B experimento
-very mediocre in all areas. However, the
-.B experimento
-may be placed almost anywhere within the playing grid.
-.PP
-The possible ranges for starting statistics are summarized in
-the following table.
-.PP
-.TS
-l c c c c c c
-l c c c c c c.
-Type Strength Quick Mana Energy Brains Magic
-_
-Mag. User 10-15 30-35 50-100 30-45 60-85 5-9
-Fighter 40-55 30-35 30-50 45-70 25-45 3-6
-Elf 35-45 32-38 45-90 30-50 40-65 4-7
-Dwarf 50-70 25-30 25-45 60-100 20-40 2-5
-Halfling 20-25 34 25-45 55-90 40-75 1-4
-Experimento 25 27 100 35 25 2
-.TE
-.PP
-Not only are the starting characteristics different for the different
-character types, the characteristics progress at different rates for the
-different types as the character goes up in
-.B level. Experimentoes'
-characteristics progress randomly as one of the other types.
-The progression as characters increase in
-.B level
-is summarized in the following table.
-.PP
-.TS
-l c c c c c
-l n n n n n.
-Type Strength Mana Energy Brains Magic
-_
-Mag. User 2.0 75 20 6 2.75
-Fighter 3.0 40 30 3.0 1.5
-Elf 2.5 65 25 4.0 2.0
-Dwarf 5 30 35 2.5 1
-Halfling 2.0 30 30 4.5 1
-.TE
-.PP
-The character type also determines how much gold a player may
-carry, how long until
-.B rings
-can overcome the player, and how much
-.B poison
-the player can withstand.
-.sh "Spells"
-During the course of the game, the player may exercise his/her
-magic powers. These cases are described below.
-.TP 1.5i
-.B cloak
-.I magic level necessary:
-20 (plus level 7)
-.br
-.I mana used:
-35 plus 3 per rest period
-.br
-Used during normal play. Prevents monsters from finding the character,
-as well as hiding the player from other players. His/her coordinates
-show up as '?' in the
-.B players
-option. Players cannot collect
-.B mana,
-find trading posts, or discover the
-.B grail
-while cloaked. Calling a monster uncloaks, as well as choosing
-this option while cloaked.
-.br
-.TP 1.5i
-.B teleport
-.I magic level necessary:
-40 (plus level 12)
-.br
-.I mana used:
-30 per 75 moved
-.br
-Used during normal play. Allows the player too move with much more freedom
-than with the
-.B move
-option, at the price of expending mana. The maximum distance possible
-to move is based upon
-.B level
-and
-.B magic level.
-.TP 1.5i
-.B power blast
-.I magic level necessary:
-none
-.br
-.I mana used:
-5 times
-.B level
-.br
-Used during inter-terminal battle. Damage is based upon
-.B magic level
-and
-.B strength.
-Hits much harder than a normal hit.
-.TP 1.5i
-.B all or nothing
-.I magic level necessary:
-none
-.br
-.I mana used:
-1
-.br
-Used while combating monsters.
-Has a 25% chance of working. If it works it hits the monster just enough
-to kill it. If it fails, it doesn't hit the monster, and doubles the
-monster's
-.B quickness
-and
-.B strength.
-Paralyzed monsters wake up much quicker as a result of this spell.
-.TP 1.5i
-.B magic bolt
-.I magic level necessary:
-5
-.br
-.I mana used:
-variable
-.br
-Used while combating monsters. Hits the monster based upon the amount
-of
-.B mana
-expended and
-.B magic level.
-Guaranteed to hit at least 10 per
-.B mana.
-.TP 1.5i
-.B force field
-.I magic level necessary:
-15
-.br
-.I mana used:
-30
-.br
-Used during monster combat. Throws up a shield to protect from damage.
-The shield is added to actual energy level, and is a fixed number, based
-upon maximum energy. Normally, damage occurs first to the shield, and
-then to the players actual
-.B energy level.
-.TP 1.5i
-.B transform
-.I magic level necessary:
-25
-.br
-.I mana used:
-50
-.br
-Used during monster combat. Transforms the monster randomly into one
-of the 100 monsters from the monster file.
-.TP 1.5i
-.B increase might
-.I magic level necessary:
-35
-.br
-.I mana used:
-75
-.br
-Used during combat with monsters. Increases strength up to a maximum.
-.TP 1.5i
-.B invisibility
-.I magic level necessary:
-45
-.br
-.I mana used:
-90
-.br
-Used while fighting monsters. Makes it harder for the monster to hit,
-by temporarily increasing the player's
-.B quickness.
-This spell may be thrown several times, but a maximum level will be reached.
-.TP 1.5i
-.B transport
-.I magic level necessary:
-60
-.br
-.I mana used:
-125
-.br
-Used during monster combat. Transports the monster away from the
-player. Success is base upon player's
-.B magic
-and
-.B brains,
-and the monster's
-.B experience.
-If it fails the player is transported instead. 60% of the time, the monster
-will drop any treasure it was carrying.
-.TP 1.5i
-.B paralyze
-.I magic level necessary:
-75
-.br
-.I mana used:
-150
-.br
-Used during monster combat. "Freezes" the monster by putting its
-.B quickness
-slightly negative. The monster will slowly wake up. Success is based
-upon player's
-.B magic
-and the monster's
-.B experience.
-If it fails, nothing happens.
-.TP 1.5i
-.B specify
-.I magic level necessary:
-none
-.br
-.I mana used:
-1000
-.br
-Used during monster combat only by
-.B valar
-or
-.B council of the wise.
-Allows the player to pick which monster to fight.
-.sh "Monsters"
-Monsters get bigger as one moves farther from the origin (0,0). Rings of
-distance 125 from the origin determine the size. A monster's
-.B experience, energy level,
-and
-.B brains
-are multiplied by the size.
-.B Strength
-is increase 50% per size over one, and
-.B quickness
-remains the same, regardless of size.
-.PP
-Also, nastier monsters are found as one progress farther out
-from the origin. Monsters also may flock. The percent chance of that
-happening is designated as
-.B flock%
-in the monster listing. Monsters outside the first ring
-may carry treasure, as determined by their treasure type.
-Flocking monsters, and bigger monsters increase the chances of treasure.
-.PP
-Certain monsters have special abilities; they are as follows:
-.TP 1.5i
-.B Unicorn
-can only be subdued if the player is in possession of a
-.B virgin.
-.TP 1.5i
-.B Modnar
-has random characteristics, including treasure type.
-.TP 1.5i
-.B Mimic
-will pick another name from the list of monsters in order to
-confuse.
-.TP 1.5i
-.B Dark Lord
-very nasty person. Does not like to be hit (especially nicked),
-and many spells do not work well (or at all) against him.
-One can always
-.B evade
-from the
-.B Dark Lord.
-.TP 1.5i
-.B Leanan-Sidhe
-also a very nasty person. She will permanently sap
-.B strength
-from someone.
-.TP 1.5i
-.B Saruman
-wanders around with
-.B Wormtongue
-, who can steal a
-.B palantir.
-Also,
-.B Saruman
-may turn a player's gems into gold pieces,
-or scramble her/his stats.
-.TP 1.5i
-.B Thaumaturgist
-can transport a player.
-.TP 1.5i
-.B Balrog
-inflicts damage by taking away
-.B experience
-, not
-.B energy.
-.TP 1.5i
-.B Vortex
-may take some
-.B mana.
-.TP 1.5i
-.B Nazgul
-may try to steal a
-.B ring
-or neutralize part of one's
-.B brains.
-.TP 1.5i
-.B Tiamat
-may take half a player's
-.B gold
-and
-.B gems
-and escape.
-.TP 1.5i
-.B Kobold
-may get nasty and steal one gold piece and run away.
-.TP 1.5i
-.B Shelob
-may bite, inflicting the equivalent of one
-.B poison.
-.TP 1.5i
-.B Assorted Faeries
-These are killed if attacking someone carrying
-.B holy water.
-These are
-.B Cluricaun, Fir Darrig, Fachan,
-.B Ghille Dhu, Bogle, Killmoulis,
-and
-.B Bwca.
-.TP 1.5i
-.B Lamprey
-may bite, inflicting 1/2 of a
-.B poison.
-.TP 1.5i
-.B Shrieker
-will call one of its (much bigger) buddies if picked upon.
-.TP 1.5i
-.B Bonnacon
-will become bored with battle, fart, and run off.
-.TP 1.5i
-.B Smeagol
-will try to steal a
-.B ring
-from a player, if given the chance.
-.TP 1.5i
-.B Succubus
-may inflict damage through a
-.B force field.
-This subtracts from
-.B energy level
-instead of any shield the player may have thrown up.
-This is a very easy way to die.
-.TP 1.5i
-.B Cerberus
-loves metal and will steal all the metal treasures from
-a player if able.
-.TP 1.5i
-.B Ungoliant
-can bite and poison. This inflicts five
-.B poisons
-, and also takes one from the player's
-.B quickness.
-.TP 1.5i
-.B Jabberwock
-may tire of battle, and leave after calling one of his friends
-(
-.B Jubjub Bird
-or
-.B Bandersnatch
-).
-.TP 1.5i
-.B Morgoth
-actually
-.B Modnar
-, but reserved for
-.B council of the wise, valar,
-and
-.B ex-valar.
-Fights with
-.B Morgoth
-end when either he or the player dies. His characteristics
-are calculated based upon the player's. The player is given
-the chance to ally with him. No magic, except
-.B force field
-works when battling
-.B Morgoth.
-.TP 1.5i
-.B Troll
-may regenerate its
-.B energy
-and
-.B strength
-while in battle.
-.TP 1.5i
-.B Wraith
-may make a player blind.
-.sh "Treasures"
-The various treasure types are as follows:
-.TP 1.5i
-.B Type zero
-.I none
-.TP 1.5i
-.B Type one
-.I power booster
-\- adds mana.
-.br
-.I druid
-\- adds experience.
-.br
-.I holy orb
-\- subtracts 0.25 sin.
-.TP 1.5i
-.B Type two
-.I amulet
-\- protects from cursed treasure.
-.br
-.I holy water
-\- kills
-.B assorted faeries.
-.br
-.I hermit
-\- reduces sin by 25% and adds some mana.
-.TP 1.5i
-.B Type three
-.I shield
-\- adds to maximum
-.B energy level
-.br
-.I virgin
-\- used to subdue a
-.B unicorn
-, or to give much
-.B experience
-(and some
-.B sin
-).
-.br
-.I athelas
-\- subtracts one
-.B poison.
-.TP 1.5i
-.B Type four (scrolls)
-.I shield
-\- throws a bigger than normal
-.B force field.
-.br
-.I invisible
-\- temporarily puts the finder's
-.B quickness
-to one million.
-.br
-.I ten fold strength
-\- multiplies finder's strength by ten.
-.br
-.I pick monster
-\- allows finder to pick next monster to battle.
-.br
-.I general knowledge
-\- adds to finder's
-.B brains
-and
-.B magic level.
-.PP
-All the scrolls except
-.B general knowledge
-automatically call a monster. These preserve any
-spells that were already in effect, but are only in
-effect while in battle.
-.TP 1.5i
-.B Type five
-.I dagger
-\- adds to
-.B strength.
-.br
-.I armour
-\- same as a
-.B shield,
-but bigger.
-.br
-.I tablet
-\- adds brains.
-.TP 1.5i
-.B Type six
-.I priest
-\- rests to maximum; adds
-.B mana, brains;
-and halves
-.B sin.
-.br
-.I Robin Hood
-\- increases
-.B shield
-and adds permanently to
-.B strength.
-.br
-.I axe
-\- like
-.B dagger,
-but bigger.
-.TP 1.5i
-.B Type seven
-.I charm
-\- protects from cursed treasure (used before
-.B amulet
-); used in conjunction with
-.B blessing
-to battle
-.B Dark Lord.
-.br
-.I Merlyn
-\- adds
-.B brains, magic,
-and
-.B mana.
-.br
-.I war hammer
-\- like an
-.B axe,
-but bigger.
-.TP 1.5i
-.B Type eight
-.I healing potion
-\- sets
-.B poison
-to -2, or subtracts two from
-.B poison,
-whichever is better.
-.br
-.I transporter
-\- allows finder to move anywhere.
-.br
-.I sword
-\- like a
-.B war hammer
-, but bigger.
-.TP 1.5i
-.B Type nine
-.I golden crown
-\- allows the player to become
-.B king,
-by going to (0,0).
-.br
-.I blessing
-\- cuts
-.B sin
-to 1/3, adds
-.B mana,
-rests to max., kills
-.B Dark Lord
-with a
-.B charm,
-and gives bearer first hit on all monsters.
-.br
-.I quicksilver
-\- adds to
-.B quickness.
-.TP 1.5i
-.B Type ten
-.I elven boots
-\- adds permanently to
-.B quickness.
-.TP 1.5i
-.B Type eleven
-.I palantir
-\- allows one to see all the other players; used by
-.B council of the wise
-to seek the
-.B grail.
-.TP 1.5i
-.B Type twelve/thirteen
-.I ring
-\- allows one to hit much harder in battle, etc.
-.PP
-Any treasure type 10-13 monsters may instead carry a type nine treasure.
-.PP
-A monster may also be carrying
-.B gold
-or
-.B gems.
-These are used at
-.B trading posts
-to buy things. A
-.B gem
-is worth 1000 gold pieces. Too much
-.B gold
-will slow a player down. One may carry 1000 plus 200 per
-.B level
-of
-.B gold.
-A
-.B gem
-weighs one half a gold piece.
-Monsters of treasure type 7 or higher may carry
-.B gems.
-.PP
-The chance of a cursed treasure is based upon treasure type.
-The more valuable treasures have a greater chance of being cursed.
-A cursed treasure knocks
-.B energy level
-very low, and adds 0.25
-.B poison.
-.sh "Rings"
-.B Rings
-are only carried by
-.B nazguls
-and
-.B Dark Lord.
-They come in four different flavors.
-All
-.B rings
-rest the player to maximum and cause him/her to hit much harder
-in battle with monsters (assuming one has chosen to use the
-.B ring
-for battle.)
-.PP
-Two types of
-.B rings
-are cursed and come either from
-.B nazguls
-or
-.B Dark Lord.
-After a few times of using these types, the player falls
-under the control of the
-.B ring,
-and strange, random things will occur.
-Eventually, the player dies, and gives his/her name to a monster
-on the file.
-Dying before the
-.B ring
-is used up also renames the monster.
-.PP
-The two remaining types of
-.B rings
-are much more benign.
-The one from a
-.B nazgul
-is good for a limited number of battle rounds, and will save
-the player from death if it was being used when he/she died.
-The one from
-.B Dark Lord
-is the same, except that it never is used up.
-.B rings
-disappear after saving someone from death.
-In general, cursed
-.B rings
-occur much more often than normal ones.
-It is usually not a good idea to pick one up.
-The only way to get rid of a
-.B ring
-is to have a monster steal it.
-.sh "King"
-A player may become
-.B king by finding a
-.I crown
-and going to (0,0). Players must have a
-.B level
-in the range of 10 to 1000 to be able to find a
-.I crown.
-When a player with one or more
-.I crowns
-reaches
-.B level
-1000, the
-.I crowns
-are converted to
-.I gold.
-.PP
-Once a player is king, he/she may do certain things while in
-the Lord's Chamber (0,0). These are exercised with the
-.B decree
-('0') option.
-.TP 1.5i
-.I transport
-This is done to another player. It randomly moves the affected
-player about. A
-.B charm
-protects from transports.
-.TP 1.5i
-.I curse
-This is done to another player. It is analogous to cursed treasure,
-but worse. It inflicts two
-.B poison,
-knocks
-.B energy level
-very low, and degrades the maximum energy. It also
-removes a
-.B cloak.
-A
-.B blessing
-protects from king's curses.
-.TP 1.5i
-.I energy void
-The king may put a number of these scattered about
-his/her kingdom as he/she pleases.
-If a player hits one, he/she loses
-.B mana, energy,
-and
-.B gold.
-The energy void disappears after being hit.
-.TP 1.5i
-.I bestow
-This is also done to another player. The king may
-wish to reward one or more loyal subjects by sharing his/her
-riches (
-.B gold
-). Or it is a convenient way to dispose of some unwanted
-deadweight.
-.TP 1.5i
-.I collect taxes
-Everyone pays 7% tax on all
-.B gold
-and
-.B gems
-acquired, regardless of the existence of a
-.B king.
-The king collects the accrued taxes with this option.
-.PP
-The
-.B king
-may also
-.B teleport
-anywhere for free by using the origin as a starting place.
-.sh "Council of the Wise, Valar"
-.pl +0.5
-A player automatically becomes a member of the
-.B council of the wise
-upon reaching level 3000. Members of the council cannot have
-.B rings.
-Members of the council have a few extra options which they can exercise.
-These are exercised
-.B intervene
-('8') option.
-All
-.B intervene
-options cost 1000 mana.
-One
-.B intervene
-option is to
-.I heal
-another player. This is just a quick way for that player to be rested
-to maximum and lose a little
-.B poison.
-The main purpose in life for members of the council is to seek the
-.B Holy Grail.
-This is done with a
-.B palantir
-under the
-.I seek grail
-option. The distance cited by the seek is accurate within 10%, in order
-not to make it too easy to find the grail.
-A player must have infinitesimally small
-.B sin,
-or else it's all over upon finding the grail.
-In order to help members of the council on their quest, they
-may
-.I teleport
-with greater ease.
-.pl -0.5
-.sp 1
-.ne 1i
-.PP
-Upon finding the grail, the player advances to position of
-.B valar.
-He/she may then exercise more and niftier options under
-.I intervention.
-These include all of the council members' options plus the
-ability to move other players about, bless them, and throw monsters at
-them.
-A
-.BR valar 's
-blessing has the same effect as the treasure
-.I blessing,
-except that the affected player does not get his/her
-.I blessing
-flag set.
-All
-.I intervention
-options which affect other players age the player
-who uses them.
-.B Valars
-are essentially immortal, but are actually given five lives.
-If these are used up, the player is left to die, and becomes an
-.B ex-valar.
-A
-.B valar
-cannot
-.I move, teleport,
-or call monsters.
-(An exception to this is if the
-.I valar
-finds a
-.I transporter.
-This is to allow him/her to dispose of excess
-.I gold.
-Any monsters which a
-.B valar
-encounters are based upon his/her size.
-Only one valar may exist at a time.
-The current valar is replaced when another player finds the grail.
-The valar is then bumped back to the council of the wise.
-.sh "Wizard"
-The
-.I wizard
-is usually the owner of the game, and the one who maintains
-the associated files.
-The
-.I wizard
-is granted special powers within the game, if it is invoked
-with the '\-S' option.
-Otherwise, the
-.I wizard
-plays no different from other players.
-The
-.I wizard
-abilities are outlined below.
-.TP
-.I change players
-When examining a player, (game invoked with '-x', or use 'X' from within game),
-the
-.I wizard
-may also change the player.
-.TP
-.I intervention
-The
-.I wizard
-may do all the
-.I intervention
-options. One extra option,
-.I vaporize,
-is added to kill any offensive players.
-.TP
-.I super character type
-An extra character type is added. This character starts with the
-maximum possible in all statistics, selected from the other character types.
-A
-.B super
-character's statistics also progress at the maximum possible rate, selected
-from the other character types.
-.sh "Special Places"
-Certain regions of the playing grid have different names.
-In general, this is only to give the player some idea of
-his/her present location. Some special places do exist.
-.TP 1.5i
-.I Trading Posts
-These are located at |x| == |y| == n*n*100 for n = 1, 2...1000.
-Trading posts farther out have more things for sale.
-Be careful about cheating the merchants there, as they have short
-tempers.
-Merchants are dishonest about 5% of the time.
-.TP 1.5i
-.I Lord's Chamber
-This is located at (0,0). Only players with
-.B crowns
-may enter.
-.TP 1.5i
-.I Point of No Return
-This is located beyond 1.2e+6 in any direction.
-The only way to return from here is a
-.B transporter
-or to have a
-.B valar
-relocate the player.
-.TP 1.5i
-.I Dead Marshes
-This is a band located fairly distant from the origin. The first
-fourteen monsters (water monsters) can normally only be found here.
-.TP 1.5i
-.I Valhala
-This place is where the
-.B valar
-resides. It is associated with no particular coordinate on the
-playing grid.
-.sh "Miscellaneous"
-Once a player reaches
-.B level
-5, the game will start to time out waiting for input.
-This is to try to keep the game a bit faster paced.
-.PP
-A
-.I guru
-will never be disgusted with your
-.B sins
-if they are less than one.
-.PP
-A
-.I medic
-wants half of a player's
-.B gold
-to be happy. Offering more than one has, or a negative amount
-will anger the
-.I medic,
-who will make the player worse (add one
-.B poison
-).
-.PP
-The
-.B Holy Grail
-does little for those who are not ready to behold it.
-Whenever anyone finds it, it moves.
-It is always located within 1e+6 in any compass direction of the origin.
-.PP
-There is a maximum amount of
-.B mana
-and
-.B charms
-a player may posses, based upon
-.B level.
-.I Quicksilver
-is always limited to a maximum of 99.
-.PP
-.I Books
-bought at a
-.B trading post
-increase
-.B brains,
-based upon the number bought.
-It is unwise, however to buy more than 1/10 of one's
-.B level
-in books at a time.
-.PP
-Players over level 10000 are automatically retired.
-.PP
-A
-.I blindness
-goes away in random time.
-.PP
-Players with
-.I crowns
-are identified with a '*' before their character type.
-.sh "Inter-terminal Battle"
-When two player's coordinates correspond, they may engage in battle.
-In general, the player with the highest
-.B quickness
-gets the first hit.
-If the two players are severely mis-matched, the stronger player
-is drastically handicapped for the battle.
-In order to protect from being stuck in an infinite loop,
-the player waiting for response may time out. Options for battle are:
-.TP 1.5i
-.I fight
-Inflicts damage upon other person.
-.TP 1.5i
-.I run away
-Escape from battle. Has a 75% chance of working.
-.TP 1.5i
-.I power blast
-Battle spell.
-.TP 1.5i
-.I luckout
-One-time chance to try to win against the foe. Has a 10% chance of working.
-.PP
-Sometimes waits for the other player may be excessive, because
-he/she may be battling a monster. Upon slaying a player in battle
-the winner gets the other's
-.B experience
-and treasures.
-.B Rings
-do not work for inter-terminal battle.
-.SH BUGS
-All screen formats assume at least 24 lines by at least 80 columns.
-No provisions are made for when any of the data items get too big
-for the allotted space on the screen.
diff --git a/games/phantasia/phantdefs.h b/games/phantasia/phantdefs.h
deleted file mode 100644
index 9e597e5..0000000
--- a/games/phantasia/phantdefs.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * phantdefs.h - important constants for Phantasia
- */
-
-/* ring constants */
-#define R_NONE 0 /* no ring */
-#define R_NAZREG 1 /* regular Nazgul ring (expires) */
-#define R_DLREG 2 /* regular Dark Lord ring (does not expire) */
-#define R_BAD 3 /* bad ring */
-#define R_SPOILED 4 /* ring which has gone bad */
-
-/* status constants */
-#define S_NOTUSED 0 /* record not in use */
-#define S_OFF 1 /* not playing */
-#define S_PLAYING 2 /* playing - nothing else */
-#define S_CLOAKED 3 /* playing - cloaked */
-#define S_INBATTLE 4 /* playing - in battle */
-#define S_MONSTER 5 /* playing - fighting monster */
-#define S_TRADING 6 /* playing - at a trading post */
-#define S_HUNGUP 7 /* error occured with character */
-
-/* tampered constants */
-#define T_OFF 0 /* nothing */
-#define T_NRGVOID 1 /* hit an energy void */
-#define T_GRAIL 2 /* landed on the holy grail */
-#define T_TRANSPORT 3 /* transported by king */
-#define T_BESTOW 4 /* gold bestowed by king */
-#define T_CURSED 5 /* cursed by king */
-#define T_MONSTER 6 /* monster lobbed by valar */
-#define T_BLESSED 7 /* blessed by valar */
-#define T_RELOCATE 8 /* moved by valar */
-#define T_HEAL 9 /* healed by valar */
-#define T_VAPORIZED 10 /* vaporized by wizard */
-#define T_EXVALAR 11 /* no longer valar */
-
-/* inter-terminal battle status constants */
-#define I_OFF 0 /* nothing */
-#define I_RAN 1 /* ran away */
-#define I_STUCK 2 /* tried to run unsuccessfully */
-#define I_BLEWIT 3 /* tried to luckout unsuccessfully */
-#define I_KILLED 4 /* killed foe */
-
-/* constants for altering coordinates */
-#define A_SPECIFIC 0 /* coordinates specified */
-#define A_FORCED 1 /* coordinates specified, ignore Beyond */
-#define A_NEAR 2 /* coordinates not specified, move near */
-#define A_FAR 3 /* coordinates not specified, move far */
-
-/* constants for character types */
-#define C_MAGIC 0 /* magic user */
-#define C_FIGHTER 1 /* fighter */
-#define C_ELF 2 /* elf */
-#define C_DWARF 3 /* dwarf */
-#define C_HALFLING 4 /* halfling */
-#define C_EXPER 5 /* experimento */
-#define C_SUPER 6 /* super being */
-
-/* constants for special character types */
-#define SC_NONE 0 /* not a special character */
-#define SC_KING 1 /* king */
-#define SC_COUNCIL 2 /* council of the wise */
-#define SC_VALAR 3 /* valar */
-#define SC_EXVALAR 4 /* ex-valar */
-
-/* special monster constants */
-#define SM_NONE 0 /* nothing special */
-#define SM_UNICORN 1 /* unicorn */
-#define SM_MODNAR 2 /* Modnar */
-#define SM_MIMIC 3 /* mimic */
-#define SM_DARKLORD 4 /* Dark Lord */
-#define SM_LEANAN 5 /* Leanan-Sidhe */
-#define SM_SARUMAN 6 /* Saruman */
-#define SM_THAUMATURG 7 /* thaumaturgist */
-#define SM_BALROG 8 /* balrog */
-#define SM_VORTEX 9 /* vortex */
-#define SM_NAZGUL 10 /* nazgul */
-#define SM_TIAMAT 11 /* Tiamat */
-#define SM_KOBOLD 12 /* kobold */
-#define SM_SHELOB 13 /* Shelob */
-#define SM_FAERIES 14 /* assorted faeries */
-#define SM_LAMPREY 15 /* lamprey */
-#define SM_SHRIEKER 16 /* shrieker */
-#define SM_BONNACON 17 /* bonnacon */
-#define SM_SMEAGOL 18 /* Smeagol */
-#define SM_SUCCUBUS 19 /* succubus */
-#define SM_CERBERUS 20 /* Cerberus */
-#define SM_UNGOLIANT 21 /* Ungoliant */
-#define SM_JABBERWOCK 22 /* jabberwock */
-#define SM_MORGOTH 23 /* Morgoth */
-#define SM_TROLL 24 /* troll */
-#define SM_WRAITH 25 /* wraith */
-
-/* constants for spells */
-#define ML_ALLORNOTHING 0.0 /* magic level for 'all or nothing' */
-#define MM_ALLORNOTHING 1.0 /* mana used for 'all or nothing' */
-#define ML_MAGICBOLT 5.0 /* magic level for 'magic bolt' */
-#define ML_FORCEFIELD 15.0 /* magic level for 'force field' */
-#define MM_FORCEFIELD 30.0 /* mana used for 'force field' */
-#define ML_XFORM 25.0 /* magic level for 'transform' */
-#define MM_XFORM 50.0 /* mana used for 'transform' */
-#define ML_INCRMIGHT 35.0 /* magic level for 'increase might' */
-#define MM_INCRMIGHT 75.0 /* mana used for 'increase might' */
-#define ML_INVISIBLE 45.0 /* magic level for 'invisibility' */
-#define MM_INVISIBLE 90.0 /* mana used for 'invisibility' */
-#define ML_XPORT 60.0 /* magic level for 'transport' */
-#define MM_XPORT 125.0 /* mana used for 'transport' */
-#define ML_PARALYZE 75.0 /* magic level for 'paralyze' */
-#define MM_PARALYZE 150.0 /* mana used for 'paralyze' */
-#define MM_SPECIFY 1000.0 /* mana used for 'specify' */
-#define ML_CLOAK 20.0 /* magic level for 'cloak' */
-#define MEL_CLOAK 7.0 /* experience level for 'cloak' */
-#define MM_CLOAK 35.0 /* mana used for 'cloak' */
-#define ML_TELEPORT 40.0 /* magic level for 'teleport' */
-#define MEL_TELEPORT 12.0 /* experience level for 'teleport' */
-#define MM_INTERVENE 1000.0 /* mana used to 'intervene' */
-
-/* some miscellaneous constants */
-#define SZ_DATABUF 100 /* size of input buffer */
-#define SZ_PLAYERSTRUCT sizeof(struct player) /* size of player structure */
-#define SZ_VOIDSTRUCT sizeof(struct energyvoid) /* size of energy void struct */
-#define SZ_SCORESTRUCT sizeof(struct scoreboard) /* size of score board entry */
-#define SZ_MONSTERSTRUCT sizeof(struct monster) /* size of monster structure */
-#define SZ_NAME 21 /* size of player name (incl. trailing nul) */
-#define SZ_PASSWORD 9 /* size of password (incl. trailing nul) */
-#define SZ_LOGIN 9 /* size of login (incl. trailing nul) */
-
-#define N_DAYSOLD 21 /* number of days old for purge */
-#define N_AGE 500 /* age to degenerate ratio */
-#define N_GEMVALUE (1000.0) /* number of gold pieces to gem ratio */
-#define N_TAXAMOUNT (7.0) /* tax percent */
-
-#define D_BEYOND (1.1e6) /* distance to beyond point of no return */
-#define D_EXPER (2000.0) /* distance experimentos are allowed */
-
-#define CH_MARKDELETE '\001' /* used to alter name of deleted players */
-#define CH_KILL '\030' /* kill character (ctrl-X) */
-#define CH_ERASE '\010' /* erase character (ctrl-H) */
-#define CH_NEWLINE '\n' /* newline */
-#define CH_REDRAW '\014' /* redraw screen character (ctrl-L) */
diff --git a/games/phantasia/phantglobs.c b/games/phantasia/phantglobs.c
deleted file mode 100644
index 65ab630..0000000
--- a/games/phantasia/phantglobs.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * phantglobs.c - globals for Phantasia
- */
-
-#include "include.h"
-
-double Circle; /* which circle player is in */
-double Shield; /* force field thrown up in monster battle */
-
-bool Beyond; /* set if player is beyond point of no return */
-bool Marsh; /* set if player is in dead marshes */
-bool Throne; /* set if player is on throne */
-bool Changed; /* set if important player stats have changed */
-bool Wizard; /* set if player is the 'wizard' of the game */
-bool Timeout; /* set if short timeout waiting for input */
-bool Windows; /* set if we are set up for curses stuff */
-bool Luckout; /* set if we have tried to luck out in fight */
-bool Foestrikes; /* set if foe gets a chance to hit in battleplayer() */
-bool Echo; /* set if echo input to terminal */
-
-int Users; /* number of users currently playing */
-int Whichmonster; /* which monster we are fighting */
-int Lines; /* line on screen counter for fight routines */
-
-jmp_buf Fightenv; /* used to jump into fight routine */
-jmp_buf Timeoenv; /* used for timing out waiting for input */
-
-long Fileloc; /* location in file of player statistics */
-
-char *Login; /* pointer to login of player */
-char *Enemyname; /* pointer name of monster/player we are battling*/
-
-struct player Player; /* stats for player */
-struct player Other; /* stats for another player */
-
-struct monster Curmonster;/* stats for current monster */
-
-struct energyvoid Enrgyvoid;/* energy void buffer */
-
-struct charstats *Statptr;/* pointer into Stattable[] */
-
-/* lookup table for character type dependent statistics */
-struct charstats Stattable[7] =
- {
- /* MAGIC USER */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 15.0, 200.0, 18.0, 175.0, 10,
- /* quickness strength mana energy brains magic lvl */
- 30, 6, 0.0, 10, 6, 2.0, 50,51,75.0, 30,16,20.0, 60,26, 6.0, 5, 5,2.75,
-
- /* FIGHTER */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 10.0, 110.0, 15.0, 220.0, 20,
- /* quickness strength mana energy brains magic lvl */
- 30, 6, 0.0, 40,16, 3.0, 30,21,40.0, 45,26,30.0, 25,21, 3.0, 3, 4, 1.5,
-
- /* ELF */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 12.0, 150.0, 17.0, 190.0, 13,
- /* quickness strength mana energy brains magic lvl */
- 32, 7, 0.0, 35,11, 2.5, 45,46,65.0, 30,21,25.0, 40,26, 4.0, 4, 4, 2.0,
-
- /* DWARF */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 7.0, 80.0, 13.0, 255.0, 25,
- /* quickness strength mana energy brains magic lvl */
- 25, 6, 0.0, 50,21, 5.0, 25,21,30.0, 60,41,35.0, 20,21, 2.5, 2, 4, 1.0,
-
- /* HALFLING */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 11.0, 80.0, 10.0, 125.0, 40,
- /* quickness strength mana energy brains magic lvl */
- 34, 0, 0.0, 20, 6, 2.0, 25,21,30.0, 55,36,30.0, 40,36, 4.5, 1, 4, 1.0,
-
- /* EXPERIMENTO */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 9.0, 90.0, 16.0, 160.0, 20,
- /* quickness strength mana energy brains magic lvl */
- 27, 0, 0.0, 25, 0, 0.0, 100,0, 0.0, 35, 0, 0.0, 25, 0, 0.0, 2, 0, 0.0,
-
- /* SUPER */
- /* max brains, max mana, weakness, gold tote, ring duration */
- 15.0, 200.0, 10.0, 225.0, 40,
- /* quickness strength mana energy brains magic lvl */
- 38, 0, 0.0, 65, 0, 5.0, 100,0,75.0, 80, 0,35.0, 85, 0, 6.0, 9, 0,2.75
- };
-
-/* menu of items for purchase */
-struct menuitem Menu[] =
- {
- "Mana", 1,
- "Shield", 5,
- "Book", 200,
- "Sword", 500,
- "Charm", 1000,
- "Quicksilver", 2500,
- "Blessing", 1000,
- };
-
-FILE *Playersfp; /* pointer to open player file */
-FILE *Monstfp; /* pointer to open monster file */
-FILE *Messagefp; /* pointer to open message file */
-FILE *Energyvoidfp; /* pointer to open energy void file */
-
-char Databuf[SZ_DATABUF]; /* a place to read data into */
-
-/* some canned strings for messages */
-char Illcmd[] = "Illegal command.\n";
-char Illmove[] = "Too far.\n";
-char Illspell[] = "Illegal spell.\n";
-char Nomana[] = "Not enought mana for that spell.\n";
-char Somebetter[] = "But you already have something better.\n";
-char Nobetter[] = "That's no better than what you already have.\n";
diff --git a/games/phantasia/phantglobs.h b/games/phantasia/phantglobs.h
deleted file mode 100644
index b0b64bd..0000000
--- a/games/phantasia/phantglobs.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * phantglobs.h - global declarations for Phantasia
- */
-
-extern double Circle; /* which circle player is in */
-extern double Shield; /* force field thrown up in monster battle */
-
-extern bool Beyond; /* set if player is beyond point of no return */
-extern bool Marsh; /* set if player is in dead marshes */
-extern bool Throne; /* set if player is on throne */
-extern bool Changed; /* set if important player stats have changed */
-extern bool Wizard; /* set if player is the 'wizard' of the game */
-extern bool Timeout; /* set if short timeout waiting for input */
-extern bool Windows; /* set if we are set up for curses stuff */
-extern bool Luckout; /* set if we have tried to luck out in fight */
-extern bool Foestrikes; /* set if foe gets a chance to hit in battleplayer()*/
-extern bool Echo; /* set if echo input to terminal */
-
-extern int Users; /* number of users currently playing */
-extern int Whichmonster; /* which monster we are fighting */
-extern int Lines; /* line on screen counter for fight routines */
-
-extern jmp_buf Fightenv; /* used to jump into fight routine */
-extern jmp_buf Timeoenv; /* used for timing out waiting for input */
-
-extern long Fileloc; /* location in file of player statistics */
-
-extern char *Login; /* pointer to login of current player */
-extern char *Enemyname; /* pointer name of monster/player we are battling*/
-
-extern struct player Player; /* stats for player */
-extern struct player Other; /* stats for another player */
-
-extern struct monster Curmonster;/* stats for current monster */
-
-extern struct energyvoid Enrgyvoid;/* energy void buffer */
-
-extern struct charstats Stattable[];/* used for rolling and changing player stats*/
-
-extern struct charstats *Statptr;/* pointer into Stattable[] */
-
-extern struct menuitem Menu[]; /* menu of items for purchase */
-
-extern FILE *Playersfp; /* pointer to open player file */
-extern FILE *Monstfp; /* pointer to open monster file */
-extern FILE *Messagefp; /* pointer to open message file */
-extern FILE *Energyvoidfp; /* pointer to open energy void file */
-
-extern char Databuf[]; /* a place to read data into */
-
-/* some canned strings for messages */
-extern char Illcmd[];
-extern char Illmove[];
-extern char Illspell[];
-extern char Nomana[];
-extern char Somebetter[];
-extern char Nobetter[];
-
-/* library functions and system calls */
-extern char *getlogin();
-extern char *getpass();
-extern char *strchr();
-extern char *strcat();
-extern char *strcpy();
-extern char *strncpy();
-extern char *getenv();
-struct passwd *getpwuid();
-extern char *fgets();
-
-/* functions which we need to know about */
-extern int interrupt();
-extern int ill_sig();
-extern void catchalarm();
-extern long recallplayer();
-extern long findname();
-extern long allocrecord();
-extern long rollnewplayer();
-extern long allocvoid();
-extern double drandom();
-extern double distance();
-extern double infloat();
-extern double explevel();
-extern char *descrlocation();
-extern char *descrtype();
-extern char *descrstatus();
diff --git a/games/phantasia/phantstruct.h b/games/phantasia/phantstruct.h
deleted file mode 100644
index 05c6da5..0000000
--- a/games/phantasia/phantstruct.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * phantstruct.h - structure definitions for Phantasia
- */
-
-struct player /* player statistics */
- {
- double p_experience; /* experience */
- double p_level; /* level */
- double p_strength; /* strength */
- double p_sword; /* sword */
- double p_might; /* effect strength */
- double p_energy; /* energy */
- double p_maxenergy; /* maximum energy */
- double p_shield; /* shield */
- double p_quickness; /* quickness */
- double p_quksilver; /* quicksilver */
- double p_speed; /* effective quickness */
- double p_magiclvl; /* magic level */
- double p_mana; /* mana */
- double p_brains; /* brains */
- double p_poison; /* poison */
- double p_gold; /* gold */
- double p_gems; /* gems */
- double p_sin; /* sin */
- double p_x; /* x coord */
- double p_y; /* y coord */
- double p_1scratch,
- p_2scratch; /* variables used for decree, player battle */
-
- struct
- {
- short ring_type; /* type of ring */
- short ring_duration; /* duration of ring */
- bool ring_inuse; /* ring in use flag */
- } p_ring; /* ring stuff */
-
- long p_age; /* age of player */
-
- int p_degenerated; /* age/3000 last degenerated */
-
- short p_type; /* character type */
- short p_specialtype; /* special character type */
- short p_lives; /* multiple lives for council, valar */
- short p_crowns; /* crowns */
- short p_charms; /* charms */
- short p_amulets; /* amulets */
- short p_holywater; /* holy water */
- short p_lastused; /* day of year last used */
- short p_status; /* playing, cloaked, etc. */
- short p_tampered; /* decree'd, etc. flag */
- short p_istat; /* used for inter-terminal battle */
-
- bool p_palantir; /* palantir */
- bool p_blessing; /* blessing */
- bool p_virgin; /* virgin */
- bool p_blindness; /* blindness */
-
- char p_name[SZ_NAME]; /* name */
- char p_password[SZ_PASSWORD];/* password */
- char p_login[SZ_LOGIN]; /* login */
- };
-
-struct monster /* monster stats */
- {
- double m_strength; /* strength */
- double m_brains; /* brains */
- double m_speed; /* speed */
- double m_energy; /* energy */
- double m_experience; /* experience */
- double m_flock; /* % chance of flocking */
-
- double m_o_strength; /* original strength */
- double m_o_speed; /* original speed */
- double m_maxspeed; /* maximum speed */
- double m_o_energy; /* original energy */
- double m_melee; /* melee damage */
- double m_skirmish; /* skirmish damage */
-
- int m_treasuretype; /* treasure type */
- int m_type; /* special type */
-
- char m_name[26]; /* name */
- };
-
-struct energyvoid /* energy void */
- {
- double ev_x; /* x coordinate */
- double ev_y; /* y coordinate */
- bool ev_active; /* active or not */
- };
-
-struct scoreboard /* scoreboard entry */
- {
- double sb_level; /* level of player */
- char sb_type[4]; /* character type of player */
- char sb_name[SZ_NAME]; /* name of player */
- char sb_login[SZ_LOGIN]; /* login of player */
- };
-
-struct charstats /* character type statistics */
- {
- double c_maxbrains; /* max brains per level */
- double c_maxmana; /* max mana per level */
- double c_weakness; /* how strongly poison affects player */
- double c_goldtote; /* how much gold char can carry */
- int c_ringduration; /* bad ring duration */
- struct
- {
- double base; /* base for roll */
- double interval; /* interval for roll */
- double increase; /* increment per level */
- } c_quickness, /* quickness */
- c_strength, /* strength */
- c_mana, /* mana */
- c_energy, /* energy level */
- c_brains, /* brains */
- c_magiclvl; /* magic level */
- };
-
-struct menuitem /* menu item for purchase */
- {
- char *item; /* menu item name */
- double cost; /* cost of item */
- };
diff --git a/games/phantasia/setup.c b/games/phantasia/setup.c
deleted file mode 100644
index b295b6a..0000000
--- a/games/phantasia/setup.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * setup.c - set up all files for Phantasia
- *
- * $FreeBSD$
- */
-#include "include.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: main()
-/
-/ FUNCTION: setup files for Phantasia 3.3.2
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: time(), exit(), stat(), Error(), creat(), close(), fopen(),
-/ fgets(), floor(), srandom(), umask(), drandom(), strcpy(), getuid(),
-/ unlink(), fwrite(), fclose(), sscanf(), printf(), strlen(), fprintf()
-/
-/ GLOBAL INPUTS: Curmonster, _iob[], Databuf[], *Monstfp, Enrgyvoid
-/
-/ GLOBAL OUTPUTS: Curmonster, Databuf[], *Monstfp, Enrgyvoid
-/
-/ DESCRIPTION:
-/
-/ This program tries to verify the parameters specified in
-/ the Makefile.
-/
-/ Create all necessary files. Note that nothing needs to be
-/ put in these files.
-/ Also, the monster binary data base is created here.
-/
-*************************************************************************/
-
-void Error();
-
-static char *files[] = { /* all files to create */
- _SPATH_MONST,
- _SPATH_PEOPLE,
- _SPATH_MESS,
- _SPATH_LASTDEAD,
- _SPATH_MOTD,
- _SPATH_GOLD,
- _SPATH_VOID,
- _SPATH_SCORE,
- NULL,
-};
-
-char *monsterfile="monsters.asc";
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char **filename; /* for pointing to file names */
- int fd; /* file descriptor */
- FILE *fp; /* for opening files */
- struct stat fbuf; /* for getting files statistics */
- int ch;
-
- while ((ch = getopt(argc, argv, "m:")) != -1)
- switch(ch) {
- case 'm':
- monsterfile = optarg;
- break;
- case '?':
- default:
- break;
- }
- argc -= optind;
- argv += optind;
-
- srandomdev();
-
-#if 0
- umask(0117); /* only owner can read/write created files */
-#endif
-
- /* try to create data files */
- filename = &files[0];
- while (*filename != NULL)
- /* create each file */
- {
- if (stat(*filename, &fbuf) == 0)
- /* file exists; remove it */
- {
- if (!strcmp(*filename, _SPATH_PEOPLE))
- /* do not reset character file if it already exists */
- {
- ++filename;
- continue;
- }
-
- if (unlink(*filename) < 0)
- Error("Cannot unlink %s.\n", *filename);
- /*NOTREACHED*/
- }
-
- if ((fd = creat(*filename, 0666)) < 0)
- Error("Cannot create %s.\n", *filename);
- /*NOTREACHED*/
-
- close(fd); /* close newly created file */
-
- ++filename; /* process next file */
- }
-
- /* put holy grail info into energy void file */
- Enrgyvoid.ev_active = TRUE;
- Enrgyvoid.ev_x = ROLL(-1.0e6, 2.0e6);
- Enrgyvoid.ev_y = ROLL(-1.0e6, 2.0e6);
- if ((fp = fopen(_SPATH_VOID, "w")) == NULL)
- Error("Cannot update %s.\n", _SPATH_VOID);
- else
- {
- fwrite(&Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
- fclose(fp);
- }
-
- /* create binary monster data base */
- if ((Monstfp = fopen(_SPATH_MONST, "w")) == NULL)
- Error("Cannot update %s.\n", _SPATH_MONST);
- else
- {
- if ((fp = fopen(monsterfile, "r")) == NULL)
- {
- fclose(Monstfp);
- Error("cannot open %s to create monster database.\n", "monsters.asc");
- }
- else
- {
- Curmonster.m_o_strength =
- Curmonster.m_o_speed =
- Curmonster.m_maxspeed =
- Curmonster.m_o_energy =
- Curmonster.m_melee =
- Curmonster.m_skirmish = 0.0;
-
- while (fgets(Databuf, SZ_DATABUF, fp) != NULL)
- /* read in text file, convert to binary */
- {
- sscanf(&Databuf[24], "%lf%lf%lf%lf%lf%d%d%lf",
- &Curmonster.m_strength, &Curmonster.m_brains,
- &Curmonster.m_speed, &Curmonster.m_energy,
- &Curmonster.m_experience, &Curmonster.m_treasuretype,
- &Curmonster.m_type, &Curmonster.m_flock);
- Databuf[24] = '\0';
- strcpy(Curmonster.m_name, Databuf);
- fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
- }
- fclose(fp);
- fclose(Monstfp);
- }
- }
-
-#ifdef MAKE_INSTALLS_THIS_AND_DOESNT_WANT_TO_HEAR_ABOUT_IT
- /* write to motd file */
- printf("One line 'motd' ? ");
- if (fgets(Databuf, SZ_DATABUF, stdin) == NULL)
- Databuf[0] = '\0';
- if ((fp = fopen(_SPATH_MOTD, "w")) == NULL)
- Error("Cannot update %s.\n", _SPATH_MOTD);
- else
- {
- fwrite(Databuf, sizeof(char), strlen(Databuf), fp);
- fclose(fp);
- }
-
- /* report compile-time options */
- printf("Compiled options:\n\n");
- printf("Phantasia destination directory: %s\n", _SPATH_PHANTDIR);
- printf("Wizard: root UID: 0\n");
-
-#ifdef BSD41
- printf("Compiled for BSD 4.1\n");
-#endif
-
-#ifdef BSD42
- printf("Compiled for BSD 4.2\n");
-#endif
-
-#ifdef SYS3
- printf("Compiled for System III\n");
-#endif
-
-#ifdef SYS5
- printf("Compiled for System V\n");
-#endif
-#endif
-
- exit(0);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: Error()
-/
-/ FUNCTION: print an error message, and exit
-/
-/ AUTHOR: E. A. Estes, 12/4/85
-/
-/ ARGUMENTS:
-/ char *str - format string for printf()
-/ char *file - file which caused error
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: exit(), perror(), fprintf()
-/
-/ GLOBAL INPUTS: _iob[]
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/ Print an error message, then exit.
-/
-*************************************************************************/
-
-void
-Error(str, file)
-char *str, *file;
-{
- fprintf(stderr, "Error: ");
- fprintf(stderr, str, file);
- perror(file);
- exit(1);
- /*NOTREACHED*/
-}
-/* */
-/************************************************************************
-/
-/ FUNCTION NAME: drandom()
-/
-/ FUNCTION: return a random number
-/
-/ AUTHOR: E. A. Estes, 2/7/86
-/
-/ ARGUMENTS: none
-/
-/ RETURN VALUE: none
-/
-/ MODULES CALLED: random()
-/
-/ GLOBAL INPUTS: none
-/
-/ GLOBAL OUTPUTS: none
-/
-/ DESCRIPTION:
-/
-*************************************************************************/
-
-double
-drandom()
-{
- if (sizeof(int) != 2)
- return((double) (random() & 0x7fff) / 32768.0);
- else
- return((double) random() / 32768.0);
-}
diff --git a/games/piano/Makefile b/games/piano/Makefile
deleted file mode 100644
index c9a9392..0000000
--- a/games/piano/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= piano
-MAN= piano.6
-DPADD= ${LIBCURSES}
-LDADD= -lcurses
-
-.include <bsd.prog.mk>
diff --git a/games/piano/README b/games/piano/README
deleted file mode 100644
index c4b13ad..0000000
--- a/games/piano/README
+++ /dev/null
@@ -1,12 +0,0 @@
-Hello. I've been using FreeBSD from version 1.0 1993 and very happy.
-One of my favorite is /dev/speaker. Here is my /dev/speaker
-application named `piano' which is a piano/organ emulator. I'd like
-to contribute this program to FreeBSD if you like it.
-
-This directory contains sources, Makefile and man page.
-
-Make sure to config /dev/speaker and make it writable. Please select
-appropriate owner/group/mode for /dev/speaker and piano.
-
-._. . ._ _.. _ .... . .._. .. _. . __ ._ _. .._ ._ ._..
-candy@kgc.co.jp (Toshihiro Kanda) or zw6t-knd@asahi-net.or.jp
diff --git a/games/piano/piano.6 b/games/piano/piano.6
deleted file mode 100644
index 8078b6c..0000000
--- a/games/piano/piano.6
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" $FreeBSD$
-.\"
-.Dd February 3, 1995
-.Dt "PIANO" 6
-.Os
-.Sh NAME
-.Nm piano
-.Nd "a piano emulator"
-.Sh SYNOPSIS
-.Nm
-.Op Fl vV
-.Op Fl i Ar string
-.Sh DESCRIPTION
-The
-.Nm
-plays note by typing
-.Em "QWERTYUIOP[]"
-or
-.Em "12 45 789 -=" .
-Type
-.Em ESC
-key to quit
-.Nm .
-.Nm Piano
-uses
-.Pa /dev/speaker .
-.Pp
-Available option:
-.Bl -tag -width flag
-.It Fl v
-The
-.Fl v
-option causes
-.Nm
-to generate
-.Em "play-string language" .
-.It Fl V
-The
-.Fl V
-option is for
-.Nm
-usage.
-.It Fl i Ar string
-The
-.Fl i
-option initializes
-.Pa /dev/speaker
-by
-.Ar string .
-The default value is
-.Ql "t160 o1 l16 ml" .
-.El
-.Sh FILES
-.Bl -tag -width /dev/speakerxx
-.It Pa /dev/speaker
-speaker device file
-.El
-.Sh SEE ALSO
-.Xr spkr 4
-.Sh AUTHORS
-.An Toshihiro Kanda Aq candy@kgc.co.jp
-Nov. 1993
diff --git a/games/piano/piano.c b/games/piano/piano.c
deleted file mode 100644
index 5eca743..0000000
--- a/games/piano/piano.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * piano.c - a piano emulator
- */
-static const char rcsid[] =
- "$FreeBSD$";
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <curses.h>
-
-#include <unistd.h>
-#include <sys/file.h>
-
-char *myname;
-int verbose;
-static const char *initcmd = "t160 o1 l16 ml";
-
-static const char usage_msg[] =
- "simple keyboard player V0.8086\n"
- "usage: %s [-v][-i str]\n"
- "\t-i str defaults 't160 o1 l16 ml'\n"
- "function: play by console keyboard\n"
- "\tESC to exit. Note keys are ...\n"
- "\t1 2 4 5 7 8 9 - = \\\n"
- "\t Q W E R T Y U I O P [ ]\n"
- ;
-
-struct kdef_t {
- int ch;
- const char *str;
-};
-
-static const char *kstr[256];
-
-static struct kdef_t kdef[] = {
- /* white key */
- { '\t', "<g>" },
- { 'q', "<a>" },
- { 'w', "<b>" },
- { 'e', "c" },
- { 'r', "d" },
- { 't', "e" },
- { 'y', "f" },
- { 'u', "g" },
- { 'i', "a" },
- { 'o', "b" },
- { 'p', ">c<" },
- { '[', ">d<" },
- { ']', ">e<" },
- { '\n', ">f<" },
- { '\r', ">f<" },
- /* black key */
- { '`', "<f#>" },
- { '1', "<g#>" },
- { '2', "<a#>" },
- /*{ '3', "<b#>" },*/
- { '4', "c#" },
- { '5', "d#" },
- /*{ '6', "e#" },*/
- { '7', "f#" },
- { '8', "g#" },
- { '9', "a#" },
- /*{ '0', "b#" },*/
- { '-', ">c#<" },
- { '=', ">d#<" },
- /*{ '\', ">e#<" },*/
- { '\177', ">f#<" },
- { '\0', NULL }
-};
-
-static int
-init_kstr(void)
-{
- struct kdef_t *mv = kdef;
- while (mv->str != NULL) {
- kstr[mv->ch] = mv->str;
- mv++;
- }/* while */
- return 0;
-}/* init_kstr */
-
-static int
-fdputs(const char *s, int fd, int p_echo)
-{
- int err;
- size_t len;
- len = strlen(s);
- write(fd, s, len);
- err = write(fd, "\n", 1);
- if (p_echo) {
- fputs(s, stdout);
- }
- return err;
-}/* fdputs */
-
-static int
-outspkr(const char *s)
-{
- int err = -1, fd = open("/dev/speaker", O_WRONLY);
- if (fd >= 0) {
- fdputs(initcmd, fd, 0);
- err = fdputs(s, fd, verbose);
- close(fd);
- }
- return err;
-}/* outspkr */
-
-static int
-nain(void)
-{
- int ch;
- initscr();
- noecho();
- nonl();
- raw();
- init_kstr();
- while ((ch = getch()) != '\033') {
- if (kstr[ch] != NULL) {
- outspkr(kstr[ch]);
- }
- else {
- if (verbose) {
- switch (ch) {
- case ' ':
- fputs(" ", stdout);
- break;
- case '\b':
- fputs("\b", stdout);
- break;
- }/* switch */
- }
- }
- }/* while */
- endwin();
- return 0;
-}/* nain */
-
-int
-main(int argc, char *argv[])
-{
- int ch, ex, show_usage = 0;
- myname = argv[0];
- while ((ch = getopt(argc, argv, "-vi:")) != -1) {
- switch (ch) {
- default:
- case 'V':
- show_usage++;
- break;
- case 'v':
- verbose++;
- break;
- case 'i':
- initcmd = optarg;
- break;
- }/* switch */
- }/* while */
- ex = 1;
- if (show_usage) {
- fprintf(stderr, usage_msg, myname);
- }
- else {
- printf("Type ESC to exit.\n");
- ex = 0;
- nain();
- }
- return ex;
-}/* main */
diff --git a/games/pig/Makefile b/games/pig/Makefile
deleted file mode 100644
index 9cde1e4..0000000
--- a/games/pig/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= pig
-MAN= pig.6
-
-.include <bsd.prog.mk>
diff --git a/games/pig/pig.6 b/games/pig/pig.6
deleted file mode 100644
index f67c475..0000000
--- a/games/pig/pig.6
+++ /dev/null
@@ -1,49 +0,0 @@
-.\" Copyright (c) 1992 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)pig.6 8.1 (Berkeley) 6/10/93
-.\" $FreeBSD$
-.\"
-.Dd June 10, 1993
-.Dt PIG 6
-.Os
-.Sh NAME
-.Nm pig
-.Nd eformatray inputway asway Igpay Atinlay
-.Sh SYNOPSIS
-.Nm
-.Sh DESCRIPTION
-Ethay
-.Nm igpay
-utilityway eadsray ethay andardstay inputway andway iteswray itway
-outway otay andardstay outputway inway Igpay Atinlay.
-.Pp
-Usefulway orfay eneratinggay onthlymay eportsray.
diff --git a/games/pig/pig.c b/games/pig/pig.c
deleted file mode 100644
index ccb5675..0000000
--- a/games/pig/pig.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-void pigout(char *, int);
-void usage(void);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int len;
- int ch;
- char buf[1024];
-
- while ((ch = getopt(argc, argv, "")) != -1)
- switch(ch) {
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- for (len = 0; (ch = getchar()) != EOF;) {
- if (isalpha(ch)) {
- if (len >= sizeof(buf)) {
- (void)fprintf(stderr, "pig: ate too much!\n");
- exit(1);
- }
- buf[len++] = ch;
- continue;
- }
- if (len != 0) {
- pigout(buf, len);
- len = 0;
- }
- (void)putchar(ch);
- }
- exit(0);
-}
-
-void
-pigout(buf, len)
- char *buf;
- int len;
-{
- int ch, start;
- int olen;
-
- /*
- * If the word starts with a vowel, append "way". Don't treat 'y'
- * as a vowel if it appears first.
- */
- if (index("aeiouAEIOU", buf[0]) != NULL) {
- (void)printf("%.*sway", len, buf);
- return;
- }
-
- /*
- * Copy leading consonants to the end of the word. The unit "qu"
- * isn't treated as a vowel.
- */
- for (start = 0, olen = len;
- !index("aeiouyAEIOUY", buf[start]) && start < olen;) {
- ch = buf[len++] = buf[start++];
- if ((ch == 'q' || ch == 'Q') && start < olen &&
- (buf[start] == 'u' || buf[start] == 'U'))
- buf[len++] = buf[start++];
- }
- (void)printf("%.*say", olen, buf + start);
-}
-
-void
-usage()
-{
- (void)fprintf(stderr, "usage: pig\n");
- exit(1);
-}
diff --git a/games/quiz/Makefile b/games/quiz/Makefile
deleted file mode 100644
index b9b03f1..0000000
--- a/games/quiz/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= quiz
-SRCS= quiz.c rxp.c
-MAN= quiz.6
-FILES= africa america areas arith asia babies bard chinese collectives \
- ed elements europe flowers greek inca index latin locomotive \
- midearth morse murders poetry posneg pres province seq-easy seq-hard \
- sexes sov spell state trek ucc
-FILESDIR= ${SHAREDIR}/games/quiz.db
-HIDEGAME=hidegame
-
-.PATH: ${.CURDIR}/datfiles
-
-.include <bsd.prog.mk>
diff --git a/games/quiz/datfiles/africa b/games/quiz/datfiles/africa
deleted file mode 100644
index 6e74550..0000000
--- a/games/quiz/datfiles/africa
+++ /dev/null
@@ -1,43 +0,0 @@
-Algeria:Alg[iers|er]
-Botswana:Gaberones
-Burundi:Bujumbura
-Cameroun:Yaound['e|e'|e]
-Central Africa{n Rep{ublic}}:Bangui
-Chad:Ndjamena
-Congo:Brazzaville
-Dahomey:Porto Novo
-Ethiopia:Addis Ababa
-Gabon:Libreville
-Ghana:Accra
-Guinea-Bissau:Bissau
-Guinea:Conakry
-Ivory Coast:Abidjan
-Kenya:Nairobi
-Lesotho:Maseru
-Liberia:Monrovia
-Libya:Al Bayda{'}
-Malagasy{ Rep{ublic}}|Madagascar:Tananarive
-Malawi:Zomba
-Mali:Bamako
-Mauritania:Nouakchott
-Morocco:Rabat
-Mo[z|,c|c,|c]ambique:Louren[,c|c,|c]o Marques
-Niger:Niamey
-Nigeria:Lagos
-Rhodesia:Salisbury
-Rwanda:Kigali
-Senegal:Dakar
-Sierra Leone:Freetown
-Somali{ Rep{ublic}}:Mogadis[cio|hu]
-Sudan:Khartoum
-Swaziland:Mbabane
-Tanzania:Dar es Salaam
-Togo:Lom['e|e'|e]
-Tunisia:Tunis
-Uganda:Kampala
-United Arab Rep{ublic}|Egypt:Cairo
-Upper Volta:Ouagadougou
-Zambia:Lusaka
-Za["i|i"|i]re:Kinshasha
-{Rep{ublic} of }South Africa:Pretoria
-{The }Gambia:Bathurst
diff --git a/games/quiz/datfiles/america b/games/quiz/datfiles/america
deleted file mode 100644
index 7f8fee1..0000000
--- a/games/quiz/datfiles/america
+++ /dev/null
@@ -1,27 +0,0 @@
-Argentina:Buenos Aires
-Bahamas:Nassau
-Barbados:Bridgetown
-Bolivia:La Paz|Sucre
-Bra[z|s]il:Brasilia
-Canada:Ottawa
-Chile:Santiago
-Colombia:Bogot['a|a'|a]
-Costa Rica:San Jose
-Cuba:Ha[v|b]ana
-Dominican Republic:Santo Domingo
-Ecuador:Quito
-El Salvador:San Salvador
-Guatemala:Guatemala
-Guyana:Georgetown
-Haiti:Port au Prince
-Honduras:Tegucigalpa
-Jamaica:Kingston
-Mexico:Mexico
-Nicaragua:Managua
-Panama:Panama
-Paraguay:Asunci['o|o'|o]n
-Peru:Lima
-Trinidad[ and Tobago|]:Port of Spain
-United States|US{A}:Washington
-Uruguay:Montevideo
-Venezuela:Caracas
diff --git a/games/quiz/datfiles/areas b/games/quiz/datfiles/areas
deleted file mode 100644
index 25a241b..0000000
--- a/games/quiz/datfiles/areas
+++ /dev/null
@@ -1,124 +0,0 @@
-201:northern new jersey|NJ:newark
-202:washington d c|DC:
-203:connecticut|CT:
-204:manitoba:
-205:alabama|AL:
-206:western washington state|WA:seattle
-207:maine|ME:
-208:idaho|ID:
-209:central california|CA:fresno
-212:new york city, new york|NY:
-213:los angeles, california|CA:
-214:northeastern texas|TX:dallas
-215:southeastern pennsylvania|PA:philadelphia
-216:northeastern ohio|OH:akron
-217:central illinois|IL:springfield
-218:northern minnesota|MN:duluth
-219:northern indiana|IN:south bend
-301:maryland|MD:
-302:delaware|DE:
-303:colorado|CO:
-304:west virginia|WV:
-305:southeastern florida|FL:miami
-306:saskatchewan:
-307:wyoming|WY:
-308:western nebraska|NE:omaha
-309:northwestern illinois|IL:peoria
-312:chicago, illinois|IL:
-313:eastern michigan|MI:detroit
-314:southeastern missouri|MO:jefferson city
-315:northern central new york|NY:syracuse
-316:southern kansas|KS:wichita
-317:central indiana|IN:indianapolis
-318:western louisiana|LA:shreveport
-319:eastern iowa|IA:cedar rapids
-401:rhode island|RI:
-402:eastern nebraska|NE:north platte
-403:alberta:
-404:northern georgia|GA:atlanta
-405:western oklahoma|OK:oklahoma city
-406:montana|MT:
-408:central coastal california|CA:san jose
-412:western pennsylvania|PA:pittsburgh
-413:western massachusetts|MA:springfield
-414:southeastern wisconsin|WI:milwaukee
-415:san francisco, california|CA:
-416:southern central ontario:toronto
-417:southwestern missouri|MO:springfield
-418:northeastern quebec:quebec
-419:northwestern ohio|OH:toledo
-501:arkansas|AR:
-502:western kentucky|KY:louisville
-503:oregon|OR:
-504:eastern louisiana|LA:new orleans
-505:new mexico|NM:
-506:new brunswick:
-507:southern minnesota|MN:rochester
-509:eastern washington state|WA:spokane
-512:southern texas|TX:austin
-513:southwestern ohio|OH:dayton
-514:southwestern quebec:montreal
-515:central iowa|IA:des moines
-516:long island, new york|NY:
-517:central michigan|MI:lansing
-518:northeastern new york|NY:albany
-519:southwestern ontario:windsor
-601:mississippi|MS:
-602:arizona|AZ:
-603:new hampshire|NH:
-604:british columbia:
-605:south dakota|SD:
-606:eastern kentucky|KY:ashland
-607:southern central new york|NY:ithaca, binghamton
-608:southwestern wisconsin|WI:madison
-609:southern new jersey|NJ:trenton
-612:central minnesota|MN:minneapolis
-613:southeastern ontario:ottawa
-614:southeastern ohio|OH:columbus
-615:eastern tennessee|TN:nashville
-616:western michigan|MI:grand rapids
-617:eastern massachusetts|MA:boston
-618:southern illinois|IL:centralia
-701:north dakota|ND:
-702:nevada|NV:
-703:western virginia|VA:arlington
-704:western north carolina:charlotte
-705:northeastern ontario:sault ste. marie
-707:northwestern california|CA:santa rosa
-709:newfoundland:
-712:western iowa|IA:council bluffs
-713:southeastern texas|TX:houston
-714:southern california|CA:san diego
-715:northern wisconsin|WI:superior
-716:northern western new york|NY:buffalo, rochester
-717:eastern pennsylvania|PA:wilkes-barre, scranton
-801:utah|UT:
-802:vermont|VT:
-803:south carolina|SC:
-804:eastern virginia|VA:richmond
-805:southern central coastal california|CA:bakersfield
-806:panhandle texas|TX:amarillo
-807:western ontario:fort william
-808:hawaii|HI:
-809:bermuda, puerto rico, virgin islands, caribbean:
-812:southern indiana|IN:evansville
-813:southwestern florida|FL:st. petersburg
-814:central pennsylvania|PA:erie
-815:northeastern illinois|IL:rockford
-816:northern missouri|MO:kansas city
-817:northern central texas|TX:fort worth
-819:northwestern quebec:trois rivieres
-901:western tennessee|TN:memphis
-902:nova scotia, prince edward island:
-903:western mexico:mexicali
-904:northern florida|FL:jacksonville
-905:eastern mexico:mexico city
-906:upper michigan|MI:escanaba
-907:alaska|AK:
-912:southern georgia|GA:savannah
-913:northern kansas|KS:topeka
-914:southern new york|NY:westchester county
-915:western texas|TX:el paso
-916:northeastern california|CA:sacramento
-918:eastern oklahoma|OK:tulsa
-919:eastern north carolina|NC:raleigh
diff --git a/games/quiz/datfiles/arith b/games/quiz/datfiles/arith
deleted file mode 100644
index 64babb5..0000000
--- a/games/quiz/datfiles/arith
+++ /dev/null
@@ -1,45 +0,0 @@
-63 - ... = 55:8
-147 - 3 = ...:144
-614 - 9 ...:605
-465 - 7 = ...:458
-563 - ... = 560:3
-33 - 14 = ...:19
-42 - ... = 37:5
-264 - 3 = ...:261
-763 - 8 = ...:755
-375 - 6 = ...:369
-736 - ... = 728:8
-62 - 34 = ...:28
-75 - 8 = ...:67
-244 - ... = 230:14
-478 - 19 = ...:459
-78 - ... = 75:3
-679 - 5 = ...:674
-564 - 7 = ...:557
-761 - 5 = ...:756
-718 - ... = 716:2
-56 - 18 = ...:38
-65 - ... = 48:17
-748 - 5 = ...:743
-856 - 8 = ...:848
-763 - 5 = ...:758
-445 - ... = 436:9
-94 - 55 = ...:39
-42 - 9 = ...:33
-483 - ... = 455:28
-742 - ... = 714:28
-84 - ... = 75:9
-569 - 7 = ...:562
-856 - 7 = ...:849
-324 - 6 = ...:318
-437 - ... = 432:5
-84 - 56 = ...:28
-81 - ... = 65:16
-326 - 4 = ...:322
-643 - 7 = ...:636
-546 - 9 = ...:537
-842 - ... = 835:7
-53 - 39 = ...:14
-63 - 48 = ...:15
-57 - 38 = ...:19
-52 - 26 = ...:26
diff --git a/games/quiz/datfiles/asia b/games/quiz/datfiles/asia
deleted file mode 100644
index 02ebff4..0000000
--- a/games/quiz/datfiles/asia
+++ /dev/null
@@ -1,41 +0,0 @@
-Afghanistan:Kabul
-Australia:Canberra
-Bahrein:Manama
-Bangladesh:Dacca
-Bhutan:Thimbu
-Burma:Rangoon
-China:Peking
-Cyprus:Nicosia
-India:New Delhi
-Indonesia:Djakarta
-Iran:Tehran
-Iraq:Baghdad
-Israel:Jerusalem
-Japan:Tokyo
-Jordan:Amman
-Khmer|Cambodia:P{h}nom Penh
-Kuwait:Al-kuwait
-Laos:Vientiane
-Lebanon:Beirut
-Malaysia:Kuala Lumpur
-Maldive Islands:Male
-Mongolia:Ulan Bator
-Nepal:Katmandu
-North Korea:P{'}yongyang
-North Yemen:San{'}a
-Oman:Muscat
-Pakistan:Islamabad
-Papua[-| ]New Guinea:Port Moresby
-Philippines:Quezon City
-Qatar:Doha
-Saudi Arabia:Riyadh|J{ei}ddah
-Singapore:Singapore
-South Korea:Seoul
-South Yemen:Aden
-Sri Lanka:Colombo
-Syria:Damascus
-Taiwan:Taipei
-Thailand:Bangkok
-Turkey:Ankara
-United Arab Emirates:Abu Dhabi
-Vietnam:Hanoi
diff --git a/games/quiz/datfiles/babies b/games/quiz/datfiles/babies
deleted file mode 100644
index 5305c0c..0000000
--- a/games/quiz/datfiles/babies
+++ /dev/null
@@ -1,21 +0,0 @@
-cub:lion|tiger|bear
-kitten:cat|fox|skunk|rabbit|bobcat|panther
-gosling:goose
-colt|foal:horse|donkey|zebra
-puppy:dog
-pup:seal|fox|beaver
-duckling:duck
-fawn:deer
-piglet|shoat:pig
-lamb:sheep
-kid:goat|antelope
-chick:chicken
-tadpole|polliwog:frog|toad
-joey:kangaroo
-calf:cow|whale|moose|elephant|buffalo|giraffe
-caterpillar:butterfly|moth
-elver:eel
-eaglet:eagle
-owlet:owl
-fingerling|fry:fish
-nestling:bird
diff --git a/games/quiz/datfiles/bard b/games/quiz/datfiles/bard
deleted file mode 100644
index 1dad4bf..0000000
--- a/games/quiz/datfiles/bard
+++ /dev/null
@@ -1,228 +0,0 @@
-The quality of mercy is not strain['|e]d:\
-It droppeth as the gentle rain from heaven:\
-{The }Merchant{ of Venice{ IV-i}}:\
-Portia
-Friends{,} Romans{,} Countrymen:\
-lend me your ears{;}:\
-{Julius }Caesar{ III-ii}:\
-{Mark }Antony
-Neither a borrower nor a lender be:\
-For loan oft loses both itself and friend{.}:\
-Hamlet{ I-iii}:\
-Polonius
-To be{,} or not to be{\:}:\
-that is the question{\:}:\
-Hamlet{ III-i}:\
-Hamlet
-Alas{,} poor Yorick{!}:\
-I knew him{,} Horatio{;}:\
-Hamlet{ V-i}:\
-Hamlet
-Double{,} double toil and trouble{;}:\
-Fire burn and cauldron bubble{.}:\
-Macbeth{ IV-i}:\
-Witch{es}
-By the pricking of my thumbs{,}:\
-Something wicked this way comes{.}:\
-Macbeth{ IV-i}:\
-{Second |2nd }Witch
-Out, damned spot! out, I say!:\
-:\
-Macbeth{ V-i}:\
-Lady Macbeth
-Unbidden guests:\
-Are often welcomest when they are gone{.}:\
-{King }Henry VI{,} Part I{ I-ii}:\
-
-She is a woman{,} therefore may be woo'd{;}:\
-She is a woman{,} therefore may be [won|screw'd]{.}:\
-Titus Andronicus{ II-i}:\
-Demetrius
-Such duty as the subject owes the prince{,}:\
-Even such a woman oweth to her husband{.}:\
-{The }Taming of the Shrew{ V-ii}:\
-Kate
-Who is Silvia{?} what is she{,}:\
-That all our swains commend her{?}:\
-{The }Two Gentlemen of Verona{ IV-ii}:\
-Thurio
-Tu-whit{,} tu-who[ - | |--]a merry note{,}:\
-While greasy Joan doth keel the pot{.}:\
-Love's Labo{u}r Lost{ V-ii}:\
-Winter
-My only love sprung from my only hate{!}:\
-Too early seen unknown{,} and known too late{!}:\
-Romeo{ and Juliet{ I-v}}:\
-Juliet
-But{,} soft{!} what light through yonder window breaks{?}:\
-It is the east{,} and Juliet is the sun{!}:\
-Romeo{ and Juliet{ II-ii}}:\
-Romeo
-What's in a name{?} That which we call a rose:\
-By any other name would smell as sweet{.}:\
-Romeo{ and Juliet{ II-ii}}:\
-Juliet
-Good night{,} good night{!} parting is such sweet sorrow{,}:\
-That I shall say good night till it be morrow{.}:\
-Romeo{ and Juliet{ II-ii}}:\
-Juliet
-A plague o['|n] both your houses{!}:\
-They have made worms' meat of me{.}:\
-Romeo{ and Juliet{ III-i}}:\
-Mercutio
-This royal throne of kings{,} this scepter['|e]d isle{,}:\
-This earth of majesty{,} this seat of Mars{,}:\
-{King }Richard II{ II-i}:\
-John of Gaunt
-Not all the water in a rough rude sea:\
-Can wash the balm from an anointed king{.}:\
-{King }Richard II{ III-ii}:\
-{King }Richard II
-I'll put a girdle round the earth:\
-In forty minutes{.}:\
-{A }Midsummer[-| ]Night's Dream{ II-i}:\
-Puck
-I can call spirits from the vasty deep{.}:\
-Why{,} so can I{,} or so can any man{;}:\
-{King }Henry IV{,} Part I{ II-iv}:\
-
-There are more things in heaven and earth{,} Horatio{,}:\
-Than are dream[t|ed] of in your philosophy{.}:\
-Hamlet{ I-v}:\
-Hamlet
-The time is out of joint{;} O cursed spite{,}:\
-That ever I was born to set it right{!}:\
-Hamlet{ I-v}:\
-Hamlet
-Once more unto the breach{,} dear friends{,} once more{;}:\
-Or close the wall up with our English dead{.}:\
-{King }Henry V{ III-i}:\
-{King }Henry V
-Was ever woman in this humour woo['|e]d{?}:\
-Was ever woman in this humour [won|screw'd]{?}:\
-{King }Richard III{ I-ii}:\
-{King }Richard III
-Now is the winter of our discontent:\
-Made glorious summer by this sun of York:\
-{King }Richard III{ I-i}:\
-{King }Richard III
-There['s| is] a divinity that shapes our ends{,}:\
-Rough[-| ]hew them how we will{.}:\
-Hamlet{ V-ii}:\
-Hamlet
-There is a tide in the affairs of men:\
-Which{,} taken at the flood{,} leads on to fortune{;}:\
-{Julius }Caesar{ IV-iii}:\
-Brutus
-Never{,} never{,} never{,} never{,} never{.}:\
-Pray you undo this button{.}{ Thank you{,} sir{.}}:\
-{King }Lear{ V-iii}:\
-{King }Lear
-I grow{,} I prosper{\:}:\
-Now{,} gods{,} stand up for bastards{!}:\
-{King }Lear{ I-ii}:\
-Edmund
-The better part of valour is discretion{;}:\
-in the which better part I have saved my life{.}:\
-{King }Henry IV{,} Part I{ V-iv}:\
-Falstaff
-Asses are made to bear{,} and so are you{.}:\
-Women are made to bear{,} and so are you{.}:\
-{The }Taming of the Shrew{ II-i}:\
-
-Full fathom five thy father lies{;}:\
-Of his bones are coral made{;}:\
-{The }Tempest{ I-ii}:\
-Ariel
-She lov['|e]d me for the dangers I had pass['|e]d{;}:\
-And I lov['|e]d her that she did pity them{.}:\
-Othello{ I-iii}:\
-Othello
-Uneasy lies the head that wears a crown{.}:\
-Many good morrows to your Majesty{!}:\
-{King }Henry IV{,} Part II{ III-i}:\
-
-Mislike me not for my complexion{,}:\
-The shadow['|e]d livery of the burnish['|e]d sun{.}:\
-{The }Merchant{ of Venice{ II-i}}:\
-Morocco
-Cowards die many times before their deaths{;}:\
-The valiant never taste of death but once{.}:\
-{Julius }Caesar{ II-ii}:\
-Caesar
-O{h}{!|,} Pardon me{,} thou bleeding piece of earth{,}:\
-That I am meek and gentle with these butchers{.}:\
-{Julius }Caesar{ III-i}:\
-{Mark }Antony
-The play's the thing:\
-Wherein I'll catch the conscience of the king{.}:\
-Hamlet{ II-ii}:\
-Hamlet
-How sharper than a serpent's tooth it is:\
-to have a thankless child{.}:\
-{King }Lear{ I-iv}:\
-{King }Lear
-Had I but served my God with half the zeal I served my king:\
-He would not in [mine|my] old age have left me naked to [mine|my] enemies{.}:\
-{King }Henry VIII{ IV-ii}:\
-{Cardinal }Wolsey
-It seems she hangs upon the cheek of night:\
-Like a rich jewel in an Ethiop's ear{.}:\
-Romeo{ and Juliet{ I-v}}:\
-Romeo
-Where the bee sucks{,} there suck I{;}:\
-In a cowslip's bell I lie{.}:\
-{The }Tempest{ V-i}:\
-Ariel
-O brave new world{,}:\
-That has such people [in't|in it]{!}:\
-{The }Tempest{ V-i}:\
-Miranda
-Why{,} then the world's mine oyster{,}:\
-Which I with sword will open{.}:\
-{The }Merry Wives of Windsor{ II-ii}:\
-Falstaff
-A goodly apple rotten at the heart{\:}:\
-O{h}{,} what a goodly outside falsehood hath{!|.}:\
-{The }Merchant{ of Venice{ I-iii}}:\
-Antonio
-I never kill['|e]d a mouse{,} nor hurt a fly{;}:\
-I trod upon a worm against my will{,}:\
-Pericles{ IV-i}:\
-Marina
-Golden lads and girls all must{,}:\
-Like chimney sweepers{,} come to dust{.}:\
-Cymbeline{ IV-ii}:\
-Guiderius
-You blocks, you stones, you worse than senseless things!:\
-O you hard hearts{,} you cruel men of Rome{.}:\
-{Julius }Caesar{ I-i}:\
-Marullus
-A horse{!|,} a horse{!|,} my kingdom for a horse{!}:\
-:\
-{King }Richard III{ V-iv}:\
-{King }Richard III
-My salad days,:\
-When I was green in judg{e}ment, cold in blood{,}:\
-Antony [and|&] Cleopatra{ I-v}:\
-Cleopatra
-Age cannot wither her, nor custom stale:\
-Her infinite variety{.}:\
-Antony [and|&] Cleopatra{ II-iii}:\
-Enobarbus
-Give me some music\: music, moody food:\
-Of us that trade in love{.}:\
-Antony [and|&] Cleopatra{ II-v}:\
-Cleopatra
-'Tis better playing with a lion's whelp,:\
-Than with an old one dying{.}:\
-Antony [and|&] Cleopatra:\
-Enobarbus
-The barge she sat in, like a burnished throne,:\
-Burned on the water{.} The poop was burnished gold{;|.}:\
-Antony [and|&] Cleopatra:\
-Enobarbus
-Done like a Frenchman - turn and turn again!:\
-:\
-{King }Henry VI{,} Part I{ III-iii}:\
-{Joan }Pucelle|{Saint |St{.} }Joan{ of Arc}
diff --git a/games/quiz/datfiles/chinese b/games/quiz/datfiles/chinese
deleted file mode 100644
index 66d9472..0000000
--- a/games/quiz/datfiles/chinese
+++ /dev/null
@@ -1,12 +0,0 @@
-rabbit:dragon
-dragon:snake
-snake:horse
-horse:sheep
-sheep:monkey
-monkey:rooster
-rooster:dog
-dog:boar
-boar:rat
-rat:ox
-ox:tiger
-tiger:rabbit
diff --git a/games/quiz/datfiles/collectives b/games/quiz/datfiles/collectives
deleted file mode 100644
index 3b757ee..0000000
--- a/games/quiz/datfiles/collectives
+++ /dev/null
@@ -1,105 +0,0 @@
-actors|soldiers:company
-angels:host
-ants:colony|hill
-apes:shrewdness
-asses:pace|bunch
-badgers:cete
-bass:shoal
-bears:sloth
-bees:swarm
-bees|locusts:swarm
-birds:dissimulation
-brats:passel
-buffaloes:herd
-candidates:slate
-caterpillars:army
-cats:clowder
-cattle:drove|herd
-chickens:peep|flock
-crows:murder
-curs:cowardice
-dogs:pack
-doves:dule
-ducks:[pad|ba]dling
-earthquakes:swarm
-eggs:clutch
-elephants:herd
-elk:gang
-engineers:corps
-ferrets:business
-finches:charm
-firemen:brigade
-fish:school
-foxes:skulk
-gangsters:mob
-geese in flight:skein
-geese on water:gaggle
-goats:trip
-grapes|bananas:bunch
-hawks:cast
-hens:brood
-herons:siege
-horses:haras|team
-hounds:kennel
-jellyfish:smack
-kangaroos|monkeys:troop
-kittens:kindle
-lapwings:deceit
-larks:exaltation|bevy
-leopards:leap
-lions:pride
-locusts:plague
-magpies:tidings
-maidens|quail:bevy
-martens:richness
-men:band
-moles:labor
-monkeys|kangaroos:troop
-mountains:range
-mules:barren|baren
-nightingales:watch
-operating companies:at&t|bell system
-owls:parliament
-oxen:drove
-partridges:covey
-partridges|grouse:covey
-peacocks:ostentation
-people:crowd
-pheasants:bouquet
-plovers:congregation
-ponies:string
-porpoises:shoal
-prisoners:gang
-pups:litter
-quail|maidens:bevy
-rabbits:nest
-ravens:unkindness
-rhinoceroses:crash
-robbers:band
-roebucks:bevy
-rooks:building
-rubbish:heap
-seals:pod
-sheep:flock
-ships:fleet
-snipe:walk|wisp
-sparrows:host
-squirrels:dray
-starlings:murmuration
-stars:constellation
-storks:mustering
-swallows:flight
-teal:spring
-toads:knot
-turkeys:rafter
-turtledoves:pitying
-whales:gam|pod
-whales|fish:school
-witches:coven
-wolves:pack
-wolves:route
-woodcocks:fall
-woodpeckers:descent
-worshippers:congregation
-{H|h}uns:horde
-{wild }swine:sounder
diff --git a/games/quiz/datfiles/ed b/games/quiz/datfiles/ed
deleted file mode 100644
index 6ac8e89..0000000
--- a/games/quiz/datfiles/ed
+++ /dev/null
@@ -1,84 +0,0 @@
-prepare to add text at beginning of file:0a|1i
-find name of file being edited:f
-print last 3 lines of file:$-[2|-],$p
-print previous line:[-|^]{p}|{.}-{1}{p}
-print whole file:1,$p|g/[^|$]/p
-delete this line and next:.{,|;}[{.}+{1}|.1]d
-prepare to replace text from here to just before next "PP":\
-.{,|;}/[PP|{^}\\.PP]/-{1}c
-find next "1.2":/1\\.2/{p}
-find next 2-or-more digit number:\
-/\[[0|1]-9\]\[0-9\]/{p}
-move rest of this paragraph (separated by "PP") to end of previous one:\
-[.,|{.}+{1},|.1,]/[PP|{^}\\.PP]/-{1}m[??|?{^}{\\.}PP?]-{1}
-print every "Oxygen" or "oxygen":[g|1,$g]/\[[Oo|oO]\]xygen/[p|.p]
-change each "BTL" in file to "Bell Laboratories" and check:\
-[g|1,$g]/BTL/[s|.s]/[/|BTL/]Bell Laboratories/gp
-combine every even-numbered line with the next odd-numbered line:\
-2,${-{1}}g/[^|$]/[j|.,{.}+{1}j|.,.1j]
-print next "SH" and following line:\
-/SH/;[{.}+{1}|.1]p|/SH/,[//|/SH/][{.}+{1}|.1]p
-print from next "TS" to following "TE":/TS/;/TE/p
-reverse order of lines in whole file:[g|1,$g]/^/[m|.m]0
-replace each string of x's in current line by one x:\
-[s|.s]/[x|\[x\]][x|\[x\]]*/x/g{p}{ (not s/x*/x/g)}
-change first "hte" in current line to "the" and check:[s|.s]/hte/the/p
-combine previous line and this one:\
-[-,|^,|{.}-{1},].j
-go to line after third "PP" ahead:\
-/[PP|{^}\\.PP]/;[//|/[PP|{^}\\.PP]/];[//|/[PP|{^}\\.PP]/]\
-[{+}1|+]|;[{.}+{1}|.1]{ (not ...p)}
-exchange current line with previous line:\
-[[-|^]m|{.}-{1}m].|{.}m[[--|^^]|{.}-2]
-move everything from here through "stop." to end of file:\
-.,/stop\\./m$
-current line has 2 fields separated by 1 blank; exchange them:\
-[s|.s]/[\\|^\\]([.|\[^ \]]*\\) \\([.|\[^ \]]*\\)[/|$/]\\2 \\1/{p}
-insert a "0" after last "0" on current line:\
-[s|.s]/[.*0/&0|^.*0/&0|0\\(\[^0\]*\\)$/[0&|00\1]|0\[^0\]*$/0&\
-|\[^0\]*$/0&]/{p}
-replace "a*b" by "a**b":s/[a\\*b|a[*]b]/a**b/{p}|\
-s/\\*/**/p
-attach the word "extra" to the end of the current line:\
-[s|.s]/$/{ }extra/{p}
-replace "ATT" in current line by "AT&T":\
-[s|.s]/ATT/AT\\&T/{g}{p}
-double the length of the current line by repetition:\
-[s|.s]/[.*|.|^.*$]/&&/{p}
-look for another line containing what you just looked for://
-find the previous line that contains a capital letter:?\[A-Z\]?{p}
-delete the next line that contains only capital letters:\
-/^\[A-Z\]*$/d|/^\[A-Z\]\[A-Z\]*$/d
-place a copy of current line at the end of the file:\
-t$|.{,.}t$
-find how many lines there are:=|$=
-find the number of the current line:.=
-delete the first 3 lines of the file:1,3d
-delete every line that doesn't begin with "A":\
-[v|1,$v]/^A/d{ (not g/^\[^A\]/d)}
-delete every empty line from here through next "LP":\
-.,/[LP|{{^}\\.}LP]/g/^$/d
-print the line after each "AU":\
-[g|1,$g]/[AU|{^}\\.AU]/[{.}+{1}|.1]{p}
-delete everything after "proud" from current line:\
-[s|.s]/proud.*/proud/{p}
-delete part of current line from "alpha" through "omega":\
-[s|.s]/alpha.*omega//{p}
-save everything up through current line in file "prefix":1,.w prefix
-prepare to add text at end of file:$a
-append the contents of file "suffix" to this file:$r suffix
-go back 10 lines:{.}-10{p}|----------
-change every "01" in current line to "1":[s|.s]/01/1/g{p}
-go to next line that contains a double capital letter:\
-/\\(\[A-Z\]\\)\\1/{p}
-place parens () around current line:\
-[s|.s]/[.*|^.*$]/(&)/{p}
-the current line is too long for your terminal; print it to fit:\
-l|.l
-put the work you've done back in the original file:w
-append the whole file to the file "unfinished":\
-[W|1,$W] unfinished
-insert "\\&" at beginning of current line:\
-[s|.s]/^/\\\\\\&/{p}
-list your current directory:!ls
-stop work on current file and shift to file "other":e other
diff --git a/games/quiz/datfiles/elements b/games/quiz/datfiles/elements
deleted file mode 100644
index fb9c7eb3..0000000
--- a/games/quiz/datfiles/elements
+++ /dev/null
@@ -1,103 +0,0 @@
-H:1:1.008:Hydrogen
-He:2:4.003:Helium
-Li:3:6.94:Lithium
-Be:4:9.013:Beryllium
-B:5:10.82:Boron
-C:6:12.011:Carbon
-N:7:14.008:Nitrogen
-O:8:16.0:Oxygen
-F:9:19.0:Fluorine
-Ne:10:20.183:Neon
-Na:11:22.991:Sodium
-Mg:12:24.32:Magnesium
-Al:13:26.98:Aluminum
-Si:14:28.09:Silicon
-P:15:30.975:Phosphorus
-S:16:32.066:Sul[ph|f]ur
-Cl:17:35.457:Chlorine
-Ar:18:39.944:Argon
-K:19:39.1:Potassium
-Ca:20:40.08:Calcium
-Sc:21:44.96:Scandium
-Ti:22:47.9:Titanium
-V:23:50.95:Vanadium
-Cr:24:52.01:Chromium
-Mn:25:54.94:Manganese
-Fe:26:55.85:Iron
-Co:27:58.94:Cobalt
-Ni:28:58.71:Nickel
-Cu:29:63.54:Copper
-Zn:30:65.38:Zinc
-Ga:31:69.72:Gallium
-Ge:32:72.6:Germanium
-As:33:74.91:Arsenic
-Se:34:78.96:Selenium
-Br:35:79.916:Bromine
-Kr:36:83.8:Krypton
-Rb:37:85.48:Rubidium
-Sr:38:87.63:Strontium
-Y:39:88.92:Yttrium
-Zr:40:91.22:Zirconium
-Nb:41:92.91:Niobium
-Mo:42:95.95:Molybdenum
-Tc:43:(99):Technetium
-Ru:44:101.1:Ruthenium
-Rh:45:102.91:Rhodium
-Pd:46:106.4:Palladium
-Ag:47:107.88:Silver
-Cd:48:112.41:Cadmium
-In:49:114.82:Indium
-Sn:50:118.7:Tin
-Sb:51:121.76:Antimony
-Te:52:127.61:Tellurium
-I:53:126.91:Iodine
-Xe:54:131.3:Xenon
-Cs:55:132.91:Cesium
-Ba:56:137.36:Barium
-La:57:138.92:Lanthanum
-Ce:58:140.13:Cerium
-Pr:59:140.92:Praseodymium
-Nd:60:144.27:Neodymium
-Pm:61:(145):Promethium
-Sm:62:150.35:Samarium
-Eu:63:152.0:Europium
-Gd:64:157.26:Gadolinium
-Tb:65:158.93:Terbium
-Dy:66:162.51:Dysprosium
-Ho:67:164.94:Holmium
-Er:68:167.27:Erbium
-Tm:69:168.94:Thulium
-Yb:70:173.04:Ytterbium
-Lu:71:174.99:Lutetium
-Hf:72:178.5:Hafnium
-Ta:73:180.95:Tantalum
-W:74:183.86:Tungsten
-Re:75:186.22:Rhenium
-Os:76:190.2:Osmium
-Ir:77:192.2:Iridium
-Pt:78:195.09:Platinum
-Au:79:197.0:Gold
-Hg:80:200.61:Mercury
-Tl:81:204.39:Thallium
-Pb:82:207.21:Lead
-Bi:83:209.0:Bismuth
-Po:84:(210):Polonium
-At:85:(210):Astatine
-Rn:86:(222):Radon
-Fr:87:(223):Francium
-Ra:88:(226):Radium
-Ac:89:(227):Actinium
-Th:90:232.05:Thorium
-Pa:91:(231):Protactinium
-U:92:238.07:Uranium
-Np:93:(237):Neptunium
-Pu:94:(242):Plutonium
-Am:95:(243):Americium
-Cm:96:(248):Curium
-Bk:97:(247):Berkelium
-Cf:98:(249):Californium
-Es:99:(254):Einsteinium
-Fm:100:(253):Fermium
-Md:101:(256):Mendelevium
-No:102:(253):Nobelium
-Lw:103:(259):Lawrencium
diff --git a/games/quiz/datfiles/europe b/games/quiz/datfiles/europe
deleted file mode 100644
index 477e8b7..0000000
--- a/games/quiz/datfiles/europe
+++ /dev/null
@@ -1,44 +0,0 @@
-Albania:Tirana|Tirane"
-Andorra:Andorra la V[ell|iej]a
-Austria:Vienna|Wien
-Belarus|Byelorussia:M[i|e]nsk
-Belgium:Brussel[s|]|Bruxelles
-Bosnia[-Herzegovina|]:Sarajevo
-Bulgaria:Sofi[a|ya]
-Croatia:Zagreb
-Czech Republic:Prague|Praha
-Denmark:Copenhagen|K[o|o/]benhavn
-Estonia:Tallinn
-Georgia:Tbilisi
-Germany:Berlin
-United Kingdom|England|Great Britain|UK:London
-Finland:Helsinki
-France:Paris
-Greece:Athens
-Hungary:Budapest
-Iceland:Reykjavik
-Ireland|Eire:Dublin
-Italy:Rom[e|a]
-Latvia:Riga
-Liechtenstein:Vaduz
-Lithuania:Vilnius
-Luxembourg:Luxembourg
-[|Former Yugoslav Republic Of ]Macedonia:Skop[|l]je
-Malta:Valletta
-Moldova:Chisinau|Kishinev
-Monaco:Monte Carlo
-Netherlands|Holland:The Hague|'sGravenhage|den Haag|Amsterdam
-Norway:Oslo
-Poland:Wars[aw|zawa]
-Portugal:Lisbo[n|a]
-R[u|o]mania:Bucharest|Bucuresti
-Russia:Mos[cow|kva]
-San Marino:San Marino
-Slovakia|Slovak Republic:Bratislava
-Slovenia:Ljubljana
-Spain:Madrid
-Sweden:Stockholm
-Switzerland:Bern{e}
-Turkey:Ankara
-Ukraine:Kiev|Kyiv
-Yugoslavia:Belgrade|Beograd
diff --git a/games/quiz/datfiles/flowers b/games/quiz/datfiles/flowers
deleted file mode 100644
index 1d71774..0000000
--- a/games/quiz/datfiles/flowers
+++ /dev/null
@@ -1,45 +0,0 @@
-African violet:Such worth is rare
-Apple blossom:Preference
-Bachelor's button:Celibacy
-Bay leaf:I change but in death
-Camellia:Reflected loveliness
-Chrysanthemum, non-red/white:Slighted love
-Chrysanthemum, red:I love
-Chrysanthemum, white:Truth
-Clover:Be mine
-Crocus:Abuse not
-Daffodil:Innocence
-Dead leaves:Melancholy
-Forget-me-not:True love
-Fuchsia:Fast
-Gardenia:Secret, untold love
-Honeysuckle:Bonds of love
-Ivy:Friendship, fidelity, marriage
-Jasmine:Amiability, transports of joy, sensuality
-Lilac:Youthful innocence
-Lilly of the valley:Return of happiness
-Lilly:Purity, sweetness
-Magnolia:Dignity, perseverance
-Marigold:Jealousy
-Mint:Virtue
-Orange blossom:Your purity equals your loveliness
-Orchid:Beauty, magnificence
-Pansy:Thoughts
-Peach blossom:I am your captive
-Petunia:Your presence soothes me
-Poppy:Sleep
-Rose, any color:Love
-Rose, deep red:Bashful shame
-Rose, single, pink:Simplicity
-Rose, thornless, any color:Early attachment
-Rose, white:I am worthy of you
-Rose, yellow:Decrease of love, rise of jealousy
-Rosebud, white:Girlhood, and a heart ignorant of love
-Rosemary:Remembrance
-Sunflower:Haughtiness
-Tulip, red:Declaration of love
-Tulip, yellow:Hopeless love
-Upside down:Reverses meaning
-Violet, blue:Faithfulness
-Violet, white:Modesty
-Zinnia:Thoughts of absent friends
diff --git a/games/quiz/datfiles/greek b/games/quiz/datfiles/greek
deleted file mode 100644
index 4833e83..0000000
--- a/games/quiz/datfiles/greek
+++ /dev/null
@@ -1,7 +0,0 @@
-$luw$:{I} [loose|destroy]
-$eluon$:{I} [loosed|destroyed|was loosing|was destroying]
-$elusa$:{I} [loosed|destroyed]
-$leluka$:{I} have [loosed|destroyed]
-$lusw$:{I} will [loose|destroy]
-$luswn$:[loosing|destroying]
-$lusas$:{having} [loosed|destroyed]
diff --git a/games/quiz/datfiles/inca b/games/quiz/datfiles/inca
deleted file mode 100644
index 02fd39f..0000000
--- a/games/quiz/datfiles/inca
+++ /dev/null
@@ -1,12 +0,0 @@
-manco capac:sinchi roca
-sinchi roca:lloque yupanqui
-lloque yupanqui:mayta capac
-mayta capac:capac yupanqui
-capac yupanqui:inca roca
-inca roca:yahuar huacac
-yahuar huacac:viracocha
-viracocha:pachacuti
-pachacuti:tupa inca yupanqui
-tupa inca yupanqui:huayna capac
-huayna capac:huascar
-huascar:atahuallpa
diff --git a/games/quiz/datfiles/index b/games/quiz/datfiles/index
deleted file mode 100644
index 67a5234..0000000
--- a/games/quiz/datfiles/index
+++ /dev/null
@@ -1,32 +0,0 @@
-/usr/share/games/quiz.db/africa:Africa{n}:cap{ital}
-/usr/share/games/quiz.db/america:America{n}:cap{ital}
-/usr/share/games/quiz.db/areas:area{-code}:state{-region}:city
-/usr/share/games/quiz.db/arith:arith{metic}:ans{wer}
-/usr/share/games/quiz.db/asia:Asia{n}:cap{ital}
-/usr/share/games/quiz.db/babies:baby:adult
-/usr/share/games/quiz.db/bard:Shakespeare{{-}line{s}}|line{s}:next:work:char{acter}
-/usr/share/games/quiz.db/chinese:{Chinese{-}}year:next
-/usr/share/games/quiz.db/collectives:ind{ividuals}:coll{ective}
-/usr/share/games/quiz.db/ed:function:ed-command
-/usr/share/games/quiz.db/elements:symbol:number:weight:element
-/usr/share/games/quiz.db/europe:Europe{an}:cap{ital}
-/usr/share/games/quiz.db/flowers:flower{s}:meaning
-/usr/share/games/quiz.db/greek:greek:english
-/usr/share/games/quiz.db/inca:inca:succ{essor}
-/usr/share/games/quiz.db/latin:latin:english
-/usr/share/games/quiz.db/locomotive:locomotive:name
-/usr/share/games/quiz.db/midearth:M[iddle{-}Earth|E]:cap{ital}
-/usr/share/games/quiz.db/morse:clear|alpha{bet{ic}}:morse
-/usr/share/games/quiz.db/mult:mult{iplication}:ans{wer}
-/usr/share/games/quiz.db/murders:victim:killer
-/usr/share/games/quiz.db/poetry:poem{-}line:next:poem:author
-/usr/share/games/quiz.db/posneg:pos{itive}:neg{ative}
-/usr/share/games/quiz.db/pres:pres{ident}:term:succ{essor}
-/usr/share/games/quiz.db/province:province:cap{ital}
-/usr/share/games/quiz.db/seq-easy:easy{-}{seq{uence}}:next:name
-/usr/share/games/quiz.db/seq-hard:hard{-}{seq{uence}}:next:name
-/usr/share/games/quiz.db/sexes:male:female
-/usr/share/games/quiz.db/sov:sov{ereign}:cen{t{ury}}:succ{essor}
-/usr/share/games/quiz.db/state:state:cap{ital}:abbr{ev{iation}}:flower
-/usr/share/games/quiz.db/trek:star:trek
-/usr/share/games/quiz.db/ucc:section:U{niform{-}}C{riminal{-}}C{ode}
diff --git a/games/quiz/datfiles/latin b/games/quiz/datfiles/latin
deleted file mode 100644
index 0b03bd3..0000000
--- a/games/quiz/datfiles/latin
+++ /dev/null
@@ -1,157 +0,0 @@
-condo:{I }found
-condidi:{I }founded
-laedo:{I }[injure|thwart]
-impello:{I }[drive|force]
-impulit:{he }[drove|forced]
-sino:{I }permit
-sinat:{he }permit{s}
-dolor:pain|grief
-invideo:{I }[envy|hate]
-invisus:[hated|envied]
-immitis:cruel|harsh
-arceo:{I }[keep away|hinder|prevent]
-ratis:ship
-antrum:cave
-freno:rein{ in}|curb|check
-celsus:lofty
-spelunca:cave{rn}
-foedus (n.):agreement|treaty|truce
-foedera:agreements|treaties
-laxus:loose|free
-habena:rein{s}
-mulceo:soothe|calm
-fluctus (n.):wave{s}
-exigo:finish|spend
-exegit:{he }[finished|spent]
-opto (v.):desire|wish
-optat:{he }[desire{s}|wish{es}]
-capesso:seize|carry out
-concilio (v.):secure|gain
-converto:reverse
-procella:blast|gust
-polus:sky|heaven
-mico:flash|gleam
-extemplo:immediately
-frigus (n.):cold|chill
-ingemo:groan
-os (n.):mouth
-effundo:pour{ out}
-corripio:snatch|catch
-harena:sand
-excutio:shake{ off}
-nare:{to }swim
-rima:crack|fissure
-fatisco:gape{ open}
-disjicio:scatter|disperse
-dolus (n.):deceit
-luo:wash{ away}|atone{ for}
-cito (adv.):quickly|soon
-tumidus:swollen
-fugo:put to flight|drive out
-adnitor:strive
-seditio:riot|uprising
-fax:fire{-}brand
-volo (v.):fly
-arrigo:prick up
-cunctus:whole|entire
-flecto:turn|guide
-sinus:bay|fold|curve|gulf
-scindo:split|divide
-rupes:crag|cliff
-geminus:twin
-minatur:{he }threaten{s}
-coruscus:flashing|waving
-horreo:bristle
-nemus:grove
-nemora:groves
-umbra:shade|shadow
-intus:within
-dulcis:sweet|fresh
-sedile:seat|bench
-fessus:weary|tired
-uncus:hooked|curved
-morsus:bite
-artus:joint|limb
-silex:flint
-scintilla:spark
-folium:leaf
-aridus:dry
-corrumpo:spoil|ruin
-corrupit:{he }[spoil{ed}|ruin{ed}]
-frux:grain
-torreo:parch
-celsus:high|lofty
-cervus:stag
-erro:wander
-armentum:herd
-pasco:feed|nourish
-pascor:graze
-arcus:bow
-turba:crowd
-sterno:strew
-humus:ground|earth
-vinum:wine
-maereo:mourn|sorrow
-ignarus:unknowing|ignorant|inexperienced
-rabies:rage|fury
-penitus:within
-sono (v.):sound|roar
-maestus:sad|gloomy
-forsan:perhaps
-olim:someday|sometime
-memini:{I }remember
-varius:different
-discrimen:crisis|danger
-quiesco:become quiet
-refert:{he }[say{s}|tell{s}]
-vultus:face|countenance
-cor:heart
-corda:hearts
-dolor:pain|grief
-daps:feast
-dapes:feasts
-viscus:flesh
-seco:cut
-tremo:quiver
-pinguis:fat|rich
-mensa:table
-sermo:talk|discourse
-dubius:doubtful|wavering
-pius:dutiful|devoted|loyal
-gemo:lament|moan|bemoan
-crudelis:cruel|bitter
-lumen:light|eye
-lumina:lights|eyes
-tristis:sad
-lacrima:tear
-niteo:shine|glisten
-fulmen:thunderbolt|lightning
-fulmina:thunderbolts
-funus:death|disaster
-funera:deaths|disasters
-orbis terrarum:world
-ductor:leader
-dicio (n.):power
-fons:spring|source
-fontes:springs|sources
-arvum:land
-infandus:unspeakable
-rideo:laugh
-osculum:lip
-libo:sip|touch|kiss
-nata:daughter
-haereo:{I }[stick to|adhere]
-promitto:primise
-sublimis:high|uplifted|up high
-quando:since|when|because
-arcanum:{a }secret
-ferox:fierce|savage
-contundo:crush
-albus:white
-donec:until
-sacerdos:priest{ess}
-lupus:wolf
-nutrix:nurse
-nutrices:nurses
-fulvus:tawny|yellow
-meta:limit|boundary
diff --git a/games/quiz/datfiles/locomotive b/games/quiz/datfiles/locomotive
deleted file mode 100644
index a29cc01..0000000
--- a/games/quiz/datfiles/locomotive
+++ /dev/null
@@ -1,11 +0,0 @@
-4-4-0:American
-4-6-0:Mogul
-4-4-2:Atlantic
-4-6-2:Pacific
-2-8-0:Consolidation
-2-8-2:Mikado
-4-8-2:Mountain
-2-8-4:Berkshire
-4-6-4:Hudson
-4-8-4:Northern
-2-10-2:Decapod
diff --git a/games/quiz/datfiles/midearth b/games/quiz/datfiles/midearth
deleted file mode 100644
index 17e21c0..0000000
--- a/games/quiz/datfiles/midearth
+++ /dev/null
@@ -1,10 +0,0 @@
-Shire:Michel Delving|Hobbiton
-Mordor:Minas Morgul
-Gondor:Minas Tirith
-Umbar:{City of the }Corsairs
-Rhovanion:Esgaroth{ upon the Long Lake}
-Rohan:Edoras
-Lothl['o|o|o']rien:Caras Galadon
-Breeland:Bree
-Arnor:Ann['u|u'|u]minas
-Arthedain:Fornost{ Erain}|Norbury of the Kings
diff --git a/games/quiz/datfiles/morse b/games/quiz/datfiles/morse
deleted file mode 100644
index 4086374..0000000
--- a/games/quiz/datfiles/morse
+++ /dev/null
@@ -1,26 +0,0 @@
-A:.-
-B:-...
-C:-.-.
-D:-..
-E:.
-F:..-.
-G:--.
-H:....
-I:..
-J:.---
-K:-.-
-L:.-..
-M:--
-N:-.
-O:---
-P:.--.
-Q:--.-
-R:.-.
-S:...
-T:-
-U:..-
-V:...-
-W:.--
-X:-..-
-Y:-.--
-Z:--..
diff --git a/games/quiz/datfiles/mult b/games/quiz/datfiles/mult
deleted file mode 100644
index 2ce87a0..0000000
--- a/games/quiz/datfiles/mult
+++ /dev/null
@@ -1,99 +0,0 @@
-1 x 0:0
-1 x 1:1
-1 x 2:2
-1 x 3:3
-1 x 4:4
-1 x 5:5
-1 x 6:6
-1 x 7:7
-1 x 8:8
-1 x 9:9
-1 x 10:10
-2 x 0:0
-2 x 1:2
-2 x 2:4
-2 x 3:6
-2 x 4:8
-2 x 5:10
-2 x 6:12
-2 x 7:14
-2 x 8:16
-2 x 9:18
-2 x 10:20
-3 x 0:0
-3 x 1:3
-3 x 2:6
-3 x 3:9
-3 x 4:12
-3 x 5:15
-3 x 6:18
-3 x 7:21
-3 x 8:24
-3 x 9:27
-3 x 10:30
-4 x 0:0
-4 x 1:4
-4 x 2:8
-4 x 3:12
-4 x 4:16
-4 x 5:20
-4 x 6:24
-4 x 7:28
-4 x 8:32
-4 x 9:36
-4 x 10:40
-5 x 0:0
-5 x 1:5
-5 x 2:10
-5 x 3:15
-5 x 4:20
-5 x 5:25
-5 x 6:30
-5 x 7:35
-5 x 8:40
-5 x 9:45
-5 x 10:50
-6 x 0:0
-6 x 1:6
-6 x 2:12
-6 x 3:18
-6 x 4:24
-6 x 5:30
-6 x 6:36
-6 x 7:42
-6 x 8:48
-6 x 9:54
-6 x 10:60
-7 x 0:0
-7 x 1:7
-7 x 2:14
-7 x 3:21
-7 x 4:28
-7 x 5:35
-7 x 6:42
-7 x 7:49
-7 x 8:56
-7 x 9:63
-7 x 10:70
-8 x 0:0
-8 x 1:8
-8 x 2:16
-8 x 3:24
-8 x 4:32
-8 x 5:40
-8 x 6:48
-8 x 7:56
-8 x 8:64
-8 x 9:72
-8 x 10:80
-9 x 0:0
-9 x 1:9
-9 x 2:18
-9 x 3:27
-9 x 4:36
-9 x 5:45
-9 x 6:54
-9 x 7:63
-9 x 8:72
-9 x 9:81
-9 x 10:90
diff --git a/games/quiz/datfiles/murders b/games/quiz/datfiles/murders
deleted file mode 100644
index 30cf324..0000000
--- a/games/quiz/datfiles/murders
+++ /dev/null
@@ -1,25 +0,0 @@
-Cock Robin:{the }sparrow
-sleep|Duncan:Macbeth
-{the }cat:curiosity|care
-{John {F{.} }}Kennedy|JFK:{Lee Harvey }Oswald|{the }FBI|{the }CIA
-{Lee Harvey }Oswald:{Jack }Ruby|{the }FBI|{the }CIA
-{Martin Luther }King:{James {Earl }}Ray|{the }FBI|{the }CIA
-[Bobby |Robert {F{.} }]Kennedy|RFK:{Sirhan }Sirhan|{the }FBI|{the }CIA
-Christ:{the }Romans|{Pontius }Pilate|{the }CIA
-{Sharon }Tate:{Charles }Manson
-Charles Lindbergh Jr{.}:{Bruno }Hauptman{n}
-{Mr{.} }{{and }Mrs{.} }Borden|{her }parents:Lizzie{ Borden}
-{Prof{essor} }{James }Moriarty:{Sherlock }Holmes
-Achilles:Paris
-Abel:Cain
-{the }nurses:{Richard }Speck
-{J{.} |Julius }Caesar:Brutus{ et al.}
-Pompeii:Vesuvius
-{Abraham |Abe }Lincoln:{John {Wilkes }}Booth
-{Yukio }Mishima:{Yukio }Mishima
-{Alexander }Hamilton:{Aaron }Burr
-Cleopatra:{the |an }asp
-[Ann Boleyn|Catharine Howard]:Henry{ VIII}
-vaudeville:{the }movies|film
-{the }movies|film:TV|television
-{the }VA patients:{the }nurses
diff --git a/games/quiz/datfiles/poetry b/games/quiz/datfiles/poetry
deleted file mode 100644
index f4c07d6..0000000
--- a/games/quiz/datfiles/poetry
+++ /dev/null
@@ -1,184 +0,0 @@
-Come live with me and be my love:\
-And we will all the pleasures prove:\
-{The }Passionate Shepherd{ to his Love}:\
-{Christopher }Marlowe
-Shall I compare thee to a summer's day{?}:\
-Thou art more lovely and more temperate:\
-Sonnet 18:\
-{William }Shakespeare
-Fine knacks for ladies, cheap, choice, brave, and new!:\
-Good pennyworths{! }but money cannot move:\
-Fine Knacks{ for Ladies}:\
-{John }Dowland
-My mind to me a kingdom is:\
-Such perfect joy therein I find:\
-My Mind to Me a Kingdom Is:\
-{Sir }{Edward }Dyer
-Underneath this stone doth lie:\
-As much beauty as could die:\
-Epitaph on Elizabeth{,} {L. H.}:\
-{Ben }Jonson
-Death be not proud, though some have called thee:\
-Mighty and dreadful{,} for thou art not so:\
-{Holy }Sonnet{s}{ 10}:\
-{John }Donne
-Gather ye rose-buds while ye may:\
-Old Time is still a-flying:\
-To the Virgins{,} {To Make Much of Time}:\
-{Robert }Herrick
-Why so pale and wan, fond lover?:\
-Prithee{,} why so pale{?}:\
-Song:\
-{Sir }{John }Suckling
-Stone walls do not a prison make:\
-Nor iron bars a cage:\
-To Althea{,} From Prison:\
-{Richard }Lovelace
-I could not love thee (Dear) so much,:\
-Lov['|e]d I not hono{u}r more:\
-To Lucasta{, Going to the Wars}:\
-{Richard }Lovelace
-I saw Eternity the other night:\
-Like a great ring of pure and endless light:\
-{The }World:\
-{Henry }Vaughan
-Come and trip it as you go,:\
-On the light fantastic toe:\
-L'Allegro:\
-{John }Milton
-When I consider how my light is spent:\
-Ere half my days in this dark world and wide:\
-On His Blindness|When I Consider:\
-{John }Milton
-The grave's a fine and private place{,}:\
-But none{,} I think{,} do there embrace{.}:\
-To His Coy Mistress:\
-{Andrew }Marvel
-Great wits are sure to madness near allied:\
-And thin partitions do their bounds divide:\
-Absalom and Achitophel|Absalom:\
-{John }Dryden
-A little learning is a dangerous thing{;}:\
-Drink deep{,} or taste not the Pierian spring{.}:\
-{An }Essay on Criticism|{On }Criticism:\
-{Alexander }Pope
-The curfew tolls the knell of parting day{,}:\
-The lowing herd wind slowly o'er the lea:\
-Elegy{ Written in a Country Church{-| }Yard:\
-{Thomas }Gray
-The best laid schemes o' mice an' men gang aft a-gley{,}:\
-An{'|d} lea{'|v}e us nought but grief an{'|d} pain for promised joy{.}:\
-To a Mouse:\
-{Robert }Burns
-Tiger! tiger! burning bright!:\
-In the forests of the night:\
-{The }Tiger:\
-{William }Blake
-My heart leaps up when I behold:\
-A rainbow in the sky:\
-My Heart Leaps Up:\
-{William }Wordsworth
-The world is too much with us; late and soon{,}:\
-Getting and spending{,} we lay waste our powers:\
-{The }World is Too Much With Us|Sonnet:\
-{William }Wordsworth
-A sadder and a wiser man{,}:\
-He rose the morrow morn:\
-{The }{Rime of }{The }Ancient Mariner:\
-{Samuel }{Taylor }Coleridge
-In Xanadu did Kubla Khan:\
-A stately pleasure{-| }dome decree:\
-Kubla Khan:\
-{Samuel }{Taylor }Coleridge
-She walks in beauty, like the night:\
-Of cloudless climes and starry skies:\
-She Walks in Beauty:\
-{George Gordon, }{Lord }Byron
-I want a hero- an uncommon want{,}:\
-When every year and month sends forth a new one:\
-Don Juan{ Canto I}:\
-{George Gordon, }{Lord }Byron
-A thing of beauty is a joy forever.:\
-Its loveliness increases{;|.} {it will never/Pass into nothingness}:\
-Endymion{ Book I}:\
-{John }Keats
-Matched with an aged wife, I mete and dole:\
-Unequal laws unto a savage race:\
-Ulysses:\
-{Alfred{,} }{Lord }Tennyson
-He will hold thee, when his passion shall have spent its novel force{,}:\
-Something better than his dog{,} a little dearer than his horse:\
-Locksley Hall:\
-{Alfred{,} }{Lord }Tennyson
-'Tis better to have loved and lost:\
-Than never to have loved at all:\
-{In }Memoriam{ A. H. H.}:\
-{Alfred{,} }{Lord }Tennyson
-Kind hearts are more than coronets,:\
-And simple faith than Norman blood{.}:\
-Lady Clara Vere de Vere:\
-{Alfred{,} }{Lord }Tennyson
-Oh, to be in England:\
-Now that April's there:\
-Home{-| }Thoughts{,} From Abroad:\
-{Robert }Browning
-Ah, but a man's reach should exceed his grasp{,}:\
-Or what's a heaven for{?}:\
-Andrea Del Sarto:\
-{Robert }Browning
-How do I love thee? Let me count the ways.:\
-I love thee to the depth and breadth and height:\
-Sonnet{s} {From the Portuguese}{ 43}:\
-{Elizabeth }{Barrett }Browning
-A Book of Verses underneath the Bough{,}:\
-A Jug of Wine, a Loaf of Bread{-|,| }and Thou:\
-{The }Rubaiyat{ of Omar Khayyam}{ 12}:\
-{Edward }Fitzgerald
-The Moving Finger writes; and, having writ,:\
-Moves on{\:|,|.} nor all your Piety nor Wit:\
-{The }Rubaiyat{ of Omar Khayyam}{ 71}:\
-{Edward }Fitzgerald
-Ah Love! could you and I with Him conspire:\
-To grasp this sorry Scheme of Things entire:\
-{The }Rubaiyat{ of Omar Khayyam}{ 99}:\
-{Edward }Fitzgerald
-Remember me when I am gone away,:\
-Gone far away into the silent land:\
-Remember:\
-{Christina }Rossetti
-Home is the sailor, home from the sea,:\
-And the hunter home from the hill:\
-Requiem:\
-{Robert }{Louis }Stevenson
-I fled Him, down the nights and down the days;:\
-I fled Him, down the arches of the years:\
-{The }Hound of Heaven:\
-{Francis }Thompson
-So 'ere's to you, Fuzzy-Wuzzy, at your 'ome in the Soudan;:\
-You're a {pore|poor} benighted {'|h}eathen but a first class fightin{'|g} man:\
-Fuzzy{-| }Wuzzy:\
-{Rudyard }Kipling
-Morns abed and daylight slumber:\
-Were not meant for man alive:\
-Reveille:\
-{A{.}{ }E{.}{ }}Houseman
-I will arise and go now, and go to Innisfree,:\
-And a small cabin build there{,} of clay and wattles made:\
-{The }{Lake Isle of }Innisfree:\
-{William }{Butler }Yeats
-I must go down to the seas again, to the lonely sea and the sky,:\
-And all I ask is a tall ship and a star to steer her by:\
-Sea{-| }Fever:\
-{John }Masefield
-April is the cruelest month, breeding:\
-Lilacs out of the dead land:\
-{The }Waste{ }Land:\
-{T{.}{ }S{.}{ }}Eliot
-Now as I was young and easy under the apple boughs:\
-About the little house and happy as the grass was green:\
-Fern Hill:\
-{Dylan }Thomas
-Of Man's first disobedience, and the fruit:\
-Of that forbidden tree{,} whose mortal taste:\
-Paradise Lost:\
-{John }Milton
diff --git a/games/quiz/datfiles/posneg b/games/quiz/datfiles/posneg
deleted file mode 100644
index 03fde40..0000000
--- a/games/quiz/datfiles/posneg
+++ /dev/null
@@ -1,50 +0,0 @@
-large|big:small
-on:off
-standing up:sitting down
-inside:outside
-high:low
-old:new|young
-hot:cold
-out:in
-heavy|dark:light
-daytime:night[time| time]
-stop|come:go
-top:bottom
-floor:ceiling
-near:far
-run:walk
-empty|hungry:full
-backwards:f[or|ront]wards
-big|large:little|small
-fat|thick:thin|skinny
-bright|light:dark|dull
-right:wrong|left
-give:take|receive|get
-buy:sell
-shiny|bright:dull
-dawn:dusk
-fall down|go to bed:[get|stand|rise] up
-asleep:awake
-up:down
-open[|ed|]:close[d|]
-smile:frown|cry
-happy|glad:sad
-hard:soft|easy
-boy|woman|lady:girl|man
-fast:slow
-wet:dry
-covered|hid[den|]:uncovered|open
-good:bad
-always|sometimes|now:never|sometimes
-beautiful|pretty:ugly
-rough:smooth
-hairy:bald||smooth
-above:below
-yin:yang
-sweet:sour
-if:unless
-from|fro:to
-with[|in|]:without|against
-after:before
-together:apart
-plus:minus
diff --git a/games/quiz/datfiles/pres b/games/quiz/datfiles/pres
deleted file mode 100644
index 49da275..0000000
--- a/games/quiz/datfiles/pres
+++ /dev/null
@@ -1,38 +0,0 @@
-{G{eorge} }Washington:1789-{17}97:{J{ohn} }Adams
-{J{ohn} }Adams:1797-1801:{T{homas} }Jefferson
-{T{homas} }Jefferson:1801-{{18}0}9:{J{ames} }Madison
-{J{ames} }Madison:1809-{18}17:{J{ames} }Monroe
-{J{ames} }Monroe:1817-1825:{J{ohn} }{Q{uincy} }Adams
-{J{ohn} }{Q{uincy} }Adams:1825-{{18}2}9:{A{ndrew} }Jackson
-{A{ndrew} }Jackson:1829-{18}37:{M{artin} }Van Buren
-{M{artin} }Van Buren:1837-{18}41:{W{illiam|m} }{H{enry} }Harrison
-{W{illiam|m} }{H{enry} }Harrison:1841:{J{ohn} }Tyler
-{J{ohn} }Tyler:1841-{{18}4}5:{J{ames} }{K{nox} }Polk
-{J{ames} }{K{nox} }Polk:1845-{{18}4}9:{Z{achary} }Taylor
-{Z{achary} }Taylor:1849-{18}50:{M{illard} }Fillmore
-{M{illard} }Fillmore:1850-{{18}5}3:{F{ranklin} }Pierce
-{F{ranklin} }Pierce:1853-{{18}5}7:{J{ames} }Buchanan
-{J{ames} }Buchanan:1857-{18}61:{A{braham|be} }Lincoln
-{A{braham|be} }Lincoln:1861-{{18}6}5:{A{ndrew} }Johnson
-{A{ndrew} }Johnson:1865-{{18}6}9:{U{lysses} }{S{impson} }Grant
-{U{lysses} }{S{impson} }Grant:1869-{18}77:{R{utherford} }{B{irchard} }Hayes
-{R{utherford} }{B{irchard} }Hayes:1877-{18}81:{J{ames} }{A{bram} }Garfield
-{J{ames} }{A{bram} }Garfield:1881:{C{hester} }{A{lan} }Arthur
-{C{hester} }{A{lan} }Arthur:1881-{{18}8}5:{G{rover} }Cleveland{ (1st term)}
-{G{rover} }Cleveland{ (1st term)}:1885-{{18}8}9:{B{enjamin} }Harrison
-{B{enjamin} }Harrison:1889-{18}93:{G{rover} }Cleveland{ (2nd term)}
-{G{rover} }Cleveland{ (2nd term)}:1893-{18}97:{W{illiam|m} }McKinley
-{W{illiam|m} }McKinley:1897-1901:{T{heodore|eddy} }Roosevelt|TR
-{T{heodore|eddy} }Roosevelt|TR:1901-{{19}0}9:{W{illiam|m} }{H{oward} }Taft
-{W{illiam|m} }{H{oward} }Taft:1909-{19}13:{W{oodrow} }Wilson
-{W{oodrow} }Wilson:1913-{19}21:{W{arren} }{G{amaliel} }Harding
-{W{arren} }{G{amaliel} }Harding:1921-{{19}2}3:{C{alvin} }Coolidge
-{C{alvin} }Coolidge:1923-{{19}2}9:{H{erbert} }Hoover
-{H{erbert} }Hoover:1929-{19}33:{F{ranklin} }{D{elano} }Roosevelt|FDR
-{F{ranklin} }{D{elano} }Roosevelt|FDR:1933-{19}45:{H{arry} }{S }Truman
-{H{arry} }{S }Truman:1945-{19}53:{D{wight} }{D{avid} }Eisenhower
-{D{wight} }{D{avid} }Eisenhower:1953-{19}61:{J{ohn} }{F{itzgerald} }Kennedy|JFK
-{J{ohn} }{F{itzgerald} }Kennedy|JFK:1961-{{19}6}3:{L{yndon} }{B{aines} }Johnson|LBJ
-{L{yndon} }{B{aines} }Johnson|LBJ:1963-{{19}6}9:{R{ichard} }{M{ilhouse} }Nixon
-{R{ichard} }{M{ilhouse} }Nixon:1969-{19}74:{G{erald} }{R{obert} }Ford
-{G{erald} }{R{obert} }Ford:1974-:
diff --git a/games/quiz/datfiles/province b/games/quiz/datfiles/province
deleted file mode 100644
index d8b53f6..0000000
--- a/games/quiz/datfiles/province
+++ /dev/null
@@ -1,14 +0,0 @@
-Newfoundland{ and Labrador}:[St.|Saint] John's
-New Brunswick:Fredericton
-Prince Edward Island:Charlottetown
-Nova Scotia:Halifax
-Quebec:Quebec{ City}
-Ontario:Toronto
-Manitoba:Winnipeg
-Saskatchewan:Regina
-Alberta:Edmonton
-British Columbia:Victoria
-Yukon Territory:Whitehorse
-Northwest Territories:Yellowknife
-Nunavut:Iqaluit
-Canada:Ottawa
diff --git a/games/quiz/datfiles/seq-easy b/games/quiz/datfiles/seq-easy
deleted file mode 100644
index e88cefa..0000000
--- a/games/quiz/datfiles/seq-easy
+++ /dev/null
@@ -1,14 +0,0 @@
-1,2,3,4,5,6:7{(integers)}:integers|[natural|counting] numbers
-1,2,3,5,8,13:21{(Fibonacci)}:Fibonacci{ seq{ence}| numbers}
-1,2,4,8,16,32:64{(powers of 2)}:powers of 2|2[**|^]n
-1,2,6,24,120,720:5040{(factorials)}:factorials|n!
-1,3,5,7,9,11:13{(odd nos.)}:odd [integ|numb]ers
-1,3,6,10,15,21:28{(triangular)}:triangular{ numbers}|C(n,2)
-1,3,9,27,81:243{(powers of 3)}:powers of 3|3[**|^]n
-1,4,9,16,25:36{(squares)}:squares|n[**|^]2
-1,4,16,64:256{(powers of 4)}:powers of 4|4[**|^]n
-1,5,25,125:625{(powers of 5)}:powers of 5|5[**|^]n
-1,8,27,64,125:216{(cubes)}:cubes|n[**|^]3
-2,3,5,7,11,13:17{(primes)}:prime[ number]s
-2,4,6,8,10,12:14{(even nos.)}:even [integ|numb]ers|multiples of 2|2n
-3,6,9,12,15:18{(3n)}:multiples of 3|3n
diff --git a/games/quiz/datfiles/seq-hard b/games/quiz/datfiles/seq-hard
deleted file mode 100644
index 9d9373f..0000000
--- a/games/quiz/datfiles/seq-hard
+++ /dev/null
@@ -1,15 +0,0 @@
-1,1,2,1,2,2,3,1,2,2,3,2,3,3,4:1{(1's in binary nos)}:number of 1's in binary numbers
-1,1,2,2,4,2,6,4,6,4,10:4{(phi(n))}:Euler's [totient|phi]{ function}|phi(n)
-1,2,2,4,2,4,2,4,6,2:6{(diff of primes)}:diff{erences} [between|of] primes
-1,2,4,11,34:156{(unlabeled graphs)}:{unlabeled }graphs
-1,2,5,14,42,132:429{(Catalan)}:Catalan{ numbers}
-1,2,5,16,61:272{(Euler)}:Euler{ numbers}
-1,3,12,60,360:2520{(n!/2)}:Even permutations|n!/2
-1,3,16,125,1296,16807:262144{(n**(n-2))}:{labeled }trees|n[**|^](n-2)
-1,4,10,20,35,56:84{(C(n,3))}:Tetrahedral{ numbers}|C(n,3)
-1,4,11,20,31,44,61:100{(n**2 base 8)}:[Squares|n[**|^]2} base 8|octal squares
-1,4,16,256:65536{(2**2**n)}:{labeled }boolean functions|2[**|^]2[**|^]n
-1,6,28:496{(perfect nos)}:perfect{ numbers}
-2,7,1,8,2,8:1{(e)}:{digits of }e
-3,1,4,1,5,9:2{(pi)}:{digits of }pi
-3,7,31,127:8191{(Mersenne primes)}:Mersenne{ primes}
diff --git a/games/quiz/datfiles/sexes b/games/quiz/datfiles/sexes
deleted file mode 100644
index 78c583a..0000000
--- a/games/quiz/datfiles/sexes
+++ /dev/null
@@ -1,26 +0,0 @@
-Y|y:X|x
-abbot:abbess
-alumnus:alumna
-ambassador:ambassadress
-boar:sow
-buck:doe
-bull:cow
-cob:pen
-colt:filly
-curator:curatrix
-dog:bitch|vixen
-duke:duchess
-drake:duck
-effeminate|womanish:mannish
-gander:goose
-gentleman:lady|gentlewoman
-jack:jenny
-lad:lass
-manly:womanly
-marquis:marchioness[|e]|marquise
-monk:nun
-[O|o]edipus complex:[E|e]lectra[| complex]
-prince:princess
-ram:ewe
-rooster|cock:hen
-stallion:mare
diff --git a/games/quiz/datfiles/sov b/games/quiz/datfiles/sov
deleted file mode 100644
index c02d417..0000000
--- a/games/quiz/datfiles/sov
+++ /dev/null
@@ -1,42 +0,0 @@
-W[illia|]m [I|1|the Conqueror]:11:W[illia|]m [II|2|Rufus|the Red]
-W[illia|]m [II|2|Rufus|the Red]:11:Hen[ry|] [I|1]
-Hen[ry|] [I|1]:12:Stephen
-Stephen:12:Hen[ry|] [II|2]
-Hen[ry|] [II|2]:12:Rich[ard|] [I|1]
-Rich[ard|] [I|1]:12:John
-John:13|12-13:Hen[ry|] [III|3]
-Hen[ry|] [III|3]:13:Ed[w[ard|]|] [I|1]
-Ed[w[ard|]|] [I|1]:13-14|13|14:Ed[w[ard|]|] [II|2]
-Ed[w[ard|]|] [II|2]:14:Ed[w[ard|]|] [III|3]
-Ed[w[ard|]|] [III|3]:14:Rich[ard|] [II|2]
-Rich[ard|] [II|2]:14:Hen[ry|] [IV|4] Part 1
-Hen[ry|] [IV|4] Part 1:15|14-15:Hen[ry|] [IV|4] Part 2
-Hen[ry|] [IV|4] Part 2:15|14-15:Hen[ry|] [V|5]
-Hen[ry|] [V|5]:15:Hen[ry|] [VI|6]
-Hen[ry|] [VI|6]:15:Ed[w[ard|]|] [IV|4]
-Ed[w[ard|]|] [IV|4]:15:Ed[w[ard|]|] [V|5]
-Ed[w[ard|]|] [V|5]:15:Rich[ard|] [III|3]
-Rich[ard|] [III|3]:15:Hen[ry|] [VII|7]
-Hen[ry|] [VII|7]:15-16|15|16:Hen[ry|] [VIII|8]
-Hen[ry|] [VIII|8]:16:Ed[w[ard|]|] [VI|6]
-Ed[w[ard|]|] [VI|6]:16:Mary
-Mary:16:Eliz[abeth|][ [I|1]|]
-Elizabeth[ [I|1]|]:16-17|16:Ja[me|]s [I|1]
-Ja[me|]s [I|1]:17:Cha[rle|]s [I|1]
-Cha[rle|]s [I|1]:17:[Oliver |]Cromwell
-[Oliver |]Cromwell:17:Rich[ard|] Cromwell
-Rich[ard|] Cromwell:17:Ch[arle|]s [II|2]
-Cha[rle|]s [II|2]:17:Ja[me|]s [II|2]
-Ja[me|]s [II|2]:17:W[illia|]m and Mary
-W[illia|]m and Mary:17-18|17:Anne
-Anne:18:Geo[rge|] [I|1]
-Geo[rge|] [I|1]:18:Geo[rge|] [II|2]
-Geo[rge|] [II|2]:18:Geo[rge|] [III|3]
-Geo[rge|] [III|3]:18-19|18|19:Geo[rge|] [IV|4]
-Geo[rge|] [IV|4]:19:W[illia|]m [IV|4]
-W[illia|]m [IV|4]:19:Victoria
-Victoria:19:Ed[w[ard|]|] [VII|7]
-Ed[w[ard|]|] [VII|7]:19-20|19|20:Geo[rge|] [V|5]
-Geo[rge|] [V|5]:20:Ed[w[ard|]|] [VIII|8]
-Ed[w[ard|]|] [VIII|8]:20:Geo[rge|] [VI|6]
-Geo[rge|] [VI|6]:20:Eliz[abeth|] [II|2]
diff --git a/games/quiz/datfiles/spell b/games/quiz/datfiles/spell
deleted file mode 100644
index 75ce1e8..0000000
--- a/games/quiz/datfiles/spell
+++ /dev/null
@@ -1,2 +0,0 @@
-The son went behind a cloud.:sun
-Did you see the monky at the zoo?:monkey
diff --git a/games/quiz/datfiles/state b/games/quiz/datfiles/state
deleted file mode 100644
index 0c11487..0000000
--- a/games/quiz/datfiles/state
+++ /dev/null
@@ -1,50 +0,0 @@
-Alabama|Ala|AL:Montgomery:AL:goldenrod
-Alaska|AK:Juneau:AK:forget{-| }me{-| }not
-Arizona|Ariz|AZ:Phoenix:AZ:{saguaro }cactus
-Arkansas|Ark|AR:Little Rock:AR:gok
-Cal{if{ornia}}|CA:Sacramento:CA:{golden }poppy
-Col{o{rado}}|CO:Denver:CO:columbine
-Conn{ecticut}|CT:Hartford:CT:{mountain }laurel
-Del{aware}|DE:Dover:DE:peach{ blossom}
-Fl{orid}a|FL:Tallahassee:FL:orange{ blossom}
-Georgia|Ga:Atlanta:GA:{Cherokee }rose
-Hawaii|HI:Honolulu:HI:hibiscus
-Idaho|Ida|ID:Boise:ID:syringa
-Ill{inois}|IL:Springfield:IL:violet
-Ind{iana}|IN:Indianapolis:IN:zinnia
-Iowa|Ia:Des Moines:IA:{wild }rose
-Kans{as}|Kan|KS:Topeka:KS:sun{ }flower
-Kentucky|Ky:Frankfort:KY:goldenrod
-Louisiana|La:Baton Rouge:LA:magnolia
-Maine|Me:Augusta:ME:pinecone{ and}{ tassel}
-Maryland|Md:Annapolis:MD:blackeyed susan
-Mass{achusetts}|MA:Boston:MA:{trailing }arbutus
-Mich{igan}|MI:Lansing:MI:apple{ blossom}
-Minn{esota}|MN:Saint Paul|St Paul:MN:gok
-Miss{issippi}|MS:Jackson:MS:magnolia
-Missouri|Mo:Jefferson City:MO:hawthorn
-Mont{ana}|MT:Helena:MT:bitterroot
-Nebraska|Neb|NE|NB:Lincoln:NE|NB:goldenrod
-Nevada|Nev|NV:Carson City:NV:sagebrush
-New Hampshire|NH:Concord:NH:{purple }lilac
-New Jersey|NJ:Trenton:NJ:violet
-New Mexico|NM:Santa Fe:NM:yucca
-New York|NY:Albany:NY:{wild }rose
-N{orth} Carolina|NC:Raleigh:NC:dogwood
-N{orth} Dakota|ND:Bismarck:ND:{wild }{prarie }rose
-Ohio|O|OH:Columbus:OH:{scarlet }carnation
-Oklahoma|Okla|OK:Oklahoma City:OK:mistletoe
-Oregon|Ore|OR:Salem:OR:{Oregon }grape
-Pennsylvania|Pa:Harrisburg:PA:{mountain }laurel
-Rhode Island|RI:Providence:RI:violet
-S{outh} Carolina|SC:Columbia:SC:{yellow }jasmine
-S{outh} Dakota|SD:Pierre:SD:pasque{ flower}
-Tenn{essee}|TN:Nashville:TN:iris
-Texas|Tex|TX:Austin:TX:blue{-| }bonnet
-Utah|UT:Salt Lake City:UT:{sego }lilly
-Vermont|Vt:Montpelier:VT:{red }clover
-Virginia|Va:Richmond:VA:dogwood
-Wash{ington}|WA:Olympia:WA:rhododendron
-W{est} Virginia|W{ }Va|WV:Charleston:WV:rhododendron
-Wisconsin|Wis|WI:Madison:WI:violet
-Wyo{ming}|WY:Cheyenne:WY:indian paint brush
diff --git a/games/quiz/datfiles/trek b/games/quiz/datfiles/trek
deleted file mode 100644
index 11740b8..0000000
--- a/games/quiz/datfiles/trek
+++ /dev/null
@@ -1,19 +0,0 @@
-captain's name:{James |Jim }{T. }Kirk|{james |jim }{t. }kirk
-first officers name:Spock|spock|Mr. Spock|mr. spock
-name of ship:{the }{u.s.s. }enterprise|Enterprise
-name of the "good guys":{the }Federation|federation|{the }federation
-name of the "bad guys":{the }klingons|{the }romulans
-nickname of chief engineer:scotty|Scotty
-nickname of chief medical officer:bones|Bones
-machine used for transportation to surface of nearby planet:transporter|shuttlecraft
-main engines of ship:warp engines|warp
-number of crew:400|four hundred
-hand-held weapon:phaser
-type of torpedoes used on the ship:photon torpedoes|photon
-name of electronic protective device on ship:shields|shield
-name of device that makes a ship invisible:cloaking device|cloak|cloaking
-type of voice that the on-board computer has:female|feminine|woman's
-where first officer comes from:vulcan|Vulcan
-rare, but very powerful enemies:romulans|Romulans
-reaction that main engines operate on:matter-antimatter{ reaction}|matter/antimatter{ reaction}
-slow engines used in emergencies:impulse engines|impulse
diff --git a/games/quiz/datfiles/ucc b/games/quiz/datfiles/ucc
deleted file mode 100644
index d852b95..0000000
--- a/games/quiz/datfiles/ucc
+++ /dev/null
@@ -1,127 +0,0 @@
-1-103:supplementary general principles of law applicable
-1-106:remedies to be liberally administered
-1-201:general definitions
-1-203:obligation of good faith
-1-205:course of dealing and usage of trade
-1-206:statue of frauds for kinds of personal property not otherwise covered
-2-103:definitions-sales
-2-201:statute of frauds
-2-208:course of performance or practical consideration
-2-302:unconscionable contract or clause
-2-310:open time for payment or running of credit
-2-319:FOB and FAS terms
-2-320:CIF and C&F terms
-2-323:form of bill of lading required in overseas shipment
-2-401:passing of title; reservation for security
-2-402:rights of seller's creditors against sold goods
-2-403:powr to transfer; good faith purchase of goods; entrusting
-2-501:insurable interest in goods; manner of identification of goods
-2-502:buyer's right to goods on seller's insolvency
-2-503:manner of seller's tender of delivery
-2-506:rights of financing agency
-2-507:effect of seller's tender; delivery on condition
-2-508:cure by seller of improper tender or delivery; replacement
-2-509:risk of loss in the absence ogf breach
-2-510:effect of breach on risk of loss
-2-513:buyer's right to inspection of goods
-2-601:buyer's rights on improper delivery
-2-602:manner and effect of rightful rejection
-2-603:merchant buyer's duties as to rightfully rejected goods
-2-605:waiver of buyer's objections by failure to particularize
-2-606:what constitutes acceptance of goods
-2-607:effect of acceptance; notice of breach
-2-608:revocation of acceptance in whole or in part
-2-609:right to adequate assurance of performance
-2-610:anticipatory repudiation
-2-611:retraction of anticipatory repudiation
-2-612:installment contract; breach
-2-702:seller's remedies on discovery o buyer's insolvency
-2-703:seller's remedies in general
-2-705:seller's stoppage of delivery in transit or otherwise
-2-706:seller's resale including contract for resale
-2-708:seller's damages for non-acceptance or repudiation
-2-709:action for the price
-2-711:buyer's remedies in general; buyer's security interest in rejected goods
-2-712:cover; buyer's procurement of substitute goods
-2-713:buyer's damages for on-delivery or repudiation
-2-714:buyer's damages for breach in regard to accepted goods
-2-715:buyer's incidental and consequential damages
-2-716:buyer's right to specific performance or replevin
-3-102:definitions-commercial paper
-3-104:form of negotiable instruments; draft; check; certificate of deposit; note
-3-110:payable to order
-3-111:payable to bearer
-3-201:transfer: right to indorsement
-3-202:negotiation
-3-204:special indorsement; blank indorsement
-3-301:rights of a holder
-3-302:holder in due course
-3-305:rights of a holder in due course
-3-306:rights of one not holder in due course
-3-401:signature
-3-404:unauthorized signature
-3-405:impostors; signature in name of payee
-3-406:negligence contributing to alteration or unauthorized signature
-3-407:alteration
-3-410:definition and operation of acceptance
-3-411:certification of a check
-3-413:contract of maker, drawer and acceptor
-3-414:contract of indorser; order of liability
-3-417:warranties on presentment and transfer
-3-418:finality of payment or acceptance
-3-419:conversion of instrument; innocent representative
-3-501:when presentment, notice of dishonor, and protest necessary or permissible
-3-502:unexcused delay; discharge
-3-503:time or presentment
-3-507:dishonor; holder's right of recourse; term allowing representment
-3-508:notice of dishonor
-3-511:waived or excused presentment, protest or notice of dishonor or delay therein
-3-601:discharge of parties
-3-802:effect of instrument on obligation for which it is given
-3-804:lost,destroyed or stolen instruments
-4-104:definitions-bank deposits and collections
-4-105:banks-depositary, intermediary, collecting, payor, presenting, remitting
-4-207:warranties of customer and collecting bank on transfer or presentment of items
-4-208:security interest of collecting bank in items, accompanying documents and proceeds
-4-209:when bank gives value for purposes of holder in due course
-4-211:media of remittance; provision and final settlement in remittance cases
-4-213:final payment of item by payor bank
-4-401:when bank may charge customer's account
-4-406:customer's duty to discover and report unauthorized signature or alteration
-4-402:bank liability to customer for wrongful dishonor
-4-407:payor bank's right to subrogation on improper payment
-5-111:warranties on transfer and presentment (letters of credit)
-5-114:issuer's duty and privilege to honor; right to reimbursement
-5-115:remedy for improper dishonor or anticipatory repudiaion (letters of credit)
-7-104:negotiable and non-negotiable warehouse receipt, bill of lading, other title
-7-204:duty of care; contractual limitation of warehouseperson's liability
-7-301:liability for non-receipt or misdescription
-7-403:obligation of warehouseperson or carrier to deliver; excuse
-7-404:no liability for good faith delivery pursuant to receipt or bill
-7-501:form of negotiation and requirements of due negotiation
-7-502:rights acquired by due negotiation
-7-503:document of title to goods defeated in certain cases
-7-504:rights acquired in absence of due negotiation; effect of diversion
-7-507:warranties on negotiation or transfer of receipt or bill
-7-508:warranties of collecting bank as to documents
-9-105:definitions-secured transactions
-9-107:definitions "purchase money security interest"
-9-109:classification of goods; consumer goods; equipment; farm products; inventory
-9-113:security interests arising under article on sales
-9-203:attachment and enforceability of security interest; proceeds; formal requisites
-9-206:agreement not to asserr defenses against assignee; modification of sales warranties
-9-301:persons who take priority over unperfected security interests
-9-302:when filing is required to perfect security interest
-9-303:when security interest is perfected
-9-304:perfection of security interest in instruments, documents
-9-305:when possession by secured party perfects security interest without filing
-9-306:proceeds; secured party's rights on disposition of collateral
-9-307:protection of buyers of goods
-9-310:periority of certain liens arising by opration of law (mechanic's liens)
-9-311:alienability of debtor's rights; judicial process
-9-312:priorities among conflicting security interests in the same collateral
-9-405:assignment of security interest
-9-501:default; procedure when security agreement covers real and personal property
-9-503:secured party's right to take possession after default
-9-504:secured party's right to dispose of collateral after default
-9-505:compulsory disposition of collateral; acceptance of collateral as discharge of obligation
diff --git a/games/quiz/pathnames.h b/games/quiz/pathnames.h
deleted file mode 100644
index 08f4a6b..0000000
--- a/games/quiz/pathnames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_PAGER "/usr/bin/more"
-#define _PATH_QUIZIDX "/usr/share/games/quiz.db/index"
diff --git a/games/quiz/quiz.6 b/games/quiz/quiz.6
deleted file mode 100644
index d8706db..0000000
--- a/games/quiz/quiz.6
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Jim R. Oldroyd at The Instruction Set.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)quiz.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt QUIZ 6
-.Os
-.Sh NAME
-.Nm quiz
-.Nd random knowledge tests
-.Sh SYNOPSIS
-.Nm
-.Op Fl t
-.Op Fl i Ar file
-.Op Ar question answer
-.Sh DESCRIPTION
-The
-.Nm
-utility tests your knowledge of random facts.
-It has a database of subjects from which you can choose.
-With no arguments,
-.Nm
-displays the list of available subjects.
-.Pp
-The options are as follows:
-.Bl -tag -width indent
-.It Fl t
-Use tutorial mode, in which questions are repeated later if you didn't get
-them right the first time, and new questions are presented less frequently
-to help you learn the older ones.
-.It Fl i
-Specify an alternate index file.
-.El
-.Pp
-Subjects are divided into categories.
-You can pick any two categories from the same subject.
-.Nm Quiz
-will ask questions from the first category and it expects answers from
-the second category.
-For example, the command ``quiz victim killer'' asks questions which are
-the names of victims, and expects you to answer with the cause of their
-untimely demise, whereas the command ``quiz killer victim'' works the
-other way around.
-.Pp
-If you get the answer wrong,
-.Nm
-lets you try again.
-To see the right answer, enter a blank line.
-.Sh "Index and Data File Syntax"
-The index and data files have a similar syntax.
-Lines in them consist of several categories separated by colons.
-The categories are regular expressions formed using the following
-meta-characters:
-.Pp
-.Bl -tag -width "pat|pat" -compact -offset indent
-.It pat|pat
-alternate patterns
-.It {pat}
-optional pattern
-.It [pat]
-delimiters, as in pat[pat|pat]pat
-.El
-.Pp
-In an index file, each line represents a subject.
-The first category in each subject is the pathname of the data file for
-the subject.
-The remaining categories are regular expressions for the titles of each
-category in the subject.
-.Pp
-In data files, each line represents a question/answer set.
-Each category is the information for the question/answer for that category.
-.Pp
-The backslash character (``\e'') is used to quote syntactically significant
-characters, or at the end of a line to signify that a continuation line
-follows.
-.Pp
-If either a question or its answer is empty,
-.Nm
-will refrain from asking it.
-.Sh FILES
-.Bl -tag -width /usr/share/games/quiz.db -compact
-.It Pa /usr/share/games/quiz.db
-The default index and data files.
-.El
-.Sh BUGS
-.Nm Quiz
-is pretty cynical about certain subjects.
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c
deleted file mode 100644
index 450fd59..0000000
--- a/games/quiz/quiz.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at
- * Commodore Business Machines.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "quiz.h"
-#include "pathnames.h"
-
-static QE qlist;
-static int catone, cattwo, tflag;
-static u_int qsize;
-
-char *appdstr(char *, char *, size_t);
-void downcase(char *);
-void err(const char *, ...) __printflike(1, 2);
-void get_cats(char *, char *);
-void get_file(const char *);
-int main(int, char *[]);
-char *next_cat(char *);
-void quiz(void);
-void score(u_int, u_int, u_int);
-void show_index(void);
-void usage(void);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int ch;
- const char *indexfile;
-
- /* revoke */
- setgid(getgid());
-
- indexfile = _PATH_QUIZIDX;
- while ((ch = getopt(argc, argv, "i:t")) != -1)
- switch(ch) {
- case 'i':
- indexfile = optarg;
- break;
- case 't':
- tflag = 1;
- break;
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- switch(argc) {
- case 0:
- get_file(indexfile);
- show_index();
- break;
- case 2:
- get_file(indexfile);
- get_cats(argv[0], argv[1]);
- quiz();
- break;
- default:
- usage();
- }
- exit(0);
-}
-
-void
-get_file(file)
- const char *file;
-{
- FILE *fp;
- QE *qp;
- size_t len;
- char *lp;
-
- if ((fp = fopen(file, "r")) == NULL)
- err("%s: %s", file, strerror(errno));
-
- /*
- * XXX
- * Should really free up space from any earlier read list
- * but there are no reverse pointers to do so with.
- */
- qp = &qlist;
- qsize = 0;
- while ((lp = fgetln(fp, &len)) != NULL) {
- if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\')
- qp->q_text = appdstr(qp->q_text, lp, len);
- else {
- if ((qp->q_next = malloc(sizeof(QE))) == NULL)
- err("%s", strerror(errno));
- qp = qp->q_next;
- lp[len - 1] = '\0';
- if ((qp->q_text = strdup(lp)) == NULL)
- err("%s", strerror(errno));
- qp->q_asked = qp->q_answered = FALSE;
- qp->q_next = NULL;
- ++qsize;
- }
- }
- (void)fclose(fp);
-}
-
-void
-show_index()
-{
- QE *qp;
- char *p, *s;
- FILE *pf;
-
- if ((pf = popen(_PATH_PAGER, "w")) == NULL)
- err("%s: %s", _PATH_PAGER, strerror(errno));
- (void)fprintf(pf, "Subjects:\n\n");
- for (qp = qlist.q_next; qp; qp = qp->q_next) {
- for (s = next_cat(qp->q_text); s; s = next_cat(s)) {
- if (!rxp_compile(s))
- err("%s", rxperr);
- if ((p = rxp_expand()) != '\0')
- (void)fprintf(pf, "%s ", p);
- }
- (void)fprintf(pf, "\n");
- }
- (void)fprintf(pf, "\n%s\n%s\n%s\n",
-"For example, \"quiz victim killer\" prints a victim's name and you reply",
-"with the killer, and \"quiz killer victim\" works the other way around.",
-"Type an empty line to get the correct answer.");
- (void)pclose(pf);
-}
-
-void
-get_cats(cat1, cat2)
- char *cat1, *cat2;
-{
- QE *qp;
- int i;
- char *s;
-
- downcase(cat1);
- downcase(cat2);
- for (qp = qlist.q_next; qp; qp = qp->q_next) {
- s = next_cat(qp->q_text);
- catone = cattwo = i = 0;
- while (s) {
- if (!rxp_compile(s))
- err("%s", rxperr);
- i++;
- if (rxp_match(cat1))
- catone = i;
- if (rxp_match(cat2))
- cattwo = i;
- s = next_cat(s);
- }
- if (catone && cattwo && catone != cattwo) {
- if (!rxp_compile(qp->q_text))
- err("%s", rxperr);
- get_file(rxp_expand());
- return;
- }
- }
- err("invalid categories");
-}
-
-void
-quiz()
-{
- QE *qp;
- int i;
- size_t len;
- u_int guesses, rights, wrongs;
- int next;
- char *answer, *s, *t, question[LINE_SZ];
-
- srandomdev();
- guesses = rights = wrongs = 0;
- for (;;) {
- if (qsize == 0)
- break;
- next = random() % qsize;
- qp = qlist.q_next;
- for (i = 0; i < next; i++)
- qp = qp->q_next;
- while (qp && qp->q_answered)
- qp = qp->q_next;
- if (!qp) {
- qsize = next;
- continue;
- }
- if (tflag && random() % 100 > 20) {
- /* repeat questions in tutorial mode */
- while (qp && (!qp->q_asked || qp->q_answered))
- qp = qp->q_next;
- if (!qp)
- continue;
- }
- s = qp->q_text;
- for (i = 0; i < catone - 1; i++)
- s = next_cat(s);
- if (!rxp_compile(s))
- err("%s", rxperr);
- t = rxp_expand();
- if (!t || *t == '\0') {
- qp->q_answered = TRUE;
- continue;
- }
- (void)strcpy(question, t);
- s = qp->q_text;
- for (i = 0; i < cattwo - 1; i++)
- s = next_cat(s);
- if (!rxp_compile(s))
- err("%s", rxperr);
- t = rxp_expand();
- if (!t || *t == '\0') {
- qp->q_answered = TRUE;
- continue;
- }
- qp->q_asked = TRUE;
- (void)printf("%s?\n", question);
- for (;; ++guesses) {
- if ((answer = fgetln(stdin, &len)) == NULL) {
- score(rights, wrongs, guesses);
- exit(0);
- }
- answer[len - 1] = '\0';
- downcase(answer);
- if (rxp_match(answer)) {
- (void)printf("Right!\n");
- ++rights;
- qp->q_answered = TRUE;
- break;
- }
- if (*answer == '\0') {
- (void)printf("%s\n", t);
- ++wrongs;
- if (!tflag)
- qp->q_answered = TRUE;
- break;
- }
- (void)printf("What?\n");
- }
- }
- score(rights, wrongs, guesses);
-}
-
-char *
-next_cat(s)
- char * s;
-{
- for (;;)
- switch (*s++) {
- case '\0':
- return (NULL);
- case '\\':
- s++;
- break;
- case ':':
- return (s);
- }
- /* NOTREACHED */
-}
-
-char *
-appdstr(s, tp, len)
- char *s;
- char *tp;
- size_t len;
-{
- char *mp, *sp;
- char *m;
-
- if ((m = malloc(strlen(s) + len + 1)) == NULL)
- err("%s", strerror(errno));
- mp = m;
- sp = s;
- for (; (*mp++ = *sp++););
- mp--;
-
- if (*(mp - 1) == '\\')
- --mp;
- memcpy(mp, tp, len);
- mp[len] = '\0';
- if (mp[len - 1] == '\n')
- mp[len - 1] = '\0';
-
- free(s);
- return (m);
-}
-
-void
-score(r, w, g)
- u_int r, w, g;
-{
- (void)printf("Rights %d, wrongs %d,", r, w);
- if (g)
- (void)printf(" extra guesses %d,", g);
- (void)printf(" score %d%%\n", (r + w + g) ? r * 100 / (r + w + g) : 0);
-}
-
-void
-downcase(p)
- char *p;
-{
- int ch;
-
- for (; (ch = *p); ++p)
- if (isascii(ch) && isupper(ch))
- *p = tolower(ch);
-}
-
-void
-usage()
-{
- (void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n");
- exit(1);
-}
-
-void
-err(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- (void)fprintf(stderr, "quiz: ");
- (void)vfprintf(stderr, fmt, ap);
- va_end(ap);
- (void)fprintf(stderr, "\n");
- exit(1);
-}
diff --git a/games/quiz/quiz.h b/games/quiz/quiz.h
deleted file mode 100644
index dd8a18a..0000000
--- a/games/quiz/quiz.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at
- * Commodore Business Machines.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)quiz.h 8.1 (Berkeley) 5/31/93
- */
-
-#include <sys/cdefs.h>
-
-__FBSDID("$FreeBSD$");
-
-#define TRUE 1
-#define FALSE 0
-
-/* Length of compiled regexp machine; increase if not big enough. */
-#define RXP_LINE_SZ 8192
-
-/* Maximum line length for data files. */
-#define LINE_SZ 1024
-
-/* Linked list for holding index and data file information. */
-typedef struct qentry {
- struct qentry *q_next; /* next one */
- char *q_text; /* category text string from file */
- int q_asked; /* TRUE if question's been asked */
- int q_answered; /* TRUE if question's been answered */
-} QE;
-
-extern char rxperr[];
-
-int rxp_compile(char *);
-char *rxp_expand(void);
-int rxp_match(char *);
diff --git a/games/quiz/rxp.c b/games/quiz/rxp.c
deleted file mode 100644
index a3e37ce..0000000
--- a/games/quiz/rxp.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at
- * Commodore Business Machines.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * regular expression parser
- *
- * external functions and return values are:
- * rxp_compile(s)
- * TRUE success
- * FALSE parse failure; error message will be in char rxperr[]
- * metas are:
- * {...} optional pattern, equialent to [...|]
- * | alternate pattern
- * [...] pattern delimiters
- *
- * rxp_match(s)
- * TRUE string s matches compiled pattern
- * FALSE match failure or regexp error
- *
- * rxp_expand()
- * char * reverse-engineered regular expression string
- * NULL regexp error
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "quiz.h"
- /* regexp tokens, arg */
-#define LIT (-1) /* literal character, char */
-#define SOT (-2) /* start text anchor, - */
-#define EOT (-3) /* end text anchor, - */
-#define GRP_S (-4) /* start alternate grp, ptr_to_end */
-#define GRP_E (-5) /* end group, - */
-#define ALT_S (-6) /* alternate starts, ptr_to_next */
-#define ALT_E (-7) /* alternate ends, - */
-#define END (-8) /* end of regexp, - */
-
-typedef short Rxp_t; /* type for regexp tokens */
-
-static Rxp_t rxpbuf[RXP_LINE_SZ]; /* compiled regular expression buffer */
-char rxperr[128]; /* parser error message */
-
-static int rxp__compile(char *, int);
-static char *rxp__expand(int);
-static int rxp__match(char *, int, Rxp_t *, Rxp_t *, char *);
-
-int
-rxp_compile(s)
- char * s;
-{
- return (rxp__compile(s, TRUE));
-}
-
-static int
-rxp__compile(s, first)
- char *s;
- int first;
-{
- static Rxp_t *rp;
- static char *sp;
- Rxp_t *grp_ptr;
- Rxp_t *alt_ptr;
- int esc, err;
-
- esc = 0;
- if (first) {
- rp = rxpbuf;
- sp = s;
- *rp++ = SOT; /* auto-anchor: pat is really ^pat$ */
- *rp++ = GRP_S; /* auto-group: ^pat$ is really ^[pat]$ */
- *rp++ = 0;
- }
- *rp++ = ALT_S;
- alt_ptr = rp;
- *rp++ = 0;
- for (; *sp; ++sp) {
- if (rp - rxpbuf >= RXP_LINE_SZ - 4) {
- (void)snprintf(rxperr, sizeof(rxperr),
- "regular expression too long %s", s);
- return (FALSE);
- }
- if (*sp == ':' && !esc)
- break;
- if (esc) {
- *rp++ = LIT;
- *rp++ = *sp;
- esc = 0;
- }
- else switch (*sp) {
- case '\\':
- esc = 1;
- break;
- case '{':
- case '[':
- *rp++ = GRP_S;
- grp_ptr = rp;
- *rp++ = 0;
- sp++;
- if ((err = rxp__compile(s, FALSE)) != TRUE)
- return (err);
- *rp++ = GRP_E;
- *grp_ptr = rp - rxpbuf;
- break;
- case '}':
- case ']':
- case '|':
- *rp++ = ALT_E;
- *alt_ptr = rp - rxpbuf;
- if (*sp != ']') {
- *rp++ = ALT_S;
- alt_ptr = rp;
- *rp++ = 0;
- }
- if (*sp != '|') {
- if (*sp != ']') {
- *rp++ = ALT_E;
- *alt_ptr = rp - rxpbuf;
- }
- if (first) {
- (void)snprintf(rxperr, sizeof(rxperr),
- "unmatched alternator in regexp %s",
- s);
- return (FALSE);
- }
- return (TRUE);
- }
- break;
- default:
- *rp++ = LIT;
- *rp++ = *sp;
- esc = 0;
- break;
- }
- }
- if (!first) {
- (void)snprintf(rxperr, sizeof(rxperr),
- "unmatched alternator in regexp %s", s);
- return (FALSE);
- }
- *rp++ = ALT_E;
- *alt_ptr = rp - rxpbuf;
- *rp++ = GRP_E;
- *(rxpbuf + 2) = rp - rxpbuf;
- *rp++ = EOT;
- *rp = END;
- return (TRUE);
-}
-
-/*
- * match string against compiled regular expression
- */
-int
-rxp_match(s)
- char * s;
-{
- return (rxp__match(s, TRUE, NULL, NULL, NULL));
-}
-
-static int
-rxp__match(s, first, j_succ, j_fail, sp_fail)
- char *s;
- int first;
- Rxp_t *j_succ; /* jump here on successful alt match */
- Rxp_t *j_fail; /* jump here on failed match */
- char *sp_fail; /* reset sp to here on failed match */
-{
- static Rxp_t *rp;
- static char *sp;
- int ch;
- Rxp_t *grp_end;
- int err;
-
- grp_end = NULL;
- if (first) {
- rp = rxpbuf;
- sp = s;
- }
- while (rp < rxpbuf + RXP_LINE_SZ && *rp != END)
- switch(*rp) {
- case LIT:
- rp++;
- ch = isascii(*rp) && isupper(*rp) ? tolower(*rp) : *rp;
- if (ch != *sp++) {
- rp = j_fail;
- sp = sp_fail;
- return (TRUE);
- }
- rp++;
- break;
- case SOT:
- if (sp != s)
- return (FALSE);
- rp++;
- break;
- case EOT:
- if (*sp != 0)
- return (FALSE);
- rp++;
- break;
- case GRP_S:
- rp++;
- grp_end = rxpbuf + *rp++;
- break;
- case ALT_S:
- rp++;
- if ((err = rxp__match(sp,
- FALSE, grp_end, rxpbuf + *rp++, sp)) != TRUE)
- return (err);
- break;
- case ALT_E:
- rp = j_succ;
- return (TRUE);
- case GRP_E:
- default:
- return (FALSE);
- }
- return (*rp != END ? FALSE : TRUE);
-}
-
-/*
- * Reverse engineer the regular expression, by picking first of all alternates.
- */
-char *
-rxp_expand()
-{
- return (rxp__expand(TRUE));
-}
-
-static char *
-rxp__expand(first)
- int first;
-{
- static char buf[RXP_LINE_SZ/2];
- static Rxp_t *rp;
- static char *bp;
- Rxp_t *grp_ptr;
- char *err;
-
- if (first) {
- rp = rxpbuf;
- bp = buf;
- }
- while (rp < rxpbuf + RXP_LINE_SZ && *rp != END)
- switch(*rp) {
- case LIT:
- rp++;
- *bp++ = *rp++;
- break;
- case GRP_S:
- rp++;
- grp_ptr = rxpbuf + *rp;
- rp++;
- if ((err = rxp__expand(FALSE)) == NULL)
- return (err);
- rp = grp_ptr;
- break;
- case ALT_E:
- return (buf);
- case ALT_S:
- rp++;
- /* FALLTHROUGH */
- case SOT:
- case EOT:
- case GRP_E:
- rp++;
- break;
- default:
- return (NULL);
- }
- if (first) {
- if (*rp != END)
- return (NULL);
- *bp = '\0';
- }
- return (buf);
-}
diff --git a/games/rain/Makefile b/games/rain/Makefile
deleted file mode 100644
index 6f2097f..0000000
--- a/games/rain/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= rain
-MAN= rain.6
-DPADD= ${LIBCURSES}
-LDADD= -lcurses
-
-.include <bsd.prog.mk>
diff --git a/games/rain/rain.6 b/games/rain/rain.6
deleted file mode 100644
index 1fcc7e9..0000000
--- a/games/rain/rain.6
+++ /dev/null
@@ -1,57 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)rain.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt RAIN 6
-.Os
-.Sh NAME
-.Nm rain
-.Nd animated raindrops display
-.Sh SYNOPSIS
-.Nm
-.Op Fl d Ar delay
-.Sh DESCRIPTION
-The output of
-.Nm
-is modeled after the
-.Tn VAX/VMS
-program of the same name.
-To obtain the proper effect, either the terminal must be set for 9600
-baud or the
-.Fl d
-option must be used to specify a delay, in milliseconds, between each
-update.
-A reasonable delay is 120; the default is 0.
-.Sh AUTHORS
-.An Eric P. Scott
diff --git a/games/rain/rain.c b/games/rain/rain.c
deleted file mode 100644
index 5f762b3..0000000
--- a/games/rain/rain.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)rain.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * rain 11/3/1980 EPS/CITHEP
- * cc rain.c -o rain -O -ltermlib
- */
-
-#include <sys/types.h>
-#include <curses.h>
-#include <err.h>
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-volatile sig_atomic_t sig_caught = 0;
-
-static void onsig(int sig);
-
-int
-main(int argc, char **argv)
-{
- int x, y, j;
- long cols, lines;
- int xpos[5], ypos[5];
- unsigned int delay = 0;
- int ch;
-
- while ((ch = getopt(argc, argv, "d:h")) != -1)
- switch (ch) {
- case 'd':
- if ((delay = (unsigned int)strtoul(optarg, (char **)NULL, 10)) < 1
- || delay > 1000)
- errx(1, "invalid delay (1-1000)");
- delay *= 1000; /* ms -> us */
- break;
- case 'h':
- default:
- (void)fprintf(stderr, "usage: rain [-d delay]\n");
- exit(1);
- }
- srandomdev();
-
- initscr();
- cols = COLS - 4;
- lines = LINES - 4;
-
- (void)signal(SIGHUP, onsig);
- (void)signal(SIGINT, onsig);
- (void)signal(SIGQUIT, onsig);
- (void)signal(SIGSTOP, onsig);
- (void)signal(SIGTSTP, onsig);
- (void)signal(SIGTERM, onsig);
-
- for (j = 4; j >= 0; --j) {
- xpos[j] = random() % cols + 2;
- ypos[j] = random() % lines + 2;
- }
- for (j = 0;;) {
- if (sig_caught) {
- endwin();
- exit(0);
- }
- x = random() % cols + 2;
- y = random() % lines + 2;
- mvaddch(y, x, '.');
- mvaddch(ypos[j], xpos[j], 'o');
- if (!j--)
- j = 4;
- mvaddch(ypos[j], xpos[j], 'O');
- if (!j--)
- j = 4;
- mvaddch(ypos[j] - 1, xpos[j], '-');
- mvaddstr(ypos[j], xpos[j] - 1, "|.|");
- mvaddch(ypos[j] + 1, xpos[j], '-');
- if (!j--)
- j = 4;
- mvaddch(ypos[j] - 2, xpos[j], '-');
- mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\");
- mvaddstr(ypos[j], xpos[j] - 2, "| O |");
- mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /");
- mvaddch(ypos[j] + 2, xpos[j], '-');
- if (!j--)
- j = 4;
- mvaddch(ypos[j] - 2, xpos[j], ' ');
- mvaddstr(ypos[j] - 1, xpos[j] - 1, " ");
- mvaddstr(ypos[j], xpos[j] - 2, " ");
- mvaddstr(ypos[j] + 1, xpos[j] - 1, " ");
- mvaddch(ypos[j] + 2, xpos[j], ' ');
- xpos[j] = x;
- ypos[j] = y;
- refresh();
- if (delay) usleep(delay);
- }
-}
-
-static void
-onsig(int sig)
-{
-
- sig = 0;
- sig_caught = 1;
-}
diff --git a/games/robots/Makefile b/games/robots/Makefile
deleted file mode 100644
index 3e26d85..0000000
--- a/games/robots/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= robots
-CFLAGS+=-DMAX_PER_UID=5
-SRCS= extern.c init_field.c main.c make_level.c move.c move_robs.c \
- play_level.c query.c rnd_pos.c score.c flush_in.c
-MAN= robots.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/robots_roll)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/robots_roll
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/robots/extern.c b/games/robots/extern.c
deleted file mode 100644
index 07a8ce0..0000000
--- a/games/robots/extern.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-bool Dead; /* Player is now dead */
-bool Full_clear = TRUE; /* Lots of junk for init_field to clear */
-bool Jump = FALSE; /* Jump while running, counting, or waiting */
-bool Newscore; /* There was a new score added */
-#ifdef FANCY
-bool Pattern_roll = FALSE; /* Auto play for YHBJNLUK pattern */
-#endif
-bool Real_time = FALSE; /* Play in real time? */
-bool Running = FALSE; /* Currently in the middle of a run */
-#ifdef FANCY
-bool Stand_still = FALSE; /* Auto play for standing still pattern */
-#endif
-bool Teleport = FALSE; /* Teleport automatically when player must */
-bool Waiting; /* Player is waiting for end */
-bool Was_bonus = FALSE; /* Was a bonus last level */
-
-char Cnt_move; /* Command which has preceded the count */
-char Field[Y_FIELDSIZE][X_FIELDSIZE]; /* the playing field itslef */
-char *Next_move; /* Next move to be used in the pattern */
-char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
-char Run_ch; /* Character for the direction we are running */
-
-int Count = 0; /* Command count */
-int Level; /* Current level */
-int Num_robots; /* Number of robots left */
-int Num_scores; /* Number of scores posted */
-int Score; /* Current score */
-int Start_level = 1; /* Level on which to start */
-int Wait_bonus; /* bonus for waiting */
-
-COORD Max; /* Max area robots take up */
-COORD Min; /* Min area robots take up */
-COORD My_pos; /* Player's current position */
-COORD Robots[MAXROBOTS]; /* Robots' current positions */
-
-jmp_buf End_move; /* Jump to on Real_time */
diff --git a/games/robots/flush_in.c b/games/robots/flush_in.c
deleted file mode 100644
index 18e2709..0000000
--- a/games/robots/flush_in.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)flush_in.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <curses.h>
-
-/*
- * flush_in:
- * Flush all pending input.
- */
-flush_in()
-{
-# ifdef TIOCFLUSH
- ioctl(fileno(stdin), TIOCFLUSH, NULL);
-# else /* TIOCFLUSH */
- crmode();
-# endif /* TIOCFLUSH */
-}
diff --git a/games/robots/init_field.c b/games/robots/init_field.c
deleted file mode 100644
index 5ba6466..0000000
--- a/games/robots/init_field.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init_field.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-# include "robots.h"
-
-/*
- * init_field:
- * Lay down the initial pattern whih is constant across all levels,
- * and initialize all the global variables.
- */
-init_field()
-{
- int i;
- WINDOW *wp;
- int j;
- static bool first = TRUE;
- static char *desc[] = {
- "Directions:",
- "",
- "y k u",
- " \\|/",
- "h- -l",
- " /|\\",
- "b j n",
- "",
- "Commands:",
- "",
- "w: wait for end",
- "t: teleport",
- "q: quit",
- "^L: redraw screen",
- "",
- "Legend:",
- "",
- "+: robot",
- "*: junk heap",
- "@: you",
- "",
- "Score: 0",
- NULL
- };
-
- Dead = FALSE;
- Waiting = FALSE;
- /* flushok(stdscr, TRUE); */
- Score = 0;
-
- erase();
- move(0, 0);
- addch('+');
- for (i = 1; i < Y_FIELDSIZE; i++) {
- move(i, 0);
- addch('|');
- }
- move(Y_FIELDSIZE, 0);
- addch('+');
- for (i = 1; i < X_FIELDSIZE; i++)
- addch('-');
- addch('+');
- if (first)
- refresh();
- move(0, 1);
- for (i = 1; i < X_FIELDSIZE; i++)
- addch('-');
- addch('+');
- for (i = 1; i < Y_FIELDSIZE; i++) {
- move(i, X_FIELDSIZE);
- addch('|');
- }
- if (first)
- refresh();
- for (i = 0; desc[i] != NULL; i++) {
- move(i, X_FIELDSIZE + 2);
- addstr(desc[i]);
- }
- if (first)
- refresh();
- first = FALSE;
-#ifdef FANCY
- if (Pattern_roll)
- Next_move = &Move_list[-1];
-#endif
-}
diff --git a/games/robots/main.c b/games/robots/main.c
deleted file mode 100644
index 837d608..0000000
--- a/games/robots/main.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <signal.h>
-# include <stdlib.h>
-# include <ctype.h>
-
-main(ac, av)
-int ac;
-char **av;
-{
- char *sp;
- bool bad_arg;
- bool show_only;
- extern char *Scorefile;
- extern int Max_per_uid;
- void quit();
-
- show_only = FALSE;
- if (ac > 1) {
- bad_arg = FALSE;
- for (++av; ac > 1 && *av[0]; av++, ac--)
- if (av[0][0] != '-')
- if (isdigit(av[0][0]))
- Max_per_uid = atoi(av[0]);
- else {
- Scorefile = av[0];
-# ifdef FANCY
- sp = rindex(Scorefile, '/');
- if (sp == NULL)
- sp = Scorefile;
- if (strcmp(sp, "pattern_roll") == 0)
- Pattern_roll = TRUE;
- else if (strcmp(sp, "stand_still") == 0)
- Stand_still = TRUE;
- if (Pattern_roll || Stand_still)
- Teleport = TRUE;
-# endif
- }
- else
- for (sp = &av[0][1]; *sp; sp++)
- switch (*sp) {
- case 's':
- show_only = TRUE;
- break;
- case 'r':
- Real_time = TRUE;
- break;
- case 'a':
- Start_level = 4;
- break;
- case 'j':
- Jump = TRUE;
- break;
- case 't':
- Teleport = TRUE;
- break;
- default:
- fprintf(stderr, "robots: uknown option: %c\n", *sp);
- bad_arg = TRUE;
- break;
- }
- if (bad_arg) {
- exit(1);
- /* NOTREACHED */
- }
- }
-
- if (show_only) {
- show_score();
- exit(0);
- /* NOTREACHED */
- }
-
- initscr();
- signal(SIGINT, quit);
- crmode();
- noecho();
- nonl();
- if (LINES != Y_SIZE || COLS != X_SIZE) {
- if (LINES < Y_SIZE || COLS < X_SIZE) {
- endwin();
- printf("Need at least a %dx%d screen\n",
- Y_SIZE, X_SIZE);
- exit(1);
- }
- delwin(stdscr);
- stdscr = newwin(Y_SIZE, X_SIZE, 0, 0);
- }
-
- srandomdev();
- if (Real_time)
- signal(SIGALRM, move_robots);
- do {
- init_field();
- for (Level = Start_level; !Dead; Level++) {
- make_level();
- play_level();
- }
- move(My_pos.y, My_pos.x);
- printw("AARRrrgghhhh....");
- refresh();
- score();
- } while (another());
- quit();
-}
-
-void
-__cputchar(ch)
- int ch;
-{
- (void)putchar(ch);
-}
-
-/*
- * quit:
- * Leave the program elegantly.
- */
-void
-quit()
-{
- endwin();
- exit(0);
- /* NOTREACHED */
-}
-
-/*
- * another:
- * See if another game is desired
- */
-another()
-{
- int y;
-
-#ifdef FANCY
- if ((Stand_still || Pattern_roll) && !Newscore)
- return TRUE;
-#endif
-
- if (query("Another game?")) {
- if (Full_clear) {
- for (y = 1; y <= Num_scores; y++) {
- move(y, 1);
- clrtoeol();
- }
- refresh();
- }
- return TRUE;
- }
- return FALSE;
-}
diff --git a/games/robots/make_level.c b/games/robots/make_level.c
deleted file mode 100644
index 4aca2f5..0000000
--- a/games/robots/make_level.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)make_level.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-/*
- * make_level:
- * Make the current level
- */
-make_level()
-{
- int i;
- COORD *cp;
- WINDOW *wp;
- int x, *endp;
-
- reset_count();
- for (i = 1; i < Y_FIELDSIZE; i++)
- for (x = 1; x < X_FIELDSIZE; x++)
- if (Field[i][x] != 0)
- mvaddch(i, x, ' ');
- if (My_pos.y > 0)
- mvaddch(My_pos.y, My_pos.x, ' ');
-
- Waiting = FALSE;
- Wait_bonus = 0;
- leaveok(stdscr, FALSE);
- for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++)
- cp->y = -1;
- My_pos.y = -1;
-
- bzero(Field, sizeof Field);
- Min.y = Y_FIELDSIZE;
- Min.x = X_FIELDSIZE;
- Max.y = 0;
- Max.x = 0;
- if ((i = Level * 10) > MAXROBOTS)
- i = MAXROBOTS;
- Num_robots = i;
- while (i-- > 0) {
- cp = rnd_pos();
- Robots[i] = *cp;
- Field[cp->y][cp->x]++;
- if (cp->y < Min.y)
- Min.y = cp->y;
- if (cp->x < Min.x)
- Min.x = cp->x;
- if (cp->y > Max.y)
- Max.y = cp->y;
- if (cp->x > Max.x)
- Max.x = cp->x;
- }
- My_pos = *rnd_pos();
- refresh();
-}
diff --git a/games/robots/move.c b/games/robots/move.c
deleted file mode 100644
index fe18ed6..0000000
--- a/games/robots/move.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/ttydefaults.h>
-#include <ctype.h>
-#include "robots.h"
-
-# define ESC '\033'
-
-/*
- * get_move:
- * Get and execute a move from the player
- */
-get_move()
-{
- int c;
- int y, x, lastmove;
- static COORD newpos;
-
- if (Waiting)
- return;
-
-#ifdef FANCY
- if (Pattern_roll) {
- if (Next_move >= Move_list)
- lastmove = *Next_move;
- else
- lastmove = -1; /* flag for "first time in" */
- } else
- lastmove = 0; /* Shut up gcc */
-#endif
- for (;;) {
- if (Teleport && must_telep())
- goto teleport;
- if (Running)
- c = Run_ch;
- else if (Count != 0)
- c = Cnt_move;
-#ifdef FANCY
- else if (Num_robots > 1 && Stand_still)
- c = '>';
- else if (Num_robots > 1 && Pattern_roll) {
- if (*++Next_move == '\0') {
- if (lastmove < 0)
- goto over;
- Next_move = Move_list;
- }
- c = *Next_move;
- mvaddch(0, 0, c);
- if (c == lastmove)
- goto over;
- }
-#endif
- else {
-over:
- c = getchar();
- if (isdigit(c)) {
- Count = (c - '0');
- while (isdigit(c = getchar()))
- Count = Count * 10 + (c - '0');
- if (c == ESC)
- goto over;
- Cnt_move = c;
- if (Count)
- leaveok(stdscr, TRUE);
- }
- }
-
- switch (c) {
- case ' ':
- case '.':
- if (do_move(0, 0))
- goto ret;
- break;
- case 'y':
- if (do_move(-1, -1))
- goto ret;
- break;
- case 'k':
- if (do_move(-1, 0))
- goto ret;
- break;
- case 'u':
- if (do_move(-1, 1))
- goto ret;
- break;
- case 'h':
- if (do_move(0, -1))
- goto ret;
- break;
- case 'l':
- if (do_move(0, 1))
- goto ret;
- break;
- case 'b':
- if (do_move(1, -1))
- goto ret;
- break;
- case 'j':
- if (do_move(1, 0))
- goto ret;
- break;
- case 'n':
- if (do_move(1, 1))
- goto ret;
- break;
- case 'Y': case 'U': case 'H': case 'J':
- case 'K': case 'L': case 'B': case 'N':
- case '>':
- Running = TRUE;
- if (c == '>')
- Run_ch = ' ';
- else
- Run_ch = tolower(c);
- leaveok(stdscr, TRUE);
- break;
- case 'q':
- case 'Q':
- if (query("Really quit?"))
- quit();
- refresh();
- break;
- case 'w':
- case 'W':
- Waiting = TRUE;
- leaveok(stdscr, TRUE);
- /* flushok(stdscr, FALSE); */
- goto ret;
- case 't':
- case 'T':
-teleport:
- Running = FALSE;
- mvaddch(My_pos.y, My_pos.x, ' ');
- My_pos = *rnd_pos();
- mvaddch(My_pos.y, My_pos.x, PLAYER);
- leaveok(stdscr, FALSE);
- refresh();
- flush_in();
- goto ret;
- case CTRL('L'):
- wrefresh(curscr);
- break;
- case EOF:
- break;
- default:
- putchar(CTRL('G'));
- reset_count();
- fflush(stdout);
- break;
- }
- }
-ret:
- if (Count > 0)
- if (--Count == 0)
- leaveok(stdscr, FALSE);
-}
-
-/*
- * must_telep:
- * Must I teleport; i.e., is there anywhere I can move without
- * being eaten?
- */
-must_telep()
-{
- int x, y;
- static COORD newpos;
-
-#ifdef FANCY
- if (Stand_still && Num_robots > 1 && eaten(&My_pos))
- return TRUE;
-#endif
-
- for (y = -1; y <= 1; y++) {
- newpos.y = My_pos.y + y;
- if (newpos.y <= 0 || newpos.y >= Y_FIELDSIZE)
- continue;
- for (x = -1; x <= 1; x++) {
- newpos.x = My_pos.x + x;
- if (newpos.x <= 0 || newpos.x >= X_FIELDSIZE)
- continue;
- if (Field[newpos.y][newpos.x] > 0)
- continue;
- if (!eaten(&newpos))
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/*
- * do_move:
- * Execute a move
- */
-do_move(dy, dx)
-int dy, dx;
-{
- static COORD newpos;
-
- newpos.y = My_pos.y + dy;
- newpos.x = My_pos.x + dx;
- if (newpos.y <= 0 || newpos.y >= Y_FIELDSIZE ||
- newpos.x <= 0 || newpos.x >= X_FIELDSIZE ||
- Field[newpos.y][newpos.x] > 0 || eaten(&newpos)) {
- if (Running) {
- Running = FALSE;
- leaveok(stdscr, FALSE);
- move(My_pos.y, My_pos.x);
- refresh();
- }
- else {
- putchar(CTRL('G'));
- reset_count();
- }
- return FALSE;
- }
- else if (dy == 0 && dx == 0)
- return TRUE;
- mvaddch(My_pos.y, My_pos.x, ' ');
- My_pos = newpos;
- mvaddch(My_pos.y, My_pos.x, PLAYER);
- if (!jumping())
- refresh();
- return TRUE;
-}
-
-/*
- * eaten:
- * Player would get eaten at this place
- */
-eaten(pos)
-COORD *pos;
-{
- int x, y;
-
- for (y = pos->y - 1; y <= pos->y + 1; y++) {
- if (y <= 0 || y >= Y_FIELDSIZE)
- continue;
- for (x = pos->x - 1; x <= pos->x + 1; x++) {
- if (x <= 0 || x >= X_FIELDSIZE)
- continue;
- if (Field[y][x] == 1)
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*
- * reset_count:
- * Reset the count variables
- */
-reset_count()
-{
- Count = 0;
- Running = FALSE;
- leaveok(stdscr, FALSE);
- refresh();
-}
-
-/*
- * jumping:
- * See if we are jumping, i.e., we should not refresh.
- */
-jumping()
-{
- return (Jump && (Count || Running || Waiting));
-}
diff --git a/games/robots/move_robs.c b/games/robots/move_robs.c
deleted file mode 100644
index 23f39f6..0000000
--- a/games/robots/move_robs.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move_robs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <signal.h>
-
-/*
- * move_robots:
- * Move the robots around
- */
-void
-move_robots(was_sig)
-bool was_sig;
-{
- COORD *rp;
- int y, x;
- int mindist, d;
- static COORD newpos;
-
- if (Real_time)
- signal(SIGALRM, move_robots);
-# ifdef DEBUG
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
-# endif /* DEBUG */
- for (rp = Robots; rp < &Robots[MAXROBOTS]; rp++) {
- if (rp->y < 0)
- continue;
- mvaddch(rp->y, rp->x, ' ');
- Field[rp->y][rp->x]--;
- rp->y += sign(My_pos.y - rp->y);
- rp->x += sign(My_pos.x - rp->x);
- if (rp->y <= 0)
- rp->y = 0;
- else if (rp->y >= Y_FIELDSIZE)
- rp->y = Y_FIELDSIZE - 1;
- if (rp->x <= 0)
- rp->x = 0;
- else if (rp->x >= X_FIELDSIZE)
- rp->x = X_FIELDSIZE - 1;
- Field[rp->y][rp->x]++;
- }
-
- Min.y = Y_FIELDSIZE;
- Min.x = X_FIELDSIZE;
- Max.y = 0;
- Max.x = 0;
- for (rp = Robots; rp < &Robots[MAXROBOTS]; rp++)
- if (rp->y < 0)
- continue;
- else if (rp->y == My_pos.y && rp->x == My_pos.x)
- Dead = TRUE;
- else if (Field[rp->y][rp->x] > 1) {
- mvaddch(rp->y, rp->x, HEAP);
- rp->y = -1;
- Num_robots--;
- if (Waiting)
- Wait_bonus++;
- add_score(ROB_SCORE);
- }
- else {
- mvaddch(rp->y, rp->x, ROBOT);
- if (rp->y < Min.y)
- Min.y = rp->y;
- if (rp->x < Min.x)
- Min.x = rp->x;
- if (rp->y > Max.y)
- Max.y = rp->y;
- if (rp->x > Max.x)
- Max.x = rp->x;
- }
-
- if (was_sig) {
- refresh();
- if (Dead || Num_robots <= 0)
- longjmp(End_move, 0);
- }
-
-# ifdef DEBUG
- standout();
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
- standend();
-# endif /* DEBUG */
- if (Real_time)
- alarm(3);
-}
-
-/*
- * add_score:
- * Add a score to the overall point total
- */
-add_score(add)
-int add;
-{
- Score += add;
- move(Y_SCORE, X_SCORE);
- printw("%d", Score);
-}
-
-/*
- * sign:
- * Return the sign of the number
- */
-sign(n)
-int n;
-{
- if (n < 0)
- return -1;
- else if (n > 0)
- return 1;
- else
- return 0;
-}
diff --git a/games/robots/pathnames.h b/games/robots/pathnames.h
deleted file mode 100644
index 2be7857..0000000
--- a/games/robots/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_SCORE "/var/games/robots_roll"
diff --git a/games/robots/play_level.c b/games/robots/play_level.c
deleted file mode 100644
index b03bbc4..0000000
--- a/games/robots/play_level.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)play_level.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-/*
- * play_level:
- * Let the player play the current level
- */
-play_level()
-{
- COORD *cp;
- int y, x, bonus;
-
- move(My_pos.y, My_pos.x);
- addch(PLAYER);
- refresh();
- for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) {
- if (cp->y < 0)
- continue;
- move(cp->y, cp->x);
- addch(ROBOT);
- }
- refresh();
-# ifdef DEBUG
- standout();
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
- standend();
-# endif /* DEBUG */
- setjmp(End_move);
- flush_in();
- while (!Dead && Num_robots > 0) {
- move(My_pos.y, My_pos.x);
- if (!jumping())
- refresh();
- get_move();
- if (Real_time)
- alarm(0);
- if (Field[My_pos.y][My_pos.x] != 0)
- Dead = TRUE;
- if (!Dead)
- move_robots(FALSE);
- if (Was_bonus) {
- move(Y_PROMPT, X_PROMPT);
- clrtoeol();
- move(Y_PROMPT + 1, X_PROMPT);
- clrtoeol();
- Was_bonus = FALSE;
- }
- }
-
- /*
- * if the player didn't die, add on the possible bonuses
- */
-
- if (!Dead) {
- Was_bonus = FALSE;
-
- if (Level == Start_level && Start_level > 1) {
- move(Y_PROMPT, X_PROMPT);
- printw("Advance bonus: %d", S_BONUS);
- refresh();
- add_score(S_BONUS);
- Was_bonus = TRUE;
- }
-
- if (Wait_bonus != 0) {
- if (!Was_bonus)
- move(Y_PROMPT, X_PROMPT);
- else
- move(Y_PROMPT + 1, X_PROMPT);
- printw("Wait bonus: %d", Wait_bonus);
- refresh();
- add_score(Wait_bonus);
- Was_bonus = TRUE;
- }
- }
-}
diff --git a/games/robots/query.c b/games/robots/query.c
deleted file mode 100644
index bc6590c..0000000
--- a/games/robots/query.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-# include "robots.h"
-
-/*
- * query:
- * Ask a question and get a yes or no answer. Default is "no".
- */
-query(prompt)
-char *prompt;
-{
- int c, retval;
- int y, x;
-
- getyx(stdscr, y, x);
- move(Y_PROMPT, X_PROMPT);
- addstr(prompt);
- clrtoeol();
- refresh();
- retval = ((c = getchar()) == 'y' || c == 'Y');
- move(Y_PROMPT, X_PROMPT);
- clrtoeol();
- move(y, x);
- return retval;
-}
diff --git a/games/robots/rnd_pos.c b/games/robots/rnd_pos.c
deleted file mode 100644
index 13be7ca..0000000
--- a/games/robots/rnd_pos.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)rnd_pos.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdlib.h>
-# include "robots.h"
-
-# define IS_SAME(p,y,x) ((p).y != -1 && (p).y == y && (p).x == x)
-
-/*
- * rnd_pos:
- * Pick a random, unoccupied position
- */
-COORD *
-rnd_pos()
-{
- static COORD pos;
- static int call = 0;
- int i = 0;
-
- do {
- pos.y = rnd(Y_FIELDSIZE - 1) + 1;
- pos.x = rnd(X_FIELDSIZE - 1) + 1;
- refresh();
- } while (Field[pos.y][pos.x] != 0);
- call++;
- return &pos;
-}
-
-rnd(range)
-int range;
-{
- return random() % range;
-}
diff --git a/games/robots/robots.6 b/games/robots/robots.6
deleted file mode 100644
index 2f89853..0000000
--- a/games/robots/robots.6
+++ /dev/null
@@ -1,142 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)robots.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH ROBOTS 6 "May 31, 1993"
-.UC 6
-.SH NAME
-robots \- fight off villainous robots
-.SH SYNOPSIS
-.B robots
-[
-.B \-sjta
-] [
-.B scorefile
-]
-.SH DESCRIPTION
-.I Robots
-pits you against evil robots, who are trying to kill you (which is why
-they are evil).
-Fortunately for you, even though they are evil, they are not very bright
-and have a habit of bumping into each other, thus destroying themselves.
-In order to survive, you must get them to kill each other off, since you
-have no offensive weaponry.
-.PP
-Since you are stuck without offensive weaponry, you are endowed with one
-piece of defensive weaponry: a teleportation device.
-When two robots run into each other or a junk pile, they die.
-If a robot runs into you, you die.
-When a robot dies, you get 10 points, and when all the robots die,
-you start on the next field.
-This keeps up until they finally get you.
-.PP
-Robots are represented on the screen by a
-.RB ` + ',
-the junk heaps from their collisions by a
-.RB ` \(** ',
-and you
-(the good guy)
-by a
-.RB ` @ '.
-.PP
-The commands are:
-.sp
-.nf
-.ta
-.ta \w'\fBHJKLBNYU\fP\ \ 'u
-\fBh\fP move one square left
-\fBl\fP move one square right
-\fBk\fP move one square up
-\fBj\fP move one square down
-\fBy\fP move one square up and left
-\fBu\fP move one square up and right
-\fBb\fP move one square down and left
-\fBn\fP move one square down and right
-\fB\&.\fP (also space) do nothing for one turn
-\fBHJKLBNYU\fP run as far as possible in the given direction
-\fB>\fP do nothing for as long as possible
-\fBt\fP teleport to a random location
-\fBw\fP wait until you die or they all do
-\fBq\fP quit
-\fB^L\fP redraw the screen
-.sp
-.fi
-All commands can be preceded by a count.
-.PP
-If you use the
-.RB ` w '
-command and survive to the next level, you will get a bonus of 10%
-for each robot which died after you decided to wait.
-If you die, however, you get nothing.
-For all other commands, the program will save you from typos
-by stopping short of being eaten.
-However, with
-.RB ` w '
-you take the risk of dying by miscalculation.
-.PP
-Only five scores are allowed per user on the score file.
-If you make it into the score file, you will be shown the list at the end
-of the game.
-If an alternate score file is specified, that will be used instead of the
-standard file for scores.
-.PP
-The options are
-.TP
-.B \-s
-Don't play, just show the score file.
-.TP
-.B \-j
-Jump,
-.IR i.e. ,
-when you run, don't show any intermediate positions; only show things at
-the end.
-This is useful on slow terminals.
-.TP
-.B \-t
-Teleport automatically when you have no other option.
-This is a little disconcerting until you get used to it, and then it is
-very nice.
-.TP
-.B \-a
-Advance into the higher levels directly, skipping the lower, easier levels.
-.SH AUTHOR
-Ken Arnold
-.SH FILES
-.ta
-.ta \w'/var/games/robots_roll\ \ \ \ 'u
-/var/games/robots_roll the score file
-.SH BUGS
-Bugs?
-You
-.IR crazy ,
-man?!?
diff --git a/games/robots/robots.h b/games/robots/robots.h
deleted file mode 100644
index 0139a1d..0000000
--- a/games/robots/robots.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)robots.h 8.1 (Berkeley) 5/31/93
- */
-
-# include <curses.h>
-# include <setjmp.h>
-
-/*
- * miscellaneous constants
- */
-
-# define Y_FIELDSIZE 23
-# define X_FIELDSIZE 60
-# define Y_SIZE 24
-# define X_SIZE 80
-# define MAXLEVELS 4
-# define MAXROBOTS (MAXLEVELS * 10)
-# define ROB_SCORE 10
-# define S_BONUS (60 * ROB_SCORE)
-# define Y_SCORE 21
-# define X_SCORE (X_FIELDSIZE + 9)
-# define Y_PROMPT (Y_FIELDSIZE - 1)
-# define X_PROMPT (X_FIELDSIZE + 2)
-# define MAXSCORES (Y_SIZE - 2)
-# define MAXNAME 16
-# define MS_NAME "Ten"
-
-/*
- * characters on screen
- */
-
-# define ROBOT '+'
-# define HEAP '*'
-# define PLAYER '@'
-
-/*
- * type definitions
- */
-
-typedef struct {
- int y, x;
-} COORD;
-
-/*
- * global variables
- */
-
-extern bool Dead, Full_clear, Jump, Newscore, Real_time, Running,
- Teleport, Waiting, Was_bonus;
-
-#ifdef FANCY
-extern bool Pattern_roll, Stand_still;
-#endif
-
-extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], *Next_move,
- *Move_list, Run_ch;
-
-extern int Count, Level, Num_robots, Num_scores, Score,
- Start_level, Wait_bonus;
-
-extern COORD Max, Min, My_pos, Robots[];
-
-extern jmp_buf End_move;
-
-/*
- * functions types
- */
-
-int cmp_sc();
-void move_robots();
-
-COORD *rnd_pos();
-
-
-
-
diff --git a/games/robots/score.c b/games/robots/score.c
deleted file mode 100644
index 21fadf5..0000000
--- a/games/robots/score.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <sys/types.h>
-# include <pwd.h>
-# include "pathnames.h"
-
-typedef struct {
- int s_uid;
- int s_score;
- char s_name[MAXNAME];
-} SCORE;
-
-typedef struct passwd PASSWD;
-
-char *Scorefile = _PATH_SCORE;
-
-int Max_per_uid = MAX_PER_UID;
-
-static SCORE Top[MAXSCORES];
-
-/*
- * score:
- * Post the player's score, if reasonable, and then print out the
- * top list.
- */
-score()
-{
- int inf;
- SCORE *scp;
- int uid;
- bool done_show = FALSE;
- static int numscores, max_uid;
-
- Newscore = FALSE;
- if ((inf = open(Scorefile, 2)) < 0) {
- perror(Scorefile);
- return;
- }
-
- if (read(inf, &max_uid, sizeof max_uid) == sizeof max_uid)
- read(inf, Top, sizeof Top);
- else {
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- scp->s_score = -1;
- max_uid = Max_per_uid;
- }
-
- uid = getuid();
- if (Top[MAXSCORES-1].s_score <= Score) {
- numscores = 0;
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- if (scp->s_score < 0 ||
- (scp->s_uid == uid && ++numscores == max_uid)) {
- if (scp->s_score > Score)
- break;
- scp->s_score = Score;
- scp->s_uid = uid;
- set_name(scp);
- Newscore = TRUE;
- break;
- }
- if (scp == &Top[MAXSCORES]) {
- Top[MAXSCORES-1].s_score = Score;
- Top[MAXSCORES-1].s_uid = uid;
- set_name(&Top[MAXSCORES-1]);
- Newscore = TRUE;
- }
- if (Newscore)
- qsort(Top, MAXSCORES, sizeof Top[0], cmp_sc);
- }
-
- if (!Newscore) {
- Full_clear = FALSE;
- close(inf);
- return;
- }
- else
- Full_clear = TRUE;
-
- for (scp = Top; scp < &Top[MAXSCORES]; scp++) {
- if (scp->s_score < 0)
- break;
- move((scp - Top) + 1, 15);
- if (!done_show && scp->s_uid == uid && scp->s_score == Score)
- standout();
- printw(" %d\t%d\t%-8.8s ", (scp - Top) + 1, scp->s_score, scp->s_name);
- if (!done_show && scp->s_uid == uid && scp->s_score == Score) {
- standend();
- done_show = TRUE;
- }
- }
- Num_scores = scp - Top;
- refresh();
-
- if (Newscore) {
- lseek(inf, 0L, 0);
- write(inf, &max_uid, sizeof max_uid);
- write(inf, Top, sizeof Top);
- }
- close(inf);
-}
-
-set_name(scp)
-SCORE *scp;
-{
- PASSWD *pp;
-
- if ((pp = getpwuid(scp->s_uid)) == NULL)
- pp->pw_name = "???";
- strncpy(scp->s_name, pp->pw_name, MAXNAME);
-}
-
-/*
- * cmp_sc:
- * Compare two scores.
- */
-cmp_sc(s1, s2)
-SCORE *s1, *s2;
-{
- return s2->s_score - s1->s_score;
-}
-
-/*
- * show_score:
- * Show the score list for the '-s' option.
- */
-show_score()
-{
- SCORE *scp;
- int inf;
- static int max_score;
-
- if ((inf = open(Scorefile, 0)) < 0) {
- perror(Scorefile);
- return;
- }
-
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- scp->s_score = -1;
-
- read(inf, &max_score, sizeof max_score);
- read(inf, Top, sizeof Top);
- close(inf);
- inf = 1;
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- if (scp->s_score >= 0)
- printf("%d\t%d\t%.*s\n", inf++, scp->s_score,
- (int)sizeof(scp->s_name), scp->s_name);
-}
diff --git a/games/rogue/CHANGES b/games/rogue/CHANGES
deleted file mode 100644
index 73a7135..0000000
--- a/games/rogue/CHANGES
+++ /dev/null
@@ -1,53 +0,0 @@
-From: tektronix!zeus.TEK.COM!tims@ucbvax.Berkeley.EDU
-Date: 30 Nov 87 15:08:15 PST (Mon)
-To: okeeffe.Berkeley.EDU!mckusick@ucbvax.Berkeley.EDU (Kirk McKusick)
-Subject: Re: Public domain rogue
-Return-Path: tektronix!zeus.TEK.COM!tims@ucbvax.Berkeley.EDU
-
-Here is a list of discrepencies from the documentation you sent me:
-
-The -d option not implemented.
-The -r option not implemented, use "rogue save_file" instead.
-Strength is between 1 and 99, not 3 and 32.
-The D command is not implemented.
-Only scrolls,potions,wands,and rings may be "call"ed something.
-The ^P command may be used to go 4 messages back, instead of just 1.
-The @ comand is not implemented.
-There are no dark rooms.
-ROGUEOPTS of flush,terse,seefloor,askme,inventory are ignored.
- 'askquit' is added to prevent ^\ from terminating the game accidentally.
- If 'noaskquit' is
- found in the ROGUEOPTS string, the the ^\ kills the game, otherwise,
- the player is asked if he really wants to quit. In either case, no
- score file processing is attempted.
-The score is keyed to winning scores, and no player may appear twice.
-
-
-
-
-
-
-Other differences from "standard" rogue 5.3. This list covers externally
-visible differences only.
-
-There should be NO bugs with any severe consequences. Absolutely NO
- game-stopping, or game-winning bugs should be present.
-Traps fail occasionally, that is, they sometimes are sprung but miss.
-The ^A command prints out some stuff you're probably not interested in.
-The '&' command silently saves your screen into the file 'rogue.screen'
-Any inventory selection command that takes '*' as a request to list all
- appropriate items, can take one of "=?:)]!/" to list only rings,
- scrolls, or whatever.
-Scrolls and potions, once used, become identified. All other objects become
- identified only by scroll of identification.
-There is only one scroll of identification, and it works on any item.
-ROGUEOPTS
- Only the following are implemented:
- file,jump,name,askquit,tombstone,passgo
- "askquit" is used to prevent accidental termination of the game via ^\
-You may drop objects in doorways.
-Prints a picture of a skull, not a tombstone, upon death.
-The save/restore game function is faster and machine-independent, but sometimes
- requires modification when new variables are added to the source.
-The potion of detect monster lasts for the whole level.
-Their is no wand of light.
diff --git a/games/rogue/Makefile b/games/rogue/Makefile
deleted file mode 100644
index 7e3eea9..0000000
--- a/games/rogue/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= rogue
-CFLAGS+=-DUNIX -fwritable-strings
-SRCS= hit.c init.c inventory.c level.c machdep.c main.c \
- message.c monster.c move.c object.c pack.c play.c random.c ring.c \
- room.c save.c score.c spec_hit.c throw.c trap.c use.c zap.c
-DPADD= ${LIBCURSES}
-LDADD= -lcurses
-HIDEGAME=hidegame
-MAN= rogue.6
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/rogue.scores)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/rogue.scores
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/rogue/USD.doc/Makefile b/games/rogue/USD.doc/Makefile
deleted file mode 100644
index 3df0ddb..0000000
--- a/games/rogue/USD.doc/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-DIR= usd/30.rogue
-SRCS= rogue.me
-MACROS= -me
-
-paper.${PRINTER}: ${SRCS}
- ${TBL} ${SRCS} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
diff --git a/games/rogue/USD.doc/rogue.me b/games/rogue/USD.doc/rogue.me
deleted file mode 100644
index 20f5a84..0000000
--- a/games/rogue/USD.doc/rogue.me
+++ /dev/null
@@ -1,836 +0,0 @@
-.\" Copyright (c) 1986, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)rogue.me 8.1 (Berkeley) 6/8/93
-.\" $FreeBSD$
-.\"
-.ds E \s-2<ESCAPE>\s0
-.ds R \s-2<RETURN>\s0
-.ds U \s-2UNIX\s0
-.ie t .ds _ \d\(mi\u
-.el .ds _ _
-.de Cs
-\&\\$3\*(lq\\$1\*(rq\\$2
-..
-.sp 5
-.ce 1000
-.ps +4
-.vs +4p
-.b
-A Guide to the Dungeons of Doom
-.r
-.vs
-.ps
-.sp 2
-.i
-Michael C. Toy
-Kenneth C. R. C. Arnold
-.r
-.sp 2
-Computer Systems Research Group
-Department of Electrical Engineering and Computer Science
-University of California
-Berkeley, California 94720
-.sp 4
-.i ABSTRACT
-.ce 0
-.(b I F
-.bi Rogue
-is a visual CRT based fantasy game
-which runs under the \*U\(dg timesharing system.
-.(f
-\fR\(dg\*U is a trademark of Bell Laboratories\fP
-.)f
-This paper describes how to play rogue,
-and gives a few hints
-for those who might otherwise get lost in the Dungeons of Doom.
-.)b
-\".he '''\fBA Guide to the Dungeons of Doom\fP'
-\" .fo ''- % -''
-.eh 'USD:30-%''A Guide to the Dungeons of Doom'
-.oh 'A Guide to the Dungeons of Doom''USD:30-%'
-.sh 1 Introduction
-.pp
-You have just finished your years as a student at the local fighter's guild.
-After much practice and sweat you have finally completed your training
-and are ready to embark upon a perilous adventure.
-As a test of your skills,
-the local guildmasters have sent you into the Dungeons of Doom.
-Your task is to return with the Amulet of Yendor.
-Your reward for the completion of this task
-will be a full membership in the local guild.
-In addition,
-you are allowed to keep all the loot you bring back from the dungeons.
-.pp
-In preparation for your journey,
-you are given an enchanted mace,
-a bow, and a quiver of arrows
-taken from a dragon's hoard in the far off Dark Mountains.
-You are also outfitted with elf-crafted armor
-and given enough food to reach the dungeons.
-You say goodbye to family and friends for what may be the last time
-and head up the road.
-.pp
-You set out on your way to the dungeons
-and after several days of uneventful travel,
-you see the ancient ruins
-that mark the entrance to the Dungeons of Doom.
-It is late at night,
-so you make camp at the entrance
-and spend the night sleeping under the open skies.
-In the morning you gather your weapons,
-put on your armor,
-eat what is almost your last food,
-and enter the dungeons.
-.sh 1 "What is going on here?"
-.pp
-You have just begun a game of rogue.
-Your goal is to grab as much treasure as you can,
-find the Amulet of Yendor,
-and get out of the Dungeons of Doom alive.
-On the screen,
-a map of where you have been
-and what you have seen on the current dungeon level is kept.
-As you explore more of the level,
-it appears on the screen in front of you.
-.pp
-Rogue differs from most computer fantasy games in that it is screen oriented.
-Commands are all one or two keystrokes\**
-.(f
-\** As opposed to pseudo English sentences.
-.)f
-and the results of your commands
-are displayed graphically on the screen rather
-than being explained in words.\**
-.(f
-\** A minimum screen size of 24 lines by 80 columns is required.
-If the screen is larger, only the 24x80 section will be used
-for the map.
-.)f
-.pp
-Another major difference between rogue and other computer fantasy games
-is that once you have solved all the puzzles in a standard fantasy game,
-it has lost most of its excitement and it ceases to be fun.
-Rogue,
-on the other hand,
-generates a new dungeon every time you play it
-and even the author finds it an entertaining and exciting game.
-.sh 1 "What do all those things on the screen mean?"
-.pp
-In order to understand what is going on in rogue
-you have to first get some grasp of what rogue is doing with the screen.
-The rogue screen is intended
-to replace the \*(lqYou can see ...\*(rq descriptions
-of standard fantasy games.
-Figure 1 is a sample of what a rogue screen might look like.
-.(z
-.hl
-.nf
-.TS
-center;
-ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce.
-- - - - - - - - - - - -
-| . . . . . . . . . . +
-| . . @ . . . . ] . . |
-| . . . . B . . . . . |
-| . . . . . . . . . . |
-- - - - - + - - - - - -
-.TE
-
-
-.ce 1000
-Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0
-
-Figure 1
-.ce
-.hl
-.)z
-.sh 2 "The bottom line"
-.pp
-At the bottom line of the screen
-are a few pieces of cryptic information
-describing your current status.
-Here is an explanation of what these things mean:
-.ip Level \w'Level\ \ 'u
-This number indicates how deep you have gone in the dungeon.
-It starts at one and goes up as you go deeper into the dungeon.
-.ip Gold \w'Level\ \ 'u
-The number of gold pieces you have managed to find
-and keep with you so far.
-.ip Hp \w'Level\ \ 'u
-Your current and maximum health points.
-Health points indicate how much damage you can take before you die.
-The more you get hit in a fight,
-the lower they get.
-You can regain health points by resting.
-The number in parentheses
-is the maximum number your health points can reach.
-.ip Str \w'Level\ \ 'u
-Your current strength and maximum ever strength.
-This can be any integer less than or equal to 99,
-or greater than or equal to 1.
-The higher the number,
-the stronger you are.
-The number in the parentheses
-is the maximum strength you have attained so far this game.
-.ip Arm \w'Level\ \ 'u
-Your current armor protection.
-This number indicates how effective your armor is
-in stopping blows from unfriendly creatures.
-The higher this number is,
-the more effective the armor.
-.ip Exp \w'Level\ \ 'u
-These two numbers give your current experience level
-and experience points.
-As you do things,
-you gain experience points.
-At certain experience point totals,
-you gain an experience level.
-The more experienced you are,
-the better you are able to fight and to withstand magical attacks.
-.sh 2 "The top line"
-.pp
-The top line of the screen is reserved
-for printing messages that describe things
-that are impossible to represent visually.
-If you see a \*(lq--More--\*(rq on the top line,
-this means that rogue wants to print another message on the screen,
-but it wants to make certain
-that you have read the one that is there first.
-To read the next message,
-just type a space.
-.sh 2 "The rest of the screen"
-.pp
-The rest of the screen is the map of the level
-as you have explored it so far.
-Each symbol on the screen represents something.
-Here is a list of what the various symbols mean:
-.ip @
-This symbol represents you, the adventurer.
-.ip "-\^|"
-These symbols represent the walls of rooms.
-.ip +
-A door to/from a room.
-.ip .
-The floor of a room.
-.ip #
-The floor of a passage between rooms.
-.ip *
-A pile or pot of gold.
-.ip )
-A weapon of some sort.
-.ip ]
-A piece of armor.
-.ip !
-A flask containing a magic potion.
-.ip ?
-A piece of paper, usually a magic scroll.
-.ip =
-A ring with magic properties
-.ip /
-A magical staff or wand
-.ip ^
-A trap, watch out for these.
-.ip %
-A staircase to other levels
-.ip :
-A piece of food.
-.ip A-Z
-The uppercase letters
-represent the various inhabitants of the Dungeons of Doom.
-Watch out, they can be nasty and vicious.
-.sh 1 Commands
-.pp
-Commands are given to rogue by typing one or two characters.
-Most commands can be preceded by a count to repeat them
-(e.g. typing
-.Cs 10s
-will do ten searches).
-Commands for which counts make no sense
-have the count ignored.
-To cancel a count or a prefix,
-type \*E.
-The list of commands is rather long,
-but it can be read at any time during the game with the
-.Cs ?
-command.
-Here it is for reference,
-with a short explanation of each command.
-.ip ?
-The help command.
-Asks for a character to give help on.
-If you type a
-.Cs * ,
-it will list all the commands,
-otherwise it will explain what the character you typed does.
-.ip /
-This is the \*(lqWhat is that on the screen?\*(rq command.
-A
-.Cs /
-followed by any character that you see on the level,
-will tell you what that character is.
-For instance,
-typing
-.Cs /@
-will tell you that the
-.Cs @
-symbol represents you, the player.
-.ip "h, H, ^H"
-Move left.
-You move one space to the left.
-If you use upper case
-.Cs h ,
-you will continue to move left until you run into something.
-This works for all movement commands
-(e.g.
-.Cs L
-means run in direction
-.Cs l )
-If you use the \*(lqcontrol\*(rq
-.Cs h ,
-you will continue moving in the specified direction
-until you pass something interesting or run into a wall.
-You should experiment with this,
-since it is a very useful command,
-but very difficult to describe.
-This also works for all movement commands.
-.ip j
-Move down.
-.ip k
-Move up.
-.ip l
-Move right.
-.ip y
-Move diagonally up and left.
-.ip u
-Move diagonally up and right.
-.ip b
-Move diagonally down and left.
-.ip n
-Move diagonally down and right.
-.ip t
-Throw an object.
-This is a prefix command.
-When followed with a direction
-it throws an object in the specified direction.
-(e.g. type
-.Cs th
-to throw
-something to the left.)
-.ip f
-Fight until someone dies.
-When followed with a direction
-this will force you to fight the creature in that direction
-until either you or it bites the big one.
-.ip m
-Move onto something without picking it up.
-This will move you one space in the direction you specify and,
-if there is an object there you can pick up,
-it won't do it.
-.ip z
-Zap prefix.
-Point a staff or wand in a given direction
-and fire it.
-Even non-directional staves must be pointed in some direction
-to be used.
-.ip ^
-Identify trap command.
-If a trap is on your map
-and you can't remember what type it is,
-you can get rogue to remind you
-by getting next to it and typing
-.Cs ^
-followed by the direction that would move you on top of it.
-.ip s
-Search for traps and secret doors.
-Examine each space immediately adjacent to you
-for the existence of a trap or secret door.
-There is a large chance that even if there is something there,
-you won't find it,
-so you might have to search a while before you find something.
-.ip >
-Climb down a staircase to the next level.
-Not surprisingly, this can only be done if you are standing on staircase.
-.ip <
-Climb up a staircase to the level above.
-This can't be done without the Amulet of Yendor in your possession.
-.ip "."
-Rest.
-This is the \*(lqdo nothing\*(rq command.
-This is good for waiting and healing.
-.ip ,
-Pick up something.
-This picks up whatever you are currently standing on,
-if you are standing on anything at all.
-.ip i
-Inventory.
-List what you are carrying in your pack.
-.ip I
-Selective inventory.
-Tells you what a single item in your pack is.
-.ip q
-Quaff one of the potions you are carrying.
-.ip r
-Read one of the scrolls in your pack.
-.ip e
-Eat food from your pack.
-.ip w
-Wield a weapon.
-Take a weapon out of your pack and carry it for use in combat,
-replacing the one you are currently using (if any).
-.ip W
-Wear armor.
-You can only wear one suit of armor at a time.
-This takes extra time.
-.ip T
-Take armor off.
-You can't remove armor that is cursed.
-This takes extra time.
-.ip P
-Put on a ring.
-You can wear only two rings at a time
-(one on each hand).
-If you aren't wearing any rings,
-this command will ask you which hand you want to wear it on,
-otherwise, it will place it on the unused hand.
-The program assumes that you wield your sword in your right hand.
-.ip R
-Remove a ring.
-If you are only wearing one ring,
-this command takes it off.
-If you are wearing two,
-it will ask you which one you wish to remove,
-.ip d
-Drop an object.
-Take something out of your pack and leave it lying on the floor.
-Only one object can occupy each space.
-You cannot drop a cursed object at all
-if you are wielding or wearing it.
-.ip c
-Call an object something.
-If you have a type of object in your pack
-which you wish to remember something about,
-you can use the call command to give a name to that type of object.
-This is usually used when you figure out what a
-potion, scroll, ring, or staff is
-after you pick it up but before it is truly identified. Each type of
-scroll and potion will become identified after its first use.
-.ip o
-Examine and set options.
-This command is further explained in the section on options.
-.ip ^R
-Redraws the screen.
-Useful if spurious messages or transmission errors
-have messed up the display.
-.ip ^P
-Print last message.
-Useful when a message disappears before you can read it.
-Consecutive repetitions of this command will reveal the last
-five messages.
-.ip \*E
-Cancel a command, prefix, or count.
-.ip !
-Escape to a shell for some commands.
-.ip Q
-Quit.
-Leave the game.
-.ip S
-Save the current game in a file.
-It will ask you whether you wish to use the default save file.
-.i Caveat :
-Rogue won't let you start up a copy of a saved game,
-and it removes the save file as soon as you start up a restored game.
-This is to prevent people from saving a game just before a dangerous position
-and then restarting it if they die.
-To restore a saved game,
-give the file name as an argument to rogue.
-As in
-.ti +1i
-.nf
-% rogue \fIsave\*_file\fP
-.ip v
-Prints the program version number.
-.ip )
-Print the weapon you are currently wielding
-.ip ]
-Print the armor you are currently wearing
-.ip =
-Print the rings you are currently wearing
-.sh 1 Rooms
-.pp
-Rooms in the dungeons are lit as you enter them.
-Upon leaving a room,
-all monsters inside the room are erased from the screen.
-In the darkness of a corridor, you can only see one space
-in all directions around you.
-.sh 1 Fighting
-.pp
-If you see a monster and you wish to fight it,
-just attempt to run into it.
-Many times a monster you find will mind its own business
-unless you attack it.
-It is often the case that discretion is the better part of valor.
-.sh 1 "Objects you can find"
-.pp
-When you find something in the dungeon,
-it is common to want to pick the object up.
-This is accomplished in rogue by walking over the object
-(unless you use the
-.Cs m
-prefix, see above).
-If you are carrying too many things,
-the program will tell you and it won't pick up the object,
-otherwise it will add it to your pack
-and tell you what you just picked up.
-.pp
-Many of the commands that operate on objects must prompt you
-to find out which object you want to use.
-If you change your mind and don't want to do that command after all,
-just type an \*E and the command will be aborted.
-.pp
-Some objects, like armor and weapons,
-are easily differentiated.
-Others, like scrolls and potions,
-are given labels which vary according to type.
-During a game,
-any two of the same kind of object
-with the same label
-are the same type.
-However,
-the labels will vary from game to game.
-.pp
-When you use one of these labeled objects,
-if its effect may be obvious. Potions or scrolls will
-become identified at this point, but not other items.
-You may want to call these other items something
-so you will recognize it later,
-you can use the
-.Cs call
-command
-(see above).
-.sh 2 Weapons
-.pp
-Some weapons,
-like arrows,
-come in bunches,
-but most come one at a time.
-In order to use a weapon,
-you must wield it.
-To fire an arrow out of a bow,
-you must first wield the bow,
-then throw the arrow.
-You can only wield one weapon at a time,
-but you can't change weapons if the one
-you are currently wielding is cursed.
-The commands to use weapons are
-.Cs w
-(wield)
-and
-.Cs t
-(throw).
-.sh 2 Armor
-.pp
-There are various sorts of armor lying around in the dungeon.
-Some of it is enchanted,
-some is cursed,
-and some is just normal.
-Different armor types have different armor protection.
-The higher the armor protection,
-the more protection the armor affords against the blows of monsters.
-Here is a list of the various armor types and their normal armor protection:
-.(b
-.TS
-box center;
-l r.
-\ \ \fIType Protection\fP
-None 0
-Leather armor 2
-Studded leather / Ring mail 3
-Scale mail 4
-Chain mail 5
-Banded mail / Splint mail 6
-Plate mail 7
-.TE
-.)b
-.lp
-If a piece of armor is enchanted,
-its armor protection will be higher than normal.
-If a suit of armor is cursed,
-its armor protection will be lower,
-and you will not be able to remove it.
-However, not all armor with a protection that is lower than normal is cursed.
-.pp
-The commands to use weapons are
-.Cs W
-(wear)
-and
-.Cs T
-(take off).
-.sh 2 Scrolls
-.pp
-Scrolls come with titles in an unknown tongue\**.
-.(f
-\** Actually, it's a dialect spoken only by the twenty-seven members
-of a tribe in Outer Mongolia,
-but you're not supposed to
-.i know
-that.
-.)f
-After you read a scroll,
-it disappears from your pack.
-The command to use a scroll is
-.Cs r
-(read).
-.sh 2 Potions
-.pp
-Potions are labeled by the color of the liquid inside the flask.
-They disappear after being quaffed.
-The command to quaff a potion is
-.Cs q
-(quaff).
-.sh 2 "Staves and Wands"
-.pp
-Staves and wands do the same kinds of things.
-Staves are identified by a type of wood;
-wands by a type of metal or bone.
-They are generally things you want to do to something
-over a long distance,
-so you must point them at what you wish to affect
-to use them.
-Some staves are not affected by the direction they are pointed, though.
-Staves come with multiple magic charges,
-the number being random,
-and when they are used up,
-the staff is just a piece of wood or metal.
-.pp
-The command to use a wand or staff is
-.Cs z
-(zap)
-.sh 2 Rings
-.pp
-Rings are very useful items,
-since they are relatively permanent magic,
-unlike the usually fleeting effects of potions, scrolls, and staves.
-Of course,
-the bad rings are also more powerful.
-Most rings also cause you to use up food more rapidly,
-the rate varying with the type of ring.
-Rings are differentiated by their stone settings.
-The commands to use rings are
-.Cs P
-(put on)
-and
-.Cs R
-(remove).
-.sh 2 Food
-.pp
-Food is necessary to keep you going.
-If you go too long without eating you will faint,
-and eventually die of starvation.
-The command to use food is
-.Cs e
-(eat).
-.sh 1 Options
-.pp
-Due to variations in personal tastes
-and conceptions of the way rogue should do things,
-there are a set of options you can set
-that cause rogue to behave in various different ways.
-.sh 2 "Setting the options"
-.pp
-There are two ways to set the options.
-The first is with the
-.Cs o
-command of rogue;
-the second is with the
-.Cs ROGUEOPTS
-environment variable\**.
-.(f
-\** On Version 6 systems,
-there is no equivalent of the ROGUEOPTS feature.
-.br
-.)f
-.br
-.sh 3 "Using the `o' command"
-.pp
-When you type
-.Cs o
-in rogue,
-it clears the screen
-and displays the current settings for all the options.
-It then places the cursor by the value of the first option
-and waits for you to type.
-You can type a \*R
-which means to go to the next option,
-a
-.Cs \-
-which means to go to the previous option,
-an \*E
-which means to return to the game,
-or you can give the option a value.
-For boolean options this merely involves typing
-.Cs t
-for true or
-.Cs f
-for false.
-For string options,
-type the new value followed by a \*R.
-.sh 3 "Using the ROGUEOPTS variable"
-.pp
-The ROGUEOPTS variable is a string
-containing a comma separated list of initial values
-for the various options.
-Boolean variables can be turned on by listing their name
-or turned off by putting a
-.Cs no
-in front of the name.
-Thus to set up an environment variable so that
-.b jump
-is on,
-.b passgo
-is off,
-and the
-.b name
-is set to \*(lqBlue Meanie\*(rq,
-use the command
-.nf
-.ti +3n
-% setenv ROGUEOPTS "jump,nopassgo,name=Blue Meanie"\**
-.fi
-.(f
-\**
-For those of you who use the Bourne shell sh (1), the commands would be
-.in +3
-.nf
-$ ROGUEOPTS="jump,nopassgo,name=Blue Meanie"
-$ export ROGUEOPTS
-.fi
-.in +0
-.)f
-.sh 2 "Option list"
-.pp
-Here is a list of the options
-and an explanation of what each one is for.
-The default value for each is enclosed in square brackets.
-For character string options,
-input over forty characters will be ignored.
-.ip "\fBjump\fP [\fI\^nojump\^\fP]"
-If this option is set,
-running moves will not be displayed
-until you reach the end of the move.
-This saves considerable cpu and display time.
-This option defaults to
-.i jump
-if you are using a slow terminal.
-.ip "\fBpassgo\fP [\fI\^nopassgo\^\fP]"
-Follow turnings in passageways.
-If you run in a passage
-and you run into stone or a wall,
-rogue will see if it can turn to the right or left.
-If it can only turn one way,
-it will turn that way.
-If it can turn either or neither,
-it will stop.
-This algorithm can sometimes lead to slightly confusing occurrences
-which is why it defaults to \fInopassgo\fP.
-.ip "\fBskull\fP [\fI\^skull\^\fP]"
-Print out the skull at the end if you get killed.
-This is nice but slow, so you can turn it off if you like.
-.ip "\fBname\fP [account name]"
-This is the name of your character.
-It is used if you get on the top ten scorer's list.
-.ip "\fBfruit\fP [\fI\^slime-mold\^\fP]"
-This should hold the name of a fruit that you enjoy eating.
-It is basically a whimsey that rogue uses in a couple of places.
-.ip "\fBfile\fP [\fI\^~/rogue.save\^\fP]"
-The default file name for saving the game.
-If your phone is hung up by accident,
-rogue will automatically save the game in this file.
-The file name may start with the special character
-.Cs ~
-which expands to be your home directory.
-.sh 1 Scoring
-.pp
-Rogue maintains a list
-of the top scoring people or scores on your machine.
-If you score higher than someone else on this list,
-or better your previous score on the list,
-you will be inserted in the proper place
-under your current name.
-.pp
-If you quit the game, you get out with all of your gold intact.
-If, however, you get killed in the Dungeons of Doom,
-your body is forwarded to your next-of-kin,
-along with 90% of your gold;
-ten percent of your gold is kept by the Dungeons' wizard as a fee\**.
-.(f
-\** The Dungeon's wizard is named Wally the Wonder Badger.
-Invocations should be accompanied by a sizable donation.
-.)f
-This should make you consider whether you want to take one last hit
-at that monster and possibly live,
-or quit and thus stop with whatever you have.
-If you quit, you do get all your gold,
-but if you swing and live, you might find more.
-.pp
-If you just want to see what the current top players/games list is,
-you can type
-.ti +1i
-.nf
-% rogue \-s
-.br
-.sh 1 Acknowledgements
-.pp
-Rogue was originally conceived of by Glenn Wichman and Michael Toy.
-Ken Arnold and Michael Toy then smoothed out the user interface,
-and added jillions of new features.
-We would like to thank
-Bob Arnold,
-Michelle Busch,
-Andy Hatcher,
-Kipp Hickman,
-Mark Horton,
-Daniel Jensen,
-Bill Joy,
-Joe Kalash,
-Steve Maurer,
-Marty McNary,
-Jan Miller,
-and
-Scott Nelson
-for their ideas and assistance;
-and also the teeming multitudes
-who graciously ignored work, school, and social life to play rogue
-and send us bugs, complaints, suggestions, and just plain flames.
-And also Mom.
-.pp
-The public domain version of rogue now distributed with Berkeley UNIX
-was written by Timothy Stoehr.
diff --git a/games/rogue/hit.c b/games/rogue/hit.c
deleted file mode 100644
index aef546c..0000000
--- a/games/rogue/hit.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * hit.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-object *fight_monster = 0;
-char hit_message[80] = "";
-
-extern short halluc, blind, cur_level;
-extern short add_strength, ring_exp, r_rings;
-extern boolean being_held, interrupted, wizard, con_mon;
-
-mon_hit(monster)
-object *monster;
-{
- short damage, hit_chance;
- const char *mn;
- float minus;
-
- if (fight_monster && (monster != fight_monster)) {
- fight_monster = 0;
- }
- monster->trow = NO_ROOM;
- if (cur_level >= (AMULET_LEVEL * 2)) {
- hit_chance = 100;
- } else {
- hit_chance = monster->m_hit_chance;
- hit_chance -= (((2 * rogue.exp) + (2 * ring_exp)) - r_rings);
- }
- if (wizard) {
- hit_chance /= 2;
- }
- if (!fight_monster) {
- interrupted = 1;
- }
- mn = mon_name(monster);
-
- if (!rand_percent(hit_chance)) {
- if (!fight_monster) {
- sprintf(hit_message + strlen(hit_message), "the %s misses", mn);
- message(hit_message, 1);
- hit_message[0] = 0;
- }
- return;
- }
- if (!fight_monster) {
- sprintf(hit_message + strlen(hit_message), "the %s hit", mn);
- message(hit_message, 1);
- hit_message[0] = 0;
- }
- if (!(monster->m_flags & STATIONARY)) {
- damage = get_damage(monster->m_damage, 1);
- if (cur_level >= (AMULET_LEVEL * 2)) {
- minus = (float) ((AMULET_LEVEL * 2) - cur_level);
- } else {
- minus = (float) get_armor_class(rogue.armor) * 3.00;
- minus = minus/100.00 * (float) damage;
- }
- damage -= (short) minus;
- } else {
- damage = monster->stationary_damage++;
- }
- if (wizard) {
- damage /= 3;
- }
- if (damage > 0) {
- rogue_damage(damage, monster, 0);
- }
- if (monster->m_flags & SPECIAL_HIT) {
- special_hit(monster);
- }
-}
-
-rogue_hit(monster, force_hit)
-object *monster;
-boolean force_hit;
-{
- short damage, hit_chance;
-
- if (monster) {
- if (check_imitator(monster)) {
- return;
- }
- hit_chance = force_hit ? 100 : get_hit_chance(rogue.weapon);
-
- if (wizard) {
- hit_chance *= 2;
- }
- if (!rand_percent(hit_chance)) {
- if (!fight_monster) {
- (void) strcpy(hit_message, "you miss ");
- }
- goto RET;
- }
- damage = get_weapon_damage(rogue.weapon);
- if (wizard) {
- damage *= 3;
- }
- if (con_mon) {
- s_con_mon(monster);
- }
- if (mon_damage(monster, damage)) { /* still alive? */
- if (!fight_monster) {
- (void) strcpy(hit_message, "you hit ");
- }
- }
-RET: check_gold_seeker(monster);
- wake_up(monster);
- }
-}
-
-rogue_damage(d, monster, other)
-short d;
-object *monster;
-short other;
-{
- if (d >= rogue.hp_current) {
- rogue.hp_current = 0;
- print_stats(STAT_HP);
- killed_by(monster, other);
- }
- if (d > 0) {
- rogue.hp_current -= d;
- print_stats(STAT_HP);
- }
-}
-
-get_damage(ds, r)
-const char *ds;
-boolean r;
-{
- int i = 0, j, n, d, total = 0;
-
- while (ds[i]) {
- n = get_number(ds+i);
- while (ds[i++] != 'd') ;
- d = get_number(ds+i);
- while ((ds[i] != '/') && ds[i]) i++;
-
- for (j = 0; j < n; j++) {
- if (r) {
- total += get_rand(1, d);
- } else {
- total += d;
- }
- }
- if (ds[i] == '/') {
- i++;
- }
- }
- return(total);
-}
-
-get_w_damage(obj)
-const object *obj;
-{
- char new_damage[12];
- int to_hit, damage;
- int i = 0;
-
- if ((!obj) || (obj->what_is != WEAPON)) {
- return(-1);
- }
- to_hit = get_number(obj->damage) + obj->hit_enchant;
- while (obj->damage[i++] != 'd') ;
- damage = get_number(obj->damage + i) + obj->d_enchant;
-
- sprintf(new_damage, "%dd%d", to_hit, damage);
-
- return(get_damage(new_damage, 1));
-}
-
-get_number(s)
-const char *s;
-{
- int i = 0;
- int total = 0;
-
- while ((s[i] >= '0') && (s[i] <= '9')) {
- total = (10 * total) + (s[i] - '0');
- i++;
- }
- return(total);
-}
-
-long
-lget_number(s)
-const char *s;
-{
- short i = 0;
- long total = 0;
-
- while ((s[i] >= '0') && (s[i] <= '9')) {
- total = (10 * total) + (s[i] - '0');
- i++;
- }
- return(total);
-}
-
-to_hit(obj)
-const object *obj;
-{
- if (!obj) {
- return(1);
- }
- return(get_number(obj->damage) + obj->hit_enchant);
-}
-
-damage_for_strength()
-{
- short strength;
-
- strength = rogue.str_current + add_strength;
-
- if (strength <= 6) {
- return(strength-5);
- }
- if (strength <= 14) {
- return(1);
- }
- if (strength <= 17) {
- return(3);
- }
- if (strength <= 18) {
- return(4);
- }
- if (strength <= 20) {
- return(5);
- }
- if (strength <= 21) {
- return(6);
- }
- if (strength <= 30) {
- return(7);
- }
- return(8);
-}
-
-mon_damage(monster, damage)
-object *monster;
-short damage;
-{
- const char *mn;
- short row, col;
-
- monster->hp_to_kill -= damage;
-
- if (monster->hp_to_kill <= 0) {
- row = monster->row;
- col = monster->col;
- dungeon[row][col] &= ~MONSTER;
- mvaddch(row, col, (int) get_dungeon_char(row, col));
-
- fight_monster = 0;
- cough_up(monster);
- mn = mon_name(monster);
- sprintf(hit_message+strlen(hit_message), "defeated the %s", mn);
- message(hit_message, 1);
- hit_message[0] = 0;
- add_exp(monster->kill_exp, 1);
- take_from_pack(monster, &level_monsters);
-
- if (monster->m_flags & HOLDS) {
- being_held = 0;
- }
- free_object(monster);
- return(0);
- }
- return(1);
-}
-
-fight(to_the_death)
-boolean to_the_death;
-{
- short ch, c, d;
- short row, col;
- boolean first_miss = 1;
- short possible_damage;
- object *monster;
-
- while (!is_direction(ch = rgetchar(), &d)) {
- sound_bell();
- if (first_miss) {
- message("direction?", 0);
- first_miss = 0;
- }
- }
- check_message();
- if (ch == CANCEL) {
- return;
- }
- row = rogue.row; col = rogue.col;
- get_dir_rc(d, &row, &col, 0);
-
- c = mvinch(row, col);
- if (((c < 'A') || (c > 'Z')) ||
- (!can_move(rogue.row, rogue.col, row, col))) {
- message("I see no monster there", 0);
- return;
- }
- if (!(fight_monster = object_at(&level_monsters, row, col))) {
- return;
- }
- if (!(fight_monster->m_flags & STATIONARY)) {
- possible_damage = ((get_damage(fight_monster->m_damage, 0) * 2) / 3);
- } else {
- possible_damage = fight_monster->stationary_damage - 1;
- }
- while (fight_monster) {
- (void) one_move_rogue(ch, 0);
- if (((!to_the_death) && (rogue.hp_current <= possible_damage)) ||
- interrupted || (!(dungeon[row][col] & MONSTER))) {
- fight_monster = 0;
- } else {
- monster = object_at(&level_monsters, row, col);
- if (monster != fight_monster) {
- fight_monster = 0;
- }
- }
- }
-}
-
-get_dir_rc(dir, row, col, allow_off_screen)
-short dir;
-short *row, *col;
-short allow_off_screen;
-{
- switch(dir) {
- case LEFT:
- if (allow_off_screen || (*col > 0)) {
- (*col)--;
- }
- break;
- case DOWN:
- if (allow_off_screen || (*row < (DROWS-2))) {
- (*row)++;
- }
- break;
- case UPWARD:
- if (allow_off_screen || (*row > MIN_ROW)) {
- (*row)--;
- }
- break;
- case RIGHT:
- if (allow_off_screen || (*col < (DCOLS-1))) {
- (*col)++;
- }
- break;
- case UPLEFT:
- if (allow_off_screen || ((*row > MIN_ROW) && (*col > 0))) {
- (*row)--;
- (*col)--;
- }
- break;
- case UPRIGHT:
- if (allow_off_screen || ((*row > MIN_ROW) && (*col < (DCOLS-1)))) {
- (*row)--;
- (*col)++;
- }
- break;
- case DOWNRIGHT:
- if (allow_off_screen || ((*row < (DROWS-2)) && (*col < (DCOLS-1)))) {
- (*row)++;
- (*col)++;
- }
- break;
- case DOWNLEFT:
- if (allow_off_screen || ((*row < (DROWS-2)) && (*col > 0))) {
- (*row)++;
- (*col)--;
- }
- break;
- }
-}
-
-get_hit_chance(weapon)
-const object *weapon;
-{
- short hit_chance;
-
- hit_chance = 40;
- hit_chance += 3 * to_hit(weapon);
- hit_chance += (((2 * rogue.exp) + (2 * ring_exp)) - r_rings);
- return(hit_chance);
-}
-
-get_weapon_damage(weapon)
-const object *weapon;
-{
- short damage;
-
- damage = get_w_damage(weapon);
- damage += damage_for_strength();
- damage += ((((rogue.exp + ring_exp) - r_rings) + 1) / 2);
- return(damage);
-}
-
-s_con_mon(monster)
-object *monster;
-{
- if (con_mon) {
- monster->m_flags |= CONFUSED;
- monster->moves_confused += get_rand(12, 22);
- message("the monster appears confused", 0);
- con_mon = 0;
- }
-}
diff --git a/games/rogue/init.c b/games/rogue/init.c
deleted file mode 100644
index 3c214cb..0000000
--- a/games/rogue/init.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * init.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include <stdio.h>
-#include "rogue.h"
-
-char login_name[MAX_OPT_LEN];
-char *nick_name = (char *) 0;
-char *rest_file = 0;
-boolean cant_int = 0;
-boolean did_int = 0;
-boolean score_only;
-boolean init_curses = 0;
-boolean save_is_interactive = 1;
-boolean ask_quit = 1;
-boolean no_skull = 0;
-boolean passgo = 0;
-boolean flush = 1;
-const char *error_file = "rogue.esave";
-const char *byebye_string = "Okay, bye bye!";
-
-extern char *fruit;
-extern char *save_file;
-extern short party_room;
-extern boolean jump;
-
-init(argc, argv)
-int argc;
-char *argv[];
-{
- const char *pn;
- int seed;
-
- pn = md_gln();
- if ((!pn) || (strlen(pn) >= MAX_OPT_LEN)) {
- clean_up("Hey! Who are you?");
- }
- (void) strcpy(login_name, pn);
-
- do_args(argc, argv);
- do_opts();
-
- if (!score_only && !rest_file) {
- printf("Hello %s, just a moment while I dig the dungeon...",
- nick_name);
- fflush(stdout);
- }
-
- initscr();
- if ((LINES < DROWS) || (COLS < DCOLS)) {
- clean_up("must be played on 24 x 80 screen");
- }
- start_window();
- init_curses = 1;
-
- md_heed_signals();
-
- if (score_only) {
- put_scores((object *) 0, 0);
- }
- seed = md_gseed();
- (void) srrandom(seed);
- if (rest_file) {
- restore(rest_file);
- return(1);
- }
- mix_colors();
- get_wand_and_ring_materials();
- make_scroll_titles();
-
- level_objects.next_object = (object *) 0;
- level_monsters.next_monster = (object *) 0;
- player_init();
- ring_stats(0);
- return(0);
-}
-
-player_init()
-{
- object *obj;
-
- rogue.pack.next_object = (object *) 0;
-
- obj = alloc_object();
- get_food(obj, 1);
- (void) add_to_pack(obj, &rogue.pack, 1);
-
- obj = alloc_object(); /* initial armor */
- obj->what_is = ARMOR;
- obj->which_kind = RINGMAIL;
- obj->class = RINGMAIL+2;
- obj->is_protected = 0;
- obj->d_enchant = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
- do_wear(obj);
-
- obj = alloc_object(); /* initial weapons */
- obj->what_is = WEAPON;
- obj->which_kind = MACE;
- obj->damage = "2d3";
- obj->hit_enchant = obj->d_enchant = 1;
- obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
- do_wield(obj);
-
- obj = alloc_object();
- obj->what_is = WEAPON;
- obj->which_kind = BOW;
- obj->damage = "1d2";
- obj->hit_enchant = 1;
- obj->d_enchant = 0;
- obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
-
- obj = alloc_object();
- obj->what_is = WEAPON;
- obj->which_kind = ARROW;
- obj->quantity = get_rand(25, 35);
- obj->damage = "1d2";
- obj->hit_enchant = 0;
- obj->d_enchant = 0;
- obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
-}
-
-clean_up(estr)
-const char *estr;
-{
- if (save_is_interactive) {
- if (init_curses) {
- move(DROWS-1, 0);
- refresh();
- stop_window();
- }
- printf("\n%s\n", estr);
- }
- md_exit(0);
-}
-
-start_window()
-{
- crmode();
- noecho();
-#ifndef BAD_NONL
- nonl();
-#endif
- md_control_keybord(0);
-}
-
-stop_window()
-{
- endwin();
- md_control_keybord(1);
-}
-
-void
-byebye()
-{
- md_ignore_signals();
- if (ask_quit) {
- quit(1);
- } else {
- clean_up(byebye_string);
- }
- md_heed_signals();
-}
-
-void
-onintr()
-{
- md_ignore_signals();
- if (cant_int) {
- did_int = 1;
- } else {
- check_message();
- message("interrupt", 1);
- }
- md_heed_signals();
-}
-
-void
-error_save()
-{
- save_is_interactive = 0;
- save_into_file(error_file);
- clean_up("");
-}
-
-do_args(argc, argv)
-int argc;
-char *argv[];
-{
- short i, j;
-
- for (i = 1; i < argc; i++) {
- if (argv[i][0] == '-') {
- for (j = 1; argv[i][j]; j++) {
- switch(argv[i][j]) {
- case 's':
- score_only = 1;
- break;
- }
- }
- } else {
- rest_file = argv[i];
- }
- }
-}
-
-do_opts()
-{
- char *eptr;
-
- if (eptr = md_getenv("ROGUEOPTS")) {
- for (;;) {
- while ((*eptr) == ' ') {
- eptr++;
- }
- if (!(*eptr)) {
- break;
- }
- if (!strncmp(eptr, "fruit=", 6)) {
- eptr += 6;
- env_get_value(&fruit, eptr, 1);
- } else if (!strncmp(eptr, "file=", 5)) {
- eptr += 5;
- env_get_value(&save_file, eptr, 0);
- } else if (!strncmp(eptr, "jump", 4)) {
- jump = 1;
- } else if (!strncmp(eptr, "name=", 5)) {
- eptr += 5;
- env_get_value(&nick_name, eptr, 0);
- } else if (!strncmp(eptr, "noaskquit", 9)) {
- ask_quit = 0;
- } else if (!strncmp(eptr, "noskull", 7) ||
- !strncmp(eptr,"notomb", 6)) {
- no_skull = 1;
- } else if (!strncmp(eptr, "passgo", 6)) {
- passgo = 1;
- } else if (!strncmp(eptr, "noflush", 7)) {
- flush = 0;
- }
- while ((*eptr) && (*eptr != ',')) {
- eptr++;
- }
- if (!(*(eptr++))) {
- break;
- }
- }
- }
- /* If some strings have not been set through ROGUEOPTS, assign defaults
- * to them so that the options editor has data to work with.
- */
- init_str(&nick_name, login_name);
- init_str(&save_file, "rogue.save");
- init_str(&fruit, "slime-mold");
-}
-
-env_get_value(s, e, add_blank)
-char **s, *e;
-boolean add_blank;
-{
- short i = 0;
- const char *t;
-
- t = e;
-
- while ((*e) && (*e != ',')) {
- if (*e == ':') {
- *e = ';'; /* ':' reserved for score file purposes */
- }
- e++;
- if (++i >= MAX_OPT_LEN) {
- break;
- }
- }
- *s = md_malloc(MAX_OPT_LEN + 2);
- (void) strncpy(*s, t, i);
- if (add_blank) {
- (*s)[i++] = ' ';
- }
- (*s)[i] = '\0';
-}
-
-init_str(str, dflt)
-char **str;
-const char *dflt;
-{
- if (!(*str)) {
- *str = md_malloc(MAX_OPT_LEN + 2);
- (void) strcpy(*str, dflt);
- }
-}
diff --git a/games/rogue/inventory.c b/games/rogue/inventory.c
deleted file mode 100644
index 0923aa1..0000000
--- a/games/rogue/inventory.c
+++ /dev/null
@@ -1,778 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * inventory.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-boolean is_wood[WANDS];
-const char *press_space = " --press space to continue--";
-
-const char *const wand_materials[WAND_MATERIALS] = {
- "steel ",
- "bronze ",
- "gold ",
- "silver ",
- "copper ",
- "nickel ",
- "cobalt ",
- "tin ",
- "iron ",
- "magnesium ",
- "chrome ",
- "carbon ",
- "platinum ",
- "silicon ",
- "titanium ",
-
- "teak ",
- "oak ",
- "cherry ",
- "birch ",
- "pine ",
- "cedar ",
- "redwood ",
- "balsa ",
- "ivory ",
- "walnut ",
- "maple ",
- "mahogany ",
- "elm ",
- "palm ",
- "wooden "
-};
-
-const char *const gems[GEMS] = {
- "diamond ",
- "stibotantalite ",
- "lapi-lazuli ",
- "ruby ",
- "emerald ",
- "sapphire ",
- "amethyst ",
- "quartz ",
- "tiger-eye ",
- "opal ",
- "agate ",
- "turquoise ",
- "pearl ",
- "garnet "
-};
-
-const char *const syllables[MAXSYLLABLES] = {
- "blech ",
- "foo ",
- "barf ",
- "rech ",
- "bar ",
- "blech ",
- "quo ",
- "bloto ",
- "oh ",
- "caca ",
- "blorp ",
- "erp ",
- "festr ",
- "rot ",
- "slie ",
- "snorf ",
- "iky ",
- "yuky ",
- "ooze ",
- "ah ",
- "bahl ",
- "zep ",
- "druhl ",
- "flem ",
- "behil ",
- "arek ",
- "mep ",
- "zihr ",
- "grit ",
- "kona ",
- "kini ",
- "ichi ",
- "tims ",
- "ogr ",
- "oo ",
- "ighr ",
- "coph ",
- "swerr ",
- "mihln ",
- "poxi "
-};
-
-#define COMS 48
-
-struct id_com_s {
- short com_char;
- const char *com_desc;
-};
-
-const struct id_com_s com_id_tab[COMS] = {
- '?', "? prints help",
- 'r', "r read scroll",
- '/', "/ identify object",
- 'e', "e eat food",
- 'h', "h left ",
- 'w', "w wield a weapon",
- 'j', "j down",
- 'W', "W wear armor",
- 'k', "k up",
- 'T', "T take armor off",
- 'l', "l right",
- 'P', "P put on ring",
- 'y', "y up & left",
- 'R', "R remove ring",
- 'u', "u up & right",
- 'd', "d drop object",
- 'b', "b down & left",
- 'c', "c call object",
- 'n', "n down & right",
- '\0', "<SHIFT><dir>: run that way",
- ')', ") print current weapon",
- '\0', "<CTRL><dir>: run till adjacent",
- ']', "] print current armor",
- 'f', "f<dir> fight till death or near death",
- '=', "= print current rings",
- 't', "t<dir> throw something",
- '\001', "^A print Hp-raise average",
- 'm', "m<dir> move onto without picking up",
- 'z', "z<dir> zap a wand in a direction",
- 'o', "o examine/set options",
- '^', "^<dir> identify trap type",
- '\022', "^R redraw screen",
- '&', "& save screen into 'rogue.screen'",
- 's', "s search for trap/secret door",
- '\020', "^P repeat last message",
- '>', "> go down a staircase",
- '\033', "^[ cancel command",
- '<', "< go up a staircase",
- 'S', "S save game",
- '.', ". rest for a turn",
- 'Q', "Q quit",
- ',', ", pick something up",
- '!', "! shell escape",
- 'i', "i inventory",
- 'F', "F<dir> fight till either of you dies",
- 'I', "I inventory single item",
- 'v', "v print version number",
- 'q', "q quaff potion"
-};
-
-extern boolean wizard;
-extern char *m_names[], *more;
-
-inventory(pack, mask)
-const object *pack;
-unsigned short mask;
-{
- object *obj;
- short i = 0, j, maxlen = 0, n;
- char descs[MAX_PACK_COUNT+1][DCOLS];
- short row, col;
-
- obj = pack->next_object;
-
- if (!obj) {
- message("your pack is empty", 0);
- return;
- }
- while (obj) {
- if (obj->what_is & mask) {
- descs[i][0] = ' ';
- descs[i][1] = obj->ichar;
- descs[i][2] = ((obj->what_is & ARMOR) && obj->is_protected)
- ? '}' : ')';
- descs[i][3] = ' ';
- get_desc(obj, descs[i]+4);
- if ((n = strlen(descs[i])) > maxlen) {
- maxlen = n;
- }
- i++;
- }
- obj = obj->next_object;
- }
- (void) strcpy(descs[i++], press_space);
- if (maxlen < 27) maxlen = 27;
- col = DCOLS - (maxlen + 2);
-
- for (row = 0; ((row < i) && (row < DROWS)); row++) {
- if (row > 0) {
- for (j = col; j < DCOLS; j++) {
- descs[row-1][j-col] = mvinch(row, j);
- }
- descs[row-1][j-col] = 0;
- }
- mvaddstr(row, col, descs[row]);
- clrtoeol();
- }
- refresh();
- wait_for_ack();
-
- move(0, 0);
- clrtoeol();
-
- for (j = 1; ((j < i) && (j < DROWS)); j++) {
- mvaddstr(j, col, descs[j-1]);
- }
-}
-
-id_com()
-{
- int ch = 0;
- short i, j, k;
-
- while (ch != CANCEL) {
- check_message();
- message("Character you want help for (* for all):", 0);
-
- refresh();
- ch = getchar();
-
- switch(ch) {
- case LIST:
- {
- char save[(((COMS / 2) + (COMS % 2)) + 1)][DCOLS];
- short rows = (((COMS / 2) + (COMS % 2)) + 1);
- boolean need_two_screens;
-
- if (rows > LINES) {
- need_two_screens = 1;
- rows = LINES;
- }
- k = 0;
-
- for (i = 0; i < rows; i++) {
- for (j = 0; j < DCOLS; j++) {
- save[i][j] = mvinch(i, j);
- }
- }
-MORE:
- for (i = 0; i < rows; i++) {
- move(i, 0);
- clrtoeol();
- }
- for (i = 0; i < (rows-1); i++) {
- if (i < (LINES-1)) {
- if (((i + i) < COMS) && ((i+i+k) < COMS)) {
- mvaddstr(i, 0, com_id_tab[i+i+k].com_desc);
- }
- if (((i + i + 1) < COMS) && ((i+i+k+1) < COMS)) {
- mvaddstr(i, (DCOLS/2),
- com_id_tab[i+i+k+1].com_desc);
- }
- }
- }
- mvaddstr(rows - 1, 0, need_two_screens ? more : press_space);
- refresh();
- wait_for_ack();
-
- if (need_two_screens) {
- k += ((rows-1) * 2);
- need_two_screens = 0;
- goto MORE;
- }
- for (i = 0; i < rows; i++) {
- move(i, 0);
- for (j = 0; j < DCOLS; j++) {
- addch(save[i][j]);
- }
- }
- }
- break;
- default:
- if (!pr_com_id(ch)) {
- if (!pr_motion_char(ch)) {
- check_message();
- message("unknown character", 0);
- }
- }
- ch = CANCEL;
- break;
- }
- }
-}
-
-pr_com_id(ch)
-int ch;
-{
- int i;
-
- if (!get_com_id(&i, ch)) {
- return(0);
- }
- check_message();
- message(com_id_tab[i].com_desc, 0);
- return(1);
-}
-
-get_com_id(index, ch)
-int *index;
-short ch;
-{
- short i;
-
- for (i = 0; i < COMS; i++) {
- if (com_id_tab[i].com_char == ch) {
- *index = i;
- return(1);
- }
- }
- return(0);
-}
-
-pr_motion_char(ch)
-int ch;
-{
- if ( (ch == 'J') ||
- (ch == 'K') ||
- (ch == 'L') ||
- (ch == 'H') ||
- (ch == 'Y') ||
- (ch == 'U') ||
- (ch == 'N') ||
- (ch == 'B') ||
- (ch == '\012') ||
- (ch == '\013') ||
- (ch == '\010') ||
- (ch == '\014') ||
- (ch == '\025') ||
- (ch == '\031') ||
- (ch == '\016') ||
- (ch == '\002')) {
- char until[18], buf[DCOLS];
- int n;
-
- if (ch <= '\031') {
- ch += 96;
- (void) strcpy(until, "until adjascent");
- } else {
- ch += 32;
- until[0] = '\0';
- }
- (void) get_com_id(&n, ch);
- sprintf(buf, "run %s %s", com_id_tab[n].com_desc + 8, until);
- check_message();
- message(buf, 0);
- return(1);
- } else {
- return(0);
- }
-}
-
-mix_colors()
-{
- short i, j, k;
- char *t;
-
- for (i = 0; i <= 32; i++) {
- j = get_rand(0, (POTIONS - 1));
- k = get_rand(0, (POTIONS - 1));
- t = id_potions[j].title;
- id_potions[j].title = id_potions[k].title;
- id_potions[k].title = t;
- }
-}
-
-make_scroll_titles()
-{
- short i, j, n;
- short sylls, s;
-
- for (i = 0; i < SCROLS; i++) {
- sylls = get_rand(2, 5);
- (void) strcpy(id_scrolls[i].title, "'");
-
- for (j = 0; j < sylls; j++) {
- s = get_rand(1, (MAXSYLLABLES-1));
- (void) strcat(id_scrolls[i].title, syllables[s]);
- }
- n = strlen(id_scrolls[i].title);
- (void) strcpy(id_scrolls[i].title+(n-1), "' ");
- }
-}
-
-get_desc(obj, desc)
-const object *obj;
-char *desc;
-{
- const char *item_name;
- struct id *id_table;
- char more_info[32];
- short i;
-
- if (obj->what_is == AMULET) {
- (void) strcpy(desc, "the amulet of Yendor ");
- return;
- }
- item_name = name_of(obj);
-
- if (obj->what_is == GOLD) {
- sprintf(desc, "%d pieces of gold", obj->quantity);
- return;
- }
-
- if (obj->what_is != ARMOR) {
- if (obj->quantity == 1) {
- (void) strcpy(desc, "a ");
- } else {
- sprintf(desc, "%d ", obj->quantity);
- }
- }
- if (obj->what_is == FOOD) {
- if (obj->which_kind == RATION) {
- if (obj->quantity > 1) {
- sprintf(desc, "%d rations of ", obj->quantity);
- } else {
- (void) strcpy(desc, "some ");
- }
- } else {
- (void) strcpy(desc, "a ");
- }
- (void) strcat(desc, item_name);
- goto ANA;
- }
- id_table = get_id_table(obj);
-
- if (wizard) {
- goto ID;
- }
- if (obj->what_is & (WEAPON | ARMOR | WAND | RING)) {
- goto CHECK;
- }
-
- switch(id_table[obj->which_kind].id_status) {
- case UNIDENTIFIED:
-CHECK:
- switch(obj->what_is) {
- case SCROL:
- (void) strcat(desc, item_name);
- (void) strcat(desc, "entitled: ");
- (void) strcat(desc, id_table[obj->which_kind].title);
- break;
- case POTION:
- (void) strcat(desc, id_table[obj->which_kind].title);
- (void) strcat(desc, item_name);
- break;
- case WAND:
- case RING:
- if (obj->identified ||
- (id_table[obj->which_kind].id_status == IDENTIFIED)) {
- goto ID;
- }
- if (id_table[obj->which_kind].id_status == CALLED) {
- goto CALL;
- }
- (void) strcat(desc, id_table[obj->which_kind].title);
- (void) strcat(desc, item_name);
- break;
- case ARMOR:
- if (obj->identified) {
- goto ID;
- }
- (void) strcpy(desc, id_table[obj->which_kind].title);
- break;
- case WEAPON:
- if (obj->identified) {
- goto ID;
- }
- (void) strcat(desc, name_of(obj));
- break;
- }
- break;
- case CALLED:
-CALL: switch(obj->what_is) {
- case SCROL:
- case POTION:
- case WAND:
- case RING:
- (void) strcat(desc, item_name);
- (void) strcat(desc, "called ");
- (void) strcat(desc, id_table[obj->which_kind].title);
- break;
- }
- break;
- case IDENTIFIED:
-ID: switch(obj->what_is) {
- case SCROL:
- case POTION:
- (void) strcat(desc, item_name);
- (void) strcat(desc, id_table[obj->which_kind].real);
- break;
- case RING:
- if (wizard || obj->identified) {
- if ((obj->which_kind == DEXTERITY) ||
- (obj->which_kind == ADD_STRENGTH)) {
- sprintf(more_info, "%s%d ", ((obj->class > 0) ? "+" : ""),
- obj->class);
- (void) strcat(desc, more_info);
- }
- }
- (void) strcat(desc, item_name);
- (void) strcat(desc, id_table[obj->which_kind].real);
- break;
- case WAND:
- (void) strcat(desc, item_name);
- (void) strcat(desc, id_table[obj->which_kind].real);
- if (wizard || obj->identified) {
- sprintf(more_info, "[%d]", obj->class);
- (void) strcat(desc, more_info);
- }
- break;
- case ARMOR:
- sprintf(desc, "%s%d ", ((obj->d_enchant >= 0) ? "+" : ""),
- obj->d_enchant);
- (void) strcat(desc, id_table[obj->which_kind].title);
- sprintf(more_info, "[%d] ", get_armor_class(obj));
- (void) strcat(desc, more_info);
- break;
- case WEAPON:
- sprintf(desc+strlen(desc), "%s%d,%s%d ",
- ((obj->hit_enchant >= 0) ? "+" : ""), obj->hit_enchant,
- ((obj->d_enchant >= 0) ? "+" : ""), obj->d_enchant);
- (void) strcat(desc, name_of(obj));
- break;
- }
- break;
- }
-ANA:
- if (!strncmp(desc, "a ", 2)) {
- if (is_vowel(desc[2])) {
- for (i = strlen(desc) + 1; i > 1; i--) {
- desc[i] = desc[i-1];
- }
- desc[1] = 'n';
- }
- }
- if (obj->in_use_flags & BEING_WIELDED) {
- (void) strcat(desc, "in hand");
- } else if (obj->in_use_flags & BEING_WORN) {
- (void) strcat(desc, "being worn");
- } else if (obj->in_use_flags & ON_LEFT_HAND) {
- (void) strcat(desc, "on left hand");
- } else if (obj->in_use_flags & ON_RIGHT_HAND) {
- (void) strcat(desc, "on right hand");
- }
-}
-
-get_wand_and_ring_materials()
-{
- short i, j;
- boolean used[WAND_MATERIALS];
-
- for (i = 0; i < WAND_MATERIALS; i++) {
- used[i] = 0;
- }
- for (i = 0; i < WANDS; i++) {
- do {
- j = get_rand(0, WAND_MATERIALS-1);
- } while (used[j]);
- used[j] = 1;
- (void) strcpy(id_wands[i].title, wand_materials[j]);
- is_wood[i] = (j > MAX_METAL);
- }
- for (i = 0; i < GEMS; i++) {
- used[i] = 0;
- }
- for (i = 0; i < RINGS; i++) {
- do {
- j = get_rand(0, GEMS-1);
- } while (used[j]);
- used[j] = 1;
- (void) strcpy(id_rings[i].title, gems[j]);
- }
-}
-
-single_inv(ichar)
-short ichar;
-{
- short ch;
- char desc[DCOLS];
- object *obj;
-
- ch = ichar ? ichar : pack_letter("inventory what?", ALL_OBJECTS);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- desc[0] = ch;
- desc[1] = ((obj->what_is & ARMOR) && obj->is_protected) ? '}' : ')';
- desc[2] = ' ';
- desc[3] = 0;
- get_desc(obj, desc+3);
- message(desc, 0);
-}
-
-struct id *
-get_id_table(obj)
-const object *obj;
-{
- switch(obj->what_is) {
- case SCROL:
- return(id_scrolls);
- case POTION:
- return(id_potions);
- case WAND:
- return(id_wands);
- case RING:
- return(id_rings);
- case WEAPON:
- return(id_weapons);
- case ARMOR:
- return(id_armors);
- }
- return((struct id *) 0);
-}
-
-inv_armor_weapon(is_weapon)
-boolean is_weapon;
-{
- if (is_weapon) {
- if (rogue.weapon) {
- single_inv(rogue.weapon->ichar);
- } else {
- message("not wielding anything", 0);
- }
- } else {
- if (rogue.armor) {
- single_inv(rogue.armor->ichar);
- } else {
- message("not wearing anything", 0);
- }
- }
-}
-
-id_type()
-{
- const char *id;
- int ch;
- char buf[DCOLS];
-
- message("what do you want identified?", 0);
-
- ch = rgetchar();
-
- if ((ch >= 'A') && (ch <= 'Z')) {
- id = m_names[ch-'A'];
- } else if (ch < 32) {
- check_message();
- return;
- } else {
- switch(ch) {
- case '@':
- id = "you";
- break;
- case '%':
- id = "staircase";
- break;
- case '^':
- id = "trap";
- break;
- case '+':
- id = "door";
- break;
- case '-':
- case '|':
- id = "wall of a room";
- break;
- case '.':
- id = "floor";
- break;
- case '#':
- id = "passage";
- break;
- case ' ':
- id = "solid rock";
- break;
- case '=':
- id = "ring";
- break;
- case '?':
- id = "scroll";
- break;
- case '!':
- id = "potion";
- break;
- case '/':
- id = "wand or staff";
- break;
- case ')':
- id = "weapon";
- break;
- case ']':
- id = "armor";
- break;
- case '*':
- id = "gold";
- break;
- case ':':
- id = "food";
- break;
- case ',':
- id = "the Amulet of Yendor";
- break;
- default:
- id = "unknown character";
- break;
- }
- }
- check_message();
- sprintf(buf, "'%c': %s", ch, id);
- message(buf, 0);
-}
diff --git a/games/rogue/level.c b/games/rogue/level.c
deleted file mode 100644
index 1fb0e05..0000000
--- a/games/rogue/level.c
+++ /dev/null
@@ -1,885 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)level.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * level.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-#define swap(x,y) {t = x; x = y; y = t;}
-
-short cur_level = 0;
-short max_level = 1;
-short cur_room;
-const char *new_level_message = 0;
-short party_room = NO_ROOM;
-short r_de;
-
-const long level_points[MAX_EXP_LEVEL] = {
- 10L,
- 20L,
- 40L,
- 80L,
- 160L,
- 320L,
- 640L,
- 1300L,
- 2600L,
- 5200L,
- 10000L,
- 20000L,
- 40000L,
- 80000L,
- 160000L,
- 320000L,
- 1000000L,
- 3333333L,
- 6666666L,
- MAX_EXP,
- 99900000L
-};
-
-short random_rooms[MAXROOMS] = {3, 7, 5, 2, 0, 6, 1, 4, 8};
-
-extern boolean being_held, wizard, detect_monster;
-extern boolean see_invisible;
-extern short bear_trap, levitate, extra_hp, less_hp, cur_room;
-
-make_level()
-{
- short i, j;
- short must_1, must_2, must_3;
- boolean big_room;
-
- if (cur_level < LAST_DUNGEON) {
- cur_level++;
- }
- if (cur_level > max_level) {
- max_level = cur_level;
- }
- must_1 = get_rand(0, 5);
-
- switch(must_1) {
- case 0:
- must_1 = 0;
- must_2 = 1;
- must_3 = 2;
- break;
- case 1:
- must_1 = 3;
- must_2 = 4;
- must_3 = 5;
- break;
- case 2:
- must_1 = 6;
- must_2 = 7;
- must_3 = 8;
- break;
- case 3:
- must_1 = 0;
- must_2 = 3;
- must_3 = 6;
- break;
- case 4:
- must_1 = 1;
- must_2 = 4;
- must_3 = 7;
- break;
- case 5:
- must_1 = 2;
- must_2 = 5;
- must_3 = 8;
- break;
- }
- if (rand_percent(8)) {
- party_room = 0;
- }
- big_room = ((party_room != NO_ROOM) && rand_percent(1));
- if (big_room) {
- make_room(BIG_ROOM, 0, 0, 0);
- } else {
- for (i = 0; i < MAXROOMS; i++) {
- make_room(i, must_1, must_2, must_3);
- }
- }
- if (!big_room) {
- add_mazes();
-
- mix_random_rooms();
-
- for (j = 0; j < MAXROOMS; j++) {
-
- i = random_rooms[j];
-
- if (i < (MAXROOMS-1)) {
- (void) connect_rooms(i, i+1);
- }
- if (i < (MAXROOMS-3)) {
- (void) connect_rooms(i, i+3);
- }
- if (i < (MAXROOMS-2)) {
- if (rooms[i+1].is_room & R_NOTHING) {
- if (connect_rooms(i, i+2)) {
- rooms[i+1].is_room = R_CROSS;
- }
- }
- }
- if (i < (MAXROOMS-6)) {
- if (rooms[i+3].is_room & R_NOTHING) {
- if (connect_rooms(i, i+6)) {
- rooms[i+3].is_room = R_CROSS;
- }
- }
- }
- if (is_all_connected()) {
- break;
- }
- }
- fill_out_level();
- }
- if (!has_amulet() && (cur_level >= AMULET_LEVEL)) {
- put_amulet();
- }
-}
-
-make_room(rn, r1, r2, r3)
-short rn, r1, r2, r3;
-{
- short left_col, right_col, top_row, bottom_row;
- short width, height;
- short row_offset, col_offset;
- short i, j, ch;
-
- switch(rn) {
- case 0:
- left_col = 0;
- right_col = COL1-1;
- top_row = MIN_ROW;
- bottom_row = ROW1-1;
- break;
- case 1:
- left_col = COL1+1;
- right_col = COL2-1;
- top_row = MIN_ROW;
- bottom_row = ROW1-1;
- break;
- case 2:
- left_col = COL2+1;
- right_col = DCOLS-1;
- top_row = MIN_ROW;
- bottom_row = ROW1-1;
- break;
- case 3:
- left_col = 0;
- right_col = COL1-1;
- top_row = ROW1+1;
- bottom_row = ROW2-1;
- break;
- case 4:
- left_col = COL1+1;
- right_col = COL2-1;
- top_row = ROW1+1;
- bottom_row = ROW2-1;
- break;
- case 5:
- left_col = COL2+1;
- right_col = DCOLS-1;
- top_row = ROW1+1;
- bottom_row = ROW2-1;
- break;
- case 6:
- left_col = 0;
- right_col = COL1-1;
- top_row = ROW2+1;
- bottom_row = DROWS - 2;
- break;
- case 7:
- left_col = COL1+1;
- right_col = COL2-1;
- top_row = ROW2+1;
- bottom_row = DROWS - 2;
- break;
- case 8:
- left_col = COL2+1;
- right_col = DCOLS-1;
- top_row = ROW2+1;
- bottom_row = DROWS - 2;
- break;
- case BIG_ROOM:
- top_row = get_rand(MIN_ROW, MIN_ROW+5);
- bottom_row = get_rand(DROWS-7, DROWS-2);
- left_col = get_rand(0, 10);;
- right_col = get_rand(DCOLS-11, DCOLS-1);
- rn = 0;
- goto B;
- }
- height = get_rand(4, (bottom_row - top_row + 1));
- width = get_rand(7, (right_col - left_col - 2));
-
- row_offset = get_rand(0, ((bottom_row - top_row) - height + 1));
- col_offset = get_rand(0, ((right_col - left_col) - width + 1));
-
- top_row += row_offset;
- bottom_row = top_row + height - 1;
-
- left_col += col_offset;
- right_col = left_col + width - 1;
-
- if ((rn != r1) && (rn != r2) && (rn != r3) && rand_percent(40)) {
- goto END;
- }
-B:
- rooms[rn].is_room = R_ROOM;
-
- for (i = top_row; i <= bottom_row; i++) {
- for (j = left_col; j <= right_col; j++) {
- if ((i == top_row) || (i == bottom_row)) {
- ch = HORWALL;
- } else if ( ((i != top_row) && (i != bottom_row)) &&
- ((j == left_col) || (j == right_col))) {
- ch = VERTWALL;
- } else {
- ch = FLOOR;
- }
- dungeon[i][j] = ch;
- }
- }
-END:
- rooms[rn].top_row = top_row;
- rooms[rn].bottom_row = bottom_row;
- rooms[rn].left_col = left_col;
- rooms[rn].right_col = right_col;
-}
-
-connect_rooms(room1, room2)
-short room1, room2;
-{
- short row1, col1, row2, col2, dir;
-
- if ((!(rooms[room1].is_room & (R_ROOM | R_MAZE))) ||
- (!(rooms[room2].is_room & (R_ROOM | R_MAZE)))) {
- return(0);
- }
- if (same_row(room1, room2) &&
- (rooms[room1].left_col > rooms[room2].right_col)) {
- put_door(&rooms[room1], LEFT, &row1, &col1);
- put_door(&rooms[room2], RIGHT, &row2, &col2);
- dir = LEFT;
- } else if (same_row(room1, room2) &&
- (rooms[room2].left_col > rooms[room1].right_col)) {
- put_door(&rooms[room1], RIGHT, &row1, &col1);
- put_door(&rooms[room2], LEFT, &row2, &col2);
- dir = RIGHT;
- } else if (same_col(room1, room2) &&
- (rooms[room1].top_row > rooms[room2].bottom_row)) {
- put_door(&rooms[room1], UPWARD, &row1, &col1);
- put_door(&rooms[room2], DOWN, &row2, &col2);
- dir = UPWARD;
- } else if (same_col(room1, room2) &&
- (rooms[room2].top_row > rooms[room1].bottom_row)) {
- put_door(&rooms[room1], DOWN, &row1, &col1);
- put_door(&rooms[room2], UPWARD, &row2, &col2);
- dir = DOWN;
- } else {
- return(0);
- }
-
- do {
- draw_simple_passage(row1, col1, row2, col2, dir);
- } while (rand_percent(4));
-
- rooms[room1].doors[dir/2].oth_room = room2;
- rooms[room1].doors[dir/2].oth_row = row2;
- rooms[room1].doors[dir/2].oth_col = col2;
-
- rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_room = room1;
- rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_row = row1;
- rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_col = col1;
- return(1);
-}
-
-clear_level()
-{
- short i, j;
-
- for (i = 0; i < MAXROOMS; i++) {
- rooms[i].is_room = R_NOTHING;
- for (j = 0; j < 4; j++) {
- rooms[i].doors[j].oth_room = NO_ROOM;
- }
- }
-
- for (i = 0; i < MAX_TRAPS; i++) {
- traps[i].trap_type = NO_TRAP;
- }
- for (i = 0; i < DROWS; i++) {
- for (j = 0; j < DCOLS; j++) {
- dungeon[i][j] = NOTHING;
- }
- }
- detect_monster = see_invisible = 0;
- being_held = bear_trap = 0;
- party_room = NO_ROOM;
- rogue.row = rogue.col = -1;
- clear();
-}
-
-put_door(rm, dir, row, col)
-room *rm;
-short dir;
-short *row, *col;
-{
- short wall_width;
-
- wall_width = (rm->is_room & R_MAZE) ? 0 : 1;
-
- switch(dir) {
- case UPWARD:
- case DOWN:
- *row = ((dir == UPWARD) ? rm->top_row : rm->bottom_row);
- do {
- *col = get_rand(rm->left_col+wall_width,
- rm->right_col-wall_width);
- } while (!(dungeon[*row][*col] & (HORWALL | TUNNEL)));
- break;
- case RIGHT:
- case LEFT:
- *col = (dir == LEFT) ? rm->left_col : rm->right_col;
- do {
- *row = get_rand(rm->top_row+wall_width,
- rm->bottom_row-wall_width);
- } while (!(dungeon[*row][*col] & (VERTWALL | TUNNEL)));
- break;
- }
- if (rm->is_room & R_ROOM) {
- dungeon[*row][*col] = DOOR;
- }
- if ((cur_level > 2) && rand_percent(HIDE_PERCENT)) {
- dungeon[*row][*col] |= HIDDEN;
- }
- rm->doors[dir/2].door_row = *row;
- rm->doors[dir/2].door_col = *col;
-}
-
-draw_simple_passage(row1, col1, row2, col2, dir)
-short row1, col1, row2, col2, dir;
-{
- short i, middle, t;
-
- if ((dir == LEFT) || (dir == RIGHT)) {
- if (col1 > col2) {
- swap(row1, row2);
- swap(col1, col2);
- }
- middle = get_rand(col1+1, col2-1);
- for (i = col1+1; i != middle; i++) {
- dungeon[row1][i] = TUNNEL;
- }
- for (i = row1; i != row2; i += (row1 > row2) ? -1 : 1) {
- dungeon[i][middle] = TUNNEL;
- }
- for (i = middle; i != col2; i++) {
- dungeon[row2][i] = TUNNEL;
- }
- } else {
- if (row1 > row2) {
- swap(row1, row2);
- swap(col1, col2);
- }
- middle = get_rand(row1+1, row2-1);
- for (i = row1+1; i != middle; i++) {
- dungeon[i][col1] = TUNNEL;
- }
- for (i = col1; i != col2; i += (col1 > col2) ? -1 : 1) {
- dungeon[middle][i] = TUNNEL;
- }
- for (i = middle; i != row2; i++) {
- dungeon[i][col2] = TUNNEL;
- }
- }
- if (rand_percent(HIDE_PERCENT)) {
- hide_boxed_passage(row1, col1, row2, col2, 1);
- }
-}
-
-same_row(room1, room2)
-{
- return((room1 / 3) == (room2 / 3));
-}
-
-same_col(room1, room2)
-{
- return((room1 % 3) == (room2 % 3));
-}
-
-add_mazes()
-{
- short i, j;
- short start;
- short maze_percent;
-
- if (cur_level > 1) {
- start = get_rand(0, (MAXROOMS-1));
- maze_percent = (cur_level * 5) / 4;
-
- if (cur_level > 15) {
- maze_percent += cur_level;
- }
- for (i = 0; i < MAXROOMS; i++) {
- j = ((start + i) % MAXROOMS);
- if (rooms[j].is_room & R_NOTHING) {
- if (rand_percent(maze_percent)) {
- rooms[j].is_room = R_MAZE;
- make_maze(get_rand(rooms[j].top_row+1, rooms[j].bottom_row-1),
- get_rand(rooms[j].left_col+1, rooms[j].right_col-1),
- rooms[j].top_row, rooms[j].bottom_row,
- rooms[j].left_col, rooms[j].right_col);
- hide_boxed_passage(rooms[j].top_row, rooms[j].left_col,
- rooms[j].bottom_row, rooms[j].right_col,
- get_rand(0, 2));
- }
- }
- }
- }
-}
-
-fill_out_level()
-{
- short i, rn;
-
- mix_random_rooms();
-
- r_de = NO_ROOM;
-
- for (i = 0; i < MAXROOMS; i++) {
- rn = random_rooms[i];
- if ((rooms[rn].is_room & R_NOTHING) ||
- ((rooms[rn].is_room & R_CROSS) && coin_toss())) {
- fill_it(rn, 1);
- }
- }
- if (r_de != NO_ROOM) {
- fill_it(r_de, 0);
- }
-}
-
-fill_it(rn, do_rec_de)
-int rn;
-boolean do_rec_de;
-{
- short i, tunnel_dir, door_dir, drow, dcol;
- short target_room, rooms_found = 0;
- short srow, scol, t;
- static short offsets[4] = {-1, 1, 3, -3};
- boolean did_this = 0;
-
- for (i = 0; i < 10; i++) {
- srow = get_rand(0, 3);
- scol = get_rand(0, 3);
- t = offsets[srow];
- offsets[srow] = offsets[scol];
- offsets[scol] = t;
- }
- for (i = 0; i < 4; i++) {
-
- target_room = rn + offsets[i];
-
- if (((target_room < 0) || (target_room >= MAXROOMS)) ||
- (!(same_row(rn,target_room) || same_col(rn,target_room))) ||
- (!(rooms[target_room].is_room & (R_ROOM | R_MAZE)))) {
- continue;
- }
- if (same_row(rn, target_room)) {
- tunnel_dir = (rooms[rn].left_col < rooms[target_room].left_col) ?
- RIGHT : LEFT;
- } else {
- tunnel_dir = (rooms[rn].top_row < rooms[target_room].top_row) ?
- DOWN : UPWARD;
- }
- door_dir = ((tunnel_dir + 4) % DIRS);
- if (rooms[target_room].doors[door_dir/2].oth_room != NO_ROOM) {
- continue;
- }
- if (((!do_rec_de) || did_this) ||
- (!mask_room(rn, &srow, &scol, TUNNEL))) {
- srow = (rooms[rn].top_row + rooms[rn].bottom_row) / 2;
- scol = (rooms[rn].left_col + rooms[rn].right_col) / 2;
- }
- put_door(&rooms[target_room], door_dir, &drow, &dcol);
- rooms_found++;
- draw_simple_passage(srow, scol, drow, dcol, tunnel_dir);
- rooms[rn].is_room = R_DEADEND;
- dungeon[srow][scol] = TUNNEL;
-
- if ((i < 3) && (!did_this)) {
- did_this = 1;
- if (coin_toss()) {
- continue;
- }
- }
- if ((rooms_found < 2) && do_rec_de) {
- recursive_deadend(rn, offsets, srow, scol);
- }
- break;
- }
-}
-
-recursive_deadend(rn, offsets, srow, scol)
-short rn;
-const short *offsets;
-short srow, scol;
-{
- short i, de;
- short drow, dcol, tunnel_dir;
-
- rooms[rn].is_room = R_DEADEND;
- dungeon[srow][scol] = TUNNEL;
-
- for (i = 0; i < 4; i++) {
- de = rn + offsets[i];
- if (((de < 0) || (de >= MAXROOMS)) ||
- (!(same_row(rn, de) || same_col(rn, de)))) {
- continue;
- }
- if (!(rooms[de].is_room & R_NOTHING)) {
- continue;
- }
- drow = (rooms[de].top_row + rooms[de].bottom_row) / 2;
- dcol = (rooms[de].left_col + rooms[de].right_col) / 2;
- if (same_row(rn, de)) {
- tunnel_dir = (rooms[rn].left_col < rooms[de].left_col) ?
- RIGHT : LEFT;
- } else {
- tunnel_dir = (rooms[rn].top_row < rooms[de].top_row) ?
- DOWN : UPWARD;
- }
- draw_simple_passage(srow, scol, drow, dcol, tunnel_dir);
- r_de = de;
- recursive_deadend(de, offsets, drow, dcol);
- }
-}
-
-boolean
-mask_room(rn, row, col, mask)
-short rn;
-short *row, *col;
-unsigned short mask;
-{
- short i, j;
-
- for (i = rooms[rn].top_row; i <= rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col; j <= rooms[rn].right_col; j++) {
- if (dungeon[i][j] & mask) {
- *row = i;
- *col = j;
- return(1);
- }
- }
- }
- return(0);
-}
-
-make_maze(r, c, tr, br, lc, rc)
-short r, c, tr, br, lc, rc;
-{
- char dirs[4];
- short i, t;
-
- dirs[0] = UPWARD;
- dirs[1] = DOWN;
- dirs[2] = LEFT;
- dirs[3] = RIGHT;
-
- dungeon[r][c] = TUNNEL;
-
- if (rand_percent(20)) {
- for (i = 0; i < 10; i++) {
- short t1, t2;
-
- t1 = get_rand(0, 3);
- t2 = get_rand(0, 3);
-
- swap(dirs[t1], dirs[t2]);
- }
- }
- for (i = 0; i < 4; i++) {
- switch(dirs[i]) {
- case UPWARD:
- if (((r-1) >= tr) &&
- (dungeon[r-1][c] != TUNNEL) &&
- (dungeon[r-1][c-1] != TUNNEL) &&
- (dungeon[r-1][c+1] != TUNNEL) &&
- (dungeon[r-2][c] != TUNNEL)) {
- make_maze((r-1), c, tr, br, lc, rc);
- }
- break;
- case DOWN:
- if (((r+1) <= br) &&
- (dungeon[r+1][c] != TUNNEL) &&
- (dungeon[r+1][c-1] != TUNNEL) &&
- (dungeon[r+1][c+1] != TUNNEL) &&
- (dungeon[r+2][c] != TUNNEL)) {
- make_maze((r+1), c, tr, br, lc, rc);
- }
- break;
- case LEFT:
- if (((c-1) >= lc) &&
- (dungeon[r][c-1] != TUNNEL) &&
- (dungeon[r-1][c-1] != TUNNEL) &&
- (dungeon[r+1][c-1] != TUNNEL) &&
- (dungeon[r][c-2] != TUNNEL)) {
- make_maze(r, (c-1), tr, br, lc, rc);
- }
- break;
- case RIGHT:
- if (((c+1) <= rc) &&
- (dungeon[r][c+1] != TUNNEL) &&
- (dungeon[r-1][c+1] != TUNNEL) &&
- (dungeon[r+1][c+1] != TUNNEL) &&
- (dungeon[r][c+2] != TUNNEL)) {
- make_maze(r, (c+1), tr, br, lc, rc);
- }
- break;
- }
- }
-}
-
-hide_boxed_passage(row1, col1, row2, col2, n)
-short row1, col1, row2, col2, n;
-{
- short i, j, t;
- short row, col, row_cut, col_cut;
- short h, w;
-
- if (cur_level > 2) {
- if (row1 > row2) {
- swap(row1, row2);
- }
- if (col1 > col2) {
- swap(col1, col2);
- }
- h = row2 - row1;
- w = col2 - col1;
-
- if ((w >= 5) || (h >= 5)) {
- row_cut = ((h >= 2) ? 1 : 0);
- col_cut = ((w >= 2) ? 1 : 0);
-
- for (i = 0; i < n; i++) {
- for (j = 0; j < 10; j++) {
- row = get_rand(row1 + row_cut, row2 - row_cut);
- col = get_rand(col1 + col_cut, col2 - col_cut);
- if (dungeon[row][col] == TUNNEL) {
- dungeon[row][col] |= HIDDEN;
- break;
- }
- }
- }
- }
- }
-}
-
-put_player(nr)
-short nr; /* try not to put in this room */
-{
- short rn = nr, misses;
- short row, col;
-
- for (misses = 0; ((misses < 2) && (rn == nr)); misses++) {
- gr_row_col(&row, &col, (FLOOR | TUNNEL | OBJECT | STAIRS));
- rn = get_room_number(row, col);
- }
- rogue.row = row;
- rogue.col = col;
-
- if (dungeon[rogue.row][rogue.col] & TUNNEL) {
- cur_room = PASSAGE;
- } else {
- cur_room = rn;
- }
- if (cur_room != PASSAGE) {
- light_up_room(cur_room);
- } else {
- light_passage(rogue.row, rogue.col);
- }
- rn = get_room_number(rogue.row, rogue.col);
- wake_room(rn, 1, rogue.row, rogue.col);
- if (new_level_message) {
- message(new_level_message, 0);
- new_level_message = 0;
- }
- mvaddch(rogue.row, rogue.col, rogue.fchar);
-}
-
-drop_check()
-{
- if (wizard) {
- return(1);
- }
- if (dungeon[rogue.row][rogue.col] & STAIRS) {
- if (levitate) {
- message("you're floating in the air!", 0);
- return(0);
- }
- return(1);
- }
- message("I see no way down", 0);
- return(0);
-}
-
-check_up()
-{
- if (!wizard) {
- if (!(dungeon[rogue.row][rogue.col] & STAIRS)) {
- message("I see no way up", 0);
- return(0);
- }
- if (!has_amulet()) {
- message("your way is magically blocked", 0);
- return(0);
- }
- }
- new_level_message = "you feel a wrenching sensation in your gut";
- if (cur_level == 1) {
- win();
- } else {
- cur_level -= 2;
- return(1);
- }
- return(0);
-}
-
-add_exp(e, promotion)
-int e;
-boolean promotion;
-{
- char mbuf[40];
- short new_exp;
- short i, hp;
-
- rogue.exp_points += e;
-
- if (rogue.exp_points >= level_points[rogue.exp-1]) {
- new_exp = get_exp_level(rogue.exp_points);
- if (rogue.exp_points > MAX_EXP) {
- rogue.exp_points = MAX_EXP + 1;
- }
- for (i = rogue.exp+1; i <= new_exp; i++) {
- sprintf(mbuf, "welcome to level %d", i);
- message(mbuf, 0);
- if (promotion) {
- hp = hp_raise();
- rogue.hp_current += hp;
- rogue.hp_max += hp;
- }
- rogue.exp = i;
- print_stats(STAT_HP | STAT_EXP);
- }
- } else {
- print_stats(STAT_EXP);
- }
-}
-
-get_exp_level(e)
-long e;
-{
- short i;
-
- for (i = 0; i < (MAX_EXP_LEVEL - 1); i++) {
- if (level_points[i] > e) {
- break;
- }
- }
- return(i+1);
-}
-
-hp_raise()
-{
- int hp;
-
- hp = (wizard ? 10 : get_rand(3, 10));
- return(hp);
-}
-
-show_average_hp()
-{
- char mbuf[80];
- float real_average;
- float effective_average;
-
- if (rogue.exp == 1) {
- real_average = effective_average = 0.00;
- } else {
- real_average = (float)
- ((rogue.hp_max - extra_hp - INIT_HP) + less_hp) / (rogue.exp - 1);
- effective_average = (float) (rogue.hp_max - INIT_HP) / (rogue.exp - 1);
-
- }
- sprintf(mbuf, "R-Hp: %.2f, E-Hp: %.2f (!: %d, V: %d)", real_average,
- effective_average, extra_hp, less_hp);
- message(mbuf, 0);
-}
-
-mix_random_rooms()
-{
- short i, t;
- short x, y;
-
- for (i = 0; i < (3 * MAXROOMS); i++) {
- do {
- x = get_rand(0, (MAXROOMS-1));
- y = get_rand(0, (MAXROOMS-1));
- } while (x == y);
- swap(random_rooms[x], random_rooms[y]);
- }
-}
diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c
deleted file mode 100644
index 055056a..0000000
--- a/games/rogue/machdep.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * machdep.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-/* Included in this file are all system dependent routines. Extensive use
- * of #ifdef's will be used to compile the appropriate code on each system:
- *
- * UNIX: all UNIX systems.
- * UNIX_BSD4_2: UNIX BSD 4.2 and later, UTEK, (4.1 BSD too?)
- * UNIX_SYSV: UNIX system V
- * UNIX_V7: UNIX version 7
- *
- * All UNIX code should be included between the single "#ifdef UNIX" at the
- * top of this file, and the "#endif" at the bottom.
- *
- * To change a routine to include a new UNIX system, simply #ifdef the
- * existing routine, as in the following example:
- *
- * To make a routine compatible with UNIX system 5, change the first
- * function to the second:
- *
- * md_function()
- * {
- * code;
- * }
- *
- * md_function()
- * {
- * #ifdef UNIX_SYSV
- * sys5code;
- * #else
- * code;
- * #endif
- * }
- *
- * Appropriate variations of this are of course acceptible.
- * The use of "#elseif" is discouraged because of non-portability.
- * If the correct #define doesn't exist, "UNIX_SYSV" in this case, make it up
- * and insert it in the list at the top of the file. Alter the CFLAGS
- * in you Makefile appropriately.
- *
- */
-
-#ifdef UNIX
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include <pwd.h>
-#include <time.h>
-
-#ifdef UNIX_BSD4_2
-#include <sys/time.h>
-#include <sgtty.h>
-#endif
-
-#ifdef UNIX_SYSV
-#include <time.h>
-#include <termio.h>
-#endif
-
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "rogue.h"
-#include "pathnames.h"
-
-/* md_slurp:
- *
- * This routine throws away all keyboard input that has not
- * yet been read. It is used to get rid of input that the user may have
- * typed-ahead.
- *
- * This function is not necessary, so it may be stubbed. The might cause
- * message-line output to flash by because the game has continued to read
- * input without waiting for the user to read the message. Not such a
- * big deal.
- */
-
-md_slurp()
-{
- (void)fpurge(stdin);
-}
-
-/* md_control_keyboard():
- *
- * This routine is much like md_cbreak_no_echo_nonl() below. It sets up the
- * keyboard for appropriate input. Specifically, it prevents the tty driver
- * from stealing characters. For example, ^Y is needed as a command
- * character, but the tty driver intercepts it for another purpose. Any
- * such behavior should be stopped. This routine could be avoided if
- * we used RAW mode instead of CBREAK. But RAW mode does not allow the
- * generation of keyboard signals, which the program uses.
- *
- * The parameter 'mode' when true, indicates that the keyboard should
- * be set up to play rogue. When false, it should be restored if
- * necessary.
- *
- * This routine is not strictly necessary and may be stubbed. This may
- * cause certain command characters to be unavailable.
- */
-
-md_control_keybord(mode)
-boolean mode;
-{
- static boolean called_before = 0;
-#ifdef UNIX_BSD4_2
- static struct ltchars ltc_orig;
- static struct tchars tc_orig;
- struct ltchars ltc_temp;
- struct tchars tc_temp;
-#endif
-#ifdef UNIX_SYSV
- static struct termio _oldtty;
- struct termio _tty;
-#endif
-
- if (!called_before) {
- called_before = 1;
-#ifdef UNIX_BSD4_2
- ioctl(0, TIOCGETC, &tc_orig);
- ioctl(0, TIOCGLTC, &ltc_orig);
-#endif
-#ifdef UNIX_SYSV
- ioctl(0, TCGETA, &_oldtty);
-#endif
- }
-#ifdef UNIX_BSD4_2
- ltc_temp = ltc_orig;
- tc_temp = tc_orig;
-#endif
-#ifdef UNIX_SYSV
- _tty = _oldtty;
-#endif
-
- if (!mode) {
-#ifdef UNIX_BSD4_2
- ltc_temp.t_suspc = ltc_temp.t_dsuspc = -1;
- ltc_temp.t_rprntc = ltc_temp.t_flushc = -1;
- ltc_temp.t_werasc = ltc_temp.t_lnextc = -1;
- tc_temp.t_startc = tc_temp.t_stopc = -1;
-#endif
-#ifdef UNIX_SYSV
- _tty.c_cc[VSWTCH] = CNSWTCH;
-#endif
- }
-#ifdef UNIX_BSD4_2
- ioctl(0, TIOCSETC, &tc_temp);
- ioctl(0, TIOCSLTC, &ltc_temp);
-#endif
-#ifdef UNIX_SYSV
- ioctl(0, TCSETA, &_tty);
-#endif
-}
-
-/* md_heed_signals():
- *
- * This routine tells the program to call particular routines when
- * certain interrupts/events occur:
- *
- * SIGINT: call onintr() to interrupt fight with monster or long rest.
- * SIGQUIT: call byebye() to check for game termination.
- * SIGHUP: call error_save() to save game when terminal hangs up.
- *
- * On VMS, SIGINT and SIGQUIT correspond to ^C and ^Y.
- *
- * This routine is not strictly necessary and can be stubbed. This will
- * mean that the game cannot be interrupted properly with keyboard
- * input, this is not usually critical.
- */
-
-md_heed_signals()
-{
- signal(SIGINT, onintr);
- signal(SIGQUIT, byebye);
- signal(SIGHUP, error_save);
-}
-
-/* md_ignore_signals():
- *
- * This routine tells the program to completely ignore the events mentioned
- * in md_heed_signals() above. The event handlers will later be turned on
- * by a future call to md_heed_signals(), so md_heed_signals() and
- * md_ignore_signals() need to work together.
- *
- * This function should be implemented or the user risks interrupting
- * critical sections of code, which could cause score file, or saved-game
- * file, corruption.
- */
-
-md_ignore_signals()
-{
- signal(SIGQUIT, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
-}
-
-/* md_get_file_id():
- *
- * This function returns an integer that uniquely identifies the specified
- * file. It need not check for the file's existence. In UNIX, the inode
- * number is used.
- *
- * This function is used to identify saved-game files.
- */
-
-int
-md_get_file_id(fname)
-const char *fname;
-{
- struct stat sbuf;
-
- if (stat(fname, &sbuf)) {
- return(-1);
- }
- return((int) sbuf.st_ino);
-}
-
-/* md_link_count():
- *
- * This routine returns the number of hard links to the specified file.
- *
- * This function is not strictly necessary. On systems without hard links
- * this routine can be stubbed by just returning 1.
- */
-
-int
-md_link_count(fname)
-const char *fname;
-{
- struct stat sbuf;
-
- stat(fname, &sbuf);
- return((int) sbuf.st_nlink);
-}
-
-/* md_gct(): (Get Current Time)
- *
- * This function returns the current year, month(1-12), day(1-31), hour(0-23),
- * minute(0-59), and second(0-59). This is used for identifying the time
- * at which a game is saved.
- *
- * This function is not strictly necessary. It can be stubbed by returning
- * zeros instead of the correct year, month, etc. If your operating
- * system doesn't provide all of the time units requested here, then you
- * can provide only those that it does, and return zeros for the others.
- * If you cannot provide good time values, then users may be able to copy
- * saved-game files and play them.
- */
-
-md_gct(rt_buf)
-struct rogue_time *rt_buf;
-{
- struct tm *t, *localtime();
- time_t seconds;
-
- time(&seconds);
- t = localtime(&seconds);
-
- rt_buf->year = t->tm_year;
- rt_buf->month = t->tm_mon + 1;
- rt_buf->day = t->tm_mday;
- rt_buf->hour = t->tm_hour;
- rt_buf->minute = t->tm_min;
- rt_buf->second = t->tm_sec;
-}
-
-/* md_gfmt: (Get File Modification Time)
- *
- * This routine returns a file's date of last modification in the same format
- * as md_gct() above.
- *
- * This function is not strictly necessary. It is used to see if saved-game
- * files have been modified since they were saved. If you have stubbed the
- * routine md_gct() above by returning constant values, then you may do
- * exactly the same here.
- * Or if md_gct() is implemented correctly, but your system does not provide
- * file modification dates, you may return some date far in the past so
- * that the program will never know that a saved-game file being modified.
- * You may also do this if you wish to be able to restore games from
- * saved-games that have been modified.
- */
-
-md_gfmt(fname, rt_buf)
-const char *fname;
-struct rogue_time *rt_buf;
-{
- struct stat sbuf;
- time_t seconds;
- struct tm *t;
-
- stat(fname, &sbuf);
- seconds = sbuf.st_mtime;
- t = localtime(&seconds);
-
- rt_buf->year = t->tm_year;
- rt_buf->month = t->tm_mon + 1;
- rt_buf->day = t->tm_mday;
- rt_buf->hour = t->tm_hour;
- rt_buf->minute = t->tm_min;
- rt_buf->second = t->tm_sec;
-}
-
-/* md_df: (Delete File)
- *
- * This function deletes the specified file, and returns true (1) if the
- * operation was successful. This is used to delete saved-game files
- * after restoring games from them.
- *
- * Again, this function is not strictly necessary, and can be stubbed
- * by simply returning 1. In this case, saved-game files will not be
- * deleted and can be replayed.
- */
-
-boolean
-md_df(fname)
-const char *fname;
-{
- if (unlink(fname)) {
- return(0);
- }
- return(1);
-}
-
-/* md_gln: (Get login name)
- *
- * This routine returns the login name of the user. This string is
- * used mainly for identifying users in score files.
- *
- * A dummy string may be returned if you are unable to implement this
- * function, but then the score file would only have one name in it.
- */
-
-const char *
-md_gln()
-{
- struct passwd *p;
- char *s;
-
- if ((s = getlogin()))
- return s;
- if (!(p = getpwuid(getuid())))
- return((char *)NULL);
- return(p->pw_name);
-}
-
-/* md_sleep:
- *
- * This routine causes the game to pause for the specified number of
- * seconds.
- *
- * This routine is not particularly necessary at all. It is used for
- * delaying execution, which is useful to this program at some times.
- */
-
-md_sleep(nsecs)
-int nsecs;
-{
- (void) sleep(nsecs);
-}
-
-/* md_getenv()
- *
- * This routine gets certain values from the user's environment. These
- * values are strings, and each string is identified by a name. The names
- * of the values needed, and their use, is as follows:
- *
- * ROGUEOPTS
- * A string containing the various game options. This need not be
- * defined.
- * HOME
- * The user's home directory. This is only used when the user specifies
- * '~' as the first character of a saved-game file. This string need
- * not be defined.
- * SHELL
- * The user's favorite shell. If not found, "/bin/sh" is assumed.
- *
- */
-
-char *
-md_getenv(name)
-const char *name;
-{
- char *value;
-
- value = getenv(name);
-
- return(value);
-}
-
-/* md_malloc()
- *
- * This routine allocates, and returns a pointer to, the specified number
- * of bytes. This routines absolutely MUST be implemented for your
- * particular system or the program will not run at all. Return zero
- * when no more memory can be allocated.
- */
-
-char *
-md_malloc(n)
-int n;
-{
- char *t;
-
- t = malloc(n);
- return(t);
-}
-
-/* md_gseed() (Get Seed)
- *
- * This function returns a seed for the random number generator (RNG). This
- * seed causes the RNG to begin generating numbers at some point in it's
- * sequence. Without a random seed, the RNG will generate the same set
- * of numbers, and every game will start out exactly the same way. A good
- * number to use is the process id, given by getpid() on most UNIX systems.
- *
- * You need to find some single random integer, such as:
- * process id.
- * current time (minutes + seconds) returned from md_gct(), if implemented.
- *
- * It will not help to return "get_rand()" or "rand()" or the return value of
- * any pseudo-RNG. If you don't have a random number, you can just return 1,
- * but this means your games will ALWAYS start the same way, and will play
- * exactly the same way given the same input.
- */
-
-md_gseed()
-{
- time_t seconds;
-
- time(&seconds);
- return((int) seconds);
-}
-
-/* md_exit():
- *
- * This function causes the program to discontinue execution and exit.
- * This function must be implemented or the program will continue to
- * hang when it should quit.
- */
-
-md_exit(status)
-int status;
-{
- exit(status);
-}
-
-/* md_lock():
- *
- * This function is intended to give the user exclusive access to the score
- * file. It does so by flock'ing the score file. The full path name of the
- * score file should be defined for any particular site in rogue.h. The
- * constants _PATH_SCOREFILE defines this file name.
- *
- * When the parameter 'l' is non-zero (true), a lock is requested. Otherwise
- * the lock is released.
- */
-
-md_lock(l)
-boolean l;
-{
- static int fd;
- short tries;
-
- if (l) {
- if ((fd = open(_PATH_SCOREFILE, O_RDONLY)) < 1) {
- message("cannot lock score file", 0);
- return;
- }
- for (tries = 0; tries < 5; tries++)
- if (!flock(fd, LOCK_EX|LOCK_NB))
- return;
- } else {
- (void)flock(fd, LOCK_NB);
- (void)close(fd);
- }
-}
-
-/* md_shell():
- *
- * This function spawns a shell for the user to use. When this shell is
- * terminated, the game continues. Since this program may often be run
- * setuid to gain access to privileged files, care is taken that the shell
- * is run with the user's REAL user id, and not the effective user id.
- * The effective user id is restored after the shell completes.
- */
-
-md_shell(shell)
-const char *shell;
-{
- long w[2];
-
- if (!fork()) {
- /* revoke */
- setgid(getgid());
- execl(shell, shell, (char *)0);
- }
- wait(w);
-}
-
-#endif /* UNIX */
diff --git a/games/rogue/main.c b/games/rogue/main.c
deleted file mode 100644
index 781c618..0000000
--- a/games/rogue/main.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * main.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-extern short party_room;
-
-main(argc, argv)
-int argc;
-char *argv[];
-{
- if (init(argc, argv)) { /* restored game */
- goto PL;
- }
-
- for (;;) {
- clear_level();
- make_level();
- put_objects();
- put_stairs();
- add_traps();
- put_mons();
- put_player(party_room);
- print_stats(STAT_ALL);
-PL:
- play_level();
- free_stuff(&level_objects);
- free_stuff(&level_monsters);
- }
-}
diff --git a/games/rogue/message.c b/games/rogue/message.c
deleted file mode 100644
index 3758a54..0000000
--- a/games/rogue/message.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * message.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include <stdio.h>
-#include "rogue.h"
-
-char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""};
-short msg_col = 0, imsg = -1;
-boolean msg_cleared = 1, rmsg = 0;
-char hunger_str[8] = "";
-const char *more = "-more-";
-
-extern boolean cant_int, did_int, interrupted, save_is_interactive, flush;
-extern short add_strength;
-extern short cur_level;
-
-message(msg, intrpt)
-const char *msg;
-boolean intrpt;
-{
- cant_int = 1;
-
- if (!save_is_interactive) {
- return;
- }
- if (intrpt) {
- interrupted = 1;
- if (flush)
- md_slurp();
- }
-
- if (!msg_cleared) {
- mvaddstr(MIN_ROW-1, msg_col, more);
- refresh();
- wait_for_ack();
- check_message();
- }
- if (!rmsg) {
- imsg = (imsg + 1) % NMESSAGES;
- (void) strcpy(msgs[imsg], msg);
- }
- mvaddstr(MIN_ROW-1, 0, msg);
- addch(' ');
- refresh();
- msg_cleared = 0;
- msg_col = strlen(msg);
-
- cant_int = 0;
-
- if (did_int) {
- did_int = 0;
- onintr();
- }
-}
-
-remessage(c)
-short c;
-{
- if (imsg != -1) {
- check_message();
- rmsg = 1;
- while (c > imsg) {
- c -= NMESSAGES;
- }
- message(msgs[((imsg - c) % NMESSAGES)], 0);
- rmsg = 0;
- move(rogue.row, rogue.col);
- refresh();
- }
-}
-
-check_message()
-{
- if (msg_cleared) {
- return;
- }
- move(MIN_ROW-1, 0);
- clrtoeol();
- refresh();
- msg_cleared = 1;
-}
-
-get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo)
-const char *prompt, *insert;
-char *buf;
-const char *if_cancelled;
-boolean add_blank;
-boolean do_echo;
-{
- short ch;
- short i = 0, n;
-
- message(prompt, 0);
- n = strlen(prompt);
-
- if (insert[0]) {
- mvaddstr(0, n + 1, insert);
- (void) strcpy(buf, insert);
- i = strlen(insert);
- move(0, (n + i + 1));
- refresh();
- }
-
- while (((ch = rgetchar()) != '\r') && (ch != '\n') && (ch != CANCEL)) {
- if ((ch >= ' ') && (ch <= '~') && (i < MAX_TITLE_LENGTH-2)) {
- if ((ch != ' ') || (i > 0)) {
- buf[i++] = ch;
- if (do_echo) {
- addch(ch);
- }
- }
- }
- if ((ch == '\b') && (i > 0)) {
- if (do_echo) {
- mvaddch(0, i + n, ' ');
- move(MIN_ROW-1, i+n);
- }
- i--;
- }
- refresh();
- }
- check_message();
- if (add_blank) {
- buf[i++] = ' ';
- } else {
- while ((i > 0) && (buf[i-1] == ' ')) {
- i--;
- }
- }
-
- buf[i] = 0;
-
- if ((ch == CANCEL) || (i == 0) || ((i == 1) && add_blank)) {
- if (if_cancelled) {
- message(if_cancelled, 0);
- }
- return(0);
- }
- return(i);
-}
-
-rgetchar()
-{
- int ch;
-
- for(;;) {
- ch = getchar();
-
- switch(ch) {
- case '\022':
- wrefresh(curscr);
- break;
-#ifdef UNIX_BSD4_2
- case '\032':
- printf("%s", CL);
- fflush(stdout);
- tstp();
- break;
-#endif
- case '&':
- save_screen();
- break;
- default:
- return(ch);
- }
- }
-}
-/*
-Level: 99 Gold: 999999 Hp: 999(999) Str: 99(99) Arm: 99 Exp: 21/10000000 Hungry
-0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5
-*/
-
-print_stats(stat_mask)
-int stat_mask;
-{
- char buf[16];
- boolean label;
- int row = DROWS - 1;
-
- label = (stat_mask & STAT_LABEL) ? 1 : 0;
-
- if (stat_mask & STAT_LEVEL) {
- if (label) {
- mvaddstr(row, 0, "Level: ");
- }
- /* max level taken care of in make_level() */
- sprintf(buf, "%d", cur_level);
- mvaddstr(row, 7, buf);
- pad(buf, 2);
- }
- if (stat_mask & STAT_GOLD) {
- if (label) {
- mvaddstr(row, 10, "Gold: ");
- }
- if (rogue.gold > MAX_GOLD) {
- rogue.gold = MAX_GOLD;
- }
- sprintf(buf, "%ld", rogue.gold);
- mvaddstr(row, 16, buf);
- pad(buf, 6);
- }
- if (stat_mask & STAT_HP) {
- if (label) {
- mvaddstr(row, 23, "Hp: ");
- }
- if (rogue.hp_max > MAX_HP) {
- rogue.hp_current -= (rogue.hp_max - MAX_HP);
- rogue.hp_max = MAX_HP;
- }
- sprintf(buf, "%d(%d)", rogue.hp_current, rogue.hp_max);
- mvaddstr(row, 27, buf);
- pad(buf, 8);
- }
- if (stat_mask & STAT_STRENGTH) {
- if (label) {
- mvaddstr(row, 36, "Str: ");
- }
- if (rogue.str_max > MAX_STRENGTH) {
- rogue.str_current -= (rogue.str_max - MAX_STRENGTH);
- rogue.str_max = MAX_STRENGTH;
- }
- sprintf(buf, "%d(%d)", (rogue.str_current + add_strength),
- rogue.str_max);
- mvaddstr(row, 41, buf);
- pad(buf, 6);
- }
- if (stat_mask & STAT_ARMOR) {
- if (label) {
- mvaddstr(row, 48, "Arm: ");
- }
- if (rogue.armor && (rogue.armor->d_enchant > MAX_ARMOR)) {
- rogue.armor->d_enchant = MAX_ARMOR;
- }
- sprintf(buf, "%d", get_armor_class(rogue.armor));
- mvaddstr(row, 53, buf);
- pad(buf, 2);
- }
- if (stat_mask & STAT_EXP) {
- if (label) {
- mvaddstr(row, 56, "Exp: ");
- }
- if (rogue.exp_points > MAX_EXP) {
- rogue.exp_points = MAX_EXP;
- }
- if (rogue.exp > MAX_EXP_LEVEL) {
- rogue.exp = MAX_EXP_LEVEL;
- }
- sprintf(buf, "%d/%ld", rogue.exp, rogue.exp_points);
- mvaddstr(row, 61, buf);
- pad(buf, 11);
- }
- if (stat_mask & STAT_HUNGER) {
- mvaddstr(row, 73, hunger_str);
- clrtoeol();
- }
- refresh();
-}
-
-pad(s, n)
-const char *s;
-short n;
-{
- short i;
-
- for (i = strlen(s); i < n; i++) {
- addch(' ');
- }
-}
-
-save_screen()
-{
- FILE *fp;
- short i, j;
- char buf[DCOLS+2];
- boolean found_non_blank;
-
- if ((fp = fopen("rogue.screen", "w")) != NULL) {
- for (i = 0; i < DROWS; i++) {
- found_non_blank = 0;
- for (j = (DCOLS - 1); j >= 0; j--) {
- buf[j] = mvinch(i, j);
- if (!found_non_blank) {
- if ((buf[j] != ' ') || (j == 0)) {
- buf[j + ((j == 0) ? 0 : 1)] = 0;
- found_non_blank = 1;
- }
- }
- }
- fputs(buf, fp);
- putc('\n', fp);
- }
- fclose(fp);
- } else {
- sound_bell();
- }
-}
-
-sound_bell()
-{
- putchar(7);
- fflush(stdout);
-}
-
-boolean
-is_digit(ch)
-short ch;
-{
- return((ch >= '0') && (ch <= '9'));
-}
-
-r_index(str, ch, last)
-const char *str;
-int ch;
-boolean last;
-{
- int i = 0;
-
- if (last) {
- for (i = strlen(str) - 1; i >= 0; i--) {
- if (str[i] == ch) {
- return(i);
- }
- }
- } else {
- for (i = 0; str[i]; i++) {
- if (str[i] == ch) {
- return(i);
- }
- }
- }
- return(-1);
-}
diff --git a/games/rogue/monster.c b/games/rogue/monster.c
deleted file mode 100644
index e436f86..0000000
--- a/games/rogue/monster.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * monster.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-object level_monsters;
-boolean mon_disappeared;
-
-const char *const m_names[] = {
- "aquator",
- "bat",
- "centaur",
- "dragon",
- "emu",
- "venus fly-trap",
- "griffin",
- "hobgoblin",
- "ice monster",
- "jabberwock",
- "kestrel",
- "leprechaun",
- "medusa",
- "nymph",
- "orc",
- "phantom",
- "quagga",
- "rattlesnake",
- "snake",
- "troll",
- "black unicorn",
- "vampire",
- "wraith",
- "xeroc",
- "yeti",
- "zombie"
-};
-
-object mon_tab[MONSTERS] = {
- {(ASLEEP|WAKENS|WANDERS|RUSTS),"0d0",25,'A',20,9,18,100,0,0,0,0,0},
- {(ASLEEP|WANDERS|FLITS|FLIES),"1d3",10,'B',2,1,8,60,0,0,0,0,0},
- {(ASLEEP|WANDERS),"3d3/2d5",32,'C',15,7,16,85,0,10,0,0,0},
- {(ASLEEP|WAKENS|FLAMES),"4d6/4d9",145,'D',5000,21,126,100,0,90,0,0,0},
- {(ASLEEP|WAKENS),"1d3",11,'E',2,1,7,65,0,0,0,0,0},
- {(HOLDS|STATIONARY),"5d5",73,'F',91,12,126,80,0,0,0,0,0},
- {(ASLEEP|WAKENS|WANDERS|FLIES),"5d5/5d5",115,'G',
- 2000,20,126,85,0,10,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"1d3/1d2",15,'H',3,1,10,67,0,0,0,0,0},
- {(ASLEEP|FREEZES),"0d0",15,'I',5,2,11,68,0,0,0,0,0},
- {(ASLEEP|WANDERS),"3d10/4d5",132,'J',3000,21,126,100,0,0,0,0,0},
- {(ASLEEP|WAKENS|WANDERS|FLIES),"1d4",10,'K',2,1,6,60,0,0,0,0,0},
- {(ASLEEP|STEALS_GOLD),"0d0",25,'L',21,6,16,75,0,0,0,0,0},
- {(ASLEEP|WAKENS|WANDERS|CONFUSES),"4d4/3d7",97,'M',
- 250,18,126,85,0,25,0,0,0},
- {(ASLEEP|STEALS_ITEM),"0d0",25,'N',39,10,19,75,0,100,0,0,0},
- {(ASLEEP|WANDERS|WAKENS|SEEKS_GOLD),"1d6",25,'O',5,4,13,70,0,10,0,0,0},
- {(ASLEEP|INVISIBLE|WANDERS|FLITS),"5d4",76,'P',120,15,24,80,0,50,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"3d5",30,'Q',20,8,17,78,0,20,0,0,0},
- {(ASLEEP|WAKENS|WANDERS|STINGS),"2d5",19,'R',10,3,12,70,0,0,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"1d3",8,'S',2,1,9,50,0,0,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"4d6/1d4",75,'T',125,13,22,75,0,33,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"4d10",90,'U',
- 200,17,26,85,0,33,0,0,0},
- {(ASLEEP|WAKENS|WANDERS|DRAINS_LIFE),"1d14/1d4",55,'V',
- 350,19,126,85,0,18,0,0,0},
- {(ASLEEP|WANDERS|DROPS_LEVEL),"2d8",45,'W',55,14,23,75,0,0,0,0,0},
- {(ASLEEP|IMITATES),"4d6",42,'X',110,16,25,75,0,0,0,0,0},
- {(ASLEEP|WANDERS),"3d6",35,'Y',50,11,20,80,0,20,0,0,0},
- {(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0,0,0,0}
-};
-
-extern short cur_level;
-extern short cur_room, party_room;
-extern short blind, halluc, haste_self;
-extern boolean detect_monster, see_invisible, r_see_invisible;
-extern short stealthy;
-
-put_mons()
-{
- short i;
- short n;
- object *monster;
- short row, col;
-
- n = get_rand(4, 6);
-
- for (i = 0; i < n; i++) {
- monster = gr_monster((object *) 0, 0);
- if ((monster->m_flags & WANDERS) && coin_toss()) {
- wake_up(monster);
- }
- gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
- put_m_at(row, col, monster);
- }
-}
-
-object *
-gr_monster(monster, mn)
-object *monster;
-int mn;
-{
- if (!monster) {
- monster = alloc_object();
-
- for (;;) {
- mn = get_rand(0, MONSTERS-1);
- if ((cur_level >= mon_tab[mn].first_level) &&
- (cur_level <= mon_tab[mn].last_level)) {
- break;
- }
- }
- }
- *monster = mon_tab[mn];
- if (monster->m_flags & IMITATES) {
- monster->disguise = gr_obj_char();
- }
- if (cur_level > (AMULET_LEVEL + 2)) {
- monster->m_flags |= HASTED;
- }
- monster->trow = NO_ROOM;
- return(monster);
-}
-
-mv_mons()
-{
- object *monster, *next_monster, *test_mons;
- boolean flew;
-
- if (haste_self % 2) {
- return;
- }
-
- monster = level_monsters.next_monster;
-
- while (monster) {
- next_monster = monster->next_monster;
- mon_disappeared = 0;
- if (monster->m_flags & HASTED) {
- mv_1_monster(monster, rogue.row, rogue.col);
- if (mon_disappeared) {
- goto NM;
- }
- } else if (monster->m_flags & SLOWED) {
- monster->slowed_toggle = !monster->slowed_toggle;
- if (monster->slowed_toggle) {
- goto NM;
- }
- }
- if ((monster->m_flags & CONFUSED) && move_confused(monster)) {
- goto NM;
- }
- flew = 0;
- if ( (monster->m_flags & FLIES) &&
- !(monster->m_flags & NAPPING) &&
- !mon_can_go(monster, rogue.row, rogue.col)) {
- flew = 1;
- mv_1_monster(monster, rogue.row, rogue.col);
- if (mon_disappeared) {
- goto NM;
- }
- }
- if (!(flew && mon_can_go(monster, rogue.row, rogue.col))) {
- mv_1_monster(monster, rogue.row, rogue.col);
- }
-NM: test_mons = level_monsters.next_monster;
- monster = NULL;
- while(test_mons)
- {
- if(next_monster == test_mons)
- {
- monster = next_monster;
- break;
- }
- test_mons = test_mons->next_monster;
- }
- }
-}
-
-party_monsters(rn, n)
-int rn, n;
-{
- short i, j;
- short row, col;
- object *monster;
- boolean found;
-
- n += n;
-
- for (i = 0; i < MONSTERS; i++) {
- mon_tab[i].first_level -= (cur_level % 3);
- }
- for (i = 0; i < n; i++) {
- if (no_room_for_monster(rn)) {
- break;
- }
- for (j = found = 0; ((!found) && (j < 250)); j++) {
- row = get_rand(rooms[rn].top_row+1,
- rooms[rn].bottom_row-1);
- col = get_rand(rooms[rn].left_col+1,
- rooms[rn].right_col-1);
- if ((!(dungeon[row][col] & MONSTER)) &&
- (dungeon[row][col] & (FLOOR | TUNNEL))) {
- found = 1;
- }
- }
- if (found) {
- monster = gr_monster((object *) 0, 0);
- if (!(monster->m_flags & IMITATES)) {
- monster->m_flags |= WAKENS;
- }
- put_m_at(row, col, monster);
- }
- }
- for (i = 0; i < MONSTERS; i++) {
- mon_tab[i].first_level += (cur_level % 3);
- }
-}
-
-gmc_row_col(row, col)
-int row, col;
-{
- object *monster;
-
- if (monster = object_at(&level_monsters, row, col)) {
- if ((!(detect_monster || see_invisible || r_see_invisible) &&
- (monster->m_flags & INVISIBLE)) || blind) {
- return(monster->trail_char);
- }
- if (monster->m_flags & IMITATES) {
- return(monster->disguise);
- }
- return(monster->m_char);
- } else {
- return('&'); /* BUG if this ever happens */
- }
-}
-
-gmc(monster)
-object *monster;
-{
- if ((!(detect_monster || see_invisible || r_see_invisible) &&
- (monster->m_flags & INVISIBLE))
- || blind) {
- return(monster->trail_char);
- }
- if (monster->m_flags & IMITATES) {
- return(monster->disguise);
- }
- return(monster->m_char);
-}
-
-mv_1_monster(monster, row, col)
-object *monster;
-short row, col;
-{
- short i, n;
- boolean tried[6];
-
- if (monster->m_flags & ASLEEP) {
- if (monster->m_flags & NAPPING) {
- if (--monster->nap_length <= 0) {
- monster->m_flags &= (~(NAPPING | ASLEEP));
- }
- return;
- }
- if ((monster->m_flags & WAKENS) &&
- rogue_is_around(monster->row, monster->col) &&
- rand_percent(((stealthy > 0) ?
- (WAKE_PERCENT / (STEALTH_FACTOR + stealthy)) :
- WAKE_PERCENT))) {
- wake_up(monster);
- }
- return;
- } else if (monster->m_flags & ALREADY_MOVED) {
- monster->m_flags &= (~ALREADY_MOVED);
- return;
- }
- if ((monster->m_flags & FLITS) && flit(monster)) {
- return;
- }
- if ((monster->m_flags & STATIONARY) &&
- (!mon_can_go(monster, rogue.row, rogue.col))) {
- return;
- }
- if (monster->m_flags & FREEZING_ROGUE) {
- return;
- }
- if ((monster->m_flags & CONFUSES) && m_confuse(monster)) {
- return;
- }
- if (mon_can_go(monster, rogue.row, rogue.col)) {
- mon_hit(monster);
- return;
- }
- if ((monster->m_flags & FLAMES) && flame_broil(monster)) {
- return;
- }
- if ((monster->m_flags & SEEKS_GOLD) && seek_gold(monster)) {
- return;
- }
- if ((monster->trow == monster->row) &&
- (monster->tcol == monster->col)) {
- monster->trow = NO_ROOM;
- } else if (monster->trow != NO_ROOM) {
- row = monster->trow;
- col = monster->tcol;
- }
- if (monster->row > row) {
- row = monster->row - 1;
- } else if (monster->row < row) {
- row = monster->row + 1;
- }
- if ((dungeon[row][monster->col] & DOOR) &&
- mtry(monster, row, monster->col)) {
- return;
- }
- if (monster->col > col) {
- col = monster->col - 1;
- } else if (monster->col < col) {
- col = monster->col + 1;
- }
- if ((dungeon[monster->row][col] & DOOR) &&
- mtry(monster, monster->row, col)) {
- return;
- }
- if (mtry(monster, row, col)) {
- return;
- }
-
- for (i = 0; i <= 5; i++) tried[i] = 0;
-
- for (i = 0; i < 6; i++) {
-NEXT_TRY: n = get_rand(0, 5);
- switch(n) {
- case 0:
- if (!tried[n] && mtry(monster, row, monster->col-1)) {
- goto O;
- }
- break;
- case 1:
- if (!tried[n] && mtry(monster, row, monster->col)) {
- goto O;
- }
- break;
- case 2:
- if (!tried[n] && mtry(monster, row, monster->col+1)) {
- goto O;
- }
- break;
- case 3:
- if (!tried[n] && mtry(monster, monster->row-1, col)) {
- goto O;
- }
- break;
- case 4:
- if (!tried[n] && mtry(monster, monster->row, col)) {
- goto O;
- }
- break;
- case 5:
- if (!tried[n] && mtry(monster, monster->row+1, col)) {
- goto O;
- }
- break;
- }
- if (!tried[n]) {
- tried[n] = 1;
- } else {
- goto NEXT_TRY;
- }
- }
-O:
- if ((monster->row == monster->o_row) && (monster->col == monster->o_col)) {
- if (++(monster->o) > 4) {
- if ((monster->trow == NO_ROOM) &&
- (!mon_sees(monster, rogue.row, rogue.col))) {
- monster->trow = get_rand(1, (DROWS - 2));
- monster->tcol = get_rand(0, (DCOLS - 1));
- } else {
- monster->trow = NO_ROOM;
- monster->o = 0;
- }
- }
- } else {
- monster->o_row = monster->row;
- monster->o_col = monster->col;
- monster->o = 0;
- }
-}
-
-mtry(monster, row, col)
-object *monster;
-short row, col;
-{
- if (mon_can_go(monster, row, col)) {
- move_mon_to(monster, row, col);
- return(1);
- }
- return(0);
-}
-
-move_mon_to(monster, row, col)
-object *monster;
-short row, col;
-{
- short c;
- int mrow, mcol;
-
- mrow = monster->row;
- mcol = monster->col;
-
- dungeon[mrow][mcol] &= ~MONSTER;
- dungeon[row][col] |= MONSTER;
-
- c = mvinch(mrow, mcol);
-
- if ((c >= 'A') && (c <= 'Z')) {
- if (!detect_monster) {
- mvaddch(mrow, mcol, monster->trail_char);
- } else {
- if (rogue_can_see(mrow, mcol)) {
- mvaddch(mrow, mcol, monster->trail_char);
- } else {
- if (monster->trail_char == '.') {
- monster->trail_char = ' ';
- }
- mvaddch(mrow, mcol, monster->trail_char);
- }
- }
- }
- monster->trail_char = mvinch(row, col);
- if (!blind && (detect_monster || rogue_can_see(row, col))) {
- if ((!(monster->m_flags & INVISIBLE) ||
- (detect_monster || see_invisible || r_see_invisible))) {
- mvaddch(row, col, gmc(monster));
- }
- }
- if ((dungeon[row][col] & DOOR) &&
- (get_room_number(row, col) != cur_room) &&
- (dungeon[mrow][mcol] == FLOOR) && !blind) {
- mvaddch(mrow, mcol, ' ');
- }
- if (dungeon[row][col] & DOOR) {
- dr_course(monster, ((dungeon[mrow][mcol] & TUNNEL) ? 1 : 0),
- row, col);
- } else {
- monster->row = row;
- monster->col = col;
- }
-}
-
-mon_can_go(monster, row, col)
-const object *monster;
-short row, col;
-{
- object *obj;
- short dr, dc;
-
- dr = monster->row - row; /* check if move distance > 1 */
- if ((dr >= 2) || (dr <= -2)) {
- return(0);
- }
- dc = monster->col - col;
- if ((dc >= 2) || (dc <= -2)) {
- return(0);
- }
- if ((!dungeon[monster->row][col]) || (!dungeon[row][monster->col])) {
- return(0);
- }
- if ((!is_passable(row, col)) || (dungeon[row][col] & MONSTER)) {
- return(0);
- }
- if ((monster->row!=row)&&(monster->col!=col)&&((dungeon[row][col]&DOOR) ||
- (dungeon[monster->row][monster->col]&DOOR))) {
- return(0);
- }
- if (!(monster->m_flags & (FLITS | CONFUSED | CAN_FLIT)) &&
- (monster->trow == NO_ROOM)) {
- if ((monster->row < rogue.row) && (row < monster->row)) return(0);
- if ((monster->row > rogue.row) && (row > monster->row)) return(0);
- if ((monster->col < rogue.col) && (col < monster->col)) return(0);
- if ((monster->col > rogue.col) && (col > monster->col)) return(0);
- }
- if (dungeon[row][col] & OBJECT) {
- obj = object_at(&level_objects, row, col);
- if ((obj->what_is == SCROL) && (obj->which_kind == SCARE_MONSTER)) {
- return(0);
- }
- }
- return(1);
-}
-
-wake_up(monster)
-object *monster;
-{
- if (!(monster->m_flags & NAPPING)) {
- monster->m_flags &= (~(ASLEEP | IMITATES | WAKENS));
- }
-}
-
-wake_room(rn, entering, row, col)
-short rn;
-boolean entering;
-short row, col;
-{
- object *monster;
- short wake_percent;
- boolean in_room;
-
- wake_percent = (rn == party_room) ? PARTY_WAKE_PERCENT : WAKE_PERCENT;
- if (stealthy > 0) {
- wake_percent /= (STEALTH_FACTOR + stealthy);
- }
-
- monster = level_monsters.next_monster;
-
- while (monster) {
- in_room = (rn == get_room_number(monster->row, monster->col));
- if (in_room) {
- if (entering) {
- monster->trow = NO_ROOM;
- } else {
- monster->trow = row;
- monster->tcol = col;
- }
- }
- if ((monster->m_flags & WAKENS) &&
- (rn == get_room_number(monster->row, monster->col))) {
- if (rand_percent(wake_percent)) {
- wake_up(monster);
- }
- }
- monster = monster->next_monster;
- }
-}
-
-const char *
-mon_name(monster)
-const object *monster;
-{
- short ch;
-
- if (blind || ((monster->m_flags & INVISIBLE) &&
- !(detect_monster || see_invisible || r_see_invisible))) {
- return("something");
- }
- if (halluc) {
- ch = get_rand('A', 'Z') - 'A';
- return(m_names[ch]);
- }
- ch = monster->m_char - 'A';
- return(m_names[ch]);
-}
-
-rogue_is_around(row, col)
-int row, col;
-{
- short rdif, cdif, retval;
-
- rdif = row - rogue.row;
- cdif = col - rogue.col;
-
- retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1);
- return(retval);
-}
-
-wanderer()
-{
- object *monster;
- short row, col, i;
- boolean found = 0;
-
- for (i = 0; ((i < 15) && (!found)); i++) {
- monster = gr_monster((object *) 0, 0);
- if (!(monster->m_flags & (WAKENS | WANDERS))) {
- free_object(monster);
- } else {
- found = 1;
- }
- }
- if (found) {
- found = 0;
- wake_up(monster);
- for (i = 0; ((i < 25) && (!found)); i++) {
- gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
- if (!rogue_can_see(row, col)) {
- put_m_at(row, col, monster);
- found = 1;
- }
- }
- if (!found) {
- free_object(monster);
- }
- }
-}
-
-show_monsters()
-{
- object *monster;
-
- detect_monster = 1;
-
- if (blind) {
- return;
- }
- monster = level_monsters.next_monster;
-
- while (monster) {
- mvaddch(monster->row, monster->col, monster->m_char);
- if (monster->m_flags & IMITATES) {
- monster->m_flags &= (~IMITATES);
- monster->m_flags |= WAKENS;
- }
- monster = monster->next_monster;
- }
-}
-
-create_monster()
-{
- short row, col;
- short i;
- boolean found = 0;
- object *monster;
-
- row = rogue.row;
- col = rogue.col;
-
- for (i = 0; i < 9; i++) {
- rand_around(i, &row, &col);
- if (((row == rogue.row) && (col = rogue.col)) ||
- (row < MIN_ROW) || (row > (DROWS-2)) ||
- (col < 0) || (col > (DCOLS-1))) {
- continue;
- }
- if ((!(dungeon[row][col] & MONSTER)) &&
- (dungeon[row][col] & (FLOOR|TUNNEL|STAIRS|DOOR))) {
- found = 1;
- break;
- }
- }
- if (found) {
- monster = gr_monster((object *) 0, 0);
- put_m_at(row, col, monster);
- mvaddch(row, col, gmc(monster));
- if (monster->m_flags & (WANDERS | WAKENS)) {
- wake_up(monster);
- }
- } else {
- message("you hear a faint cry of anguish in the distance", 0);
- }
-}
-
-put_m_at(row, col, monster)
-short row, col;
-object *monster;
-{
- monster->row = row;
- monster->col = col;
- dungeon[row][col] |= MONSTER;
- monster->trail_char = mvinch(row, col);
- (void) add_to_pack(monster, &level_monsters, 0);
- aim_monster(monster);
-}
-
-aim_monster(monster)
-object *monster;
-{
- short i, rn, d, r;
-
- rn = get_room_number(monster->row, monster->col);
- r = get_rand(0, 12);
-
- for (i = 0; i < 4; i++) {
- d = (r + i) % 4;
- if (rooms[rn].doors[d].oth_room != NO_ROOM) {
- monster->trow = rooms[rn].doors[d].door_row;
- monster->tcol = rooms[rn].doors[d].door_col;
- break;
- }
- }
-}
-
-rogue_can_see(row, col)
-int row, col;
-{
- int retval;
-
- retval = !blind &&
- (((get_room_number(row, col) == cur_room) &&
- !(rooms[cur_room].is_room & R_MAZE)) ||
- rogue_is_around(row, col));
-
- return(retval);
-}
-
-move_confused(monster)
-object *monster;
-{
- short i, row, col;
-
- if (!(monster->m_flags & ASLEEP)) {
- if (--monster->moves_confused <= 0) {
- monster->m_flags &= (~CONFUSED);
- }
- if (monster->m_flags & STATIONARY) {
- return(coin_toss() ? 1 : 0);
- } else if (rand_percent(15)) {
- return(1);
- }
- row = monster->row;
- col = monster->col;
-
- for (i = 0; i < 9; i++) {
- rand_around(i, &row, &col);
- if ((row == rogue.row) && (col == rogue.col)) {
- return(0);
- }
- if (mtry(monster, row, col)) {
- return(1);
- }
- }
- }
- return(0);
-}
-
-flit(monster)
-object *monster;
-{
- short i, row, col;
-
- if (!rand_percent(FLIT_PERCENT + ((monster->m_flags & FLIES) ? 20 : 0))) {
- return(0);
- }
- if (rand_percent(10)) {
- return(1);
- }
- row = monster->row;
- col = monster->col;
-
- for (i = 0; i < 9; i++) {
- rand_around(i, &row, &col);
- if ((row == rogue.row) && (col == rogue.col)) {
- continue;
- }
- if (mtry(monster, row, col)) {
- return(1);
- }
- }
- return(1);
-}
-
-gr_obj_char()
-{
- short r;
- const char *rs = "%!?]=/):*";
-
- r = get_rand(0, 8);
-
- return(rs[r]);
-}
-
-no_room_for_monster(rn)
-int rn;
-{
- short i, j;
-
- for (i = rooms[rn].top_row+1; i < rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col+1; j < rooms[rn].right_col; j++) {
- if (!(dungeon[i][j] & MONSTER)) {
- return(0);
- }
- }
- }
- return(1);
-}
-
-aggravate()
-{
- object *monster;
-
- message("you hear a high pitched humming noise", 0);
-
- monster = level_monsters.next_monster;
-
- while (monster) {
- wake_up(monster);
- monster->m_flags &= (~IMITATES);
- if (rogue_can_see(monster->row, monster->col)) {
- mvaddch(monster->row, monster->col, monster->m_char);
- }
- monster = monster->next_monster;
- }
-}
-
-boolean
-mon_sees(monster, row, col)
-const object *monster;
-int row, col;
-{
- short rn, rdif, cdif, retval;
-
- rn = get_room_number(row, col);
-
- if ( (rn != NO_ROOM) &&
- (rn == get_room_number(monster->row, monster->col)) &&
- !(rooms[rn].is_room & R_MAZE)) {
- return(1);
- }
- rdif = row - monster->row;
- cdif = col - monster->col;
-
- retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1);
- return(retval);
-}
-
-mv_aquatars()
-{
- object *monster;
-
- monster = level_monsters.next_monster;
-
- while (monster) {
- if ((monster->m_char == 'A') &&
- mon_can_go(monster, rogue.row, rogue.col)) {
- mv_1_monster(monster, rogue.row, rogue.col);
- monster->m_flags |= ALREADY_MOVED;
- }
- monster = monster->next_monster;
- }
-}
diff --git a/games/rogue/move.c b/games/rogue/move.c
deleted file mode 100644
index b989bf6..0000000
--- a/games/rogue/move.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * move.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-short m_moves = 0;
-boolean jump = 0;
-const char *you_can_move_again = "you can move again";
-
-extern short cur_room, halluc, blind, levitate;
-extern short cur_level, max_level;
-extern short bear_trap, haste_self, confused;
-extern short e_rings, regeneration, auto_search;
-extern char hunger_str[];
-extern boolean being_held, interrupted, r_teleport, passgo;
-
-one_move_rogue(dirch, pickup)
-short dirch, pickup;
-{
- short row, col;
- object *obj;
- char desc[DCOLS];
- short n, status, d;
-
- row = rogue.row;
- col = rogue.col;
-
- if (confused) {
- dirch = gr_dir();
- }
- (void) is_direction(dirch, &d);
- get_dir_rc(d, &row, &col, 1);
-
- if (!can_move(rogue.row, rogue.col, row, col)) {
- return(MOVE_FAILED);
- }
- if (being_held || bear_trap) {
- if (!(dungeon[row][col] & MONSTER)) {
- if (being_held) {
- message("you are being held", 1);
- } else {
- message("you are still stuck in the bear trap", 0);
- (void) reg_move();
- }
- return(MOVE_FAILED);
- }
- }
- if (r_teleport) {
- if (rand_percent(R_TELE_PERCENT)) {
- tele();
- return(STOPPED_ON_SOMETHING);
- }
- }
- if (dungeon[row][col] & MONSTER) {
- rogue_hit(object_at(&level_monsters, row, col), 0);
- (void) reg_move();
- return(MOVE_FAILED);
- }
- if (dungeon[row][col] & DOOR) {
- if (cur_room == PASSAGE) {
- cur_room = get_room_number(row, col);
- light_up_room(cur_room);
- wake_room(cur_room, 1, row, col);
- } else {
- light_passage(row, col);
- }
- } else if ((dungeon[rogue.row][rogue.col] & DOOR) &&
- (dungeon[row][col] & TUNNEL)) {
- light_passage(row, col);
- wake_room(cur_room, 0, rogue.row, rogue.col);
- darken_room(cur_room);
- cur_room = PASSAGE;
- } else if (dungeon[row][col] & TUNNEL) {
- light_passage(row, col);
- }
- mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col));
- mvaddch(row, col, rogue.fchar);
-
- if (!jump) {
- refresh();
- }
- rogue.row = row;
- rogue.col = col;
- if (dungeon[row][col] & OBJECT) {
- if (levitate && pickup) {
- return(STOPPED_ON_SOMETHING);
- }
- if (pickup && !levitate) {
- if (obj = pick_up(row, col, &status)) {
- get_desc(obj, desc);
- if (obj->what_is == GOLD) {
- free_object(obj);
- goto NOT_IN_PACK;
- }
- } else if (!status) {
- goto MVED;
- } else {
- goto MOVE_ON;
- }
- } else {
-MOVE_ON:
- obj = object_at(&level_objects, row, col);
- (void) strcpy(desc, "moved onto ");
- get_desc(obj, desc+11);
- goto NOT_IN_PACK;
- }
- n = strlen(desc);
- desc[n] = '(';
- desc[n+1] = obj->ichar;
- desc[n+2] = ')';
- desc[n+3] = 0;
-NOT_IN_PACK:
- message(desc, 1);
- (void) reg_move();
- return(STOPPED_ON_SOMETHING);
- }
- if (dungeon[row][col] & (DOOR | STAIRS | TRAP)) {
- if ((!levitate) && (dungeon[row][col] & TRAP)) {
- trap_player(row, col);
- }
- (void) reg_move();
- return(STOPPED_ON_SOMETHING);
- }
-MVED: if (reg_move()) { /* fainted from hunger */
- return(STOPPED_ON_SOMETHING);
- }
- return((confused ? STOPPED_ON_SOMETHING : MOVED));
-}
-
-multiple_move_rogue(dirch)
-short dirch;
-{
- short row, col;
- short m;
-
- switch(dirch) {
- case '\010':
- case '\012':
- case '\013':
- case '\014':
- case '\031':
- case '\025':
- case '\016':
- case '\002':
- do {
- row = rogue.row;
- col = rogue.col;
- if (((m = one_move_rogue((dirch + 96), 1)) == MOVE_FAILED) ||
- (m == STOPPED_ON_SOMETHING) ||
- interrupted) {
- break;
- }
- } while (!next_to_something(row, col));
- if ( (!interrupted) && passgo && (m == MOVE_FAILED) &&
- (dungeon[rogue.row][rogue.col] & TUNNEL)) {
- turn_passage(dirch + 96, 0);
- }
- break;
- case 'H':
- case 'J':
- case 'K':
- case 'L':
- case 'B':
- case 'Y':
- case 'U':
- case 'N':
- while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED)) ;
-
- if ( (!interrupted) && passgo &&
- (dungeon[rogue.row][rogue.col] & TUNNEL)) {
- turn_passage(dirch + 32, 1);
- }
- break;
- }
-}
-
-is_passable(row, col)
-int row, col;
-{
- if ((row < MIN_ROW) || (row > (DROWS - 2)) || (col < 0) ||
- (col > (DCOLS-1))) {
- return(0);
- }
- if (dungeon[row][col] & HIDDEN) {
- return((dungeon[row][col] & TRAP) ? 1 : 0);
- }
- return(dungeon[row][col] & (FLOOR | TUNNEL | DOOR | STAIRS | TRAP));
-}
-
-next_to_something(drow, dcol)
-int drow, dcol;
-{
- short i, j, i_end, j_end, row, col;
- short pass_count = 0;
- unsigned short s;
-
- if (confused) {
- return(1);
- }
- if (blind) {
- return(0);
- }
- i_end = (rogue.row < (DROWS-2)) ? 1 : 0;
- j_end = (rogue.col < (DCOLS-1)) ? 1 : 0;
-
- for (i = ((rogue.row > MIN_ROW) ? -1 : 0); i <= i_end; i++) {
- for (j = ((rogue.col > 0) ? -1 : 0); j <= j_end; j++) {
- if ((i == 0) && (j == 0)) {
- continue;
- }
- if (((rogue.row+i) == drow) && ((rogue.col+j) == dcol)) {
- continue;
- }
- row = rogue.row + i;
- col = rogue.col + j;
- s = dungeon[row][col];
- if (s & HIDDEN) {
- continue;
- }
- /* If the rogue used to be right, up, left, down, or right of
- * row,col, and now isn't, then don't stop */
- if (s & (MONSTER | OBJECT | STAIRS)) {
- if (((row == drow) || (col == dcol)) &&
- (!((row == rogue.row) || (col == rogue.col)))) {
- continue;
- }
- return(1);
- }
- if (s & TRAP) {
- if (!(s & HIDDEN)) {
- if (((row == drow) || (col == dcol)) &&
- (!((row == rogue.row) || (col == rogue.col)))) {
- continue;
- }
- return(1);
- }
- }
- if ((((i - j) == 1) || ((i - j) == -1)) && (s & TUNNEL)) {
- if (++pass_count > 1) {
- return(1);
- }
- }
- if ((s & DOOR) && ((i == 0) || (j == 0))) {
- return(1);
- }
- }
- }
- return(0);
-}
-
-can_move(row1, col1, row2, col2)
-{
- if (!is_passable(row2, col2)) {
- return(0);
- }
- if ((row1 != row2) && (col1 != col2)) {
- if ((dungeon[row1][col1] & DOOR) || (dungeon[row2][col2] & DOOR)) {
- return(0);
- }
- if ((!dungeon[row1][col2]) || (!dungeon[row2][col1])) {
- return(0);
- }
- }
- return(1);
-}
-
-move_onto()
-{
- short ch, d;
- boolean first_miss = 1;
-
- while (!is_direction(ch = rgetchar(), &d)) {
- sound_bell();
- if (first_miss) {
- message("direction? ", 0);
- first_miss = 0;
- }
- }
- check_message();
- if (ch != CANCEL) {
- (void) one_move_rogue(ch, 0);
- }
-}
-
-boolean
-is_direction(c, d)
-short c;
-short *d;
-{
- switch(c) {
- case 'h':
- *d = LEFT;
- break;
- case 'j':
- *d = DOWN;
- break;
- case 'k':
- *d = UPWARD;
- break;
- case 'l':
- *d = RIGHT;
- break;
- case 'b':
- *d = DOWNLEFT;
- break;
- case 'y':
- *d = UPLEFT;
- break;
- case 'u':
- *d = UPRIGHT;
- break;
- case 'n':
- *d = DOWNRIGHT;
- break;
- case CANCEL:
- break;
- default:
- return(0);
- }
- return(1);
-}
-
-boolean
-check_hunger(msg_only)
-boolean msg_only;
-{
- short i, n;
- boolean fainted = 0;
-
- if (rogue.moves_left == HUNGRY) {
- (void) strcpy(hunger_str, "hungry");
- message(hunger_str, 0);
- print_stats(STAT_HUNGER);
- }
- if (rogue.moves_left == WEAK) {
- (void) strcpy(hunger_str, "weak");
- message(hunger_str, 1);
- print_stats(STAT_HUNGER);
- }
- if (rogue.moves_left <= FAINT) {
- if (rogue.moves_left == FAINT) {
- (void) strcpy(hunger_str, "faint");
- message(hunger_str, 1);
- print_stats(STAT_HUNGER);
- }
- n = get_rand(0, (FAINT - rogue.moves_left));
- if (n > 0) {
- fainted = 1;
- if (rand_percent(40)) {
- rogue.moves_left++;
- }
- message("you faint", 1);
- for (i = 0; i < n; i++) {
- if (coin_toss()) {
- mv_mons();
- }
- }
- message(you_can_move_again, 1);
- }
- }
- if (msg_only) {
- return(fainted);
- }
- if (rogue.moves_left <= STARVE) {
- killed_by((object *) 0, STARVATION);
- }
-
- switch(e_rings) {
- /*case -2:
- Subtract 0, i.e. do nothing.
- break;*/
- case -1:
- rogue.moves_left -= (rogue.moves_left % 2);
- break;
- case 0:
- rogue.moves_left--;
- break;
- case 1:
- rogue.moves_left--;
- (void) check_hunger(1);
- rogue.moves_left -= (rogue.moves_left % 2);
- break;
- case 2:
- rogue.moves_left--;
- (void) check_hunger(1);
- rogue.moves_left--;
- break;
- }
- return(fainted);
-}
-
-boolean
-reg_move()
-{
- boolean fainted;
-
- if ((rogue.moves_left <= HUNGRY) || (cur_level >= max_level)) {
- fainted = check_hunger(0);
- } else {
- fainted = 0;
- }
-
- mv_mons();
-
- if (++m_moves >= 120) {
- m_moves = 0;
- wanderer();
- }
- if (halluc) {
- if (!(--halluc)) {
- unhallucinate();
- } else {
- hallucinate();
- }
- }
- if (blind) {
- if (!(--blind)) {
- unblind();
- }
- }
- if (confused) {
- if (!(--confused)) {
- unconfuse();
- }
- }
- if (bear_trap) {
- bear_trap--;
- }
- if (levitate) {
- if (!(--levitate)) {
- message("you float gently to the ground", 1);
- if (dungeon[rogue.row][rogue.col] & TRAP) {
- trap_player(rogue.row, rogue.col);
- }
- }
- }
- if (haste_self) {
- if (!(--haste_self)) {
- message("you feel yourself slowing down", 0);
- }
- }
- heal();
- if (auto_search > 0) {
- search(auto_search, auto_search);
- }
- return(fainted);
-}
-
-rest(count)
-{
- int i;
-
- interrupted = 0;
-
- for (i = 0; i < count; i++) {
- if (interrupted) {
- break;
- }
- (void) reg_move();
- }
-}
-
-gr_dir()
-{
- short d;
-
- d = get_rand(1, 8);
-
- switch(d) {
- case 1:
- d = 'j';
- break;
- case 2:
- d = 'k';
- break;
- case 3:
- d = 'l';
- break;
- case 4:
- d = 'h';
- break;
- case 5:
- d = 'y';
- break;
- case 6:
- d = 'u';
- break;
- case 7:
- d = 'b';
- break;
- case 8:
- d = 'n';
- break;
- }
- return(d);
-}
-
-heal()
-{
- static short heal_exp = -1, n, c = 0;
- static boolean alt;
-
- if (rogue.hp_current == rogue.hp_max) {
- c = 0;
- return;
- }
- if (rogue.exp != heal_exp) {
- heal_exp = rogue.exp;
-
- switch(heal_exp) {
- case 1:
- n = 20;
- break;
- case 2:
- n = 18;
- break;
- case 3:
- n = 17;
- break;
- case 4:
- n = 14;
- break;
- case 5:
- n = 13;
- break;
- case 6:
- n = 10;
- break;
- case 7:
- n = 9;
- break;
- case 8:
- n = 8;
- break;
- case 9:
- n = 7;
- break;
- case 10:
- n = 4;
- break;
- case 11:
- n = 3;
- break;
- case 12:
- default:
- n = 2;
- }
- }
- if (++c >= n) {
- c = 0;
- rogue.hp_current++;
- if (alt = !alt) {
- rogue.hp_current++;
- }
- if ((rogue.hp_current += regeneration) > rogue.hp_max) {
- rogue.hp_current = rogue.hp_max;
- }
- print_stats(STAT_HP);
- }
-}
-
-static boolean
-can_turn(nrow, ncol)
-short nrow, ncol;
-{
- if ((dungeon[nrow][ncol] & TUNNEL) && is_passable(nrow, ncol)) {
- return(1);
- }
- return(0);
-}
-
-turn_passage(dir, fast)
-short dir;
-boolean fast;
-{
- short crow = rogue.row, ccol = rogue.col, turns = 0;
- short ndir;
-
- if ((dir != 'h') && can_turn(crow, ccol + 1)) {
- turns++;
- ndir = 'l';
- }
- if ((dir != 'l') && can_turn(crow, ccol - 1)) {
- turns++;
- ndir = 'h';
- }
- if ((dir != 'k') && can_turn(crow + 1, ccol)) {
- turns++;
- ndir = 'j';
- }
- if ((dir != 'j') && can_turn(crow - 1, ccol)) {
- turns++;
- ndir = 'k';
- }
- if (turns == 1) {
- multiple_move_rogue(ndir - (fast ? 32 : 96));
- }
-}
diff --git a/games/rogue/object.c b/games/rogue/object.c
deleted file mode 100644
index 9056c54..0000000
--- a/games/rogue/object.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * object.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-object level_objects;
-unsigned short dungeon[DROWS][DCOLS];
-short foods = 0;
-object *free_list = (object *) 0;
-char *fruit = (char *) 0;
-
-fighter rogue = {
- INIT_AW, /* armor, weapon */
- INIT_RINGS, /* rings */
- INIT_HP, /* Hp current,max */
- INIT_STR, /* Str current,max */
- INIT_PACK, /* pack */
- INIT_GOLD, /* gold */
- INIT_EXP, /* exp level,points */
- 0, 0, /* row, col */
- INIT_CHAR, /* char */
- INIT_MOVES /* moves */
-};
-
-struct id id_potions[POTIONS] = {
-{100, "blue \0 ", "of increase strength ", 0},
-{250, "red \0 ", "of restore strength ", 0},
-{100, "green \0 ", "of healing ", 0},
-{200, "grey \0 ", "of extra healing ", 0},
- {10, "brown \0 ", "of poison ", 0},
-{300, "clear \0 ", "of raise level ", 0},
- {10, "pink \0 ", "of blindness ", 0},
- {25, "white \0 ", "of hallucination ", 0},
-{100, "purple \0 ", "of detect monster ", 0},
-{100, "black \0 ", "of detect things ", 0},
- {10, "yellow \0 ", "of confusion ", 0},
- {80, "plaid \0 ", "of levitation ", 0},
-{150, "burgundy \0 ", "of haste self ", 0},
-{145, "beige \0 ", "of see invisible ", 0}
-};
-
-struct id id_scrolls[SCROLS] = {
-{505, " ", "of protect armor ", 0},
-{200, " ", "of hold monster ", 0},
-{235, " ", "of enchant weapon ", 0},
-{235, " ", "of enchant armor ", 0},
-{175, " ", "of identify ", 0},
-{190, " ", "of teleportation ", 0},
- {25, " ", "of sleep ", 0},
-{610, " ", "of scare monster ", 0},
-{210, " ", "of remove curse ", 0},
- {80, " ", "of create monster ",0},
- {25, " ", "of aggravate monster ",0},
-{180, " ", "of magic mapping ", 0},
- {90, " ", "of confuse monster ", 0}
-};
-
-struct id id_weapons[WEAPONS] = {
- {150, "short bow ", "", 0},
- {8, "darts ", "", 0},
- {15, "arrows ", "", 0},
- {27, "daggers ", "", 0},
- {35, "shurikens ", "", 0},
- {360, "mace ", "", 0},
- {470, "long sword ", "", 0},
- {580, "two-handed sword ", "", 0}
-};
-
-struct id id_armors[ARMORS] = {
- {300, "leather armor ", "", (UNIDENTIFIED)},
- {300, "ring mail ", "", (UNIDENTIFIED)},
- {400, "scale mail ", "", (UNIDENTIFIED)},
- {500, "chain mail ", "", (UNIDENTIFIED)},
- {600, "banded mail ", "", (UNIDENTIFIED)},
- {600, "splint mail ", "", (UNIDENTIFIED)},
- {700, "plate mail ", "", (UNIDENTIFIED)}
-};
-
-struct id id_wands[WANDS] = {
- {25, " ", "of teleport away ",0},
- {50, " ", "of slow monster ", 0},
- {8, " ", "of invisibility ",0},
- {55, " ", "of polymorph ",0},
- {2, " ", "of haste monster ",0},
- {20, " ", "of magic missile ",0},
- {20, " ", "of cancellation ",0},
- {0, " ", "of do nothing ",0},
- {35, " ", "of drain life ",0},
- {20, " ", "of cold ",0},
- {20, " ", "of fire ",0}
-};
-
-struct id id_rings[RINGS] = {
- {250, " ", "of stealth ",0},
- {100, " ", "of teleportation ", 0},
- {255, " ", "of regeneration ",0},
- {295, " ", "of slow digestion ",0},
- {200, " ", "of add strength ",0},
- {250, " ", "of sustain strength ",0},
- {250, " ", "of dexterity ",0},
- {25, " ", "of adornment ",0},
- {300, " ", "of see invisible ",0},
- {290, " ", "of maintain armor ",0},
- {270, " ", "of searching ",0},
-};
-
-extern short cur_level, max_level;
-extern short party_room;
-extern char *error_file;
-extern boolean is_wood[];
-
-put_objects()
-{
- short i, n;
- object *obj;
-
- if (cur_level < max_level) {
- return;
- }
- n = coin_toss() ? get_rand(2, 4) : get_rand(3, 5);
- while (rand_percent(33)) {
- n++;
- }
- if (party_room != NO_ROOM) {
- make_party();
- }
- for (i = 0; i < n; i++) {
- obj = gr_object();
- rand_place(obj);
- }
- put_gold();
-}
-
-put_gold()
-{
- short i, j;
- short row,col;
- boolean is_maze, is_room;
-
- for (i = 0; i < MAXROOMS; i++) {
- is_maze = (rooms[i].is_room & R_MAZE) ? 1 : 0;
- is_room = (rooms[i].is_room & R_ROOM) ? 1 : 0;
-
- if (!(is_room || is_maze)) {
- continue;
- }
- if (is_maze || rand_percent(GOLD_PERCENT)) {
- for (j = 0; j < 50; j++) {
- row = get_rand(rooms[i].top_row+1,
- rooms[i].bottom_row-1);
- col = get_rand(rooms[i].left_col+1,
- rooms[i].right_col-1);
- if ((dungeon[row][col] == FLOOR) ||
- (dungeon[row][col] == TUNNEL)) {
- plant_gold(row, col, is_maze);
- break;
- }
- }
- }
- }
-}
-
-plant_gold(row, col, is_maze)
-short row, col;
-boolean is_maze;
-{
- object *obj;
-
- obj = alloc_object();
- obj->row = row; obj->col = col;
- obj->what_is = GOLD;
- obj->quantity = get_rand((2 * cur_level), (16 * cur_level));
- if (is_maze) {
- obj->quantity += obj->quantity / 2;
- }
- dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
-}
-
-place_at(obj, row, col)
-object *obj;
-int row, col;
-{
- obj->row = row;
- obj->col = col;
- dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
-}
-
-object *
-object_at(pack, row, col)
-object *pack;
-short row, col;
-{
- object *obj = (object *) 0;
-
- if (dungeon[row][col] & (MONSTER | OBJECT)) {
- obj = pack->next_object;
-
- while (obj && ((obj->row != row) || (obj->col != col))) {
- obj = obj->next_object;
- }
- if (!obj) {
- message("object_at(): inconsistent", 1);
- }
- }
- return(obj);
-}
-
-object *
-get_letter_object(ch)
-int ch;
-{
- object *obj;
-
- obj = rogue.pack.next_object;
-
- while (obj && (obj->ichar != ch)) {
- obj = obj->next_object;
- }
- return(obj);
-}
-
-free_stuff(objlist)
-object *objlist;
-{
- object *obj;
-
- while (objlist->next_object) {
- obj = objlist->next_object;
- objlist->next_object =
- objlist->next_object->next_object;
- free_object(obj);
- }
-}
-
-const char *
-name_of(obj)
-const object *obj;
-{
- const char *retstring;
-
- switch(obj->what_is) {
- case SCROL:
- retstring = obj->quantity > 1 ? "scrolls " : "scroll ";
- break;
- case POTION:
- retstring = obj->quantity > 1 ? "potions " : "potion ";
- break;
- case FOOD:
- if (obj->which_kind == RATION) {
- retstring = "food ";
- } else {
- retstring = fruit;
- }
- break;
- case WAND:
- retstring = is_wood[obj->which_kind] ? "staff " : "wand ";
- break;
- case WEAPON:
- switch(obj->which_kind) {
- case DART:
- retstring=obj->quantity > 1 ? "darts " : "dart ";
- break;
- case ARROW:
- retstring=obj->quantity > 1 ? "arrows " : "arrow ";
- break;
- case DAGGER:
- retstring=obj->quantity > 1 ? "daggers " : "dagger ";
- break;
- case SHURIKEN:
- retstring=obj->quantity > 1?"shurikens ":"shuriken ";
- break;
- default:
- retstring = id_weapons[obj->which_kind].title;
- }
- break;
- case ARMOR:
- retstring = "armor ";
- break;
- case RING:
- retstring = "ring ";
- break;
- case AMULET:
- retstring = "amulet ";
- break;
- default:
- retstring = "unknown ";
- break;
- }
- return(retstring);
-}
-
-object *
-gr_object()
-{
- object *obj;
-
- obj = alloc_object();
-
- if (foods < (cur_level / 3)) {
- obj->what_is = FOOD;
- foods++;
- } else {
- obj->what_is = gr_what_is();
- }
- switch(obj->what_is) {
- case SCROL:
- gr_scroll(obj);
- break;
- case POTION:
- gr_potion(obj);
- break;
- case WEAPON:
- gr_weapon(obj, 1);
- break;
- case ARMOR:
- gr_armor(obj);
- break;
- case WAND:
- gr_wand(obj);
- break;
- case FOOD:
- get_food(obj, 0);
- break;
- case RING:
- gr_ring(obj, 1);
- break;
- }
- return(obj);
-}
-
-unsigned short
-gr_what_is()
-{
- short percent;
- unsigned short what_is;
-
- percent = get_rand(1, 91);
-
- if (percent <= 30) {
- what_is = SCROL;
- } else if (percent <= 60) {
- what_is = POTION;
- } else if (percent <= 64) {
- what_is = WAND;
- } else if (percent <= 74) {
- what_is = WEAPON;
- } else if (percent <= 83) {
- what_is = ARMOR;
- } else if (percent <= 88) {
- what_is = FOOD;
- } else {
- what_is = RING;
- }
- return(what_is);
-}
-
-gr_scroll(obj)
-object *obj;
-{
- short percent;
-
- percent = get_rand(0, 91);
-
- obj->what_is = SCROL;
-
- if (percent <= 5) {
- obj->which_kind = PROTECT_ARMOR;
- } else if (percent <= 10) {
- obj->which_kind = HOLD_MONSTER;
- } else if (percent <= 20) {
- obj->which_kind = CREATE_MONSTER;
- } else if (percent <= 35) {
- obj->which_kind = IDENTIFY;
- } else if (percent <= 43) {
- obj->which_kind = TELEPORT;
- } else if (percent <= 50) {
- obj->which_kind = SLEEP;
- } else if (percent <= 55) {
- obj->which_kind = SCARE_MONSTER;
- } else if (percent <= 64) {
- obj->which_kind = REMOVE_CURSE;
- } else if (percent <= 69) {
- obj->which_kind = ENCH_ARMOR;
- } else if (percent <= 74) {
- obj->which_kind = ENCH_WEAPON;
- } else if (percent <= 80) {
- obj->which_kind = AGGRAVATE_MONSTER;
- } else if (percent <= 86) {
- obj->which_kind = CON_MON;
- } else {
- obj->which_kind = MAGIC_MAPPING;
- }
-}
-
-gr_potion(obj)
-object *obj;
-{
- short percent;
-
- percent = get_rand(1, 118);
-
- obj->what_is = POTION;
-
- if (percent <= 5) {
- obj->which_kind = RAISE_LEVEL;
- } else if (percent <= 15) {
- obj->which_kind = DETECT_OBJECTS;
- } else if (percent <= 25) {
- obj->which_kind = DETECT_MONSTER;
- } else if (percent <= 35) {
- obj->which_kind = INCREASE_STRENGTH;
- } else if (percent <= 45) {
- obj->which_kind = RESTORE_STRENGTH;
- } else if (percent <= 55) {
- obj->which_kind = HEALING;
- } else if (percent <= 65) {
- obj->which_kind = EXTRA_HEALING;
- } else if (percent <= 75) {
- obj->which_kind = BLINDNESS;
- } else if (percent <= 85) {
- obj->which_kind = HALLUCINATION;
- } else if (percent <= 95) {
- obj->which_kind = CONFUSION;
- } else if (percent <= 105) {
- obj->which_kind = POISON;
- } else if (percent <= 110) {
- obj->which_kind = LEVITATION;
- } else if (percent <= 114) {
- obj->which_kind = HASTE_SELF;
- } else {
- obj->which_kind = SEE_INVISIBLE;
- }
-}
-
-gr_weapon(obj, assign_wk)
-object *obj;
-int assign_wk;
-{
- short percent;
- short i;
- short blessing, increment;
-
- obj->what_is = WEAPON;
- if (assign_wk) {
- obj->which_kind = get_rand(0, (WEAPONS - 1));
- }
- if ((obj->which_kind == ARROW) || (obj->which_kind == DAGGER) ||
- (obj->which_kind == SHURIKEN) | (obj->which_kind == DART)) {
- obj->quantity = get_rand(3, 15);
- obj->quiver = get_rand(0, 126);
- } else {
- obj->quantity = 1;
- }
- obj->hit_enchant = obj->d_enchant = 0;
-
- percent = get_rand(1, 96);
- blessing = get_rand(1, 3);
-
- if (percent <= 16) {
- increment = 1;
- } else if (percent <= 32) {
- increment = -1;
- obj->is_cursed = 1;
- }
- if (percent <= 32) {
- for (i = 0; i < blessing; i++) {
- if (coin_toss()) {
- obj->hit_enchant += increment;
- } else {
- obj->d_enchant += increment;
- }
- }
- }
- switch(obj->which_kind) {
- case BOW:
- case DART:
- obj->damage = "1d1";
- break;
- case ARROW:
- obj->damage = "1d2";
- break;
- case DAGGER:
- obj->damage = "1d3";
- break;
- case SHURIKEN:
- obj->damage = "1d4";
- break;
- case MACE:
- obj->damage = "2d3";
- break;
- case LONG_SWORD:
- obj->damage = "3d4";
- break;
- case TWO_HANDED_SWORD:
- obj->damage = "4d5";
- break;
- }
-}
-
-gr_armor(obj)
-object *obj;
-{
- short percent;
- short blessing;
-
- obj->what_is = ARMOR;
- obj->which_kind = get_rand(0, (ARMORS - 1));
- obj->class = obj->which_kind + 2;
- if ((obj->which_kind == PLATE) || (obj->which_kind == SPLINT)) {
- obj->class--;
- }
- obj->is_protected = 0;
- obj->d_enchant = 0;
-
- percent = get_rand(1, 100);
- blessing = get_rand(1, 3);
-
- if (percent <= 16) {
- obj->is_cursed = 1;
- obj->d_enchant -= blessing;
- } else if (percent <= 33) {
- obj->d_enchant += blessing;
- }
-}
-
-gr_wand(obj)
-object *obj;
-{
- obj->what_is = WAND;
- obj->which_kind = get_rand(0, (WANDS - 1));
- obj->class = get_rand(3, 7);
-}
-
-get_food(obj, force_ration)
-object *obj;
-boolean force_ration;
-{
- obj->what_is = FOOD;
-
- if (force_ration || rand_percent(80)) {
- obj->which_kind = RATION;
- } else {
- obj->which_kind = FRUIT;
- }
-}
-
-put_stairs()
-{
- short row, col;
-
- gr_row_col(&row, &col, (FLOOR | TUNNEL));
- dungeon[row][col] |= STAIRS;
-}
-
-get_armor_class(obj)
-const object *obj;
-{
- if (obj) {
- return(obj->class + obj->d_enchant);
- }
- return(0);
-}
-
-object *
-alloc_object()
-{
- object *obj;
-
- if (free_list) {
- obj = free_list;
- free_list = free_list->next_object;
- } else if (!(obj = (object *) md_malloc(sizeof(object)))) {
- message("cannot allocate object, saving game", 0);
- save_into_file(error_file);
- }
- obj->quantity = 1;
- obj->ichar = 'L';
- obj->picked_up = obj->is_cursed = 0;
- obj->in_use_flags = NOT_USED;
- obj->identified = UNIDENTIFIED;
- obj->damage = "1d1";
- return(obj);
-}
-
-free_object(obj)
-object *obj;
-{
- obj->next_object = free_list;
- free_list = obj;
-}
-
-make_party()
-{
- short n;
-
- party_room = gr_room();
-
- n = rand_percent(99) ? party_objects(party_room) : 11;
- if (rand_percent(99)) {
- party_monsters(party_room, n);
- }
-}
-
-show_objects()
-{
- object *obj;
- short mc, rc, row, col;
- object *monster;
-
- obj = level_objects.next_object;
-
- while (obj) {
- row = obj->row;
- col = obj->col;
-
- rc = get_mask_char(obj->what_is);
-
- if (dungeon[row][col] & MONSTER) {
- if (monster = object_at(&level_monsters, row, col)) {
- monster->trail_char = rc;
- }
- }
- mc = mvinch(row, col);
- if (((mc < 'A') || (mc > 'Z')) &&
- ((row != rogue.row) || (col != rogue.col))) {
- mvaddch(row, col, rc);
- }
- obj = obj->next_object;
- }
-
- monster = level_monsters.next_object;
-
- while (monster) {
- if (monster->m_flags & IMITATES) {
- mvaddch(monster->row, monster->col, (int) monster->disguise);
- }
- monster = monster->next_monster;
- }
-}
-
-put_amulet()
-{
- object *obj;
-
- obj = alloc_object();
- obj->what_is = AMULET;
- rand_place(obj);
-}
-
-rand_place(obj)
-object *obj;
-{
- short row, col;
-
- gr_row_col(&row, &col, (FLOOR | TUNNEL));
- place_at(obj, row, col);
-}
-
-c_object_for_wizard()
-{
- short ch, max, wk;
- object *obj;
- char buf[80];
-
- if (pack_count((object *) 0) >= MAX_PACK_COUNT) {
- message("pack full", 0);
- return;
- }
- message("type of object?", 0);
-
- while (r_index("!?:)]=/,\033", (ch = rgetchar()), 0) == -1) {
- sound_bell();
- }
- check_message();
-
- if (ch == '\033') {
- return;
- }
- obj = alloc_object();
-
- switch(ch) {
- case '!':
- obj->what_is = POTION;
- max = POTIONS - 1;
- break;
- case '?':
- obj->what_is = SCROL;
- max = SCROLS - 1;
- break;
- case ',':
- obj->what_is = AMULET;
- break;
- case ':':
- get_food(obj, 0);
- break;
- case ')':
- gr_weapon(obj, 0);
- max = WEAPONS - 1;
- break;
- case ']':
- gr_armor(obj);
- max = ARMORS - 1;
- break;
- case '/':
- gr_wand(obj);
- max = WANDS - 1;
- break;
- case '=':
- max = RINGS - 1;
- obj->what_is = RING;
- break;
- }
- if ((ch != ',') && (ch != ':')) {
-GIL:
- if (get_input_line("which kind?", "", buf, "", 0, 1)) {
- wk = get_number(buf);
- if ((wk >= 0) && (wk <= max)) {
- obj->which_kind = (unsigned short) wk;
- if (obj->what_is == RING) {
- gr_ring(obj, 0);
- }
- } else {
- sound_bell();
- goto GIL;
- }
- } else {
- free_object(obj);
- return;
- }
- }
- get_desc(obj, buf);
- message(buf, 0);
- (void) add_to_pack(obj, &rogue.pack, 1);
-}
diff --git a/games/rogue/pack.c b/games/rogue/pack.c
deleted file mode 100644
index 5ce3520..0000000
--- a/games/rogue/pack.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * pack.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-const char *curse_message = "you can't, it appears to be cursed";
-
-extern short levitate;
-
-object *
-add_to_pack(obj, pack, condense)
-object *obj, *pack;
-int condense;
-{
- object *op;
-
- if (condense) {
- if (op = check_duplicate(obj, pack)) {
- free_object(obj);
- return(op);
- } else {
- obj->ichar = next_avail_ichar();
- }
- }
- if (pack->next_object == 0) {
- pack->next_object = obj;
- } else {
- op = pack->next_object;
-
- while (op->next_object) {
- op = op->next_object;
- }
- op->next_object = obj;
- }
- obj->next_object = 0;
- return(obj);
-}
-
-take_from_pack(obj, pack)
-object *obj, *pack;
-{
- while (pack->next_object != obj) {
- pack = pack->next_object;
- }
- pack->next_object = pack->next_object->next_object;
-}
-
-/* Note: *status is set to 0 if the rogue attempts to pick up a scroll
- * of scare-monster and it turns to dust. *status is otherwise set to 1.
- */
-
-object *
-pick_up(row, col, status)
-int row, col;
-short *status;
-{
- object *obj;
-
- *status = 1;
-
- if (levitate) {
- message("you're floating in the air!", 0);
- return((object *) 0);
- }
- obj = object_at(&level_objects, row, col);
- if (!obj) {
- message("pick_up(): inconsistent", 1);
- return(obj);
- }
- if ( (obj->what_is == SCROL) &&
- (obj->which_kind == SCARE_MONSTER) &&
- obj->picked_up) {
- message("the scroll turns to dust as you pick it up", 0);
- dungeon[row][col] &= (~OBJECT);
- vanish(obj, 0, &level_objects);
- *status = 0;
- if (id_scrolls[SCARE_MONSTER].id_status == UNIDENTIFIED) {
- id_scrolls[SCARE_MONSTER].id_status = IDENTIFIED;
- }
- return((object *) 0);
- }
- if (obj->what_is == GOLD) {
- rogue.gold += obj->quantity;
- dungeon[row][col] &= ~(OBJECT);
- take_from_pack(obj, &level_objects);
- print_stats(STAT_GOLD);
- return(obj); /* obj will be free_object()ed in caller */
- }
- if (pack_count(obj) >= MAX_PACK_COUNT) {
- message("pack too full", 1);
- return((object *) 0);
- }
- dungeon[row][col] &= ~(OBJECT);
- take_from_pack(obj, &level_objects);
- obj = add_to_pack(obj, &rogue.pack, 1);
- obj->picked_up = 1;
- return(obj);
-}
-
-drop()
-{
- object *obj, *new;
- short ch;
- char desc[DCOLS];
-
- if (dungeon[rogue.row][rogue.col] & (OBJECT | STAIRS | TRAP)) {
- message("there's already something there", 0);
- return;
- }
- if (!rogue.pack.next_object) {
- message("you have nothing to drop", 0);
- return;
- }
- if ((ch = pack_letter("drop what?", ALL_OBJECTS)) == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (obj->in_use_flags & BEING_WIELDED) {
- if (obj->is_cursed) {
- message(curse_message, 0);
- return;
- }
- unwield(rogue.weapon);
- } else if (obj->in_use_flags & BEING_WORN) {
- if (obj->is_cursed) {
- message(curse_message, 0);
- return;
- }
- mv_aquatars();
- unwear(rogue.armor);
- print_stats(STAT_ARMOR);
- } else if (obj->in_use_flags & ON_EITHER_HAND) {
- if (obj->is_cursed) {
- message(curse_message, 0);
- return;
- }
- un_put_on(obj);
- }
- obj->row = rogue.row;
- obj->col = rogue.col;
-
- if ((obj->quantity > 1) && (obj->what_is != WEAPON)) {
- obj->quantity--;
- new = alloc_object();
- *new = *obj;
- new->quantity = 1;
- obj = new;
- } else {
- obj->ichar = 'L';
- take_from_pack(obj, &rogue.pack);
- }
- place_at(obj, rogue.row, rogue.col);
- (void) strcpy(desc, "dropped ");
- get_desc(obj, desc+8);
- message(desc, 0);
- (void) reg_move();
-}
-
-object *
-check_duplicate(obj, pack)
-object *obj, *pack;
-{
- object *op;
-
- if (!(obj->what_is & (WEAPON | FOOD | SCROL | POTION))) {
- return(0);
- }
- if ((obj->what_is == FOOD) && (obj->which_kind == FRUIT)) {
- return(0);
- }
- op = pack->next_object;
-
- while (op) {
- if ((op->what_is == obj->what_is) &&
- (op->which_kind == obj->which_kind)) {
-
- if ((obj->what_is != WEAPON) ||
- ((obj->what_is == WEAPON) &&
- ((obj->which_kind == ARROW) ||
- (obj->which_kind == DAGGER) ||
- (obj->which_kind == DART) ||
- (obj->which_kind == SHURIKEN)) &&
- (obj->quiver == op->quiver))) {
- op->quantity += obj->quantity;
- return(op);
- }
- }
- op = op->next_object;
- }
- return(0);
-}
-
-next_avail_ichar()
-{
- object *obj;
- int i;
- boolean ichars[26];
-
- for (i = 0; i < 26; i++) {
- ichars[i] = 0;
- }
- obj = rogue.pack.next_object;
- while (obj) {
- ichars[(obj->ichar - 'a')] = 1;
- obj = obj->next_object;
- }
- for (i = 0; i < 26; i++) {
- if (!ichars[i]) {
- return(i + 'a');
- }
- }
- return('?');
-}
-
-wait_for_ack()
-{
- if (!isatty(0) || !isatty(1))
- return;
- while (rgetchar() != ' ') ;
-}
-
-pack_letter(prompt, mask)
-const char *prompt;
-unsigned short mask;
-{
- short ch;
- unsigned short tmask = mask;
-
- if (!mask_pack(&rogue.pack, mask)) {
- message("nothing appropriate", 0);
- return(CANCEL);
- }
- for (;;) {
-
- message(prompt, 0);
-
- for (;;) {
- ch = rgetchar();
- if (!is_pack_letter(&ch, &mask)) {
- sound_bell();
- } else {
- break;
- }
- }
-
- if (ch == LIST) {
- check_message();
- mask = tmask;
- inventory(&rogue.pack, mask);
- } else {
- break;
- }
- mask = tmask;
- }
- check_message();
- return(ch);
-}
-
-take_off()
-{
- char desc[DCOLS];
- object *obj;
-
- if (rogue.armor) {
- if (rogue.armor->is_cursed) {
- message(curse_message, 0);
- } else {
- mv_aquatars();
- obj = rogue.armor;
- unwear(rogue.armor);
- (void) strcpy(desc, "was wearing ");
- get_desc(obj, desc+12);
- message(desc, 0);
- print_stats(STAT_ARMOR);
- (void) reg_move();
- }
- } else {
- message("not wearing any", 0);
- }
-}
-
-wear()
-{
- short ch;
- object *obj;
- char desc[DCOLS];
-
- if (rogue.armor) {
- message("your already wearing some", 0);
- return;
- }
- ch = pack_letter("wear what?", ARMOR);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (obj->what_is != ARMOR) {
- message("you can't wear that", 0);
- return;
- }
- obj->identified = 1;
- (void) strcpy(desc, "wearing ");
- get_desc(obj, desc + 8);
- message(desc, 0);
- do_wear(obj);
- print_stats(STAT_ARMOR);
- (void) reg_move();
-}
-
-unwear(obj)
-object *obj;
-{
- if (obj) {
- obj->in_use_flags &= (~BEING_WORN);
- }
- rogue.armor = (object *) 0;
-}
-
-do_wear(obj)
-object *obj;
-{
- rogue.armor = obj;
- obj->in_use_flags |= BEING_WORN;
- obj->identified = 1;
-}
-
-wield()
-{
- short ch;
- object *obj;
- char desc[DCOLS];
-
- if (rogue.weapon && rogue.weapon->is_cursed) {
- message(curse_message, 0);
- return;
- }
- ch = pack_letter("wield what?", WEAPON);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("No such item.", 0);
- return;
- }
- if (obj->what_is & (ARMOR | RING)) {
- sprintf(desc, "you can't wield %s",
- ((obj->what_is == ARMOR) ? "armor" : "rings"));
- message(desc, 0);
- return;
- }
- if (obj->in_use_flags & BEING_WIELDED) {
- message("in use", 0);
- } else {
- unwield(rogue.weapon);
- (void) strcpy(desc, "wielding ");
- get_desc(obj, desc + 9);
- message(desc, 0);
- do_wield(obj);
- (void) reg_move();
- }
-}
-
-do_wield(obj)
-object *obj;
-{
- rogue.weapon = obj;
- obj->in_use_flags |= BEING_WIELDED;
-}
-
-unwield(obj)
-object *obj;
-{
- if (obj) {
- obj->in_use_flags &= (~BEING_WIELDED);
- }
- rogue.weapon = (object *) 0;
-}
-
-call_it()
-{
- short ch;
- object *obj;
- struct id *id_table;
- char buf[MAX_TITLE_LENGTH+2];
-
- ch = pack_letter("call what?", (SCROL | POTION | WAND | RING));
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (!(obj->what_is & (SCROL | POTION | WAND | RING))) {
- message("surely you already know what that's called", 0);
- return;
- }
- id_table = get_id_table(obj);
-
- if (get_input_line("call it:","",buf,id_table[obj->which_kind].title,1,1)) {
- id_table[obj->which_kind].id_status = CALLED;
- (void) strcpy(id_table[obj->which_kind].title, buf);
- }
-}
-
-pack_count(new_obj)
-const object *new_obj;
-{
- object *obj;
- short count = 0;
-
- obj = rogue.pack.next_object;
-
- while (obj) {
- if (obj->what_is != WEAPON) {
- count += obj->quantity;
- } else if (!new_obj) {
- count++;
- } else if ((new_obj->what_is != WEAPON) ||
- ((obj->which_kind != ARROW) &&
- (obj->which_kind != DAGGER) &&
- (obj->which_kind != DART) &&
- (obj->which_kind != SHURIKEN)) ||
- (new_obj->which_kind != obj->which_kind) ||
- (obj->quiver != new_obj->quiver)) {
- count++;
- }
- obj = obj->next_object;
- }
- return(count);
-}
-
-boolean
-mask_pack(pack, mask)
-const object *pack;
-unsigned short mask;
-{
- while (pack->next_object) {
- pack = pack->next_object;
- if (pack->what_is & mask) {
- return(1);
- }
- }
- return(0);
-}
-
-is_pack_letter(c, mask)
-short *c;
-unsigned short *mask;
-{
- if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') ||
- (*c == ')') || (*c == ']') || (*c == '/') || (*c == ','))) {
- switch(*c) {
- case '?':
- *mask = SCROL;
- break;
- case '!':
- *mask = POTION;
- break;
- case ':':
- *mask = FOOD;
- break;
- case ')':
- *mask = WEAPON;
- break;
- case ']':
- *mask = ARMOR;
- break;
- case '/':
- *mask = WAND;
- break;
- case '=':
- *mask = RING;
- break;
- case ',':
- *mask = AMULET;
- break;
- }
- *c = LIST;
- return(1);
- }
- return(((*c >= 'a') && (*c <= 'z')) || (*c == CANCEL) || (*c == LIST));
-}
-
-has_amulet()
-{
- return(mask_pack(&rogue.pack, AMULET));
-}
-
-kick_into_pack()
-{
- object *obj;
- char desc[DCOLS];
- short n, stat;
-
- if (!(dungeon[rogue.row][rogue.col] & OBJECT)) {
- message("nothing here", 0);
- } else {
- if (obj = pick_up(rogue.row, rogue.col, &stat)) {
- get_desc(obj, desc);
- if (obj->what_is == GOLD) {
- message(desc, 0);
- free_object(obj);
- } else {
- n = strlen(desc);
- desc[n] = '(';
- desc[n+1] = obj->ichar;
- desc[n+2] = ')';
- desc[n+3] = 0;
- message(desc, 0);
- }
- }
- if (obj || (!stat)) {
- (void) reg_move();
- }
- }
-}
diff --git a/games/rogue/pathnames.h b/games/rogue/pathnames.h
deleted file mode 100644
index 2d2b9c0..0000000
--- a/games/rogue/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_SCOREFILE "/var/games/rogue.scores"
diff --git a/games/rogue/play.c b/games/rogue/play.c
deleted file mode 100644
index 13b319d..0000000
--- a/games/rogue/play.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * play.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-boolean interrupted = 0;
-const char *unknown_command = "unknown command";
-
-extern short party_room, bear_trap;
-extern char hit_message[];
-extern boolean wizard, trap_door;
-
-play_level()
-{
- short ch;
- int count;
-
- for (;;) {
- interrupted = 0;
- if (hit_message[0]) {
- message(hit_message, 1);
- hit_message[0] = 0;
- }
- if (trap_door) {
- trap_door = 0;
- return;
- }
- move(rogue.row, rogue.col);
- refresh();
-
- ch = rgetchar();
-CMCH:
- check_message();
- count = 0;
-CH:
- switch(ch) {
- case '.':
- rest((count > 0) ? count : 1);
- break;
- case 's':
- search(((count > 0) ? count : 1), 0);
- break;
- case 'i':
- inventory(&rogue.pack, ALL_OBJECTS);
- break;
- case 'f':
- fight(0);
- break;
- case 'F':
- fight(1);
- break;
- case 'h':
- case 'j':
- case 'k':
- case 'l':
- case 'y':
- case 'u':
- case 'n':
- case 'b':
- (void) one_move_rogue(ch, 1);
- break;
- case 'H':
- case 'J':
- case 'K':
- case 'L':
- case 'B':
- case 'Y':
- case 'U':
- case 'N':
- case '\010':
- case '\012':
- case '\013':
- case '\014':
- case '\031':
- case '\025':
- case '\016':
- case '\002':
- multiple_move_rogue(ch);
- break;
- case 'e':
- eat();
- break;
- case 'q':
- quaff();
- break;
- case 'r':
- read_scroll();
- break;
- case 'm':
- move_onto();
- break;
- case ',':
- kick_into_pack();
- break;
- case 'd':
- drop();
- break;
- case 'P':
- put_on_ring();
- break;
- case 'R':
- remove_ring();
- break;
- case '\020':
- do {
- remessage(count++);
- ch = rgetchar();
- } while (ch == '\020');
- goto CMCH;
- break;
- case '\027':
- wizardize();
- break;
- case '>':
- if (drop_check()) {
- return;
- }
- break;
- case '<':
- if (check_up()) {
- return;
- }
- break;
- case ')':
- case ']':
- inv_armor_weapon(ch == ')');
- break;
- case '=':
- inv_rings();
- break;
- case '^':
- id_trap();
- break;
- case '/':
- id_type();
- break;
- case '?':
- id_com();
- break;
- case '!':
- do_shell();
- break;
- case 'o':
- edit_opts();
- break;
- case 'I':
- single_inv(0);
- break;
- case 'T':
- take_off();
- break;
- case 'W':
- wear();
- break;
- case 'w':
- wield();
- break;
- case 'c':
- call_it();
- break;
- case 'z':
- zapp();
- break;
- case 't':
- throw();
- break;
- case 'v':
- message("rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims", 0);
- break;
- case 'Q':
- quit(0);
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- move(rogue.row, rogue.col);
- refresh();
- do {
- if (count < 100) {
- count = (10 * count) + (ch - '0');
- }
- ch = rgetchar();
- } while (is_digit(ch));
- if (ch != CANCEL) {
- goto CH;
- }
- break;
- case ' ':
- break;
- case '\011':
- if (wizard) {
- inventory(&level_objects, ALL_OBJECTS);
- } else {
- message(unknown_command, 0);
- }
- break;
- case '\023':
- if (wizard) {
- draw_magic_map();
- } else {
- message(unknown_command, 0);
- }
- break;
- case '\024':
- if (wizard) {
- show_traps();
- } else {
- message(unknown_command, 0);
- }
- break;
- case '\017':
- if (wizard) {
- show_objects();
- } else {
- message(unknown_command, 0);
- }
- break;
- case '\001':
- show_average_hp();
- break;
- case '\003':
- if (wizard) {
- c_object_for_wizard();
- } else {
- message(unknown_command, 0);
- }
- break;
- case '\015':
- if (wizard) {
- show_monsters();
- } else {
- message(unknown_command, 0);
- }
- break;
- case 'S':
- save_game();
- break;
- default:
- message(unknown_command, 0);
- break;
- }
- }
-}
diff --git a/games/rogue/random.c b/games/rogue/random.c
deleted file mode 100644
index 8105e65..0000000
--- a/games/rogue/random.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "rogue.h"
-
-#if 0
-/*
- * random.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-static long rntb[32] = {
- 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
- 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, 0x7449e56b,
- 0xbeb1dbb0, 0xab5c5918, 0x946554fd, 0x8c2e680f, 0xeb3d799f,
- 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, 0xe369735d,
- 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
- 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e,
- 0x8999220b, 0x27fb47b9
-};
-
-static long *fptr = &rntb[4];
-static long *rptr = &rntb[1];
-static long *state = &rntb[1];
-static int rand_type = 3;
-static int rand_deg = 31;
-static int rand_sep = 3;
-static long *end_ptr = &rntb[32];
-
-srrandom(x)
-int x;
-{
- int i;
-
- state[0] = (long) x;
- if (rand_type != 0) {
- for (i = 1; i < rand_deg; i++) {
- state[i] = 1103515245 * state[i - 1] + 12345;
- }
- fptr = &state[rand_sep];
- rptr = &state[0];
- for (i = 0; i < 10 * rand_deg; i++) {
- (void) rrandom();
- }
- }
-}
-
-long
-rrandom()
-{
- long i;
-
- if (rand_type == 0) {
- i = state[0] = (state[0]*1103515245 + 12345) & 0x7fffffff;
- } else {
- *fptr += *rptr;
- i = (*fptr >> 1) & 0x7fffffff;
- if (++fptr >= end_ptr) {
- fptr = state;
- ++rptr;
- } else {
- if (++rptr >= end_ptr) {
- rptr = state;
- }
- }
- }
- return(i);
-}
-#endif
-
-get_rand(x, y)
-int x, y;
-{
- int r, t;
- long lr;
-
- if (x > y) {
- t = y;
- y = x;
- x = t;
- }
- lr = rrandom();
- lr &= (long) 0x00003fff;
- r = (int) lr;
- r = (r % ((y - x) + 1)) + x;
- return(r);
-}
-
-rand_percent(percentage)
-int percentage;
-{
- return(get_rand(1, 100) <= percentage);
-}
-
-coin_toss()
-{
-
- return(((rrandom() & 01) ? 1 : 0));
-}
diff --git a/games/rogue/ring.c b/games/rogue/ring.c
deleted file mode 100644
index 4a4bb53..0000000
--- a/games/rogue/ring.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * ring.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-const char *left_or_right = "left or right hand?";
-const char *no_ring = "there's no ring on that hand";
-short stealthy;
-short r_rings;
-short add_strength;
-short e_rings;
-short regeneration;
-short ring_exp;
-short auto_search;
-boolean r_teleport;
-boolean r_see_invisible;
-boolean sustain_strength;
-boolean maintain_armor;
-
-extern char *curse_message;
-extern boolean wizard;
-
-put_on_ring()
-{
- short ch;
- char desc[DCOLS];
- object *ring;
-
- if (r_rings == 2) {
- message("wearing two rings already", 0);
- return;
- }
- if ((ch = pack_letter("put on what?", RING)) == CANCEL) {
- return;
- }
- if (!(ring = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (!(ring->what_is & RING)) {
- message("that's not a ring", 0);
- return;
- }
- if (ring->in_use_flags & (ON_LEFT_HAND | ON_RIGHT_HAND)) {
- message("that ring is already being worn", 0);
- return;
- }
- if (r_rings == 1) {
- ch = (rogue.left_ring ? 'r' : 'l');
- } else {
- message(left_or_right, 0);
- do {
- ch = rgetchar();
- } while ((ch != CANCEL) && (ch != 'l') && (ch != 'r') && (ch != '\n') &&
- (ch != '\r'));
- }
- if ((ch != 'l') && (ch != 'r')) {
- check_message();
- return;
- }
- if (((ch == 'l') && rogue.left_ring)||((ch == 'r') && rogue.right_ring)) {
- check_message();
- message("there's already a ring on that hand", 0);
- return;
- }
- if (ch == 'l') {
- do_put_on(ring, 1);
- } else {
- do_put_on(ring, 0);
- }
- ring_stats(1);
- check_message();
- get_desc(ring, desc);
- message(desc, 0);
- (void) reg_move();
-}
-
-/*
- * Do not call ring_stats() from within do_put_on(). It will cause
- * serious problems when do_put_on() is called from read_pack() in restore().
- */
-
-do_put_on(ring, on_left)
-object *ring;
-boolean on_left;
-{
- if (on_left) {
- ring->in_use_flags |= ON_LEFT_HAND;
- rogue.left_ring = ring;
- } else {
- ring->in_use_flags |= ON_RIGHT_HAND;
- rogue.right_ring = ring;
- }
-}
-
-remove_ring()
-{
- boolean left = 0, right = 0;
- short ch;
- char buf[DCOLS];
- object *ring;
-
- if (r_rings == 0) {
- inv_rings();
- } else if (rogue.left_ring && !rogue.right_ring) {
- left = 1;
- } else if (!rogue.left_ring && rogue.right_ring) {
- right = 1;
- } else {
- message(left_or_right, 0);
- do {
- ch = rgetchar();
- } while ((ch != CANCEL) && (ch != 'l') && (ch != 'r') &&
- (ch != '\n') && (ch != '\r'));
- left = (ch == 'l');
- right = (ch == 'r');
- check_message();
- }
- if (left || right) {
- if (left) {
- if (rogue.left_ring) {
- ring = rogue.left_ring;
- } else {
- message(no_ring, 0);
- }
- } else {
- if (rogue.right_ring) {
- ring = rogue.right_ring;
- } else {
- message(no_ring, 0);
- }
- }
- if (ring->is_cursed) {
- message(curse_message, 0);
- } else {
- un_put_on(ring);
- (void) strcpy(buf, "removed ");
- get_desc(ring, buf + 8);
- message(buf, 0);
- (void) reg_move();
- }
- }
-}
-
-un_put_on(ring)
-object *ring;
-{
- if (ring && (ring->in_use_flags & ON_LEFT_HAND)) {
- ring->in_use_flags &= (~ON_LEFT_HAND);
- rogue.left_ring = 0;
- } else if (ring && (ring->in_use_flags & ON_RIGHT_HAND)) {
- ring->in_use_flags &= (~ON_RIGHT_HAND);
- rogue.right_ring = 0;
- }
- ring_stats(1);
-}
-
-gr_ring(ring, assign_wk)
-object *ring;
-boolean assign_wk;
-{
- ring->what_is = RING;
- if (assign_wk) {
- ring->which_kind = get_rand(0, (RINGS - 1));
- }
- ring->class = 0;
-
- switch(ring->which_kind) {
- /*
- case STEALTH:
- break;
- case SLOW_DIGEST:
- break;
- case REGENERATION:
- break;
- case R_SEE_INVISIBLE:
- break;
- case SUSTAIN_STRENGTH:
- break;
- case R_MAINTAIN_ARMOR:
- break;
- case SEARCHING:
- break;
- */
- case R_TELEPORT:
- ring->is_cursed = 1;
- break;
- case ADD_STRENGTH:
- case DEXTERITY:
- while ((ring->class = (get_rand(0, 4) - 2)) == 0) ;
- ring->is_cursed = (ring->class < 0);
- break;
- case ADORNMENT:
- ring->is_cursed = coin_toss();
- break;
- }
-}
-
-inv_rings()
-{
- char buf[DCOLS];
-
- if (r_rings == 0) {
- message("not wearing any rings", 0);
- } else {
- if (rogue.left_ring) {
- get_desc(rogue.left_ring, buf);
- message(buf, 0);
- }
- if (rogue.right_ring) {
- get_desc(rogue.right_ring, buf);
- message(buf, 0);
- }
- }
- if (wizard) {
- sprintf(buf, "ste %d, r_r %d, e_r %d, r_t %d, s_s %d, a_s %d, reg %d, r_e %d, s_i %d, m_a %d, aus %d",
- stealthy, r_rings, e_rings, r_teleport, sustain_strength,
- add_strength, regeneration, ring_exp, r_see_invisible,
- maintain_armor, auto_search);
- message(buf, 0);
- }
-}
-
-ring_stats(pr)
-boolean pr;
-{
- short i;
- object *ring;
-
- stealthy = 0;
- r_rings = 0;
- e_rings = 0;
- r_teleport = 0;
- sustain_strength = 0;
- add_strength = 0;
- regeneration = 0;
- ring_exp = 0;
- r_see_invisible = 0;
- maintain_armor = 0;
- auto_search = 0;
-
- for (i = 0; i < 2; i++) {
- if (!(ring = ((i == 0) ? rogue.left_ring : rogue.right_ring))) {
- continue;
- }
- r_rings++;
- e_rings++;
- switch(ring->which_kind) {
- case STEALTH:
- stealthy++;
- break;
- case R_TELEPORT:
- r_teleport = 1;
- break;
- case REGENERATION:
- regeneration++;
- break;
- case SLOW_DIGEST:
- e_rings -= 2;
- break;
- case ADD_STRENGTH:
- add_strength += ring->class;
- break;
- case SUSTAIN_STRENGTH:
- sustain_strength = 1;
- break;
- case DEXTERITY:
- ring_exp += ring->class;
- break;
- case ADORNMENT:
- break;
- case R_SEE_INVISIBLE:
- r_see_invisible = 1;
- break;
- case MAINTAIN_ARMOR:
- maintain_armor = 1;
- break;
- case SEARCHING:
- auto_search += 2;
- break;
- }
- }
- if (pr) {
- print_stats(STAT_STRENGTH);
- relight();
- }
-}
diff --git a/games/rogue/rogue.6 b/games/rogue/rogue.6
deleted file mode 100644
index 614d3f6..0000000
--- a/games/rogue/rogue.6
+++ /dev/null
@@ -1,115 +0,0 @@
-.\" Copyright (c) 1988, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)rogue.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd December 7, 2000
-.Dt ROGUE 6
-.Os
-.Sh NAME
-.Nm rogue
-.Nd exploring The Dungeons of Doom
-.Sh SYNOPSIS
-.Nm
-.Op Fl r
-.Op Ar save_file
-.Op Fl s
-.Op Fl d
-.Sh DESCRIPTION
-The
-.Nm
-is a computer fantasy with a new twist.
-It is CRT oriented and the object of the game is to survive
-the attacks of various monsters and gather a lot of gold, rather
-than the puzzle solving orientation of most computer fantasy games.
-.Pp
-To get started you really only need to know two commands.
-The command
-.Ic ?\&
-will give you a list of the available commands and the command
-.Ic /
-will identify the things you see on the screen.
-.Pp
-To win the game (as opposed to merely playing to beat other people's high
-scores) you must locate the
-.Em Amulet of Yendor
-which is somewhere below the 20th level of the dungeon and get it out.
-Nobody has achieved this
-yet and if somebody does, they will probably go down in history as a hero
-among heroes.
-.Pp
-When the game ends, either by your death, when you quit, or if you (by
-some miracle) manage to win,
-.Nm
-will give you a list of the top-ten scorers.
-The scoring is based entirely upon how much gold you get.
-There is a 10% penalty for getting yourself killed.
-.Pp
-If
-.Ar save_file
-is specified,
-.Nm
-will be restored from the specified saved game file.
-.Pp
-The
-.Fl s
-option will print out the list of scores.
-.Pp
-For more detailed directions, read the document
-.Rs
-.%B A Guide to the Dungeons of Doom
-.Re
-.Sh AUTHORS
-.An Timothy Stoehr ,
-.An Michael C. Toy ,
-.An Kenneth C. R. C. Arnold ,
-.An Glenn Wichman
-.Sh FILES
-.Bl -tag -width /var/games/rogue.scoresXX -compact
-.It Pa /var/games/rogue.scores
-score file
-.It Pa rogue.save
-default save file
-.El
-.Sh SEE ALSO
-.Rs
-.%A Michael C. Toy
-.%A Kenneth C. R. C. Arnold
-.%B A Guide to the Dungeons of Doom
-.%O (see /usr/share/doc/usd/30.rogue/)
-.Re
-.Sh BUGS
-Probably infinite, although none are known.
-However, that Ice Monsters sometimes transfix you permanently is
-.Em not
-a bug.
-It's a feature.
diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h
deleted file mode 100644
index c8299db..0000000
--- a/games/rogue/rogue.h
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timoth C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)rogue.h 8.1 (Berkeley) 5/31/93
- * $FreeBSD$
- */
-
-#include <curses.h>
-#include <string.h>
-
-/*
- * rogue.h
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) This notice shall not be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- */
-
-#define boolean char
-
-#define NOTHING ((unsigned short) 0)
-#define OBJECT ((unsigned short) 01)
-#define MONSTER ((unsigned short) 02)
-#define STAIRS ((unsigned short) 04)
-#define HORWALL ((unsigned short) 010)
-#define VERTWALL ((unsigned short) 020)
-#define DOOR ((unsigned short) 040)
-#define FLOOR ((unsigned short) 0100)
-#define TUNNEL ((unsigned short) 0200)
-#define TRAP ((unsigned short) 0400)
-#define HIDDEN ((unsigned short) 01000)
-
-#define ARMOR ((unsigned short) 01)
-#define WEAPON ((unsigned short) 02)
-#define SCROL ((unsigned short) 04)
-#define POTION ((unsigned short) 010)
-#define GOLD ((unsigned short) 020)
-#define FOOD ((unsigned short) 040)
-#define WAND ((unsigned short) 0100)
-#define RING ((unsigned short) 0200)
-#define AMULET ((unsigned short) 0400)
-#define ALL_OBJECTS ((unsigned short) 0777)
-
-#define LEATHER 0
-#define RINGMAIL 1
-#define SCALE 2
-#define CHAIN 3
-#define BANDED 4
-#define SPLINT 5
-#define PLATE 6
-#define ARMORS 7
-
-#define BOW 0
-#define DART 1
-#define ARROW 2
-#define DAGGER 3
-#define SHURIKEN 4
-#define MACE 5
-#define LONG_SWORD 6
-#define TWO_HANDED_SWORD 7
-#define WEAPONS 8
-
-#define MAX_PACK_COUNT 24
-
-#define PROTECT_ARMOR 0
-#define HOLD_MONSTER 1
-#define ENCH_WEAPON 2
-#define ENCH_ARMOR 3
-#define IDENTIFY 4
-#define TELEPORT 5
-#define SLEEP 6
-#define SCARE_MONSTER 7
-#define REMOVE_CURSE 8
-#define CREATE_MONSTER 9
-#define AGGRAVATE_MONSTER 10
-#define MAGIC_MAPPING 11
-#define CON_MON 12
-#define SCROLS 13
-
-#define INCREASE_STRENGTH 0
-#define RESTORE_STRENGTH 1
-#define HEALING 2
-#define EXTRA_HEALING 3
-#define POISON 4
-#define RAISE_LEVEL 5
-#define BLINDNESS 6
-#define HALLUCINATION 7
-#define DETECT_MONSTER 8
-#define DETECT_OBJECTS 9
-#define CONFUSION 10
-#define LEVITATION 11
-#define HASTE_SELF 12
-#define SEE_INVISIBLE 13
-#define POTIONS 14
-
-#define TELE_AWAY 0
-#define SLOW_MONSTER 1
-#define INVISIBILITY 2
-#define POLYMORPH 3
-#define HASTE_MONSTER 4
-#define MAGIC_MISSILE 5
-#define CANCELLATION 6
-#define DO_NOTHING 7
-#define DRAIN_LIFE 8
-#define COLD 9
-#define FIRE 10
-#define WANDS 11
-
-#define STEALTH 0
-#define R_TELEPORT 1
-#define REGENERATION 2
-#define SLOW_DIGEST 3
-#define ADD_STRENGTH 4
-#define SUSTAIN_STRENGTH 5
-#define DEXTERITY 6
-#define ADORNMENT 7
-#define R_SEE_INVISIBLE 8
-#define MAINTAIN_ARMOR 9
-#define SEARCHING 10
-#define RINGS 11
-
-#define RATION 0
-#define FRUIT 1
-
-#define NOT_USED ((unsigned short) 0)
-#define BEING_WIELDED ((unsigned short) 01)
-#define BEING_WORN ((unsigned short) 02)
-#define ON_LEFT_HAND ((unsigned short) 04)
-#define ON_RIGHT_HAND ((unsigned short) 010)
-#define ON_EITHER_HAND ((unsigned short) 014)
-#define BEING_USED ((unsigned short) 017)
-
-#define NO_TRAP -1
-#define TRAP_DOOR 0
-#define BEAR_TRAP 1
-#define TELE_TRAP 2
-#define DART_TRAP 3
-#define SLEEPING_GAS_TRAP 4
-#define RUST_TRAP 5
-#define TRAPS 6
-
-#define STEALTH_FACTOR 3
-#define R_TELE_PERCENT 8
-
-#define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
-#define IDENTIFIED ((unsigned short) 01)
-#define CALLED ((unsigned short) 02)
-
-#define DROWS 24
-#define DCOLS 80
-#define NMESSAGES 5
-#define MAX_TITLE_LENGTH 30
-#define MAXSYLLABLES 40
-#define MAX_METAL 14
-#define WAND_MATERIALS 30
-#define GEMS 14
-
-#define GOLD_PERCENT 46
-
-#define MAX_OPT_LEN 40
-
-struct id {
- short value;
- char *title;
- char *real;
- unsigned short id_status;
-};
-
-/* The following #defines provide more meaningful names for some of the
- * struct object fields that are used for monsters. This, since each monster
- * and object (scrolls, potions, etc) are represented by a struct object.
- * Ideally, this should be handled by some kind of union structure.
- */
-
-#define m_damage damage
-#define hp_to_kill quantity
-#define m_char ichar
-#define first_level is_protected
-#define last_level is_cursed
-#define m_hit_chance class
-#define stationary_damage identified
-#define drop_percent which_kind
-#define trail_char d_enchant
-#define slowed_toggle quiver
-#define moves_confused hit_enchant
-#define nap_length picked_up
-#define disguise what_is
-#define next_monster next_object
-
-struct obj { /* comment is monster meaning */
- unsigned long m_flags; /* monster flags */
- const char *damage; /* damage it does */
- short quantity; /* hit points to kill */
- short ichar; /* 'A' is for aquatar */
- short kill_exp; /* exp for killing it */
- short is_protected; /* level starts */
- short is_cursed; /* level ends */
- short class; /* chance of hitting you */
- short identified; /* 'F' damage, 1,2,3... */
- unsigned short which_kind; /* item carry/drop % */
- short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */
- short row, col; /* current row, col */
- short d_enchant; /* room char when detect_monster */
- short quiver; /* monster slowed toggle */
- short trow, tcol; /* target row, col */
- short hit_enchant; /* how many moves is confused */
- unsigned short what_is; /* imitator's charactor (?!%: */
- short picked_up; /* sleep from wand of sleep */
- unsigned short in_use_flags;
- struct obj *next_object; /* next monster */
-};
-
-typedef struct obj object;
-
-#define INIT_AW (object*)0,(object*)0
-#define INIT_RINGS (object*)0,(object*)0
-#define INIT_HP 12,12
-#define INIT_STR 16,16
-#define INIT_EXP 1,0
-#define INIT_PACK {0}
-#define INIT_GOLD 0
-#define INIT_CHAR '@'
-#define INIT_MOVES 1250
-
-struct fightr {
- object *armor;
- object *weapon;
- object *left_ring, *right_ring;
- short hp_current;
- short hp_max;
- short str_current;
- short str_max;
- object pack;
- long gold;
- short exp;
- long exp_points;
- short row, col;
- short fchar;
- short moves_left;
-};
-
-typedef struct fightr fighter;
-
-struct dr {
- short oth_room;
- short oth_row,
- oth_col;
- short door_row,
- door_col;
-};
-
-typedef struct dr door;
-
-struct rm {
- short bottom_row, right_col, left_col, top_row;
- door doors[4];
- unsigned short is_room;
-};
-
-typedef struct rm room;
-
-#define MAXROOMS 9
-#define BIG_ROOM 10
-
-#define NO_ROOM -1
-
-#define PASSAGE -3 /* cur_room value */
-
-#define AMULET_LEVEL 26
-
-#define R_NOTHING ((unsigned short) 01)
-#define R_ROOM ((unsigned short) 02)
-#define R_MAZE ((unsigned short) 04)
-#define R_DEADEND ((unsigned short) 010)
-#define R_CROSS ((unsigned short) 020)
-
-#define MAX_EXP_LEVEL 21
-#define MAX_EXP 10000001L
-#define MAX_GOLD 999999
-#define MAX_ARMOR 99
-#define MAX_HP 999
-#define MAX_STRENGTH 99
-#define LAST_DUNGEON 99
-
-#define STAT_LEVEL 01
-#define STAT_GOLD 02
-#define STAT_HP 04
-#define STAT_STRENGTH 010
-#define STAT_ARMOR 020
-#define STAT_EXP 040
-#define STAT_HUNGER 0100
-#define STAT_LABEL 0200
-#define STAT_ALL 0377
-
-#define PARTY_TIME 10 /* one party somewhere in each 10 level span */
-
-#define MAX_TRAPS 10 /* maximum traps per level */
-
-#define HIDE_PERCENT 12
-
-struct tr {
- short trap_type;
- short trap_row, trap_col;
-};
-
-typedef struct tr trap;
-
-extern fighter rogue;
-extern room rooms[];
-extern trap traps[];
-extern unsigned short dungeon[DROWS][DCOLS];
-extern object level_objects;
-
-extern struct id id_scrolls[];
-extern struct id id_potions[];
-extern struct id id_wands[];
-extern struct id id_rings[];
-extern struct id id_weapons[];
-extern struct id id_armors[];
-
-extern object mon_tab[];
-extern object level_monsters;
-
-#define MONSTERS 26
-
-#define HASTED 01L
-#define SLOWED 02L
-#define INVISIBLE 04L
-#define ASLEEP 010L
-#define WAKENS 020L
-#define WANDERS 040L
-#define FLIES 0100L
-#define FLITS 0200L
-#define CAN_FLIT 0400L /* can, but usually doesn't, flit */
-#define CONFUSED 01000L
-#define RUSTS 02000L
-#define HOLDS 04000L
-#define FREEZES 010000L
-#define STEALS_GOLD 020000L
-#define STEALS_ITEM 040000L
-#define STINGS 0100000L
-#define DRAINS_LIFE 0200000L
-#define DROPS_LEVEL 0400000L
-#define SEEKS_GOLD 01000000L
-#define FREEZING_ROGUE 02000000L
-#define RUST_VANISHED 04000000L
-#define CONFUSES 010000000L
-#define IMITATES 020000000L
-#define FLAMES 040000000L
-#define STATIONARY 0100000000L /* damage will be 1,2,3,... */
-#define NAPPING 0200000000L /* can't wake up for a while */
-#define ALREADY_MOVED 0400000000L
-
-#define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
-
-#define WAKE_PERCENT 45
-#define FLIT_PERCENT 40
-#define PARTY_WAKE_PERCENT 75
-
-#define HYPOTHERMIA 1
-#define STARVATION 2
-#define POISON_DART 3
-#define QUIT 4
-#define WIN 5
-#define KFIRE 6
-
-#define UPWARD 0
-#define UPRIGHT 1
-#define RIGHT 2
-#define DOWNRIGHT 3
-#define DOWN 4
-#define DOWNLEFT 5
-#define LEFT 6
-#define UPLEFT 7
-#define DIRS 8
-
-#define ROW1 7
-#define ROW2 15
-
-#define COL1 26
-#define COL2 52
-
-#define MOVED 0
-#define MOVE_FAILED -1
-#define STOPPED_ON_SOMETHING -2
-#define CANCEL '\033'
-#define LIST '*'
-
-#define HUNGRY 300
-#define WEAK 150
-#define FAINT 20
-#define STARVE 0
-
-#define MIN_ROW 1
-
-/* external routine declarations.
- */
-const char *mon_name();
-const char *get_ench_color();
-const char *name_of();
-const char *md_gln();
-char *md_getenv();
-char *md_malloc();
-boolean is_direction();
-boolean mon_sees();
-boolean mask_pack();
-boolean mask_room();
-boolean is_digit();
-boolean check_hunger();
-boolean reg_move();
-boolean md_df();
-boolean has_been_touched();
-object *add_to_pack();
-object *alloc_object();
-object *get_letter_object();
-object *gr_monster();
-object *get_thrown_at_monster();
-object *get_zapped_monster();
-object *check_duplicate();
-object *gr_object();
-object *object_at();
-object *pick_up();
-struct id *get_id_table();
-unsigned short gr_what_is();
-#define rrandom random
-#define srrandom(x) srandomdev()
-long lget_number();
-long xxx();
-void byebye(), onintr(), error_save();
-
-struct rogue_time {
- short year; /* >= 1987 */
- short month; /* 1 - 12 */
- short day; /* 1 - 31 */
- short hour; /* 0 - 23 */
- short minute; /* 0 - 59 */
- short second; /* 0 - 59 */
-};
-
diff --git a/games/rogue/room.c b/games/rogue/room.c
deleted file mode 100644
index 08e8b68..0000000
--- a/games/rogue/room.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * room.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-room rooms[MAXROOMS];
-boolean rooms_visited[MAXROOMS];
-
-extern short blind;
-extern boolean detect_monster, jump, passgo, no_skull, ask_quit, flush;
-extern char *nick_name, *fruit, *save_file, *press_space;
-
-#define NOPTS 8
-
-struct option {
- const char *prompt;
- boolean is_bool;
- char **strval;
- boolean *bval;
-} options[NOPTS] = {
- {
- "Flush typeahead during battle (\"flush\"): ",
- 1, (char **) 0, &flush
- },
- {
- "Show position only at end of run (\"jump\"): ",
- 1, (char **) 0, &jump
- },
- {
- "Follow turnings in passageways (\"passgo\"): ",
- 1, (char **) 0, &passgo
- },
- {
- "Don't print skull when killed (\"noskull\" or \"notombstone\"): ",
- 1, (char **) 0, &no_skull
- },
- {
- "Ask player before saying 'Okay, bye-bye!' (\"askquit\"): ",
- 1, (char **) 0, &ask_quit
- },
- {
- "Name (\"name\"): ",
- 0, &nick_name
- },
- {
- "Fruit (\"fruit\"): ",
- 0, &fruit
- },
- {
- "Save file (\"file\"): ",
- 0, &save_file
- }
-};
-
-light_up_room(rn)
-int rn;
-{
- short i, j;
-
- if (!blind) {
- for (i = rooms[rn].top_row;
- i <= rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col;
- j <= rooms[rn].right_col; j++) {
- if (dungeon[i][j] & MONSTER) {
- object *monster;
-
- if (monster = object_at(&level_monsters, i, j)) {
- dungeon[monster->row][monster->col] &= (~MONSTER);
- monster->trail_char =
- get_dungeon_char(monster->row, monster->col);
- dungeon[monster->row][monster->col] |= MONSTER;
- }
- }
- mvaddch(i, j, get_dungeon_char(i, j));
- }
- }
- mvaddch(rogue.row, rogue.col, rogue.fchar);
- }
-}
-
-light_passage(row, col)
-int row, col;
-{
- short i, j, i_end, j_end;
-
- if (blind) {
- return;
- }
- i_end = (row < (DROWS-2)) ? 1 : 0;
- j_end = (col < (DCOLS-1)) ? 1 : 0;
-
- for (i = ((row > MIN_ROW) ? -1 : 0); i <= i_end; i++) {
- for (j = ((col > 0) ? -1 : 0); j <= j_end; j++) {
- if (can_move(row, col, row+i, col+j)) {
- mvaddch(row+i, col+j, get_dungeon_char(row+i, col+j));
- }
- }
- }
-}
-
-darken_room(rn)
-short rn;
-{
- short i, j;
-
- for (i = rooms[rn].top_row + 1; i < rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col + 1; j < rooms[rn].right_col; j++) {
- if (blind) {
- mvaddch(i, j, ' ');
- } else {
- if (!(dungeon[i][j] & (OBJECT | STAIRS)) &&
- !(detect_monster && (dungeon[i][j] & MONSTER))) {
- if (!imitating(i, j)) {
- mvaddch(i, j, ' ');
- }
- if ((dungeon[i][j] & TRAP) && (!(dungeon[i][j] & HIDDEN))) {
- mvaddch(i, j, '^');
- }
- }
- }
- }
- }
-}
-
-get_dungeon_char(row, col)
-int row, col;
-{
- unsigned short mask = dungeon[row][col];
-
- if (mask & MONSTER) {
- return(gmc_row_col(row, col));
- }
- if (mask & OBJECT) {
- object *obj;
-
- obj = object_at(&level_objects, row, col);
- return(get_mask_char(obj->what_is));
- }
- if (mask & (TUNNEL | STAIRS | HORWALL | VERTWALL | FLOOR | DOOR)) {
- if ((mask & (TUNNEL| STAIRS)) && (!(mask & HIDDEN))) {
- return(((mask & STAIRS) ? '%' : '#'));
- }
- if (mask & HORWALL) {
- return('-');
- }
- if (mask & VERTWALL) {
- return('|');
- }
- if (mask & FLOOR) {
- if (mask & TRAP) {
- if (!(dungeon[row][col] & HIDDEN)) {
- return('^');
- }
- }
- return('.');
- }
- if (mask & DOOR) {
- if (mask & HIDDEN) {
- if (((col > 0) && (dungeon[row][col-1] & HORWALL)) ||
- ((col < (DCOLS-1)) && (dungeon[row][col+1] & HORWALL))) {
- return('-');
- } else {
- return('|');
- }
- } else {
- return('+');
- }
- }
- }
- return(' ');
-}
-
-get_mask_char(mask)
-unsigned short mask;
-{
- switch(mask) {
- case SCROL:
- return('?');
- case POTION:
- return('!');
- case GOLD:
- return('*');
- case FOOD:
- return(':');
- case WAND:
- return('/');
- case ARMOR:
- return(']');
- case WEAPON:
- return(')');
- case RING:
- return('=');
- case AMULET:
- return(',');
- default:
- return('~'); /* unknown, something is wrong */
- }
-}
-
-gr_row_col(row, col, mask)
-short *row, *col;
-unsigned short mask;
-{
- short rn;
- short r, c;
-
- do {
- r = get_rand(MIN_ROW, DROWS-2);
- c = get_rand(0, DCOLS-1);
- rn = get_room_number(r, c);
- } while ((rn == NO_ROOM) ||
- (!(dungeon[r][c] & mask)) ||
- (dungeon[r][c] & (~mask)) ||
- (!(rooms[rn].is_room & (R_ROOM | R_MAZE))) ||
- ((r == rogue.row) && (c == rogue.col)));
-
- *row = r;
- *col = c;
-}
-
-gr_room()
-{
- short i;
-
- do {
- i = get_rand(0, MAXROOMS-1);
- } while (!(rooms[i].is_room & (R_ROOM | R_MAZE)));
-
- return(i);
-}
-
-party_objects(rn)
-{
- short i, j, nf = 0;
- object *obj;
- short n, N, row, col;
- boolean found;
-
- N = ((rooms[rn].bottom_row - rooms[rn].top_row) - 1) *
- ((rooms[rn].right_col - rooms[rn].left_col) - 1);
- n = get_rand(5, 10);
- if (n > N) {
- n = N - 2;
- }
- for (i = 0; i < n; i++) {
- for (j = found = 0; ((!found) && (j < 250)); j++) {
- row = get_rand(rooms[rn].top_row+1,
- rooms[rn].bottom_row-1);
- col = get_rand(rooms[rn].left_col+1,
- rooms[rn].right_col-1);
- if ((dungeon[row][col] == FLOOR) || (dungeon[row][col] == TUNNEL)) {
- found = 1;
- }
- }
- if (found) {
- obj = gr_object();
- place_at(obj, row, col);
- nf++;
- }
- }
- return(nf);
-}
-
-get_room_number(row, col)
-int row, col;
-{
- short i;
-
- for (i = 0; i < MAXROOMS; i++) {
- if ((row >= rooms[i].top_row) && (row <= rooms[i].bottom_row) &&
- (col >= rooms[i].left_col) && (col <= rooms[i].right_col)) {
- return(i);
- }
- }
- return(NO_ROOM);
-}
-
-is_all_connected()
-{
- short i, starting_room;
-
- for (i = 0; i < MAXROOMS; i++) {
- rooms_visited[i] = 0;
- if (rooms[i].is_room & (R_ROOM | R_MAZE)) {
- starting_room = i;
- }
- }
-
- visit_rooms(starting_room);
-
- for (i = 0; i < MAXROOMS; i++) {
- if ((rooms[i].is_room & (R_ROOM | R_MAZE)) && (!rooms_visited[i])) {
- return(0);
- }
- }
- return(1);
-}
-
-visit_rooms(rn)
-int rn;
-{
- short i;
- short oth_rn;
-
- rooms_visited[rn] = 1;
-
- for (i = 0; i < 4; i++) {
- oth_rn = rooms[rn].doors[i].oth_room;
- if ((oth_rn >= 0) && (!rooms_visited[oth_rn])) {
- visit_rooms(oth_rn);
- }
- }
-}
-
-draw_magic_map()
-{
- short i, j, ch, och;
- unsigned short mask = (HORWALL | VERTWALL | DOOR | TUNNEL | TRAP | STAIRS |
- MONSTER);
- unsigned short s;
-
- for (i = 0; i < DROWS; i++) {
- for (j = 0; j < DCOLS; j++) {
- s = dungeon[i][j];
- if (s & mask) {
- if (((ch = mvinch(i, j)) == ' ') ||
- ((ch >= 'A') && (ch <= 'Z')) || (s & (TRAP | HIDDEN))) {
- och = ch;
- dungeon[i][j] &= (~HIDDEN);
- if (s & HORWALL) {
- ch = '-';
- } else if (s & VERTWALL) {
- ch = '|';
- } else if (s & DOOR) {
- ch = '+';
- } else if (s & TRAP) {
- ch = '^';
- } else if (s & STAIRS) {
- ch = '%';
- } else if (s & TUNNEL) {
- ch = '#';
- } else {
- continue;
- }
- if ((!(s & MONSTER)) || (och == ' ')) {
- addch(ch);
- }
- if (s & MONSTER) {
- object *monster;
-
- if (monster = object_at(&level_monsters, i, j)) {
- monster->trail_char = ch;
- }
- }
- }
- }
- }
- }
-}
-
-dr_course(monster, entering, row, col)
-object *monster;
-boolean entering;
-short row, col;
-{
- short i, j, k, rn;
- short r, rr;
-
- monster->row = row;
- monster->col = col;
-
- if (mon_sees(monster, rogue.row, rogue.col)) {
- monster->trow = NO_ROOM;
- return;
- }
- rn = get_room_number(row, col);
-
- if (entering) { /* entering room */
- /* look for door to some other room */
- r = get_rand(0, MAXROOMS-1);
- for (i = 0; i < MAXROOMS; i++) {
- rr = (r + i) % MAXROOMS;
- if ((!(rooms[rr].is_room & (R_ROOM | R_MAZE))) || (rr == rn)) {
- continue;
- }
- for (k = 0; k < 4; k++) {
- if (rooms[rr].doors[k].oth_room == rn) {
- monster->trow = rooms[rr].doors[k].oth_row;
- monster->tcol = rooms[rr].doors[k].oth_col;
- if ((monster->trow == row) &&
- (monster->tcol == col)) {
- continue;
- }
- return;
- }
- }
- }
- /* look for door to dead end */
- for (i = rooms[rn].top_row; i <= rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col; j <= rooms[rn].right_col; j++) {
- if ((i != monster->row) && (j != monster->col) &&
- (dungeon[i][j] & DOOR)) {
- monster->trow = i;
- monster->tcol = j;
- return;
- }
- }
- }
- /* return monster to room that he came from */
- for (i = 0; i < MAXROOMS; i++) {
- for (j = 0; j < 4; j++) {
- if (rooms[i].doors[j].oth_room == rn) {
- for (k = 0; k < 4; k++) {
- if (rooms[rn].doors[k].oth_room == i) {
- monster->trow = rooms[rn].doors[k].oth_row;
- monster->tcol = rooms[rn].doors[k].oth_col;
- return;
- }
- }
- }
- }
- }
- /* no place to send monster */
- monster->trow = NO_ROOM;
- } else { /* exiting room */
- if (!get_oth_room(rn, &row, &col)) {
- monster->trow = NO_ROOM;
- } else {
- monster->trow = row;
- monster->tcol = col;
- }
- }
-}
-
-get_oth_room(rn, row, col)
-short rn, *row, *col;
-{
- short d = -1;
-
- if (*row == rooms[rn].top_row) {
- d = UPWARD/2;
- } else if (*row == rooms[rn].bottom_row) {
- d = DOWN/2;
- } else if (*col == rooms[rn].left_col) {
- d = LEFT/2;
- } else if (*col == rooms[rn].right_col) {
- d = RIGHT/2;
- }
- if ((d != -1) && (rooms[rn].doors[d].oth_room >= 0)) {
- *row = rooms[rn].doors[d].oth_row;
- *col = rooms[rn].doors[d].oth_col;
- return(1);
- }
- return(0);
-}
-
-edit_opts()
-{
- char save[NOPTS+1][DCOLS];
- short i, j;
- short ch;
- boolean done = 0;
- char buf[MAX_OPT_LEN + 2];
-
- for (i = 0; i < NOPTS+1; i++) {
- for (j = 0; j < DCOLS; j++) {
- save[i][j] = mvinch(i, j);
- }
- if (i < NOPTS) {
- opt_show(i);
- }
- }
- opt_go(0);
- i = 0;
-
- while (!done) {
- refresh();
- ch = rgetchar();
-CH:
- switch(ch) {
- case '\033':
- done = 1;
- break;
- case '\012':
- case '\015':
- if (i == (NOPTS - 1)) {
- mvaddstr(NOPTS, 0, press_space);
- refresh();
- wait_for_ack();
- done = 1;
- } else {
- i++;
- opt_go(i);
- }
- break;
- case '-':
- if (i > 0) {
- opt_go(--i);
- } else {
- sound_bell();
- }
- break;
- case 't':
- case 'T':
- case 'f':
- case 'F':
- if (options[i].is_bool) {
- *(options[i].bval) = (((ch == 't') || (ch == 'T')) ? 1 : 0);
- opt_show(i);
- opt_go(++i);
- break;
- }
- default:
- if (options[i].is_bool) {
- sound_bell();
- break;
- }
- j = 0;
- if ((ch == '\010') || ((ch >= ' ') && (ch <= '~'))) {
- opt_erase(i);
- do {
- if ((ch >= ' ') && (ch <= '~') && (j < MAX_OPT_LEN)) {
- buf[j++] = ch;
- buf[j] = '\0';
- addch(ch);
- } else if ((ch == '\010') && (j > 0)) {
- buf[--j] = '\0';
- move(i, j + strlen(options[i].prompt));
- addch(' ');
- move(i, j + strlen(options[i].prompt));
- }
- refresh();
- ch = rgetchar();
- } while ((ch != '\012') && (ch != '\015') && (ch != '\033'));
- if (j != 0) {
- (void) strcpy(*(options[i].strval), buf);
- }
- opt_show(i);
- goto CH;
- } else {
- sound_bell();
- }
- break;
- }
- }
-
- for (i = 0; i < NOPTS+1; i++) {
- move(i, 0);
- for (j = 0; j < DCOLS; j++) {
- addch(save[i][j]);
- }
- }
-}
-
-opt_show(i)
-int i;
-{
- const char *s;
- struct option *opt = &options[i];
-
- opt_erase(i);
-
- if (opt->is_bool) {
- s = *(opt->bval) ? "True" : "False";
- } else {
- s = *(opt->strval);
- }
- addstr(s);
-}
-
-opt_erase(i)
-int i;
-{
- struct option *opt = &options[i];
-
- mvaddstr(i, 0, opt->prompt);
- clrtoeol();
-}
-
-opt_go(i)
-int i;
-{
- move(i, strlen(options[i].prompt));
-}
-
-do_shell()
-{
-#ifdef UNIX
- const char *sh;
-
- md_ignore_signals();
- if (!(sh = md_getenv("SHELL"))) {
- sh = "/bin/sh";
- }
- move(LINES-1, 0);
- refresh();
- stop_window();
- printf("\nCreating new shell...\n");
- md_shell(sh);
- start_window();
- wrefresh(curscr);
- md_heed_signals();
-#endif
-}
diff --git a/games/rogue/save.c b/games/rogue/save.c
deleted file mode 100644
index 938217b..0000000
--- a/games/rogue/save.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * save.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include <stdio.h>
-#include "rogue.h"
-
-short write_failed = 0;
-char *save_file = (char *) 0;
-static char save_name[80];
-
-extern boolean detect_monster;
-extern short cur_level, max_level;
-extern char hunger_str[];
-extern char login_name[];
-extern short party_room;
-extern short foods;
-extern boolean is_wood[];
-extern short cur_room;
-extern boolean being_held;
-extern short bear_trap;
-extern short halluc;
-extern short blind;
-extern short confused;
-extern short levitate;
-extern short haste_self;
-extern boolean see_invisible;
-extern boolean detect_monster;
-extern boolean wizard;
-extern boolean score_only;
-extern short m_moves;
-
-extern boolean msg_cleared;
-
-save_game()
-{
- char fname[64];
-
- if (!get_input_line("file name?", save_file, fname, "game not saved",
- 0, 1)) {
- return;
- }
- check_message();
- message(fname, 0);
- save_into_file(fname);
-}
-
-save_into_file(sfile)
-const char *sfile;
-{
- FILE *fp;
- int file_id;
- char name_buffer[80];
- char *hptr;
- struct rogue_time rt_buf;
-
- if (sfile[0] == '~') {
- if (hptr = md_getenv("HOME")) {
- (void) strcpy(name_buffer, hptr);
- (void) strcat(name_buffer, sfile+1);
- sfile = name_buffer;
- }
- }
- /* revoke */
- setgid(getgid());
- if ( ((fp = fopen(sfile, "w")) == NULL) ||
- ((file_id = md_get_file_id(sfile)) == -1)) {
- message("problem accessing the save file", 0);
- return;
- }
- md_ignore_signals();
- write_failed = 0;
- (void) xxx(1);
- r_write(fp, (char *) &detect_monster, sizeof(detect_monster));
- r_write(fp, (char *) &cur_level, sizeof(cur_level));
- r_write(fp, (char *) &max_level, sizeof(max_level));
- write_string(hunger_str, fp);
- write_string(login_name, fp);
- r_write(fp, (char *) &party_room, sizeof(party_room));
- write_pack(&level_monsters, fp);
- write_pack(&level_objects, fp);
- r_write(fp, (char *) &file_id, sizeof(file_id));
- rw_dungeon(fp, 1);
- r_write(fp, (char *) &foods, sizeof(foods));
- r_write(fp, (char *) &rogue, sizeof(fighter));
- write_pack(&rogue.pack, fp);
- rw_id(id_potions, fp, POTIONS, 1);
- rw_id(id_scrolls, fp, SCROLS, 1);
- rw_id(id_wands, fp, WANDS, 1);
- rw_id(id_rings, fp, RINGS, 1);
- r_write(fp, (char *) traps, (MAX_TRAPS * sizeof(trap)));
- r_write(fp, (char *) is_wood, (WANDS * sizeof(boolean)));
- r_write(fp, (char *) &cur_room, sizeof(cur_room));
- rw_rooms(fp, 1);
- r_write(fp, (char *) &being_held, sizeof(being_held));
- r_write(fp, (char *) &bear_trap, sizeof(bear_trap));
- r_write(fp, (char *) &halluc, sizeof(halluc));
- r_write(fp, (char *) &blind, sizeof(blind));
- r_write(fp, (char *) &confused, sizeof(confused));
- r_write(fp, (char *) &levitate, sizeof(levitate));
- r_write(fp, (char *) &haste_self, sizeof(haste_self));
- r_write(fp, (char *) &see_invisible, sizeof(see_invisible));
- r_write(fp, (char *) &detect_monster, sizeof(detect_monster));
- r_write(fp, (char *) &wizard, sizeof(wizard));
- r_write(fp, (char *) &score_only, sizeof(score_only));
- r_write(fp, (char *) &m_moves, sizeof(m_moves));
- md_gct(&rt_buf);
- rt_buf.second += 10; /* allow for some processing time */
- r_write(fp, (char *) &rt_buf, sizeof(rt_buf));
- fclose(fp);
-
- if (write_failed) {
- (void) md_df(sfile); /* delete file */
- } else {
- if (strcmp(sfile, save_name) == 0)
- save_name[0] = 0;
- clean_up("");
- }
-}
-
-static del_save_file()
-{
- if (!save_name[0])
- return;
- /* revoke */
- setgid(getgid());
- md_df(save_name);
-}
-
-restore(fname)
-const char *fname;
-{
- FILE *fp;
- struct rogue_time saved_time, mod_time;
- char buf[4];
- char tbuf[40];
- int new_file_id, saved_file_id;
-
- if ( ((new_file_id = md_get_file_id(fname)) == -1) ||
- ((fp = fopen(fname, "r")) == NULL)) {
- clean_up("cannot open file");
- }
- if (md_link_count(fname) > 1) {
- clean_up("file has link");
- }
- (void) xxx(1);
- r_read(fp, (char *) &detect_monster, sizeof(detect_monster));
- r_read(fp, (char *) &cur_level, sizeof(cur_level));
- r_read(fp, (char *) &max_level, sizeof(max_level));
- read_string(hunger_str, fp);
-
- (void) strcpy(tbuf, login_name);
- read_string(login_name, fp);
- if (strcmp(tbuf, login_name)) {
- clean_up("you're not the original player");
- }
-
- r_read(fp, (char *) &party_room, sizeof(party_room));
- read_pack(&level_monsters, fp, 0);
- read_pack(&level_objects, fp, 0);
- r_read(fp, (char *) &saved_file_id, sizeof(saved_file_id));
- if (new_file_id != saved_file_id) {
- clean_up("sorry, saved game is not in the same file");
- }
- rw_dungeon(fp, 0);
- r_read(fp, (char *) &foods, sizeof(foods));
- r_read(fp, (char *) &rogue, sizeof(fighter));
- read_pack(&rogue.pack, fp, 1);
- rw_id(id_potions, fp, POTIONS, 0);
- rw_id(id_scrolls, fp, SCROLS, 0);
- rw_id(id_wands, fp, WANDS, 0);
- rw_id(id_rings, fp, RINGS, 0);
- r_read(fp, (char *) traps, (MAX_TRAPS * sizeof(trap)));
- r_read(fp, (char *) is_wood, (WANDS * sizeof(boolean)));
- r_read(fp, (char *) &cur_room, sizeof(cur_room));
- rw_rooms(fp, 0);
- r_read(fp, (char *) &being_held, sizeof(being_held));
- r_read(fp, (char *) &bear_trap, sizeof(bear_trap));
- r_read(fp, (char *) &halluc, sizeof(halluc));
- r_read(fp, (char *) &blind, sizeof(blind));
- r_read(fp, (char *) &confused, sizeof(confused));
- r_read(fp, (char *) &levitate, sizeof(levitate));
- r_read(fp, (char *) &haste_self, sizeof(haste_self));
- r_read(fp, (char *) &see_invisible, sizeof(see_invisible));
- r_read(fp, (char *) &detect_monster, sizeof(detect_monster));
- r_read(fp, (char *) &wizard, sizeof(wizard));
- r_read(fp, (char *) &score_only, sizeof(score_only));
- r_read(fp, (char *) &m_moves, sizeof(m_moves));
- r_read(fp, (char *) &saved_time, sizeof(saved_time));
-
- if (fread(buf, sizeof(char), 1, fp) > 0) {
- clear();
- clean_up("extra characters in file");
- }
-
- md_gfmt(fname, &mod_time); /* get file modification time */
-
- if (has_been_touched(&saved_time, &mod_time)) {
- clear();
- clean_up("sorry, file has been touched");
- }
- if ((!wizard)) {
- strcpy(save_name, fname);
- atexit(del_save_file);
- }
- msg_cleared = 0;
- ring_stats(0);
- fclose(fp);
-}
-
-write_pack(pack, fp)
-const object *pack;
-FILE *fp;
-{
- object t;
-
- while (pack = pack->next_object) {
- r_write(fp, (const char *) pack, sizeof(object));
- }
- t.ichar = t.what_is = 0;
- r_write(fp, (const char *) &t, sizeof(object));
-}
-
-read_pack(pack, fp, is_rogue)
-object *pack;
-FILE *fp;
-boolean is_rogue;
-{
- object read_obj, *new_obj;
-
- for (;;) {
- r_read(fp, (char *) &read_obj, sizeof(object));
- if (read_obj.ichar == 0) {
- pack->next_object = (object *) 0;
- break;
- }
- new_obj = alloc_object();
- *new_obj = read_obj;
- if (is_rogue) {
- if (new_obj->in_use_flags & BEING_WORN) {
- do_wear(new_obj);
- } else if (new_obj->in_use_flags & BEING_WIELDED) {
- do_wield(new_obj);
- } else if (new_obj->in_use_flags & (ON_EITHER_HAND)) {
- do_put_on(new_obj,
- ((new_obj->in_use_flags & ON_LEFT_HAND) ? 1 : 0));
- }
- }
- pack->next_object = new_obj;
- pack = new_obj;
- }
-}
-
-rw_dungeon(fp, rw)
-FILE *fp;
-boolean rw;
-{
- short i, j;
- char buf[DCOLS];
-
- for (i = 0; i < DROWS; i++) {
- if (rw) {
- r_write(fp, (char *) dungeon[i], (DCOLS * sizeof(dungeon[0][0])));
- for (j = 0; j < DCOLS; j++) {
- buf[j] = mvinch(i, j);
- }
- r_write(fp, buf, DCOLS);
- } else {
- r_read(fp, (char *) dungeon[i], (DCOLS * sizeof(dungeon[0][0])));
- r_read(fp, buf, DCOLS);
- for (j = 0; j < DCOLS; j++) {
- mvaddch(i, j, buf[j]);
- }
- }
- }
-}
-
-rw_id(id_table, fp, n, wr)
-struct id id_table[];
-FILE *fp;
-int n;
-boolean wr;
-{
- short i;
-
- for (i = 0; i < n; i++) {
- if (wr) {
- r_write(fp, (const char *) &(id_table[i].value), sizeof(short));
- r_write(fp, (const char *) &(id_table[i].id_status),
- sizeof(unsigned short));
- write_string(id_table[i].title, fp);
- } else {
- r_read(fp, (char *) &(id_table[i].value), sizeof(short));
- r_read(fp, (char *) &(id_table[i].id_status),
- sizeof(unsigned short));
- read_string(id_table[i].title, fp);
- }
- }
-}
-
-write_string(s, fp)
-char *s;
-FILE *fp;
-{
- short n;
-
- n = strlen(s) + 1;
- xxxx(s, n);
- r_write(fp, (char *) &n, sizeof(short));
- r_write(fp, s, n);
-}
-
-read_string(s, fp)
-char *s;
-FILE *fp;
-{
- short n;
-
- r_read(fp, (char *) &n, sizeof(short));
- r_read(fp, s, n);
- xxxx(s, n);
-}
-
-rw_rooms(fp, rw)
-FILE *fp;
-boolean rw;
-{
- short i;
-
- for (i = 0; i < MAXROOMS; i++) {
- rw ? r_write(fp, (char *) (rooms + i), sizeof(room)) :
- r_read(fp, (char *) (rooms + i), sizeof(room));
- }
-}
-
-r_read(fp, buf, n)
-FILE *fp;
-char *buf;
-int n;
-{
- if (fread(buf, sizeof(char), n, fp) != n) {
- clean_up("read() failed, don't know why");
- }
-}
-
-r_write(fp, buf, n)
-FILE *fp;
-const char *buf;
-int n;
-{
- if (!write_failed) {
- if (fwrite(buf, sizeof(char), n, fp) != n) {
- message("write() failed, don't know why", 0);
- sound_bell();
- write_failed = 1;
- }
- }
-}
-
-boolean
-has_been_touched(saved_time, mod_time)
-const struct rogue_time *saved_time, *mod_time;
-{
- if (saved_time->year < mod_time->year) {
- return(1);
- } else if (saved_time->year > mod_time->year) {
- return(0);
- }
- if (saved_time->month < mod_time->month) {
- return(1);
- } else if (saved_time->month > mod_time->month) {
- return(0);
- }
- if (saved_time->day < mod_time->day) {
- return(1);
- } else if (saved_time->day > mod_time->day) {
- return(0);
- }
- if (saved_time->hour < mod_time->hour) {
- return(1);
- } else if (saved_time->hour > mod_time->hour) {
- return(0);
- }
- if (saved_time->minute < mod_time->minute) {
- return(1);
- } else if (saved_time->minute > mod_time->minute) {
- return(0);
- }
- if (saved_time->second < mod_time->second) {
- return(1);
- }
- return(0);
-}
diff --git a/games/rogue/score.c b/games/rogue/score.c
deleted file mode 100644
index 1f0794a..0000000
--- a/games/rogue/score.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * score.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include <stdio.h>
-#include "rogue.h"
-#include "pathnames.h"
-
-extern char login_name[];
-extern char *m_names[];
-extern short max_level;
-extern boolean score_only, no_skull, msg_cleared;
-extern char *byebye_string, *nick_name;
-
-killed_by(monster, other)
-const object *monster;
-short other;
-{
- char buf[128];
-
- md_ignore_signals();
-
- if (other != QUIT) {
- rogue.gold = ((rogue.gold * 9) / 10);
- }
-
- if (other) {
- switch(other) {
- case HYPOTHERMIA:
- (void) strcpy(buf, "died of hypothermia");
- break;
- case STARVATION:
- (void) strcpy(buf, "died of starvation");
- break;
- case POISON_DART:
- (void) strcpy(buf, "killed by a dart");
- break;
- case QUIT:
- (void) strcpy(buf, "quit");
- break;
- case KFIRE:
- (void) strcpy(buf, "killed by fire");
- break;
- }
- } else {
- (void) strcpy(buf, "Killed by ");
- if (is_vowel(m_names[monster->m_char - 'A'][0])) {
- (void) strcat(buf, "an ");
- } else {
- (void) strcat(buf, "a ");
- }
- (void) strcat(buf, m_names[monster->m_char - 'A']);
- }
- (void) strcat(buf, " with ");
- sprintf(buf+strlen(buf), "%ld gold", rogue.gold);
- if ((!other) && (!no_skull)) {
- clear();
- mvaddstr(4, 32, "__---------__");
- mvaddstr(5, 30, "_~ ~_");
- mvaddstr(6, 29, "/ \\");
- mvaddstr(7, 28, "~ ~");
- mvaddstr(8, 27, "/ \\");
- mvaddstr(9, 27, "| XXXX XXXX |");
- mvaddstr(10, 27, "| XXXX XXXX |");
- mvaddstr(11, 27, "| XXX XXX |");
- mvaddstr(12, 28, "\\ @ /");
- mvaddstr(13, 29, "--\\ @@@ /--");
- mvaddstr(14, 30, "| | @@@ | |");
- mvaddstr(15, 30, "| | | |");
- mvaddstr(16, 30, "| vvVvvvvvvvVvv |");
- mvaddstr(17, 30, "| ^^^^^^^^^^^ |");
- mvaddstr(18, 31, "\\_ _/");
- mvaddstr(19, 33, "~---------~");
- center(21, nick_name);
- center(22, buf);
- } else {
- message(buf, 0);
- }
- message("", 0);
- put_scores(monster, other);
-}
-
-win()
-{
- unwield(rogue.weapon); /* disarm and relax */
- unwear(rogue.armor);
- un_put_on(rogue.left_ring);
- un_put_on(rogue.right_ring);
-
- clear();
- mvaddstr(10, 11, "@ @ @@@ @ @ @ @ @ @@@ @ @ @");
- mvaddstr(11, 11, " @ @ @ @ @ @ @ @ @ @ @ @@ @ @");
- mvaddstr(12, 11, " @ @ @ @ @ @ @ @ @ @ @ @ @ @");
- mvaddstr(13, 11, " @ @ @ @ @ @ @ @ @ @ @ @@");
- mvaddstr(14, 11, " @ @@@ @@@ @@ @@ @@@ @ @ @");
- mvaddstr(17, 11, "Congratulations, you have been admitted to the");
- mvaddstr(18, 11, "Fighters' Guild. You return home, sell all your");
- mvaddstr(19, 11, "treasures at great profit and retire into comfort.");
- message("", 0);
- message("", 0);
- id_all();
- sell_pack();
- put_scores((object *) 0, WIN);
-}
-
-quit(from_intrpt)
-boolean from_intrpt;
-{
- char buf[128];
- short i, orow, ocol;
- boolean mc;
-
- md_ignore_signals();
-
- if (from_intrpt) {
- orow = rogue.row;
- ocol = rogue.col;
-
- mc = msg_cleared;
-
- for (i = 0; i < DCOLS; i++) {
- buf[i] = mvinch(0, i);
- }
- }
- check_message();
- message("really quit?", 1);
- if (rgetchar() != 'y') {
- md_heed_signals();
- check_message();
- if (from_intrpt) {
- for (i = 0; i < DCOLS; i++) {
- mvaddch(0, i, buf[i]);
- }
- msg_cleared = mc;
- move(orow, ocol);
- refresh();
- }
- return;
- }
- if (from_intrpt) {
- clean_up(byebye_string);
- }
- check_message();
- killed_by((object *) 0, QUIT);
-}
-
-put_scores(monster, other)
-const object *monster;
-short other;
-{
- short i, n, rank = 10, x, ne = 0, found_player = -1;
- char scores[10][82];
- char n_names[10][30];
- char buf[128];
- FILE *fp;
- long s;
- boolean pause = score_only;
-
- md_lock(1);
-
- if ((fp = fopen(_PATH_SCOREFILE, "r+")) == NULL &&
- (fp = fopen(_PATH_SCOREFILE, "w+")) == NULL) {
- message("cannot read/write/create score file", 0);
- sf_error();
- }
- rewind(fp);
- (void) xxx(1);
-
- for (i = 0; i < 10; i++) {
- if (((n = fread(scores[i], sizeof(char), 80, fp)) < 80) && (n != 0)) {
- sf_error();
- } else if (n != 0) {
- xxxx(scores[i], 80);
- if ((n = fread(n_names[i], sizeof(char), 30, fp)) < 30) {
- sf_error();
- }
- xxxx(n_names[i], 30);
- } else {
- break;
- }
- ne++;
- if ((!score_only) && (found_player == -1)) {
- if (!name_cmp(scores[i]+15, login_name)) {
- x = 5;
- while (scores[i][x] == ' ') {
- x++;
- }
- s = lget_number(scores[i] + x);
- if (rogue.gold < s) {
- score_only = 1;
- } else {
- found_player = i;
- }
- }
- }
- }
- if (found_player != -1) {
- ne--;
- for (i = found_player; i < ne; i++) {
- (void) strcpy(scores[i], scores[i+1]);
- (void) strcpy(n_names[i], n_names[i+1]);
- }
- }
- if (!score_only) {
- for (i = 0; i < ne; i++) {
- x = 5;
- while (scores[i][x] == ' ') {
- x++;
- }
- s = lget_number(scores[i] + x);
-
- if (rogue.gold >= s) {
- rank = i;
- break;
- }
- }
- if (ne == 0) {
- rank = 0;
- } else if ((ne < 10) && (rank == 10)) {
- rank = ne;
- }
- if (rank < 10) {
- insert_score(scores, n_names, nick_name, rank, ne, monster,
- other);
- if (ne < 10) {
- ne++;
- }
- }
- rewind(fp);
- }
-
- clear();
- mvaddstr(3, 30, "Top Ten Rogueists");
- mvaddstr(8, 0, "Rank Score Name");
-
- md_ignore_signals();
-
- (void) xxx(1);
-
- for (i = 0; i < ne; i++) {
- if (i == rank) {
- standout();
- }
- if (i == 9) {
- scores[i][0] = '1';
- scores[i][1] = '0';
- } else {
- scores[i][0] = ' ';
- scores[i][1] = i + '1';
- }
- nickize(buf, scores[i], n_names[i]);
- mvaddstr(i+10, 0, buf);
- if (rank < 10) {
- xxxx(scores[i], 80);
- fwrite(scores[i], sizeof(char), 80, fp);
- xxxx(n_names[i], 30);
- fwrite(n_names[i], sizeof(char), 30, fp);
- }
- if (i == rank) {
- standend();
- }
- }
- md_lock(0);
- refresh();
- fclose(fp);
- message("", 0);
- if (pause) {
- message("", 0);
- }
- clean_up("");
-}
-
-insert_score(scores, n_names, n_name, rank, n, monster, other)
-char scores[][82];
-char n_names[][30];
-const char *n_name;
-short rank, n;
-const object *monster;
-{
- short i;
- char buf[128];
-
- if (n > 0) {
- for (i = n; i > rank; i--) {
- if ((i < 10) && (i > 0)) {
- (void) strcpy(scores[i], scores[i-1]);
- (void) strcpy(n_names[i], n_names[i-1]);
- }
- }
- }
- sprintf(buf, "%2d %6ld %s: ", rank+1, rogue.gold, login_name);
-
- if (other) {
- switch(other) {
- case HYPOTHERMIA:
- (void) strcat(buf, "died of hypothermia");
- break;
- case STARVATION:
- (void) strcat(buf, "died of starvation");
- break;
- case POISON_DART:
- (void) strcat(buf, "killed by a dart");
- break;
- case QUIT:
- (void) strcat(buf, "quit");
- break;
- case WIN:
- (void) strcat(buf, "a total winner");
- break;
- case KFIRE:
- (void) strcat(buf, "killed by fire");
- break;
- }
- } else {
- (void) strcat(buf, "killed by ");
- if (is_vowel(m_names[monster->m_char - 'A'][0])) {
- (void) strcat(buf, "an ");
- } else {
- (void) strcat(buf, "a ");
- }
- (void) strcat(buf, m_names[monster->m_char - 'A']);
- }
- sprintf(buf+strlen(buf), " on level %d ", max_level);
- if ((other != WIN) && has_amulet()) {
- (void) strcat(buf, "with amulet");
- }
- for (i = strlen(buf); i < 79; i++) {
- buf[i] = ' ';
- }
- buf[79] = 0;
- (void) strcpy(scores[rank], buf);
- (void) strcpy(n_names[rank], n_name);
-}
-
-is_vowel(ch)
-short ch;
-{
- return( (ch == 'a') ||
- (ch == 'e') ||
- (ch == 'i') ||
- (ch == 'o') ||
- (ch == 'u') );
-}
-
-sell_pack()
-{
- object *obj;
- short row = 2, val;
- char buf[DCOLS];
-
- obj = rogue.pack.next_object;
-
- clear();
- mvaddstr(1, 0, "Value Item");
-
- while (obj) {
- if (obj->what_is != FOOD) {
- obj->identified = 1;
- val = get_value(obj);
- rogue.gold += val;
-
- if (row < DROWS) {
- sprintf(buf, "%5d ", val);
- get_desc(obj, buf+11);
- mvaddstr(row++, 0, buf);
- }
- }
- obj = obj->next_object;
- }
- refresh();
- if (rogue.gold > MAX_GOLD) {
- rogue.gold = MAX_GOLD;
- }
- message("", 0);
-}
-
-get_value(obj)
-const object *obj;
-{
- short wc;
- int val;
-
- wc = obj->which_kind;
-
- switch(obj->what_is) {
- case WEAPON:
- val = id_weapons[wc].value;
- if ((wc == ARROW) || (wc == DAGGER) || (wc == SHURIKEN) ||
- (wc == DART)) {
- val *= obj->quantity;
- }
- val += (obj->d_enchant * 85);
- val += (obj->hit_enchant * 85);
- break;
- case ARMOR:
- val = id_armors[wc].value;
- val += (obj->d_enchant * 75);
- if (obj->is_protected) {
- val += 200;
- }
- break;
- case WAND:
- val = id_wands[wc].value * (obj->class + 1);
- break;
- case SCROL:
- val = id_scrolls[wc].value * obj->quantity;
- break;
- case POTION:
- val = id_potions[wc].value * obj->quantity;
- break;
- case AMULET:
- val = 5000;
- break;
- case RING:
- val = id_rings[wc].value * (obj->class + 1);
- break;
- }
- if (val <= 0) {
- val = 10;
- }
- return(val);
-}
-
-id_all()
-{
- short i;
-
- for (i = 0; i < SCROLS; i++) {
- id_scrolls[i].id_status = IDENTIFIED;
- }
- for (i = 0; i < WEAPONS; i++) {
- id_weapons[i].id_status = IDENTIFIED;
- }
- for (i = 0; i < ARMORS; i++) {
- id_armors[i].id_status = IDENTIFIED;
- }
- for (i = 0; i < WANDS; i++) {
- id_wands[i].id_status = IDENTIFIED;
- }
- for (i = 0; i < POTIONS; i++) {
- id_potions[i].id_status = IDENTIFIED;
- }
-}
-
-name_cmp(s1, s2)
-char *s1;
-const char *s2;
-{
- short i = 0;
- int r;
-
- while(s1[i] != ':') {
- i++;
- }
- s1[i] = 0;
- r = strcmp(s1, s2);
- s1[i] = ':';
- return(r);
-}
-
-xxxx(buf, n)
-char *buf;
-short n;
-{
- short i;
- unsigned char c;
-
- for (i = 0; i < n; i++) {
-
- /* It does not matter if accuracy is lost during this assignment */
- c = (unsigned char) xxx(0);
-
- buf[i] ^= c;
- }
-}
-
-long
-xxx(st)
-boolean st;
-{
- static long f, s;
- long r;
-
- if (st) {
- f = 37;
- s = 7;
- return(0L);
- }
- r = ((f * s) + 9337) % 8887;
- f = s;
- s = r;
- return(r);
-}
-
-nickize(buf, score, n_name)
-char *buf;
-const char *score, *n_name;
-{
- short i = 15, j;
-
- if (!n_name[0]) {
- (void) strcpy(buf, score);
- } else {
- (void) strncpy(buf, score, 16);
-
- while (score[i] != ':') {
- i++;
- }
-
- (void) strcpy(buf+15, n_name);
- j = strlen(buf);
-
- while (score[i]) {
- buf[j++] = score[i++];
- }
- buf[j] = 0;
- buf[79] = 0;
- }
-}
-
-center(row, buf)
-short row;
-const char *buf;
-{
- short margin;
-
- margin = ((DCOLS - strlen(buf)) / 2);
- mvaddstr(row, margin, buf);
-}
-
-sf_error()
-{
- md_lock(0);
- message("", 1);
- clean_up("sorry, score file is out of order");
-}
diff --git a/games/rogue/spec_hit.c b/games/rogue/spec_hit.c
deleted file mode 100644
index bfcdc04..0000000
--- a/games/rogue/spec_hit.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * special_hit.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-short less_hp = 0;
-boolean being_held;
-
-extern short cur_level, max_level, blind, levitate, ring_exp;
-extern long level_points[];
-extern boolean detect_monster, mon_disappeared;
-extern boolean sustain_strength, maintain_armor;
-extern char *you_can_move_again;
-
-special_hit(monster)
-object *monster;
-{
- if ((monster->m_flags & CONFUSED) && rand_percent(66)) {
- return;
- }
- if (monster->m_flags & RUSTS) {
- rust(monster);
- }
- if ((monster->m_flags & HOLDS) && !levitate) {
- being_held = 1;
- }
- if (monster->m_flags & FREEZES) {
- freeze(monster);
- }
- if (monster->m_flags & STINGS) {
- sting(monster);
- }
- if (monster->m_flags & DRAINS_LIFE) {
- drain_life();
- }
- if (monster->m_flags & DROPS_LEVEL) {
- drop_level();
- }
- if (monster->m_flags & STEALS_GOLD) {
- steal_gold(monster);
- } else if (monster->m_flags & STEALS_ITEM) {
- steal_item(monster);
- }
-}
-
-rust(monster)
-object *monster;
-{
- if ((!rogue.armor) || (get_armor_class(rogue.armor) <= 1) ||
- (rogue.armor->which_kind == LEATHER)) {
- return;
- }
- if ((rogue.armor->is_protected) || maintain_armor) {
- if (monster && (!(monster->m_flags & RUST_VANISHED))) {
- message("the rust vanishes instantly", 0);
- monster->m_flags |= RUST_VANISHED;
- }
- } else {
- rogue.armor->d_enchant--;
- message("your armor weakens", 0);
- print_stats(STAT_ARMOR);
- }
-}
-
-freeze(monster)
-object *monster;
-{
- short freeze_percent = 99;
- short i, n;
-
- if (rand_percent(12)) {
- return;
- }
- freeze_percent -= (rogue.str_current+(rogue.str_current / 2));
- freeze_percent -= ((rogue.exp + ring_exp) * 4);
- freeze_percent -= (get_armor_class(rogue.armor) * 5);
- freeze_percent -= (rogue.hp_max / 3);
-
- if (freeze_percent > 10) {
- monster->m_flags |= FREEZING_ROGUE;
- message("you are frozen", 1);
-
- n = get_rand(4, 8);
- for (i = 0; i < n; i++) {
- mv_mons();
- }
- if (rand_percent(freeze_percent)) {
- for (i = 0; i < 50; i++) {
- mv_mons();
- }
- killed_by((object *)0, HYPOTHERMIA);
- }
- message(you_can_move_again, 1);
- monster->m_flags &= (~FREEZING_ROGUE);
- }
-}
-
-steal_gold(monster)
-object *monster;
-{
- int amount;
-
- if ((rogue.gold <= 0) || rand_percent(10)) {
- return;
- }
-
- amount = get_rand((cur_level * 10), (cur_level * 30));
-
- if (amount > rogue.gold) {
- amount = rogue.gold;
- }
- rogue.gold -= amount;
- message("your purse feels lighter", 0);
- print_stats(STAT_GOLD);
- disappear(monster);
-}
-
-steal_item(monster)
-object *monster;
-{
- object *obj;
- short i, n, t;
- char desc[80];
- boolean has_something = 0;
-
- if (rand_percent(15)) {
- return;
- }
- obj = rogue.pack.next_object;
-
- if (!obj) {
- goto DSPR;
- }
- while (obj) {
- if (!(obj->in_use_flags & BEING_USED)) {
- has_something = 1;
- break;
- }
- obj = obj->next_object;
- }
- if (!has_something) {
- goto DSPR;
- }
- n = get_rand(0, MAX_PACK_COUNT);
- obj = rogue.pack.next_object;
-
- for (i = 0; i <= n; i++) {
- obj = obj->next_object;
- while ((!obj) || (obj->in_use_flags & BEING_USED)) {
- if (!obj) {
- obj = rogue.pack.next_object;
- } else {
- obj = obj->next_object;
- }
- }
- }
- (void) strcpy(desc, "she stole ");
- if (obj->what_is != WEAPON) {
- t = obj->quantity;
- obj->quantity = 1;
- }
- get_desc(obj, desc+10);
- message(desc, 0);
-
- obj->quantity = ((obj->what_is != WEAPON) ? t : 1);
-
- vanish(obj, 0, &rogue.pack);
-DSPR:
- disappear(monster);
-}
-
-disappear(monster)
-object *monster;
-{
- short row, col;
-
- row = monster->row;
- col = monster->col;
-
- dungeon[row][col] &= ~MONSTER;
- if (rogue_can_see(row, col)) {
- mvaddch(row, col, get_dungeon_char(row, col));
- }
- take_from_pack(monster, &level_monsters);
- free_object(monster);
- mon_disappeared = 1;
-}
-
-cough_up(monster)
-object *monster;
-{
- object *obj;
- short row, col, i, n;
-
- if (cur_level < max_level) {
- return;
- }
-
- if (monster->m_flags & STEALS_GOLD) {
- obj = alloc_object();
- obj->what_is = GOLD;
- obj->quantity = get_rand((cur_level * 15), (cur_level * 30));
- } else {
- if (!rand_percent((int) monster->drop_percent)) {
- return;
- }
- obj = gr_object();
- }
- row = monster->row;
- col = monster->col;
-
- for (n = 0; n <= 5; n++) {
- for (i = -n; i <= n; i++) {
- if (try_to_cough(row+n, col+i, obj)) {
- return;
- }
- if (try_to_cough(row-n, col+i, obj)) {
- return;
- }
- }
- for (i = -n; i <= n; i++) {
- if (try_to_cough(row+i, col-n, obj)) {
- return;
- }
- if (try_to_cough(row+i, col+n, obj)) {
- return;
- }
- }
- }
- free_object(obj);
-}
-
-try_to_cough(row, col, obj)
-short row, col;
-object *obj;
-{
- if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) || (col>(DCOLS-1))) {
- return(0);
- }
- if ((!(dungeon[row][col] & (OBJECT | STAIRS | TRAP))) &&
- (dungeon[row][col] & (TUNNEL | FLOOR | DOOR))) {
- place_at(obj, row, col);
- if (((row != rogue.row) || (col != rogue.col)) &&
- (!(dungeon[row][col] & MONSTER))) {
- mvaddch(row, col, get_dungeon_char(row, col));
- }
- return(1);
- }
- return(0);
-}
-
-seek_gold(monster)
-object *monster;
-{
- short i, j, rn, s;
-
- if ((rn = get_room_number(monster->row, monster->col)) < 0) {
- return(0);
- }
- for (i = rooms[rn].top_row+1; i < rooms[rn].bottom_row; i++) {
- for (j = rooms[rn].left_col+1; j < rooms[rn].right_col; j++) {
- if ((gold_at(i, j)) && !(dungeon[i][j] & MONSTER)) {
- monster->m_flags |= CAN_FLIT;
- s = mon_can_go(monster, i, j);
- monster->m_flags &= (~CAN_FLIT);
- if (s) {
- move_mon_to(monster, i, j);
- monster->m_flags |= ASLEEP;
- monster->m_flags &= (~(WAKENS | SEEKS_GOLD));
- return(1);
- }
- monster->m_flags &= (~SEEKS_GOLD);
- monster->m_flags |= CAN_FLIT;
- mv_1_monster(monster, i, j);
- monster->m_flags &= (~CAN_FLIT);
- monster->m_flags |= SEEKS_GOLD;
- return(1);
- }
- }
- }
- return(0);
-}
-
-gold_at(row, col)
-short row, col;
-{
- if (dungeon[row][col] & OBJECT) {
- object *obj;
-
- if ((obj = object_at(&level_objects, row, col)) &&
- (obj->what_is == GOLD)) {
- return(1);
- }
- }
- return(0);
-}
-
-check_gold_seeker(monster)
-object *monster;
-{
- monster->m_flags &= (~SEEKS_GOLD);
-}
-
-check_imitator(monster)
-object *monster;
-{
- char msg[80];
-
- if (monster->m_flags & IMITATES) {
- wake_up(monster);
- if (!blind) {
- mvaddch(monster->row, monster->col,
- get_dungeon_char(monster->row, monster->col));
- check_message();
- sprintf(msg, "wait, that's a %s!", mon_name(monster));
- message(msg, 1);
- }
- return(1);
- }
- return(0);
-}
-
-imitating(row, col)
-short row, col;
-{
- if (dungeon[row][col] & MONSTER) {
- object *object_at(), *monster;
-
- if (monster = object_at(&level_monsters, row, col)) {
- if (monster->m_flags & IMITATES) {
- return(1);
- }
- }
- }
- return(0);
-}
-
-sting(monster)
-object *monster;
-{
- short sting_chance = 35;
- char msg[80];
-
- if ((rogue.str_current <= 3) || sustain_strength) {
- return;
- }
- sting_chance += (6 * (6 - get_armor_class(rogue.armor)));
-
- if ((rogue.exp + ring_exp) > 8) {
- sting_chance -= (6 * ((rogue.exp + ring_exp) - 8));
- }
- if (rand_percent(sting_chance)) {
- sprintf(msg, "the %s's bite has weakened you",
- mon_name(monster));
- message(msg, 0);
- rogue.str_current--;
- print_stats(STAT_STRENGTH);
- }
-}
-
-drop_level()
-{
- int hp;
-
- if (rand_percent(80) || (rogue.exp <= 5)) {
- return;
- }
- rogue.exp_points = level_points[rogue.exp-2] - get_rand(9, 29);
- rogue.exp -= 2;
- hp = hp_raise();
- if ((rogue.hp_current -= hp) <= 0) {
- rogue.hp_current = 1;
- }
- if ((rogue.hp_max -= hp) <= 0) {
- rogue.hp_max = 1;
- }
- add_exp(1, 0);
-}
-
-drain_life()
-{
- short n;
-
- if (rand_percent(60) || (rogue.hp_max <= 30) || (rogue.hp_current < 10)) {
- return;
- }
- n = get_rand(1, 3); /* 1 Hp, 2 Str, 3 both */
-
- if ((n != 2) || (!sustain_strength)) {
- message("you feel weaker", 0);
- }
- if (n != 2) {
- rogue.hp_max--;
- rogue.hp_current--;
- less_hp++;
- }
- if (n != 1) {
- if ((rogue.str_current > 3) && (!sustain_strength)) {
- rogue.str_current--;
- if (coin_toss()) {
- rogue.str_max--;
- }
- }
- }
- print_stats((STAT_STRENGTH | STAT_HP));
-}
-
-m_confuse(monster)
-object *monster;
-{
- char msg[80];
-
- if (!rogue_can_see(monster->row, monster->col)) {
- return(0);
- }
- if (rand_percent(45)) {
- monster->m_flags &= (~CONFUSES); /* will not confuse the rogue */
- return(0);
- }
- if (rand_percent(55)) {
- monster->m_flags &= (~CONFUSES);
- sprintf(msg, "the gaze of the %s has confused you", mon_name(monster));
- message(msg, 1);
- cnfs();
- return(1);
- }
- return(0);
-}
-
-flame_broil(monster)
-object *monster;
-{
- short row, col, dir;
-
- if ((!mon_sees(monster, rogue.row, rogue.col)) || coin_toss()) {
- return(0);
- }
- row = rogue.row - monster->row;
- col = rogue.col - monster->col;
- if (row < 0) {
- row = -row;
- }
- if (col < 0) {
- col = -col;
- }
- if (((row != 0) && (col != 0) && (row != col)) ||
- ((row > 7) || (col > 7))) {
- return(0);
- }
- dir = get_dir(monster->row, monster->col, row, col);
- bounce(FIRE, dir, monster->row, monster->col, 0);
-
- return(1);
-}
-
-get_dir(srow, scol, drow, dcol)
-short srow, scol, drow, dcol;
-{
- if (srow == drow) {
- if (scol < dcol) {
- return(RIGHT);
- } else {
- return(LEFT);
- }
- }
- if (scol == dcol) {
- if (srow < drow) {
- return(DOWN);
- } else {
- return(UPWARD);
- }
- }
- if ((srow > drow) && (scol > dcol)) {
- return(UPLEFT);
- }
- if ((srow < drow) && (scol < dcol)) {
- return(DOWNRIGHT);
- }
- if ((srow < drow) && (scol > dcol)) {
- return(DOWNLEFT);
- }
- /*if ((srow > drow) && (scol < dcol)) {*/
- return(UPRIGHT);
- /*}*/
-}
diff --git a/games/rogue/throw.c b/games/rogue/throw.c
deleted file mode 100644
index 037beb2..0000000
--- a/games/rogue/throw.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * throw.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-extern short cur_room;
-extern char *curse_message;
-extern char hit_message[];
-
-throw()
-{
- short wch, d;
- boolean first_miss = 1;
- object *weapon;
- short dir, row, col;
- object *monster;
-
- while (!is_direction(dir = rgetchar(), &d)) {
- sound_bell();
- if (first_miss) {
- message("direction? ", 0);
- first_miss = 0;
- }
- }
- check_message();
- if (dir == CANCEL) {
- return;
- }
- if ((wch = pack_letter("throw what?", WEAPON)) == CANCEL) {
- return;
- }
- check_message();
-
- if (!(weapon = get_letter_object(wch))) {
- message("no such item.", 0);
- return;
- }
- if ((weapon->in_use_flags & BEING_USED) && weapon->is_cursed) {
- message(curse_message, 0);
- return;
- }
- row = rogue.row; col = rogue.col;
-
- if ((weapon->in_use_flags & BEING_WIELDED) && (weapon->quantity <= 1)) {
- unwield(rogue.weapon);
- } else if (weapon->in_use_flags & BEING_WORN) {
- mv_aquatars();
- unwear(rogue.armor);
- print_stats(STAT_ARMOR);
- } else if (weapon->in_use_flags & ON_EITHER_HAND) {
- un_put_on(weapon);
- }
- monster = get_thrown_at_monster(weapon, d, &row, &col);
- mvaddch(rogue.row, rogue.col, rogue.fchar);
- refresh();
-
- if (rogue_can_see(row, col) && ((row != rogue.row) || (col != rogue.col))){
- mvaddch(row, col, get_dungeon_char(row, col));
- }
- if (monster) {
- wake_up(monster);
- check_gold_seeker(monster);
-
- if (!throw_at_monster(monster, weapon)) {
- flop_weapon(weapon, row, col);
- }
- } else {
- flop_weapon(weapon, row, col);
- }
- vanish(weapon, 1, &rogue.pack);
-}
-
-throw_at_monster(monster, weapon)
-object *monster, *weapon;
-{
- short damage, hit_chance;
- short t;
-
- hit_chance = get_hit_chance(weapon);
- damage = get_weapon_damage(weapon);
- if ((weapon->which_kind == ARROW) &&
- (rogue.weapon && (rogue.weapon->which_kind == BOW))) {
- damage += get_weapon_damage(rogue.weapon);
- damage = ((damage * 2) / 3);
- hit_chance += (hit_chance / 3);
- } else if ((weapon->in_use_flags & BEING_WIELDED) &&
- ((weapon->which_kind == DAGGER) ||
- (weapon->which_kind == SHURIKEN) ||
- (weapon->which_kind == DART))) {
- damage = ((damage * 3) / 2);
- hit_chance += (hit_chance / 3);
- }
- t = weapon->quantity;
- weapon->quantity = 1;
- sprintf(hit_message, "the %s", name_of(weapon));
- weapon->quantity = t;
-
- if (!rand_percent(hit_chance)) {
- (void) strcat(hit_message, "misses ");
- return(0);
- }
- s_con_mon(monster);
- (void) strcat(hit_message, "hit ");
- (void) mon_damage(monster, damage);
- return(1);
-}
-
-object *
-get_thrown_at_monster(obj, dir, row, col)
-object *obj;
-short dir;
-short *row, *col;
-{
- short orow, ocol;
- short i, ch;
-
- orow = *row; ocol = *col;
-
- ch = get_mask_char(obj->what_is);
-
- for (i = 0; i < 24; i++) {
- get_dir_rc(dir, row, col, 0);
- if ( (((*col <= 0) || (*col >= DCOLS-1)) ||
- (dungeon[*row][*col] == NOTHING)) ||
- ((dungeon[*row][*col] & (HORWALL | VERTWALL | HIDDEN)) &&
- (!(dungeon[*row][*col] & TRAP)))) {
- *row = orow;
- *col = ocol;
- return(0);
- }
- if ((i != 0) && rogue_can_see(orow, ocol)) {
- mvaddch(orow, ocol, get_dungeon_char(orow, ocol));
- }
- if (rogue_can_see(*row, *col)) {
- if (!(dungeon[*row][*col] & MONSTER)) {
- mvaddch(*row, *col, ch);
- }
- refresh();
- }
- orow = *row; ocol = *col;
- if (dungeon[*row][*col] & MONSTER) {
- if (!imitating(*row, *col)) {
- return(object_at(&level_monsters, *row, *col));
- }
- }
- if (dungeon[*row][*col] & TUNNEL) {
- i += 2;
- }
- }
- return(0);
-}
-
-flop_weapon(weapon, row, col)
-object *weapon;
-short row, col;
-{
- object *new_weapon, *monster;
- short i = 0;
- char msg[80];
- boolean found = 0;
- short mch, dch;
- unsigned short mon;
-
- while ((i < 9) && dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER)) {
- rand_around(i++, &row, &col);
- if ((row > (DROWS-2)) || (row < MIN_ROW) ||
- (col > (DCOLS-1)) || (col < 0) || (!dungeon[row][col]) ||
- (dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER))) {
- continue;
- }
- found = 1;
- break;
- }
-
- if (found || (i == 0)) {
- new_weapon = alloc_object();
- *new_weapon = *weapon;
- new_weapon->in_use_flags = NOT_USED;
- new_weapon->quantity = 1;
- new_weapon->ichar = 'L';
- place_at(new_weapon, row, col);
- if (rogue_can_see(row, col) &&
- ((row != rogue.row) || (col != rogue.col))) {
- mon = dungeon[row][col] & MONSTER;
- dungeon[row][col] &= (~MONSTER);
- dch = get_dungeon_char(row, col);
- if (mon) {
- mch = mvinch(row, col);
- if (monster = object_at(&level_monsters, row, col)) {
- monster->trail_char = dch;
- }
- if ((mch < 'A') || (mch > 'Z')) {
- mvaddch(row, col, dch);
- }
- } else {
- mvaddch(row, col, dch);
- }
- dungeon[row][col] |= mon;
- }
- } else {
- short t;
-
- t = weapon->quantity;
- weapon->quantity = 1;
- sprintf(msg, "the %svanishes as it hits the ground",
- name_of(weapon));
- weapon->quantity = t;
- message(msg, 0);
- }
-}
-
-rand_around(i, r, c)
-short i, *r, *c;
-{
- static char pos[] = "\010\007\001\003\004\005\002\006\0";
- static short row, col;
- short j;
-
- if (i == 0) {
- short x, y, o, t;
-
- row = *r;
- col = *c;
-
- o = get_rand(1, 8);
-
- for (j = 0; j < 5; j++) {
- x = get_rand(0, 8);
- y = (x + o) % 9;
- t = pos[x];
- pos[x] = pos[y];
- pos[y] = t;
- }
- }
- switch((short)pos[i]) {
- case 0:
- *r = row + 1;
- *c = col + 1;
- break;
- case 1:
- *r = row + 1;
- *c = col - 1;
- break;
- case 2:
- *r = row - 1;
- *c = col + 1;
- break;
- case 3:
- *r = row - 1;
- *c = col - 1;
- break;
- case 4:
- *r = row;
- *c = col + 1;
- break;
- case 5:
- *r = row + 1;
- *c = col;
- break;
- case 6:
- *r = row;
- *c = col;
- break;
- case 7:
- *r = row - 1;
- *c = col;
- break;
- case 8:
- *r = row;
- *c = col - 1;
- break;
- }
-}
diff --git a/games/rogue/trap.c b/games/rogue/trap.c
deleted file mode 100644
index dd8cfed..0000000
--- a/games/rogue/trap.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * trap.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-trap traps[MAX_TRAPS];
-boolean trap_door = 0;
-short bear_trap = 0;
-
-const char *const trap_strings[TRAPS * 2] = {
- "trap door",
- "you fell down a trap",
- "bear trap",
- "you are caught in a bear trap",
- "teleport trap",
- "teleport",
- "poison dart trap",
- "a small dart just hit you in the shoulder",
- "sleeping gas trap",
- "a strange white mist envelops you and you fall asleep",
- "rust trap",
- "a gush of water hits you on the head"
-};
-
-extern short cur_level, party_room;
-extern const char *new_level_message;
-extern boolean interrupted;
-extern short ring_exp;
-extern boolean sustain_strength;
-extern short blind;
-
-trap_at(row, col)
-int row, col;
-{
- short i;
-
- for (i = 0; ((i < MAX_TRAPS) && (traps[i].trap_type != NO_TRAP)); i++) {
- if ((traps[i].trap_row == row) && (traps[i].trap_col == col)) {
- return(traps[i].trap_type);
- }
- }
- return(NO_TRAP);
-}
-
-trap_player(row, col)
-short row, col;
-{
- short t;
-
- if ((t = trap_at(row, col)) == NO_TRAP) {
- return;
- }
- dungeon[row][col] &= (~HIDDEN);
- if (rand_percent(rogue.exp + ring_exp)) {
- message("the trap failed", 1);
- return;
- }
- switch(t) {
- case TRAP_DOOR:
- trap_door = 1;
- new_level_message = trap_strings[(t*2)+1];
- break;
- case BEAR_TRAP:
- message(trap_strings[(t*2)+1], 1);
- bear_trap = get_rand(4, 7);
- break;
- case TELE_TRAP:
- mvaddch(rogue.row, rogue.col, '^');
- tele();
- break;
- case DART_TRAP:
- message(trap_strings[(t*2)+1], 1);
- rogue.hp_current -= get_damage("1d6", 1);
- if (rogue.hp_current <= 0) {
- rogue.hp_current = 0;
- }
- if ((!sustain_strength) && rand_percent(40) &&
- (rogue.str_current >= 3)) {
- rogue.str_current--;
- }
- print_stats(STAT_HP | STAT_STRENGTH);
- if (rogue.hp_current <= 0) {
- killed_by((object *) 0, POISON_DART);
- }
- break;
- case SLEEPING_GAS_TRAP:
- message(trap_strings[(t*2)+1], 1);
- take_a_nap();
- break;
- case RUST_TRAP:
- message(trap_strings[(t*2)+1], 1);
- rust((object *) 0);
- break;
- }
-}
-
-add_traps()
-{
- short i, n, tries = 0;
- short row, col;
-
- if (cur_level <= 2) {
- n = 0;
- } else if (cur_level <= 7) {
- n = get_rand(0, 2);
- } else if (cur_level <= 11) {
- n = get_rand(1, 2);
- } else if (cur_level <= 16) {
- n = get_rand(2, 3);
- } else if (cur_level <= 21) {
- n = get_rand(2, 4);
- } else if (cur_level <= (AMULET_LEVEL + 2)) {
- n = get_rand(3, 5);
- } else {
- n = get_rand(5, MAX_TRAPS);
- }
- for (i = 0; i < n; i++) {
- traps[i].trap_type = get_rand(0, (TRAPS - 1));
-
- if ((i == 0) && (party_room != NO_ROOM)) {
- do {
- row = get_rand((rooms[party_room].top_row+1),
- (rooms[party_room].bottom_row-1));
- col = get_rand((rooms[party_room].left_col+1),
- (rooms[party_room].right_col-1));
- tries++;
- } while (((dungeon[row][col] & (OBJECT|STAIRS|TRAP|TUNNEL)) ||
- (dungeon[row][col] == NOTHING)) && (tries < 15));
- if (tries >= 15) {
- gr_row_col(&row, &col, (FLOOR | MONSTER));
- }
- } else {
- gr_row_col(&row, &col, (FLOOR | MONSTER));
- }
- traps[i].trap_row = row;
- traps[i].trap_col = col;
- dungeon[row][col] |= (TRAP | HIDDEN);
- }
-}
-
-id_trap()
-{
- short dir, row, col, d, t;
-
- message("direction? ", 0);
-
- while (!is_direction(dir = rgetchar(), &d)) {
- sound_bell();
- }
- check_message();
-
- if (dir == CANCEL) {
- return;
- }
- row = rogue.row;
- col = rogue.col;
-
- get_dir_rc(d, &row, &col, 0);
-
- if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) {
- t = trap_at(row, col);
- message(trap_strings[t*2], 0);
- } else {
- message("no trap there", 0);
- }
-}
-
-show_traps()
-{
- short i, j;
-
- for (i = 0; i < DROWS; i++) {
- for (j = 0; j < DCOLS; j++) {
- if (dungeon[i][j] & TRAP) {
- mvaddch(i, j, '^');
- }
- }
- }
-}
-
-search(n, is_auto)
-short n;
-boolean is_auto;
-{
- short s, i, j, row, col, t;
- short shown = 0, found = 0;
- static boolean reg_search;
-
- for (i = -1; i <= 1; i++) {
- for (j = -1; j <= 1; j++) {
- row = rogue.row + i;
- col = rogue.col + j;
- if ((row < MIN_ROW) || (row >= (DROWS-1)) ||
- (col < 0) || (col >= DCOLS)) {
- continue;
- }
- if (dungeon[row][col] & HIDDEN) {
- found++;
- }
- }
- }
- for (s = 0; s < n; s++) {
- for (i = -1; i <= 1; i++) {
- for (j = -1; j <= 1; j++) {
- row = rogue.row + i;
- col = rogue.col + j ;
- if ((row < MIN_ROW) || (row >= (DROWS-1)) ||
- (col < 0) || (col >= DCOLS)) {
- continue;
- }
- if (dungeon[row][col] & HIDDEN) {
- if (rand_percent(17 + (rogue.exp + ring_exp))) {
- dungeon[row][col] &= (~HIDDEN);
- if ((!blind) && ((row != rogue.row) ||
- (col != rogue.col))) {
- mvaddch(row, col, get_dungeon_char(row, col));
- }
- shown++;
- if (dungeon[row][col] & TRAP) {
- t = trap_at(row, col);
- message(trap_strings[t*2], 1);
- }
- }
- }
- if (((shown == found) && (found > 0)) || interrupted) {
- return;
- }
- }
- }
- if ((!is_auto) && (reg_search = !reg_search)) {
- (void) reg_move();
- }
- }
-}
diff --git a/games/rogue/use.c b/games/rogue/use.c
deleted file mode 100644
index 3c5f62b..0000000
--- a/games/rogue/use.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)use.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * use.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-short halluc = 0;
-short blind = 0;
-short confused = 0;
-short levitate = 0;
-short haste_self = 0;
-boolean see_invisible = 0;
-short extra_hp = 0;
-boolean detect_monster = 0;
-boolean con_mon = 0;
-const char *strange_feeling = "you have a strange feeling for a moment, then it passes";
-
-extern short bear_trap;
-extern char hunger_str[];
-extern short cur_room;
-extern long level_points[];
-extern boolean being_held;
-extern char *fruit, *you_can_move_again;
-extern boolean sustain_strength;
-
-quaff()
-{
- short ch;
- char buf[80];
- object *obj;
-
- ch = pack_letter("quaff what?", POTION);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (obj->what_is != POTION) {
- message("you can't drink that", 0);
- return;
- }
- switch(obj->which_kind) {
- case INCREASE_STRENGTH:
- message("you feel stronger now, what bulging muscles!",
- 0);
- rogue.str_current++;
- if (rogue.str_current > rogue.str_max) {
- rogue.str_max = rogue.str_current;
- }
- break;
- case RESTORE_STRENGTH:
- rogue.str_current = rogue.str_max;
- message("this tastes great, you feel warm all over", 0);
- break;
- case HEALING:
- message("you begin to feel better", 0);
- potion_heal(0);
- break;
- case EXTRA_HEALING:
- message("you begin to feel much better", 0);
- potion_heal(1);
- break;
- case POISON:
- if (!sustain_strength) {
- rogue.str_current -= get_rand(1, 3);
- if (rogue.str_current < 1) {
- rogue.str_current = 1;
- }
- }
- message("you feel very sick now", 0);
- if (halluc) {
- unhallucinate();
- }
- break;
- case RAISE_LEVEL:
- rogue.exp_points = level_points[rogue.exp - 1];
- message("you suddenly feel much more skillful", 0);
- add_exp(1, 1);
- break;
- case BLINDNESS:
- go_blind();
- break;
- case HALLUCINATION:
- message("oh wow, everything seems so cosmic", 0);
- halluc += get_rand(500, 800);
- break;
- case DETECT_MONSTER:
- show_monsters();
- if (!(level_monsters.next_monster)) {
- message(strange_feeling, 0);
- }
- break;
- case DETECT_OBJECTS:
- if (level_objects.next_object) {
- if (!blind) {
- show_objects();
- }
- } else {
- message(strange_feeling, 0);
- }
- break;
- case CONFUSION:
- message((halluc ? "what a trippy feeling" :
- "you feel confused"), 0);
- cnfs();
- break;
- case LEVITATION:
- message("you start to float in the air", 0);
- levitate += get_rand(15, 30);
- being_held = bear_trap = 0;
- break;
- case HASTE_SELF:
- message("you feel yourself moving much faster", 0);
- haste_self += get_rand(11, 21);
- if (!(haste_self % 2)) {
- haste_self++;
- }
- break;
- case SEE_INVISIBLE:
- sprintf(buf, "hmm, this potion tastes like %sjuice", fruit);
- message(buf, 0);
- if (blind) {
- unblind();
- }
- see_invisible = 1;
- relight();
- break;
- }
- print_stats((STAT_STRENGTH | STAT_HP));
- if (id_potions[obj->which_kind].id_status != CALLED) {
- id_potions[obj->which_kind].id_status = IDENTIFIED;
- }
- vanish(obj, 1, &rogue.pack);
-}
-
-read_scroll()
-{
- short ch;
- object *obj;
- char msg[DCOLS];
-
- ch = pack_letter("read what?", SCROL);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (obj->what_is != SCROL) {
- message("you can't read that", 0);
- return;
- }
- switch(obj->which_kind) {
- case SCARE_MONSTER:
- message("you hear a maniacal laughter in the distance",
- 0);
- break;
- case HOLD_MONSTER:
- hold_monster();
- break;
- case ENCH_WEAPON:
- if (rogue.weapon) {
- if (rogue.weapon->what_is == WEAPON) {
- sprintf(msg, "your %sglow%s %sfor a moment",
- name_of(rogue.weapon),
- ((rogue.weapon->quantity <= 1) ? "s" : ""),
- get_ench_color());
- message(msg, 0);
- if (coin_toss()) {
- rogue.weapon->hit_enchant++;
- } else {
- rogue.weapon->d_enchant++;
- }
- }
- rogue.weapon->is_cursed = 0;
- } else {
- message("your hands tingle", 0);
- }
- break;
- case ENCH_ARMOR:
- if (rogue.armor) {
- sprintf(msg, "your armor glows %sfor a moment",
- get_ench_color());
- message(msg, 0);
- rogue.armor->d_enchant++;
- rogue.armor->is_cursed = 0;
- print_stats(STAT_ARMOR);
- } else {
- message("your skin crawls", 0);
- }
- break;
- case IDENTIFY:
- message("this is a scroll of identify", 0);
- obj->identified = 1;
- id_scrolls[obj->which_kind].id_status = IDENTIFIED;
- idntfy();
- break;
- case TELEPORT:
- tele();
- break;
- case SLEEP:
- message("you fall asleep", 0);
- take_a_nap();
- break;
- case PROTECT_ARMOR:
- if (rogue.armor) {
- message( "your armor is covered by a shimmering gold shield",0);
- rogue.armor->is_protected = 1;
- rogue.armor->is_cursed = 0;
- } else {
- message("your acne seems to have disappeared", 0);
- }
- break;
- case REMOVE_CURSE:
- message((!halluc) ?
- "you feel as though someone is watching over you" :
- "you feel in touch with the universal oneness", 0);
- uncurse_all();
- break;
- case CREATE_MONSTER:
- create_monster();
- break;
- case AGGRAVATE_MONSTER:
- aggravate();
- break;
- case MAGIC_MAPPING:
- message("this scroll seems to have a map on it", 0);
- draw_magic_map();
- break;
- case CON_MON:
- con_mon = 1;
- sprintf(msg, "your hands glow %sfor a moment", get_ench_color());
- message(msg, 0);
- break;
- }
- if (id_scrolls[obj->which_kind].id_status != CALLED) {
- id_scrolls[obj->which_kind].id_status = IDENTIFIED;
- }
- vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
-}
-
-/* vanish() does NOT handle a quiver of weapons with more than one
- * arrow (or whatever) in the quiver. It will only decrement the count.
- */
-
-vanish(obj, rm, pack)
-object *obj;
-short rm;
-object *pack;
-{
- if (obj->quantity > 1) {
- obj->quantity--;
- } else {
- if (obj->in_use_flags & BEING_WIELDED) {
- unwield(obj);
- } else if (obj->in_use_flags & BEING_WORN) {
- unwear(obj);
- } else if (obj->in_use_flags & ON_EITHER_HAND) {
- un_put_on(obj);
- }
- take_from_pack(obj, pack);
- free_object(obj);
- }
- if (rm) {
- (void) reg_move();
- }
-}
-
-potion_heal(extra)
-{
- float ratio;
- short add;
-
- rogue.hp_current += rogue.exp;
-
- ratio = ((float)rogue.hp_current) / rogue.hp_max;
-
- if (ratio >= 1.00) {
- rogue.hp_max += (extra ? 2 : 1);
- extra_hp += (extra ? 2 : 1);
- rogue.hp_current = rogue.hp_max;
- } else if (ratio >= 0.90) {
- rogue.hp_max += (extra ? 1 : 0);
- extra_hp += (extra ? 1 : 0);
- rogue.hp_current = rogue.hp_max;
- } else {
- if (ratio < 0.33) {
- ratio = 0.33;
- }
- if (extra) {
- ratio += ratio;
- }
- add = (short)(ratio * ((float)rogue.hp_max - rogue.hp_current));
- rogue.hp_current += add;
- if (rogue.hp_current > rogue.hp_max) {
- rogue.hp_current = rogue.hp_max;
- }
- }
- if (blind) {
- unblind();
- }
- if (confused && extra) {
- unconfuse();
- } else if (confused) {
- confused = (confused / 2) + 1;
- }
- if (halluc && extra) {
- unhallucinate();
- } else if (halluc) {
- halluc = (halluc / 2) + 1;
- }
-}
-
-idntfy()
-{
- short ch;
- object *obj;
- struct id *id_table;
- char desc[DCOLS];
-AGAIN:
- ch = pack_letter("what would you like to identify?", ALL_OBJECTS);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item, try again", 0);
- message("", 0);
- check_message();
- goto AGAIN;
- }
- obj->identified = 1;
- if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) {
- id_table = get_id_table(obj);
- id_table[obj->which_kind].id_status = IDENTIFIED;
- }
- get_desc(obj, desc);
- message(desc, 0);
-}
-
-eat()
-{
- short ch;
- short moves;
- object *obj;
- char buf[70];
-
- ch = pack_letter("eat what?", FOOD);
-
- if (ch == CANCEL) {
- return;
- }
- if (!(obj = get_letter_object(ch))) {
- message("no such item.", 0);
- return;
- }
- if (obj->what_is != FOOD) {
- message("you can't eat that", 0);
- return;
- }
- if ((obj->which_kind == FRUIT) || rand_percent(60)) {
- moves = get_rand(950, 1150);
- if (obj->which_kind == RATION) {
- message("yum, that tasted good", 0);
- } else {
- sprintf(buf, "my, that was a yummy %s", fruit);
- message(buf, 0);
- }
- } else {
- moves = get_rand(750, 950);
- message("yuk, that food tasted awful", 0);
- add_exp(2, 1);
- }
- rogue.moves_left /= 3;
- rogue.moves_left += moves;
- hunger_str[0] = 0;
- print_stats(STAT_HUNGER);
-
- vanish(obj, 1, &rogue.pack);
-}
-
-hold_monster()
-{
- short i, j;
- short mcount = 0;
- object *monster;
- short row, col;
-
- for (i = -2; i <= 2; i++) {
- for (j = -2; j <= 2; j++) {
- row = rogue.row + i;
- col = rogue.col + j;
- if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) ||
- (col > (DCOLS-1))) {
- continue;
- }
- if (dungeon[row][col] & MONSTER) {
- monster = object_at(&level_monsters, row, col);
- monster->m_flags |= ASLEEP;
- monster->m_flags &= (~WAKENS);
- mcount++;
- }
- }
- }
- if (mcount == 0) {
- message("you feel a strange sense of loss", 0);
- } else if (mcount == 1) {
- message("the monster freezes", 0);
- } else {
- message("the monsters around you freeze", 0);
- }
-}
-
-tele()
-{
- mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col));
-
- if (cur_room >= 0) {
- darken_room(cur_room);
- }
- put_player(get_room_number(rogue.row, rogue.col));
- being_held = 0;
- bear_trap = 0;
-}
-
-hallucinate()
-{
- object *obj, *monster;
- short ch;
-
- if (blind) return;
-
- obj = level_objects.next_object;
-
- while (obj) {
- ch = mvinch(obj->row, obj->col);
- if (((ch < 'A') || (ch > 'Z')) &&
- ((obj->row != rogue.row) || (obj->col != rogue.col)))
- if ((ch != ' ') && (ch != '.') && (ch != '#') && (ch != '+')) {
- addch(gr_obj_char());
- }
- obj = obj->next_object;
- }
- monster = level_monsters.next_monster;
-
- while (monster) {
- ch = mvinch(monster->row, monster->col);
- if ((ch >= 'A') && (ch <= 'Z')) {
- addch(get_rand('A', 'Z'));
- }
- monster = monster->next_monster;
- }
-}
-
-unhallucinate()
-{
- halluc = 0;
- relight();
- message("everything looks SO boring now", 1);
-}
-
-unblind()
-{
- blind = 0;
- message("the veil of darkness lifts", 1);
- relight();
- if (halluc) {
- hallucinate();
- }
- if (detect_monster) {
- show_monsters();
- }
-}
-
-relight()
-{
- if (cur_room == PASSAGE) {
- light_passage(rogue.row, rogue.col);
- } else {
- light_up_room(cur_room);
- }
- mvaddch(rogue.row, rogue.col, rogue.fchar);
-}
-
-take_a_nap()
-{
- short i;
-
- i = get_rand(2, 5);
- md_sleep(1);
-
- while (i--) {
- mv_mons();
- }
- md_sleep(1);
- message(you_can_move_again, 0);
-}
-
-go_blind()
-{
- short i, j;
-
- if (!blind) {
- message("a cloak of darkness falls around you", 0);
- }
- blind += get_rand(500, 800);
-
- if (detect_monster) {
- object *monster;
-
- monster = level_monsters.next_monster;
-
- while (monster) {
- mvaddch(monster->row, monster->col, monster->trail_char);
- monster = monster->next_monster;
- }
- }
- if (cur_room >= 0) {
- for (i = rooms[cur_room].top_row + 1;
- i < rooms[cur_room].bottom_row; i++) {
- for (j = rooms[cur_room].left_col + 1;
- j < rooms[cur_room].right_col; j++) {
- mvaddch(i, j, ' ');
- }
- }
- }
- mvaddch(rogue.row, rogue.col, rogue.fchar);
-}
-
-const char *
-get_ench_color()
-{
- if (halluc) {
- return(id_potions[get_rand(0, POTIONS-1)].title);
- } else if (con_mon) {
- return("red ");
- }
- return("blue ");
-}
-
-cnfs()
-{
- confused += get_rand(12, 22);
-}
-
-unconfuse()
-{
- char msg[80];
-
- confused = 0;
- sprintf(msg, "you feel less %s now", (halluc ? "trippy" : "confused"));
- message(msg, 1);
-}
-
-uncurse_all()
-{
- object *obj;
-
- obj = rogue.pack.next_object;
-
- while (obj) {
- obj->is_cursed = 0;
- obj = obj->next_object;
- }
-}
diff --git a/games/rogue/zap.c b/games/rogue/zap.c
deleted file mode 100644
index d4f991c..0000000
--- a/games/rogue/zap.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Timothy C. Stoehr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * zap.c
- *
- * This source herein may be modified and/or distributed by anybody who
- * so desires, with the following restrictions:
- * 1.) No portion of this notice shall be removed.
- * 2.) Credit shall not be taken for the creation of this source.
- * 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
- *
- */
-
-#include "rogue.h"
-
-boolean wizard = 0;
-
-extern boolean being_held, score_only, detect_monster;
-extern short cur_room;
-
-zapp()
-{
- short wch;
- boolean first_miss = 1;
- object *wand;
- short dir, d, row, col;
- object *monster;
-
- while (!is_direction(dir = rgetchar(), &d)) {
- sound_bell();
- if (first_miss) {
- message("direction? ", 0);
- first_miss = 0;
- }
- }
- check_message();
- if (dir == CANCEL) {
- return;
- }
- if ((wch = pack_letter("zap with what?", WAND)) == CANCEL) {
- return;
- }
- check_message();
-
- if (!(wand = get_letter_object(wch))) {
- message("no such item.", 0);
- return;
- }
- if (wand->what_is != WAND) {
- message("you can't zap with that", 0);
- return;
- }
- if (wand->class <= 0) {
- message("nothing happens", 0);
- } else {
- wand->class--;
- row = rogue.row; col = rogue.col;
- if ((wand->which_kind == COLD) || (wand->which_kind == FIRE)) {
- bounce((short) wand->which_kind, d, row, col, 0);
- } else {
- monster = get_zapped_monster(d, &row, &col);
- if (wand->which_kind == DRAIN_LIFE) {
- wdrain_life(monster);
- } else if (monster) {
- wake_up(monster);
- s_con_mon(monster);
- zap_monster(monster, wand->which_kind);
- relight();
- }
- }
- }
- (void) reg_move();
-}
-
-object *
-get_zapped_monster(dir, row, col)
-short dir;
-short *row, *col;
-{
- short orow, ocol;
-
- for (;;) {
- orow = *row; ocol = *col;
- get_dir_rc(dir, row, col, 0);
- if (((*row == orow) && (*col == ocol)) ||
- (dungeon[*row][*col] & (HORWALL | VERTWALL)) ||
- (dungeon[*row][*col] == NOTHING)) {
- return(0);
- }
- if (dungeon[*row][*col] & MONSTER) {
- if (!imitating(*row, *col)) {
- return(object_at(&level_monsters, *row, *col));
- }
- }
- }
-}
-
-zap_monster(monster, kind)
-object *monster;
-unsigned short kind;
-{
- short row, col;
- object *nm;
- short tc;
-
- row = monster->row;
- col = monster->col;
-
- switch(kind) {
- case SLOW_MONSTER:
- if (monster->m_flags & HASTED) {
- monster->m_flags &= (~HASTED);
- } else {
- monster->slowed_toggle = 0;
- monster->m_flags |= SLOWED;
- }
- break;
- case HASTE_MONSTER:
- if (monster->m_flags & SLOWED) {
- monster->m_flags &= (~SLOWED);
- } else {
- monster->m_flags |= HASTED;
- }
- break;
- case TELE_AWAY:
- tele_away(monster);
- break;
- case INVISIBILITY:
- monster->m_flags |= INVISIBLE;
- break;
- case POLYMORPH:
- if (monster->m_flags & HOLDS) {
- being_held = 0;
- }
- nm = monster->next_monster;
- tc = monster->trail_char;
- (void) gr_monster(monster, get_rand(0, MONSTERS-1));
- monster->row = row;
- monster->col = col;
- monster->next_monster = nm;
- monster->trail_char = tc;
- if (!(monster->m_flags & IMITATES)) {
- wake_up(monster);
- }
- break;
- case MAGIC_MISSILE:
- rogue_hit(monster, 1);
- break;
- case CANCELLATION:
- if (monster->m_flags & HOLDS) {
- being_held = 0;
- }
- if (monster->m_flags & STEALS_ITEM) {
- monster->drop_percent = 0;
- }
- monster->m_flags &= (~(FLIES | FLITS | SPECIAL_HIT | INVISIBLE |
- FLAMES | IMITATES | CONFUSES | SEEKS_GOLD | HOLDS));
- break;
- case DO_NOTHING:
- message("nothing happens", 0);
- break;
- }
-}
-
-tele_away(monster)
-object *monster;
-{
- short row, col;
-
- if (monster->m_flags & HOLDS) {
- being_held = 0;
- }
- gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
- mvaddch(monster->row, monster->col, monster->trail_char);
- dungeon[monster->row][monster->col] &= ~MONSTER;
- monster->row = row; monster->col = col;
- dungeon[row][col] |= MONSTER;
- monster->trail_char = mvinch(row, col);
- if (detect_monster || rogue_can_see(row, col)) {
- mvaddch(row, col, gmc(monster));
- }
-}
-
-wizardize()
-{
- char buf[100];
-
- if (wizard) {
- wizard = 0;
- message("not wizard anymore", 0);
- } else {
- if (get_input_line("wizard's password:", "", buf, "", 0, 0)) {
- (void) xxx(1);
- xxxx(buf, strlen(buf));
- if (!strncmp(buf, "\247\104\126\272\115\243\027", 7)) {
- wizard = 1;
- score_only = 1;
- message("Welcome, mighty wizard!", 0);
- } else {
- message("sorry", 0);
- }
- }
- }
-}
-
-wdrain_life(monster)
-object *monster;
-{
- short hp;
- object *lmon, *nm;
-
- hp = rogue.hp_current / 3;
- rogue.hp_current = (rogue.hp_current + 1) / 2;
-
- if (cur_room >= 0) {
- lmon = level_monsters.next_monster;
- while (lmon) {
- nm = lmon->next_monster;
- if (get_room_number(lmon->row, lmon->col) == cur_room) {
- wake_up(lmon);
- (void) mon_damage(lmon, hp);
- }
- lmon = nm;
- }
- } else {
- if (monster) {
- wake_up(monster);
- (void) mon_damage(monster, hp);
- }
- }
- print_stats(STAT_HP);
- relight();
-}
-
-bounce(ball, dir, row, col, r)
-short ball, dir, row, col, r;
-{
- short orow, ocol;
- char buf[DCOLS];
- const char *s;
- short i, ch, new_dir = -1, damage;
- static short btime;
-
- if (++r == 1) {
- btime = get_rand(3, 6);
- } else if (r > btime) {
- return;
- }
-
- if (ball == FIRE) {
- s = "fire";
- } else {
- s = "ice";
- }
- if (r > 1) {
- sprintf(buf, "the %s bounces", s);
- message(buf, 0);
- }
- orow = row;
- ocol = col;
- do {
- ch = mvinch(orow, ocol);
- standout();
- mvaddch(orow, ocol, ch);
- get_dir_rc(dir, &orow, &ocol, 1);
- } while (!( (ocol <= 0) ||
- (ocol >= DCOLS-1) ||
- (dungeon[orow][ocol] == NOTHING) ||
- (dungeon[orow][ocol] & MONSTER) ||
- (dungeon[orow][ocol] & (HORWALL | VERTWALL)) ||
- ((orow == rogue.row) && (ocol == rogue.col))));
- standend();
- refresh();
- do {
- orow = row;
- ocol = col;
- ch = mvinch(row, col);
- mvaddch(row, col, ch);
- get_dir_rc(dir, &row, &col, 1);
- } while (!( (col <= 0) ||
- (col >= DCOLS-1) ||
- (dungeon[row][col] == NOTHING) ||
- (dungeon[row][col] & MONSTER) ||
- (dungeon[row][col] & (HORWALL | VERTWALL)) ||
- ((row == rogue.row) && (col == rogue.col))));
-
- if (dungeon[row][col] & MONSTER) {
- object *monster;
-
- monster = object_at(&level_monsters, row, col);
-
- wake_up(monster);
- if (rand_percent(33)) {
- sprintf(buf, "the %s misses the %s", s, mon_name(monster));
- message(buf, 0);
- goto ND;
- }
- if (ball == FIRE) {
- if (!(monster->m_flags & RUSTS)) {
- if (monster->m_flags & FREEZES) {
- damage = monster->hp_to_kill;
- } else if (monster->m_flags & FLAMES) {
- damage = (monster->hp_to_kill / 10) + 1;
- } else {
- damage = get_rand((rogue.hp_current / 3), rogue.hp_max);
- }
- } else {
- damage = (monster->hp_to_kill / 2) + 1;
- }
- sprintf(buf, "the %s hits the %s", s, mon_name(monster));
- message(buf, 0);
- (void) mon_damage(monster, damage);
- } else {
- damage = -1;
- if (!(monster->m_flags & FREEZES)) {
- if (rand_percent(33)) {
- message("the monster is frozen", 0);
- monster->m_flags |= (ASLEEP | NAPPING);
- monster->nap_length = get_rand(3, 6);
- } else {
- damage = rogue.hp_current / 4;
- }
- } else {
- damage = -2;
- }
- if (damage != -1) {
- sprintf(buf, "the %s hits the %s", s, mon_name(monster));
- message(buf, 0);
- (void) mon_damage(monster, damage);
- }
- }
- } else if ((row == rogue.row) && (col == rogue.col)) {
- if (rand_percent(10 + (3 * get_armor_class(rogue.armor)))) {
- sprintf(buf, "the %s misses", s);
- message(buf, 0);
- goto ND;
- } else {
- damage = get_rand(3, (3 * rogue.exp));
- if (ball == FIRE) {
- damage = (damage * 3) / 2;
- damage -= get_armor_class(rogue.armor);
- }
- sprintf(buf, "the %s hits", s);
- rogue_damage(damage, (object *) 0,
- ((ball == FIRE) ? KFIRE : HYPOTHERMIA));
- message(buf, 0);
- }
- } else {
- short nrow, ncol;
-
-ND: for (i = 0; i < 10; i++) {
- dir = get_rand(0, DIRS-1);
- nrow = orow;
- ncol = ocol;
- get_dir_rc(dir, &nrow, &ncol, 1);
- if (((ncol >= 0) && (ncol <= DCOLS-1)) &&
- (dungeon[nrow][ncol] != NOTHING) &&
- (!(dungeon[nrow][ncol] & (VERTWALL | HORWALL)))) {
- new_dir = dir;
- break;
- }
- }
- if (new_dir != -1) {
- bounce(ball, new_dir, orow, ocol, r);
- }
- }
-}
diff --git a/games/sail/Makefile b/games/sail/Makefile
deleted file mode 100644
index 1a2a278..0000000
--- a/games/sail/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= sail
-SRCS= main.c pl_main.c pl_1.c pl_2.c pl_3.c pl_4.c pl_5.c pl_6.c pl_7.c \
- dr_main.c dr_1.c dr_2.c dr_3.c dr_4.c dr_5.c lo_main.c \
- assorted.c game.c globals.c misc.c parties.c sync.c version.c
-MAN= sail.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/saillog)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/saillog
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/sail/assorted.c b/games/sail/assorted.c
deleted file mode 100644
index 390f28f..0000000
--- a/games/sail/assorted.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)assorted.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-table(rig, shot, hittable, on, from, roll)
-struct ship *on, *from;
-int rig, shot, hittable, roll;
-{
- int hhits = 0, chits = 0, ghits = 0, rhits = 0;
- int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0;
- int guns, car, pc, hull;
- int crew[3];
- int n;
- int rigg[4];
- char *message;
- struct Tables *tp;
-
- pc = on->file->pcrew;
- hull = on->specs->hull;
- crew[0] = on->specs->crew1;
- crew[1] = on->specs->crew2;
- crew[2] = on->specs->crew3;
- rigg[0] = on->specs->rig1;
- rigg[1] = on->specs->rig2;
- rigg[2] = on->specs->rig3;
- rigg[3] = on->specs->rig4;
- if (shot == L_GRAPE)
- Chit = chits = hittable;
- else {
- tp = &(rig ? RigTable : HullTable)[hittable][roll-1];
- Chit = chits = tp->C;
- Rhit = rhits = tp->R;
- Hhit = hhits = tp->H;
- Ghit = ghits = tp->G;
- if (on->file->FS)
- rhits *= 2;
- if (shot == L_CHAIN) {
- Ghit = ghits = 0;
- Hhit = hhits = 0;
- }
- }
- if (on->file->captured != 0) {
- pc -= (chits + 1) / 2;
- chits /= 2;
- }
- for (n = 0; n < 3; n++)
- if (chits > crew[n]) {
- chits -= crew[n];
- crew[n] = 0;
- } else {
- crew[n] -= chits;
- chits = 0;
- }
- for (n = 0; n < 3; n++)
- if (rhits > rigg[n]){
- rhits -= rigg[n];
- rigg[n] = 0;
- } else {
- rigg[n] -= rhits;
- rhits = 0;
- }
- if (rigg[3] != -1 && rhits > rigg[3]) {
- rhits -= rigg[3];
- rigg[3] = 0;
- } else if (rigg[3] != -1) {
- rigg[3] -= rhits;
- }
- if (rig && !rigg[2] && (!rigg[3] || rigg[3] == -1))
- makesignal(on, "dismasted!", (struct ship *)0);
- if (portside(from, on, 0)) {
- guns = on->specs->gunR;
- car = on->specs->carR;
- } else {
- guns = on->specs->gunL;
- car = on->specs->carL;
- }
- if (ghits > car) {
- ghits -= car;
- car = 0;
- } else {
- car -= ghits;
- ghits = 0;
- }
- if (ghits > guns){
- ghits -= guns;
- guns = 0;
- } else {
- guns -= ghits;
- ghits = 0;
- }
- hull -= ghits;
- if (Ghit)
- Write(portside(from, on, 0) ? W_GUNR : W_GUNL,
- on, 0, guns, car, 0, 0);
- hull -= hhits;
- hull = hull < 0 ? 0 : hull;
- if (on->file->captured != 0 && Chit)
- Write(W_PCREW, on, 0, pc, 0, 0, 0);
- if (Hhit)
- Write(W_HULL, on, 0, hull, 0, 0, 0);
- if (Chit)
- Write(W_CREW, on, 0, crew[0], crew[1], crew[2], 0);
- if (Rhit)
- Write(W_RIGG, on, 0, rigg[0], rigg[1], rigg[2], rigg[3]);
- switch (shot) {
- case L_ROUND:
- message = "firing round shot on %s (%c%c)";
- break;
- case L_GRAPE:
- message = "firing grape shot on %s (%c%c)";
- break;
- case L_CHAIN:
- message = "firing chain shot on %s (%c%c)";
- break;
- case L_DOUBLE:
- message = "firing double shot on %s (%c%c)";
- break;
- case L_EXPLODE:
- message = "exploding shot on %s (%c%c)";
- }
- makesignal(from, message, on);
- if (roll == 6 && rig) {
- switch(Rhit) {
- case 0:
- message = "fore topsail sheets parted";
- break;
- case 1:
- message = "mizzen shrouds parted";
- break;
- case 2:
- message = "main topsail yard shot away";
- break;
- case 4:
- message = "fore topmast and foremast shrouds shot away";
- break;
- case 5:
- message = "mizzen mast and yard shot through";
- break;
- case 6:
- message = "foremast and spritsail yard shattered";
- break;
- case 7:
- message = "main topmast and mizzen mast shattered";
- break;
- }
- makesignal(on, message, (struct ship *)0);
- } else if (roll == 6) {
- switch (Hhit) {
- case 0:
- message = "anchor cables severed";
- break;
- case 1:
- message = "two anchor stocks shot away";
- break;
- case 2:
- message = "quarterdeck bulwarks damaged";
- break;
- case 3:
- message = "three gun ports shot away";
- break;
- case 4:
- message = "four guns dismounted";
- break;
- case 5:
- message = "rudder cables shot through";
- Write(W_TA, on, 0, 0, 0, 0, 0);
- break;
- case 6:
- message = "shot holes below the water line";
- break;
- }
- makesignal(on, message, (struct ship *)0);
- }
- /*
- if (Chit > 1 && on->file->readyL&R_INITIAL && on->file->readyR&R_INITIAL) {
- on->specs->qual--;
- if (on->specs->qual <= 0) {
- makesignal(on, "crew mutinying!", (struct ship *)0);
- on->specs->qual = 5;
- Write(W_CAPTURED, on, 0, on->file->index, 0, 0, 0);
- } else
- makesignal(on, "crew demoralized", (struct ship *)0);
- Write(W_QUAL, on, 0, on->specs->qual, 0, 0, 0);
- }
- */
- if (!hull)
- strike(on, from);
-}
-
-Cleansnag(from, to, all, flag)
-struct ship *from, *to;
-char all, flag;
-{
- if (flag & 1) {
- Write(W_UNGRAP, from, 0, to->file->index, all, 0, 0);
- Write(W_UNGRAP, to, 0, from->file->index, all, 0, 0);
- }
- if (flag & 2) {
- Write(W_UNFOUL, from, 0, to->file->index, all, 0, 0);
- Write(W_UNFOUL, to, 0, from->file->index, all, 0, 0);
- }
- if (!snagged2(from, to)) {
- if (!snagged(from)) {
- unboard(from, from, 1); /* defense */
- unboard(from, from, 0); /* defense */
- } else
- unboard(from, to, 0); /* offense */
- if (!snagged(to)) {
- unboard(to, to, 1); /* defense */
- unboard(to, to, 0); /* defense */
- } else
- unboard(to, from, 0); /* offense */
- }
-}
-
-strike(ship, from)
-struct ship *ship, *from;
-{
- int points;
-
- if (ship->file->struck)
- return;
- Write(W_STRUCK, ship, 0, 1, 0, 0, 0);
- points = ship->specs->pts + from->file->points;
- Write(W_POINTS, from, 0, points, 0, 0, 0);
- unboard(ship, ship, 0); /* all offense */
- unboard(ship, ship, 1); /* all defense */
- switch (die()) {
- case 3:
- case 4: /* ship may sink */
- Write(W_SINK, ship, 0, 1, 0, 0, 0);
- break;
- case 5:
- case 6: /* ship may explode */
- Write(W_EXPLODE, ship, 0, 1, 0, 0, 0);
- break;
- }
- Write(W_SIGNAL, ship, 1, (int) "striking her colours!", 0, 0, 0);
-}
diff --git a/games/sail/dr_1.c b/games/sail/dr_1.c
deleted file mode 100644
index 02551f9..0000000
--- a/games/sail/dr_1.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "driver.h"
-
-unfoul()
-{
- struct ship *sp;
- struct ship *to;
- int nat;
- int i;
-
- foreachship(sp) {
- if (sp->file->captain[0])
- continue;
- nat = capship(sp)->nationality;
- foreachship(to) {
- if (nat != capship(to)->nationality &&
- !toughmelee(sp, to, 0, 0))
- continue;
- for (i = fouled2(sp, to); --i >= 0;)
- if (die() <= 2)
- cleanfoul(sp, to, 0);
- }
- }
-}
-
-boardcomp()
-{
- int crew[3];
- struct ship *sp, *sq;
-
- foreachship(sp) {
- if (*sp->file->captain)
- continue;
- if (sp->file->dir == 0)
- continue;
- if (sp->file->struck || sp->file->captured != 0)
- continue;
- if (!snagged(sp))
- continue;
- crew[0] = sp->specs->crew1 != 0;
- crew[1] = sp->specs->crew2 != 0;
- crew[2] = sp->specs->crew3 != 0;
- foreachship(sq) {
- if (!Xsnagged2(sp, sq))
- continue;
- if (meleeing(sp, sq))
- continue;
- if (!sq->file->dir
- || sp->nationality == capship(sq)->nationality)
- continue;
- switch (sp->specs->class - sq->specs->class) {
- case -3: case -4: case -5:
- if (crew[0]) {
- /* OBP */
- sendbp(sp, sq, crew[0]*100, 0);
- crew[0] = 0;
- } else if (crew[1]){
- /* OBP */
- sendbp(sp, sq, crew[1]*10, 0);
- crew[1] = 0;
- }
- break;
- case -2:
- if (crew[0] || crew[1]) {
- /* OBP */
- sendbp(sp, sq, crew[0]*100+crew[1]*10,
- 0);
- crew[0] = crew[1] = 0;
- }
- break;
- case -1: case 0: case 1:
- if (crew[0]) {
- /* OBP */
- sendbp(sp, sq, crew[0]*100+crew[1]*10,
- 0);
- crew[0] = crew[1] = 0;
- }
- break;
- case 2: case 3: case 4: case 5:
- /* OBP */
- sendbp(sp, sq, crew[0]*100+crew[1]*10+crew[2],
- 0);
- crew[0] = crew[1] = crew[2] = 0;
- break;
- }
- }
- }
-}
-
-fightitout(from, to, key)
-struct ship *from, *to;
-int key;
-{
- struct ship *fromcap, *tocap;
- int crewfrom[3], crewto[3], menfrom, mento;
- int pcto, pcfrom, fromstrength, strengthto, frominjured, toinjured;
- int topoints;
- int index, totalfrom = 0, totalto = 0;
- int count;
- char message[60];
-
- menfrom = mensent(from, to, crewfrom, &fromcap, &pcfrom, key);
- mento = mensent(to, from, crewto, &tocap, &pcto, 0);
- if (fromcap == 0)
- fromcap = from;
- if (tocap == 0)
- tocap = to;
- if (key) {
- if (!menfrom) { /* if crew surprised */
- if (fromcap == from)
- menfrom = from->specs->crew1
- + from->specs->crew2
- + from->specs->crew3;
- else
- menfrom = from->file->pcrew;
- } else {
- menfrom *= 2; /* DBP's fight at an advantage */
- }
- }
- fromstrength = menfrom * fromcap->specs->qual;
- strengthto = mento * tocap->specs->qual;
- for (count = 0;
- (fromstrength < strengthto * 3 && strengthto < fromstrength * 3
- || fromstrength == -1) && count < 4;
- count++) {
- index = fromstrength/10;
- if (index > 8)
- index = 8;
- toinjured = MT[index][2 - die() / 3];
- totalto += toinjured;
- index = strengthto/10;
- if (index > 8)
- index = 8;
- frominjured = MT[index][2 - die() / 3];
- totalfrom += frominjured;
- menfrom -= frominjured;
- mento -= toinjured;
- fromstrength = menfrom * fromcap->specs->qual;
- strengthto = mento * tocap->specs->qual;
- }
- if (fromstrength >= strengthto * 3 || count == 4) {
- unboard(to, from, 0);
- subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
- subtract(to, totalto, crewto, tocap, pcto);
- makesignal(from, "boarders from %s repelled", to);
- (void) sprintf(message, "killed in melee: %d. %s: %d",
- totalto, from->shipname, totalfrom);
- Write(W_SIGNAL, to, 1, (long) message, 0, 0, 0);
- if (key)
- return 1;
- } else if (strengthto >= fromstrength * 3) {
- unboard(from, to, 0);
- subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
- subtract(to, totalto, crewto, tocap, pcto);
- if (key) {
- if (fromcap != from)
- Write(W_POINTS, fromcap, 0,
- fromcap->file->points -
- from->file->struck
- ? from->specs->pts
- : 2 * from->specs->pts,
- 0, 0, 0);
-
-/* ptr1 points to the shipspec for the ship that was just unboarded.
- I guess that what is going on here is that the pointer is multiplied
- or something. */
-
- Write(W_CAPTURED, from, 0, to->file->index, 0, 0, 0);
- topoints = 2 * from->specs->pts + to->file->points;
- if (from->file->struck)
- topoints -= from->specs->pts;
- Write(W_POINTS, to, 0, topoints, 0, 0, 0);
- mento = crewto[0] ? crewto[0] : crewto[1];
- if (mento) {
- subtract(to, mento, crewto, tocap, pcto);
- subtract(from, - mento, crewfrom, to, 0);
- }
- (void) sprintf(message, "captured by the %s!",
- to->shipname);
- Write(W_SIGNAL, from, 1, (long) message, 0, 0, 0);
- (void) sprintf(message, "killed in melee: %d. %s: %d",
- totalto, from->shipname, totalfrom);
- Write(W_SIGNAL, to, 1, (long) message, 0, 0, 0);
- mento = 0;
- return 0;
- }
- }
- return 0;
-}
-
-resolve()
-{
- int thwart;
- struct ship *sp, *sq;
-
- foreachship(sp) {
- if (sp->file->dir == 0)
- continue;
- for (sq = sp + 1; sq < ls; sq++)
- if (sq->file->dir && meleeing(sp, sq) && meleeing(sq, sp))
- (void) fightitout(sp, sq, 0);
- thwart = 2;
- foreachship(sq) {
- if (sq->file->dir && meleeing(sq, sp))
- thwart = fightitout(sp, sq, 1);
- if (!thwart)
- break;
- }
- if (!thwart) {
- foreachship(sq) {
- if (sq->file->dir && meleeing(sq, sp))
- unboard(sq, sp, 0);
- unboard(sp, sq, 0);
- }
- unboard(sp, sp, 1);
- } else if (thwart == 2)
- unboard(sp, sp, 1);
- }
-}
-
-compcombat()
-{
- int n;
- struct ship *sp;
- struct ship *closest;
- int crew[3], men = 0, target, temp;
- int r, guns, ready, load, car;
- int index, rakehim, sternrake;
- int shootat, hit;
-
- foreachship(sp) {
- if (sp->file->captain[0] || sp->file->dir == 0)
- continue;
- crew[0] = sp->specs->crew1;
- crew[1] = sp->specs->crew2;
- crew[2] = sp->specs->crew3;
- for (n = 0; n < 3; n++) {
- if (sp->file->OBP[n].turnsent)
- men += sp->file->OBP[n].mensent;
- }
- for (n = 0; n < 3; n++) {
- if (sp->file->DBP[n].turnsent)
- men += sp->file->DBP[n].mensent;
- }
- if (men){
- crew[0] = men/100 ? 0 : crew[0] != 0;
- crew[1] = (men%100)/10 ? 0 : crew[1] != 0;
- crew[2] = men%10 ? 0 : crew[2] != 0;
- }
- for (r = 0; r < 2; r++) {
- if (!crew[2])
- continue;
- if (sp->file->struck)
- continue;
- if (r) {
- ready = sp->file->readyR;
- guns = sp->specs->gunR;
- car = sp->specs->carR;
- } else {
- ready = sp->file->readyL;
- guns = sp->specs->gunL;
- car = sp->specs->carL;
- }
- if (!guns && !car)
- continue;
- if ((ready & R_LOADED) == 0)
- continue;
- closest = closestenemy(sp, r ? 'r' : 'l', 0);
- if (closest == 0)
- continue;
- if (range(closest, sp) > range(sp, closestenemy(sp, r ? 'r' : 'l', 1)))
- continue;
- if (closest->file->struck)
- continue;
- target = range(sp, closest);
- if (target > 10)
- continue;
- if (!guns && target >= 3)
- continue;
- load = L_ROUND;
- if (target == 1 && sp->file->loadwith == L_GRAPE)
- load = L_GRAPE;
- if (target <= 3 && closest->file->FS)
- load = L_CHAIN;
- if (target == 1 && load != L_GRAPE)
- load = L_DOUBLE;
- if (load > L_CHAIN && target < 6)
- shootat = HULL;
- else
- shootat = RIGGING;
- rakehim = gunsbear(sp, closest)
- && !gunsbear(closest, sp);
- temp = portside(closest, sp, 1)
- - closest->file->dir + 1;
- if (temp < 1)
- temp += 8;
- if (temp > 8)
- temp -= 8;
- sternrake = temp > 4 && temp < 6;
- index = guns;
- if (target < 3)
- index += car;
- index = (index - 1) / 3;
- index = index > 8 ? 8 : index;
- if (!rakehim)
- hit = HDT[index][target-1];
- else
- hit = HDTrake[index][target-1];
- if (rakehim && sternrake)
- hit++;
- hit += QUAL[index][capship(sp)->specs->qual - 1];
- for (n = 0; n < 3 && sp->file->captured == 0; n++)
- if (!crew[n]) {
- if (index <= 5)
- hit--;
- else
- hit -= 2;
- }
- if (ready & R_INITIAL) {
- if (!r)
- sp->file->readyL &= ~R_INITIAL;
- else
- sp->file->readyR &= ~R_INITIAL;
- if (index <= 3)
- hit++;
- else
- hit += 2;
- }
- if (sp->file->captured != 0) {
- if (index <= 1)
- hit--;
- else
- hit -= 2;
- }
- hit += AMMO[index][load - 1];
- temp = sp->specs->class;
- if ((temp >= 5 || temp == 1) && windspeed == 5)
- hit--;
- if (windspeed == 6 && temp == 4)
- hit -= 2;
- if (windspeed == 6 && temp <= 3)
- hit--;
- if (hit >= 0) {
- if (load != L_GRAPE)
- hit = hit > 10 ? 10 : hit;
- table(shootat, load, hit, closest, sp, die());
- }
- }
- }
-}
-
-next()
-{
- if (++turn % 55 == 0) {
- if (alive)
- alive = 0;
- else
- people = 0;
- }
- if (people <= 0 || windspeed == 7) {
- struct ship *s;
- struct ship *bestship;
- float net, best = 0.0;
- foreachship(s) {
- if (*s->file->captain)
- continue;
- net = (float)s->file->points / s->specs->pts;
- if (net > best) {
- best = net;
- bestship = s;
- }
- }
- if (best > 0.0) {
- char *p = getenv("WOTD");
- if (p == 0)
- p = "Driver";
- if (islower(*p))
- *p = toupper(*p);
- (void) strncpy(bestship->file->captain, p,
- sizeof bestship->file->captain);
- bestship->file->captain
- [sizeof bestship->file->captain - 1] = 0;
- log(bestship);
- }
- return -1;
- }
- Write(W_TURN, SHIP(0), 0, turn, 0, 0, 0);
- if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) {
- switch (die()) {
- case 1:
- winddir = 1;
- break;
- case 2:
- break;
- case 3:
- winddir++;
- break;
- case 4:
- winddir--;
- break;
- case 5:
- winddir += 2;
- break;
- case 6:
- winddir -= 2;
- break;
- }
- if (winddir > 8)
- winddir -= 8;
- if (winddir < 1)
- winddir += 8;
- if (windspeed)
- switch (die()) {
- case 1:
- case 2:
- windspeed--;
- break;
- case 5:
- case 6:
- windspeed++;
- break;
- }
- else
- windspeed++;
- Write(W_WIND, SHIP(0), 0, winddir, windspeed, 0, 0);
- }
- return 0;
-}
diff --git a/games/sail/dr_2.c b/games/sail/dr_2.c
deleted file mode 100644
index 942b768..0000000
--- a/games/sail/dr_2.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "driver.h"
-
-#define couldwin(f,t) (f->specs->crew2 > t->specs->crew2 * 1.5)
-
-thinkofgrapples()
-{
- struct ship *sp, *sq;
- char friendly;
-
- foreachship(sp) {
- if (sp->file->captain[0] || sp->file->dir == 0)
- continue;
- foreachship(sq) {
- friendly = sp->nationality == capship(sq)->nationality;
- if (!friendly) {
- if (sp->file->struck || sp->file->captured != 0)
- continue;
- if (range(sp, sq) != 1)
- continue;
- if (grappled2(sp, sq))
- if (toughmelee(sp, sq, 0, 0))
- ungrap(sp, sq);
- else
- grap(sp, sq);
- else if (couldwin(sp, sq)) {
- grap(sp, sq);
- sp->file->loadwith = L_GRAPE;
- }
- } else
- ungrap(sp, sq);
- }
- }
-}
-
-checkup()
-{
- struct ship *sp, *sq;
- char explode, sink;
-
- foreachship(sp) {
- if (sp->file->dir == 0)
- continue;
- explode = sp->file->explode;
- sink = sp->file->sink;
- if (explode != 1 && sink != 1)
- continue;
- if (die() < 5)
- continue;
- Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 0, 2, 0, 0, 0);
- Write(W_DIR, sp, 0, 0, 0, 0, 0);
- if (snagged(sp))
- foreachship(sq)
- cleansnag(sp, sq, 1);
- if (sink != 1) {
- makesignal(sp, "exploding!", (struct ship *)0);
- foreachship(sq) {
- if (sp != sq && sq->file->dir && range(sp, sq) < 4)
- table(RIGGING, L_EXPLODE, sp->specs->guns/13, sq, sp, 6);
- }
- } else
- makesignal(sp, "sinking!", (struct ship *)0);
- }
-}
-
-prizecheck()
-{
- struct ship *sp;
-
- foreachship(sp) {
- if (sp->file->captured == 0)
- continue;
- if (sp->file->struck || sp->file->dir == 0)
- continue;
- if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 > sp->file->pcrew * 6) {
- Write(W_SIGNAL, sp, 1,
- (int)"prize crew overthrown", 0, 0, 0);
- Write(W_POINTS, sp->file->captured, 0, sp->file->captured->file->points - 2 * sp->specs->pts, 0, 0, 0);
- Write(W_CAPTURED, sp, 0, -1, 0, 0, 0);
- }
- }
-}
-
-strend(str)
-char *str;
-{
- char *p;
-
- for (p = str; *p; p++)
- ;
- return p == str ? 0 : p[-1];
-}
-
-closeon(from, to, command, ta, ma, af)
-struct ship *from, *to;
-char command[];
-int ma, ta, af;
-{
- int high;
- char temp[10];
-
- temp[0] = command[0] = '\0';
- high = -30000;
- try(command, temp, ma, ta, af, ma, from->file->dir, from, to, &high, 0);
-}
-
-int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */
-
-score(movement, ship, to, onlytemp)
-char movement[];
-struct ship *ship, *to;
-char onlytemp;
-{
- char drift;
- int row, col, dir, total, ran;
- struct File *fp = ship->file;
-
- if ((dir = fp->dir) == 0)
- return 0;
- row = fp->row;
- col = fp->col;
- drift = fp->drift;
- sail_move(movement, ship, &fp->dir, &fp->row, &fp->col, &drift);
- if (!*movement)
- (void) strcpy(movement, "d");
-
- ran = range(ship, to);
- total = -50 * ran;
- if (ran < 4 && gunsbear(ship, to))
- total += 60;
- if ((ran = portside(ship, to, 1) - fp->dir) == 4 || ran == -4)
- total = -30000;
-
- if (!onlytemp) {
- fp->row = row;
- fp->col = col;
- fp->dir = dir;
- }
- return total;
-}
-
-sail_move(p, ship, dir, row, col, drift)
-char *p;
-struct ship *ship;
-char *dir;
-short *row, *col;
-char *drift;
-{
- int dist;
- char moved = 0;
-
- for (; *p; p++) {
- switch (*p) {
- case 'r':
- if (++*dir == 9)
- *dir = 1;
- break;
- case 'l':
- if (--*dir == 0)
- *dir = 8;
- break;
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- moved++;
- if (*dir % 2 == 0)
- dist = dtab[*p - '0'];
- else
- dist = *p - '0';
- *row -= dr[*dir] * dist;
- *col -= dc[*dir] * dist;
- break;
- }
- }
- if (!moved) {
- if (windspeed != 0 && ++*drift > 2) {
- if (ship->specs->class >= 3 && !snagged(ship)
- || (turn & 1) == 0) {
- *row -= dr[winddir];
- *col -= dc[winddir];
- }
- }
- } else
- *drift = 0;
-}
-
-try(command, temp, ma, ta, af, vma, dir, f, t, high, rakeme)
-struct ship *f, *t;
-int ma, ta, af, vma, dir, *high, rakeme;
-char command[], temp[];
-{
- int new, n;
- char st[4];
-#define rakeyou (gunsbear(f, t) && !gunsbear(t, f))
-
- if ((n = strend(temp)) < '1' || n > '9')
- for (n = 1; vma - n >= 0; n++) {
- (void) sprintf(st, "%d", n);
- (void) strcat(temp, st);
- new = score(temp, f, t, rakeme);
- if (new > *high && (!rakeme || rakeyou)) {
- *high = new;
- (void) strcpy(command, temp);
- }
- try(command, temp, ma-n, ta, af, vma-n,
- dir, f, t, high, rakeme);
- rmend(temp);
- }
- if (ma > 0 && ta > 0 && (n = strend(temp)) != 'l' && n != 'r' || !strlen(temp)) {
- (void) strcat(temp, "r");
- new = score(temp, f, t, rakeme);
- if (new > *high && (!rakeme || gunsbear(f, t) && !gunsbear(t, f))) {
- *high = new;
- (void) strcpy(command, temp);
- }
- try(command, temp, ma-1, ta-1, af, min(ma-1, maxmove(f, (dir == 8 ? 1 : dir+1), 0)), (dir == 8 ? 1 : dir+1),f,t,high,rakeme);
- rmend(temp);
- }
- if ((ma > 0 && ta > 0 && (n = strend(temp)) != 'l' && n != 'r') || !strlen(temp)){
- (void) strcat(temp, "l");
- new = score(temp, f, t, rakeme);
- if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))){
- *high = new;
- (void) strcpy(command, temp);
- }
- try(command, temp, ma-1, ta-1, af, (min(ma-1,maxmove(f, (dir-1 ? dir-1 : 8), 0))), (dir-1 ? dir -1 : 8), f, t, high, rakeme);
- rmend(temp);
- }
-}
-
-rmend(str)
-char *str;
-{
- char *p;
-
- for (p = str; *p; p++)
- ;
- if (p != str)
- *--p = 0;
-}
diff --git a/games/sail/dr_3.c b/games/sail/dr_3.c
deleted file mode 100644
index 845a707..0000000
--- a/games/sail/dr_3.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "driver.h"
-
-moveall() /* move all comp ships */
-{
- struct ship *sp, *sq; /* r11, r10 */
- int n; /* r9 */
- int k, l; /* r8, r7 */
- int row[NSHIP], col[NSHIP], dir[NSHIP], drift[NSHIP];
- char moved[NSHIP];
-
- /*
- * first try to create moves for OUR ships
- */
- foreachship(sp) {
- struct ship *closest;
- int ma, ta;
- char af;
-
- if (sp->file->captain[0] || sp->file->dir == 0)
- continue;
- if (!sp->file->struck && windspeed && !snagged(sp)
- && sp->specs->crew3) {
- ta = maxturns(sp, &af);
- ma = maxmove(sp, sp->file->dir, 0);
- closest = closestenemy(sp, 0, 0);
- if (closest == 0)
- *sp->file->movebuf = '\0';
- else
- closeon(sp, closest, sp->file->movebuf,
- ta, ma, af);
- } else
- *sp->file->movebuf = '\0';
- }
- /*
- * Then execute the moves for ALL ships (dead ones too),
- * checking for collisions and snags at each step.
- * The old positions are saved in row[], col[], dir[].
- * At the end, we compare and write out the changes.
- */
- n = 0;
- foreachship(sp) {
- if (snagged(sp))
- (void) strcpy(sp->file->movebuf, "d");
- else
- if (*sp->file->movebuf != 'd')
- (void) strcat(sp->file->movebuf, "d");
- row[n] = sp->file->row;
- col[n] = sp->file->col;
- dir[n] = sp->file->dir;
- drift[n] = sp->file->drift;
- moved[n] = 0;
- n++;
- }
- /*
- * Now resolve collisions.
- * This is the tough part.
- */
- for (k = 0; stillmoving(k); k++) {
- /*
- * Step once.
- * And propagate the nulls at the end of sp->file->movebuf.
- */
- n = 0;
- foreachship(sp) {
- if (!sp->file->movebuf[k])
- sp->file->movebuf[k+1] = '\0';
- else if (sp->file->dir)
- step(sp->file->movebuf[k], sp, &moved[n]);
- n++;
- }
- /*
- * The real stuff.
- */
- n = 0;
- foreachship(sp) {
- if (sp->file->dir == 0 || isolated(sp))
- goto cont1;
- l = 0;
- foreachship(sq) {
- char snap = 0;
-
- if (sp == sq)
- goto cont2;
- if (sq->file->dir == 0)
- goto cont2;
- if (!push(sp, sq))
- goto cont2;
- if (snagged2(sp, sq) && range(sp, sq) > 1)
- snap++;
- if (!range(sp, sq) && !fouled2(sp, sq)) {
- makesignal(sp,
- "collision with %s (%c%c)", sq);
- if (die() < 4) {
- makesignal(sp,
- "fouled with %s (%c%c)",
- sq);
- Write(W_FOUL, sp, 0, l, 0, 0, 0);
- Write(W_FOUL, sq, 0, n, 0, 0, 0);
- }
- snap++;
- }
- if (snap) {
- sp->file->movebuf[k + 1] = 0;
- sq->file->movebuf[k + 1] = 0;
- sq->file->row = sp->file->row - 1;
- if (sp->file->dir == 1
- || sp->file->dir == 5)
- sq->file->col =
- sp->file->col - 1;
- else
- sq->file->col = sp->file->col;
- sq->file->dir = sp->file->dir;
- }
- cont2:
- l++;
- }
- cont1:
- n++;
- }
- }
- /*
- * Clear old moves. And write out new pos.
- */
- n = 0;
- foreachship(sp) {
- if (sp->file->dir != 0) {
- *sp->file->movebuf = 0;
- if (row[n] != sp->file->row)
- Write(W_ROW, sp, 0, sp->file->row, 0, 0, 0);
- if (col[n] != sp->file->col)
- Write(W_COL, sp, 0, sp->file->col, 0, 0, 0);
- if (dir[n] != sp->file->dir)
- Write(W_DIR, sp, 0, sp->file->dir, 0, 0, 0);
- if (drift[n] != sp->file->drift)
- Write(W_DRIFT, sp, 0, sp->file->drift, 0, 0, 0);
- }
- n++;
- }
-}
-
-stillmoving(k)
-int k;
-{
- struct ship *sp;
-
- foreachship(sp)
- if (sp->file->movebuf[k])
- return 1;
- return 0;
-}
-
-isolated(ship)
-struct ship *ship;
-{
- struct ship *sp;
-
- foreachship(sp) {
- if (ship != sp && range(ship, sp) <= 10)
- return 0;
- }
- return 1;
-}
-
-push(from, to)
-struct ship *from, *to;
-{
- int bs, sb;
-
- sb = to->specs->guns;
- bs = from->specs->guns;
- if (sb > bs)
- return 1;
- if (sb < bs)
- return 0;
- return from < to;
-}
-
-step(com, sp, moved)
-char com;
-struct ship *sp;
-char *moved;
-{
- int dist;
-
- switch (com) {
- case 'r':
- if (++sp->file->dir == 9)
- sp->file->dir = 1;
- break;
- case 'l':
- if (--sp->file->dir == 0)
- sp->file->dir = 8;
- break;
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- if (sp->file->dir % 2 == 0)
- dist = dtab[com - '0'];
- else
- dist = com - '0';
- sp->file->row -= dr[sp->file->dir] * dist;
- sp->file->col -= dc[sp->file->dir] * dist;
- *moved = 1;
- break;
- case 'b':
- break;
- case 'd':
- if (!*moved) {
- if (windspeed != 0 && ++sp->file->drift > 2 &&
- (sp->specs->class >= 3 && !snagged(sp)
- || (turn & 1) == 0)) {
- sp->file->row -= dr[winddir];
- sp->file->col -= dc[winddir];
- }
- } else
- sp->file->drift = 0;
- break;
- }
-}
-
-sendbp(from, to, sections, isdefense)
-struct ship *from, *to;
-int sections;
-char isdefense;
-{
- int n;
- struct BP *bp;
-
- bp = isdefense ? from->file->DBP : from->file->OBP;
- for (n = 0; n < NBP && bp[n].turnsent; n++)
- ;
- if (n < NBP && sections) {
- Write(isdefense ? W_DBP : W_OBP, from, 0,
- n, turn, to->file->index, sections);
- if (isdefense)
- makesignal(from, "repelling boarders",
- (struct ship *)0);
- else
- makesignal(from, "boarding the %s (%c%c)", to);
- }
-}
-
-toughmelee(ship, to, isdefense, count)
-struct ship *ship, *to;
-int isdefense, count;
-{
- struct BP *bp;
- int obp = 0;
- int n, OBP = 0, DBP = 0, dbp = 0;
- int qual;
-
- qual = ship->specs->qual;
- bp = isdefense ? ship->file->DBP : ship->file->OBP;
- for (n = 0; n < NBP; n++, bp++) {
- if (bp->turnsent && (to == bp->toship || isdefense)) {
- obp += bp->mensent / 100
- ? ship->specs->crew1 * qual : 0;
- obp += (bp->mensent % 100)/10
- ? ship->specs->crew2 * qual : 0;
- obp += bp->mensent % 10
- ? ship->specs->crew3 * qual : 0;
- }
- }
- if (count || isdefense)
- return obp;
- OBP = toughmelee(to, ship, 0, count + 1);
- dbp = toughmelee(ship, to, 1, count + 1);
- DBP = toughmelee(to, ship, 1, count + 1);
- if (OBP > obp + 10 || OBP + DBP >= obp + dbp + 10)
- return 1;
- else
- return 0;
-}
-
-reload()
-{
- struct ship *sp;
-
- foreachship(sp) {
- sp->file->loadwith = 0;
- }
-}
-
-checksails()
-{
- struct ship *sp;
- int rig, full;
- struct ship *close;
-
- foreachship(sp) {
- if (sp->file->captain[0] != 0)
- continue;
- rig = sp->specs->rig1;
- if (windspeed == 6 || windspeed == 5 && sp->specs->class > 4)
- rig = 0;
- if (rig && sp->specs->crew3) {
- close = closestenemy(sp, 0, 0);
- if (close != 0) {
- if (range(sp, close) > 9)
- full = 1;
- else
- full = 0;
- } else
- full = 0;
- } else
- full = 0;
- if ((sp->file->FS != 0) != full)
- Write(W_FS, sp, 0, full, 0, 0, 0);
- }
-}
diff --git a/games/sail/dr_4.c b/games/sail/dr_4.c
deleted file mode 100644
index e75d6b4..0000000
--- a/games/sail/dr_4.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_4.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-ungrap(from, to)
-struct ship *from, *to;
-{
- int k;
- char friend;
-
- if ((k = grappled2(from, to)) == 0)
- return;
- friend = capship(from)->nationality == capship(to)->nationality;
- while (--k >= 0) {
- if (friend || die() < 3) {
- cleangrapple(from, to, 0);
- makesignal(from, "ungrappling %s (%c%c)", to);
- }
- }
-}
-
-grap(from, to)
-struct ship *from, *to;
-{
- if (capship(from)->nationality != capship(to)->nationality && die() > 2)
- return;
- Write(W_GRAP, from, 0, to->file->index, 0, 0, 0);
- Write(W_GRAP, to, 0, from->file->index, 0, 0, 0);
- makesignal(from, "grappled with %s (%c%c)", to);
-}
diff --git a/games/sail/dr_5.c b/games/sail/dr_5.c
deleted file mode 100644
index a801dbd..0000000
--- a/games/sail/dr_5.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_5.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-subtract(from, totalfrom, crewfrom, fromcap, pcfrom)
-struct ship *from, *fromcap;
-int pcfrom;
-int totalfrom, crewfrom[3];
-{
- int n;
-
- if (fromcap == from && totalfrom) { /* if not captured */
- for (n = 0; n < 3; n++) {
- if (totalfrom > crewfrom[n]) {
- totalfrom -= crewfrom[n];
- crewfrom[n] = 0;
- } else {
- crewfrom[n] -= totalfrom;
- totalfrom = 0;
- }
- }
- Write(W_CREW, from, 0, crewfrom[0], crewfrom[1], crewfrom[2], 0);
- } else if (totalfrom) {
- pcfrom -= totalfrom;
- pcfrom = pcfrom < 0 ? 0 : pcfrom;
- Write(W_PCREW, from, 0, pcfrom, 0, 0, 0);
- }
-}
-
-mensent(from, to, crew, captured, pc, isdefense)
-struct ship *from, *to, **captured;
-int crew[3], *pc;
-char isdefense;
-{ /* returns # of crew squares sent */
- int men = 0;
- int n;
- int c1, c2, c3;
- struct BP *bp;
-
- *pc = from->file->pcrew;
- *captured = from->file->captured;
- crew[0] = from->specs->crew1;
- crew[1] = from->specs->crew2;
- crew[2] = from->specs->crew3;
- bp = isdefense ? from->file->DBP : from->file->OBP;
- for (n=0; n < NBP; n++, bp++) {
- if (bp->turnsent && bp->toship == to)
- men += bp->mensent;
- }
- if (men) {
- c1 = men/100 ? crew[0] : 0;
- c2 = (men%100)/10 ? crew[1] : 0;
- c3 = men/10 ? crew[2] : 0;
- c3 = *captured == 0 ? crew[2] : *pc;
- } else
- c1 = c2 = c3 = 0;
- return(c1 + c2 + c3);
-}
diff --git a/games/sail/dr_main.c b/games/sail/dr_main.c
deleted file mode 100644
index 6ada54f..0000000
--- a/games/sail/dr_main.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dr_main.c 8.2 (Berkeley) 4/16/94";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "driver.h"
-
-dr_main()
-{
- int n;
- struct ship *sp;
- int nat[NNATION];
- int value = 0;
-
- (void) signal(SIGINT, SIG_IGN);
- (void) signal(SIGQUIT, SIG_IGN);
- (void) signal(SIGTSTP, SIG_IGN);
- if (issetuid)
- (void) setuid(geteuid());
- if (game < 0 || game >= NSCENE) {
- fprintf(stderr, "DRIVER: Bad game number %d\n", game);
- exit(1);
- }
- cc = &scene[game];
- ls = SHIP(cc->vessels);
- if (sync_open() < 0) {
- perror("driver: syncfile");
- exit(1);
- }
- for (n = 0; n < NNATION; n++)
- nat[n] = 0;
- foreachship(sp) {
- if (sp->file == NULL &&
- (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL) {
- (void) fprintf(stderr, "DRIVER: Out of memory.\n");
- exit(1);
- }
- sp->file->index = sp - SHIP(0);
- sp->file->loadL = L_ROUND;
- sp->file->loadR = L_ROUND;
- sp->file->readyR = R_LOADED|R_INITIAL;
- sp->file->readyL = R_LOADED|R_INITIAL;
- sp->file->stern = nat[sp->nationality]++;
- sp->file->dir = sp->shipdir;
- sp->file->row = sp->shiprow;
- sp->file->col = sp->shipcol;
- }
- windspeed = cc->windspeed;
- winddir = cc->winddir;
- people = 0;
- for (;;) {
- sleep(7);
- if (Sync() < 0) {
- value = 1;
- break;
- }
- if (next() < 0)
- break;
- unfoul();
- checkup();
- prizecheck();
- moveall();
- thinkofgrapples();
- boardcomp();
- compcombat();
- resolve();
- reload();
- checksails();
- if (Sync() < 0) {
- value = 1;
- break;
- }
- }
- sync_close(1);
- return value;
-}
diff --git a/games/sail/driver.h b/games/sail/driver.h
deleted file mode 100644
index 84faf24..0000000
--- a/games/sail/driver.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)driver.h 8.1 (Berkeley) 5/31/93
- */
-
-#include "externs.h"
-
-extern int dtab[];
diff --git a/games/sail/externs.h b/games/sail/externs.h
deleted file mode 100644
index 89decdd..0000000
--- a/games/sail/externs.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)externs.h 8.1 (Berkeley) 5/31/93
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include "machdep.h"
-
- /* program mode */
-int mode;
-jmp_buf restart;
-#define MODE_PLAYER 1
-#define MODE_DRIVER 2
-#define MODE_LOGGER 3
-
- /* command line flags */
-char debug; /* -D */
-char randomize; /* -x, give first available ship */
-char longfmt; /* -l, print score in long format */
-char nobells; /* -b, don't ring bell before Signal */
-
- /* other initial modes */
-char issetuid; /* running setuid */
-
-#define die() (random() % 6 + 1)
-#define sqr(a) ((a) * (a))
-#define abs(a) ((a) > 0 ? (a) : -(a))
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
-#define grappled(a) ((a)->file->ngrap)
-#define fouled(a) ((a)->file->nfoul)
-#define snagged(a) (grappled(a) + fouled(a))
-
-#define grappled2(a, b) ((a)->file->grap[(b)->file->index].sn_count)
-#define fouled2(a, b) ((a)->file->foul[(b)->file->index].sn_count)
-#define snagged2(a, b) (grappled2(a, b) + fouled2(a, b))
-
-#define Xgrappled2(a, b) ((a)->file->grap[(b)->file->index].sn_turn < turn-1 ? grappled2(a, b) : 0)
-#define Xfouled2(a, b) ((a)->file->foul[(b)->file->index].sn_turn < turn-1 ? fouled2(a, b) : 0)
-#define Xsnagged2(a, b) (Xgrappled2(a, b) + Xfouled2(a, b))
-
-#define cleangrapple(a, b, c) Cleansnag(a, b, c, 1)
-#define cleanfoul(a, b, c) Cleansnag(a, b, c, 2)
-#define cleansnag(a, b, c) Cleansnag(a, b, c, 3)
-
-#define sterncolour(sp) ((sp)->file->stern+'0'-((sp)->file->captured?10:0))
-#define sternrow(sp) ((sp)->file->row + dr[(sp)->file->dir])
-#define sterncol(sp) ((sp)->file->col + dc[(sp)->file->dir])
-
-#define capship(sp) ((sp)->file->captured?(sp)->file->captured:(sp))
-
-#define readyname(r) ((r) & R_LOADING ? '*' : ((r) & R_INITIAL ? '!' : ' '))
-
-/* loadL and loadR, should match loadname[] */
-#define L_EMPTY 0 /* should be 0, don't change */
-#define L_GRAPE 1
-#define L_CHAIN 2
-#define L_ROUND 3
-#define L_DOUBLE 4
-#define L_EXPLODE 5
-
-/*
- * readyL and readyR, these are bits, except R_EMPTY
- */
-#define R_EMPTY 0 /* not loaded and not loading */
-#define R_LOADING 1 /* loading */
-#define R_DOUBLE 2 /* loading double */
-#define R_LOADED 4 /* loaded */
-#define R_INITIAL 8 /* loaded initial */
-
-#define HULL 0
-#define RIGGING 1
-
-#define W_CAPTAIN 1
-#define W_CAPTURED 2
-#define W_CLASS 3
-#define W_CREW 4
-#define W_DBP 5
-#define W_DRIFT 6
-#define W_EXPLODE 7
-#define W_FILE 8
-#define W_FOUL 9
-#define W_GUNL 10
-#define W_GUNR 11
-#define W_HULL 12
-#define W_MOVE 13
-#define W_OBP 14
-#define W_PCREW 15
-#define W_UNFOUL 16
-#define W_POINTS 17
-#define W_QUAL 18
-#define W_UNGRAP 19
-#define W_RIGG 20
-#define W_COL 21
-#define W_DIR 22
-#define W_ROW 23
-#define W_SIGNAL 24
-#define W_SINK 25
-#define W_STRUCK 26
-#define W_TA 27
-#define W_ALIVE 28
-#define W_TURN 29
-#define W_WIND 30
-#define W_FS 31
-#define W_GRAP 32
-#define W_RIG1 33
-#define W_RIG2 34
-#define W_RIG3 35
-#define W_RIG4 36
-#define W_BEGIN 37
-#define W_END 38
-#define W_DDEAD 39
-
-#define NLOG 10
-struct logs {
- char l_name[20];
- int l_uid;
- int l_shipnum;
- int l_gamenum;
- int l_netpoints;
-};
-
-struct BP {
- short turnsent;
- struct ship *toship;
- short mensent;
-};
-
-struct snag {
- short sn_count;
- short sn_turn;
-};
-
-#define NSCENE nscene
-#define NSHIP 10
-#define NBP 3
-
-#define NNATION 8
-#define N_A 0
-#define N_B 1
-#define N_S 2
-#define N_F 3
-#define N_J 4
-#define N_D 5
-#define N_K 6
-#define N_O 7
-
-struct File {
- int index;
- char captain[20]; /* 0 */
- short points; /* 20 */
- char loadL; /* 22 */
- char loadR; /* 24 */
- char readyL; /* 26 */
- char readyR; /* 28 */
- struct BP OBP[NBP]; /* 30 */
- struct BP DBP[NBP]; /* 48 */
- char struck; /* 66 */
- struct ship *captured; /* 68 */
- short pcrew; /* 70 */
- char movebuf[60]; /* 72 */
- char drift; /* 132 */
- short nfoul;
- short ngrap;
- struct snag foul[NSHIP]; /* 134 */
- struct snag grap[NSHIP]; /* 144 */
- char RH; /* 274 */
- char RG; /* 276 */
- char RR; /* 278 */
- char FS; /* 280 */
- char explode; /* 282 */
- char sink; /* 284 */
- char dir;
- short col;
- short row;
- char loadwith;
- char stern;
-};
-
-struct ship {
- char *shipname; /* 0 */
- struct shipspecs *specs; /* 2 */
- char nationality; /* 4 */
- short shiprow; /* 6 */
- short shipcol; /* 8 */
- char shipdir; /* 10 */
- struct File *file; /* 12 */
-};
-
-struct scenario {
- char winddir; /* 0 */
- char windspeed; /* 2 */
- char windchange; /* 4 */
- char vessels; /* 12 */
- char *name; /* 14 */
- struct ship ship[NSHIP]; /* 16 */
-};
-extern struct scenario scene[];
-int nscene;
-
-struct shipspecs {
- char bs;
- char fs;
- char ta;
- short guns;
- char class;
- char hull;
- char qual;
- char crew1;
- char crew2;
- char crew3;
- char gunL;
- char gunR;
- char carL;
- char carR;
- char rig1;
- char rig2;
- char rig3;
- char rig4;
- short pts;
-};
-extern struct shipspecs specs[];
-
-struct scenario *cc; /* the current scenario */
-struct ship *ls; /* &cc->ship[cc->vessels] */
-
-#define SHIP(s) (&cc->ship[s])
-#define foreachship(sp) for ((sp) = cc->ship; (sp) < ls; (sp)++)
-
-struct windeffects {
- char A, B, C, D;
-};
-struct windeffects WET[7][6];
-
-struct Tables {
- char H, G, C, R;
-};
-struct Tables RigTable[11][6];
-struct Tables HullTable[11][6];
-
-char AMMO[9][4];
-char HDT[9][10];
-char HDTrake[9][10];
-char QUAL[9][5];
-char MT[9][3];
-
-extern char *countryname[];
-extern char *classname[];
-extern char *directionname[];
-extern char *qualname[];
-extern char loadname[];
-
-extern char rangeofshot[];
-
-extern char dr[], dc[];
-
-int winddir;
-int windspeed;
-int turn;
-int game;
-int alive;
-int people;
-char hasdriver;
-
-char *info();
-char *quality();
-double arctan();
-char *saywhat();
-struct ship *closestenemy();
-
-char *rindex();
-char *strcpy();
-char *strcat();
-char *strncpy();
-char *getenv();
-char *gets();
diff --git a/games/sail/game.c b/games/sail/game.c
deleted file mode 100644
index 8ff3c90..0000000
--- a/games/sail/game.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)game.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-maxturns(ship, af)
-struct ship *ship;
-char *af;
-{
- int turns;
-
- turns = ship->specs->ta;
- if (*af = (ship->file->drift > 1 && turns)) {
- turns--;
- if (ship->file->FS == 1)
- turns = 0;
- }
- return turns;
-}
-
-maxmove(ship, dir, fs)
-struct ship *ship;
-int dir, fs;
-{
- int riggone = 0, Move, flank = 0;
-
- Move = ship->specs->bs;
- if (!ship->specs->rig1)
- riggone++;
- if (!ship->specs->rig2)
- riggone++;
- if (!ship->specs->rig3)
- riggone++;
- if (!ship->specs->rig4)
- riggone++;
- if ((ship->file->FS || fs) && fs != -1) {
- flank = 1;
- Move = ship->specs->fs;
- }
- if (dir == winddir)
- Move -= 1 + WET[windspeed][ship->specs->class-1].B;
- else if (dir == winddir + 2 || dir == winddir - 2 || dir == winddir - 6 || dir == winddir + 6)
- Move -= 1 + WET[windspeed][ship->specs->class-1].C;
- else if (dir == winddir + 3 || dir == winddir - 3 || dir == winddir - 5 || dir == winddir + 5)
- Move = (flank ? 2 : 1) - WET[windspeed][ship->specs->class-1].D;
- else if (dir == winddir + 4 || dir == winddir - 4)
- Move = 0;
- else
- Move -= WET[windspeed][ship->specs->class-1].A;
- Move -= riggone;
- Move = Move < 0 ? 0 : Move;
- return(Move);
-}
diff --git a/games/sail/globals.c b/games/sail/globals.c
deleted file mode 100644
index e9ccc07..0000000
--- a/games/sail/globals.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)globals.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-struct scenario scene[] = {
- /*
- * int winddir;
- * int windspeed;
- * int windchange;
- * int vessels;
- * char *name;
- * struct ship ship[NSHIP];
- */
- 5, 3, 5, 2, "Ranger vs. Drake",
- {
- { "Ranger", specs+0, N_A, 7, 20, 4, 0 },
- { "Drake", specs+1, N_B, 7, 31, 5, 0 }
- },
- 1, 3, 6, 2, "The Battle of Flamborough Head",
- {
- { "Bonhomme Rich", specs+2, N_A, 13, 40, 2, 0 },
- { "Serapis", specs+3, N_B, 2, 42, 2, 0 }
- },
- 5, 5, 5, 10, "Arbuthnot and Des Touches",
- {
- { "America", specs+4, N_B, 7, 37, 4, 0 },
- { "Befford", specs+5, N_B, 5, 35, 4, 0 },
- { "Adamant", specs+6, N_B, 3, 33, 4, 0 },
- { "London", specs+7, N_B, 1, 31, 4, 0 },
- { "Royal Oak", specs+8, N_B, -1, 29, 4, 0 },
- { "Neptune", specs+9, N_F, 6, 44, 4, 0 },
- { "Duc Bougogne", specs+10, N_F, 8, 46, 4, 0 },
- { "Conquerant", specs+48, N_F, 10, 48, 4, 0 },
- { "Provence", specs+11, N_F, 12, 50, 4, 0 },
- { "Romulus", specs+12, N_F, 20, 58, 4, 0 }
- },
- 1, 3, 5, 10, "Suffren and Hughes",
- {
- { "Monmouth", specs+52, N_B, 9, 45, 2, 0 },
- { "Hero", specs+5, N_B, 13, 49, 2, 0 },
- { "Isis", specs+6, N_B, 12, 48, 2, 0 },
- { "Superb", specs+50, N_B, 10, 46, 2, 0 },
- { "Burford", specs+48, N_B, 11, 47, 2, 0 },
- { "Flamband", specs+13, N_F, 7, 59, 4, 0 },
- { "Annibal", specs+9, N_F, 4, 56, 4, 0 },
- { "Severe", specs+11, N_F, 2, 54, 4, 0 },
- { "Brilliant", specs+49, N_F, -1, 51, 4, 0 },
- { "Sphinx", specs+51, N_F, -5, 47, 4, 0 }
- },
- 1, 3, 4, 2, "Nymphe vs. Cleopatre",
- {
- { "Nymphe", specs+14, N_B, 13, 30, 2, 0 },
- { "Cleopatre", specs+15, N_F, 3, 41, 2, 0 }
- },
- 1, 3, 5, 2, "Mars vs. Hercule",
- {
- { "Mars", specs+16, N_B, 13, 30, 2, 0 },
- { "Hercule", specs+17, N_F, 3, 41, 2, 0 }
- },
- 5, 3, 5, 2, "Ambuscade vs. Baionnaise",
- {
- { "Ambuscade", specs+18, N_B, 13, 30, 2, 0 },
- { "Baionnaise", specs+19, N_F, 3, 41, 2, 0 }
- },
- 1, 5, 6, 2, "Constellation vs. Insurgent",
- {
- { "Constellation", specs+20, N_A, 9, 50, 8, 0 },
- { "Insurgent", specs+22, N_F, 4, 24, 2, 0 }
- },
- 1, 3, 5, 2, "Constellation vs. Vengeance",
- {
- { "Constellation", specs+20, N_A, 12, 40, 2, 0 },
- { "Vengeance", specs+21, N_F, 1, 43, 2, 0 }
- },
- 1, 3, 6, 10, "The Battle of Lissa",
- {
- { "Amphion", specs+23, N_B, 8, 50, 4, 0 },
- { "Active", specs+24, N_B, 6, 48, 4, 0 },
- { "Volage", specs+25, N_B, 4, 46, 4, 0 },
- { "Cerberus", specs+26, N_B, 2, 44, 4, 0 },
- { "Favorite", specs+27, N_F, 9, 34, 2, 0 },
- { "Flore", specs+21, N_F, 13, 39, 2, 0 },
- { "Danae", specs+64, N_F, 15, 37, 2, 0 },
- { "Bellona", specs+28, N_F, 17, 35, 2, 0 },
- { "Corona", specs+29, N_F, 12, 31, 2, 0 },
- { "Carolina", specs+30, N_F, 15, 28, 2, 0 }
- },
- 2, 5, 6, 2, "Constitution vs. Guerriere",
- {
- { "Constitution", specs+31, N_A, 7, 35, 1, 0 },
- { "Guerriere", specs+32, N_B, 7, 47, 4, 0 }
- },
- 1, 3, 5, 2, "United States vs. Macedonian",
- {
- { "United States", specs+33, N_A, 1, 52, 6, 0 },
- { "Macedonian", specs+34, N_B, 14, 40, 1, 0 }
- },
- 1, 3, 6, 2, "Constitution vs. Java",
- {
- { "Constitution", specs+31, N_A, 1, 40, 2, 0 },
- { "Java", specs+35, N_B, 11, 40, 2, 0 }
- },
- 1, 3, 5, 2, "Chesapeake vs. Shannon",
- {
- { "Chesapeake", specs+36, N_A, 13, 40, 2, 0 },
- { "Shannon", specs+37, N_B, 1, 42, 2, 0 }
- },
- 1, 1, 6, 5, "The Battle of Lake Erie",
- {
- { "Lawrence", specs+38, N_A, 4, 55, 8, 0 },
- { "Niagara", specs+42, N_A, 7, 61, 8, 0 },
- { "Lady Prevost", specs+39, N_B, 4, 25, 2, 0 },
- { "Detroit", specs+40, N_B, 7, 22, 2, 0 },
- { "Q. Charlotte", specs+41, N_B, 10, 19, 2, 0 }
- },
- 1, 1, 5, 2, "Wasp vs. Reindeer",
- {
- { "Wasp", specs+42, N_A, 3, 41, 2, 0 },
- { "Reindeer", specs+43, N_B, 10, 48, 2, 0 }
- },
- 1, 2, 5, 3, "Constitution vs. Cyane and Levant",
- {
- { "Constitution", specs+31, N_A, 10, 45, 2, 0 },
- { "Cyane", specs+44, N_B, 3, 37, 2, 0 },
- { "Levant", specs+45, N_B, 5, 35, 2, 0 }
- },
- 5, 5, 5, 3, "Pellew vs. Droits de L'Homme",
- {
- { "Indefatigable", specs+46, N_B, 12, 45, 6, 0 },
- { "Amazon", specs+47, N_B, 9, 48, 6, 0 },
- { "Droits L'Hom", specs+48, N_F, 3, 28, 5, 0 }
- },
- 2, 2, 3, 10, "Algeciras",
- {
- { "Caesar", specs+49, N_B, 7, 70, 6, 0 },
- { "Pompee", specs+50, N_B, 5, 72, 6, 0 },
- { "Spencer", specs+5, N_B, 3, 74, 6, 0 },
- { "Hannibal", specs+7, N_B, 1, 76, 6, 0 },
- { "Real-Carlos", specs+53, N_S, 9, 20, 3, 0 },
- { "San Fernando", specs+54, N_S, 11, 16, 3, 0 },
- { "Argonauta", specs+55, N_S, 10, 14, 4, 0 },
- { "San Augustine", specs+56, N_S, 6, 22, 4, 0 },
- { "Indomptable", specs+51, N_F, 7, 23, 5, 0 },
- { "Desaix", specs+52, N_F, 7, 27, 7, 0 }
- },
- 5, 3, 6, 7, "Lake Champlain",
- {
- { "Saratoga", specs+60, N_A, 8, 10, 1, 0 },
- { "Eagle", specs+61, N_A, 9, 13, 2, 0 },
- { "Ticonderoga", specs+62, N_A, 12, 17, 3, 0 },
- { "Preble", specs+63, N_A, 14, 20, 2, 0 },
- { "Confiance", specs+57, N_B, 4, 70, 6, 0 },
- { "Linnet", specs+58, N_B, 7, 68, 6, 0 },
- { "Chubb", specs+59, N_B, 10, 65, 6, 0 }
- },
- 5, 3, 6, 4, "Last Voyage of the USS President",
- {
- { "President", specs+67, N_A, 12, 42, 5, 0 },
- { "Endymion", specs+64, N_B, 5, 42, 5, 0 },
- { "Pomone", specs+65, N_B, 7, 82, 6, 0 },
- { "Tenedos", specs+66, N_B, 7, -1, 4, 0 }
- },
- 7, 5, 5, 2, "Hornblower and the Natividad",
- {
- { "Lydia", specs+68, N_B, 12, 40, 2, 0 },
- { "Natividad", specs+69, N_S, 2, 40, 4, 0 }
- },
- 1, 3, 6, 2, "Curse of the Flying Dutchman",
- {
- { "Piece of Cake", specs+19, N_S, 7, 40, 2, 0 },
- { "Flying Dutchy", specs+71, N_F, 7, 41, 1, 0 }
- },
- 1, 4, 1, 4, "The South Pacific",
- {
- { "USS Scurvy", specs+70, N_A, 7, 40, 1, 0 },
- { "HMS Tahiti", specs+71, N_B, 12, 60, 1, 0 },
- { "Australian", specs+18, N_S, 5, 20, 8, 0 },
- { "Bikini Atoll", specs+63, N_F, 2, 60, 4, 0 }
- },
- 7, 3, 6, 5, "Hornblower and the battle of Rosas bay",
- {
- { "Sutherland", specs+5, N_B, 13, 30, 2, 0 },
- { "Turenne", specs+10, N_F, 9, 35, 6, 0 },
- { "Nightmare", specs+9, N_F, 7, 37, 6, 0 },
- { "Paris", specs+53, N_F, 3, 45, 4, 0 },
- { "Napolean", specs+56, N_F, 1, 40, 6, 0 }
- },
- 6, 4, 7, 5, "Cape Horn",
- {
- { "Concord", specs+51, N_A, 3, 20, 4, 0 },
- { "Berkeley", specs+7, N_A, 5, 50, 5, 0 },
- { "Thames", specs+71, N_B, 10, 40, 1, 0 },
- { "Madrid", specs+53, N_S, 13, 60, 8, 0 },
- { "Musket", specs+10, N_F, 10, 60, 7, 0 }
- },
- 8, 3, 7, 3, "New Orleans",
- {
- { "Alligator", specs+71, N_A, 13, 5, 1, 0 },
- { "Firefly", specs+50, N_B, 10, 20, 8, 0 },
- { "Cypress", specs+46, N_B, 5, 10, 6, 0 }
- },
- 5, 3, 7, 3, "Botany Bay",
- {
- { "Shark", specs+11, N_B, 6, 15, 4, 0 },
- { "Coral Snake", specs+31, N_F, 3, 30, 6, 0 },
- { "Sea Lion", specs+33, N_F, 13, 50, 8, 0 }
- },
- 4, 3, 6, 4, "Voyage to the Bottom of the Sea",
- {
- { "Seaview", specs+71, N_A, 6, 3, 3, 0 },
- { "Flying Sub", specs+64, N_A, 8, 3, 3, 0 },
- { "Mermaid", specs+70, N_B, 2, 5, 5, 0 },
- { "Giant Squid", specs+53, N_S, 10, 30, 8, 0 }
- },
- 7, 3, 6, 3, "Frigate Action",
- {
- { "Killdeer", specs+21, N_A, 7, 20, 8, 0 },
- { "Sandpiper", specs+27, N_B, 5, 40, 8, 0 },
- { "Curlew", specs+34, N_S, 10, 60, 8, 0 }
- },
- 7, 2, 5, 6, "The Battle of Midway",
- {
- { "Enterprise", specs+49, N_A, 10, 70, 8, 0 },
- { "Yorktown", specs+51, N_A, 3, 70, 7, 0 },
- { "Hornet", specs+52, N_A, 6, 70, 7, 0 },
- { "Akagi", specs+53, N_J, 6, 10, 4, 0 },
- { "Kaga", specs+54, N_J, 4, 12, 4, 0 },
- { "Soryu", specs+55, N_J, 2, 14, 4, 0 }
- },
- 1, 3, 4, 8, "Star Trek",
- {
- { "Enterprise", specs+76, N_D,-10, 60, 7, 0 },
- { "Yorktown", specs+77, N_D, 0, 70, 7, 0 },
- { "Reliant", specs+78, N_D, 10, 70, 7, 0 },
- { "Galileo", specs+79, N_D, 20, 60, 7, 0 },
- { "Kobayashi Maru", specs+80, N_K, 0,120, 7, 0 },
- { "Klingon II", specs+81, N_K, 10,120, 7, 0 },
- { "Red Orion", specs+82, N_O, 0, 0, 3, 0 },
- { "Blue Orion", specs+83, N_O, 10, 0, 3, 0 }
- }
-};
-int nscene = sizeof scene / sizeof (struct scenario);
-
-struct shipspecs specs[] = {
-/* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */
-/* class qual crew2 gunL carL rig1 rig3 */
-/*00*/ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7,
-/*01*/ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 4, 4, 3, 3, 3, 3, 6,
-/*02*/ 3, 5, 2, 42, 4, 7, 4, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, -1, 11,
-/*03*/ 4, 6, 3, 44, 3, 7, 4, 2, 2, 2, 3, 3, 0, 0, 5, 5, 5, 5, 12,
-/*04*/ 3, 5, 2, 64, 2, 17, 4, 8, 6, 6, 12, 12, 2, 2, 7, 7, 7, -1, 20,
-/*05*/ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26,
-/*06*/ 3, 5, 2, 50, 2, 12, 4, 6, 4, 4, 8, 8, 2, 2, 6, 6, 6, -1, 17,
-/*07*/ 3, 5, 1, 98, 1, 23, 4, 10, 10, 10, 18, 18, 2, 2, 8, 8, 8, -1, 28,
-/*08*/ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26,
-/*09*/ 3, 5, 2, 74, 2, 21, 3, 10, 10, 8, 20, 20, 0, 0, 7, 7, 7, -1, 24,
-/*10*/ 3, 5, 1, 80, 1, 23, 3, 12, 12, 10, 22, 22, 0, 0, 7, 7, 7, -1, 27,
-/*11*/ 3, 5, 2, 64, 2, 18, 3, 8, 8, 6, 12, 12, 0, 0, 7, 7, 7, -1, 18,
-/*12*/ 3, 5, 2, 44, 2, 11, 3, 4, 4, 4, 6, 6, 2, 2, 5, 5, 5, -1, 10,
-/*13*/ 3, 5, 2, 50, 2, 14, 3, 6, 6, 4, 8, 8, 0, 0, 6, 6, 6, -1, 14,
-/*14*/ 4, 6, 3, 36, 3, 11, 4, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 11,
-/*15*/ 4, 6, 3, 36, 3, 11, 3, 4, 4, 4, 4, 4, 2, 2, 5, 5, 5, 5, 10,
-/*16*/ 3, 5, 2, 74, 2, 21, 4, 10, 8, 8, 18, 18, 2, 2, 7, 7, 7, -1, 26,
-/*17*/ 3, 5, 2, 74, 2, 21, 3, 10, 10, 8, 20, 20, 2, 2, 7, 7, 7, -1, 23,
-/*18*/ 4, 6, 3, 32, 3, 8, 3, 4, 2, 2, 4, 4, 2, 2, 5, 5, 5, 5, 9,
-/*19*/ 4, 6, 3, 24, 4, 6, 3, 4, 4, 4, 2, 2, 0, 0, 4, 4, 4, 4, 9,
-/*20*/ 4, 7, 3, 38, 4, 14, 5, 6, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5, 17,
-/*21*/ 4, 6, 3, 40, 3, 15, 3, 8, 6, 6, 6, 6, 4, 4, 5, 5, 5, 5, 15,
-/*22*/ 4, 7, 3, 36, 4, 11, 3, 6, 6, 4, 4, 4, 2, 2, 5, 5, 5, 5, 11,
-/*23*/ 4, 6, 3, 32, 3, 11, 5, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 13,
-/*24*/ 4, 6, 3, 38, 3, 14, 5, 4, 4, 4, 6, 6, 4, 4, 5, 5, 5, 5, 18,
-/*25*/ 4, 6, 3, 22, 3, 6, 5, 2, 2, 2, 0, 0, 8, 8, 4, 4, 4, 4, 11,
-/*26*/ 4, 6, 3, 32, 3, 11, 5, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 13,
-/*27*/ 4, 6, 3, 40, 3, 14, 3, 6, 6, 4, 6, 6, 4, 4, 5, 5, 5, 5, 15,
-/*28*/ 4, 6, 3, 32, 3, 11, 2, 4, 4, 4, 4, 4, 0, 0, 5, 5, 5, 5, 9,
-/*29*/ 4, 6, 3, 40, 3, 14, 2, 6, 6, 4, 6, 6, 4, 4, 5, 5, 5, 5, 12,
-/*30*/ 4, 6, 3, 32, 3, 8, 2, 4, 4, 1, 2, 2, 0, 0, 4, 4, 4, 4, 7,
-/*31*/ 4, 7, 3, 44, 4, 18, 5, 6, 6, 6, 8, 8, 6, 6, 6, 6, 6, 6, 24,
-/*32*/ 4, 6, 3, 38, 3, 14, 4, 4, 4, 2, 6, 6, 4, 4, 5, 5, 5, 5, 15,
-/*33*/ 4, 5, 3, 44, 3, 18, 5, 8, 6, 6, 8, 8, 8, 8, 6, 6, 6, 6, 24,
-/*34*/ 4, 6, 3, 38, 3, 14, 4, 4, 4, 4, 6, 6, 4, 4, 5, 5, 5, 5, 16,
-/*35*/ 4, 7, 3, 38, 4, 14, 4, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 19,
-/*36*/ 4, 6, 3, 38, 3, 14, 3, 6, 6, 4, 6, 6, 6, 6, 5, 5, 5, 5, 14,
-/*37*/ 4, 6, 3, 38, 3, 14, 5, 6, 4, 4, 6, 6, 6, 6, 5, 5, 5, 5, 17,
-/*38*/ 4, 7, 3, 20, 5, 6, 4, 4, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 9,
-/*39*/ 4, 7, 3, 13, 6, 3, 4, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 5,
-/*40*/ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7,
-/*41*/ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 3, 3, 3, 3, 6,
-/*42*/ 4, 7, 3, 20, 5, 6, 5, 4, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 12,
-/*43*/ 4, 7, 3, 18, 5, 5, 5, 2, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 9,
-/*44*/ 4, 7, 3, 24, 5, 6, 4, 4, 2, 2, 0, 0,10,10, 4, 4, 4, 4, 11,
-/*45*/ 4, 7, 3, 20, 5, 6, 4, 2, 2, 2, 0, 0, 8, 8, 4, 4, 4, 4, 10,
-/*46*/ 4, 6, 3, 44, 3, 11, 5, 4, 4, 4, 4, 4, 2, 2, 5, 5, 5, 5, 14,
-/*47*/ 4, 6, 3, 36, 3, 12, 4, 4, 4, 4, 6, 6, 2, 2, 5, 5, 5, 5, 14,
-/*48*/ 3, 5, 2, 74, 2, 21, 3, 10, 8, 8, 20, 20, 2, 2, 4, 4, 7, -1, 24,
-/*49*/ 3, 5, 2, 80, 2, 24, 4, 10, 8, 8, 20, 20, 2, 2, 8, 8, 8, -1, 31,
-/*50*/ 3, 5, 2, 74, 2, 21, 4, 8, 8, 6, 16, 16, 4, 4, 7, 7, 7, -1, 27,
-/*51*/ 3, 5, 2, 80, 2, 24, 3, 12, 12, 10, 22, 22, 2, 2, 7, 7, 7, -1, 27,
-/*52*/ 3, 5, 2, 74, 2, 21, 3, 10, 10, 8, 20, 20, 2, 2, 7, 7, 7, -1, 24,
-/*53*/ 3, 5, 1, 112, 1, 27, 2, 12, 12, 12, 24, 24, 0, 0, 9, 9, 9, -1, 27,
-/*54*/ 3, 5, 1, 96, 1, 24, 2, 12, 12, 10, 20, 20, 0, 0, 8, 8, 8, -1, 24,
-/*55*/ 3, 5, 2, 80, 2, 23, 2, 10, 10, 8, 20, 20, 0, 0, 7, 7, 7, -1, 23,
-/*56*/ 3, 5, 2, 74, 2, 21, 2, 10, 8, 8, 16, 16, 4, 4, 7, 7, 7, -1, 20,
-/*57*/ 4, 6, 3, 37, 3, 12, 4, 4, 4, 2, 6, 6, 4, 4, 5, 5, 5, 5, 14,
-/*58*/ 4, 7, 3, 16, 5, 5, 5, 2, 2, 2, 0, 0, 4, 4, 4, 4, 4, 4, 10,
-/*59*/ 4, 7, 3, 11, 6, 3, 4, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 5,
-/*60*/ 4, 7, 3, 26, 5, 6, 4, 4, 2, 2, 2, 2, 6, 6, 4, 4, 4, 4, 12,
-/*61*/ 4, 7, 3, 20, 5, 6, 4, 4, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 11,
-/*62*/ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 9,
-/*63*/ 4, 7, 3, 7, 6, 3, 4, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 4,
-/*64*/ 4, 6, 3, 40, 3, 15, 4, 4, 4, 4, 8, 8, 6, 6, 5, 5, 5, 5, 17,
-/*65*/ 4, 6, 3, 44, 3, 15, 4, 8, 8, 6, 10, 10, 2, 2, 6, 6, 6, 6, 20,
-/*66*/ 4, 6, 3, 38, 3, 14, 4, 4, 4, 4, 6, 6, 6, 6, 5, 5, 5, 5, 15,
-/*67*/ 4, 5, 3, 44, 3, 18, 5, 8, 6, 6, 8, 8, 8, 8, 6, 6, 6, 6, 24,
-/*68*/ 4, 6, 3, 36, 3, 9, 5, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 13,
-/*69*/ 3, 5, 2, 50, 2, 14, 2, 6, 6, 6, 8, 8, 0, 0, 6, 6, 6, -1, 14,
-/*70*/ 3, 5, 1, 136, 1, 30, 1, 8, 14, 14, 28, 28, 0, 0, 9, 9, 9, -1, 27,
-/*71*/ 3, 5, 1, 120, 1, 27, 5, 16, 14, 14, 28, 28, 2, 2, 9, 9, 9, -1, 43,
-/*72*/ 3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7, 9, 9, 9, -1, 36,
-/*73*/ 3, 5, 1, 90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6, 5, 5, 5, 5, 28,
-/*74*/ 4, 7, 3, 6, 6, 3, 4, 2, 2, 2, 20, 20, 6, 6, 2, 2, 3, 3, 5,
-/*75*/ 3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8, 7, 8, 9, -1, 34,
-/*76*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*77*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*78*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*79*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*80*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*81*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*82*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/*83*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75,
-/* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */
-/* class qual crew2 gunL carL rig1 rig3 */
-};
-
-struct windeffects WET[7][6] = {
- { {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9} },
- { {3,2,2,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {2,1,0,0}, {2,1,0,0} },
- { {1,1,1,0}, {1,1,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0} },
- { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} },
- { {0,0,0,0}, {1,0,0,0}, {1,1,0,0}, {1,1,0,0}, {2,2,1,0}, {2,2,1,0} },
- { {1,0,0,0}, {1,1,0,0}, {1,1,1,0}, {1,1,1,0}, {3,2,2,0}, {3,2,2,0} },
- { {2,1,1,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {3,3,2,0}, {3,3,2,0} }
-};
-
-struct Tables RigTable[11][6] = {
- { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0} },
- { {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {1,0,0,1}, {0,1,1,1} },
- { {0,0,0,0}, {0,0,0,1}, {0,0,1,1}, {0,1,0,1}, {0,1,0,1}, {1,0,1,2} },
- { {0,0,0,0}, {0,0,1,1}, {0,1,0,1}, {0,0,0,2}, {0,1,0,2}, {1,0,1,2} },
- { {0,1,0,1}, {1,0,0,1}, {0,1,1,2}, {0,1,0,2}, {0,0,1,3}, {1,0,1,4} },
- { {0,0,1,1}, {0,1,0,2}, {1,0,0,3}, {0,1,1,3}, {1,0,0,4}, {1,1,1,4} },
- { {0,0,1,2}, {0,1,1,2}, {1,1,0,3}, {0,1,0,4}, {1,0,0,4}, {1,0,1,5} },
- { {0,0,1,2}, {0,1,0,3}, {1,1,0,3}, {1,0,2,4}, {0,2,1,5}, {2,1,0,5} },
- { {0,2,1,3}, {1,0,0,3}, {2,1,0,4}, {0,1,1,4}, {0,1,0,5}, {1,0,2,6} },
- { {1,1,0,4}, {1,0,1,4}, {2,0,0,5}, {0,2,1,5}, {0,1,2,6}, {0,2,0,7} },
- { {1,0,1,5}, {0,2,0,6}, {1,2,0,6}, {1,1,1,6}, {2,0,2,6}, {1,1,2,7} }
-};
-struct Tables HullTable[11][6] = {
- { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {1,0,0,0}, {0,1,0,0} },
- { {0,0,0,0}, {0,0,0,0}, {0,1,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1} },
- { {0,1,0,0}, {1,0,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1}, {2,1,0,0} },
- { {0,1,1,0}, {1,0,0,0}, {1,1,1,0}, {2,0,0,1}, {2,0,1,0}, {2,2,0,0} },
- { {0,1,1,0}, {1,0,0,1}, {2,1,0,1}, {2,2,1,0}, {3,0,1,0}, {3,1,0,0} },
- { {1,1,1,0}, {2,0,2,1}, {2,1,1,0}, {2,2,0,0}, {3,1,0,1}, {3,1,1,0} },
- { {1,2,2,0}, {2,0,2,1}, {2,1,0,1}, {2,2,0,0}, {3,1,1,0}, {4,2,1,0} },
- { {2,1,1,0}, {2,0,1,1}, {3,2,2,0}, {3,2,0,0}, {4,2,1,0}, {4,2,1,1} },
- { {2,1,2,0}, {3,1,1,1}, {3,2,2,0}, {4,2,1,0}, {4,1,0,2}, {4,2,2,0} },
- { {2,3,1,0}, {3,2,2,0}, {3,2,2,1}, {4,2,2,0}, {4,1,0,3}, {5,1,2,0} },
- { {2,2,4,0}, {3,3,1,1}, {4,2,1,1}, {5,1,0,2}, {5,1,2,1}, {6,2,2,0} },
-};
-
-char AMMO[9][4] = {
- { -1, 1, 0, 1 },
- { -1, 1, 0, 1 },
- { -1, 1, 0, 1 },
- { -2, 1, 0, 2 },
- { -2, 2, 0, 2 },
- { -2, 2, 0, 2 },
- { -3, 2, 0, 2 },
- { -3, 2, 0, 3 },
- { -3, 2, 0, 3 }
-};
-
-char HDT[9][10] = {
- { 1, 0,-1,-2,-3,-3,-4,-4,-4,-4 },
- { 1, 1, 0,-1,-2,-2,-3,-3,-3,-3 },
- { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 },
- { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 },
- { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 },
- { 3, 3, 2, 1, 0, 0,-1,-1,-1,-1 },
- { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 },
- { 4, 4, 3, 2, 1, 1, 0, 0, 0, 0 },
- { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 }
-};
-
-char HDTrake[9][10] = {
- { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 },
- { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 },
- { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 },
- { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 },
- { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 },
- { 6, 5, 4, 3, 2, 2, 1, 1, 1, 1 },
- { 7, 6, 5, 4, 3, 3, 2, 2, 2, 2 },
- { 8, 7, 6, 5, 4, 4, 3, 3, 3, 3 },
- { 9, 8, 7, 6, 5, 5, 4, 4, 4, 4 }
-};
-
-char QUAL[9][5] = {
- { -1, 0, 0, 1, 1 },
- { -1, 0, 0, 1, 1 },
- { -1, 0, 0, 1, 2 },
- { -1, 0, 0, 1, 2 },
- { -1, 0, 0, 2, 2 },
- { -1,-1, 0, 2, 2 },
- { -2,-1, 0, 2, 2 },
- { -2,-1, 0, 2, 2 },
- { -2,-1, 0, 2, 3 }
-};
-
-char MT[9][3] = {
- { 1, 0, 0 },
- { 1, 1, 0 },
- { 2, 1, 0 },
- { 2, 1, 1 },
- { 2, 2, 1 },
- { 3, 2, 1 },
- { 3, 2, 2 },
- { 4, 3, 2 },
- { 4, 4, 2 }
-};
-
-char rangeofshot[] = {
- 0,
- 1, /* grape */
- 3, /* chain */
- 10, /* round */
- 1 /* double */
-};
-
-char *countryname[] = {
- "American", "British", "Spanish", "French", "Japanese",
- "Federation", "Klingon", "Orion"
-};
-
-char *classname[] = {
- "Drift wood",
- "Ship of the Line",
- "Ship of the Line",
- "Frigate",
- "Corvette",
- "Sloop",
- "Brig"
-};
-
-char *directionname[] = {
- "dead ahead",
- "off the starboard bow",
- "off the starboard beam",
- "off the starboard quarter",
- "dead astern",
- "off the port quarter",
- "off the port beam",
- "off the port bow",
- "dead ahead"
-};
-
-char *qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" };
-
-char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' };
-
-char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
-char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 };
diff --git a/games/sail/lo_main.c b/games/sail/lo_main.c
deleted file mode 100644
index 0615bcc..0000000
--- a/games/sail/lo_main.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lo_main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Print out the top ten SAILors
- *
- * -l force a long listing (print out real usernames)
- */
-#include <sys/types.h>
-#include <pwd.h>
-#include "externs.h"
-#include "pathnames.h"
-
-char *title[] = {
- "Admiral", "Commodore", "Captain", "Captain",
- "Captain", "Captain", "Captain", "Commander",
- "Commander", "Lieutenant"
-};
-
-lo_main()
-{
- FILE *fp;
- char sbuf[32];
- int n = 0, people;
- struct passwd *pass;
- struct logs log;
- struct ship *ship;
-
- if ((fp = fopen(_PATH_LOGFILE, "r")) == 0) {
- perror(_PATH_LOGFILE);
- exit(1);
- }
- switch (fread((char *)&people, sizeof people, 1, fp)) {
- case 0:
- printf("Nobody has sailed yet.\n");
- exit(0);
- case 1:
- break;
- default:
- perror(_PATH_LOGFILE);
- exit(1);
- }
- while (fread((char *)&log, sizeof log, 1, fp) == 1 &&
- log.l_name[0] != '\0') {
- if (longfmt && (pass = getpwuid(log.l_uid)) != NULL)
- (void) sprintf(sbuf, "%10.10s (%s)",
- log.l_name, pass->pw_name);
- else
- (void) sprintf(sbuf, "%20.20s", log.l_name);
- ship = &scene[log.l_gamenum].ship[log.l_shipnum];
- printf("%-10s %21s of the %15s %3d points, %5.2f equiv\n",
- title[n++], sbuf, ship->shipname, log.l_netpoints,
- (float) log.l_netpoints / ship->specs->pts);
- }
- printf("\n%d people have played.\n", people);
- return 0;
-}
diff --git a/games/sail/machdep.h b/games/sail/machdep.h
deleted file mode 100644
index 148da5d..0000000
--- a/games/sail/machdep.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)machdep.h 8.1 (Berkeley) 5/31/93
- */
-
-#define TIMEOUT 300 /* Sync() timeout in seconds */
-
-/* for 4.2bsd machines */
-#define blockalarm() ((void) sigblock(1 << SIGALRM-1))
-#define unblockalarm() ((void) sigsetmask(sigblock(0) & ~(1 << SIGALRM-1)))
-
-/* for 2.9bsd machines (onyx)
-typedef int void;
-#define blockalarm() ((void) sighold(SIGALRM))
-#define unblockalarm() ((void) sigrelse(SIGALRM))
-*/
diff --git a/games/sail/main.c b/games/sail/main.c
deleted file mode 100644
index e5deb9b..0000000
--- a/games/sail/main.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-/*ARGSUSED*/
-main(argc, argv)
- int argc;
- char **argv;
-{
- char *p;
- int i;
-
- srandomdev();
- issetuid = getuid() != geteuid();
- if (p = rindex(*argv, '/'))
- p++;
- else
- p = *argv;
- if (strcmp(p, "driver") == 0 || strcmp(p, "saildriver") == 0)
- mode = MODE_DRIVER;
- else if (strcmp(p, "sail.log") == 0)
- mode = MODE_LOGGER;
- else
- mode = MODE_PLAYER;
- while ((p = *++argv) && *p == '-')
- switch (p[1]) {
- case 'd':
- mode = MODE_DRIVER;
- break;
- case 's':
- mode = MODE_LOGGER;
- break;
- case 'D':
- debug++;
- break;
- case 'x':
- randomize;
- break;
- case 'l':
- longfmt++;
- break;
- case 'b':
- nobells++;
- break;
- default:
- fprintf(stderr, "SAIL: Unknown flag %s.\n", p);
- exit(1);
- }
- if (*argv)
- game = atoi(*argv);
- else
- game = -1;
- if (i = setjmp(restart))
- mode = i;
- switch (mode) {
- case MODE_PLAYER:
- return pl_main();
- case MODE_DRIVER:
- return dr_main();
- case MODE_LOGGER:
- return lo_main();
- default:
- fprintf(stderr, "SAIL: Unknown mode %d.\n", mode);
- abort();
- }
- /*NOTREACHED*/
-}
diff --git a/games/sail/misc.c b/games/sail/misc.c
deleted file mode 100644
index 4808f84..0000000
--- a/games/sail/misc.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-#include "pathnames.h"
-
-#define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
-
-/* XXX */
-range(from, to)
-struct ship *from, *to;
-{
- int bow1r, bow1c, bow2r, bow2c;
- int stern1r, stern1c, stern2c, stern2r;
- int bb, bs, sb, ss, result;
-
- if (!to->file->dir)
- return -1;
- stern1r = bow1r = from->file->row;
- stern1c = bow1c = from->file->col;
- stern2r = bow2r = to->file->row;
- stern2c = bow2c = to->file->col;
- result = bb = distance(bow2r - bow1r, bow2c - bow1c);
- if (bb < 5) {
- stern2r += dr[to->file->dir];
- stern2c += dc[to->file->dir];
- stern1r += dr[from->file->dir];
- stern1c += dc[from->file->dir];
- bs = distance((bow2r - stern1r), (bow2c - stern1c));
- sb = distance((bow1r - stern2r), (bow1c - stern2c));
- ss = distance((stern2r - stern1r) ,(stern2c - stern1c));
- result = min(bb, min(bs, min(sb, ss)));
- }
- return result;
-}
-
-struct ship *
-closestenemy(from, side, anyship)
-struct ship *from;
-char side, anyship;
-{
- struct ship *sp;
- char a;
- int olddist = 30000, dist;
- struct ship *closest = 0;
-
- a = capship(from)->nationality;
- foreachship(sp) {
- if (sp == from)
- continue;
- if (sp->file->dir == 0)
- continue;
- if (a == capship(sp)->nationality && !anyship)
- continue;
- if (side && gunsbear(from, sp) != side)
- continue;
- dist = range(from, sp);
- if (dist < olddist) {
- closest = sp;
- olddist = dist;
- }
- }
- return closest;
-}
-
-angle(dr, dc)
-int dr, dc;
-{
- int i;
-
- if (dc >= 0 && dr > 0)
- i = 0;
- else if (dr <= 0 && dc > 0)
- i = 2;
- else if (dc <= 0 && dr < 0)
- i = 4;
- else
- i = 6;
- dr = abs(dr);
- dc = abs(dc);
- if ((i == 0 || i == 4) && dc * 2.4 > dr) {
- i++;
- if (dc > dr * 2.4)
- i++;
- } else if ((i == 2 || i == 6) && dr * 2.4 > dc) {
- i++;
- if (dr > dc * 2.4)
- i++;
- }
- return i % 8 + 1;
-}
-
-gunsbear(from, to) /* checks for target bow or stern */
-struct ship *from, *to;
-{
- int Dr, Dc, i;
- int ang;
-
- Dr = from->file->row - to->file->row;
- Dc = to->file->col - from->file->col;
- for (i = 2; i; i--) {
- if ((ang = angle(Dr, Dc) - from->file->dir + 1) < 1)
- ang += 8;
- if (ang >= 2 && ang <= 4)
- return 'r';
- if (ang >= 6 && ang <= 7)
- return 'l';
- Dr += dr[to->file->dir];
- Dc += dc[to->file->dir];
- }
- return 0;
-}
-
-portside(from, on, quick)
-struct ship *from, *on;
-int quick; /* returns true if fromship is */
-{ /* shooting at onship's starboard side */
- int ang;
- int Dr, Dc;
-
- Dr = from->file->row - on->file->row;
- Dc = on->file->col - from->file->col;
- if (quick == -1) {
- Dr += dr[on->file->dir];
- Dc += dc[on->file->dir];
- }
- ang = angle(Dr, Dc);
- if (quick != 0)
- return ang;
- ang = (ang + 4 - on->file->dir - 1) % 8 + 1;
- return ang < 5;
-}
-
-colours(sp)
-struct ship *sp;
-{
- char flag;
-
- if (sp->file->struck)
- flag = '!';
- if (sp->file->explode)
- flag = '#';
- if (sp->file->sink)
- flag = '~';
- if (sp->file->struck)
- return flag;
- flag = *countryname[capship(sp)->nationality];
- return sp->file->FS ? flag : tolower(flag);
-}
-
-#include <sys/file.h>
-log(s)
-struct ship *s;
-{
- FILE *fp;
- int persons;
- int n;
- struct logs log[NLOG];
- float net;
- struct logs *lp;
-
- if ((fp = fopen(_PATH_LOGFILE, "r+")) == NULL)
- return;
-#ifdef LOCK_EX
- if (flock(fileno(fp), LOCK_EX) < 0)
- return;
-#endif
- net = (float)s->file->points / s->specs->pts;
- persons = getw(fp);
- n = fread((char *)log, sizeof(struct logs), NLOG, fp);
- for (lp = &log[n]; lp < &log[NLOG]; lp++)
- lp->l_name[0] = lp->l_uid = lp->l_shipnum
- = lp->l_gamenum = lp->l_netpoints = 0;
- rewind(fp);
- if (persons < 0)
- (void) putw(1, fp);
- else
- (void) putw(persons + 1, fp);
- for (lp = log; lp < &log[NLOG]; lp++)
- if (net > (float)lp->l_netpoints
- / scene[lp->l_gamenum].ship[lp->l_shipnum].specs->pts) {
- (void) fwrite((char *)log,
- sizeof (struct logs), lp - log, fp);
- (void) strcpy(log[NLOG-1].l_name, s->file->captain);
- log[NLOG-1].l_uid = getuid();
- log[NLOG-1].l_shipnum = s->file->index;
- log[NLOG-1].l_gamenum = game;
- log[NLOG-1].l_netpoints = s->file->points;
- (void) fwrite((char *)&log[NLOG-1],
- sizeof (struct logs), 1, fp);
- (void) fwrite((char *)lp,
- sizeof (struct logs), &log[NLOG-1] - lp, fp);
- break;
- }
-#ifdef LOCK_EX
- (void) flock(fileno(fp), LOCK_UN);
-#endif
- (void) fclose(fp);
-}
diff --git a/games/sail/parties.c b/games/sail/parties.c
deleted file mode 100644
index 5fe0538..0000000
--- a/games/sail/parties.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)parties.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-
-meleeing(from, to)
-struct ship *from;
-struct ship *to;
-{
- struct BP *p = from->file->OBP;
- struct BP *q = p + NBP;
-
- for (; p < q; p++)
- if (p->turnsent && p->toship == to)
- return 1;
- return 0;
-}
-
-boarding(from, isdefense)
-struct ship *from;
-char isdefense;
-{
- struct BP *p = isdefense ? from->file->DBP : from->file->OBP;
- struct BP *q = p + NBP;
-
- for (; p < q; p++)
- if (p->turnsent)
- return 1;
- return 0;
-}
-
-unboard(ship, to, isdefense)
-struct ship *ship, *to;
-char isdefense;
-{
- struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP;
- int n;
-
- for (n = 0; n < NBP; p++, n++)
- if (p->turnsent && (p->toship == to || isdefense || ship == to))
- Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
-}
diff --git a/games/sail/pathnames.h b/games/sail/pathnames.h
deleted file mode 100644
index 03a1dc7..0000000
--- a/games/sail/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_LOGFILE "/var/games/saillog"
diff --git a/games/sail/pl_1.c b/games/sail/pl_1.c
deleted file mode 100644
index ee12e7f..0000000
--- a/games/sail/pl_1.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_1.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-
-/*
- * If we get here before a ship is chosen, then ms == 0 and
- * we don't want to update the score file, or do any Write's either.
- * We can assume the sync file is already created and may need
- * to be removed.
- * Of course, we don't do any more Sync()'s if we got here
- * because of a Sync() failure.
- */
-leave(conditions)
-int conditions;
-{
- (void) signal(SIGHUP, SIG_IGN);
- (void) signal(SIGINT, SIG_IGN);
- (void) signal(SIGQUIT, SIG_IGN);
- (void) signal(SIGALRM, SIG_IGN);
- (void) signal(SIGCHLD, SIG_IGN);
-
- if (done_curses) {
- Signal("It looks like you've had it!",
- (struct ship *)0);
- switch (conditions) {
- case LEAVE_QUIT:
- break;
- case LEAVE_CAPTURED:
- Signal("Your ship was captured.",
- (struct ship *)0);
- break;
- case LEAVE_HURRICAN:
- Signal("Hurricane! All ships destroyed.",
- (struct ship *)0);
- break;
- case LEAVE_DRIVER:
- Signal("The driver died.", (struct ship *)0);
- break;
- case LEAVE_SYNC:
- Signal("Synchronization error.", (struct ship *)0);
- break;
- default:
- Signal("A funny thing happened (%d).",
- (struct ship *)0, conditions);
- }
- } else {
- switch (conditions) {
- case LEAVE_QUIT:
- break;
- case LEAVE_DRIVER:
- printf("The driver died.\n");
- break;
- case LEAVE_FORK:
- perror("fork");
- break;
- case LEAVE_SYNC:
- printf("Synchronization error\n.");
- break;
- default:
- printf("A funny thing happened (%d).\n",
- conditions);
- }
- }
-
- if (ms != 0) {
- log(ms);
- if (conditions != LEAVE_SYNC) {
- makesignal(ms, "Captain %s relinquishing.",
- (struct ship *)0, mf->captain);
- Write(W_END, ms, 0, 0, 0, 0, 0);
- (void) Sync();
- }
- }
- sync_close(!hasdriver);
- cleanupscreen();
- exit(0);
-}
-
-void
-choke()
-{
- leave(LEAVE_QUIT);
-}
-
-void
-child()
-{
- pid_t pid;
- int status;
-
- (void) signal(SIGCHLD, SIG_IGN);
- do {
- pid = wait3((int *)&status, WNOHANG, (struct rusage *)0);
- if (pid < 0 || pid > 0 && !WIFSTOPPED(status))
- hasdriver = 0;
- } while (pid > 0);
- (void) signal(SIGCHLD, child);
-}
diff --git a/games/sail/pl_2.c b/games/sail/pl_2.c
deleted file mode 100644
index 529b527..0000000
--- a/games/sail/pl_2.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-
-play()
-{
- struct ship *sp;
-
- for (;;) {
- switch (sgetch("~\b", (struct ship *)0, 0)) {
- case 'm':
- acceptmove();
- break;
- case 's':
- acceptsignal();
- break;
- case 'g':
- grapungrap();
- break;
- case 'u':
- unfoulplayer();
- break;
- case 'v':
- Signal("%s", (struct ship *)0, version);
- break;
- case 'b':
- acceptboard();
- break;
- case 'f':
- acceptcombat();
- break;
- case 'l':
- loadplayer();
- break;
- case 'c':
- changesail();
- break;
- case 'r':
- repair();
- break;
- case 'B':
- Signal("'Hands to stations!'", (struct ship *)0);
- unboard(ms, ms, 1); /* cancel DBP's */
- unboard(ms, ms, 0); /* cancel offense */
- break;
- case '\f':
- centerview();
- blockalarm();
- draw_board();
- draw_screen();
- unblockalarm();
- break;
- case 'L':
- mf->loadL = L_EMPTY;
- mf->loadR = L_EMPTY;
- mf->readyL = R_EMPTY;
- mf->readyR = R_EMPTY;
- Signal("Broadsides unloaded", (struct ship *)0);
- break;
- case 'q':
- Signal("Type 'Q' to quit", (struct ship *)0);
- break;
- case 'Q':
- leave(LEAVE_QUIT);
- break;
- case 'I':
- foreachship(sp)
- if (sp != ms)
- eyeball(sp);
- break;
- case 'i':
- if ((sp = closestenemy(ms, 0, 1)) == 0)
- Signal("No more ships left.");
- else
- eyeball(sp);
- break;
- case 'C':
- centerview();
- blockalarm();
- draw_view();
- unblockalarm();
- break;
- case 'U':
- upview();
- blockalarm();
- draw_view();
- unblockalarm();
- break;
- case 'D':
- case 'N':
- downview();
- blockalarm();
- draw_view();
- unblockalarm();
- break;
- case 'H':
- leftview();
- blockalarm();
- draw_view();
- unblockalarm();
- break;
- case 'J':
- rightview();
- blockalarm();
- draw_view();
- unblockalarm();
- break;
- case 'F':
- lookout();
- break;
- case 'S':
- dont_adjust = !dont_adjust;
- blockalarm();
- draw_turn();
- unblockalarm();
- break;
- }
- }
-}
diff --git a/games/sail/pl_3.c b/games/sail/pl_3.c
deleted file mode 100644
index 83486be..0000000
--- a/games/sail/pl_3.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-
-acceptcombat()
-{
- int men = 0;
- int target, temp;
- int n, r;
- int index, rakehim, sternrake;
- int hhits = 0, ghits = 0, rhits = 0, chits = 0;
- int crew[3];
- int load;
- int guns, car, ready, shootat, hit;
- int roll;
- struct ship *closest;
-
- crew[0] = mc->crew1;
- crew[1] = mc->crew2;
- crew[2] = mc->crew3;
- for (n = 0; n < 3; n++) {
- if (mf->OBP[n].turnsent)
- men += mf->OBP[n].mensent;
- }
- for (n = 0; n < 3; n++) {
- if (mf->DBP[n].turnsent)
- men += mf->DBP[n].mensent;
- }
- if (men) {
- crew[0] = men/100 ? 0 : crew[0] != 0;
- crew[1] = (men%100)/10 ? 0 : crew[1] != 0;
- crew[2] = men%10 ? 0 : crew[2] != 0;
- }
- for (r = 0; r < 2; r++) {
- if (r) {
- ready = mf->readyR;
- load = mf->loadR;
- guns = mc->gunR;
- car = mc->carR;
- } else {
- ready = mf->readyL;
- load = mf->loadL;
- guns = mc->gunL;
- car = mc->carL;
- }
- if (!guns && !car || load == L_EMPTY || (ready & R_LOADED) == 0)
- goto cant;
- if (mf->struck || !crew[2])
- goto cant;
- closest = closestenemy(ms, (r ? 'r' : 'l'), 1);
- if (closest == 0)
- goto cant;
- if (closest->file->struck)
- goto cant;
- target = range(ms, closest);
- if (target > rangeofshot[load] || !guns && target >= 3)
- goto cant;
- Signal("%s (%c%c) within range of %s broadside.",
- closest, r ? "right" : "left");
- if (load > L_CHAIN && target < 6) {
- switch (sgetch("Aim for hull or rigging? ",
- (struct ship *)0, 1)) {
- case 'r':
- shootat = RIGGING;
- break;
- case 'h':
- shootat = HULL;
- break;
- default:
- shootat = -1;
- Signal("'Avast there! Hold your fire.'",
- (struct ship *)0);
- }
- } else {
- if (sgetch("Fire? ", (struct ship *)0, 1) == 'n') {
- shootat = -1;
- Signal("Belay that! Hold your fire.",
- (struct ship *)0);
- } else
- shootat = RIGGING;
- }
- if (shootat == -1)
- continue;
- fired = 1;
- rakehim = gunsbear(ms, closest) && !gunsbear(closest, ms);
- temp = portside(closest, ms, 1) - closest->file->dir + 1;
- if (temp < 1)
- temp += 8;
- else if (temp > 8)
- temp -= 8;
- sternrake = temp > 4 && temp < 6;
- if (rakehim) {
- if (!sternrake)
- Signal("Raking the %s!", closest);
- else
- Signal("Stern Rake! %s splintering!", closest);
- }
- index = guns;
- if (target < 3)
- index += car;
- index = (index - 1)/3;
- index = index > 8 ? 8 : index;
- if (!rakehim)
- hit = HDT[index][target-1];
- else
- hit = HDTrake[index][target-1];
- if (rakehim && sternrake)
- hit++;
- hit += QUAL[index][mc->qual-1];
- for (n = 0; n < 3 && mf->captured == 0; n++)
- if (!crew[n]) {
- if (index <= 5)
- hit--;
- else
- hit -= 2;
- }
- if (ready & R_INITIAL) {
- if (index <= 3)
- hit++;
- else
- hit += 2;
- }
- if (mf->captured != 0) {
- if (index <= 1)
- hit--;
- else
- hit -= 2;
- }
- hit += AMMO[index][load - 1];
- if (((temp = mc->class) >= 5 || temp == 1) && windspeed == 5)
- hit--;
- if (windspeed == 6 && temp == 4)
- hit -= 2;
- if (windspeed == 6 && temp <= 3)
- hit--;
- if (hit >= 0) {
- roll = die();
- if (load == L_GRAPE)
- chits = hit;
- else {
- struct Tables *t;
- if (hit > 10)
- hit = 10;
- t = &(shootat == RIGGING ? RigTable : HullTable)
- [hit][roll-1];
- chits = t->C;
- rhits = t->R;
- hhits = t->H;
- ghits = t->G;
- if (closest->file->FS)
- rhits *= 2;
- if (load == L_CHAIN) {
- ghits = 0;
- hhits = 0;
- }
- }
- table(shootat, load, hit, closest, ms, roll);
- }
- Signal("Damage inflicted on the %s:",
- (struct ship *)0, closest->shipname);
- Signal("\t%d HULL, %d GUNS, %d CREW, %d RIGGING",
- (struct ship *)0, hhits, ghits, chits, rhits);
- if (!r) {
- mf->loadL = L_EMPTY;
- mf->readyL = R_EMPTY;
- } else {
- mf->loadR = L_EMPTY;
- mf->readyR = R_EMPTY;
- }
- continue;
- cant:
- Signal("Unable to fire %s broadside",
- (struct ship *)0, r ? "right" : "left");
- }
- blockalarm();
- draw_stat();
- unblockalarm();
-}
-
-grapungrap()
-{
- struct ship *sp;
- int i;
-
- foreachship(sp) {
- if (sp == ms || sp->file->dir == 0)
- continue;
- if (range(ms, sp) > 1 && !grappled2(ms, sp))
- continue;
- switch (sgetch("Attempt to grapple or ungrapple %s (%c%c): ",
- sp, 1)) {
- case 'g':
- if (die() < 3
- || ms->nationality == capship(sp)->nationality) {
- Write(W_GRAP, ms, 0, sp->file->index, 0, 0, 0);
- Write(W_GRAP, sp, 0, player, 0, 0, 0);
- Signal("Attempt succeeds!", (struct ship *)0);
- makesignal(ms, "grappled with %s (%c%c)", sp);
- } else
- Signal("Attempt fails.", (struct ship *)0);
- break;
- case 'u':
- for (i = grappled2(ms, sp); --i >= 0;) {
- if (ms->nationality
- == capship(sp)->nationality
- || die() < 3) {
- cleangrapple(ms, sp, 0);
- Signal("Attempt succeeds!",
- (struct ship *)0);
- makesignal(ms,
- "ungrappling with %s (%c%c)",
- sp);
- } else
- Signal("Attempt fails.",
- (struct ship *)0);
- }
- break;
- }
- }
-}
-
-unfoulplayer()
-{
- struct ship *to;
- int i;
-
- foreachship(to) {
- if (fouled2(ms, to) == 0)
- continue;
- if (sgetch("Attempt to unfoul with the %s (%c%c)? ", to, 1) != 'y')
- continue;
- for (i = fouled2(ms, to); --i >= 0;) {
- if (die() <= 2) {
- cleanfoul(ms, to, 0);
- Signal("Attempt succeeds!", (struct ship *)0);
- makesignal(ms, "Unfouling %s (%c%c)", to);
- } else
- Signal("Attempt fails.", (struct ship *)0);
- }
- }
-}
diff --git a/games/sail/pl_4.c b/games/sail/pl_4.c
deleted file mode 100644
index 6e78b44..0000000
--- a/games/sail/pl_4.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-
-changesail()
-{
- int rig, full;
-
- rig = mc->rig1;
- full = mf->FS;
- if (windspeed == 6 || windspeed == 5 && mc->class > 4)
- rig = 0;
- if (mc->crew3 && rig) {
- if (!full) {
- if (sgetch("Increase to Full sails? ",
- (struct ship *)0, 1) == 'y') {
- changed = 1;
- Write(W_FS, ms, 0, 1, 0, 0, 0);
- }
- } else {
- if (sgetch("Reduce to Battle sails? ",
- (struct ship *)0, 1) == 'y') {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
- changed = 1;
- }
- }
- } else if (!rig)
- Signal("Sails rent to pieces", (struct ship *)0);
-}
-
-acceptsignal()
-{
- char buf[60];
- char *p = buf;
-
- *p++ = '"';
- sgetstr("Message? ", p, sizeof buf - 2);
- while (*p++)
- ;
- p[-1] = '"';
- *p = 0;
- Write(W_SIGNAL, ms, 1, (long)buf, 0, 0, 0);
-}
-
-lookout()
-{
- struct ship *sp;
- char buf[3];
- char c;
-
- sgetstr("What ship? ", buf, sizeof buf);
- foreachship(sp) {
- c = *countryname[sp->nationality];
- if ((c == *buf || tolower(c) == *buf || colours(sp) == *buf)
- && (sp->file->stern == buf[1] || sterncolour(sp) == buf[1]
- || buf[1] == '?')) {
- eyeball(sp);
- }
- }
-}
-
-char *
-saywhat(sp, flag)
-struct ship *sp;
-char flag;
-{
- if (sp->file->captain[0])
- return sp->file->captain;
- else if (sp->file->struck)
- return "(struck)";
- else if (sp->file->captured != 0)
- return "(captured)";
- else if (flag)
- return "(available)";
- else
- return "(computer)";
-}
-
-eyeball(ship)
-struct ship *ship;
-{
- int i;
-
- if (ship->file->dir != 0) {
- Signal("Sail ho! (range %d, %s)",
- (struct ship *)0, range(ms, ship), saywhat(ship, 0));
- i = portside(ms, ship, 1) - mf->dir;
- if (i <= 0)
- i += 8;
- Signal("%s (%c%c) %s %s %s.",
- ship, countryname[ship->nationality],
- classname[ship->specs->class], directionname[i]);
- }
-}
diff --git a/games/sail/pl_5.c b/games/sail/pl_5.c
deleted file mode 100644
index 19876d1..0000000
--- a/games/sail/pl_5.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-#include "player.h"
-
-#define turnfirst(x) (*x == 'r' || *x == 'l')
-
-acceptmove()
-{
- int ta;
- int ma;
- char af;
- int moved = 0;
- int vma, dir;
- char prompt[60];
- char buf[60], last = '\0';
- char *p;
-
- if (!mc->crew3 || snagged(ms) || !windspeed) {
- Signal("Unable to move", (struct ship *)0);
- return;
- }
-
- ta = maxturns(ms, &af);
- ma = maxmove(ms, mf->dir, 0);
- (void) sprintf(prompt, "move (%d,%c%d): ", ma, af ? '\'' : ' ', ta);
- sgetstr(prompt, buf, sizeof buf);
- dir = mf->dir;
- vma = ma;
- for (p = buf; *p; p++)
- switch (*p) {
- case 'l':
- dir -= 2;
- case 'r':
- if (++dir == 0)
- dir = 8;
- else if (dir == 9)
- dir = 1;
- if (last == 't') {
- Signal("Ship can't turn that fast.",
- (struct ship *)0);
- *p-- = '\0';
- }
- last = 't';
- ma--;
- ta--;
- vma = min(ma, maxmove(ms, dir, 0));
- if (ta < 0 && moved || vma < 0 && moved)
- *p-- = '\0';
- break;
- case 'b':
- ma--;
- vma--;
- last = 'b';
- if (ta < 0 && moved || vma < 0 && moved)
- *p-- = '\0';
- break;
- case '0':
- case 'd':
- *p-- = '\0';
- break;
- case '\n':
- *p-- = '\0';
- break;
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- if (last == '0') {
- Signal("Can't move that fast.",
- (struct ship *)0);
- *p-- = '\0';
- }
- last = '0';
- moved = 1;
- ma -= *p - '0';
- vma -= *p - '0';
- if (ta < 0 && moved || vma < 0 && moved)
- *p-- = '\0';
- break;
- default:
- if (!isspace(*p)) {
- Signal("Input error.", (struct ship *)0);
- *p-- = '\0';
- }
- }
- if (ta < 0 && moved || vma < 0 && moved
- || af && turnfirst(buf) && moved) {
- Signal("Movement error.", (struct ship *)0);
- if (ta < 0 && moved) {
- if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
- Signal("No hands to set full sails.",
- (struct ship *)0);
- }
- } else if (ma >= 0)
- buf[1] = '\0';
- }
- if (af && !moved) {
- if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
- Signal("No hands to set full sails.",
- (struct ship *)0);
- }
- }
- if (*buf)
- (void) strcpy(movebuf, buf);
- else
- (void) strcpy(movebuf, "d");
- Write(W_MOVE, ms, 1, (int)movebuf, 0, 0, 0);
- Signal("Helm: %s.", (struct ship *)0, movebuf);
-}
-
-acceptboard()
-{
- struct ship *sp;
- int n;
- int crew[3];
- int men = 0;
- char c;
-
- crew[0] = mc->crew1;
- crew[1] = mc->crew2;
- crew[2] = mc->crew3;
- for (n = 0; n < NBP; n++) {
- if (mf->OBP[n].turnsent)
- men += mf->OBP[n].mensent;
- }
- for (n = 0; n < NBP; n++) {
- if (mf->DBP[n].turnsent)
- men += mf->DBP[n].mensent;
- }
- if (men) {
- crew[0] = men/100 ? 0 : crew[0] != 0;
- crew[1] = (men%100)/10 ? 0 : crew[1] != 0;
- crew[2] = men%10 ? 0 : crew[2] != 0;
- } else {
- crew[0] = crew[0] != 0;
- crew[1] = crew[1] != 0;
- crew[2] = crew[2] != 0;
- }
- foreachship(sp) {
- if (sp == ms || sp->file->dir == 0 || range(ms, sp) > 1)
- continue;
- if (ms->nationality == capship(sp)->nationality)
- continue;
- if (meleeing(ms, sp) && crew[2]) {
- c = sgetch("How many more to board the %s (%c%c)? ",
- sp, 1);
- parties(crew, sp, 0, c);
- } else if ((fouled2(ms, sp) || grappled2(ms, sp)) && crew[2]) {
- c = sgetch("Crew sections to board the %s (%c%c) (3 max) ?", sp, 1);
- parties(crew, sp, 0, c);
- }
- }
- if (crew[2]) {
- c = sgetch("How many sections to repel boarders? ",
- (struct ship *)0, 1);
- parties(crew, ms, 1, c);
- }
- blockalarm();
- draw_slot();
- unblockalarm();
-}
-
-parties(crew, to, isdefense, buf)
-struct ship *to;
-int crew[3];
-char isdefense;
-char buf;
-{
- int k, j, men;
- struct BP *ptr;
- int temp[3];
-
- for (k = 0; k < 3; k++)
- temp[k] = crew[k];
- if (isdigit(buf)) {
- ptr = isdefense ? to->file->DBP : to->file->OBP;
- for (j = 0; j < NBP && ptr[j].turnsent; j++)
- ;
- if (!ptr[j].turnsent && buf > '0') {
- men = 0;
- for (k = 0; k < 3 && buf > '0'; k++) {
- men += crew[k]
- * (k == 0 ? 100 : (k == 1 ? 10 : 1));
- crew[k] = 0;
- if (men)
- buf--;
- }
- if (buf > '0')
- Signal("Sending all crew sections.",
- (struct ship *)0);
- Write(isdefense ? W_DBP : W_OBP, ms, 0,
- j, turn, to->file->index, men);
- if (isdefense) {
- (void) wmove(slot_w, 2, 0);
- for (k=0; k < NBP; k++)
- if (temp[k] && !crew[k])
- (void) waddch(slot_w, k + '1');
- else
- (void) wmove(slot_w, 2, 1 + k);
- (void) mvwaddstr(slot_w, 3, 0, "DBP");
- makesignal(ms, "repelling boarders",
- (struct ship *)0);
- } else {
- (void) wmove(slot_w, 0, 0);
- for (k=0; k < NBP; k++)
- if (temp[k] && !crew[k])
- (void) waddch(slot_w, k + '1');
- else
- (void) wmove(slot_w, 0, 1 + k);
- (void) mvwaddstr(slot_w, 1, 0, "OBP");
- makesignal(ms, "boarding the %s (%c%c)", to);
- }
- blockalarm();
- (void) wrefresh(slot_w);
- unblockalarm();
- } else
- Signal("Sending no crew sections.", (struct ship *)0);
- }
-}
diff --git a/games/sail/pl_6.c b/games/sail/pl_6.c
deleted file mode 100644
index b91589f..0000000
--- a/games/sail/pl_6.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-
-repair()
-{
- char c;
- char *repairs;
- struct shipspecs *ptr = mc;
- int count;
-
-#define FIX(x, m) (m - ptr->x > count \
- ? (ptr->x += count, count = 0) : (count -= m - ptr->x, ptr->x = m))
-
- if (repaired || loaded || fired || changed || turned()) {
- Signal("No hands free to repair", (struct ship *)0);
- return;
- }
- c = sgetch("Repair (hull, guns, rigging)? ", (struct ship *)0, 1);
- switch (c) {
- case 'h':
- repairs = &mf->RH;
- break;
- case 'g':
- repairs = &mf->RG;
- break;
- case 'r':
- repairs = &mf->RR;
- break;
- default:
- Signal("Avast heaving!", (struct ship *)0);
- return;
- }
- if (++*repairs >= 3) {
- count = 2;
- switch (c) {
- case 'h': {
- int max = ptr->guns/4;
- if (ptr->hull < max) {
- FIX(hull, max);
- Write(W_HULL, ms, 0, ptr->hull, 0, 0, 0);
- }
- break;
- }
- case 'g':
- if (ptr->gunL < ptr->gunR) {
- int max = ptr->guns/5 - ptr->carL;
- if (ptr->gunL < max) {
- FIX(gunL, max);
- Write(W_GUNL, ms, 0, ptr->gunL,
- ptr->carL, 0, 0);
- }
- } else {
- int max = ptr->guns/5 - ptr->carR;
- if (ptr->gunR < max) {
- FIX(gunR, max);
- Write(W_GUNR, ms, 0, ptr->gunR,
- ptr->carR, 0, 0);
- }
- }
- break;
- case 'r':
-#define X 2
- if (ptr->rig4 >= 0 && ptr->rig4 < X) {
- FIX(rig4, X);
- Write(W_RIG4, ms, 0, ptr->rig4, 0, 0, 0);
- }
- if (count && ptr->rig3 < X) {
- FIX(rig3, X);
- Write(W_RIG3, ms, 0, ptr->rig3, 0, 0, 0);
- }
- if (count && ptr->rig2 < X) {
- FIX(rig2, X);
- Write(W_RIG2, ms, 0, ptr->rig2, 0, 0, 0);
- }
- if (count && ptr->rig1 < X) {
- FIX(rig1, X);
- Write(W_RIG1, ms, 0, ptr->rig1, 0, 0, 0);
- }
- break;
- }
- if (count == 2) {
- Signal("Repairs completed.", (struct ship *)0);
- *repairs = 2;
- } else {
- *repairs = 0;
- blockalarm();
- draw_stat();
- unblockalarm();
- }
- }
- blockalarm();
- draw_slot();
- unblockalarm();
- repaired = 1;
-}
-
-turned()
-{
- char *p;
-
- for (p = movebuf; *p; p++)
- if (*p == 'r' || *p == 'l')
- return 1;
- return 0;
-}
-
-loadplayer()
-{
- char c;
- int loadL, loadR, ready, load;
-
- if (!mc->crew3) {
- Signal("Out of crew", (struct ship *)0);
- return;
- }
- loadL = mf->loadL;
- loadR = mf->loadR;
- if (!loadL && !loadR) {
- c = sgetch("Load which broadside (left or right)? ",
- (struct ship *)0, 1);
- if (c == 'r')
- loadL = 1;
- else
- loadR = 1;
- }
- if (!loadL && loadR || loadL && !loadR) {
- c = sgetch("Reload with (round, double, chain, grape)? ",
- (struct ship *)0, 1);
- switch (c) {
- case 'r':
- load = L_ROUND;
- ready = 0;
- break;
- case 'd':
- load = L_DOUBLE;
- ready = R_DOUBLE;
- break;
- case 'c':
- load = L_CHAIN;
- ready = 0;
- break;
- case 'g':
- load = L_GRAPE;
- ready = 0;
- break;
- default:
- Signal("Broadside not loaded.",
- (struct ship *)0);
- return;
- }
- if (!loadR) {
- mf->loadR = load;
- mf->readyR = ready|R_LOADING;
- } else {
- mf->loadL = load;
- mf->readyL = ready|R_LOADING;
- }
- loaded = 1;
- }
-}
diff --git a/games/sail/pl_7.c b/games/sail/pl_7.c
deleted file mode 100644
index 02cd5f2..0000000
--- a/games/sail/pl_7.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/ttydefaults.h>
-#include <string.h>
-#include "player.h"
-
-
-/*
- * Display interface
- */
-
-static char sc_hasprompt;
-static char *sc_prompt;
-static char *sc_buf;
-static int sc_line;
-
-initscreen()
-{
- /* initscr() already done in SCREENTEST() */
- view_w = newwin(VIEW_Y, VIEW_X, VIEW_T, VIEW_L);
- slot_w = newwin(SLOT_Y, SLOT_X, SLOT_T, SLOT_L);
- scroll_w = newwin(SCROLL_Y, SCROLL_X, SCROLL_T, SCROLL_L);
- stat_w = newwin(STAT_Y, STAT_X, STAT_T, STAT_L);
- turn_w = newwin(TURN_Y, TURN_X, TURN_T, TURN_L);
- done_curses++;
- (void) leaveok(view_w, 1);
- (void) leaveok(slot_w, 1);
- (void) leaveok(stat_w, 1);
- (void) leaveok(turn_w, 1);
- noecho();
- crmode();
-}
-
-cleanupscreen()
-{
- /* alarm already turned off */
- if (done_curses) {
- (void) wmove(scroll_w, SCROLL_Y - 1, 0);
- (void) wclrtoeol(scroll_w);
- draw_screen();
- endwin();
- }
-}
-
-void
-newturn()
-{
- repaired = loaded = fired = changed = 0;
- movebuf[0] = '\0';
-
- (void) alarm(0);
- if (mf->readyL & R_LOADING) {
- if (mf->readyL & R_DOUBLE)
- mf->readyL = R_LOADING;
- else
- mf->readyL = R_LOADED;
- }
- if (mf->readyR & R_LOADING) {
- if (mf->readyR & R_DOUBLE)
- mf->readyR = R_LOADING;
- else
- mf->readyR = R_LOADED;
- }
- if (!hasdriver)
- Write(W_DDEAD, SHIP(0), 0, 0, 0, 0, 0);
-
- if (sc_hasprompt) {
- (void) wmove(scroll_w, sc_line, 0);
- (void) wclrtoeol(scroll_w);
- }
- if (Sync() < 0)
- leave(LEAVE_SYNC);
- if (!hasdriver)
- leave(LEAVE_DRIVER);
- if (sc_hasprompt)
- (void) wprintw(scroll_w, "%s%s", sc_prompt, sc_buf);
-
- if (turn % 50 == 0)
- Write(W_ALIVE, SHIP(0), 0, 0, 0, 0, 0);
- if (mf->FS && (!mc->rig1 || windspeed == 6))
- Write(W_FS, ms, 0, 0, 0, 0, 0);
- if (mf->FS == 1)
- Write(W_FS, ms, 0, 2, 0, 0, 0);
-
- if (mf->struck)
- leave(LEAVE_QUIT);
- if (mf->captured != 0)
- leave(LEAVE_CAPTURED);
- if (windspeed == 7)
- leave(LEAVE_HURRICAN);
-
- adjustview();
- draw_screen();
-
- (void) signal(SIGALRM, newturn);
- (void) alarm(7);
-}
-
-/*VARARGS2*/
-Signal(fmt, ship, a, b, c, d)
-char *fmt;
-struct ship *ship;
-int a, b, c, d;
-{
- if (!done_curses)
- return;
- if (*fmt == '\7')
- putchar(*fmt++);
- if (ship == 0)
- (void) wprintw(scroll_w, fmt, a, b, c, d);
- else
- (void) wprintw(scroll_w, fmt, ship->shipname,
- colours(ship), sterncolour(ship), a, b, c, d);
- Scroll();
-}
-
-Scroll()
-{
- if (++sc_line >= SCROLL_Y)
- sc_line = 0;
- (void) wmove(scroll_w, sc_line, 0);
- (void) wclrtoeol(scroll_w);
-}
-
-prompt(p, ship)
-char *p;
-struct ship *ship;
-{
- static char buf[60];
-
- if (ship != 0) {
- (void)sprintf(buf, p, ship->shipname, colours(ship),
- sterncolour(ship));
- p = buf;
- }
- sc_prompt = p;
- sc_buf = "";
- sc_hasprompt = 1;
- (void) waddstr(scroll_w, p);
-}
-
-endprompt(flag)
-char flag;
-{
- sc_hasprompt = 0;
- if (flag)
- Scroll();
-}
-
-sgetch(p, ship, flag)
-char *p;
-struct ship *ship;
-char flag;
-{
- int c;
-
- prompt(p, ship);
- blockalarm();
- (void) wrefresh(scroll_w);
- unblockalarm();
- while ((c = wgetch(scroll_w)) == EOF)
- ;
- if (flag && c >= ' ' && c < 0x7f)
- (void) waddch(scroll_w, c);
- endprompt(flag);
- return c;
-}
-
-sgetstr(pr, buf, n)
-char *pr;
-char *buf;
-int n;
-{
- int c;
- char *p = buf;
-
- prompt(pr, (struct ship *)0);
- sc_buf = buf;
- for (;;) {
- *p = 0;
- blockalarm();
- (void) wrefresh(scroll_w);
- unblockalarm();
- while ((c = wgetch(scroll_w)) == EOF)
- ;
- switch (c) {
- case '\n':
- case '\r':
- endprompt(1);
- return;
- case '\b':
- if (p > buf) {
- (void) waddstr(scroll_w, "\b \b");
- p--;
- }
- break;
- default:
- if (c >= ' ' && c < 0x7f && p < buf + n - 1) {
- *p++ = c;
- (void) waddch(scroll_w, c);
- } else
- (void) putchar(CTRL('g'));
- }
- }
-}
-
-draw_screen()
-{
- draw_view();
- draw_turn();
- draw_stat();
- draw_slot();
- (void) wrefresh(scroll_w); /* move the cursor */
-}
-
-draw_view()
-{
- struct ship *sp;
-
- (void) werase(view_w);
- foreachship(sp) {
- if (sp->file->dir
- && sp->file->row > viewrow
- && sp->file->row < viewrow + VIEW_Y
- && sp->file->col > viewcol
- && sp->file->col < viewcol + VIEW_X) {
- (void) wmove(view_w, sp->file->row - viewrow,
- sp->file->col - viewcol);
- (void) waddch(view_w, colours(sp));
- (void) wmove(view_w,
- sternrow(sp) - viewrow,
- sterncol(sp) - viewcol);
- (void) waddch(view_w, sterncolour(sp));
- }
- }
- (void) wrefresh(view_w);
-}
-
-draw_turn()
-{
- (void) wmove(turn_w, 0, 0);
- (void) wprintw(turn_w, "%cTurn %d", dont_adjust?'*':'-', turn);
- (void) wrefresh(turn_w);
-}
-
-draw_stat()
-{
- (void) wmove(stat_w, STAT_1, 0);
- (void) wprintw(stat_w, "Points %3d\n", mf->points);
- (void) wprintw(stat_w, "Fouls %2d\n", fouled(ms));
- (void) wprintw(stat_w, "Grapples %2d\n", grappled(ms));
-
- (void) wmove(stat_w, STAT_2, 0);
- (void) wprintw(stat_w, " 0 %c(%c)\n",
- maxmove(ms, winddir + 3, -1) + '0',
- maxmove(ms, winddir + 3, 1) + '0');
- (void) waddstr(stat_w, " \\|/\n");
- (void) wprintw(stat_w, " -^-%c(%c)\n",
- maxmove(ms, winddir + 2, -1) + '0',
- maxmove(ms, winddir + 2, 1) + '0');
- (void) waddstr(stat_w, " /|\\\n");
- (void) wprintw(stat_w, " | %c(%c)\n",
- maxmove(ms, winddir + 1, -1) + '0',
- maxmove(ms, winddir + 1, 1) + '0');
- (void) wprintw(stat_w, " %c(%c)\n",
- maxmove(ms, winddir, -1) + '0',
- maxmove(ms, winddir, 1) + '0');
-
- (void) wmove(stat_w, STAT_3, 0);
- (void) wprintw(stat_w, "Load %c%c %c%c\n",
- loadname[mf->loadL], readyname(mf->readyL),
- loadname[mf->loadR], readyname(mf->readyR));
- (void) wprintw(stat_w, "Hull %2d\n", mc->hull);
- (void) wprintw(stat_w, "Crew %2d %2d %2d\n",
- mc->crew1, mc->crew2, mc->crew3);
- (void) wprintw(stat_w, "Guns %2d %2d\n", mc->gunL, mc->gunR);
- (void) wprintw(stat_w, "Carr %2d %2d\n", mc->carL, mc->carR);
- (void) wprintw(stat_w, "Rigg %d %d %d ", mc->rig1, mc->rig2, mc->rig3);
- if (mc->rig4 < 0)
- (void) waddch(stat_w, '-');
- else
- (void) wprintw(stat_w, "%d", mc->rig4);
- (void) wrefresh(stat_w);
-}
-
-draw_slot()
-{
- if (!boarding(ms, 0)) {
- (void) mvwaddstr(slot_w, 0, 0, " ");
- (void) mvwaddstr(slot_w, 1, 0, " ");
- } else
- (void) mvwaddstr(slot_w, 1, 0, "OBP");
- if (!boarding(ms, 1)) {
- (void) mvwaddstr(slot_w, 2, 0, " ");
- (void) mvwaddstr(slot_w, 3, 0, " ");
- } else
- (void) mvwaddstr(slot_w, 3, 0, "DBP");
-
- (void) wmove(slot_w, SLOT_Y-4, 0);
- if (mf->RH)
- (void) wprintw(slot_w, "%dRH", mf->RH);
- else
- (void) waddstr(slot_w, " ");
- (void) wmove(slot_w, SLOT_Y-3, 0);
- if (mf->RG)
- (void) wprintw(slot_w, "%dRG", mf->RG);
- else
- (void) waddstr(slot_w, " ");
- (void) wmove(slot_w, SLOT_Y-2, 0);
- if (mf->RR)
- (void) wprintw(slot_w, "%dRR", mf->RR);
- else
- (void) waddstr(slot_w, " ");
-
-#define Y (SLOT_Y/2)
- (void) wmove(slot_w, 7, 1);
- (void) wprintw(slot_w,"%d", windspeed);
- (void) mvwaddch(slot_w, Y, 0, ' ');
- (void) mvwaddch(slot_w, Y, 2, ' ');
- (void) mvwaddch(slot_w, Y-1, 0, ' ');
- (void) mvwaddch(slot_w, Y-1, 1, ' ');
- (void) mvwaddch(slot_w, Y-1, 2, ' ');
- (void) mvwaddch(slot_w, Y+1, 0, ' ');
- (void) mvwaddch(slot_w, Y+1, 1, ' ');
- (void) mvwaddch(slot_w, Y+1, 2, ' ');
- (void) wmove(slot_w, Y - dr[winddir], 1 - dc[winddir]);
- switch (winddir) {
- case 1:
- case 5:
- (void) waddch(slot_w, '|');
- break;
- case 2:
- case 6:
- (void) waddch(slot_w, '/');
- break;
- case 3:
- case 7:
- (void) waddch(slot_w, '-');
- break;
- case 4:
- case 8:
- (void) waddch(slot_w, '\\');
- break;
- }
- (void) mvwaddch(slot_w, Y + dr[winddir], 1 + dc[winddir], '+');
- (void) wrefresh(slot_w);
-}
-
-draw_board()
-{
- int n;
-
- (void) clear();
- (void) werase(view_w);
- (void) werase(slot_w);
- (void) werase(scroll_w);
- (void) werase(stat_w);
- (void) werase(turn_w);
-
- sc_line = 0;
-
- (void) move(BOX_T, BOX_L);
- for (n = 0; n < BOX_X; n++)
- (void) addch('-');
- (void) move(BOX_B, BOX_L);
- for (n = 0; n < BOX_X; n++)
- (void) addch('-');
- for (n = BOX_T+1; n < BOX_B; n++) {
- (void) mvaddch(n, BOX_L, '|');
- (void) mvaddch(n, BOX_R, '|');
- }
- (void) mvaddch(BOX_T, BOX_L, '+');
- (void) mvaddch(BOX_T, BOX_R, '+');
- (void) mvaddch(BOX_B, BOX_L, '+');
- (void) mvaddch(BOX_B, BOX_R, '+');
- (void) refresh();
-
-#define WSaIM "Wooden Ships & Iron Men"
- (void) wmove(view_w, 2, (VIEW_X - sizeof WSaIM - 1) / 2);
- (void) waddstr(view_w, WSaIM);
- (void) wmove(view_w, 4, (VIEW_X - strlen(cc->name)) / 2);
- (void) waddstr(view_w, cc->name);
- (void) wrefresh(view_w);
-
- (void) move(LINE_T, LINE_L);
- (void) printw("Class %d %s (%d guns) '%s' (%c%c)",
- mc->class,
- classname[mc->class],
- mc->guns,
- ms->shipname,
- colours(ms),
- sterncolour(ms));
- (void) refresh();
-}
-
-centerview()
-{
- viewrow = mf->row - VIEW_Y / 2;
- viewcol = mf->col - VIEW_X / 2;
-}
-
-upview()
-{
- viewrow -= VIEW_Y / 3;
-}
-
-downview()
-{
- viewrow += VIEW_Y / 3;
-}
-
-leftview()
-{
- viewcol -= VIEW_X / 5;
-}
-
-rightview()
-{
- viewcol += VIEW_X / 5;
-}
-
-adjustview()
-{
- if (dont_adjust)
- return;
- if (mf->row < viewrow + VIEW_Y/4)
- viewrow = mf->row - (VIEW_Y - VIEW_Y/4);
- else if (mf->row > viewrow + (VIEW_Y - VIEW_Y/4))
- viewrow = mf->row - VIEW_Y/4;
- if (mf->col < viewcol + VIEW_X/8)
- viewcol = mf->col - (VIEW_X - VIEW_X/8);
- else if (mf->col > viewcol + (VIEW_X - VIEW_X/8))
- viewcol = mf->col - VIEW_X/8;
-}
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
deleted file mode 100644
index fe7ba0e..0000000
--- a/games/sail/pl_main.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "player.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-
-void choke(), child();
-
-/*ARGSUSED*/
-pl_main()
-{
-
- if (!SCREENTEST()) {
- printf("Can't sail on this terminal.\n");
- exit(1);
- }
- initialize();
- Signal("Aye aye, Sir", (struct ship *)0);
- play();
- return 0; /* for lint, play() never returns */
-}
-
-initialize()
-{
- struct File *fp;
- struct ship *sp;
- char captain[80];
- char message[60];
- int load;
- int n;
- char *nameptr;
- int nat[NNATION];
-
- if (game < 0) {
- (void) puts("Choose a scenario:\n");
- (void) puts("\n\tNUMBER\tSHIPS\tIN PLAY\tTITLE");
- for (n = 0; n < NSCENE; n++) {
- /* ( */
- printf("\t%d):\t%d\t%s\t%s\n", n, scene[n].vessels,
- sync_exists(n) ? "YES" : "no",
- scene[n].name);
- }
-reprint:
- printf("\nScenario number? ");
- (void) fflush(stdout);
- (void) scanf("%d", &game);
- while (getchar() != '\n')
- ;
- }
- if (game < 0 || game >= NSCENE) {
- (void) puts("Very funny.");
- exit(1);
- }
- cc = &scene[game];
- ls = SHIP(cc->vessels);
-
- for (n = 0; n < NNATION; n++)
- nat[n] = 0;
- foreachship(sp) {
- if (sp->file == NULL &&
- (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL) {
- (void) puts("OUT OF MEMORY");
- exit(1);
- }
- sp->file->index = sp - SHIP(0);
- sp->file->stern = nat[sp->nationality]++;
- sp->file->dir = sp->shipdir;
- sp->file->row = sp->shiprow;
- sp->file->col = sp->shipcol;
- }
- windspeed = cc->windspeed;
- winddir = cc->winddir;
-
- (void) signal(SIGHUP, choke);
- (void) signal(SIGINT, choke);
-
- hasdriver = sync_exists(game);
- if (sync_open() < 0) {
- perror("sail: syncfile");
- exit(1);
- }
-
- if (hasdriver) {
- (void) puts("Synchronizing with the other players...");
- (void) fflush(stdout);
- if (Sync() < 0)
- leave(LEAVE_SYNC);
- }
- for (;;) {
- foreachship(sp)
- if (sp->file->captain[0] == 0 && !sp->file->struck
- && sp->file->captured == 0)
- break;
- if (sp >= ls) {
- (void) puts("All ships taken in that scenario.");
- foreachship(sp)
- free((char *)sp->file);
- sync_close(0);
- people = 0;
- goto reprint;
- }
- if (randomize) {
- player = sp - SHIP(0);
- } else {
- printf("%s\n\n", cc->name);
- foreachship(sp)
- printf(" %2d: %-10s %-15s (%-2d pts) %s\n",
- sp->file->index,
- countryname[sp->nationality],
- sp->shipname,
- sp->specs->pts,
- saywhat(sp, 1));
- printf("\nWhich ship (0-%d)? ", cc->vessels-1);
- (void) fflush(stdout);
- if (scanf("%d", &player) != 1 || player < 0
- || player >= cc->vessels) {
- while (getchar() != '\n')
- ;
- (void) puts("Say what?");
- player = -1;
- } else
- while (getchar() != '\n')
- ;
- }
- if (player < 0)
- continue;
- if (Sync() < 0)
- leave(LEAVE_SYNC);
- fp = SHIP(player)->file;
- if (fp->captain[0] || fp->struck || fp->captured != 0)
- (void) puts("That ship is taken.");
- else
- break;
- }
-
- ms = SHIP(player);
- mf = ms->file;
- mc = ms->specs;
-
- Write(W_BEGIN, ms, 0, 0, 0, 0, 0);
- if (Sync() < 0)
- leave(LEAVE_SYNC);
-
- (void) signal(SIGCHLD, child);
- if (!hasdriver)
- switch (fork()) {
- case 0:
- longjmp(restart, MODE_DRIVER);
- /*NOTREACHED*/
- case -1:
- perror("fork");
- leave(LEAVE_FORK);
- break;
- default:
- hasdriver++;
- }
-
- printf("Your ship is the %s, a %d gun %s (%s crew).\n",
- ms->shipname, mc->guns, classname[mc->class],
- qualname[mc->qual]);
- if ((nameptr = (char *) getenv("SAILNAME")) && *nameptr)
- (void) strncpy(captain, nameptr, sizeof captain);
- else {
- (void) printf("Your name, Captain? ");
- (void) fflush(stdout);
- (void) fgets(captain, sizeof captain, stdin);
- if (!*captain)
- (void) strcpy(captain, "no name");
- else
- captain[sizeof(captain) - 1] = '\0';
- }
- Write(W_CAPTAIN, ms, 1, (long)captain, 0, 0, 0);
- for (n = 0; n < 2; n++) {
- char buf[10];
-
- printf("\nInitial broadside %s (grape, chain, round, double): ",
- n ? "right" : "left");
- (void) fflush(stdout);
- (void) scanf("%9s", buf);
- switch (*buf) {
- case 'g':
- load = L_GRAPE;
- break;
- case 'c':
- load = L_CHAIN;
- break;
- case 'r':
- load = L_ROUND;
- break;
- case 'd':
- load = L_DOUBLE;
- break;
- default:
- load = L_ROUND;
- }
- if (n) {
- mf->loadR = load;
- mf->readyR = R_LOADED|R_INITIAL;
- } else {
- mf->loadL = load;
- mf->readyL = R_LOADED|R_INITIAL;
- }
- }
-
- initscreen();
- draw_board();
- (void) sprintf(message, "Captain %s assuming command", captain);
- Write(W_SIGNAL, ms, 1, (long)message, 0, 0, 0);
- newturn();
-}
diff --git a/games/sail/player.h b/games/sail/player.h
deleted file mode 100644
index 76c91ab..0000000
--- a/games/sail/player.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)player.h 8.1 (Berkeley) 5/31/93
- * $FreeBSD$
- */
-
-#include <curses.h>
-#include "externs.h"
-
-/* sizes and coordinates for the screen */
-
-#define LINE_T 0
-#define LINE_L 0
-#define LINE_X COLS
-#define LINE_Y 1
-#define LINE_B (LINE_T+LINE_Y-1)
-#define LINE_R (LINE_L+LINE_X-1)
-
-#define BOX_T 1
-#define BOX_L 0
-#define BOX_X 65
-#define BOX_Y 16
-#define BOX_B (BOX_T+BOX_Y-1)
-#define BOX_R (BOX_L+BOX_X-1)
-
-#define TURN_T BOX_B
-#define TURN_Y 1
-#define TURN_L ((BOX_L+BOX_R-TURN_X)/2)
-#define TURN_X 9
-#define TURN_B (TURN_T+TURN_Y+1)
-#define TURN_R (TURN_L+TURN_X+1)
-
-#define STAT_T 0
-#define STAT_B BOX_B
-#define STAT_L (BOX_R+2)
-#define STAT_X 14
-#define STAT_Y (STAT_B-STAT_T+1)
-#define STAT_R (STAT_L+STAT_X-1)
-#define STAT_1 0
-#define STAT_2 (STAT_1+4)
-#define STAT_3 (STAT_2+7)
-
-#define SCROLL_T (BOX_B+1)
-#define SCROLL_L 0
-#define SCROLL_B (LINES-1)
-#define SCROLL_R (COLS-1)
-#define SCROLL_X (SCROLL_R-SCROLL_L+1)
-#define SCROLL_Y (SCROLL_B-SCROLL_T+1)
-
-#define VIEW_T (BOX_T+1)
-#define VIEW_L (BOX_L+1)
-#define VIEW_X (BOX_X-5)
-#define VIEW_Y (BOX_Y-2)
-#define VIEW_B (VIEW_T+VIEW_Y-1)
-#define VIEW_R (VIEW_L+VIEW_X-1)
-
-#define SLOT_T VIEW_T
-#define SLOT_L (VIEW_R+1)
-#define SLOT_X 3
-#define SLOT_Y VIEW_Y
-#define SLOT_B VIEW_B
-#define SLOT_R (SLOT_L+SLOT_X-1)
-
-#ifdef SIGTSTP
-#define SCREENTEST() (initscr() != NULL && signal(SIGTSTP, SIG_DFL) != BADSIG && STAT_R < COLS && SCROLL_Y > 0)
-#else
-#define SCREENTEST() (initscr() != NULL && STAT_R < COLS && SCROLL_Y > 0)
-#endif
-
-WINDOW *view_w;
-WINDOW *slot_w;
-WINDOW *scroll_w;
-WINDOW *stat_w;
-WINDOW *turn_w;
-
-char done_curses;
-char loaded, fired, changed, repaired;
-char dont_adjust;
-int viewrow, viewcol;
-char movebuf[sizeof SHIP(0)->file->movebuf];
-extern char version[];
-int player;
-struct ship *ms; /* memorial structure, &cc->ship[player] */
-struct File *mf; /* ms->file */
-struct shipspecs *mc; /* ms->specs */
-
-/* condition codes for leave() */
-#define LEAVE_QUIT 0
-#define LEAVE_CAPTURED 1
-#define LEAVE_HURRICAN 2
-#define LEAVE_DRIVER 3
-#define LEAVE_FORK 4
-#define LEAVE_SYNC 5
diff --git a/games/sail/sail.6 b/games/sail/sail.6
deleted file mode 100644
index 14e71de..0000000
--- a/games/sail/sail.6
+++ /dev/null
@@ -1,897 +0,0 @@
-.\" Copyright (c) 1988, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)sail.6 8.2 (Berkeley) 12/30/93
-.\" $FreeBSD$
-.\"
-.TH SAIL 6 "December 30, 1993"
-.UC 4
-.SH NAME
-sail \- multi-user wooden ships and iron men
-.SH SYNOPSIS
-.B sail
-[
-.B \-s
-[
-.B \-l
-] ] [
-.B \-x
-] [
-.B \-b
-] [
-.B num
-]
-.br
-.fi
-.SH DESCRIPTION
-.I Sail
-is a computer version of Avalon Hill's game of fighting sail
-originally developed by S. Craig Taylor.
-.PP
-Players of
-.I Sail
-take command of an old fashioned Man of War and fight other
-players or the computer. They may re-enact one of the many
-historical sea battles recorded in the game, or they can choose
-a fictional battle.
-.PP
-As a sea captain in the
-.I Sail
-Navy, the player has complete control over the workings of his ship.
-He must order every maneuver, change the set of his sails, and judge the
-right moment to let loose the terrible destruction of his broadsides.
-In addition to fighting the enemy, he must harness the powers of the wind
-and sea to make them work for him. The outcome of many battles during the
-age of sail was decided by the ability of one captain to hold the `weather
-gage.'
-.PP
-The flags are:
-.TP
-.B \-s
-Print the names and ships of the top ten sailors.
-.TP
-.B \-l
-Show the login name. Only effective with \fB-s\fP.
-.TP
-.B \-x
-Play the first available ship instead of prompting for a choice.
-.TP
-.B \-b
-No bells.
-.SH IMPLEMENTATION
-.I Sail
-is really two programs in one. Each player starts up a process which
-runs his own ship. In addition, a
-.I driver
-process is forked (by the first player) to run the computer ships
-and take care of global bookkeeping.
-.PP
-Because the
-.I driver
-must calculate moves for each ship it controls, the
-more ships the computer is playing, the slower the game will appear.
-.PP
-If a player joins a game in progress, he will synchronize
-with the other players (a rather slow process for everyone), and
-then he may play along with the rest.
-.PP
-To implement a multi-user game in Version 7 UNIX, which was the operating
-system
-.I Sail
-was first written under, the communicating processes must use a common
-temporary file as a place to read and write messages. In addition, a
-locking mechanism must be provided to ensure exclusive access to the
-shared file. For example,
-.I Sail
-uses a temporary file named /tmp/#sailsink.21 for scenario 21, and
-corresponding file names for the other scenarios. To provide exclusive
-access to the temporary file,
-.I Sail
-uses a technique stolen from an old game called "pubcaves" by Jeff Cohen.
-Processes do a busy wait in the loop
-.br
-.sp
-.ce 2
- for (n = 0; link(sync_file, sync_lock) < 0 && n < 30; n++)
- sleep(2);
-.br
-.sp
-until they are able to create a link to a file named "/tmp/#saillock.??".
-The "??" correspond to the scenario number of the game. Since UNIX
-guarantees that a link will point to only one file, the process that succeeds
-in linking will have exclusive access to the temporary file.
-.PP
-Whether or not this really works is open to speculation. When ucbmiro
-was rebooted after a crash, the file system check program found 3 links
-between the
-.I Sail
-temporary file and its link file.
-.SH CONSEQUENCES OF SEPARATE PLAYER AND DRIVER PROCESSES
-When players do something of global interest, such as moving or firing,
-the driver must coordinate the action with the other ships in the game.
-For example, if a player wants to move in a certain direction, he writes a
-message into the temporary file requesting the driver to move his ship.
-Each ``turn,'' the driver reads all the messages sent from the players and
-decides what happened. It then writes back into the temporary file new
-values of variables, etc.
-.PP
-The most noticeable effect this communication has on the game is the
-delay in moving. Suppose a player types a move for his ship and hits
-return. What happens then? The player process saves up messages to
-be written to the temporary file in a buffer. Every 7 seconds or so, the
-player process gets exclusive access to the temporary file and writes
-out its buffer to the file. The driver, running asynchronously, must
-read in the movement command, process it, and write out the results. This
-takes two exclusive accesses to the temporary file. Finally, when the player
-process gets around to doing another 7 second update, the results of the
-move are displayed on the screen. Hence, every movement requires four
-exclusive accesses to the temporary file (anywhere from 7 to 21 seconds
-depending upon asynchrony) before the player sees the results of his moves.
-.PP
-In practice, the delays are not as annoying as they would appear. There
-is room for "pipelining" in the movement. After the player writes out
-a first movement message, a second movement command can then be issued.
-The first message will be in the temporary file waiting for the driver, and
-the second will be in the file buffer waiting to be written to the file.
-Thus, by always typing moves a turn ahead of the time, the player can
-sail around quite quickly.
-.PP
-If the player types several movement commands between two 7 second updates,
-only the last movement command typed will be seen by the driver. Movement
-commands within the same update "overwrite" each other, in a sense.
-.SH THE HISTORY OF SAIL
-I wrote the first version of
-.I Sail
-on a PDP 11/70 in the fall of 1980. Needless to say, the code was horrendous,
-not portable in any sense of the word, and didn't work. The program was not
-very modular and had fseeks() and fwrites() every few lines. After a
-tremendous rewrite from the top down, I got the first working version up by
-1981. There were several annoying bugs concerning firing broadsides and
-finding angles.
-.I Sail
-uses no floating point, by the way, so the direction routines are rather
-tricky.
-Ed Wang rewrote my angle() routine in 1981 to be more correct (although
-it still doesn't work perfectly), and he added code to let a player select
-which ship he wanted at the start of the game (instead of the first one
-available).
-.PP
-Captain Happy (Craig Leres) is responsible for making
-.I Sail
-portable for the first time. This was no easy task, by the way. Constants
-like 2 and 10 were very frequent in the code. I also became famous for
-using "Riggle Memorial Structures" in
-.I Sail.
-Many of my structure references are so long that they run off the line
-printer page. Here is an example, if you promise not to laugh.
-.br
-.sp
-.ce
-specs[scene[flog.fgamenum].ship[flog.fshipnum].shipnum].pts
-.br
-.sp
-.PP
-.I Sail
-received its fourth and most thorough rewrite in the summer and fall
-of 1983. Ed Wang rewrote and modularized the code (a monumental feat)
-almost from scratch. Although he introduced many new bugs, the final
-result was very much cleaner and (?) faster. He added window movement
-commands and find ship commands.
-.SH HISTORICAL INFO
-Old Square Riggers were very maneuverable ships capable of intricate
-sailing. Their only disadvantage was an inability to sail very
-close to the wind. The design of a wooden ship allowed only for the
-guns to bear to the left and right sides. A few guns of small
-aspect (usually 6 or 9 pounders) could point forward, but their
-effect was small compared to a 68 gun broadside of 24 or 32 pounders.
-The guns bear approximately like so:
-.nf
-
- \\
- b----------------
- ---0
- \\
- \\
- \\ up to a range of ten (for round shot)
- \\
- \\
- \\
-
-.fi
-An interesting phenomenon occurred when a broadside was fired
-down the length of an enemy ship. The shot tended to bounce along
-the deck and did several times more damage. This phenomenon was called
-a rake. Because the bows of a ship are very strong and present a smaller
-target than the stern, a stern rake (firing from the stern to the bow) causes
-more damage than a bow rake.
-.nf
-
- b
- 00 ---- Stern rake!
- a
-
-.fi
-Most ships were equipped with carronades, which were very large, close
-range cannons. American ships from the revolution until the War of 1812
-were almost entirely armed with carronades.
-.PP
-The period of history covered in
-.I Sail
-is approximately from the 1770's until the end of Napoleonic France in 1815.
-There are many excellent books about the age of sail. My favorite author
-is Captain Frederick Marryat. More contemporary authors include C.S. Forester
-and Alexander Kent.
-.PP
-Fighting ships came in several sizes classed by armament. The mainstays of
-any fleet were its "Ships of the Line", or "Line of Battle Ships". They
-were so named because these ships fought together in great lines. They were
-close enough for mutual support, yet every ship could fire both its broadsides.
-We get the modern words "ocean liner," or "liner," and "battleship" from
-"ship of the line." The most common size was the 74 gun two decked
-ship of the line. The two gun decks usually mounted 18 and 24 pounder guns.
-.PP
-The pride of the fleet were the first rates. These were huge three decked
-ships of the line mounting 80 to 136 guns. The guns in the three tiers
-were usually 18, 24, and 32 pounders in that order from top to bottom.
-.PP
-Various other ships came next. They were almost all "razees," or ships
-of the line with one deck sawed off. They mounted 40-64 guns and were
-a poor cross between a frigate and a line of battle ship. They neither
-had the speed of the former nor the firepower of the latter.
-.PP
-Next came the "eyes of the fleet." Frigates came in many sizes mounting
-anywhere from 32 to 44 guns. They were very handy vessels. They could
-outsail anything bigger and outshoot anything smaller. Frigates didn't
-fight in lines of battle as the much bigger 74's did. Instead, they
-harassed the enemy's rear or captured crippled ships. They were much
-more useful in missions away from the fleet, such as cutting out expeditions
-or boat actions. They could hit hard and get away fast.
-.PP
-Lastly, there were the corvettes, sloops, and brigs. These were smaller
-ships mounting typically fewer than 20 guns. A corvette was only slightly
-smaller than a frigate, so one might have up to 30 guns. Sloops were used
-for carrying dispatches or passengers. Brigs were something you built for
-land-locked lakes.
-.SH SAIL PARTICULARS
-Ships in
-.I Sail
-are represented by two characters. One character represents the bow of
-the ship, and the other represents the stern. Ships have nationalities
-and numbers. The first ship of a nationality is number 0, the second
-number 1, etc. Therefore, the first British ship in a game would be
-printed as "b0". The second Brit would be "b1", and the fifth Don
-would be "s4".
-.PP
-Ships can set normal sails, called Battle Sails, or bend on extra canvas
-called Full Sails. A ship under full sail is a beautiful sight indeed,
-and it can move much faster than a ship under Battle Sails. The only
-trouble is, with full sails set, there is so much tension on sail and
-rigging that a well aimed round shot can burst a sail into ribbons where
-it would only cause a little hole in a loose sail. For this reason,
-rigging damage is doubled on a ship with full sails set. Don't let
-that discourage you from using full sails. I like to keep them up
-right into the heat of battle. A ship
-with full sails set has a capital letter for its nationality. E.g.,
-a Frog, "f0", with full sails set would be printed as "F0".
-.PP
-When a ship is battered into a listing hulk, the last man aboard "strikes
-the colors." This ceremony is the ship's formal surrender. The nationality
-character
-of a surrendered ship is printed as "!". E.g., the Frog of our last example
-would soon be "!0".
-.PP
-A ship has a random chance of catching fire or sinking when it reaches the
-stage of listing hulk. A sinking ship has a "~" printed for its nationality,
-and a ship on fire and about to explode has a "#" printed.
-.PP
-Captured ships become the nationality of the prize crew. Therefore, if
-an American ship captures a British ship, the British ship will have an
-"a" printed for its nationality. In addition, the ship number is changed
-to "&","'", "(", ,")", "*", or "+" depending upon the original number,
-be it 0,1,2,3,4, or 5. E.g., the "b0" captured by an American becomes the
-"a&". The "s4" captured by a Frog becomes the "f*".
-.PP
-The ultimate example is, of course, an exploding Brit captured by an
-American: "#&".
-.SH MOVEMENT
-Movement is the most confusing part of
-.I Sail
-to many. Ships can head in 8 directions:
-.nf
-
- 0 0 0
- b b b0 b b b 0b b
- 0 0 0
-
-.fi
-The stern of a ship moves when it turns. The bow remains stationary.
-Ships can always turn, regardless of the wind (unless they are becalmed).
-All ships drift when they lose headway. If a ship doesn't move forward
-at all for two turns, it will begin to drift. If a ship has begun to
-drift, then it must move forward before it turns, if it plans to do
-more than make a right or left turn, which is always possible.
-.PP
-Movement commands to
-.I Sail
-are a string of forward moves and turns. An example is "l3". It will
-turn a ship left and then move it ahead 3 spaces. In the drawing above,
-the "b0" made 7 successive left turns. When
-.I Sail
-prompts you for a move, it prints three characters of import. E.g.,
-.nf
- move (7, 4):
-.fi
-The first number is the maximum number of moves you can make,
-including turns. The second number is the maximum number of turns
-you can make. Between the numbers is sometimes printed a quote "'".
-If the quote is present, it means that your ship has been drifting, and
-you must move ahead to regain headway before you turn (see note above).
-Some of the possible moves for the example above are as follows:
-.nf
-
- move (7, 4): 7
- move (7, 4): 1
- move (7, 4): d /* drift, or do nothing */
- move (7, 4): 6r
- move (7, 4): 5r1
- move (7, 4): 4r1r
- move (7, 4): l1r1r2
- move (7, 4): 1r1r1r1
-
-.fi
-Because square riggers performed so poorly sailing into the wind, if at
-any point in a movement command you turn into the wind, the movement stops
-there. E.g.,
-.nf
-
- move (7, 4): l1l4
- Movement Error;
- Helm: l1l
-
-.fi
-Moreover, whenever you make a turn, your movement allowance drops to
-min(what's left, what you would have at the new attitude). In short,
-if you turn closer to the wind, you most likely won't be able to sail the
-full allowance printed in the "move" prompt.
-.PP
-Old sailing captains had to keep an eye constantly on the wind. Captains
-in
-.I Sail
-are no different. A ship's ability to move depends on its attitude to the
-wind. The best angle possible is to have the wind off your quarter, that is,
-just off the stern. The direction rose on the side of the screen gives the
-possible movements for your ship at all positions to the wind. Battle
-sail speeds are given first, and full sail speeds are given in parenthesis.
-.nf
-
- 0 1(2)
- \\|/
- -^-3(6)
- /|\\
- | 4(7)
- 3(6)
-
-.fi
-Pretend the bow of your ship (the "^") is pointing upward and the wind is
-blowing from the bottom to the top of the page. The
-numbers at the bottom "3(6)" will be your speed under battle or full
-sails in such a situation. If the wind is off your quarter, then you
-can move "4(7)". If the wind is off your beam, "3(6)". If the wind is
-off your bow, then you can only move "1(2)". Facing into the wind, you
-can't move at all. Ships facing into the wind were said to be "in irons".
-.SH WINDSPEED AND DIRECTION
-The windspeed and direction is displayed as a little weather vane on the
-side of the screen. The number in the middle of the vane indicates the wind
-speed, and the + to - indicates the wind direction. The wind blows from
-the + sign (high pressure) to the - sign (low pressure). E.g.,
-.nf
-
- |
- 3
- +
-
-.fi
-.PP
-The wind speeds are 0 = becalmed, 1 = light breeze, 2 = moderate breeze,
-3 = fresh breeze, 4 = strong breeze, 5 = gale, 6 = full gale, 7 = hurricane.
-If a hurricane shows up, all ships are destroyed.
-.SH GRAPPLING AND FOULING
-If two ships collide, they run the risk of becoming tangled together. This
-is called "fouling." Fouled ships are stuck together, and neither can move.
-They can unfoul each other if they want to. Boarding parties can only be
-sent across to ships when the antagonists are either fouled or grappled.
-.PP
-Ships can grapple each other by throwing grapnels into the rigging of
-the other.
-.PP
-The number of fouls and grapples you have are displayed on the upper
-right of the screen.
-.SH BOARDING
-Boarding was a very costly venture in terms of human life. Boarding parties
-may be formed in
-.I Sail
-to either board an enemy ship or to defend your own ship against attack.
-Men organized as Defensive Boarding Parties fight twice as hard to save
-their ship as men left unorganized.
-.PP
-The boarding strength of a crew depends upon its quality and upon the
-number of men sent.
-.SH CREW QUALITY
-The British seaman was world renowned for his sailing abilities. American
-sailors, however, were actually the best seamen in the world. Because the
-American Navy offered twice the wages of the Royal Navy, British seamen
-who liked the sea defected to America by the thousands.
-.PP
-In
-.I Sail,
-crew quality is quantized into 5 energy levels. "Elite" crews can outshoot
-and outfight all other sailors. "Crack" crews are next. "Mundane" crews
-are average, and "Green" and "Mutinous" crews are below average. A good
-rule of thumb is that "Crack" or "Elite" crews get one extra hit
-per broadside compared to "Mundane" crews. Don't expect too much from
-"Green" crews.
-.SH BROADSIDES
-Your two broadsides may be loaded with four kinds of shot: grape, chain,
-round, and double. You have guns and carronades in both the port and starboard
-batteries. Carronades only have a range of two, so you have to get in
-close to be able to fire them. You have the choice of firing at the hull
-or rigging of another ship. If the range of the ship is greater than 6,
-then you may only shoot at the rigging.
-.PP
-The types of shot and their advantages are:
-.SH ROUND
-Range of 10. Good for hull or rigging hits.
-.SH DOUBLE
-Range of 1. Extra good for hull or rigging hits.
-Double takes two turns to load.
-.SH CHAIN
-Range of 3. Excellent for tearing down rigging.
-Cannot damage hull or guns, though.
-.SH GRAPE
-Range of 1. Sometimes devastating against enemy crews.
-.PP
-On the side of the screen is displayed some vital information about your
-ship:
-.nf
-
- Load D! R!
- Hull 9
- Crew 4 4 2
- Guns 4 4
- Carr 2 2
- Rigg 5 5 5 5
-
-.fi
-"Load" shows what your port (left) and starboard (right) broadsides are
-loaded with. A "!" after the type of shot indicates that it is an initial
-broadside. Initial broadside were loaded with care before battle and before
-the decks ran red with blood. As a consequence, initial broadsides are a
-little more effective than broadsides loaded later. A "*" after the type of
-shot indicates that the gun
-crews are still loading it, and you cannot fire yet. "Hull" shows how much
-hull you have left. "Crew" shows your three sections of crew. As your
-crew dies off, your ability to fire decreases. "Guns" and "Carr" show
-your port and starboard guns. As you lose guns, your ability to fire
-decreases. "Rigg" shows how much rigging you have on your 3 or 4 masts.
-As rigging is shot away, you lose mobility.
-.SH EFFECTIVENESS OF FIRE
-It is very dramatic when a ship fires its thunderous broadsides, but the
-mere opportunity to fire them does not guarantee any hits. Many factors
-influence the destructive force of a broadside. First of all, and the chief
-factor, is distance. It is harder to hit a ship at range ten than it is
-to hit one sloshing alongside. Next is raking. Raking fire, as
-mentioned before,
-can sometimes dismast a ship at range ten. Next, crew size and quality affects
-the damage done by a broadside. The number of guns firing also bears on the
-point,
-so to speak. Lastly, weather affects the accuracy of a broadside. If the
-seas are high (5 or 6), then the lower gunports of ships of the line can't
-even be opened to run out the guns. This gives frigates and other flush
-decked vessels an advantage in a storm. The scenario
-.I Pellew vs. The Droits de L'Homme
-takes advantage of this peculiar circumstance.
-.SH REPAIRS
-Repairs may be made to your Hull, Guns, and Rigging at the slow rate of
-two points per three turns. The message "Repairs Completed" will be
-printed if no more repairs can be made.
-.SH PECULIARITIES OF COMPUTER SHIPS
-Computer ships in
-.I Sail
-follow all the rules above with a few exceptions. Computer ships never
-repair damage. If they did, the players could never beat them. They
-play well enough as it is. As a consolation, the computer ships can fire double
-shot every turn. That fluke is a good reason to keep your distance. The
-.I
-Driver
-figures out the moves of the computer ships. It computes them with a typical
-A.I. distance function and a depth first search to find the maximum "score."
-It seems to work fairly well, although I'll be the first to admit it isn't
-perfect.
-.SH HOW TO PLAY
-Commands are given to
-.I Sail
-by typing a single character. You will then be prompted for further
-input. A brief summary of the commands follows.
-.br
-.SH COMMAND SUMMARY
-.nf
-
- 'f' Fire broadsides if they bear
- 'l' Reload
- 'L' Unload broadsides (to change ammo)
- 'm' Move
- 'i' Print the closest ship
- 'I' Print all ships
- 'F' Find a particular ship or ships (e.g. "a?" for all Americans)
- 's' Send a message around the fleet
- 'b' Attempt to board an enemy ship
- 'B' Recall boarding parties
- 'c' Change set of sail
- 'r' Repair
- 'u' Attempt to unfoul
- 'g' Grapple/ungrapple
- 'v' Print version number of game
- '^L' Redraw screen
- 'Q' Quit
-
- 'C' Center your ship in the window
- 'U' Move window up
- 'D','N' Move window down
- 'H' Move window left
- 'J' Move window right
- 'S' Toggle window to follow your ship or stay where it is
-
-.fi
-.br
-.SH SCENARIOS
-Here is a summary of the scenarios in
-.I Sail:
-
-.br
-.SH Ranger vs. Drake:
-.nf
-Wind from the N, blowing a fresh breeze.
-
-(a) Ranger 19 gun Sloop (crack crew) (7 pts)
-(b) Drake 17 gun Sloop (crack crew) (6 pts)
-.SH The Battle of Flamborough Head:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-.fi
-This is John Paul Jones' first famous battle. Aboard the Bonhomme
-Richard, he was able to overcome the Serapis's greater firepower
-by quickly boarding her.
-.nf
-
-(a) Bonhomme Rich 42 gun Corvette (crack crew) (11 pts)
-(b) Serapis 44 gun Frigate (crack crew) (12 pts)
-.SH Arbuthnot and Des Touches:
-.nf
-Wind from the N, blowing a gale.
-
-(b) America 64 gun Ship of the Line (crack crew) (20 pts)
-(b) Befford 74 gun Ship of the Line (crack crew) (26 pts)
-(b) Adamant 50 gun Ship of the Line (crack crew) (17 pts)
-(b) London 98 gun 3 Decker SOL (crack crew) (28 pts)
-(b) Royal Oak 74 gun Ship of the Line (crack crew) (26 pts)
-(f) Neptune 74 gun Ship of the Line (average crew) (24 pts)
-(f) Duc de Bourgogne 80 gun 3 Decker SOL (average crew) (27 pts)
-(f) Conquerant 74 gun Ship of the Line (average crew) (24 pts)
-(f) Provence 64 gun Ship of the Line (average crew) (18 pts)
-(f) Romulus 44 gun Ship of the Line (average crew) (10 pts)
-.SH Suffren and Hughes:
-.nf
-
-Wind from the S, blowing a fresh breeze.
-
-(b) Monmouth 74 gun Ship of the Line (average crew) (24 pts)
-(b) Hero 74 gun Ship of the Line (crack crew) (26 pts)
-(b) Isis 50 gun Ship of the Line (crack crew) (17 pts)
-(b) Superb 74 gun Ship of the Line (crack crew) (27 pts)
-(b) Burford 74 gun Ship of the Line (average crew) (24 pts)
-(f) Flamband 50 gun Ship of the Line (average crew) (14 pts)
-(f) Annibal 74 gun Ship of the Line (average crew) (24 pts)
-(f) Severe 64 gun Ship of the Line (average crew) (18 pts)
-(f) Brilliant 80 gun Ship of the Line (crack crew) (31 pts)
-(f) Sphinx 80 gun Ship of the Line (average crew) (27 pts)
-.SH Nymphe vs. Cleopatre:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(b) Nymphe 36 gun Frigate (crack crew) (11 pts)
-(f) Cleopatre 36 gun Frigate (average crew) (10 pts)
-.SH Mars vs. Hercule:
-Wind from the S, blowing a fresh breeze.
-.nf
-(b) Mars 74 gun Ship of the Line (crack crew) (26 pts)
-(f) Hercule 74 gun Ship of the Line (average crew) (23 pts)
-.SH Ambuscade vs. Baionnaise:
-.nf
-Wind from the N, blowing a fresh breeze.
-
-(b) Ambuscade 32 gun Frigate (average crew) (9 pts)
-(f) Baionnaise 24 gun Corvette (average crew) (9 pts)
-.SH Constellation vs. Insurgent:
-.nf
-Wind from the S, blowing a gale.
-
-(a) Constellation 38 gun Corvette (elite crew) (17 pts)
-(f) Insurgent 36 gun Corvette (average crew) (11 pts)
-.SH Constellation vs. Vengeance:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(a) Constellation 38 gun Corvette (elite crew) (17 pts)
-(f) Vengeance 40 gun Frigate (average crew) (15 pts)
-.SH The Battle of Lissa:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(b) Amphion 32 gun Frigate (elite crew) (13 pts)
-(b) Active 38 gun Frigate (elite crew) (18 pts)
-(b) Volage 22 gun Frigate (elite crew) (11 pts)
-(b) Cerberus 32 gun Frigate (elite crew) (13 pts)
-(f) Favorite 40 gun Frigate (average crew) (15 pts)
-(f) Flore 40 gun Frigate (average crew) (15 pts)
-(f) Danae 40 gun Frigate (crack crew) (17 pts)
-(f) Bellona 32 gun Frigate (green crew) (9 pts)
-(f) Corona 40 gun Frigate (green crew) (12 pts)
-(f) Carolina 32 gun Frigate (green crew) (7 pts)
-.SH Constitution vs. Guerriere:
-.nf
-Wind from the SW, blowing a gale.
-
-(a) Constitution 44 gun Corvette (elite crew) (24 pts)
-(b) Guerriere 38 gun Frigate (crack crew) (15 pts)
-.SH United States vs. Macedonian:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(a) United States 44 gun Frigate (elite crew) (24 pts)
-(b) Macedonian 38 gun Frigate (crack crew) (16 pts)
-.SH Constitution vs. Java:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(a) Constitution 44 gun Corvette (elite crew) (24 pts)
-(b) Java 38 gun Corvette (crack crew) (19 pts)
-.SH Chesapeake vs. Shannon:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(a) Chesapeake 38 gun Frigate (average crew) (14 pts)
-(b) Shannon 38 gun Frigate (elite crew) (17 pts)
-.SH The Battle of Lake Erie:
-.nf
-Wind from the S, blowing a light breeze.
-
-(a) Lawrence 20 gun Sloop (crack crew) (9 pts)
-(a) Niagara 20 gun Sloop (elite crew) (12 pts)
-(b) Lady Prevost 13 gun Brig (crack crew) (5 pts)
-(b) Detroit 19 gun Sloop (crack crew) (7 pts)
-(b) Q. Charlotte 17 gun Sloop (crack crew) (6 pts)
-.SH Wasp vs. Reindeer:
-.nf
-Wind from the S, blowing a light breeze.
-
-(a) Wasp 20 gun Sloop (elite crew) (12 pts)
-(b) Reindeer 18 gun Sloop (elite crew) (9 pts)
-.SH Constitution vs. Cyane and Levant:
-.br
-Wind from the S, blowing a moderate breeze.
-
-(a) Constitution 44 gun Corvette (elite crew) (24 pts)
-(b) Cyane 24 gun Sloop (crack crew) (11 pts)
-(b) Levant 20 gun Sloop (crack crew) (10 pts)
-.br
-.SH Pellew vs. Droits de L'Homme:
-.nf
-Wind from the N, blowing a gale.
-
-(b) Indefatigable 44 gun Frigate (elite crew) (14 pts)
-(b) Amazon 36 gun Frigate (crack crew) (14 pts)
-(f) Droits L'Hom 74 gun Ship of the Line (average crew) (24 pts)
-.SH Algeciras:
-.nf
-Wind from the SW, blowing a moderate breeze.
-
-(b) Caesar 80 gun Ship of the Line (crack crew) (31 pts)
-(b) Pompee 74 gun Ship of the Line (crack crew) (27 pts)
-(b) Spencer 74 gun Ship of the Line (crack crew) (26 pts)
-(b) Hannibal 98 gun 3 Decker SOL (crack crew) (28 pts)
-(s) Real-Carlos 112 gun 3 Decker SOL (green crew) (27 pts)
-(s) San Fernando 96 gun 3 Decker SOL (green crew) (24 pts)
-(s) Argonauta 80 gun Ship of the Line (green crew) (23 pts)
-(s) San Augustine 74 gun Ship of the Line (green crew) (20 pts)
-(f) Indomptable 80 gun Ship of the Line (average crew) (27 pts)
-(f) Desaix 74 gun Ship of the Line (average crew) (24 pts)
-.SH Lake Champlain:
-.nf
-Wind from the N, blowing a fresh breeze.
-
-(a) Saratoga 26 gun Sloop (crack crew) (12 pts)
-(a) Eagle 20 gun Sloop (crack crew) (11 pts)
-(a) Ticonderoga 17 gun Sloop (crack crew) (9 pts)
-(a) Preble 7 gun Brig (crack crew) (4 pts)
-(b) Confiance 37 gun Frigate (crack crew) (14 pts)
-(b) Linnet 16 gun Sloop (elite crew) (10 pts)
-(b) Chubb 11 gun Brig (crack crew) (5 pts)
-.SH Last Voyage of the USS President:
-.nf
-Wind from the N, blowing a fresh breeze.
-
-(a) President 44 gun Frigate (elite crew) (24 pts)
-(b) Endymion 40 gun Frigate (crack crew) (17 pts)
-(b) Pomone 44 gun Frigate (crack crew) (20 pts)
-(b) Tenedos 38 gun Frigate (crack crew) (15 pts)
-.SH Hornblower and the Natividad:
-.nf
-Wind from the E, blowing a gale.
-
-.fi
-A scenario for you Horny fans. Remember, he sank the Natividad
-against heavy odds and winds. Hint: don't try to board the Natividad,
-her crew is much bigger, albeit green.
-.nf
-
-(b) Lydia 36 gun Frigate (elite crew) (13 pts)
-(s) Natividad 50 gun Ship of the Line (green crew) (14 pts)
-.SH Curse of the Flying Dutchman:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-Just for fun, take the Piece of cake.
-
-(s) Piece of Cake 24 gun Corvette (average crew) (9 pts)
-(f) Flying Dutchy 120 gun 3 Decker SOL (elite crew) (43 pts)
-.SH The South Pacific:
-.nf
-Wind from the S, blowing a strong breeze.
-
-(a) USS Scurvy 136 gun 3 Decker SOL (mutinous crew) (27 pts)
-(b) HMS Tahiti 120 gun 3 Decker SOL (elite crew) (43 pts)
-(s) Australian 32 gun Frigate (average crew) (9 pts)
-(f) Bikini Atoll 7 gun Brig (crack crew) (4 pts)
-.SH Hornblower and the battle of Rosas bay:
-.nf
-Wind from the E, blowing a fresh breeze.
-
-The only battle Hornblower ever lost. He was able to dismast one
-ship and stern rake the others though. See if you can do as well.
-.nf
-
-(b) Sutherland 74 gun Ship of the Line (crack crew) (26 pts)
-(f) Turenne 80 gun 3 Decker SOL (average crew) (27 pts)
-(f) Nightmare 74 gun Ship of the Line (average crew) (24 pts)
-(f) Paris 112 gun 3 Decker SOL (green crew) (27 pts)
-(f) Napoleon 74 gun Ship of the Line (green crew) (20 pts)
-.SH Cape Horn:
-.nf
-Wind from the NE, blowing a strong breeze.
-
-(a) Concord 80 gun Ship of the Line (average crew) (27 pts)
-(a) Berkeley 98 gun 3 Decker SOL (crack crew) (28 pts)
-(b) Thames 120 gun 3 Decker SOL (elite crew) (43 pts)
-(s) Madrid 112 gun 3 Decker SOL (green crew) (27 pts)
-(f) Musket 80 gun 3 Decker SOL (average crew) (27 pts)
-.SH New Orleans:
-.nf
-Wind from the SE, blowing a fresh breeze.
-
-Watch that little Cypress go!
-
-(a) Alligator 120 gun 3 Decker SOL (elite crew) (43 pts)
-(b) Firefly 74 gun Ship of the Line (crack crew) (27 pts)
-(b) Cypress 44 gun Frigate (elite crew) (14 pts)
-.SH Botany Bay:
-.nf
-Wind from the N, blowing a fresh breeze.
-
-(b) Shark 64 gun Ship of the Line (average crew) (18 pts)
-(f) Coral Snake 44 gun Corvette (elite crew) (24 pts)
-(f) Sea Lion 44 gun Frigate (elite crew) (24 pts)
-.SH Voyage to the Bottom of the Sea:
-.nf
-Wind from the NW, blowing a fresh breeze.
-
-This one is dedicated to Richard Basehart and David Hedison.
-
-(a) Seaview 120 gun 3 Decker SOL (elite crew) (43 pts)
-(a) Flying Sub 40 gun Frigate (crack crew) (17 pts)
-(b) Mermaid 136 gun 3 Decker SOL (mutinous crew) (27 pts)
-(s) Giant Squid 112 gun 3 Decker SOL (green crew) (27 pts)
-.SH Frigate Action:
-.nf
-Wind from the E, blowing a fresh breeze.
-
-(a) Killdeer 40 gun Frigate (average crew) (15 pts)
-(b) Sandpiper 40 gun Frigate (average crew) (15 pts)
-(s) Curlew 38 gun Frigate (crack crew) (16 pts)
-.SH The Battle of Midway:
-.nf
-Wind from the E, blowing a moderate breeze.
-
-(a) Enterprise 80 gun Ship of the Line (crack crew) (31 pts)
-(a) Yorktown 80 gun Ship of the Line (average crew) (27 pts)
-(a) Hornet 74 gun Ship of the Line (average crew) (24 pts)
-(j) Akagi 112 gun 3 Decker SOL (green crew) (27 pts)
-(j) Kaga 96 gun 3 Decker SOL (green crew) (24 pts)
-(j) Soryu 80 gun Ship of the Line (green crew) (23 pts)
-
-.SH Star Trek:
-.nf
-Wind from the S, blowing a fresh breeze.
-
-(a) Enterprise 450 gun Ship of the Line (elite crew) (75 pts)
-(a) Yorktown 450 gun Ship of the Line (elite crew) (75 pts)
-(a) Reliant 450 gun Ship of the Line (elite crew) (75 pts)
-(a) Galileo 450 gun Ship of the Line (elite crew) (75 pts)
-(k) Kobayashi Maru 450 gun Ship of the Line (elite crew) (75 pts)
-(k) Klingon II 450 gun Ship of the Line (elite crew) (75 pts)
-(o) Red Orion 450 gun Ship of the Line (elite crew) (75 pts)
-(o) Blue Orion 450 gun Ship of the Line (elite crew) (75 pts)
-
-.SH CONCLUSION
-
-.I Sail
-has been a group effort.
-
-.SH AUTHOR
-Dave Riggle
-.SH CO-AUTHOR
-Ed Wang
-.SH REFITTING
-Craig Leres
-.SH CONSULTANTS
-.nf
-Chris Guthrie
-Captain Happy
-Horatio Nelson
- and many valiant others...
-.fi
-.SH "REFERENCES"
-.nf
-Wooden Ships & Iron Men, by Avalon Hill
-Captain Horatio Hornblower Novels, (13 of them) by C.S. Forester
-Captain Richard Bolitho Novels, (12 of them) by Alexander Kent
-The Complete Works of Captain Frederick Marryat, (about 20) especially
-.in +6n
-Mr. Midshipman Easy
-Peter Simple
-Jacob Faithful
-Japhet in Search of a Father
-Snarleyyow, or The Dog Fiend
-Frank Mildmay, or The Naval Officer
-.in -6n
-.SH BUGS
-Probably a few, and please report them to "riggle@ernie.berkeley.edu" and
-"edward@ucbarpa.berkeley.edu"
diff --git a/games/sail/sync.c b/games/sail/sync.c
deleted file mode 100644
index 46f93ce..0000000
--- a/games/sail/sync.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)sync.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include "externs.h"
-#include <sys/file.h>
-#include <sys/errno.h>
-
-#define BUFSIZE 4096
-
-static char sync_buf[BUFSIZE];
-static char *sync_bp = sync_buf;
-static char sync_lock[25];
-static char sync_file[25];
-static long sync_seek;
-static FILE *sync_fp;
-#define SF "/tmp/#sailsink.%d"
-#define LF "/tmp/#saillock.%d"
-
-/*VARARGS3*/
-makesignal(from, fmt, ship, a, b, c)
- struct ship *from;
- char *fmt;
- struct ship *ship;
-{
- char message[80];
-
- if (ship == 0)
- (void) sprintf(message, fmt, a, b, c);
- else
- (void) sprintf(message, fmt,
- ship->shipname, colours(ship),
- sterncolour(ship), a, b, c);
- Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
-}
-
-#include <sys/types.h>
-#include <sys/stat.h>
-sync_exists(game)
-int game;
-{
- char buf[sizeof sync_file];
- struct stat s;
- time_t t;
-
- (void) sprintf(buf, SF, game);
- (void) time(&t);
- if (stat(buf, &s) < 0)
- return 0;
- if (s.st_mtime < t - 60*60*2) { /* 2 hours */
- (void) unlink(buf);
- (void) sprintf(buf, LF, game);
- (void) unlink(buf);
- return 0;
- } else
- return 1;
-}
-
-sync_open()
-{
- if (sync_fp != NULL)
- (void) fclose(sync_fp);
- (void) sprintf(sync_lock, LF, game);
- (void) sprintf(sync_file, SF, game);
- if (access(sync_file, 0) < 0) {
- int omask = umask(issetuid ? 077 : 011);
- sync_fp = fopen(sync_file, "w+");
- (void) umask(omask);
- } else
- sync_fp = fopen(sync_file, "r+");
- if (sync_fp == NULL)
- return -1;
- sync_seek = 0;
- return 0;
-}
-
-sync_close(remove)
- char remove;
-{
- if (sync_fp != 0)
- (void) fclose(sync_fp);
- if (remove)
- (void) unlink(sync_file);
-}
-
-Write(type, ship, isstr, a, b, c, d)
- int type;
- struct ship *ship;
- char isstr;
- int a, b, c, d;
-{
- if (isstr)
- (void) sprintf(sync_bp, "%d %d %d %s\n",
- type, ship->file->index, isstr, (char *)a);
- else
- (void) sprintf(sync_bp, "%d %d %d %d %d %d %d\n",
- type, ship->file->index, isstr, a, b, c, d);
- while (*sync_bp++)
- ;
- sync_bp--;
- if (sync_bp >= &sync_buf[sizeof sync_buf])
- abort();
- (void) sync_update(type, ship, a, b, c, d);
-}
-
-Sync()
-{
- sig_t sighup, sigint;
- int n;
- int type, shipnum, isstr, a, b, c, d;
- char buf[80];
- char erred = 0;
- extern errno;
-
- sighup = signal(SIGHUP, SIG_IGN);
- sigint = signal(SIGINT, SIG_IGN);
- for (n = TIMEOUT; --n >= 0;) {
-#ifdef LOCK_EX
- if (flock(fileno(sync_fp), LOCK_EX|LOCK_NB) >= 0)
- break;
- if (errno != EWOULDBLOCK)
- return -1;
-#else
- if (link(sync_file, sync_lock) >= 0)
- break;
- if (errno != EEXIST)
- return -1;
-#endif
- sleep(1);
- }
- if (n <= 0)
- return -1;
- (void) fseek(sync_fp, sync_seek, 0);
- for (;;) {
- switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) {
- case 3:
- break;
- case EOF:
- goto out;
- default:
- goto bad;
- }
- if (shipnum < 0 || shipnum >= cc->vessels)
- goto bad;
- if (isstr != 0 && isstr != 1)
- goto bad;
- if (isstr) {
- char *p;
- for (p = buf;;) {
- switch (*p++ = getc(sync_fp)) {
- case '\n':
- p--;
- case EOF:
- break;
- default:
- if (p >= buf + sizeof buf)
- p--;
- continue;
- }
- break;
- }
- *p = 0;
- for (p = buf; *p == ' '; p++)
- ;
- a = (long)p;
- b = c = d = 0;
- } else
- if (fscanf(sync_fp, "%d%d%d%d", &a, &b, &c, &d) != 4)
- goto bad;
- if (sync_update(type, SHIP(shipnum), a, b, c, d) < 0)
- goto bad;
- }
-bad:
- erred++;
-out:
- if (!erred && sync_bp != sync_buf) {
- (void) fseek(sync_fp, 0L, 2);
- (void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf,
- sync_fp);
- (void) fflush(sync_fp);
- sync_bp = sync_buf;
- }
- sync_seek = ftell(sync_fp);
-#ifdef LOCK_EX
- (void) flock(fileno(sync_fp), LOCK_UN);
-#else
- (void) unlink(sync_lock);
-#endif
- (void) signal(SIGHUP, sighup);
- (void) signal(SIGINT, sigint);
- return erred ? -1 : 0;
-}
-
-sync_update(type, ship, a, b, c, d)
- int type;
- struct ship *ship;
- long a, b, c, d;
-{
- switch (type) {
- case W_DBP: {
- struct BP *p = &ship->file->DBP[a];
- p->turnsent = b;
- p->toship = SHIP(c);
- p->mensent = d;
- break;
- }
- case W_OBP: {
- struct BP *p = &ship->file->OBP[a];
- p->turnsent = b;
- p->toship = SHIP(c);
- p->mensent = d;
- break;
- }
- case W_FOUL: {
- struct snag *p = &ship->file->foul[a];
- if (SHIP(a)->file->dir == 0)
- break;
- if (p->sn_count++ == 0)
- p->sn_turn = turn;
- ship->file->nfoul++;
- break;
- }
- case W_GRAP: {
- struct snag *p = &ship->file->grap[a];
- if (SHIP(a)->file->dir == 0)
- break;
- if (p->sn_count++ == 0)
- p->sn_turn = turn;
- ship->file->ngrap++;
- break;
- }
- case W_UNFOUL: {
- struct snag *p = &ship->file->foul[a];
- if (p->sn_count > 0) {
- if (b) {
- ship->file->nfoul -= p->sn_count;
- p->sn_count = 0;
- } else {
- ship->file->nfoul--;
- p->sn_count--;
- }
- }
- break;
- }
- case W_UNGRAP: {
- struct snag *p = &ship->file->grap[a];
- if (p->sn_count > 0) {
- if (b) {
- ship->file->ngrap -= p->sn_count;
- p->sn_count = 0;
- } else {
- ship->file->ngrap--;
- p->sn_count--;
- }
- }
- break;
- }
- case W_SIGNAL:
- if (mode == MODE_PLAYER) {
- if (nobells)
- Signal("%s (%c%c): %s", ship, a);
- else
- Signal("\7%s (%c%c): %s", ship, a);
- }
- break;
- case W_CREW: {
- struct shipspecs *s = ship->specs;
- s->crew1 = a;
- s->crew2 = b;
- s->crew3 = c;
- break;
- }
- case W_CAPTAIN:
- (void) strncpy(ship->file->captain, (char *)a,
- sizeof ship->file->captain - 1);
- ship->file->captain[sizeof ship->file->captain - 1] = 0;
- break;
- case W_CAPTURED:
- if (a < 0)
- ship->file->captured = 0;
- else
- ship->file->captured = SHIP(a);
- break;
- case W_CLASS:
- ship->specs->class = a;
- break;
- case W_DRIFT:
- ship->file->drift = a;
- break;
- case W_EXPLODE:
- if ((ship->file->explode = a) == 2)
- ship->file->dir = 0;
- break;
- case W_FS:
- ship->file->FS = a;
- break;
- case W_GUNL: {
- struct shipspecs *s = ship->specs;
- s->gunL = a;
- s->carL = b;
- break;
- }
- case W_GUNR: {
- struct shipspecs *s = ship->specs;
- s->gunR = a;
- s->carR = b;
- break;
- }
- case W_HULL:
- ship->specs->hull = a;
- break;
- case W_MOVE:
- (void) strncpy(ship->file->movebuf, (char *)a,
- sizeof ship->file->movebuf - 1);
- ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0;
- break;
- case W_PCREW:
- ship->file->pcrew = a;
- break;
- case W_POINTS:
- ship->file->points = a;
- break;
- case W_QUAL:
- ship->specs->qual = a;
- break;
- case W_RIGG: {
- struct shipspecs *s = ship->specs;
- s->rig1 = a;
- s->rig2 = b;
- s->rig3 = c;
- s->rig4 = d;
- break;
- }
- case W_RIG1:
- ship->specs->rig1 = a;
- break;
- case W_RIG2:
- ship->specs->rig2 = a;
- break;
- case W_RIG3:
- ship->specs->rig3 = a;
- break;
- case W_RIG4:
- ship->specs->rig4 = a;
- break;
- case W_COL:
- ship->file->col = a;
- break;
- case W_DIR:
- ship->file->dir = a;
- break;
- case W_ROW:
- ship->file->row = a;
- break;
- case W_SINK:
- if ((ship->file->sink = a) == 2)
- ship->file->dir = 0;
- break;
- case W_STRUCK:
- ship->file->struck = a;
- break;
- case W_TA:
- ship->specs->ta = a;
- break;
- case W_ALIVE:
- alive = 1;
- break;
- case W_TURN:
- turn = a;
- break;
- case W_WIND:
- winddir = a;
- windspeed = b;
- break;
- case W_BEGIN:
- (void) strcpy(ship->file->captain, "begin");
- people++;
- break;
- case W_END:
- *ship->file->captain = 0;
- ship->file->points = 0;
- people--;
- break;
- case W_DDEAD:
- hasdriver = 0;
- break;
- default:
- fprintf(stderr, "sync_update: unknown type %d\r\n", type);
- return -1;
- }
- return 0;
-}
diff --git a/games/sail/version.c b/games/sail/version.c
deleted file mode 100644
index ceb59df..0000000
--- a/games/sail/version.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-char version[] = "Wooden Ships and Iron Men, Version 8.1 (93/05/31)";
diff --git a/games/snake/Makefile b/games/snake/Makefile
deleted file mode 100644
index 0b8a472..0000000
--- a/games/snake/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-SUBDIR= snake snscore
-
-.include <bsd.subdir.mk>
diff --git a/games/snake/snake/Makefile b/games/snake/snake/Makefile
deleted file mode 100644
index 68b82e8..0000000
--- a/games/snake/snake/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= snake
-SRCS= snake.c move.c
-MAN= snake.6
-DPADD= ${LIBM} ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD= -lm -ltermcap -lcompat
-HIDEGAME=hidegame
-MLINKS= snake.6 snscore.6
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/snakerawscores)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/snakerawscores
-.endif
-.if !exists(${DESTDIR}/var/games/snake.log)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/snake.log
-.endif
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/snake/snake/move.c b/games/snake/snake/move.c
deleted file mode 100644
index 31acbac..0000000
--- a/games/snake/snake/move.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 7/19/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*************************************************************************
- *
- * MOVE LIBRARY
- *
- * This set of subroutines moves a cursor to a predefined
- * location, independent of the terminal type. If the
- * terminal has an addressable cursor, it uses it. If
- * not, it optimizes for tabs (currently) even if you don't
- * have them.
- *
- * At all times the current address of the cursor must be maintained,
- * and that is available as structure cursor.
- *
- * The following calls are allowed:
- * move(sp) move to point sp.
- * up() move up one line.
- * down() move down one line.
- * bs() move left one space (except column 0).
- * nd() move right one space(no write).
- * clear() clear screen.
- * home() home.
- * ll() move to lower left corner of screen.
- * cr() carriage return (no line feed).
- * pr() just like standard printf, but keeps track
- * of cursor position. (Uses pstring).
- * apr() same as printf, but first argument is &point.
- * (Uses pstring).
- * pstring(s) output the string of printing characters.
- * However, '\r' is interpreted to mean return
- * to column of origination AND do linefeed.
- * '\n' causes <cr><lf>.
- * putpad(str) calls tputs to output character with proper
- * padding.
- * outch() the output routine for a character used by
- * tputs. It just calls putchar.
- * pch(ch) output character to screen and update
- * cursor address (must be a standard
- * printing character). WILL SCROLL.
- * pchar(ps,ch) prints one character if it is on the
- * screen at the specified location;
- * otherwise, dumps it.(no wrap-around).
- *
- * getcap() initializes strings for later calls.
- * cap(string) outputs the string designated in the termcap
- * data base. (Should not move the cursor.)
- * done() returns the terminal to intial state and exits.
- *
- * point(&p,x,y) return point set to x,y.
- *
- * baudrate() returns the baudrate of the terminal.
- * delay(t) causes an approximately constant delay
- * independent of baudrate.
- * Duration is ~ t/20 seconds.
- *
- ******************************************************************************/
-
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include <termcap.h>
-#include <unistd.h>
-
-#include "snake.h"
-
-int CMlength;
-int NDlength;
-int BSlength;
-int delaystr[10];
-
-static char str[80];
-
-move(sp)
-struct point *sp;
-{
- int distance;
- int tabcol,ct;
- struct point z;
-
- if (sp->line <0 || sp->col <0 || sp->col > COLUMNS){
- pr("move to [%d,%d]?",sp->line,sp->col);
- return;
- }
- if (sp->line >= LINES){
- move(point(&z,sp->col,LINES-1));
- while(sp->line-- >= LINES)putchar('\n');
- return;
- }
-
- if (CM != 0) {
- char *cmstr = tgoto(CM, sp->col, sp->line);
-
- CMlength = strlen(cmstr);
- if(cursor.line == sp->line){
- distance = sp->col - cursor.col;
- if(distance == 0)return; /* Already there! */
- if(distance > 0){ /* Moving to the right */
- if(distance*NDlength < CMlength){
- right(sp);
- return;
- }
- if(TA){
- ct=sp->col&7;
- tabcol=(cursor.col|7)+1;
- do{
- ct++;
- tabcol=(tabcol|7)+1;
- }
- while(tabcol<sp->col);
- if(ct<CMlength){
- right(sp);
- return;
- }
- }
- } else { /* Moving to the left */
- if (-distance*BSlength < CMlength){
- gto(sp);
- return;
- }
- }
- if(sp->col < CMlength){
- cr();
- right(sp);
- return;
- }
- /* No more optimizations on same row. */
- }
- distance = sp->col - cursor.col;
- distance = distance > 0 ?
- distance*NDlength : -distance * BSlength;
- if (distance < 0)
- pr("ERROR: distance is negative: %d",distance);
- distance += abs(sp->line - cursor.line);
- if(distance >= CMlength){
- putpad(cmstr);
- cursor.line = sp->line;
- cursor.col = sp->col;
- return;
- }
- }
-
- /*
- * If we get here we have a terminal that can't cursor
- * address but has local motions or one which can cursor
- * address but can get there quicker with local motions.
- */
- gto(sp);
-}
-gto(sp)
-struct point *sp;
-{
-
- int distance,f,tfield;
-
- if (cursor.line > LINES || cursor.line <0 ||
- cursor.col <0 || cursor.col > COLUMNS)
- pr("ERROR: cursor is at %d,%d\n",
- cursor.line,cursor.col);
- if (sp->line > LINES || sp->line <0 ||
- sp->col <0 || sp->col > COLUMNS)
- pr("ERROR: target is %d,%d\n",sp->line,sp->col);
- tfield = (sp->col) >> 3;
- if (sp->line == cursor.line){
- if (sp->col > cursor.col)right(sp);
- else{
- distance = (cursor.col -sp->col)*BSlength;
- if (((TA) &&
- (distance > tfield+((sp->col)&7)*NDlength)
- ) ||
- (((cursor.col)*NDlength) < distance)
- ){
- cr();
- right(sp);
- }
- else{
- while(cursor.col > sp->col) bs();
- }
- }
- return;
- }
- /*must change row */
- if (cursor.col - sp->col > (cursor.col >> 3)){
- if (cursor.col == 0)f = 0;
- else f = -1;
- }
- else f = cursor.col >> 3;
- if (((sp->line << 1) + 1 < cursor.line - f) && (HO != 0)){
- /*
- * home quicker than rlf:
- * (sp->line + f > cursor.line - sp->line)
- */
- putpad(HO);
- cursor.col = cursor.line = 0;
- gto(sp);
- return;
- }
- if (((sp->line << 1) > cursor.line + LINES+1 + f) && (LL != 0)){
- /* home,rlf quicker than lf
- * (LINES+1 - sp->line + f < sp->line - cursor.line)
- */
- if (cursor.line > f + 1){
- /* is home faster than wraparound lf?
- * (cursor.line + 20 - sp->line > 21 - sp->line + f)
- */
- ll();
- gto(sp);
- return;
- }
- }
- if ((LL != 0) && (sp->line > cursor.line + (LINES >> 1) - 1))
- cursor.line += LINES;
- while(sp->line > cursor.line)down();
- while(sp->line < cursor.line)up();
- gto(sp); /*can recurse since cursor.line = sp->line */
-}
-
-right(sp)
-struct point *sp;
-{
- int field,tfield;
- int tabcol,strlength;
-
- if (sp->col < cursor.col)
- pr("ERROR:right() can't move left\n");
- if(TA){ /* If No Tabs: can't send tabs because ttydrive
- * loses count with control characters.
- */
- field = cursor.col >> 3;
-/*
- * This code is useful for a terminal which wraps around on backspaces.
- * (Mine does.) Unfortunately, this is not specified in termcap, and
- * most terminals don't work that way. (Of course, most terminals
- * have addressible cursors, too).
- */
- if (BW && (CM == 0) &&
- ((sp->col << 1) - field > (COLUMNS - 8) << 1 )
- ){
- if (cursor.line == 0){
- outch('\n');
- }
- outch('\r');
- cursor.col = COLUMNS + 1;
- while(cursor.col > sp->col)bs();
- if (cursor.line != 0) outch('\n');
- return;
- }
-
- tfield = sp->col >> 3;
-
- while (field < tfield){
- putpad(TA);
- cursor.col = ++field << 3;
- }
- tabcol = (cursor.col|7) + 1;
- strlength = (tabcol - sp->col)*BSlength + 1;
- /* length of sequence to overshoot */
- if (((sp->col - cursor.col)*NDlength > strlength) &&
- (tabcol < COLUMNS)
- ){
- /*
- * Tab past and backup
- */
- putpad(TA);
- cursor.col = (cursor.col | 7) + 1;
- while(cursor.col > sp->col)bs();
- }
- }
- while (sp->col > cursor.col){
- nd();
- }
-}
-
-cr(){
- outch('\r');
- cursor.col = 0;
-}
-
-clear(){
- int i;
-
- if (CL){
- putpad(CL);
- cursor.col=cursor.line=0;
- } else {
- for(i=0; i<LINES; i++) {
- putchar('\n');
- }
- cursor.line = LINES - 1;
- home();
- }
-}
-
-home(){
- struct point z;
-
- if(HO != 0){
- putpad(HO);
- cursor.col = cursor.line = 0;
- return;
- }
- z.col = z.line = 0;
- move(&z);
-}
-
-ll(){
- int l;
- struct point z;
-
- l = lcnt + 2;
- if(LL != NULL && LINES==l){
- putpad(LL);
- cursor.line = LINES-1;
- cursor.col = 0;
- return;
- }
- z.col = 0;
- z.line = l-1;
- move(&z);
-}
-
-up(){
- putpad(UP);
- cursor.line--;
-}
-
-down(){
- putpad(DO);
- cursor.line++;
- if (cursor.line >= LINES)cursor.line=LINES-1;
-}
-bs(){
- if (cursor.col > 0){
- putpad(BS);
- cursor.col--;
- }
-}
-
-nd(){
- putpad(ND);
- cursor.col++;
- if (cursor.col == COLUMNS+1){
- cursor.line++;
- cursor.col = 0;
- if (cursor.line >= LINES)cursor.line=LINES-1;
- }
-}
-
-pch(c)
-{
- outch(c);
- if(++cursor.col >= COLUMNS && AM) {
- cursor.col = 0;
- ++cursor.line;
- }
-}
-
-void
-apr(struct point *ps, const char *fmt, ...)
-{
- struct point p;
- va_list ap;
-
- p.line = ps->line+1; p.col = ps->col+1;
- move(&p);
- va_start(ap, fmt);
- (void)vsprintf(str, fmt, ap);
- va_end(ap);
- pstring(str);
-}
-
-void
-pr(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- (void)vsprintf(str, fmt, ap);
- va_end(ap);
- pstring(str);
-}
-
-pstring(s)
-char *s;{
- struct point z;
- int stcol;
-
- stcol = cursor.col;
- while (s[0] != '\0'){
- switch (s[0]){
- case '\n':
- move(point(&z,0,cursor.line+1));
- break;
- case '\r':
- move(point(&z,stcol,cursor.line+1));
- break;
- case '\t':
- z.col = (((cursor.col + 8) >> 3) << 3);
- z.line = cursor.line;
- move(&z);
- break;
- case '\b':
- bs();
- break;
- case CTRL('g'):
- outch(CTRL('g'));
- break;
- default:
- if (s[0] < ' ')break;
- pch(s[0]);
- }
- s++;
- }
-}
-
-pchar(ps,ch)
-struct point *ps;
-char ch;{
- struct point p;
- p.col = ps->col + 1; p.line = ps->line + 1;
- if (
- (p.col >= 0) &&
- (p.line >= 0) &&
- (
- (
- (p.line < LINES) &&
- (p.col < COLUMNS)
- ) ||
- (
- (p.col == COLUMNS) &&
- (p.line < LINES-1)
- )
- )
- ){
- move(&p);
- pch(ch);
- }
-}
-
-
-outch(c)
-{
- putchar(c);
-}
-
-putpad(str)
-char *str;
-{
- if (str)
- tputs(str, 1, outch);
-}
-
-#if 0
-baudrate()
-{
-
- switch (orig.sg_ospeed){
- case B300:
- return(300);
- case B1200:
- return(1200);
- case B4800:
- return(4800);
- case B9600:
- return(9600);
- default:
- return(0);
- }
-}
-#endif
-
-delay(t)
-unsigned int t;
-{
- while (usleep(t*50000U) == -1 && errno == EINTR) ;
-}
-
-done()
-{
- cook();
- exit(0);
-}
-
-cook()
-{
- delay(1);
- putpad(TE);
- putpad(KE);
- putpad(VE);
- fflush(stdout);
- stty(0, &orig);
-#ifdef TIOCSLTC
- ioctl(0, TIOCSLTC, &olttyc);
-#endif
-}
-
-raw()
-{
- stty(0, &new);
-#ifdef TIOCSLTC
- ioctl(0, TIOCSLTC, &nlttyc);
-#endif
-}
-
-struct point *point(ps,x,y)
-struct point *ps;
-int x,y;
-{
- ps->col=x;
- ps->line=y;
- return(ps);
-}
-
-char *ap;
-
-getcap()
-{
- char *getenv();
- char *term;
- char *xPC;
- void stop();
-#ifdef TIOCGWINSZ
- struct winsize win;
-#endif
-
- term = getenv("TERM");
- if (term==0) {
- fprintf(stderr, "No TERM in environment\n");
- exit(1);
- }
-
- switch (tgetent(tbuf, term)) {
- case -1:
- fprintf(stderr, "Cannot open termcap file\n");
- exit(2);
- case 0:
- fprintf(stderr, "%s: unknown terminal", term);
- exit(3);
- }
-
- ap = tcapbuf;
-
-#ifdef TIOCGWINSZ
- if (ioctl(0, TIOCGWINSZ, (char *) &win) < 0 ||
- (LINES = win.ws_row) == 0 || (COLUMNS = win.ws_col) == 0) {
-#endif
- LINES = tgetnum("li");
- COLUMNS = tgetnum("co");
-#ifdef TIOCGWINSZ
- }
-#endif
- if (!lcnt)
- lcnt = LINES - 2;
- if (!ccnt)
- ccnt = COLUMNS - 3;
-
- AM = tgetflag("am");
- BW = tgetflag("bw");
-
- ND = tgetstr("nd", &ap);
- UP = tgetstr("up", &ap);
-
- DO = tgetstr("do", &ap);
- if (DO == 0)
- DO = "\n";
-
- BS = tgetstr("bc", &ap);
- if (BS == 0 && tgetflag("bs"))
- BS = "\b";
- if (BS)
- xBC = *BS;
-
- TA = tgetstr("ta", &ap);
- if (TA == 0 && tgetflag("pt"))
- TA = "\t";
-
- HO = tgetstr("ho", &ap);
- CL = tgetstr("cl", &ap);
- CM = tgetstr("cm", &ap);
- LL = tgetstr("ll", &ap);
-
- KL = tgetstr("kl", &ap);
- KR = tgetstr("kr", &ap);
- KU = tgetstr("ku", &ap);
- KD = tgetstr("kd", &ap);
- if (KL)
- Klength = strlen(KL);
- else
- Klength = strlen(KL);
- /*
- * NOTE: If KL, KR, KU, and KD are not
- * all the same length, some problems
- * may arise, since tests are made on
- * all of them together.
- */
-
- TI = tgetstr("ti", &ap);
- TE = tgetstr("te", &ap);
- KS = tgetstr("ks", &ap);
- KE = tgetstr("ke", &ap);
-
- VI = tgetstr("vi", &ap);
- VE = tgetstr("ve", &ap);
-
- xPC = tgetstr("pc", &ap);
- if (xPC)
- PC = *xPC;
-
- if (ND)
- NDlength = strlen(ND);
- else
- NDlength = 0;
-
- if (BS)
- BSlength = strlen(BS);
- else
- BSlength = 0;
-
- if ((CM == 0) &&
- (HO == 0 || DO == 0 || UP==0 || BS==0 || ND==0))
- {
- /* XXX as written in rev.1.6, we can assert(DO) */
- fprintf(stderr, "Terminal must have addressible ");
- fprintf(stderr, "cursor or home + 4 local motions\n");
- exit(5);
- }
- if (tgetflag("os")) {
- fprintf(stderr, "Terminal must not overstrike\n");
- exit(5);
- }
- if (LINES <= 0 || COLUMNS <= 0) {
- fprintf(stderr, "Must know the screen size\n");
- exit(5);
- }
-
- gtty(0, &orig);
- new=orig;
- new.sg_flags &= ~(ECHO|CRMOD|ALLDELAY|XTABS);
- new.sg_flags |= CBREAK;
- signal(SIGINT,stop);
- ospeed = orig.sg_ospeed;
-#ifdef TIOCGLTC
- ioctl(0, TIOCGLTC, &olttyc);
- nlttyc = olttyc;
- nlttyc.t_suspc = '\377';
- nlttyc.t_dsuspc = '\377';
-#endif
- raw();
-
- if ((orig.sg_flags & XTABS) == XTABS) TA=0;
- putpad(KS);
- putpad(TI);
- point(&cursor,0,LINES-1);
-}
diff --git a/games/snake/snake/pathnames.h b/games/snake/snake/pathnames.h
deleted file mode 100644
index 72713d1..0000000
--- a/games/snake/snake/pathnames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_RAWSCORES "/var/games/snakerawscores"
-#define _PATH_LOGFILE "/var/games/snake.log"
diff --git a/games/snake/snake/snake.6 b/games/snake/snake/snake.6
deleted file mode 100644
index 3f1d526..0000000
--- a/games/snake/snake/snake.6
+++ /dev/null
@@ -1,113 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)snake.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH SNAKE 6 "May 31, 1993"
-.UC 4
-.SH NAME
-snake, snscore \- display chase game
-.SH SYNOPSIS
-.B snake
-[
-.B -w width
-] [
-.B -l length
-]
-.br
-.B snscore
-.SH DESCRIPTION
-Snake is a display-based game which must be played on a CRT terminal.
-The object of the game is to make as much money as possible without
-getting eaten by the snake. The
-.B \-l
-and
-.B \-w
-options allow you to specify the length and width of the field.
-By default the entire screen (except for the last column) is used.
-.PP
-You are represented on the screen by an I.
-The snake is 6 squares long and is represented by S's.
-The money is $, and an exit is #.
-Your score is posted in the upper left hand corner.
-.PP
-You can move around using the same conventions as vi(1),
-the h, j, k, and l keys work, as do the arrow keys.
-Other possibilities include:
-.IP sefc
-These keys are like hjkl but form a directed pad around the d key.
-.IP HJKL
-These keys move you all the way in the indicated direction to the
-same row or column as the money. This does
-.I not
-let you jump away from the snake, but rather saves you from having
-to type a key repeatedly. The snake still gets all his turns.
-.IP SEFC
-Likewise for the upper case versions on the left.
-.IP ATPB
-These keys move you to the four edges of the screen.
-Their position on the keyboard is the mnemonic, e.g.
-P is at the far right of the keyboard.
-.IP x
-This lets you quit the game at any time.
-.IP p
-Points in a direction you might want to go.
-.IP w
-Space warp to get out of tight squeezes, at a price.
-.PP
-To earn money, move to the same square the money is on.
-A new $ will appear when you earn the current one.
-As you get richer, the snake gets hungrier.
-To leave the game, move to the exit (#).
-.PP
-A record is kept of the personal best score of each player.
-Scores are only counted if you leave at the exit,
-getting eaten by the snake is worth nothing.
-.PP
-As in pinball, matching the last digit of your score to the number
-which appears after the game is worth a bonus.
-.PP
-To see who wastes time playing snake, run
-.I snscore .
-.SH FILES
-.nf
-.ta \w'/var/games/snakerawscores 'u
-/var/games/snakerawscores database of personal bests
-/var/games/snake.log log of games played
-.DT
-.fi
-.SH BUGS
-When playing on a small screen,
-it's hard to tell when you hit the edge of the screen.
-.PP
-The scoring function takes into account the size of the screen.
-A perfect function to do this equitably has not been devised.
diff --git a/games/snake/snake/snake.c b/games/snake/snake/snake.c
deleted file mode 100644
index f92f99c..0000000
--- a/games/snake/snake/snake.c
+++ /dev/null
@@ -1,902 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * snake - crt hack game.
- *
- * You move around the screen with arrow keys trying to pick up money
- * without getting eaten by the snake. hjkl work as in vi in place of
- * arrow keys. You can leave at the exit any time.
- *
- * compile as follows:
- * cc -O snake.c move.c -o snake -lm -ltermlib
- */
-
-#include <sys/param.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <time.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "snake.h"
-#include "pathnames.h"
-
-#define PENALTY 10 /* % penalty for invoking spacewarp */
-
-#define EOT '\004'
-#define LF '\n'
-#define DEL '\177'
-
-#define ME 'I'
-#define SNAKEHEAD 'S'
-#define SNAKETAIL 's'
-#define TREASURE '$'
-#define GOAL '#'
-
-#define BSIZE 80
-
-struct point you;
-struct point money;
-struct point finish;
-struct point snake[6];
-
-int loot, penalty;
-int long tl, tm=0L;
-int moves;
-char stri[BSIZE];
-char *p;
-char ch, savec;
-char *kl, *kr, *ku, *kd;
-int fast=1;
-int repeat=1;
-long tv;
-char *tn;
-
-int rawscores;
-FILE *logfile;
-
-main(argc,argv)
-int argc;
-char **argv;
-{
- extern char *optarg;
- extern int optind;
- int ch, i;
- void stop();
-
- rawscores = open(_PATH_RAWSCORES, O_RDWR|O_CREAT, 0664);
- logfile = fopen(_PATH_LOGFILE, "a");
-
- /* revoke privs */
- setgid(getgid());
-
- srandomdev();
-
- while ((ch = getopt(argc, argv, "l:w:")) != -1)
- switch((char)ch) {
-#ifdef notdef
- case 'd':
- tv = atol(optarg);
- break;
-#endif
- case 'w': /* width */
- ccnt = atoi(optarg);
- break;
- case 'l': /* length */
- lcnt = atoi(optarg);
- break;
- case '?':
- default:
- fputs("usage: snake [-d seed] [-w width] [-l length]\n", stderr);
- exit(1);
- }
-
- penalty = loot = 0;
- getcap();
-
- i = MIN(lcnt, ccnt);
- if (i < 4) {
- cook();
- pr("snake: screen too small for a fair game.\n");
- exit(1);
- }
-
- /*
- * chunk is the amount of money the user gets for each $.
- * The formula below tries to be fair for various screen sizes.
- * We only pay attention to the smaller of the 2 edges, since
- * that seems to be the bottleneck.
- * This formula is a hyperbola which includes the following points:
- * (24, $25) (original scoring algorithm)
- * (12, $40) (experimentally derived by the "feel")
- * (48, $15) (a guess)
- * This will give a 4x4 screen $99/shot. We don't allow anything
- * smaller than 4x4 because there is a 3x3 game where you can win
- * an infinite amount of money.
- */
- if (i < 12) i = 12; /* otherwise it isn't fair */
- /*
- * Compensate for border. This really changes the game since
- * the screen is two squares smaller but we want the default
- * to be $25, and the high scores on small screens were a bit
- * much anyway.
- */
- i += 2;
- chunk = (675.0 / (i+6)) + 2.5; /* min screen edge */
-
- signal (SIGINT, stop);
- putpad(TI); /* String to begin programs that use cm */
- putpad(KS); /* Put terminal in keypad transmit mode */
- putpad(VI); /* Hide cursor */
-
- snrand(&finish);
- snrand(&you);
- snrand(&money);
- snrand(&snake[0]);
-
- if ((orig.sg_ospeed < B9600) ||
- ((! CM) && (! TA))) fast=0;
- for(i=1;i<6;i++)
- chase (&snake[i], &snake[i-1]);
- setup();
- mainloop();
-}
-
-/* Main command loop */
-mainloop()
-{
- int j, k;
-
- for (;;) {
- int c,lastc,match;
-
- move(&you);
- fflush(stdout);
- if (((c = getchar() & 0177) <= '9') && (c >= '0')) {
- ungetc(c,stdin);
- j = scanf("%d",&repeat);
- c = getchar() & 0177;
- } else {
- if (c != '.') repeat = 1;
- }
- if (c == '.') {
- c = lastc;
- }
- if ((Klength > 0) &&
- (c == *KL || c == *KR || c == *KU || c == *KD)) {
- savec = c;
- match = 0;
- kl = KL;
- kr = KR;
- ku = KU;
- kd = KD;
- for (j=Klength;j>0;j--){
- if (match != 1) {
- match = 0;
- if (*kl++ == c) {
- ch = 'h';
- match++;
- }
- if (*kr++ == c) {
- ch = 'l';
- match++;
- }
- if (*ku++ == c) {
- ch = 'k';
- match++;
- }
- if (*kd++ == c) {
- ch = 'j';
- match++;
- }
- if (match == 0) {
- ungetc(c,stdin);
- ch = savec;
- /* Oops!
- * This works if we figure it out on second character.
- */
- break;
- }
- }
- savec = c;
- if(j != 1) c = getchar() & 0177;
- }
- c = ch;
- }
- if (!fast) flushi();
- lastc = c;
- switch (c){
- case CTRL('z'):
- suspend();
- continue;
- case EOT:
- case 'x':
- case 0177: /* del or end of file */
- ll();
- length(moves);
- logit("quit");
- done();
- case CTRL('l'):
- setup();
- winnings(cashvalue);
- continue;
- case 'p':
- case 'd':
- snap();
- continue;
- case 'w':
- spacewarp(0);
- continue;
- case 'A':
- repeat = you.col;
- c = 'h';
- break;
- case 'H':
- case 'S':
- repeat = you.col - money.col;
- c = 'h';
- break;
- case 'T':
- repeat = you.line;
- c = 'k';
- break;
- case 'K':
- case 'E':
- repeat = you.line - money.line;
- c = 'k';
- break;
- case 'P':
- repeat = ccnt - 1 - you.col;
- c = 'l';
- break;
- case 'L':
- case 'F':
- repeat = money.col - you.col;
- c = 'l';
- break;
- case 'B':
- repeat = lcnt - 1 - you.line;
- c = 'j';
- break;
- case 'J':
- case 'C':
- repeat = money.line - you.line;
- c = 'j';
- break;
- }
- for(k=1;k<=repeat;k++){
- moves++;
- switch(c) {
- case 's':
- case 'h':
- case '\b':
- if (you.col >0) {
- if((fast)||(k == 1))
- pchar(&you,' ');
- you.col--;
- if((fast) || (k == repeat) ||
- (you.col == 0))
- pchar(&you,ME);
- }
- break;
- case 'f':
- case 'l':
- case ' ':
- if (you.col < ccnt-1) {
- if((fast)||(k == 1))
- pchar(&you,' ');
- you.col++;
- if((fast) || (k == repeat) ||
- (you.col == ccnt-1))
- pchar(&you,ME);
- }
- break;
- case CTRL('p'):
- case 'e':
- case 'k':
- case 'i':
- if (you.line > 0) {
- if((fast)||(k == 1))
- pchar(&you,' ');
- you.line--;
- if((fast) || (k == repeat) ||
- (you.line == 0))
- pchar(&you,ME);
- }
- break;
- case CTRL('n'):
- case 'c':
- case 'j':
- case LF:
- case 'm':
- if (you.line+1 < lcnt) {
- if((fast)||(k == 1))
- pchar(&you,' ');
- you.line++;
- if((fast) || (k == repeat) ||
- (you.line == lcnt-1))
- pchar(&you,ME);
- }
- break;
- }
-
- if (same(&you,&money))
- {
- loot += 25;
- if(k < repeat)
- pchar(&you,' ');
- do {
- snrand(&money);
- } while (money.col == finish.col && money.line == finish.line ||
- money.col < 5 && money.line == 0 ||
- money.col == you.col && money.line == you.line);
- pchar(&money,TREASURE);
- winnings(cashvalue);
- continue;
- }
- if (same(&you,&finish))
- {
- win(&finish);
- ll();
- cook();
- pr("You have won with $%d.\n",cashvalue);
- fflush(stdout);
- logit("won");
- post(cashvalue,1);
- length(moves);
- done();
- }
- if (pushsnake())break;
- }
- fflush(stdout);
- }
-}
-
-setup(){ /*
- * setup the board
- */
- int i;
-
- clear();
- pchar(&you,ME);
- pchar(&finish,GOAL);
- pchar(&money,TREASURE);
- for(i=1; i<6; i++) {
- pchar(&snake[i],SNAKETAIL);
- }
- pchar(&snake[0], SNAKEHEAD);
- drawbox();
- fflush(stdout);
-}
-
-drawbox()
-{
- int i;
- struct point p;
-
- p.line = -1;
- for (i= 0; i<ccnt; i++) {
- p.col = i;
- pchar(&p, '-');
- }
- p.col = ccnt;
- for (i= -1; i<=lcnt; i++) {
- p.line = i;
- pchar(&p, '|');
- }
- p.col = -1;
- for (i= -1; i<=lcnt; i++) {
- p.line = i;
- pchar(&p, '|');
- }
- p.line = lcnt;
- for (i= 0; i<ccnt; i++) {
- p.col = i;
- pchar(&p, '-');
- }
-}
-
-snrand(sp)
-struct point *sp;
-{
- struct point p;
- int i;
-
- for (;;) {
- p.col = random() % ccnt;
- p.line = random() % lcnt;
-
- /* make sure it's not on top of something else */
- if (p.line == 0 && p.col < 5)
- continue;
- if (same(&p, &you))
- continue;
- if (same(&p, &money))
- continue;
- if (same(&p, &finish))
- continue;
- for (i = 0; i < 5; i++)
- if (same(&p, &snake[i]))
- break;
- if (i < 5)
- continue;
- break;
- }
- *sp = p;
-}
-
-post(iscore, flag)
-int iscore, flag;
-{
- short score = iscore;
- short uid;
- short oldbest=0;
- short allbwho=0, allbscore=0;
- struct passwd *p;
-
- /*
- * Neg uid, 0, and 1 cannot have scores recorded.
- */
- if ((uid = getuid()) <= 1) {
- pr("No saved scores for uid %d.\n", uid);
- return(1);
- }
- if (rawscores == -1) {
- pr("No score file %s: %s.\n", _PATH_RAWSCORES,
- strerror(errno));
- return(1);
- }
- /* Figure out what happened in the past */
- read(rawscores, &allbscore, sizeof(short));
- read(rawscores, &allbwho, sizeof(short));
- lseek(rawscores, ((off_t)uid)*sizeof(short), 0);
- read(rawscores, &oldbest, sizeof(short));
- if (!flag)
- return (score > oldbest ? 1 : 0);
-
- /* Update this jokers best */
- if (score > oldbest) {
- lseek(rawscores, ((off_t)uid)*sizeof(short), 0);
- write(rawscores, &score, sizeof(short));
- pr("You bettered your previous best of $%d\n", oldbest);
- } else
- pr("Your best to date is $%d\n", oldbest);
-
- /* See if we have a new champ */
- p = getpwuid(allbwho);
- if (p == NULL || score > allbscore) {
- lseek(rawscores, (off_t)0, 0);
- write(rawscores, &score, sizeof(short));
- write(rawscores, &uid, sizeof(short));
- if (allbwho)
- pr("You beat %s's old record of $%d!\n",
- p->pw_name, allbscore);
- else
- pr("You set a new record!\n");
- } else
- pr("The highest is %s with $%d\n", p->pw_name, allbscore);
- close(rawscores);
- return (1);
-}
-
-/*
- * Flush typeahead to keep from buffering a bunch of chars and then
- * overshooting. This loses horribly at 9600 baud, but works nicely
- * if the terminal gets behind.
- */
-flushi()
-{
- stty(0, &new);
-}
-int mx [8] = {
- 0, 1, 1, 1, 0,-1,-1,-1};
-int my [8] = {
- -1,-1, 0, 1, 1, 1, 0,-1};
-float absv[8]= {
- 1, 1.4, 1, 1.4, 1, 1.4, 1, 1.4
-};
-int oldw=0;
-chase (np, sp)
-struct point *sp, *np;
-{
- /* this algorithm has bugs; otherwise the
- snake would get too good */
- struct point d;
- int w, i, wt[8];
- double v1, v2, vp, max;
- point(&d,you.col-sp->col,you.line-sp->line);
- v1 = sqrt( (double) (d.col*d.col + d.line*d.line) );
- w=0;
- max=0;
- for(i=0; i<8; i++)
- {
- vp = d.col*mx[i] + d.line*my[i];
- v2 = absv[i];
- if (v1>0)
- vp = ((double)vp)/(v1*v2);
- else vp=1.0;
- if (vp>max)
- {
- max=vp;
- w=i;
- }
- }
- for(i=0; i<8; i++)
- {
- point(&d,sp->col+mx[i],sp->line+my[i]);
- wt[i]=0;
- if (d.col<0 || d.col>=ccnt || d.line<0 || d.line>=lcnt)
- continue;
- /*
- * Change to allow snake to eat you if you're on the money,
- * otherwise, you can just crouch there until the snake goes
- * away. Not positive it's right.
- *
- * if (d.line == 0 && d.col < 5) continue;
- */
- if (same(&d,&money)) continue;
- if (same(&d,&finish)) continue;
- wt[i]= i==w ? loot/10 : 1;
- if (i==oldw) wt [i] += loot/20;
- }
- for(w=i=0; i<8; i++)
- w+= wt[i];
- vp = random() % w;
- for(i=0; i<8; i++)
- if (vp <wt[i])
- break;
- else
- vp -= wt[i];
- if (i==8) {
- pr("failure\n");
- i=0;
- while (wt[i]==0) i++;
- }
- oldw=w=i;
- point(np,sp->col+mx[w],sp->line+my[w]);
-}
-
-spacewarp(w)
-int w;{
- struct point p;
- int j;
- char *str;
-
- snrand(&you);
- point(&p,COLUMNS/2 - 8,LINES/2 - 1);
- if (p.col < 0)
- p.col = 0;
- if (p.line < 0)
- p.line = 0;
- if (w) {
- str = "BONUS!!!";
- loot = loot - penalty;
- penalty = 0;
- } else {
- str = "SPACE WARP!!!";
- penalty += loot/PENALTY;
- }
- for(j=0;j<3;j++){
- clear();
- delay(5);
- apr(&p,str);
- delay(10);
- }
- setup();
- winnings(cashvalue);
-}
-
-snap()
-{
- struct point p;
-
- if(you.line < 3){
- pchar(point(&p,you.col,0),'-');
- }
- if(you.line > lcnt-4){
- pchar(point(&p,you.col,lcnt-1),'_');
- }
- if(you.col < 10){
- pchar(point(&p,0,you.line),'(');
- }
- if(you.col > ccnt-10){
- pchar(point(&p,ccnt-1,you.line),')');
- }
- if (! stretch(&money)) if (! stretch(&finish)) delay(10);
- if(you.line < 3){
- point(&p,you.col,0);
- chk(&p);
- }
- if(you.line > lcnt-4){
- point(&p,you.col,lcnt-1);
- chk(&p);
- }
- if(you.col < 10){
- point(&p,0,you.line);
- chk(&p);
- }
- if(you.col > ccnt-10){
- point(&p,ccnt-1,you.line);
- chk(&p);
- }
- fflush(stdout);
-}
-
-stretch(ps)
-struct point *ps;{
- struct point p;
-
- point(&p,you.col,you.line);
- if(abs(ps->col-you.col) < 6){
- if(you.line < ps->line){
- for (p.line = you.line+1;p.line <= ps->line;p.line++)
- pchar(&p,'v');
- delay(10);
- for (;p.line > you.line;p.line--)
- chk(&p);
- } else {
- for (p.line = you.line-1;p.line >= ps->line;p.line--)
- pchar(&p,'^');
- delay(10);
- for (;p.line < you.line;p.line++)
- chk(&p);
- }
- return(1);
- } else if(abs(ps->line-you.line) < 3){
- p.line = you.line;
- if(you.col < ps->col){
- for (p.col = you.col+1;p.col <= ps->col;p.col++)
- pchar(&p,'>');
- delay(10);
- for (;p.col > you.col;p.col--)
- chk(&p);
- } else {
- for (p.col = you.col-1;p.col >= ps->col;p.col--)
- pchar(&p,'<');
- delay(10);
- for (;p.col < you.col;p.col++)
- chk(&p);
- }
- return(1);
- }
- return(0);
-}
-
-surround(ps)
-struct point *ps;{
- struct point x;
- int j;
-
- if(ps->col == 0)ps->col++;
- if(ps->line == 0)ps->line++;
- if(ps->line == LINES -1)ps->line--;
- if(ps->col == COLUMNS -1)ps->col--;
- apr(point(&x,ps->col-1,ps->line-1),"/*\\\r* *\r\\*/");
- for (j=0;j<20;j++){
- pchar(ps,'@');
- delay(1);
- pchar(ps,' ');
- delay(1);
- }
- if (post(cashvalue,0)) {
- apr(point(&x,ps->col-1,ps->line-1)," \ro.o\r\\_/");
- delay(6);
- apr(point(&x,ps->col-1,ps->line-1)," \ro.-\r\\_/");
- delay(6);
- }
- apr(point(&x,ps->col-1,ps->line-1)," \ro.o\r\\_/");
-}
-
-win(ps)
-struct point *ps;
-{
- struct point x;
- int j,k;
- int boxsize; /* actually diameter of box, not radius */
-
- boxsize = fast ? 10 : 4;
- point(&x,ps->col,ps->line);
- for(j=1;j<boxsize;j++){
- for(k=0;k<j;k++){
- pchar(&x,'#');
- x.line--;
- }
- for(k=0;k<j;k++){
- pchar(&x,'#');
- x.col++;
- }
- j++;
- for(k=0;k<j;k++){
- pchar(&x,'#');
- x.line++;
- }
- for(k=0;k<j;k++){
- pchar(&x,'#');
- x.col--;
- }
- }
- fflush(stdout);
-}
-
-pushsnake()
-{
- int i, bonus;
- int issame = 0;
-
- /*
- * My manual says times doesn't return a value. Furthermore, the
- * snake should get his turn every time no matter if the user is
- * on a fast terminal with typematic keys or not.
- * So I have taken the call to times out.
- */
- for(i=4; i>=0; i--)
- if (same(&snake[i], &snake[5]))
- issame++;
- if (!issame)
- pchar(&snake[5],' ');
- for(i=4; i>=0; i--)
- snake[i+1]= snake[i];
- chase(&snake[0], &snake[1]);
- pchar(&snake[1],SNAKETAIL);
- pchar(&snake[0],SNAKEHEAD);
- for(i=0; i<6; i++)
- {
- if (same(&snake[i],&you))
- {
- surround(&you);
- i = (cashvalue) % 10;
- bonus = random() % 10;
- ll();
- pr("%d\n", bonus);
- delay(30);
- if (bonus == i) {
- spacewarp(1);
- logit("bonus");
- flushi();
- return(1);
- }
- if ( loot >= penalty ){
- pr("You and your $%d have been eaten\n",
- cashvalue);
- } else {
- pr("The snake ate you. You owe $%d.\n",
- -cashvalue);
- }
- logit("eaten");
- length(moves);
- done();
- }
- }
- return(0);
-}
-
-chk(sp)
-struct point *sp;
-{
- int j;
-
- if (same(sp,&money)) {
- pchar(sp,TREASURE);
- return(2);
- }
- if (same(sp,&finish)) {
- pchar(sp,GOAL);
- return(3);
- }
- if (same(sp,&snake[0])) {
- pchar(sp,SNAKEHEAD);
- return(4);
- }
- for(j=1;j<6;j++){
- if(same(sp,&snake[j])){
- pchar(sp,SNAKETAIL);
- return(4);
- }
- }
- if ((sp->col < 4) && (sp->line == 0)){
- winnings(cashvalue);
- if((you.line == 0) && (you.col < 4)) pchar(&you,ME);
- return(5);
- }
- if (same(sp,&you)) {
- pchar(sp,ME);
- return(1);
- }
- pchar(sp,' ');
- return(0);
-}
-winnings(won)
-int won;
-{
- struct point p;
-
- p.line = p.col = 1;
- if(won>0){
- move(&p);
- pr("$%d",won);
- }
-}
-
-void
-stop(){
- signal(SIGINT,SIG_IGN);
- ll();
- length(moves);
- done();
-}
-
-suspend()
-{
- ll();
- cook();
- kill(getpid(), SIGTSTP);
- raw();
- setup();
- winnings(cashvalue);
-}
-
-length(num)
-int num;
-{
- pr("You made %d moves.\n",num);
-}
-
-logit(msg)
-char *msg;
-{
- time_t t;
-
- if (logfile != NULL) {
- time(&t);
- fprintf(logfile, "%s $%d %dx%d %s %s",
- getlogin(), cashvalue, lcnt, ccnt, msg, ctime(&t));
- fclose(logfile);
- }
-}
diff --git a/games/snake/snake/snake.h b/games/snake/snake/snake.h
deleted file mode 100644
index e6ed4bd..0000000
--- a/games/snake/snake/snake.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)snake.h 8.1 (Berkeley) 5/31/93
- *
- * $FreeBSD$
- */
-
-# include <stdio.h>
-# include <assert.h>
-# include <sys/types.h>
-# include <sgtty.h>
-# include <signal.h>
-# include <math.h>
-
-#define ESC '\033'
-
-struct tbuffer {
- long t[4];
-} tbuffer;
-
-char *CL, *UP, *DO, *ND, *BS,
- *HO, *CM,
- *TA, *LL,
- *KL, *KR, *KU, *KD,
- *TI, *TE, *KS, *KE,
- *VI, *VE;
-int LINES, COLUMNS; /* physical screen size. */
-int lcnt, ccnt; /* user's idea of screen size */
-char xBC, PC;
-int AM, BW;
-char tbuf[1024], tcapbuf[128];
-char *tgetstr(), *tgoto();
-int Klength; /* length of KX strings */
-int chunk; /* amount of money given at a time */
-#ifdef debug
-#define cashvalue (loot-penalty)/25
-#else
-#define cashvalue chunk*(loot-penalty)/25
-#endif
-
-struct point {
- int col, line;
-};
-struct point cursor;
-struct sgttyb orig, new;
-#ifdef TIOCLGET
-struct ltchars olttyc, nlttyc;
-#endif
-struct point *point();
-void apr(struct point *, const char *, ...) __printflike(2, 3);
-void pr(const char *, ...) __printflike(1, 2);
-
-#define same(s1, s2) ((s1)->line == (s2)->line && (s1)->col == (s2)->col)
diff --git a/games/snake/snscore/Makefile b/games/snake/snscore/Makefile
deleted file mode 100644
index e87c6e6..0000000
--- a/games/snake/snscore/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= snscore
-CFLAGS+=-I${.CURDIR}/../snake
-NOMAN= noman
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/snake/snscore/snscore.c b/games/snake/snscore/snscore.c
deleted file mode 100644
index 47a0d5c..0000000
--- a/games/snake/snscore/snscore.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "pathnames.h"
-
-char *recfile = _PATH_RAWSCORES;
-#define MAXPLAYERS 256
-
-struct player {
- short uids;
- short scores;
- char *name;
-} players[MAXPLAYERS], temp;
-
-int
-main()
-{
- short uid, score;
- FILE *fd;
- int noplayers;
- int i, j, notsorted;
- short whoallbest, allbest;
- char *q;
- struct passwd *p;
-
- fd = fopen(recfile, "r");
-
- if (fd == NULL) {
- perror(recfile);
- exit(1);
- }
-
- printf("Snake players scores to date\n");
- fread(&whoallbest, sizeof(short), 1, fd);
- fread(&allbest, sizeof(short), 1, fd);
- noplayers = 0;
- for (uid = 2; ;uid++) {
- if(fread(&score, sizeof(short), 1, fd) == 0)
- break;
- if (score > 0) {
- if (noplayers > MAXPLAYERS) {
- printf("too many players\n");
- exit(2);
- }
- players[noplayers].uids = uid;
- players[noplayers].scores = score;
- p = getpwuid(uid);
- if (p == NULL)
- continue;
- q = p -> pw_name;
- players[noplayers].name = malloc(strlen(q) + 1);
- strcpy(players[noplayers].name, q);
- noplayers++;
- }
- }
-
- /* bubble sort scores */
- for (notsorted = 1; notsorted; ) {
- notsorted = 0;
- for (i = 0; i < noplayers - 1; i++)
- if (players[i].scores < players[i + 1].scores) {
- temp = players[i];
- players[i] = players[i + 1];
- players[i + 1] = temp;
- notsorted++;
- }
- }
-
- j = 1;
- for (i = 0; i < noplayers; i++) {
- printf("%d:\t$%d\t%s\n", j, players[i].scores, players[i].name);
- if (players[i].scores > players[i + 1].scores)
- j = i + 2;
- }
- exit(0);
-}
diff --git a/games/trek/DOC/read_me.nr b/games/trek/DOC/read_me.nr
deleted file mode 100644
index 310b990..0000000
--- a/games/trek/DOC/read_me.nr
+++ /dev/null
@@ -1,252 +0,0 @@
-.\" $FreeBSD$
-.de @h
-'sp 4
-'tl 'TREK SETUP INSTRUCTIONS''%'
-'sp 2
-.ns
-..
-.de @f
-'bp
-..
-.wh 0 @h
-.wh -6 @f
-.de pp
-.sp
-.ne 2
-.ti +5
-..
-.de s1
-.sp 2
-.nr S1 +1
-.nr S2 0
-.ne 5
-.in 4
-.ti 0
-\\n(S1.\ \ \c
-..
-.de s2
-.sp 1
-.nr S2 +1
-.ne 3
-.in 8
-.ti 4
-\\n(S2.\ \ \c
-..
-.br
-.ce
-TREK SETUP INSTRUCTIONS
-.sp 2
-.pp
-This document describes all sorts of nifty things
-you should know
-before you start to muck around
-with the trek source code.
-Please read them carefully.
-.s1
-MAINTENANCE
-.s2
-There are a number of shell files
-which you may use to maintain the system.
-"Prtrek" produces a copy of the source code.
-It pipes its output to lpr
-and runs in background.
-"Comp" compiles up to nine source modules
-and leaves them in .o files.
-"Compile" is the same as "comp"
-except that it loads after compiling.
-If stated without any arguments,
-it loads from .o files.
-"Compall" compiles all the .c files
-into .o files,
-but does not load.
-It redirects its output to the file "output".
-To recompile the entire system,
-type
-.ti +8
-compall
-.ti +8
-compile
-.br
-.s2
-Main.c contains a variable called "Mother".
-This is initialized to the result of the
-"getuid()" call for the maintainer of trek
-at your installation.
-Only Mother is allowed to set trace flags
-and run the game at other than the default priority.
-.s2
-Speaking of priorities,
-trek eats up a lot of system resources.
-Hence, it normally runs at a very low priority.
-This makes it almost impossible to play
-if the system is loaded.
-However,
-the -pN flag sets the priority to N,
-which makes it possible to debug
-when the system is loaded.
-The default priority is set by a #define of
-PRIO,
-which is set to 10 in the default system.
-.s2
-Trace information is provided
-which may be useful in debugging things in the system.
-If you are in a bad way for space,
-comment out the #define xTRACE
-which appears in trek.h.
-This will cause the trace stuff to not occur
-in the object.
-.s2
-The version of trek released to you
-is compiled with the -f flag (for no floating point)
-and should work without problems on your machine.
-You can edit out the -f flag
-in "compile" if you have floating point hardware
-on your machine
-so that it will take less space.
-.s1
-THE PORTABLE C LIBRARY
-.pp
-The portable C library was used
-to do I/O in trek.
-Unfortunately,
-the version which we had at Berkeley
-had a number of small bugs
-which caused trek to do bad things at times.
-For some unknown reason
-(temporary insanity perhaps)
-I rewrote the portable C library.
-This version is much smaller than the old version
-and has cleaner code.
-It also works right
-(???).
-However, there are a few minor differences
-which you should be aware of.
-.s2
-Scanf no longer ignores the noise characters "\\n",
-"\\t", and space in the format string;
-i.e.,
-these characters now require a match
-in the input stream.
-.s2
-A variable
-f_log
-has been added
-which is the file descriptor
-of a "log" file.
-If f_log is greater than zero
-a copy of everything read from
-the standard input
-and written to
-the standard output
-is written in the file f_log.
-.s1
-DISCLAIMERS
-.s2
-Frankly,
-I am getting pretty sick of playing this game.
-Hence,
-the version which you get may have several bugs
-in it;
-I freely admit
-that it is probably buggier
-than some previous versions.
-Sorry about that.
-.s2
-Along with being buggy,
-the game never had quite everything implemented
-that was originally intended.
-If you see things that look weird,
-that may be why.
-There are even some features which I have taken out
-(like ghost starsystems)
-upon deciding that I didn't have the energy
-to implement them correctly.
-.s1
-REQUESTS
-.pp
-There are several things that I would like to ask of anyone
-who does work on the source code.
-.s2
-Please let me know of any bugs which you find
-in the code,
-and any fixes which you may have.
-Other copies will probably be going out to other people later,
-and it would be nice if those copies where less buggy.
-Also,
-I would be interested in hearing about any
-enhancements of the game which you might install.
-.s2
-Please note that I have a distinct coding style.
-I feel that it is cleaner
-and easier to read than a more
-casual style.
-If possible,
-please stick to it,
-especially if you end up sending tapes back to me.
-This goes along with my whole belief in clean code:
-I ask you to please avoid obscure code
-whenever possible.
-If you throw some in,
-please don't let me see it.
-It just depresses me.
-.s2
-Unfortunately,
-the game is huge.
-There are many neat things
-which could go in,
-if there were only enough space.
-However,
-I have specifically not gone to separated I/D
-space.
-The main reason is that I would like future versions
-of the game
-to be 11/40 compatible.
-.s1
-SUGGESTIONS FOR THE FUTURE
-.pp
-If you happen to have more energy than I do,
-you may want to examine the following areas.
-These are things that I may get to,
-but don't hold your breath.
-.s2
-Frankly,
-making the portable C library work
-(even without bugs)
-was a bitch.
-I should have done the I/O in a more
-ad hoc manner.
-It is my intent to rewrite the I/O
-routines to bypass the portable C library entirely.
-.s2
-The routine "capture" is quite unclean.
-First, it should have a manner of selecting Klingons
-other than random,
-either selecting the most likely
-or asking the captain (probably best).
-It should either be fully implemented,
-which includes adding a "board" routine
-(half written,
-on some tapes as board.x)
-which sends a boarding party to forcefully
-take over the Klingon,
-or it should go out completely,
-which is probably what I will end up doing.
-When this happens,
-the transporter will go completely.
-It seems that the space may be better used
-for something which more directly enhances the game.
-.sp 3
-.in 0
-Well, that's about it.
-To get hold of me,
-write to:
-.nf
-.sp
-Eric P Allman
-Electronics Research Laboratory
-University of California
-Berkeley, California 94720
-.fi
-
-Happy trekking!!
-.pp
diff --git a/games/trek/DOC/things b/games/trek/DOC/things
deleted file mode 100644
index 535a0c9..0000000
--- a/games/trek/DOC/things
+++ /dev/null
@@ -1,10 +0,0 @@
-* tractor beams
-* power distribution
-* Romulans:
-- plasma bolts
-- neutral zone
-- cloaking device
-* the thing
-* ion storms
-* torpedoes with time delays
-* Put removal from event list into killk
diff --git a/games/trek/DOC/trekmanual.nr b/games/trek/DOC/trekmanual.nr
deleted file mode 100644
index e882048..0000000
--- a/games/trek/DOC/trekmanual.nr
+++ /dev/null
@@ -1,896 +0,0 @@
-.\" $FreeBSD$
-.br
-.po 10
-.if n \!.
-.sp 15
-.tr ^ \"
-.ce 88
-^****^^^^*****^^^^^^*^^^^^^****^
-*^^^^^^^^^^*^^^^^^^*^*^^^^^*^^^*
-^***^^^^^^^*^^^^^^*****^^^^****^
-^^^^*^^^^^^*^^^^^^*^^^*^^^^*^^*^
-****^^^^^^^*^^^^^^*^^^*^^^^*^^^*
-
-
-*****^^^^****^^^^^*****^^^^*^^^*
-^^*^^^^^^*^^^*^^^^*^^^^^^^^*^^*^
-^^*^^^^^^****^^^^^***^^^^^^***^^
-^^*^^^^^^*^^*^^^^^*^^^^^^^^*^^*^
-^^*^^^^^^*^^^*^^^^*****^^^^*^^^*
-
-
-by
-
-Eric Allman
-University of California
-Berkeley
-.ce 0
-.tr ^^
-.de HE
-'sp 4
-'tl 'STAR TREK''%'
-'sp 3
-..
-.de FO
-'bp
-..
-.wh 0 HE
-.wh -5 FO
-.de pp
-.sp
-.ti +4
-..
-.bp 1
-.ce
-INTRODUCTION
-.pp
-Well, the federation is once again at war with the Klingon empire.
-It is up to you,
-as captain of the U.S.S. Enterprise,
-to wipe out the invasion fleet and save the Federation.
-.pp
-For the purposes of the game
-the galaxy is divided into 64 quadrants
-on an eight by eight grid,
-with quadrant 0,0 in the upper left hand corner.
-Each quadrant is divided into 100 sectors
-on a ten by ten grid.
-Each sector contains one object
-(e.g., the Enterprise, a Klingon, or a star).
-.pp
-Navigation is handled in degrees,
-with zero being straight up
-and ninety being to the right.
-Distances are measured in quadrants.
-One tenth quadrant is one sector.
-.pp
-The galaxy contains starbases,
-at which you can dock to refuel,
-repair damages, etc.
-The galaxy also contains stars.
-Stars usually have a knack for getting in your way,
-but they can be triggered into going nova
-by shooting a photon torpedo at one,
-thereby (hopefully) destroying any adjacent Klingons.
-This is not a good practice however,
-because you are penalized for destroying stars.
-Also, a star will sometimes go supernova,
-which obliterates an entire quadrant.
-You must never stop in a supernova quadrant,
-although you may "jump over" one.
-.pp
-Some starsystems
-have inhabited planets.
-Klingons can attack inhabited planets
-and enslave the populace,
-which they then put to work building more Klingon battle cruisers.
-.bp
-.ce
-STARTING UP THE GAME
-.pp
-To request the game, issue the command
-.sp
-.ti +12
-/usr/games/trek
-.sp
-from the shell.
-If a filename is stated,
-a log of the game is written
-onto that file.
-If omitted,
-the file is not written.
-If the "-a" flag is stated before the filename,
-that file is appended to
-rather than created.
-.pp
-The game will ask you what length game
-you would like.
-Valid responses are "short", "medium", and "long".
-Ideally the length of the game does not
-affect the difficulty,
-but currently the shorter games
-tend to be harder than the longer ones.
-You may also type "restart",
-which restarts a previously saved game.
-.pp
-You will then be prompted for the skill,
-to which you must respond
-"novice", "fair", "good", "expert",
-"commodore", or "impossible".
-You should start out with a novice
-and work up,
-but if you really want to see how fast
-you can be slaughtered,
-start out with an impossible game.
-.pp
-In general,
-throughout the game,
-if you forget what is appropriate
-the game will tell you what it expects
-if you just type in
-a question mark.
-.pp
-To get a copy of these rules,
-execute the command
-.sp
-.ti +12
-nroff /usr/games/trekmanual.nr
-.sp
-.bp
-.ce
-ISSUING COMMANDS
-.pp
-If the game expects you to enter a command,
-.hc ^
-it will say ^"Command:\ "
-and wait for your response.
-Most commands can be abbreviated.
-.pp
-At almost any time you can type more than one thing on a line.
-For example,
-to move straight up one quadrant,
-you can type
-.ti +12
-move 0 1
-.br
-or you could just type
-.ti +12
-move
-.br
-and the game would prompt you with
-.ti +12
-Course:
-.br
-to which you could type
-.ti +12
-0 1
-.br
-The "1" is the distance,
-which could be put on still another line.
-Also, the "move" command
-could have been abbreviated
-"mov", "mo", or just "m".
-.pp
-If you are partway through a command
-and you change your mind,
-you can usually type "-1"
-to cancel the command.
-.pp
-Klingons generally cannot hit you
-if you don't consume anything
-(e.g., time or energy),
-so some commands are considered "free".
-As soon as you consume anything though -- POW!
-.bp
-.de **
-.if \\n+l .**
-.as x *
-..
-.de bl
-.nr l \\w'\\$1' -\\w'*'
-.ds x ****
-.**
-.sp 3
-.ne 3
-\\*x
-.br
-.if t *\h'\w'*'u'\fB\\$1\fP\h'\w'*'u'*
-.if n * \\$1 *
-.br
-\\*x
-.sp
-.in +8
-.nf
-..
-.de FF
-.in -8
-.fi
-..
-.if !\n(.V .ta \w'Full Commands: '+1
-.if \n(.V .ta \w'Full Commands: 'u
-.ce
-THE COMMANDS
-.bl "Short Range Scan"
-Mnemonic: srscan
-Shortest Abbreviation: s
-Full Commands: srscan
- srscan yes/no
-Consumes: nothing
-.FF
-.pp
-The short range scan
-gives you a picture
-of the quadrant you are in,
-and (if you say "yes")
-a status report
-which tells you
-a whole bunch
-of interesting stuff.
-You can get a status report alone
-by using the
-.ul
-status
-command.
-An example follows:
-.sp
-.nf
-.in +4
-Short range sensor scan
- 0 1 2 3 4 5 6 7 8 9
-0 . . . . . . . * . * 0 stardate 3702.16
-1 . . E . . . . . . . 1 condition RED
-2 . . . . . . . . . * 2 position 0,3/1,2
-3 * . . . . # . . . . 3 warp factor 5.0
-4 . . . . . . . . . . 4 total energy 4376
-5 . . * . * . . . . . 5 torpedoes 9
-6 . . . @ . . . . . 6 shields down, 78%
-7 . . . . . . . . . . 7 Klingons left 3
-8 . . . K . . . . . . 8 time left 6.43
-9 . . . . . . * . . . 9 life support damaged, reserves = 2.4
- 0 1 2 3 4 5 6 7 8 9
-Distressed Starsystem Marcus XII
-
-.in +8
-.ti -8
-The cast of characters is as follows:
-E the hero
-K the villain
-# the starbase
-* stars
-@ inhabited starsystem
-\&. empty space
- a black hole
-.in -12
-.fi
-.pp
-The name of the starsystem is listed underneath
-the short range scan.
-The word "distressed", if present,
-means that the starsystem
-is under attack.
-.pp
-Short range scans are absolutely free.
-They use no time, no energy,
-and they don't give the Klingons
-another chance to hit you.
-.bl "Status Report"
-Mnemonic: status
-Shortest Abbreviation: st
-Consumes: nothing
-.FF
-.pp
-This command gives you information
-about the current status
-of the game and your ship, as follows:
-.in +8
-.de qq
-.sp
-.ti -4
-..
-.qq
-Stardate -- The current stardate.
-.qq
-Condition -- as follows:
-.in +4
-.nf
-RED -- in battle
-YELLOW -- low on energy
-GREEN -- normal state
-DOCKED -- docked at starbase
-CLOAKED -- the cloaking device is activated
-.fi
-.in -4
-.qq
-Position -- Your current quadrant and sector.
-.qq
-Warp Factor -- The speed you will move at
-when you move under warp power
-(with the
-.ul
-move
-command).
-.qq
-Total Energy -- Your energy reserves.
-If they drop to zero,
-you die.
-Energy regenerates,
-but the higher the skill of the game,
-the slower it regenerates.
-.qq
-Torpedoes -- How many photon torpedoes you have left.
-.qq
-Shields -- Whether your shields are up or down,
-and how effective they are if up
-(what percentage of a hit they will absorb).
-.qq
-Klingons Left -- Guess.
-.qq
-Time Left -- How long the Federation can hold out
-if you sit on your fat ass and do nothing.
-If you kill Klingons quickly,
-this number goes up,
-otherwise,
-it goes down.
-If it hits zero,
-the Federation is conquered.
-.qq
-Life Support -- If "active", everything is fine.
-If "damaged", your reserves tell you
-how long you have
-to repair your life support
-or get to a starbase
-before you starve, suffocate,
-or something equally unpleasant.
-.qq
-Current Crew -- The number of crew members
-left.
-This figures does not include officers.
-.qq
-Brig Space -- The space left in your brig
-for Klingon captives.
-.qq
-Klingon Power -- The number of units
-needed to kill a Klingon.
-Remember, as Klingons fire at you
-they use up their own energy,
-so you probably need somewhat less
-than this.
-.qq
-Skill, Length -- The skill and length
-of the game you are playing.
-.in -8
-.pp
-Status information is absolutely free.
-.bl "Long Range Scan"
-Mnemonic: lrscan
-Shortest Abbreviation: l
-Consumes: nothing
-.FF
-.pp
-Long range scan gives you information about the
-eight quadrants
-that surround the quadrant
-you're in.
-A sample long range scan follows:
-.sp
-.in +12
-.nf
-Long range scan for quadrant 0,3
-
- 2 3 4
- -------------------
- ! * ! * ! * !
- -------------------
-0 ! 108 ! 6 ! 19 !
- -------------------
-1 ! 9 ! /// ! 8 !
- -------------------
-.sp
-.in -12
-.fi
-.pp
-The three digit numbers
-tell the number of objects
-in the quadrants.
-The units digit tells the number of stars,
-the tens digit the number of starbases,
-and the hundreds digit is the number of Klingons.
-"*" indicates the negative energy barrier
-at the edge of the galaxy,
-which you cannot enter.
-"///" means that that is a supernova quadrant
-and must not be entered.
-.bl "Damage Report"
-Mnemonic: damages
-Shortest Abbreviation: da
-Consumes: nothing
-.FF
-.pp
-A damage report tells you what devices are damaged
-and how long it will take to repair them.
-Repairs proceed faster
-when you are docked
-at a starbase.
-.bl "Set Warp Factor"
-Mnemonic: warp
-Shortest Abbreviation: w
-Full Command: warp factor
-Consumes: nothing
-.FF
-.pp
-The warp factor tells the speed of your starship
-when you move under warp power
-(with the
-.ul
-move
-command).
-The higher the warp factor,
-the faster you go,
-and the more energy you use.
-.pp
-The minimum warp factor is 1.0
-and the maximum is 10.0.
-At speeds above warp 6
-there is danger of the warp engines
-being damaged.
-The probability of this
-increases at higher warp speeds.
-Above warp 9.0 there is a chance of entering
-a time warp.
-.bl "Move Under Warp Power"
-Mnemonic: move
-Shortest Abbreviation: m
-Full Command: move course distance
-Consumes: time and energy
-.FF
-.pp
-This is the usual way of moving.
-The course is in degrees and the distance is in quadrants.
-To move one sector specify a distance of 0.1.
-.pp
-Time is consumed proportionately to
-the inverse of the warp factor squared,
-and directly to the distance.
-Energy is consumed as the warp factor cubed,
-and directly to the distance.
-If you move with your shields up
-it doubles the amount of energy consumed.
-.pp
-When you move in a quadrant containing Klingons,
-they get a chance to attack you.
-.pp
-The computer detects navigation errors.
-If the computer is out,
-you run the risk of running into things.
-.pp
-The course is determined by the
-Space Inertial Navigation System
-[SINS].
-As described in
-Star Fleet Technical Order TO:02:06:12,
-the SINS is calibrated,
-after which it becomes the base for navigation.
-If damaged,
-navigation becomes inaccurate.
-When it is fixed,
-Spock recalibrates it,
-however,
-it cannot be calibrated extremely accurately
-until you dock at starbase.
-.bl "Move Under Impulse Power"
-Mnemonic: impulse
-Shortest Abbreviation: i
-Full Command: impulse course distance
-Consumes: time and energy
-.FF
-.pp
-The impulse engines give you a chance to maneuver
-when your warp engines are damaged;
-however, they are incredibly slow
-(0.095 quadrants/stardate).
-They require 20 units of energy to engage,
-and ten units per sector to move.
-.pp
-The same comments about the computer and the SINS
-apply as above.
-.pp
-There is no penalty to move under impulse power
-with shields up.
-.bl "Deflector Shields"
-Mnemonic: shields
-Shortest Abbreviation: sh
-Full Command: shields up/down
-Consumes: energy
-.FF
-.pp
-Shields protect you from Klingon attack
-and nearby novas.
-As they protect you,
-they weaken.
-A shield which is 78% effective
-will absorb 78% of a hit
-and let 22% in to hurt you.
-.pp
-The Klingons have a chance to attack you
-every time you raise or lower shields.
-Shields do not rise and lower
-instantaneously,
-so the hit you receive
-will be computed with the shields
-at an intermediate effectiveness.
-.pp
-It takes energy to raise shields,
-but not to drop them.
-.bl "Cloaking Device"
-Mnemonic: cloak
-Shortest Abbreviation: cl
-Full Command: cloak up/down
-Consumes: energy
-.FF
-.pp
-When you are cloaked,
-Klingons cannot see you,
-and hence they do not fire at you.
-They are useful for entering
-a quadrant
-and selecting a good position,
-however,
-weapons cannot be fired through
-the cloak
-due to the huge energy drain
-that it requires.
-.pp
-The cloak up command
-only starts the cloaking process;
-Klingons will continue
-to fire at you
-until you do something
-which consumes time.
-.bl "Fire Phasers"
-Mnemonic: phasers
-Shortest Abbreviation: p
-Full Commands: phasers automatic amount
- phasers manual amt1 course1 spread1 ...
-Consumes: energy
-.FF
-.pp
-Phasers are energy weapons;
-the energy comes from your ship's reserves
-("total energy" on a srscan).
-It takes about 250 units of hits
-to kill a Klingon.
-Hits are cumulative as long as you stay
-in the quadrant.
-.pp
-Phasers become less effective
-the further from a Klingon you are.
-Adjacent Klingons receive about
-90% of what you fire,
-at five sectors about 60%,
-and at ten sectors about 35%.
-They have no effect outside of the quadrant.
-.pp
-Phasers cannot be fired while shields are up;
-to do so would fry you.
-They have no effect on starbases or stars.
-.pp
-In automatic mode
-the computer decides how to divide up the energy
-among the Klingons present;
-in manual mode you do that yourself.
-.pp
-In manual mode firing
-you specify a direction,
-amount (number of units to fire)
-and spread (0 -> 1.0)
-for each of the six phaser banks.
-A zero amount
-terminates the manual input.
-.bl "Fire Photon Torpedoes"
-Mnemonic: torpedo
-Shortest Abbreviation: t
-Full Command: torpedo course [yes/no] [burst angle]
-Consumes: torpedoes
-.FF
-.pp
-Torpedoes are projectile weapons -- there are no partial hits.
-You either hit your target or you don't.
-A hit on a Klingon destroys him.
-A hit on a starbase destroys that starbase
-(woops!).
-Hitting a star usually causes it to go nova,
-and occasionally supernova.
-.pp
-Photon torpedoes cannot be aimed precisely.
-They can be fired with shields up,
-but they get even more random
-as they pass through the shields.
-.pp
-Torpedoes may be fired in bursts of three.
-If this is desired,
-the burst angle is the angle
-between the three shots,
-which may vary from one to fifteen.
-The word "no"
-says that a burst is not wanted;
-the word "yes"
-(which may be omitted
-if stated on the same line as the course)
-says that a burst is wanted.
-.pp
-Photon torpedoes
-have no effect
-outside the quadrant.
-.bl "Onboard Computer Request"
-Mnemonic: computer
-Shortest Abbreviation: c
-Full Command: computer request; request;...
-Consumes: nothing
-.FF
-.pp
-The computer command gives you access to the facilities
-of the onboard computer,
-which allows you to do all sorts of fascinating stuff.
-Computer requests are:
-.in +8
-.qq
-score -- Shows your current score.
-.qq
-course quad/sect -- Computes the course and distance from wherever
-you are to the given location.
-If you type "course /x,y"
-you will be given the course
-to sector x,y in the current quadrant.
-.qq
-move quad/sect -- Identical to the course
-request,
-except that the move is executed.
-.qq
-chart -- prints a chart of the known galaxy,
-i.e.,
-everything that you have seen with a long range scan.
-The format is the same as on a long range scan,
-except that "..." means
-that you don't yet know what is there,
-and ".1." means that you know that a starbase
-exists, but you don't know anything else.
-"$$$" mans the quadrant
-that you are currently in.
-.qq
-trajectory -- prints the course and distance
-to all the Klingons in the quadrant.
-.qq
-warpcost dist warp_factor -- computes the cost in time and energy
-to move `dist' quadrants at warp `warp_factor'.
-.qq
-impcost dist -- same as warpcost for impulse engines.
-.qq
-pheff range -- tells how effective your phasers are
-at a given range.
-.qq
-distresslist -- gives a list of currently distressed
-starbases
-and starsystems.
-.in -8
-.pp
-More than one request may be stated
-on a line
-by separating them
-with semicolons.
-.bl "Dock at Starbase"
-Mnemonic: dock
-Shortest Abbreviation: do
-Consumes: nothing
-.FF
-.pp
-You may dock at a starbase
-when you are in one of the eight
-adjacent sectors.
-.pp
-When you dock you are resupplied
-with energy, photon torpedoes, and life support reserves.
-Repairs are also done faster at starbase.
-Any prisoners you have taken
-are unloaded.
-You do not receive points
-for taking prisoners
-until this time.
-.pp
-Starbases have their own deflector shields,
-so you are safe from attack while docked.
-.bl "Undock from Starbase"
-Mnemonic: undock
-Shortest Abbreviation: u
-Consumes: nothing
-.FF
-.pp
-This just allows you to leave starbase
-so that you may proceed on your way.
-.bl "Rest"
-Mnemonic: rest
-Shortest Abbreviation: r
-Full Command: rest time
-Consumes: time
-.FF
-.pp
-This command allows you to rest to repair damages.
-It is not advisable to rest while under attack.
-.bl "Call Starbase For Help"
-Mnemonic: help
-Shortest Abbreviation: help
-Consumes: nothing
-.FF
-.pp
-You may call starbase for help via your subspace radio.
-Starbase has long range transporter beams to get you.
-Problem is,
-they can't always rematerialize you.
-.pp
-You should avoid using this command unless absolutely necessary,
-for the above reason and because it counts heavily against you
-in the scoring.
-.bl "Capture Klingon"
-Mnemonic: capture
-Shortest Abbreviation: ca
-Consumes: time
-.FF
-.pp
-You may request that a Klingon surrender
-to you.
-If he accepts,
-you get to take captives
-(but only as many as your brig
-can hold).
-It is good if you do this,
-because you get points for captives.
-Also,
-if you ever get captured,
-you want to be sure that the Federation
-has prisoners to exchange for you.
-.pp
-You must go to a starbase
-to turn over your prisoners
-to Federation authorities.
-.bl "Visual Scan"
-Mnemonic: visual
-Shortest Abbreviation: v
-Full Command: visual course
-Consumes: time
-.FF
-.pp
-When your short range scanners are out,
-you can still see what is out "there"
-by doing a visual scan.
-Unfortunately,
-you can only see three sectors at one time,
-and it takes 0.005 stardates to perform.
-.pp
-The three sectors in the general direction
-of the course specified
-are examined
-and displayed.
-.bl "Abandon Ship"
-Mnemonic: abandon
-Shortest Abbreviation: abandon
-Consumes: nothing
-.FF
-.pp
-The officers escape the Enterprise in the shuttlecraft.
-If the transporter is working
-and there is an inhabitable starsystem
-in the area,
-the crew beams down,
-otherwise you leave them to die.
-You are given an old but still usable ship,
-the Faire Queene.
-.bl "Ram"
-Mnemonic: ram
-Shortest Abbreviation: ram
-Full Command: ram course distance
-Consumes: time and energy
-.FF
-.pp
-This command is identical to "move",
-except that the computer
-doesn't stop you
-from making navigation errors.
-.pp
-You get very nearly slaughtered
-if you ram anything.
-.bl "Self Destruct"
-Mnemonic: destruct
-Shortest Abbreviation: destruct
-Consumes: everything
-.FF
-.pp
-Your starship is self-destructed.
-Chances are you will destroy
-any Klingons
-(and stars,
-and starbases)
-left in your quadrant.
-.bl "Terminate the Game"
-Mnemonic: terminate
-Shortest Abbreviation: terminate
-Full Command: terminate yes/no
-.FF
-.pp
-Cancels the current game.
-No score is computed.
-If you answer yes,
-a new game will be started,
-otherwise trek exits.
-.bl "Call the Shell"
-Mnemonic: shell
-Shortest Abbreviation: shell
-.FF
-.pp
-Temporarily escapes to the shell.
-When you log out of the shell
-you will return to the game.
-.bp
-.ce
-SCORING
-.in +4
-.pp
-The scoring algorithm is rather complicated.
-Basically,
-you get points for each Klingon you kill,
-for your Klingon per stardate kill rate,
-and a bonus if you win the game.
-You lose
-points for the number of Klingons left
-in the galaxy
-at the end of the game,
-for getting killed,
-for each star, starbase, or inhabited starsystem
-you destroy,
-for calling for help,
-and for each casualty you incur.
-.pp
-You will be promoted
-if you play very well.
-You will never get a promotion if you
-call for help,
-abandon the Enterprise,
-get killed,
-destroy a starbase or inhabited starsystem,
-or destroy too many stars.
-.bp
-.ce
-REFERENCE PAGE
-.sp 2
-.ta 36 56
-.nf
-.ul
-Command Uses Consumes
-
-ABANDON shuttlecraft, -
- transporter
-CApture subspace radio time
-CLoak Up/Down cloaking device energy
-Computer request; request;... computer -
-DAmages - -
-DESTRUCT computer -
-DOck - -
-HELP subspace radio -
-Impulse course distance impulse engines, time, energy
- computer, SINS
-Lrscan L.R. sensors -
-Move course distance warp engines, time, energy
- computer, SINS
-Phasers Automatic amount phasers, computer energy
-Phasers Manual amt1 course1 spread1 ... phasers energy
-Torpedo course [Yes] angle/No torpedo tubes torpedoes
-RAM course distance warp engines, time, energy
- computer, SINS
-Rest time - time
-SHELL - -
-SHields Up/Down shields energy
-Srscan [Yes/No] S.R. sensors -
-STatus - -
-TERMINATE Yes/No - -
-Undock - -
-Visual course - time
-Warp warp_factor - -
-.fi
diff --git a/games/trek/Makefile b/games/trek/Makefile
deleted file mode 100644
index daaa3c6..0000000
--- a/games/trek/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= trek
-SRCS= abandon.c attack.c autover.c capture.c check_out.c checkcond.c \
- compkl.c computer.c damage.c damaged.c dcrept.c destruct.c \
- dock.c dumpgame.c dumpme.c dumpssradio.c events.c externs.c \
- getcodi.c getpar.c help.c impulse.c initquad.c kill.c klmove.c \
- lose.c lrscan.c main.c move.c nova.c out.c phaser.c play.c ram.c \
- ranf.c rest.c schedule.c score.c setup.c setwarp.c \
- shield.c snova.c srscan.c systemname.c torped.c utility.c \
- visual.c warp.c win.c cgetc.c
-MAN= trek.6
-DPADD= ${LIBM} ${LIBCOMPAT}
-LDADD= -lm -lcompat
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/trek/USD.doc/Makefile b/games/trek/USD.doc/Makefile
deleted file mode 100644
index 342141c..0000000
--- a/games/trek/USD.doc/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-DIR= usd/31.trek
-SRCS= trek.me
-MACROS= -me
-
-paper.ps: ${SRCS}
- ${TBL} ${SRCS} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
diff --git a/games/trek/USD.doc/spell.ok b/games/trek/USD.doc/spell.ok
deleted file mode 100644
index d9d0405..0000000
--- a/games/trek/USD.doc/spell.ok
+++ /dev/null
@@ -1,72 +0,0 @@
-Allman
-Faire
-Klingon
-Klingons
-L.R
-Onboard
-Queene
-S.R
-Spock
-Starbase
-Starbases
-Stardate
-Starsystem
-TO:02:06:12
-Torpedoes
-Trek''USD:34
-U.S.S
-USD:34
-XII
-amt1
-anual
-arp
-atus
-ca
-ck
-cl
-course1
-da
-dist
-distresslist
-ds
-es
-est
-filename
-fo
-ft
-hasers
-ields
-impcost
-isual
-lrscan
-mages
-mo
-mov
-mpulse
-na
-ndock
-omputer
-onboard
-orpedo
-ove
-partway
-pheff
-pture
-rscan
-shuttlecraft
-spread1
-srscan
-st
-starbase
-starbases
-stardate
-stardates
-starsystem
-starsystems
-ta
-torpedoes
-trek.me
-utomatic
-warpcost
-woops
-x,y
diff --git a/games/trek/USD.doc/trek.me b/games/trek/USD.doc/trek.me
deleted file mode 100644
index 0d062a1..0000000
--- a/games/trek/USD.doc/trek.me
+++ /dev/null
@@ -1,950 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)trek.me 8.1 (Berkeley) 6/8/93
-.\" $FreeBSD$
-.\"
-.if n .na
-.de pp
-. sp 2
-. ti +5
-..
-.ie t .ds f \fB
-.el .ds f \fI
-.de he
-' sp
-' tl 'Star Trek''USD:31-%'
-'sp 3
-..
-.oh 'Star Trek''USD:31-%'
-.eh 'USD:31-%''Star Trek'
-
-\" .wh 0 he
-.de fo
-' bp
-..
-.wh -3 fo
-.sp 16
-.ce 1000
-.ie n \{\
-. tr |
-|****||||*****||||||*||||||****|
-*||||||||||*|||||||*|*|||||*|||*
-|***|||||||*||||||*****||||****|
-||||*||||||*||||||*|||*||||*||*|
-****|||||||*||||||*|||*||||*|||*
-.sp 2
-*****||||****|||||*****||||*|||*
-||*||||||*|||*||||*||||||||*||*|
-||*||||||****|||||***||||||***||
-||*||||||*||*|||||*||||||||*||*|
-||*||||||*|||*||||*****||||*|||*
-.sp 2
-. tr ||
-by
-.\}
-.el \{\
-. ps 24
-. vs 28p
-. ft B
-STAR
-
-TREK
-
-. ps
-. vs
-. ft
-. ft I
-by
-.f ft
-.\}
-
-Eric Allman
-University of California
-Berkeley
-.ce 0
-\".bp
-.ce
-\*fINTRODUCTION\fR
-.pp
-Well, the federation is once again at war with the Klingon empire.
-It is up to you,
-as captain of the U.S.S. Enterprise,
-to wipe out the invasion fleet and save the Federation.
-.pp
-For the purposes of the game
-the galaxy is divided into 64 quadrants
-on an eight by eight grid,
-with quadrant 0,0 in the upper left hand corner.
-Each quadrant is divided into 100 sectors
-on a ten by ten grid.
-Each sector contains one object
-(e.g., the Enterprise, a Klingon, or a star).
-.pp
-Navigation is handled in degrees,
-with zero being straight up
-and ninety being to the right.
-Distances are measured in quadrants.
-One tenth quadrant is one sector.
-.pp
-The galaxy contains starbases,
-at which you can dock to refuel,
-repair damages, etc.
-The galaxy also contains stars.
-Stars usually have a knack for getting in your way,
-but they can be triggered into going nova
-by shooting a photon torpedo at one,
-thereby (hopefully) destroying any adjacent Klingons.
-This is not a good practice however,
-because you are penalized for destroying stars.
-Also, a star will sometimes go supernova,
-which obliterates an entire quadrant.
-You must never stop in a supernova quadrant,
-although you may "jump over" one.
-.pp
-Some starsystems
-have inhabited planets.
-Klingons can attack inhabited planets
-and enslave the populace,
-which they then put to work building more Klingon battle cruisers.
-\".bp
-.ce
-\*fSTARTING UP THE GAME\fR
-.pp
-To request the game, issue the command
-.sp
-.ti +15
-.ft B
-/usr/games/trek
-.ft
-.sp
-from the shell.
-If a filename is supplied,
-a log of the game is written onto that file.
-(Otherwise, no
-file is written.)
-If the
-``\fB\-a\fP'' flag is stated before the filename,
-the log of the game is appended to the file.
-.pp
-The game will ask you what length game
-you would like.
-Valid responses are "short", "medium", and "long".
-You may also type "restart",
-which restarts a previously saved game.
-Ideally,
-the length of the game does not affect the difficulty,
-but currently the shorter games tend to be harder than the longer ones.
-.pp
-You will then be prompted for the skill,
-to which you must respond
-"novice", "fair", "good", "expert",
-"commodore", or "impossible".
-You should start out with a novice
-and work up,
-but if you really want to see
-how fast you can be slaughtered,
-start out with an impossible game.
-.pp
-In general,
-throughout the game,
-if you forget what is appropriate
-the game will tell you what it expects
-if you just type in
-a question mark.
-\".bp
-.ce
-\*fISSUING COMMANDS\fR
-.pp
-If the game expects you to enter a command,
-.hc ^
-it will say ^"Command:\ "
-and wait for your response.
-Most commands can be abbreviated.
-.pp
-At almost any time you can type more than one thing on a line.
-For example,
-to move straight up one quadrant,
-you can type
-.ti +12
-move 0 1
-.br
-or you could just type
-.ti +12
-move
-.br
-and the game would prompt you with
-.ti +12
-Course:
-.br
-to which you could type
-.ti +12
-0 1
-.br
-The "1" is the distance,
-which could be put on still another line.
-Also, the "move" command
-could have been abbreviated
-"mov", "mo", or just "m".
-.pp
-If you are partway through a command
-and you change your mind,
-you can usually type "-1"
-to cancel the command.
-.pp
-Klingons generally cannot hit you
-if you don't consume anything
-(e.g., time or energy),
-so some commands are considered "free".
-As soon as you consume anything though -- POW!
-.bp
-.de **
-.if \\n+l .**
-.as x *
-..
-.de bl
-.sp
-.ie t \fB\\$1\fR
-.el \{\
-. ne 3
-. nr l \\w'\\$1' -\\w'*'
-. ds x ****
-. **
-\\*x
-. br
-* \\$1 *
-. br
-\\*x
-.\}
-.sp
-.in +8
-.nf
-..
-.de FF
-.in -8
-.fi
-..
-.if !\n(.V .ta \w'Full Commands: '+1
-.if \n(.V .ta \w'Full Commands: 'u
-.ce
-\*fTHE COMMANDS\fR
-.bl "Short Range Scan"
-Mnemonic: srscan
-Shortest Abbreviation: s
-Full Commands: srscan
- srscan yes/no
-Consumes: nothing
-.FF
-.pp
-The short range scan
-gives you a picture
-of the quadrant you are in,
-and (if you say "yes")
-a status report
-which tells you
-a whole bunch
-of interesting stuff.
-You can get a status report alone
-by using the
-.ul
-status
-command.
-An example follows:
-.sp
-.in +4
-Short range sensor scan
-.TS
-le1 ce1 ce1 ce1 ce1 ce1 ce1 ce1 ce1 ce1 ce1 le3 l1 l.
- 0 1 2 3 4 5 6 7 8 9
-0 . . . . . . . * . * 0 stardate 3702.16
-1 . . E . . . . . . . 1 condition RED
-2 . . . . . . . . . * 2 position 0,3/1,2
-3 * . . . . # . . . . 3 warp\ factor 5.0
-4 . . . . . . . . . . 4 total\ energy 4376
-5 . . * . * . . . . . 5 torpedoes 9
-6 . . . @ . . \ . . . 6 shields down,\ 78%
-7 . . . . . . . . . . 7 Klingons\ left 3
-8 . . . K . . . . . . 8 time\ left 6.43
-9 . . . . . . * . . . 9 life\ support damaged,\ reserves\ =\ 2.4
- 0 1 2 3 4 5 6 7 8 9
-.TE
-Distressed Starsystem Marcus XII
-.sp
-.in +8
-.ti -8
-The cast of characters is as follows:
-.nf
-.ta \w'E 'u
-E the hero
-K the villain
-# the starbase
-* stars
-@ inhabited starsystem
-\&. empty space
- a black hole
-.in -12
-.fi
-.pp
-The name of the starsystem is listed underneath
-the short range scan.
-The word "distressed", if present,
-means that the starsystem
-is under attack.
-.pp
-Short range scans are absolutely free.
-They use no time, no energy,
-and they don't give the Klingons
-another chance to hit you.
-.bl "Status Report"
-Mnemonic: status
-Shortest Abbreviation: st
-Consumes: nothing
-.FF
-.pp
-This command gives you information
-about the current status
-of the game and your ship, as follows:
-.in +8
-.de qq
-.sp
-.ti -4
-..
-.qq
-Stardate -- The current stardate.
-.qq
-Condition -- as follows:
-.in +4
-.nf
-RED -- in battle
-YELLOW -- low on energy
-GREEN -- normal state
-DOCKED -- docked at starbase
-CLOAKED -- the cloaking device is activated
-.fi
-.in -4
-.qq
-Position -- Your current quadrant and sector.
-.qq
-Warp Factor -- The speed you will move at
-when you move under warp power
-(with the
-.ul
-move
-command).
-.qq
-Total Energy -- Your energy reserves.
-If they drop to zero,
-you die.
-Energy regenerates,
-but the higher the skill of the game,
-the slower it regenerates.
-.qq
-Torpedoes -- How many photon torpedoes you have left.
-.qq
-Shields -- Whether your shields are up or down,
-and how effective they are if up
-(what percentage of a hit they will absorb).
-.qq
-Klingons Left -- Guess.
-.qq
-Time Left -- How long the Federation can hold out
-if you sit on your fat ass and do nothing.
-If you kill Klingons quickly,
-this number goes up,
-otherwise,
-it goes down.
-If it hits zero,
-the Federation is conquered.
-.qq
-Life Support -- If "active", everything is fine.
-If "damaged", your reserves tell you
-how long you have
-to repair your life support
-or get to a starbase
-before you starve, suffocate,
-or something equally unpleasant.
-.qq
-Current Crew -- The number of crew members
-left.
-This figures does not include officers.
-.qq
-Brig Space -- The space left in your brig
-for Klingon captives.
-.qq
-Klingon Power -- The number of units
-needed to kill a Klingon.
-Remember, as Klingons fire at you
-they use up their own energy,
-so you probably need somewhat less
-than this.
-.qq
-Skill, Length -- The skill and length
-of the game you are playing.
-.in -8
-.pp
-Status information is absolutely free.
-.bl "Long Range Scan"
-Mnemonic: lrscan
-Shortest Abbreviation: l
-Consumes: nothing
-.FF
-.pp
-Long range scan gives you information about the
-eight quadrants
-that surround the quadrant
-you're in.
-A sample long range scan follows:
-.sp
-.in +12
-Long range scan for quadrant 0,3
-.TS
-l ce ce ce
-l | _ | _ | _ |
-l | c | c | c |
-l | _ | _ | _ |
-l | r | r | r |
-l | _ | _ | _ |
-l | r | r | r |
-l | _ | _ | _ |.
- 2 3 4
-
- * * *
-
-0 108 6 19
-
-1 9 /// 8
-
-.TE
-.in -12
-.pp
-The three digit numbers
-tell the number of objects
-in the quadrants.
-The units digit tells the number of stars,
-the tens digit the number of starbases,
-and the hundreds digit is the number of Klingons.
-"*" indicates the negative energy barrier
-at the edge of the galaxy,
-which you cannot enter.
-"///" means that that is a supernova quadrant
-and must not be entered.
-.bl "Damage Report"
-Mnemonic: damages
-Shortest Abbreviation: da
-Consumes: nothing
-.FF
-.pp
-A damage report tells you what devices are damaged
-and how long it will take to repair them.
-Repairs proceed faster
-when you are docked
-at a starbase.
-.bl "Set Warp Factor"
-Mnemonic: warp
-Shortest Abbreviation: w
-Full Command: warp factor
-Consumes: nothing
-.FF
-.pp
-The warp factor tells the speed of your starship
-when you move under warp power
-(with the
-.ul
-move
-command).
-The higher the warp factor,
-the faster you go,
-and the more energy you use.
-.pp
-The minimum warp factor is 1.0
-and the maximum is 10.0.
-At speeds above warp 6
-there is danger of the warp engines
-being damaged.
-The probability of this
-increases at higher warp speeds.
-Above warp 9.0 there is a chance of entering
-a time warp.
-.bl "Move Under Warp Power"
-Mnemonic: move
-Shortest Abbreviation: m
-Full Command: move course distance
-Consumes: time and energy
-.FF
-.pp
-This is the usual way of moving.
-The course is in degrees and the distance is in quadrants.
-To move one sector specify a distance of 0.1.
-.pp
-Time is consumed proportionately to
-the inverse of the warp factor squared,
-and directly to the distance.
-Energy is consumed as the warp factor cubed,
-and directly to the distance.
-If you move with your shields up
-it doubles the amount of energy consumed.
-.pp
-When you move in a quadrant containing Klingons,
-they get a chance to attack you.
-.pp
-The computer detects navigation errors.
-If the computer is out,
-you run the risk of running into things.
-.pp
-The course is determined by the
-Space Inertial Navigation System
-[SINS].
-As described in
-Star Fleet Technical Order TO:02:06:12,
-the SINS is calibrated,
-after which it becomes the base for navigation.
-If damaged,
-navigation becomes inaccurate.
-When it is fixed,
-Spock recalibrates it,
-however,
-it cannot be calibrated extremely accurately
-until you dock at starbase.
-.bl "Move Under Impulse Power"
-Mnemonic: impulse
-Shortest Abbreviation: i
-Full Command: impulse course distance
-Consumes: time and energy
-.FF
-.pp
-The impulse engines give you a chance to maneuver
-when your warp engines are damaged;
-however, they are incredibly slow
-(0.095 quadrants/stardate).
-They require 20 units of energy to engage,
-and ten units per sector to move.
-.pp
-The same comments about the computer and the SINS
-apply as above.
-.pp
-There is no penalty to move under impulse power
-with shields up.
-.bl "Deflector Shields"
-Mnemonic: shields
-Shortest Abbreviation: sh
-Full Command: shields up/down
-Consumes: energy
-.FF
-.pp
-Shields protect you from Klingon attack
-and nearby novas.
-As they protect you,
-they weaken.
-A shield which is 78% effective
-will absorb 78% of a hit
-and let 22% in to hurt you.
-.pp
-The Klingons have a chance to attack you
-every time you raise or lower shields.
-Shields do not rise and lower
-instantaneously,
-so the hit you receive
-will be computed with the shields
-at an intermediate effectiveness.
-.pp
-It takes energy to raise shields,
-but not to drop them.
-.bl "Cloaking Device"
-Mnemonic: cloak
-Shortest Abbreviation: cl
-Full Command: cloak up/down
-Consumes: energy
-.FF
-.pp
-When you are cloaked,
-Klingons cannot see you,
-and hence they do not fire at you.
-They are useful for entering
-a quadrant
-and selecting a good position,
-however,
-weapons cannot be fired through
-the cloak
-due to the huge energy drain
-that it requires.
-.pp
-The cloak up command
-only starts the cloaking process;
-Klingons will continue
-to fire at you
-until you do something
-which consumes time.
-.bl "Fire Phasers"
-Mnemonic: phasers
-Shortest Abbreviation: p
-Full Commands: phasers automatic amount
- phasers manual amt1 course1 spread1 ...
-Consumes: energy
-.FF
-.pp
-Phasers are energy weapons;
-the energy comes from your ship's reserves
-("total energy" on a srscan).
-It takes about 250 units of hits
-to kill a Klingon.
-Hits are cumulative as long as you stay
-in the quadrant.
-.pp
-Phasers become less effective
-the further from a Klingon you are.
-Adjacent Klingons receive about
-90% of what you fire,
-at five sectors about 60%,
-and at ten sectors about 35%.
-They have no effect outside of the quadrant.
-.pp
-Phasers cannot be fired while shields are up;
-to do so would fry you.
-They have no effect on starbases or stars.
-.pp
-In automatic mode
-the computer decides how to divide up the energy
-among the Klingons present;
-in manual mode you do that yourself.
-.pp
-In manual mode firing
-you specify a direction,
-amount (number of units to fire)
-and spread (0 -> 1.0)
-for each of the six phaser banks.
-A zero amount
-terminates the manual input.
-.bl "Fire Photon Torpedoes"
-Mnemonic: torpedo
-Shortest Abbreviation: t
-Full Command: torpedo course [yes/no] [burst angle]
-Consumes: torpedoes
-.FF
-.pp
-Torpedoes are projectile weapons -- there are no partial hits.
-You either hit your target or you don't.
-A hit on a Klingon destroys him.
-A hit on a starbase destroys that starbase
-(woops!).
-Hitting a star usually causes it to go nova,
-and occasionally supernova.
-.pp
-Photon torpedoes cannot be aimed precisely.
-They can be fired with shields up,
-but they get even more random
-as they pass through the shields.
-.pp
-Torpedoes may be fired in bursts of three.
-If this is desired,
-the burst angle is the angle
-between the three shots,
-which may vary from one to fifteen.
-The word "no"
-says that a burst is not wanted;
-the word "yes"
-(which may be omitted
-if stated on the same line as the course)
-says that a burst is wanted.
-.pp
-Photon torpedoes
-have no effect
-outside the quadrant.
-.bl "Onboard Computer Request"
-Mnemonic: computer
-Shortest Abbreviation: c
-Full Command: computer request; request;...
-Consumes: nothing
-.FF
-.pp
-The computer command gives you access to the facilities
-of the onboard computer,
-which allows you to do all sorts of fascinating stuff.
-Computer requests are:
-.in +8
-.qq
-score -- Shows your current score.
-.qq
-course quad/sect -- Computes the course and distance from wherever
-you are to the given location.
-If you type "course /x,y"
-you will be given the course
-to sector x,y in the current quadrant.
-.qq
-move quad/sect -- Identical to the course
-request,
-except that the move is executed.
-.qq
-chart -- prints a chart of the known galaxy,
-i.e.,
-everything that you have seen with a long range scan.
-The format is the same as on a long range scan,
-except that "..." means
-that you don't yet know what is there,
-and ".1." means that you know that a starbase
-exists, but you don't know anything else.
-"$$$" mans the quadrant
-that you are currently in.
-.qq
-trajectory -- prints the course and distance
-to all the Klingons in the quadrant.
-.qq
-warpcost dist warp_factor -- computes the cost in time and energy
-to move `dist' quadrants at warp `warp_factor'.
-.qq
-impcost dist -- same as warpcost for impulse engines.
-.qq
-pheff range -- tells how effective your phasers are
-at a given range.
-.qq
-distresslist -- gives a list of currently distressed
-starbases
-and starsystems.
-.in -8
-.pp
-More than one request may be stated
-on a line
-by separating them
-with semicolons.
-.bl "Dock at Starbase"
-Mnemonic: dock
-Shortest Abbreviation: do
-Consumes: nothing
-.FF
-.pp
-You may dock at a starbase
-when you are in one of the eight
-adjacent sectors.
-.pp
-When you dock you are resupplied
-with energy, photon torpedoes, and life support reserves.
-Repairs are also done faster at starbase.
-Any prisoners you have taken
-are unloaded.
-You do not receive points
-for taking prisoners
-until this time.
-.pp
-Starbases have their own deflector shields,
-so you are safe from attack while docked.
-.bl "Undock from Starbase"
-Mnemonic: undock
-Shortest Abbreviation: u
-Consumes: nothing
-.FF
-.pp
-This just allows you to leave starbase
-so that you may proceed on your way.
-.bl "Rest"
-Mnemonic: rest
-Shortest Abbreviation: r
-Full Command: rest time
-Consumes: time
-.FF
-.pp
-This command allows you to rest to repair damages.
-It is not advisable to rest while under attack.
-.bl "Call Starbase For Help"
-Mnemonic: help
-Shortest Abbreviation: help
-Consumes: nothing
-.FF
-.pp
-You may call starbase for help via your subspace radio.
-Starbase has long range transporter beams to get you.
-Problem is,
-they can't always rematerialize you.
-.pp
-You should avoid using this command unless absolutely necessary,
-for the above reason and because it counts heavily against you
-in the scoring.
-.bl "Capture Klingon"
-Mnemonic: capture
-Shortest Abbreviation: ca
-Consumes: time
-.FF
-.pp
-You may request that a Klingon surrender
-to you.
-If he accepts,
-you get to take captives
-(but only as many as your brig
-can hold).
-It is good if you do this,
-because you get points for captives.
-Also,
-if you ever get captured,
-you want to be sure that the Federation
-has prisoners to exchange for you.
-.pp
-You must go to a starbase
-to turn over your prisoners
-to Federation authorities.
-.bl "Visual Scan"
-Mnemonic: visual
-Shortest Abbreviation: v
-Full Command: visual course
-Consumes: time
-.FF
-.pp
-When your short range scanners are out,
-you can still see what is out "there"
-by doing a visual scan.
-Unfortunately,
-you can only see three sectors at one time,
-and it takes 0.005 stardates to perform.
-.pp
-The three sectors in the general direction
-of the course specified
-are examined
-and displayed.
-.bl "Abandon Ship"
-Mnemonic: abandon
-Shortest Abbreviation: abandon
-Consumes: nothing
-.FF
-.pp
-The officers escape the Enterprise in the shuttlecraft.
-If the transporter is working
-and there is an inhabitable starsystem
-in the area,
-the crew beams down,
-otherwise you leave them to die.
-You are given an old but still usable ship,
-the Faire Queene.
-.bl "Ram"
-Mnemonic: ram
-Shortest Abbreviation: ram
-Full Command: ram course distance
-Consumes: time and energy
-.FF
-.pp
-This command is identical to "move",
-except that the computer
-doesn't stop you
-from making navigation errors.
-.pp
-You get very nearly slaughtered
-if you ram anything.
-.bl "Self Destruct"
-Mnemonic: destruct
-Shortest Abbreviation: destruct
-Consumes: everything
-.FF
-.pp
-Your starship is self-destructed.
-Chances are you will destroy
-any Klingons
-(and stars,
-and starbases)
-left in your quadrant.
-.bl "Terminate the Game"
-Mnemonic: terminate
-Shortest Abbreviation: terminate
-Full Command: terminate yes/no
-.FF
-.pp
-Cancels the current game.
-No score is computed.
-If you answer yes,
-a new game will be started,
-otherwise trek exits.
-.bl "Call the Shell"
-Mnemonic: shell
-Shortest Abbreviation: shell
-.FF
-.pp
-Temporarily escapes to the shell.
-When you exit the shell
-you will return to the game.
-\".bp
-.ce
-\*fSCORING\fR
-.in +4
-.pp
-The scoring algorithm is rather complicated.
-Basically,
-you get points for each Klingon you kill,
-for your Klingon per stardate kill rate,
-and a bonus if you win the game.
-You lose
-points for the number of Klingons left
-in the galaxy
-at the end of the game,
-for getting killed,
-for each star, starbase, or inhabited starsystem
-you destroy,
-for calling for help,
-and for each casualty you incur.
-.pp
-You will be promoted
-if you play very well.
-You will never get a promotion if you
-call for help,
-abandon the Enterprise,
-get killed,
-destroy a starbase or inhabited starsystem,
-or destroy too many stars.
-.bp
-.ce 1
-\*fCOMMAND SUMMARY\fP
-.TS
-l l l.
-Command Requires Consumes
-
-\*fabandon\fR shuttlecraft, -
- transporter
-\*fca\fRpture subspace radio time
-\*fcl\fRoak \*fu\fRp/\*fd\fRown cloaking device energy
-\*fc\fRomputer request; ... computer -
-\*fda\fRmages - -
-\*fdestruct\fR computer -
-\*fdo\fRck - -
-\*fhelp\fR subspace radio -
-\*fi\fRmpulse course distance impulse engines, time, energy
- computer, SINS
-\*fl\fRrscan L.R. sensors -
-\*fm\fRove course distance warp engines, time, energy
- computer, SINS
-\*fp\fRhasers \*fa\fRutomatic amount phasers, computer energy \*fp\fRhasers \*fm\fRanual
-\ \ amt1 course1 spread1 ... phasers energy
-\*ft\fRorpedo course [\*fy\fRes] angle/\*fn\fRo torpedo tubes torpedoes
-\*fram\fR course distance warp engines, time, energy
- computer, SINS
-\*fr\fRest time - time
-\*fshell\fR - -
-\*fsh\fRields \*fu\fRp/\*fd\fRown shields energy
-\*fs\fRrscan [\*fy\fRes/\*fn\fRo] S.R. sensors -
-\*fst\fRatus - -
-\*fterminate\fR \*fy\fRes/\*fn\fRo - -
-\*fu\fRndock - -
-\*fv\fRisual course - time
-\*fw\fRarp warp_factor - -
-.TE
diff --git a/games/trek/abandon.c b/games/trek/abandon.c
deleted file mode 100644
index a156e49..0000000
--- a/games/trek/abandon.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)abandon.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Abandon Ship
-**
-** The ship is abandoned. If your current ship is the Faire
-** Queene, or if your shuttlecraft is dead, you're out of
-** luck. You need the shuttlecraft in order for the captain
-** (that's you!!) to escape.
-**
-** Your crew can beam to an inhabited starsystem in the
-** quadrant, if there is one and if the transporter is working.
-** If there is no inhabited starsystem, or if the transporter
-** is out, they are left to die in outer space.
-**
-** These currently just count as regular deaths, but they
-** should count very heavily against you.
-**
-** If there are no starbases left, you are captured by the
-** Klingons, who torture you mercilessly. However, if there
-** is at least one starbase, you are returned to the
-** Federation in a prisoner of war exchange. Of course, this
-** can't happen unless you have taken some prisoners.
-**
-** Uses trace flag 40
-*/
-
-abandon()
-{
- struct quad *q;
- int i;
- int j;
- struct event *e;
-
- if (Ship.ship == QUEENE)
- return (printf("You may not abandon ye Faire Queene\n"));
- if (Ship.cond != DOCKED)
- {
- if (damaged(SHUTTLE))
- return (out(SHUTTLE));
- printf("Officers escape in shuttlecraft\n");
- /* decide on fate of crew */
- q = &Quad[Ship.quadx][Ship.quady];
- if (q->qsystemname == 0 || damaged(XPORTER))
- {
- printf("Entire crew of %d left to die in outer space\n",
- Ship.crew);
- Game.deaths += Ship.crew;
- }
- else
- {
- printf("Crew beams down to planet %s\n", systemname(q));
- }
- }
- /* see if you can be exchanged */
- if (Now.bases == 0 || Game.captives < 20 * Game.skill)
- lose(L_CAPTURED);
- /* re-outfit new ship */
- printf("You are hereby put in charge of an antiquated but still\n");
- printf(" functional ship, the Fairie Queene.\n");
- Ship.ship = QUEENE;
- Ship.shipname = "Fairie Queene";
- Param.energy = Ship.energy = 3000;
- Param.torped = Ship.torped = 6;
- Param.shield = Ship.shield = 1250;
- Ship.shldup = 0;
- Ship.cloaked = 0;
- Ship.warp = 5.0;
- Ship.warp2 = 25.0;
- Ship.warp3 = 125.0;
- Ship.cond = GREEN;
- /* clear out damages on old ship */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
- unschedule(e);
- }
- /* get rid of some devices and redistribute probabilities */
- i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK];
- Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0;
- while (i > 0)
- for (j = 0; j < NDEV; j++)
- {
- if (Param.damprob[j] != 0)
- {
- Param.damprob[j] += 1;
- i--;
- if (i <= 0)
- break;
- }
- }
- /* pick a starbase to restart at */
- i = ranf(Now.bases);
- Ship.quadx = Now.base[i].x;
- Ship.quady = Now.base[i].y;
- /* setup that quadrant */
- while (1)
- {
- initquad(1);
- Sect[Ship.sectx][Ship.secty] = EMPTY;
- for (i = 0; i < 5; i++)
- {
- Ship.sectx = Etc.starbase.x + ranf(3) - 1;
- if (Ship.sectx < 0 || Ship.sectx >= NSECTS)
- continue;
- Ship.secty = Etc.starbase.y + ranf(3) - 1;
- if (Ship.secty < 0 || Ship.secty >= NSECTS)
- continue;
- if (Sect[Ship.sectx][Ship.secty] == EMPTY)
- {
- Sect[Ship.sectx][Ship.secty] = QUEENE;
- dock();
- compkldist(0);
- return;
- }
- }
- }
-}
diff --git a/games/trek/attack.c b/games/trek/attack.c
deleted file mode 100644
index 7068228..0000000
--- a/games/trek/attack.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)attack.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Klingon Attack Routine
-**
-** This routine performs the Klingon attack provided that
-** (1) Something happened this move (i.e., not free), and
-** (2) You are not cloaked. Note that if you issue the
-** cloak command, you are not considered cloaked until you
-** expend some time.
-**
-** Klingons are permitted to move both before and after the
-** attack. They will tend to move toward you before the
-** attack and away from you after the attack.
-**
-** Under certain conditions you can get a critical hit. This
-** sort of hit damages devices. The probability that a given
-** device is damaged depends on the device. Well protected
-** devices (such as the computer, which is in the core of the
-** ship and has considerable redundancy) almost never get
-** damaged, whereas devices which are exposed (such as the
-** warp engines) or which are particularly delicate (such as
-** the transporter) have a much higher probability of being
-** damaged.
-**
-** The actual amount of damage (i.e., how long it takes to fix
-** it) depends on the amount of the hit and the "damfac[]"
-** entry for the particular device.
-**
-** Casualties can also occur.
-*/
-
-attack(resting)
-int resting; /* set if attack while resting */
-{
- int hit, i, l;
- int maxhit, tothit, shldabsb;
- double chgfac, propor, extradm;
- double dustfac, tothe;
- int cas;
- int hitflag;
-
- if (Move.free)
- return;
- if (Etc.nkling <= 0 || Quad[Ship.quadx][Ship.quady].stars < 0)
- return;
- if (Ship.cloaked && Ship.cloakgood)
- return;
- /* move before attack */
- klmove(0);
- if (Ship.cond == DOCKED)
- {
- if (!resting)
- printf("Starbase shields protect the %s\n", Ship.shipname);
- return;
- }
- /* setup shield effectiveness */
- chgfac = 1.0;
- if (Move.shldchg)
- chgfac = 0.25 + 0.50 * franf();
- maxhit = tothit = 0;
- hitflag = 0;
-
- /* let each Klingon do his damndest */
- for (i = 0; i < Etc.nkling; i++)
- {
- /* if he's low on power he won't attack */
- if (Etc.klingon[i].power < 20)
- continue;
- if (!hitflag)
- {
- printf("\nStardate %.2f: Klingon attack:\n",
- Now.date);
- hitflag++;
- }
- /* complete the hit */
- dustfac = 0.90 + 0.01 * franf();
- tothe = Etc.klingon[i].avgdist;
- hit = Etc.klingon[i].power * pow(dustfac, tothe) * Param.hitfac;
- /* deplete his energy */
- dustfac = Etc.klingon[i].power;
- Etc.klingon[i].power = dustfac * Param.phasfac * (1.0 + (franf() - 0.5) * 0.2);
- /* see how much of hit shields will absorb */
- shldabsb = 0;
- if (Ship.shldup || Move.shldchg)
- {
- propor = Ship.shield;
- propor /= Param.shield;
- shldabsb = propor * chgfac * hit;
- if (shldabsb > Ship.shield)
- shldabsb = Ship.shield;
- Ship.shield -= shldabsb;
- }
- /* actually do the hit */
- printf("HIT: %d units", hit);
- if (!damaged(SRSCAN))
- printf(" from %d,%d", Etc.klingon[i].x, Etc.klingon[i].y);
- cas = (shldabsb * 100) / hit;
- hit -= shldabsb;
- if (shldabsb > 0)
- printf(", shields absorb %d%%, effective hit %d\n",
- cas, hit);
- else
- printf("\n");
- tothit += hit;
- if (hit > maxhit)
- maxhit = hit;
- Ship.energy -= hit;
- /* see if damages occurred */
- if (hit >= (15 - Game.skill) * (25 - ranf(12)))
- {
- printf("CRITICAL HIT!!!\n");
- /* select a device from probability vector */
- cas = ranf(1000);
- for (l = 0; cas >= 0; l++)
- cas -= Param.damprob[l];
- l -= 1;
- /* compute amount of damage */
- extradm = (hit * Param.damfac[l]) / (75 + ranf(25)) + 0.5;
- /* damage the device */
- damage(l, extradm);
- if (damaged(SHIELD))
- {
- if (Ship.shldup)
- printf("Sulu: Shields knocked down, captain.\n");
- Ship.shldup = 0;
- Move.shldchg = 0;
- }
- }
- if (Ship.energy <= 0)
- lose(L_DSTRYD);
- }
-
- /* see what our casualities are like */
- if (maxhit >= 200 || tothit >= 500)
- {
- cas = tothit * 0.015 * franf();
- if (cas >= 2)
- {
- printf("McCoy: we suffered %d casualties in that attack.\n",
- cas);
- Game.deaths += cas;
- Ship.crew -= cas;
- }
- }
-
- /* allow Klingons to move after attacking */
- klmove(1);
-
- return;
-}
diff --git a/games/trek/autover.c b/games/trek/autover.c
deleted file mode 100644
index ac01d27..0000000
--- a/games/trek/autover.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)autover.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Automatic Override
-**
-** If we should be so unlucky as to be caught in a quadrant
-** with a supernova in it, this routine is called. It is
-** called from checkcond().
-**
-** It sets you to a random warp (guaranteed to be over 6.0)
-** and starts sending you off "somewhere" (whereever that is).
-**
-** Please note that it is VERY important that you reset your
-** warp speed after the automatic override is called. The new
-** warp factor does not stay in effect for just this routine.
-**
-** This routine will never try to send you more than sqrt(2)
-** quadrants, since that is all that is needed.
-*/
-
-autover()
-{
- double dist;
- int course;
-
- printf("\07RED ALERT: The %s is in a supernova quadrant\n", Ship.shipname);
- printf("*** Emergency override attempts to hurl %s to safety\n", Ship.shipname);
- /* let's get our ass out of here */
- Ship.warp = 6.0 + 2.0 * franf();
- Ship.warp2 = Ship.warp * Ship.warp;
- Ship.warp3 = Ship.warp2 * Ship.warp;
- dist = 0.75 * Ship.energy / (Ship.warp3 * (Ship.shldup + 1));
- if (dist > 1.4142)
- dist = 1.4142;
- course = ranf(360);
- Etc.nkling = -1;
- Ship.cond = RED;
- warp(-1, course, dist);
- attack(0);
-}
diff --git a/games/trek/capture.c b/games/trek/capture.c
deleted file mode 100644
index 7e66dd4..0000000
--- a/games/trek/capture.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Ask a Klingon To Surrender
-**
-** (Fat chance)
-**
-** The Subspace Radio is needed to ask a Klingon if he will kindly
-** surrender. A random Klingon from the ones in the quadrant is
-** chosen.
-**
-** The Klingon is requested to surrender. The probability of this
-** is a function of that Klingon's remaining power, our power,
-** etc.
-*/
-
-capture()
-{
- int i;
- struct kling *k;
- double x;
- extern struct kling *selectklingon();
-
- /* check for not cloaked */
- if (Ship.cloaked)
- {
- printf("Ship-ship communications out when cloaked\n");
- return;
- }
- if (damaged(SSRADIO))
- return (out(SSRADIO));
- /* find out if there are any at all */
- if (Etc.nkling <= 0)
- {
- printf("Uhura: Getting no response, sir\n");
- return;
- }
-
- /* if there is more than one Klingon, find out which one */
- k = selectklingon();
- Move.free = 0;
- Move.time = 0.05;
-
- /* check out that Klingon */
- k->srndreq++;
- x = Param.klingpwr;
- x *= Ship.energy;
- x /= k->power * Etc.nkling;
- x *= Param.srndrprob;
- i = x;
-# ifdef xTRACE
- if (Trace)
- printf("Prob = %d (%.4f)\n", i, x);
-# endif
- if (i > ranf(100))
- {
- /* guess what, he surrendered!!! */
- printf("Klingon at %d,%d surrenders\n", k->x, k->y);
- i = ranf(Param.klingcrew);
- if ( i > 0 )
- printf("%d klingons commit suicide rather than be taken captive\n", Param.klingcrew - i);
- if (i > Ship.brigfree)
- i = Ship.brigfree;
- Ship.brigfree -= i;
- printf("%d captives taken\n", i);
- killk(k->x, k->y);
- return;
- }
-
- /* big surprise, he refuses to surrender */
- printf("Fat chance, captain\n");
- return;
-}
-
-
-/*
-** SELECT A KLINGON
-**
-** Cruddy, just takes one at random. Should ask the captain.
-*/
-
-struct kling *selectklingon()
-{
- int i;
-
- if (Etc.nkling < 2)
- i = 0;
- else
- i = ranf(Etc.nkling);
- return (&Etc.klingon[i]);
-}
diff --git a/games/trek/cgetc.c b/games/trek/cgetc.c
deleted file mode 100644
index 3d25b16..0000000
--- a/games/trek/cgetc.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cgetc.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdio.h>
-
-char cgetc(i)
-int i;
-{
- return ( getchar() );
-}
diff --git a/games/trek/check_out.c b/games/trek/check_out.c
deleted file mode 100644
index 0297858..0000000
--- a/games/trek/check_out.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)check_out.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** CHECK IF A DEVICE IS OUT
-**
-** The indicated device is checked to see if it is disabled. If
-** it is, an attempt is made to use the starbase device. If both
-** of these fails, it returns non-zero (device is REALLY out),
-** otherwise it returns zero (I can get to it somehow).
-**
-** It prints appropriate messages too.
-*/
-
-check_out(device)
-int device;
-{
- int dev;
-
- dev = device;
-
- /* check for device ok */
- if (!damaged(dev))
- return (0);
-
- /* report it as being dead */
- out(dev);
-
- /* but if we are docked, we can go ahead anyhow */
- if (Ship.cond != DOCKED)
- return (1);
- printf(" Using starbase %s\n", Device[dev].name);
- return (0);
-}
diff --git a/games/trek/checkcond.c b/games/trek/checkcond.c
deleted file mode 100644
index 894be50..0000000
--- a/games/trek/checkcond.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)checkcond.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Check for Condition After a Move
-**
-** Various ship conditions are checked. First we check
-** to see if we have already lost the game, due to running
-** out of life support reserves, running out of energy,
-** or running out of crew members. The check for running
-** out of time is in events().
-**
-** If we are in automatic override mode (Etc.nkling < 0), we
-** don't want to do anything else, lest we call autover
-** recursively.
-**
-** In the normal case, if there is a supernova, we call
-** autover() to help us escape. If after calling autover()
-** we are still in the grips of a supernova, we get burnt
-** up.
-**
-** If there are no Klingons in this quadrant, we nullify any
-** distress calls which might exist.
-**
-** We then set the condition code, based on the energy level
-** and battle conditions.
-*/
-
-checkcond()
-{
- int i, j;
-
- /* see if we are still alive and well */
- if (Ship.reserves < 0.0)
- lose(L_NOLIFE);
- if (Ship.energy <= 0)
- lose(L_NOENGY);
- if (Ship.crew <= 0)
- lose(L_NOCREW);
- /* if in auto override mode, ignore the rest */
- if (Etc.nkling < 0)
- return;
- /* call in automatic override if appropriate */
- if (Quad[Ship.quadx][Ship.quady].stars < 0)
- autover();
- if (Quad[Ship.quadx][Ship.quady].stars < 0)
- lose(L_SNOVA);
- /* nullify distress call if appropriate */
- if (Etc.nkling <= 0)
- killd(Ship.quadx, Ship.quady, 1);
-
- /* set condition code */
- if (Ship.cond == DOCKED)
- return;
-
- if (Etc.nkling > 0)
- {
- Ship.cond = RED;
- return;
- }
- if (Ship.energy < Param.energylow)
- {
- Ship.cond = YELLOW;
- return;
- }
- Ship.cond = GREEN;
- return;
-}
diff --git a/games/trek/compkl.c b/games/trek/compkl.c
deleted file mode 100644
index 90bf951..0000000
--- a/games/trek/compkl.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)compkl.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** compute klingon distances
-**
-** The klingon list has the distances for all klingons recomputed
-** and sorted. The parameter is a Boolean flag which is set if
-** we have just entered a new quadrant.
-**
-** This routine is used every time the Enterprise or the Klingons
-** move.
-*/
-
-compkldist(f)
-int f; /* set if new quadrant */
-{
- int i, dx, dy;
- double d;
- double temp;
-
- if (Etc.nkling == 0)
- return;
- for (i = 0; i < Etc.nkling; i++)
- {
- /* compute distance to the Klingon */
- dx = Ship.sectx - Etc.klingon[i].x;
- dy = Ship.secty - Etc.klingon[i].y;
- d = dx * dx + dy * dy;
- d = sqrt(d);
-
- /* compute average of new and old distances to Klingon */
- if (!f)
- {
- temp = Etc.klingon[i].dist;
- Etc.klingon[i].avgdist = 0.5 * (temp + d);
- }
- else
- {
- /* new quadrant: average is current */
- Etc.klingon[i].avgdist = d;
- }
- Etc.klingon[i].dist = d;
- }
-
- /* leave them sorted */
- sortkl();
-}
-
-
-/*
-** sort klingons
-**
-** bubble sort on ascending distance
-*/
-
-sortkl()
-{
- struct kling t;
- int f, i, m;
-
- m = Etc.nkling - 1;
- f = 1;
- while (f)
- {
- f = 0;
- for (i = 0; i < m; i++)
- if (Etc.klingon[i].dist > Etc.klingon[i+1].dist)
- {
- bmove(&Etc.klingon[i], &t, sizeof t);
- bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof t);
- bmove(&t, &Etc.klingon[i+1], sizeof t);
- f = 1;
- }
- }
-}
diff --git a/games/trek/computer.c b/games/trek/computer.c
deleted file mode 100644
index d374c0f..0000000
--- a/games/trek/computer.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-# include <stdio.h>
-/*
-** On-Board Computer
-**
-** A computer request is fetched from the captain. The requests
-** are:
-**
-** chart -- print a star chart of the known galaxy. This includes
-** every quadrant that has ever had a long range or
-** a short range scan done of it, plus the location of
-** all starbases. This is of course updated by any sub-
-** space radio broadcasts (unless the radio is out).
-** The format is the same as that of a long range scan
-** except that ".1." indicates that a starbase exists
-** but we know nothing else.
-**
-** trajectory -- gives the course and distance to every know
-** Klingon in the quadrant. Obviously this fails if the
-** short range scanners are out.
-**
-** course -- gives a course computation from whereever you are
-** to any specified location. If the course begins
-** with a slash, the current quadrant is taken.
-** Otherwise the input is quadrant and sector coordi-
-** nates of the target sector.
-**
-** move -- identical to course, except that the move is performed.
-**
-** score -- prints out the current score.
-**
-** pheff -- "PHaser EFFectiveness" at a given distance. Tells
-** you how much stuff you need to make it work.
-**
-** warpcost -- Gives you the cost in time and units to move for
-** a given distance under a given warp speed.
-**
-** impcost -- Same for the impulse engines.
-**
-** distresslist -- Gives a list of the currently known starsystems
-** or starbases which are distressed, together with their
-** quadrant coordinates.
-**
-** If a command is terminated with a semicolon, you remain in
-** the computer; otherwise, you escape immediately to the main
-** command processor.
-*/
-
-struct cvntab Cputab[] =
-{
- "ch", "art", (int (*)())1, 0,
- "t", "rajectory", (int (*)())2, 0,
- "c", "ourse", (int (*)())3, 0,
- "m", "ove", (int (*)())3, 1,
- "s", "core", (int (*)())4, 0,
- "p", "heff", (int (*)())5, 0,
- "w", "arpcost", (int (*)())6, 0,
- "i", "mpcost", (int (*)())7, 0,
- "d", "istresslist", (int (*)())8, 0,
- 0
-};
-
-computer()
-{
- int ix, iy;
- int i, j;
- int numout;
- int tqx, tqy;
- struct cvntab *r;
- int cost;
- int course;
- double dist, time;
- double warpfact;
- struct quad *q;
- struct event *e;
-
- if (check_out(COMPUTER))
- return;
- while (1)
- {
- r = getcodpar("\nRequest", Cputab);
- switch ((long)r->value)
- {
-
- case 1: /* star chart */
- printf("Computer record of galaxy for all long range sensor scans\n\n");
- printf(" ");
- /* print top header */
- for (i = 0; i < NQUADS; i++)
- printf("-%d- ", i);
- printf("\n");
- for (i = 0; i < NQUADS; i++)
- {
- printf("%d ", i);
- for (j = 0; j < NQUADS; j++)
- {
- if (i == Ship.quadx && j == Ship.quady)
- {
- printf("$$$ ");
- continue;
- }
- q = &Quad[i][j];
- /* 1000 or 1001 is special case */
- if (q->scanned >= 1000)
- if (q->scanned > 1000)
- printf(".1. ");
- else
- printf("/// ");
- else
- if (q->scanned < 0)
- printf("... ");
- else
- printf("%3d ", q->scanned);
- }
- printf("%d\n", i);
- }
- printf(" ");
- /* print bottom footer */
- for (i = 0; i < NQUADS; i++)
- printf("-%d- ", i);
- printf("\n");
- break;
-
- case 2: /* trajectory */
- if (check_out(SRSCAN))
- {
- break;
- }
- if (Etc.nkling <= 0)
- {
- printf("No Klingons in this quadrant\n");
- break;
- }
- /* for each Klingon, give the course & distance */
- for (i = 0; i < Etc.nkling; i++)
- {
- printf("Klingon at %d,%d", Etc.klingon[i].x, Etc.klingon[i].y);
- course = kalc(Ship.quadx, Ship.quady, Etc.klingon[i].x, Etc.klingon[i].y, &dist);
- prkalc(course, dist);
- }
- break;
-
- case 3: /* course calculation */
- if (readdelim('/'))
- {
- tqx = Ship.quadx;
- tqy = Ship.quady;
- }
- else
- {
- ix = getintpar("Quadrant");
- if (ix < 0 || ix >= NSECTS)
- break;
- iy = getintpar("q-y");
- if (iy < 0 || iy >= NSECTS)
- break;
- tqx = ix;
- tqy = iy;
- }
- ix = getintpar("Sector");
- if (ix < 0 || ix >= NSECTS)
- break;
- iy = getintpar("s-y");
- if (iy < 0 || iy >= NSECTS)
- break;
- course = kalc(tqx, tqy, ix, iy, &dist);
- if (r->value2)
- {
- warp(-1, course, dist);
- break;
- }
- printf("%d,%d/%d,%d to %d,%d/%d,%d",
- Ship.quadx, Ship.quady, Ship.sectx, Ship.secty, tqx, tqy, ix, iy);
- prkalc(course, dist);
- break;
-
- case 4: /* score */
- score();
- break;
-
- case 5: /* phaser effectiveness */
- dist = getfltpar("range");
- if (dist < 0.0)
- break;
- dist *= 10.0;
- cost = pow(0.90, dist) * 98.0 + 0.5;
- printf("Phasers are %d%% effective at that range\n", cost);
- break;
-
- case 6: /* warp cost (time/energy) */
- dist = getfltpar("distance");
- if (dist < 0.0)
- break;
- warpfact = getfltpar("warp factor");
- if (warpfact <= 0.0)
- warpfact = Ship.warp;
- cost = (dist + 0.05) * warpfact * warpfact * warpfact;
- time = Param.warptime * dist / (warpfact * warpfact);
- printf("Warp %.2f distance %.2f cost %.2f stardates %d (%d w/ shlds up) units\n",
- warpfact, dist, time, cost, cost + cost);
- break;
-
- case 7: /* impulse cost */
- dist = getfltpar("distance");
- if (dist < 0.0)
- break;
- cost = 20 + 100 * dist;
- time = dist / 0.095;
- printf("Distance %.2f cost %.2f stardates %d units\n",
- dist, time, cost);
- break;
-
- case 8: /* distresslist */
- j = 1;
- printf("\n");
- /* scan the event list */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- /* ignore hidden entries */
- if (e->evcode & E_HIDDEN)
- continue;
- switch (e->evcode & E_EVENT)
- {
-
- case E_KDESB:
- printf("Klingon is attacking starbase in quadrant %d,%d\n",
- e->x, e->y);
- j = 0;
- break;
-
- case E_ENSLV:
- case E_REPRO:
- printf("Starsystem %s in quadrant %d,%d is distressed\n",
- Systemname[e->systemname], e->x, e->y);
- j = 0;
- break;
- }
- }
- if (j)
- printf("No known distress calls are active\n");
- break;
-
- }
-
- /* skip to next semicolon or newline. Semicolon
- * means get new computer request; newline means
- * exit computer mode. */
- while ((i = cgetc(0)) != ';')
- {
- if (i == '\0')
- exit(1);
- if (i == '\n')
- {
- ungetc(i, stdin);
- return;
- }
- }
- }
-}
-
-
-/*
-** Course Calculation
-**
-** Computes and outputs the course and distance from position
-** sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy.
-*/
-
-kalc(tqx, tqy, tsx, tsy, dist)
-int tqx;
-int tqy;
-int tsx;
-int tsy;
-double *dist;
-{
- double dx, dy;
- double quadsize;
- double angle;
- int course;
-
- /* normalize to quadrant distances */
- quadsize = NSECTS;
- dx = (Ship.quadx + Ship.sectx / quadsize) - (tqx + tsx / quadsize);
- dy = (tqy + tsy / quadsize) - (Ship.quady + Ship.secty / quadsize);
-
- /* get the angle */
- angle = atan2(dy, dx);
- /* make it 0 -> 2 pi */
- if (angle < 0.0)
- angle += 6.283185307;
- /* convert from radians to degrees */
- course = angle * 57.29577951 + 0.5;
- dx = dx * dx + dy * dy;
- *dist = sqrt(dx);
- return (course);
-}
-
-
-prkalc(course, dist)
-int course;
-double dist;
-{
- printf(": course %d dist %.3f\n", course, dist);
-}
diff --git a/games/trek/damage.c b/games/trek/damage.c
deleted file mode 100644
index 8d312eb..0000000
--- a/games/trek/damage.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)damage.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Schedule Ship.damages to a Device
-**
-** Device `dev1' is damaged in an amount `dam'. Dam is measured
-** in stardates, and is an additional amount of damage. It should
-** be the amount to occur in non-docked mode. The adjustment
-** to docked mode occurs automatically if we are docked.
-**
-** Note that the repair of the device occurs on a DATE, meaning
-** that the dock() and undock() have to reschedule the event.
-*/
-
-damage(dev1, dam)
-int dev1; /* device index */
-double dam; /* time to repair */
-{
- int i;
- struct event *e;
- int f;
- int dev;
-
- /* ignore zero damages */
- if (dam <= 0.0)
- return;
- dev = dev1;
-
- printf("\t%s damaged\n", Device[dev].name);
-
- /* find actual length till it will be fixed */
- if (Ship.cond == DOCKED)
- dam *= Param.dockfac;
- /* set the damage flag */
- f = damaged(dev);
- if (!f)
- {
- /* new damages -- schedule a fix */
- schedule(E_FIXDV, dam, 0, 0, dev);
- return;
- }
- /* device already damaged -- add to existing damages */
- /* scan for old damages */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV || e->systemname != dev)
- continue;
- /* got the right one; add on the new damages */
- reschedule(e, e->date - Now.date + dam);
- return;
- }
- syserr("Cannot find old damages %d\n", dev);
-}
diff --git a/games/trek/damaged.c b/games/trek/damaged.c
deleted file mode 100644
index 3ba0d97..0000000
--- a/games/trek/damaged.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)damaged.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/* DAMAGED -- check for device damaged
-**
-** This is a boolean function which returns non-zero if the
-** specified device is broken. It does this by checking the
-** event list for a "device fix" action on that device.
-*/
-
-damaged(dev)
-int dev;
-{
- int d;
- struct event *e;
- int i;
-
- d = dev;
-
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
- if (e->systemname == d)
- return (1);
- }
-
- /* device fix not in event list -- device must not be broken */
- return (0);
-}
diff --git a/games/trek/dcrept.c b/games/trek/dcrept.c
deleted file mode 100644
index 1cd1ad0..0000000
--- a/games/trek/dcrept.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dcrept.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** damage control report
-**
-** Print damages and time to fix. This is taken from the event
-** list. A couple of factors are set up, based on whether or not
-** we are docked. (One of these factors will always be 1.0.)
-** The event list is then scanned for damage fix events, the
-** time until they occur is determined, and printed out. The
-** magic number DAMFAC is used to tell how much faster you can
-** fix things if you are docked.
-*/
-
-dcrept()
-{
- int i, f;
- double x;
- double m1, m2;
- struct event *e;
-
- /* set up the magic factors to output the time till fixed */
- if (Ship.cond == DOCKED)
- {
- m1 = 1.0 / Param.dockfac;
- m2 = 1.0;
- }
- else
- {
- m1 = 1.0;
- m2 = Param.dockfac;
- }
- printf("Damage control report:\n");
- f = 1;
-
- /* scan for damages */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
-
- /* output the title first time */
- if (f)
- {
- printf("\t\t\t repair times\n");
- printf("device\t\t\tin flight docked\n");
- f = 0;
- }
-
- /* compute time till fixed, then adjust by the magic factors */
- x = e->date - Now.date;
- printf("%-24s%7.2f %7.2f\n",
- Device[e->systemname].name, x * m1 + 0.005, x * m2 + 0.005);
-
- /* do a little consistancy checking */
- }
-
- /* if everything was ok, reassure the nervous captain */
- if (f)
- printf("All devices functional\n");
-}
diff --git a/games/trek/destruct.c b/games/trek/destruct.c
deleted file mode 100644
index afa4a75..0000000
--- a/games/trek/destruct.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)destruct.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Self Destruct Sequence
-**
-** The computer starts up the self destruct sequence. Obviously,
-** if the computer is out nothing can happen. You get a countdown
-** and a request for password. This must match the password that
-** you entered at the start of the game.
-**
-** You get to destroy things when you blow up; hence, it is
-** possible to win the game by destructing if you take the last
-** Klingon with you.
-**
-** By the way, the \032 in the message is a ^Z, which is because
-** the terminal in my office is an ADM-3, which uses that char-
-** acter to clear the screen. I also stick in a \014 (form feed)
-** because that clears some other screens.
-**
-** Uses trace flag 41
-*/
-
-destruct()
-{
- char checkpass[15];
- int i, j;
- double zap;
-
- if (damaged(COMPUTER))
- return (out(COMPUTER));
- printf("\n\07 --- WORKING ---\07\n");
- sleep(3);
- /* output the count 10 9 8 7 6 */
- for (i = 10; i > 5; i--)
- {
- for (j = 10; j > i; j--)
- printf(" ");
- printf("%d\n", i);
- sleep(1);
- }
- /* check for password on new line only */
- skiptonl(0);
- getstrpar("Enter password verification", checkpass, 14, 0);
- sleep(2);
- if (!sequal(checkpass, Game.passwd))
- return (printf("Self destruct sequence aborted\n"));
- printf("Password verified; self destruct sequence continues:\n");
- sleep(2);
- /* output count 5 4 3 2 1 0 */
- for (i = 5; i >= 0; i--)
- {
- sleep(1);
- for (j = 5; j > i; j--)
- printf(" ");
- printf("%d\n", i);
- }
- sleep(2);
- printf("\032\014***** %s destroyed *****\n", Ship.shipname);
- Game.killed = 1;
- /* let's see what we can blow up!!!! */
- zap = 20.0 * Ship.energy;
- Game.deaths += Ship.crew;
- for (i = 0; i < Etc.nkling; )
- {
- if (Etc.klingon[i].power * Etc.klingon[i].dist <= zap)
- killk(Etc.klingon[i].x, Etc.klingon[i].y);
- else
- i++;
- }
- /* if we didn't kill the last Klingon (detected by killk), */
- /* then we lose.... */
- lose(L_DSTRCT);
-}
diff --git a/games/trek/dock.c b/games/trek/dock.c
deleted file mode 100644
index 42515b7..0000000
--- a/games/trek/dock.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dock.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** DOCK TO STARBASE
-**
-** The starship is docked to a starbase. For this to work you
-** must be adjacent to a starbase.
-**
-** You get your supplies replenished and your captives are
-** disembarked. Note that your score is updated now, not when
-** you actually take the captives.
-**
-** Any repairs that need to be done are rescheduled to take
-** place sooner. This provides for the faster repairs when you
-** are docked.
-*/
-
-dock()
-{
- int i, j;
- int ok;
- struct event *e;
-
- if (Ship.cond == DOCKED)
- return (printf("Chekov: But captain, we are already docked\n"));
- /* check for ok to dock, i.e., adjacent to a starbase */
- ok = 0;
- for (i = Ship.sectx - 1; i <= Ship.sectx + 1 && !ok; i++)
- {
- if (i < 0 || i >= NSECTS)
- continue;
- for (j = Ship.secty - 1; j <= Ship.secty + 1; j++)
- {
- if (j < 0 || j >= NSECTS)
- continue;
- if (Sect[i][j] == BASE)
- {
- ok++;
- break;
- }
- }
- }
- if (!ok)
- return (printf("Chekov: But captain, we are not adjacent to a starbase.\n"));
-
- /* restore resources */
- Ship.energy = Param.energy;
- Ship.torped = Param.torped;
- Ship.shield = Param.shield;
- Ship.crew = Param.crew;
- Game.captives += Param.brigfree - Ship.brigfree;
- Ship.brigfree = Param.brigfree;
-
- /* reset ship's defenses */
- Ship.shldup = 0;
- Ship.cloaked = 0;
- Ship.cond = DOCKED;
- Ship.reserves = Param.reserves;
-
- /* recalibrate space inertial navigation system */
- Ship.sinsbad = 0;
-
- /* output any saved radio messages */
- dumpssradio();
-
- /* reschedule any device repairs */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
- reschedule(e, (e->date - Now.date) * Param.dockfac);
- }
- return;
-}
-
-
-/*
-** LEAVE A STARBASE
-**
-** This is the inverse of dock(). The main function it performs
-** is to reschedule any damages so that they will take longer.
-*/
-
-undock()
-{
- struct event *e;
- int i;
-
- if (Ship.cond != DOCKED)
- {
- printf("Sulu: Pardon me captain, but we are not docked.\n");
- return;
- }
- Ship.cond = GREEN;
- Move.free = 0;
-
- /* reschedule device repair times (again) */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
- reschedule(e, (e->date - Now.date) / Param.dockfac);
- }
- return;
-}
diff --git a/games/trek/dumpgame.c b/games/trek/dumpgame.c
deleted file mode 100644
index d9f935e..0000000
--- a/games/trek/dumpgame.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <fcntl.h>
-
-# include "trek.h"
-
-/*** THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/
-# define VERSION 2
-
-struct dump
-{
- char *area;
- int count;
-};
-
-
-struct dump Dump_template[] =
-{
- (char *)&Ship, sizeof (Ship),
- (char *)&Now, sizeof (Now),
- (char *)&Param, sizeof (Param),
- (char *)&Etc, sizeof (Etc),
- (char *)&Game, sizeof (Game),
- (char *)Sect, sizeof (Sect),
- (char *)Quad, sizeof (Quad),
- (char *)&Move, sizeof (Move),
- (char *)Event, sizeof (Event),
- 0
-};
-
-/*
-** DUMP GAME
-**
-** This routine dumps the game onto the file "trek.dump". The
-** first two bytes of the file are a version number, which
-** reflects whether this image may be used. Obviously, it must
-** change as the size, content, or order of the data structures
-** output change.
-*/
-
-dumpgame()
-{
- int version;
- int fd;
- struct dump *d;
- int i;
-
- if ((fd = creat("trek.dump", 0644)) < 0)
- return (printf("cannot dump\n"));
- version = VERSION;
- write(fd, &version, sizeof version);
-
- /* output the main data areas */
- for (d = Dump_template; d->area; d++)
- {
- write(fd, &d->area, sizeof d->area);
- i = d->count;
- write(fd, d->area, i);
- }
-
- close(fd);
-}
-
-
-/*
-** RESTORE GAME
-**
-** The game is restored from the file "trek.dump". In order for
-** this to succeed, the file must exist and be readable, must
-** have the correct version number, and must have all the appro-
-** priate data areas.
-**
-** Return value is zero for success, one for failure.
-*/
-
-restartgame()
-{
- int fd;
- int version;
-
- if ((fd = open("trek.dump", O_RDONLY)) < 0 ||
- read(fd, &version, sizeof version) != sizeof version ||
- version != VERSION ||
- readdump(fd))
- {
- printf("cannot restart\n");
- close(fd);
- return (1);
- }
-
- close(fd);
- return (0);
-}
-
-
-/*
-** READ DUMP
-**
-** This is the business end of restartgame(). It reads in the
-** areas.
-**
-** Returns zero for success, one for failure.
-*/
-
-readdump(fd1)
-int fd1;
-{
- int fd;
- struct dump *d;
- int i;
- long junk;
-
- fd = fd1;
-
- for (d = Dump_template; d->area; d++)
- {
- if (read(fd, &junk, sizeof junk) != (sizeof junk))
- return (1);
- if ((char *)junk != d->area)
- return (1);
- i = d->count;
- if (read(fd, d->area, i) != i)
- return (1);
- }
-
- /* make quite certain we are at EOF */
- return (read(fd, &junk, 1));
-}
diff --git a/games/trek/dumpme.c b/games/trek/dumpme.c
deleted file mode 100644
index cb4c9d2..0000000
--- a/games/trek/dumpme.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dumpme.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Dump the starship somewhere in the galaxy
-**
-** Parameter is zero if bounce off of negative energy barrier,
-** one if through a black hole
-**
-** Note that the quadrant is NOT initialized here. This must
-** be done from the calling routine.
-**
-** Repair of devices must be deferred.
-*/
-
-dumpme(flag)
-int flag;
-{
- int f;
- double x;
- struct event *e;
- int i;
-
- f = flag;
- Ship.quadx = ranf(NQUADS);
- Ship.quady = ranf(NQUADS);
- Ship.sectx = ranf(NSECTS);
- Ship.secty = ranf(NSECTS);
- x += 1.5 * franf();
- Move.time += x;
- if (f)
- {
- printf("%s falls into a black hole.\n", Ship.shipname);
- }
- else
- {
- printf("Computer applies full reverse power to avoid hitting the\n");
- printf(" negative energy barrier. A space warp was entered.\n");
- }
- /* bump repair dates forward */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode != E_FIXDV)
- continue;
- reschedule(e, (e->date - Now.date) + x);
- }
- events(1);
- printf("You are now in quadrant %d,%d. It is stardate %.2f\n",
- Ship.quadx, Ship.quady, Now.date);
- Move.time = 0;
-}
diff --git a/games/trek/dumpssradio.c b/games/trek/dumpssradio.c
deleted file mode 100644
index 79d95ef..0000000
--- a/games/trek/dumpssradio.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dumpssradio.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/**
- ** output hidden distress calls
- **/
-
-dumpssradio()
-{
- struct event *e;
- int j;
- int chkrest;
-
- chkrest = 0;
- for (j = 0; j < MAXEVENTS; j++)
- {
- e = &Event[j];
- /* if it is not hidden, then just ignore it */
- if ((e->evcode & E_HIDDEN) == 0)
- continue;
- if (e->evcode & E_GHOST)
- {
- unschedule(e);
- printf("Starsystem %s in quadrant %d,%d is no longer distressed\n",
- systemname(e), e->x, e->y);
- continue;
- }
-
- switch (e->evcode)
- {
-
- case E_KDESB:
- printf("Starbase in quadrant %d,%d is under attack\n",
- e->x, e->y);
- chkrest++;
- break;
-
- case E_ENSLV:
- case E_REPRO:
- printf("Starsystem %s in quadrant %d,%d is distressed\n",
- systemname(e), e->x, e->y);
- chkrest++;
- break;
-
- }
- }
-
- return (chkrest);
-}
diff --git a/games/trek/events.c b/games/trek/events.c
deleted file mode 100644
index 97b98fb..0000000
--- a/games/trek/events.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)events.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** CAUSE TIME TO ELAPSE
-**
-** This routine does a hell of a lot. It elapses time, eats up
-** energy, regenerates energy, processes any events that occur,
-** and so on.
-*/
-
-
-events(warp)
-int warp; /* set if called in a time warp */
-{
- int i;
- int j;
- struct kling *k;
- double rtime;
- double xdate;
- double idate;
- struct event *ev, *xsched(), *schedule();
- int ix, iy;
- struct quad *q;
- struct event *e;
- int evnum;
- int restcancel;
-
- /* if nothing happened, just allow for any Klingons killed */
- if (Move.time <= 0.0)
- {
- Now.time = Now.resource / Now.klings;
- return (0);
- }
-
- /* indicate that the cloaking device is now working */
- Ship.cloakgood = 1;
-
- /* idate is the initial date */
- idate = Now.date;
-
- /* schedule attacks if resting too long */
- if (Move.time > 0.5 && Move.resting)
- schedule(E_ATTACK, 0.5, 0, 0, 0);
-
- /* scan the event list */
- while (1)
- {
- restcancel = 0;
- evnum = -1;
- /* xdate is the date of the current event */
- xdate = idate + Move.time;
-
- /* find the first event that has happened */
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode == 0 || (e->evcode & E_GHOST))
- continue;
- if (e->date < xdate)
- {
- xdate = e->date;
- ev = e;
- evnum = i;
- }
- }
- e = ev;
-
- /* find the time between events */
- rtime = xdate - Now.date;
-
- /* decrement the magic "Federation Resources" pseudo-variable */
- Now.resource -= Now.klings * rtime;
- /* and recompute the time left */
- Now.time = Now.resource / Now.klings;
-
- /* move us up to the next date */
- Now.date = xdate;
-
- /* check for out of time */
- if (Now.time <= 0.0)
- lose(L_NOTIME);
-# ifdef xTRACE
- if (evnum >= 0 && Trace)
- printf("xdate = %.2f, evcode %d params %d %d %d\n",
- xdate, e->evcode, e->x, e->y, e->systemname);
-# endif
-
- /* if evnum < 0, no events occurred */
- if (evnum < 0)
- break;
-
- /* otherwise one did. Find out what it is */
- switch (e->evcode & E_EVENT)
- {
-
- case E_SNOVA: /* supernova */
- /* cause the supernova to happen */
- snova(-1);
- /* and schedule the next one */
- xresched(e, E_SNOVA, 1);
- break;
-
- case E_LRTB: /* long range tractor beam */
- /* schedule the next one */
- xresched(e, E_LRTB, Now.klings);
- /* LRTB cannot occur if we are docked */
- if (Ship.cond != DOCKED)
- {
- /* pick a new quadrant */
- i = ranf(Now.klings) + 1;
- for (ix = 0; ix < NQUADS; ix++)
- {
- for (iy = 0; iy < NQUADS; iy++)
- {
- q = &Quad[ix][iy];
- if (q->stars >= 0)
- if ((i -= q->klings) <= 0)
- break;
- }
- if (i <= 0)
- break;
- }
-
- /* test for LRTB to same quadrant */
- if (Ship.quadx == ix && Ship.quady == iy)
- break;
-
- /* nope, dump him in the new quadrant */
- Ship.quadx = ix;
- Ship.quady = iy;
- printf("\n%s caught in long range tractor beam\n", Ship.shipname);
- printf("*** Pulled to quadrant %d,%d\n", Ship.quadx, Ship.quady);
- Ship.sectx = ranf(NSECTS);
- Ship.secty = ranf(NSECTS);
- initquad(0);
- /* truncate the move time */
- Move.time = xdate - idate;
- }
- break;
-
- case E_KATSB: /* Klingon attacks starbase */
- /* if out of bases, forget it */
- if (Now.bases <= 0)
- {
- unschedule(e);
- break;
- }
-
- /* check for starbase and Klingons in same quadrant */
- for (i = 0; i < Now.bases; i++)
- {
- ix = Now.base[i].x;
- iy = Now.base[i].y;
- /* see if a Klingon exists in this quadrant */
- q = &Quad[ix][iy];
- if (q->klings <= 0)
- continue;
-
- /* see if already distressed */
- for (j = 0; j < MAXEVENTS; j++)
- {
- e = &Event[j];
- if ((e->evcode & E_EVENT) != E_KDESB)
- continue;
- if (e->x == ix && e->y == iy)
- break;
- }
- if (j < MAXEVENTS)
- continue;
-
- /* got a potential attack */
- break;
- }
- e = ev;
- if (i >= Now.bases)
- {
- /* not now; wait a while and see if some Klingons move in */
- reschedule(e, 0.5 + 3.0 * franf());
- break;
- }
- /* schedule a new attack, and a destruction of the base */
- xresched(e, E_KATSB, 1);
- e = xsched(E_KDESB, 1, ix, iy, 0);
-
- /* report it if we can */
- if (!damaged(SSRADIO))
- {
- printf("\nUhura: Captain, we have recieved a distress signal\n");
- printf(" from the starbase in quadrant %d,%d.\n",
- ix, iy);
- restcancel++;
- }
- else
- /* SSRADIO out, make it so we can't see the distress call */
- /* but it's still there!!! */
- e->evcode |= E_HIDDEN;
- break;
-
- case E_KDESB: /* Klingon destroys starbase */
- unschedule(e);
- q = &Quad[e->x][e->y];
- /* if the base has mysteriously gone away, or if the Klingon
- got tired and went home, ignore this event */
- if (q->bases <=0 || q->klings <= 0)
- break;
- /* are we in the same quadrant? */
- if (e->x == Ship.quadx && e->y == Ship.quady)
- {
- /* yep, kill one in this quadrant */
- printf("\nSpock: ");
- killb(Ship.quadx, Ship.quady);
- }
- else
- /* kill one in some other quadrant */
- killb(e->x, e->y);
- break;
-
- case E_ISSUE: /* issue a distress call */
- xresched(e, E_ISSUE, 1);
- /* if we already have too many, throw this one away */
- if (Ship.distressed >= MAXDISTR)
- break;
- /* try a whole bunch of times to find something suitable */
- for (i = 0; i < 100; i++)
- {
- ix = ranf(NQUADS);
- iy = ranf(NQUADS);
- q = &Quad[ix][iy];
- /* need a quadrant which is not the current one,
- which has some stars which are inhabited and
- not already under attack, which is not
- supernova'ed, and which has some Klingons in it */
- if (!((ix == Ship.quadx && iy == Ship.quady) || q->stars < 0 ||
- (q->qsystemname & Q_DISTRESSED) ||
- (q->qsystemname & Q_SYSTEM) == 0 || q->klings <= 0))
- break;
- }
- if (i >= 100)
- /* can't seem to find one; ignore this call */
- break;
-
- /* got one!! Schedule its enslavement */
- Ship.distressed++;
- e = xsched(E_ENSLV, 1, ix, iy, q->qsystemname);
- q->qsystemname = (e - Event) | Q_DISTRESSED;
-
- /* tell the captain about it if we can */
- if (!damaged(SSRADIO))
- {
- printf("\nUhura: Captain, starsystem %s in quadrant %d,%d is under attack\n",
- Systemname[e->systemname], ix, iy);
- restcancel++;
- }
- else
- /* if we can't tell him, make it invisible */
- e->evcode |= E_HIDDEN;
- break;
-
- case E_ENSLV: /* starsystem is enslaved */
- unschedule(e);
- /* see if current distress call still active */
- q = &Quad[e->x][e->y];
- if (q->klings <= 0)
- {
- /* no Klingons, clean up */
- /* restore the system name */
- q->qsystemname = e->systemname;
- break;
- }
-
- /* play stork and schedule the first baby */
- e = schedule(E_REPRO, Param.eventdly[E_REPRO] * franf(), e->x, e->y, e->systemname);
-
- /* report the disaster if we can */
- if (!damaged(SSRADIO))
- {
- printf("\nUhura: We've lost contact with starsystem %s\n",
- Systemname[e->systemname]);
- printf(" in quadrant %d,%d.\n",
- e->x, e->y);
- }
- else
- e->evcode |= E_HIDDEN;
- break;
-
- case E_REPRO: /* Klingon reproduces */
- /* see if distress call is still active */
- q = &Quad[e->x][e->y];
- if (q->klings <= 0)
- {
- unschedule(e);
- q->qsystemname = e->systemname;
- break;
- }
- xresched(e, E_REPRO, 1);
- /* reproduce one Klingon */
- ix = e->x;
- iy = e->y;
- if (Now.klings == 127)
- break; /* full right now */
- if (q->klings >= MAXKLQUAD)
- {
- /* this quadrant not ok, pick an adjacent one */
- for (i = ix - 1; i <= ix + 1; i++)
- {
- if (i < 0 || i >= NQUADS)
- continue;
- for (j = iy - 1; j <= iy + 1; j++)
- {
- if (j < 0 || j >= NQUADS)
- continue;
- q = &Quad[i][j];
- /* check for this quad ok (not full & no snova) */
- if (q->klings >= MAXKLQUAD || q->stars < 0)
- continue;
- break;
- }
- if (j <= iy + 1)
- break;
- }
- if (j > iy + 1)
- /* cannot create another yet */
- break;
- ix = i;
- iy = j;
- }
- /* deliver the child */
- q->klings++;
- Now.klings++;
- if (ix == Ship.quadx && iy == Ship.quady)
- {
- /* we must position Klingon */
- sector(&ix, &iy);
- Sect[ix][iy] = KLINGON;
- k = &Etc.klingon[Etc.nkling++];
- k->x = ix;
- k->y = iy;
- k->power = Param.klingpwr;
- k->srndreq = 0;
- compkldist(Etc.klingon[0].dist == Etc.klingon[0].avgdist ? 0 : 1);
- }
-
- /* recompute time left */
- Now.time = Now.resource / Now.klings;
- break;
-
- case E_SNAP: /* take a snapshot of the galaxy */
- xresched(e, E_SNAP, 1);
- i = (int) Etc.snapshot;
- i = bmove(Quad, i, sizeof (Quad));
- i = bmove(Event, i, sizeof (Event));
- i = bmove(&Now, i, sizeof (Now));
- Game.snap = 1;
- break;
-
- case E_ATTACK: /* Klingons attack during rest period */
- if (!Move.resting)
- {
- unschedule(e);
- break;
- }
- attack(1);
- reschedule(e, 0.5);
- break;
-
- case E_FIXDV:
- i = e->systemname;
- unschedule(e);
-
- /* de-damage the device */
- printf("%s reports repair work on the %s finished.\n",
- Device[i].person, Device[i].name);
-
- /* handle special processing upon fix */
- switch (i)
- {
-
- case LIFESUP:
- Ship.reserves = Param.reserves;
- break;
-
- case SINS:
- if (Ship.cond == DOCKED)
- break;
- printf("Spock has tried to recalibrate your Space Internal Navigation System,\n");
- printf(" but he has no standard base to calibrate to. Suggest you get\n");
- printf(" to a starbase immediately so that you can properly recalibrate.\n");
- Ship.sinsbad = 1;
- break;
-
- case SSRADIO:
- restcancel = dumpssradio();
- break;
- }
- break;
-
- default:
- break;
- }
-
- if (restcancel && Move.resting && getynpar("Spock: Shall we cancel our rest period"))
- Move.time = xdate - idate;
-
- }
-
- /* unschedule an attack during a rest period */
- if (e = Now.eventptr[E_ATTACK])
- unschedule(e);
-
- if (!warp)
- {
- /* eat up energy if cloaked */
- if (Ship.cloaked)
- Ship.energy -= Param.cloakenergy * Move.time;
-
- /* regenerate resources */
- rtime = 1.0 - exp(-Param.regenfac * Move.time);
- Ship.shield += (Param.shield - Ship.shield) * rtime;
- Ship.energy += (Param.energy - Ship.energy) * rtime;
-
- /* decrement life support reserves */
- if (damaged(LIFESUP) && Ship.cond != DOCKED)
- Ship.reserves -= Move.time;
- }
- return (0);
-}
diff --git a/games/trek/externs.c b/games/trek/externs.c
deleted file mode 100644
index 428eaf4..0000000
--- a/games/trek/externs.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)externs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** global variable definitions
-*/
-
-struct device Device[NDEV] =
-{
- "warp drive", "Scotty",
- "S.R. scanners", "Scotty",
- "L.R. scanners", "Scotty",
- "phasers", "Sulu",
- "photon tubes", "Sulu",
- "impulse engines", "Scotty",
- "shield control", "Sulu",
- "computer", "Spock",
- "subspace radio", "Uhura",
- "life support", "Scotty",
- "navigation system", "Chekov",
- "cloaking device", "Scotty",
- "transporter", "Scotty",
- "shuttlecraft", "Scotty",
- "*ERR 14*", "Nobody",
- "*ERR 15*", "Nobody"
-};
-
-char *Systemname[NINHAB] =
-{
- "ERROR",
- "Talos IV",
- "Rigel III",
- "Deneb VII",
- "Canopus V",
- "Icarus I",
- "Prometheus II",
- "Omega VII",
- "Elysium I",
- "Scalos IV",
- "Procyon IV",
- "Arachnid I",
- "Argo VIII",
- "Triad III",
- "Echo IV",
- "Nimrod III",
- "Nemisis IV",
- "Centarurus I",
- "Kronos III",
- "Spectros V",
- "Beta III",
- "Gamma Tranguli VI",
- "Pyris III",
- "Triachus",
- "Marcus XII",
- "Kaland",
- "Ardana",
- "Stratos",
- "Eden",
- "Arrikis",
- "Epsilon Eridani IV",
- "Exo III"
-};
diff --git a/games/trek/getcodi.c b/games/trek/getcodi.c
deleted file mode 100644
index ae47d1a..0000000
--- a/games/trek/getcodi.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)getcodi.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "getpar.h"
-
-/*
-** get course and distance
-**
-** The user is asked for a course and distance. This is used by
-** move, impulse, and some of the computer functions.
-**
-** The return value is zero for success, one for an invalid input
-** (meaning to drop the request).
-*/
-
-getcodi(co, di)
-int *co;
-double *di;
-{
-
- *co = getintpar("Course");
-
- /* course must be in the interval [0, 360] */
- if (*co < 0 || *co > 360)
- return (1);
- *di = getfltpar("Distance");
-
- /* distance must be in the interval [0, 15] */
- if (*di <= 0.0 || *di > 15.0)
- return (1);
-
- /* good return */
- return (0);
-}
diff --git a/games/trek/getpar.c b/games/trek/getpar.c
deleted file mode 100644
index 488af3f..0000000
--- a/games/trek/getpar.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdio.h>
-# include "getpar.h"
-
-/**
- ** get integer parameter
- **/
-
-getintpar(s)
-char *s;
-{
- int i;
- int n;
-
- while (1)
- {
- if (testnl() && s)
- printf("%s: ", s);
- i = scanf("%d", &n);
- if (i < 0)
- exit(1);
- if (i > 0 && testterm())
- return (n);
- printf("invalid input; please enter an integer\n");
- skiptonl(0);
- }
-}
-
-/**
- ** get floating parameter
- **/
-
-double getfltpar(s)
-char *s;
-{
- int i;
- double d;
-
- while (1)
- {
- if (testnl() && s)
- printf("%s: ", s);
- i = scanf("%lf", &d);
- if (i < 0)
- exit(1);
- if (i > 0 && testterm())
- return (d);
- printf("invalid input; please enter a double\n");
- skiptonl(0);
- }
-}
-
-/**
- ** get yes/no parameter
- **/
-
-struct cvntab Yntab[] =
-{
- "y", "es", (int (*)())1, 0,
- "n", "o", (int (*)())0, 0,
- 0
-};
-
-getynpar(s)
-char *s;
-{
- struct cvntab *r;
-
- r = getcodpar(s, Yntab);
- return ((long) r->value);
-}
-
-
-/**
- ** get coded parameter
- **/
-
-struct cvntab *getcodpar(s, tab)
-char *s;
-struct cvntab tab[];
-{
- char input[100];
- struct cvntab *r;
- int flag;
- char *p, *q;
- int c;
- int f;
-
- flag = 0;
- while (1)
- {
- flag |= (f = testnl());
- if (flag)
- printf("%s: ", s);
- if (f)
- cgetc(0); /* throw out the newline */
- scanf("%*[ \t;]");
- if ((c = scanf("%[^ \t;\n]", input)) < 0)
- exit(1);
- if (c == 0)
- continue;
- flag = 1;
-
- /* if command list, print four per line */
- if (input[0] == '?' && input[1] == 0)
- {
- c = 4;
- for (r = tab; r->abrev; r++)
- {
- concat(r->abrev, r->full, input);
- printf("%14.14s", input);
- if (--c > 0)
- continue;
- c = 4;
- printf("\n");
- }
- if (c != 4)
- printf("\n");
- continue;
- }
-
- /* search for in table */
- for (r = tab; r->abrev; r++)
- {
- p = input;
- for (q = r->abrev; *q; q++)
- if (*p++ != *q)
- break;
- if (!*q)
- {
- for (q = r->full; *p && *q; q++, p++)
- if (*p != *q)
- break;
- if (!*p || !*q)
- break;
- }
- }
-
- /* check for not found */
- if (!r->abrev)
- {
- printf("invalid input; ? for valid inputs\n");
- skiptonl(0);
- }
- else
- return (r);
- }
-}
-
-
-/**
- ** get string parameter
- **/
-
-getstrpar(s, r, l, t)
-char *s;
-char *r;
-int l;
-char *t;
-{
- int i;
- char format[20];
- int f;
-
- if (t == 0)
- t = " \t\n;";
- (void)sprintf(format, "%%%d[^%s]", l, t);
- while (1)
- {
- if ((f = testnl()) && s)
- printf("%s: ", s);
- if (f)
- cgetc(0);
- scanf("%*[\t ;]");
- i = scanf(format, r);
- if (i < 0)
- exit(1);
- if (i != 0)
- return;
- }
-}
-
-
-/**
- ** test if newline is next valid character
- **/
-
-testnl()
-{
- char c;
-
- while ((c = cgetc(0)) != '\n')
- if ((c >= '0' && c <= '9') || c == '.' || c == '!' ||
- (c >= 'A' && c <= 'Z') ||
- (c >= 'a' && c <= 'z') || c == '-')
- {
- ungetc(c, stdin);
- return(0);
- }
- ungetc(c, stdin);
- return (1);
-}
-
-
-/**
- ** scan for newline
- **/
-
-skiptonl(c)
-char c;
-{
- while (c != '\n')
- if (!(c = cgetc(0)))
- return;
- ungetc('\n', stdin);
- return;
-}
-
-
-/**
- ** test for valid terminator
- **/
-
-testterm()
-{
- char c;
-
- if (!(c = cgetc(0)))
- return (1);
- if (c == '.')
- return (0);
- if (c == '\n' || c == ';')
- ungetc(c, stdin);
- return (1);
-}
-
-
-/*
-** TEST FOR SPECIFIED DELIMETER
-**
-** The standard input is scanned for the parameter. If found,
-** it is thrown away and non-zero is returned. If not found,
-** zero is returned.
-*/
-
-readdelim(d)
-char d;
-{
- char c;
-
- while (c = cgetc(0))
- {
- if (c == d)
- return (1);
- if (c == ' ')
- continue;
- ungetc(c, stdin);
- break;
- }
- return (0);
-}
diff --git a/games/trek/getpar.h b/games/trek/getpar.h
deleted file mode 100644
index 821ef74..0000000
--- a/games/trek/getpar.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)getpar.h 8.1 (Berkeley) 5/31/93
- */
-
-struct cvntab /* used for getcodpar() paramater list */
-{
- char *abrev;
- char *full;
- int (*value)();
- int value2;
-};
-
-extern double getfltpar();
-extern struct cvntab *getcodpar();
diff --git a/games/trek/help.c b/games/trek/help.c
deleted file mode 100644
index 89aff5b..0000000
--- a/games/trek/help.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** call starbase for help
-**
-** First, the closest starbase is selected. If there is a
-** a starbase in your own quadrant, you are in good shape.
-** This distance takes quadrant distances into account only.
-**
-** A magic number is computed based on the distance which acts
-** as the probability that you will be rematerialized. You
-** get three tries.
-**
-** When it is determined that you should be able to be remater-
-** ialized (i.e., when the probability thing mentioned above
-** comes up positive), you are put into that quadrant (anywhere).
-** Then, we try to see if there is a spot adjacent to the star-
-** base. If not, you can't be rematerialized!!! Otherwise,
-** it drops you there. It only tries five times to find a spot
-** to drop you. After that, it's your problem.
-*/
-
-char *Cntvect[3] =
-{"first", "second", "third"};
-
-help()
-{
- int i;
- double dist, x;
- int dx, dy;
- int j, l;
-
- /* check to see if calling for help is reasonable ... */
- if (Ship.cond == DOCKED)
- return (printf("Uhura: But Captain, we're already docked\n"));
-
- /* or possible */
- if (damaged(SSRADIO))
- return (out(SSRADIO));
- if (Now.bases <= 0)
- return (printf("Uhura: I'm not getting any response from starbase\n"));
-
- /* tut tut, there goes the score */
- Game.helps += 1;
-
- /* find the closest base */
- dist = 1e50;
- if (Quad[Ship.quadx][Ship.quady].bases <= 0)
- {
- /* there isn't one in this quadrant */
- for (i = 0; i < Now.bases; i++)
- {
- /* compute distance */
- dx = Now.base[i].x - Ship.quadx;
- dy = Now.base[i].y - Ship.quady;
- x = dx * dx + dy * dy;
- x = sqrt(x);
-
- /* see if better than what we already have */
- if (x < dist)
- {
- dist = x;
- l = i;
- }
- }
-
- /* go to that quadrant */
- Ship.quadx = Now.base[l].x;
- Ship.quady = Now.base[l].y;
- initquad(1);
- }
- else
- {
- dist = 0.0;
- }
-
- /* dematerialize the Enterprise */
- Sect[Ship.sectx][Ship.secty] = EMPTY;
- printf("Starbase in %d,%d responds\n", Ship.quadx, Ship.quady);
-
- /* this next thing acts as a probability that it will work */
- x = pow(1.0 - pow(0.94, dist), 0.3333333);
-
- /* attempt to rematerialize */
- for (i = 0; i < 3; i++)
- {
- sleep(2);
- printf("%s attempt to rematerialize ", Cntvect[i]);
- if (franf() > x)
- {
- /* ok, that's good. let's see if we can set her down */
- for (j = 0; j < 5; j++)
- {
- dx = Etc.starbase.x + ranf(3) - 1;
- if (dx < 0 || dx >= NSECTS)
- continue;
- dy = Etc.starbase.y + ranf(3) - 1;
- if (dy < 0 || dy >= NSECTS || Sect[dx][dy] != EMPTY)
- continue;
- break;
- }
- if (j < 5)
- {
- /* found an empty spot */
- printf("succeeds\n");
- Ship.sectx = dx;
- Ship.secty = dy;
- Sect[dx][dy] = Ship.ship;
- dock();
- compkldist(0);
- return;
- }
- /* the starbase must have been surrounded */
- }
- printf("fails\n");
- }
-
- /* one, two, three strikes, you're out */
- lose(L_NOHELP);
-}
diff --git a/games/trek/impulse.c b/games/trek/impulse.c
deleted file mode 100644
index d76a401..0000000
--- a/games/trek/impulse.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)impulse.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/**
- ** move under impulse power
- **/
-
-impulse()
-{
- int course;
- int power;
- double dist, time;
- int percent;
- extern double move();
-
- if (Ship.cond == DOCKED)
- return (printf("Scotty: Sorry captain, but we are still docked.\n"));
- if (damaged(IMPULSE))
- return (out(IMPULSE));
- if (getcodi(&course, &dist))
- return;
- power = 20 + 100 * dist;
- percent = 100 * power / Ship.energy + 0.5;
- if (percent >= 85)
- {
- printf("Scotty: That would consume %d%% of our remaining energy.\n",
- percent);
- if (!getynpar("Are you sure that is wise"))
- return;
- printf("Aye aye, sir\n");
- }
- time = dist / 0.095;
- percent = 100 * time / Now.time + 0.5;
- if (percent >= 85)
- {
- printf("Spock: That would take %d%% of our remaining time.\n",
- percent);
- if (!getynpar("Are you sure that is wise"))
- return;
- printf("(He's finally gone mad)\n");
- }
- Move.time = move(0, course, time, 0.095);
- Ship.energy -= 20 + 100 * Move.time * 0.095;
-}
diff --git a/games/trek/initquad.c b/games/trek/initquad.c
deleted file mode 100644
index dc300d4..0000000
--- a/games/trek/initquad.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)initquad.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Paramize Quadrant Upon Entering
-**
-** A quadrant is initialized from the information held in the
-** Quad matrix. Basically, everything is just initialized
-** randomly, except for the starship, which goes into a fixed
-** sector.
-**
-** If there are Klingons in the quadrant, the captain is informed
-** that the condition is RED, and he is given a chance to put
-** his shields up if the computer is working.
-**
-** The flag `f' is set to disable the check for condition red.
-** This mode is used in situations where you know you are going
-** to be docked, i.e., abandon() and help().
-*/
-
-initquad(f)
-int f;
-{
- int i, j;
- int rx, ry;
- int nbases, nstars;
- struct quad *q;
- int nholes;
-
- q = &Quad[Ship.quadx][Ship.quady];
-
- /* ignored supernova'ed quadrants (this is checked again later anyway */
- if (q->stars < 0)
- return;
- Etc.nkling = q->klings;
- nbases = q->bases;
- nstars = q->stars;
- nholes = q->holes;
-
- /* have we blundered into a battle zone w/ shields down? */
- if (Etc.nkling > 0 && !f)
- {
- printf("Condition RED\n");
- Ship.cond = RED;
- if (!damaged(COMPUTER))
- shield(1);
- }
-
- /* clear out the quadrant */
- for (i = 0; i < NSECTS; i++)
- for (j = 0; j < NSECTS; j++)
- Sect[i][j] = EMPTY;
-
- /* initialize Enterprise */
- Sect[Ship.sectx][Ship.secty] = Ship.ship;
-
- /* initialize Klingons */
- for (i = 0; i < Etc.nkling; i++)
- {
- sector(&rx, &ry);
- Sect[rx][ry] = KLINGON;
- Etc.klingon[i].x = rx;
- Etc.klingon[i].y = ry;
- Etc.klingon[i].power = Param.klingpwr;
- Etc.klingon[i].srndreq = 0;
- }
- compkldist(1);
-
- /* initialize star base */
- if (nbases > 0)
- {
- sector(&rx, &ry);
- Sect[rx][ry] = BASE;
- Etc.starbase.x = rx;
- Etc.starbase.y = ry;
- }
-
- /* initialize inhabited starsystem */
- if (q->qsystemname != 0)
- {
- sector(&rx, &ry);
- Sect[rx][ry] = INHABIT;
- nstars -= 1;
- }
-
- /* initialize black holes */
- for (i = 0; i < nholes; i++)
- {
- sector(&rx, &ry);
- Sect[rx][ry] = HOLE;
- }
-
- /* initialize stars */
- for (i = 0; i < nstars; i++)
- {
- sector(&rx, &ry);
- Sect[rx][ry] = STAR;
- }
- Move.newquad = 1;
-}
-
-
-sector(x, y)
-int *x, *y;
-{
- int i, j;
-
- do
- {
- i = ranf(NSECTS);
- j = ranf(NSECTS);
- } while (Sect[i][j] != EMPTY);
- *x = i;
- *y = j;
- return;
-}
diff --git a/games/trek/kill.c b/games/trek/kill.c
deleted file mode 100644
index 86f4122..0000000
--- a/games/trek/kill.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)kill.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** KILL KILL KILL !!!
-**
-** This file handles the killing off of almost anything.
-*/
-
-/*
-** Handle a Klingon's death
-**
-** The Klingon at the sector given by the parameters is killed
-** and removed from the Klingon list. Notice that it is not
-** removed from the event list; this is done later, when the
-** the event is to be caught. Also, the time left is recomputed,
-** and the game is won if that was the last klingon.
-*/
-
-killk(ix, iy)
-int ix, iy;
-{
- int i, j;
-
- printf(" *** Klingon at %d,%d destroyed ***\n", ix, iy);
-
- /* remove the scoundrel */
- Now.klings -= 1;
- Sect[ix][iy] = EMPTY;
- Quad[Ship.quadx][Ship.quady].klings -= 1;
- /* %%% IS THIS SAFE???? %%% */
- Quad[Ship.quadx][Ship.quady].scanned -= 100;
- Game.killk += 1;
-
- /* find the Klingon in the Klingon list */
- for (i = 0; i < Etc.nkling; i++)
- if (ix == Etc.klingon[i].x && iy == Etc.klingon[i].y)
- {
- /* purge him from the list */
- Etc.nkling -= 1;
- for (; i < Etc.nkling; i++)
- bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof Etc.klingon[i]);
- break;
- }
-
- /* find out if that was the last one */
- if (Now.klings <= 0)
- win();
-
- /* recompute time left */
- Now.time = Now.resource / Now.klings;
- return;
-}
-
-
-/*
-** handle a starbase's death
-*/
-
-killb(qx, qy)
-int qx, qy;
-{
- struct quad *q;
- struct xy *b;
-
- q = &Quad[qx][qy];
-
- if (q->bases <= 0)
- return;
- if (!damaged(SSRADIO))
- /* then update starchart */
- if (q->scanned < 1000)
- q->scanned -= 10;
- else
- if (q->scanned > 1000)
- q->scanned = -1;
- q->bases = 0;
- Now.bases -= 1;
- for (b = Now.base; ; b++)
- if (qx == b->x && qy == b->y)
- break;
- bmove(&Now.base[Now.bases], b, sizeof *b);
- if (qx == Ship.quadx && qy == Ship.quady)
- {
- Sect[Etc.starbase.x][Etc.starbase.y] = EMPTY;
- if (Ship.cond == DOCKED)
- undock();
- printf("Starbase at %d,%d destroyed\n", Etc.starbase.x, Etc.starbase.y);
- }
- else
- {
- if (!damaged(SSRADIO))
- {
- printf("Uhura: Starfleet command reports that the starbase in\n");
- printf(" quadrant %d,%d has been destroyed\n", qx, qy);
- }
- else
- schedule(E_KATSB | E_GHOST, 1e50, qx, qy, 0);
- }
-}
-
-
-/**
- ** kill an inhabited starsystem
- **/
-
-kills(x, y, f)
-int x, y; /* quad coords if f == 0, else sector coords */
-int f; /* f != 0 -- this quad; f < 0 -- Enterprise's fault */
-{
- struct quad *q;
- struct event *e;
- char *name;
- char *systemname();
-
- if (f)
- {
- /* current quadrant */
- q = &Quad[Ship.quadx][Ship.quady];
- Sect[x][y] = EMPTY;
- name = systemname(q);
- if (name == 0)
- return;
- printf("Inhabited starsystem %s at %d,%d destroyed\n",
- name, x, y);
- if (f < 0)
- Game.killinhab += 1;
- }
- else
- {
- /* different quadrant */
- q = &Quad[x][y];
- }
- if (q->qsystemname & Q_DISTRESSED)
- {
- /* distressed starsystem */
- e = &Event[q->qsystemname & Q_SYSTEM];
- printf("Distress call for %s invalidated\n",
- Systemname[e->systemname]);
- unschedule(e);
- }
- q->qsystemname = 0;
- q->stars -= 1;
-}
-
-
-/**
- ** "kill" a distress call
- **/
-
-killd(x, y, f)
-int x, y; /* quadrant coordinates */
-int f; /* set if user is to be informed */
-{
- struct event *e;
- int i;
- struct quad *q;
-
- q = &Quad[x][y];
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->x != x || e->y != y)
- continue;
- switch (e->evcode)
- {
- case E_KDESB:
- if (f)
- {
- printf("Distress call for starbase in %d,%d nullified\n",
- x, y);
- unschedule(e);
- }
- break;
-
- case E_ENSLV:
- case E_REPRO:
- if (f)
- {
- printf("Distress call for %s in quadrant %d,%d nullified\n",
- Systemname[e->systemname], x, y);
- q->qsystemname = e->systemname;
- unschedule(e);
- }
- else
- {
- e->evcode |= E_GHOST;
- }
- }
- }
-}
diff --git a/games/trek/klmove.c b/games/trek/klmove.c
deleted file mode 100644
index d98acd6..0000000
--- a/games/trek/klmove.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)klmove.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Move Klingons Around
-**
-** This is a largely incomprehensible block of code that moves
-** Klingons around in a quadrant. It was written in a very
-** "program as you go" fashion, and is a prime candidate for
-** rewriting.
-**
-** The flag `fl' is zero before an attack, one after an attack,
-** and two if you are leaving a quadrant. This serves to
-** change the probability and distance that it moves.
-**
-** Basically, what it will try to do is to move a certain number
-** of steps either toward you or away from you. It will avoid
-** stars whenever possible. Nextx and nexty are the next
-** sector to move to on a per-Klingon basis; they are roughly
-** equivalent to Ship.sectx and Ship.secty for the starship. Lookx and
-** looky are the sector that you are going to look at to see
-** if you can move their. Dx and dy are the increment. Fudgex
-** and fudgey are the things you change around to change your
-** course around stars.
-*/
-
-klmove(fl)
-int fl;
-{
- int n;
- struct kling *k;
- double dx, dy;
- int nextx, nexty;
- int lookx, looky;
- int motion;
- int fudgex, fudgey;
- int qx, qy;
- double bigger;
- int i;
-
-# ifdef xTRACE
- if (Trace)
- printf("klmove: fl = %d, Etc.nkling = %d\n", fl, Etc.nkling);
-# endif
- for (n = 0; n < Etc.nkling; k && n++)
- {
- k = &Etc.klingon[n];
- i = 100;
- if (fl)
- i = 100.0 * k->power / Param.klingpwr;
- if (ranf(i) >= Param.moveprob[2 * Move.newquad + fl])
- continue;
- /* compute distance to move */
- motion = ranf(75) - 25;
- motion *= k->avgdist * Param.movefac[2 * Move.newquad + fl];
- /* compute direction */
- dx = Ship.sectx - k->x + ranf(3) - 1;
- dy = Ship.secty - k->y + ranf(3) - 1;
- bigger = dx;
- if (dy > bigger)
- bigger = dy;
- if (bigger == 0.0)
- bigger = 1.0;
- dx = dx / bigger + 0.5;
- dy = dy / bigger + 0.5;
- if (motion < 0)
- {
- motion = -motion;
- dx = -dx;
- dy = -dy;
- }
- fudgex = fudgey = 1;
- /* try to move the klingon */
- nextx = k->x;
- nexty = k->y;
- for (; motion > 0; motion--)
- {
- lookx = nextx + dx;
- looky = nexty + dy;
- if (lookx < 0 || lookx >= NSECTS || looky < 0 || looky >= NSECTS)
- {
- /* new quadrant */
- qx = Ship.quadx;
- qy = Ship.quady;
- if (lookx < 0)
- qx -= 1;
- else
- if (lookx >= NSECTS)
- qx += 1;
- if (looky < 0)
- qy -= 1;
- else
- if (looky >= NSECTS)
- qy += 1;
- if (qx < 0 || qx >= NQUADS || qy < 0 || qy >= NQUADS ||
- Quad[qx][qy].stars < 0 || Quad[qx][qy].klings > MAXKLQUAD - 1)
- break;
- if (!damaged(SRSCAN))
- {
- printf("Klingon at %d,%d escapes to quadrant %d,%d\n",
- k->x, k->y, qx, qy);
- motion = Quad[qx][qy].scanned;
- if (motion >= 0 && motion < 1000)
- Quad[qx][qy].scanned += 100;
- motion = Quad[Ship.quadx][Ship.quady].scanned;
- if (motion >= 0 && motion < 1000)
- Quad[Ship.quadx][Ship.quady].scanned -= 100;
- }
- Sect[k->x][k->y] = EMPTY;
- Quad[qx][qy].klings += 1;
- Etc.nkling -= 1;
- bmove(&Etc.klingon[Etc.nkling], k, sizeof *k);
- Quad[Ship.quadx][Ship.quady].klings -= 1;
- k = 0;
- break;
- }
- if (Sect[lookx][looky] != EMPTY)
- {
- lookx = nextx + fudgex;
- if (lookx < 0 || lookx >= NSECTS)
- lookx = nextx + dx;
- if (Sect[lookx][looky] != EMPTY)
- {
- fudgex = -fudgex;
- looky = nexty + fudgey;
- if (looky < 0 || looky >= NSECTS || Sect[lookx][looky] != EMPTY)
- {
- fudgey = -fudgey;
- break;
- }
- }
- }
- nextx = lookx;
- nexty = looky;
- }
- if (k && (k->x != nextx || k->y != nexty))
- {
- if (!damaged(SRSCAN))
- printf("Klingon at %d,%d moves to %d,%d\n",
- k->x, k->y, nextx, nexty);
- Sect[k->x][k->y] = EMPTY;
- Sect[k->x = nextx][k->y = nexty] = KLINGON;
- }
- }
- compkldist(0);
-}
diff --git a/games/trek/lose.c b/games/trek/lose.c
deleted file mode 100644
index 60c89ad..0000000
--- a/games/trek/lose.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lose.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include <setjmp.h>
-
-/*
-** PRINT OUT LOSER MESSAGES
-**
-** The messages are printed out, the score is computed and
-** printed, and the game is restarted. Oh yeh, any special
-** actions which need be taken are taken.
-*/
-
-char *Losemsg[] =
-{
- "You ran out of time",
- "You ran out of energy",
- "You have been destroyed",
- "You ran into the negative energy barrier",
- "You destroyed yourself by nova'ing that star",
- "You have been caught in a supernova",
- "You just suffocated in outer space",
- "You could not be rematerialized",
- "\n\032\014 ***\07 Ship's hull has imploded\07 ***",
- "You have burned up in a star",
- "Well, you destroyed yourself, but it didn't do any good",
- "You have been captured by Klingons and mercilessly tortured",
- "Your last crew member died",
-};
-
-lose(why)
-int why;
-{
- extern jmp_buf env;
-
- Game.killed = 1;
- sleep(1);
- printf("\n%s\n", Losemsg[why - 1]);
- switch (why)
- {
-
- case L_NOTIME:
- Game.killed = 0;
- break;
- }
- Move.endgame = -1;
- score();
- skiptonl(0);
- longjmp(env, 1);
-}
diff --git a/games/trek/lrscan.c b/games/trek/lrscan.c
deleted file mode 100644
index 65f31a3..0000000
--- a/games/trek/lrscan.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lrscan.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** LONG RANGE OF SCANNERS
-**
-** A summary of the quadrants that surround you is printed. The
-** hundreds digit is the number of Klingons in the quadrant,
-** the tens digit is the number of starbases, and the units digit
-** is the number of stars. If the printout is "///" it means
-** that that quadrant is rendered uninhabitable by a supernova.
-** It also updates the "scanned" field of the quadrants it scans,
-** for future use by the "chart" option of the computer.
-*/
-
-lrscan()
-{
- int i, j;
- struct quad *q;
-
- if (check_out(LRSCAN))
- {
- return;
- }
- printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady);
-
- /* print the header on top */
- for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
- {
- if (j < 0 || j >= NQUADS)
- printf(" ");
- else
- printf(" %1d", j);
- }
-
- /* scan the quadrants */
- for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++)
- {
- printf("\n -------------------\n");
- if (i < 0 || i >= NQUADS)
- {
- /* negative energy barrier */
- printf(" ! * ! * ! * !");
- continue;
- }
-
- /* print the left hand margin */
- printf("%1d !", i);
- for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
- {
- if (j < 0 || j >= NQUADS)
- {
- /* negative energy barrier again */
- printf(" * !");
- continue;
- }
- q = &Quad[i][j];
- if (q->stars < 0)
- {
- /* supernova */
- printf(" /// !");
- q->scanned = 1000;
- continue;
- }
- q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
- printf(" %3d !", q->scanned);
- }
- }
- printf("\n -------------------\n");
- return;
-}
diff --git a/games/trek/main.c b/games/trek/main.c
deleted file mode 100644
index f97005c..0000000
--- a/games/trek/main.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include <stdio.h>
-# include <sgtty.h>
-# include <setjmp.h>
-# include <stdlib.h>
-
-# define PRIO 00 /* default priority */
-
-int Mother = 51 + (51 << 8);
-
-/*
-** #### ##### # #### ##### #### ##### # #
-** # # # # # # # # # # # #
-** ### # ##### #### # #### ### ###
-** # # # # # # # # # # # #
-** #### # # # # # # # # ##### # #
-**
-** C version by Eric P. Allman 5/76 (U.C. Berkeley) with help
-** from Jeff Poskanzer and Pete Rubinstein.
-**
-** I also want to thank everyone here at Berkeley who
-** where crazy enough to play the undebugged game. I want to
-** particularly thank Nick Whyte, who made considerable
-** suggestions regarding the content of the game. Why, I'll
-** never forget the time he suggested the name for the
-** "capture" command.
-**
-** Please send comments, questions, and suggestions about this
-** game to:
-** Eric P. Allman
-** Project INGRES
-** Electronics Research Laboratory
-** Cory Hall
-** University of California
-** Berkeley, California 94720
-**
-** If you make ANY changes in the game, I sure would like to
-** know about them. It is sort of an ongoing project for me,
-** and I very much want to put in any bug fixes and improvements
-** that you might come up with.
-**
-** FORTRASH version by Kay R. Fisher (DEC) "and countless others".
-** That was adapted from the "original BASIC program" (ha!) by
-** Mike Mayfield (Centerline Engineering).
-**
-** Additional inspiration taken from FORTRAN version by
-** David Matuszek and Paul Reynolds which runs on the CDC
-** 7600 at Lawrence Berkeley Lab, maintained there by
-** Andy Davidson. This version is also available at LLL
-** and at LMSC. In all fairness, this version was the
-** major inspiration for this version of the game (trans-
-** lation: I ripped off a whole lot of code).
-**
-** Minor other input from the "Battelle Version 7A" by Joe Miller
-** (Graphics Systems Group, Battelle-Columbus Labs) and
-** Ross Pavlac (Systems Programmer, Battelle Memorial
-** Institute). That version was written in December '74
-** and extensively modified June '75. It was adapted
-** from the FTN version by Ron Williams of CDC Sunnyvale,
-** which was adapted from the Basic version distributed
-** by DEC. It also had "neat stuff swiped" from T. T.
-** Terry and Jim Korp (University of Texas), Hicks (Penn
-** U.), and Rick Maus (Georgia Tech). Unfortunately, it
-** was not as readable as it could have been and so the
-** translation effort was severely hampered. None the
-** less, I got the idea of inhabited starsystems from this
-** version.
-**
-** Permission is given for use, copying, and modification of
-** all or part of this program and related documentation,
-** provided that all reference to the authors are maintained.
-**
-**
-**********************************************************************
-**
-** NOTES TO THE MAINTAINER:
-**
-** There is a compilation option xTRACE which must be set for any
-** trace information to be generated. It is probably defined in
-** the version that you get. It can be removed, however, if you
-** have trouble finding room in core.
-**
-** Many things in trek are not as clear as they might be, but are
-** done to reduce space. I compile with the -f and -O flags. I
-** am constrained to running with non-separated I/D space, since
-** we don't have doubleing point hardware here; even if we did, I
-** would like trek to be available to the large number of people
-** who either have an 11/40 or do not have FP hardware. I also
-** found it desirable to make the code run reentrant, so this
-** added even more space constraints.
-**
-** I use the portable C library to do my I/O. This is done be-
-** cause I wanted the game easily transportable to other C
-** implementations, and because I was too lazy to do the doubleing
-** point input myself. Little did I know. The portable C library
-** released by Bell Labs has more bugs than you would believe, so
-** I ended up rewriting the whole blessed thing. Trek excercises
-** many of the bugs in it, as well as bugs in some of the section
-** III UNIX routines. We have fixed them here. One main problem
-** was a bug in alloc() that caused it to always ask for a large
-** hunk of memory, which worked fine unless you were almost out,
-** which I inevitably was. If you want the code for all of this
-** stuff, it is also available through me.
-**
-***********************************************************************
-*/
-
-jmp_buf env;
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- /* extern FILE *f_log; */
- char opencode;
- int prio;
- int ac;
- char **av;
- struct sgttyb argp;
-
- /* revoke */
- setgid(getgid());
-
- av = argv;
- ac = argc;
- av++;
- srandomdev();
- opencode = 'w';
- prio = PRIO;
- if (gtty(1, &argp) == 0)
- {
- if ((argp.sg_ispeed ) < B1200)
- Etc.fast++;
- }
- while (ac > 1 && av[0][0] == '-')
- {
- switch (av[0][1])
- {
- case 'a': /* append to log file */
- opencode = 'a';
- break;
-
- case 'f': /* set fast mode */
- Etc.fast++;
- break;
-
- case 's': /* set slow mode */
- Etc.fast = 0;
- break;
-
-# ifdef xTRACE
- case 't': /* trace */
- if (getuid() != Mother)
- goto badflag;
- Trace++;
- break;
-# endif
-
- case 'p': /* set priority */
- if (getuid() != Mother)
- goto badflag;
- prio = atoi(av[0] + 2);
- break;
-
- default:
- badflag:
- printf("Invalid option: %s\n", av[0]);
-
- }
- ac--;
- av++;
- }
- if (ac > 2)
- syserr("arg count");
- /*
- if (ac > 1)
- f_log = fopen(av[0], opencode);
- */
-
- printf("\n * * * S T A R T R E K * * *\n\nPress return to continue.\n");
-
- if (setjmp(env))
- {
- if ( !getynpar("Another game") )
- exit(0);
- }
- do
- {
- setup();
- play();
- } while (getynpar("Another game"));
-
- fflush(stdout);
-}
diff --git a/games/trek/move.c b/games/trek/move.c
deleted file mode 100644
index 6e413c7..0000000
--- a/games/trek/move.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Move Under Warp or Impulse Power
-**
-** `Ramflag' is set if we are to be allowed to ram stars,
-** Klingons, etc. This is passed from warp(), which gets it from
-** either play() or ram(). Course is the course (0 -> 360) at
-** which we want to move. `Speed' is the speed we
-** want to go, and `time' is the expected time. It
-** can get cut short if a long range tractor beam is to occur. We
-** cut short the move so that the user doesn't get docked time and
-** energy for distance which he didn't travel.
-**
-** We check the course through the current quadrant to see that he
-** doesn't run into anything. After that, though, space sort of
-** bends around him. Note that this puts us in the awkward posi-
-** tion of being able to be dropped into a sector which is com-
-** pletely surrounded by stars. Oh Well.
-**
-** If the SINS (Space Inertial Navigation System) is out, we ran-
-** domize the course accordingly before ever starting to move.
-** We will still move in a straight line.
-**
-** Note that if your computer is out, you ram things anyway. In
-** other words, if your computer and sins are both out, you're in
-** potentially very bad shape.
-**
-** Klingons get a chance to zap you as you leave the quadrant.
-** By the way, they also try to follow you (heh heh).
-**
-** Return value is the actual amount of time used.
-**
-**
-** Uses trace flag 4.
-*/
-
-double move(ramflag, course, time, speed)
-int ramflag;
-int course;
-double time;
-double speed;
-{
- double angle;
- double x, y, dx, dy;
- int ix, iy;
- double bigger;
- int n;
- int i;
- double dist;
- double sectsize;
- double xn;
- double evtime;
-
-# ifdef xTRACE
- if (Trace)
- printf("move: ramflag %d course %d time %.2f speed %.2f\n",
- ramflag, course, time, speed);
-# endif
- sectsize = NSECTS;
- /* initialize delta factors for move */
- angle = course * 0.0174532925;
- if (damaged(SINS))
- angle += Param.navigcrud[1] * (franf() - 0.5);
- else
- if (Ship.sinsbad)
- angle += Param.navigcrud[0] * (franf() - 0.5);
- dx = -cos(angle);
- dy = sin(angle);
- bigger = fabs(dx);
- dist = fabs(dy);
- if (dist > bigger)
- bigger = dist;
- dx /= bigger;
- dy /= bigger;
-
- /* check for long range tractor beams */
- /**** TEMPORARY CODE == DEBUGGING ****/
- evtime = Now.eventptr[E_LRTB]->date - Now.date;
-# ifdef xTRACE
- if (Trace)
- printf("E.ep = %p, ->evcode = %d, ->date = %.2f, evtime = %.2f\n",
- (void *)Now.eventptr[E_LRTB],
- Now.eventptr[E_LRTB]->evcode,
- Now.eventptr[E_LRTB]->date, evtime);
-# endif
- if (time > evtime && Etc.nkling < 3)
- {
- /* then we got a LRTB */
- evtime += 0.005;
- time = evtime;
- }
- else
- evtime = -1.0e50;
- dist = time * speed;
-
- /* move within quadrant */
- Sect[Ship.sectx][Ship.secty] = EMPTY;
- x = Ship.sectx + 0.5;
- y = Ship.secty + 0.5;
- xn = NSECTS * dist * bigger;
- n = xn + 0.5;
-# ifdef xTRACE
- if (Trace)
- printf("dx = %.2f, dy = %.2f, xn = %.2f, n = %d\n", dx, dy, xn, n);
-# endif
- Move.free = 0;
-
- for (i = 0; i < n; i++)
- {
- ix = (x += dx);
- iy = (y += dy);
-# ifdef xTRACE
- if (Trace)
- printf("ix = %d, x = %.2f, iy = %d, y = %.2f\n", ix, x, iy, y);
-# endif
- if (x < 0.0 || y < 0.0 || x >= sectsize || y >= sectsize)
- {
- /* enter new quadrant */
- dx = Ship.quadx * NSECTS + Ship.sectx + dx * xn;
- dy = Ship.quady * NSECTS + Ship.secty + dy * xn;
- if (dx < 0.0)
- ix = -1;
- else
- ix = dx + 0.5;
- if (dy < 0.0)
- iy = -1;
- else
- iy = dy + 0.5;
-# ifdef xTRACE
- if (Trace)
- printf("New quad: ix = %d, iy = %d\n", ix, iy);
-# endif
- Ship.sectx = x;
- Ship.secty = y;
- compkldist(0);
- Move.newquad = 2;
- attack(0);
- checkcond();
- Ship.quadx = ix / NSECTS;
- Ship.quady = iy / NSECTS;
- Ship.sectx = ix % NSECTS;
- Ship.secty = iy % NSECTS;
- if (ix < 0 || Ship.quadx >= NQUADS || iy < 0 || Ship.quady >= NQUADS)
- {
- if (!damaged(COMPUTER))
- {
- dumpme(0);
- }
- else
- lose(L_NEGENB);
- }
- initquad(0);
- n = 0;
- break;
- }
- if (Sect[ix][iy] != EMPTY)
- {
- /* we just hit something */
- if (!damaged(COMPUTER) && ramflag <= 0)
- {
- ix = x - dx;
- iy = y - dy;
- printf("Computer reports navigation error; %s stopped at %d,%d\n",
- Ship.shipname, ix, iy);
- Ship.energy -= Param.stopengy * speed;
- break;
- }
- /* test for a black hole */
- if (Sect[ix][iy] == HOLE)
- {
- /* get dumped elsewhere in the galaxy */
- dumpme(1);
- initquad(0);
- n = 0;
- break;
- }
- ram(ix, iy);
- break;
- }
- }
- if (n > 0)
- {
- dx = Ship.sectx - ix;
- dy = Ship.secty - iy;
- dist = sqrt(dx * dx + dy * dy) / NSECTS;
- time = dist / speed;
- if (evtime > time)
- time = evtime; /* spring the LRTB trap */
- Ship.sectx = ix;
- Ship.secty = iy;
- }
- Sect[Ship.sectx][Ship.secty] = Ship.ship;
- compkldist(0);
- return (time);
-}
diff --git a/games/trek/nova.c b/games/trek/nova.c
deleted file mode 100644
index 8aef4c0..0000000
--- a/games/trek/nova.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)nova.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** CAUSE A NOVA TO OCCUR
-**
-** A nova occurs. It is the result of having a star hit with
-** a photon torpedo. There are several things which may happen.
-** The star may not be affected. It may go nova. It may turn
-** into a black hole. Any (yummy) it may go supernova.
-**
-** Stars that go nova cause stars which surround them to undergo
-** the same probabilistic process. Klingons next to them are
-** destroyed. And if the starship is next to it, it gets zapped.
-** If the zap is too much, it gets destroyed.
-*/
-
-nova(x, y)
-int x, y;
-{
- int i, j;
- int se;
-
- if (Sect[x][y] != STAR || Quad[Ship.quadx][Ship.quady].stars < 0)
- return;
- if (ranf(100) < 15)
- {
- printf("Spock: Star at %d,%d failed to nova.\n", x, y);
- return;
- }
- if (ranf(100) < 5)
- return (snova(x, y));
- printf("Spock: Star at %d,%d gone nova\n", x, y);
-
- if (ranf(4) != 0)
- Sect[x][y] = EMPTY;
- else
- {
- Sect[x][y] = HOLE;
- Quad[Ship.quadx][Ship.quady].holes += 1;
- }
- Quad[Ship.quadx][Ship.quady].stars -= 1;
- Game.kills += 1;
- for (i = x - 1; i <= x + 1; i++)
- {
- if (i < 0 || i >= NSECTS)
- continue;
- for (j = y - 1; j <= y + 1; j++)
- {
- if (j < 0 || j >= NSECTS)
- continue;
- se = Sect[i][j];
- switch (se)
- {
-
- case EMPTY:
- case HOLE:
- break;
-
- case KLINGON:
- killk(i, j);
- break;
-
- case STAR:
- nova(i, j);
- break;
-
- case INHABIT:
- kills(i, j, -1);
- break;
-
- case BASE:
- killb(i, j);
- Game.killb += 1;
- break;
-
- case ENTERPRISE:
- case QUEENE:
- se = 2000;
- if (Ship.shldup)
- if (Ship.shield >= se)
- {
- Ship.shield -= se;
- se = 0;
- }
- else
- {
- se -= Ship.shield;
- Ship.shield = 0;
- }
- Ship.energy -= se;
- if (Ship.energy <= 0)
- lose(L_SUICID);
- break;
-
- default:
- printf("Unknown object %c at %d,%d destroyed\n",
- se, i, j);
- Sect[i][j] = EMPTY;
- break;
- }
- }
- }
- return;
-}
diff --git a/games/trek/out.c b/games/trek/out.c
deleted file mode 100644
index 99d910d..0000000
--- a/games/trek/out.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)out.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** Announce Device Out
-*/
-
-out(dev)
-int dev;
-{
- struct device *d;
-
- d = &Device[dev];
- printf("%s reports %s ", d->person, d->name);
- if (d->name[length(d->name) - 1] == 's')
- printf("are");
- else
- printf("is");
- printf(" damaged\n");
-}
diff --git a/games/trek/phaser.c b/games/trek/phaser.c
deleted file mode 100644
index 5fa25c0..0000000
--- a/games/trek/phaser.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/* factors for phaser hits; see description below */
-
-# define ALPHA 3.0 /* spread */
-# define BETA 3.0 /* franf() */
-# define GAMMA 0.30 /* cos(angle) */
-# define EPSILON 150.0 /* dist ** 2 */
-# define OMEGA 10.596 /* overall scaling factor */
-
-/* OMEGA ~= 100 * (ALPHA + 1) * (BETA + 1) / (EPSILON + 1) */
-
-/*
-** Phaser Control
-**
-** There are up to NBANKS phaser banks which may be fired
-** simultaneously. There are two modes, "manual" and
-** "automatic". In manual mode, you specify exactly which
-** direction you want each bank to be aimed, the number
-** of units to fire, and the spread angle. In automatic
-** mode, you give only the total number of units to fire.
-**
-** The spread is specified as a number between zero and
-** one, with zero being minimum spread and one being maximum
-** spread. You will normally want zero spread, unless your
-** short range scanners are out, in which case you probably
-** don't know exactly where the Klingons are. In that case,
-** you really don't have any choice except to specify a
-** fairly large spread.
-**
-** Phasers spread slightly, even if you specify zero spread.
-**
-** Uses trace flag 30
-*/
-
-struct cvntab Matab[] =
-{
- "m", "anual", (int (*)())1, 0,
- "a", "utomatic", 0, 0,
- 0
-};
-
-struct banks
-{
- int units;
- double angle;
- double spread;
-};
-
-
-
-phaser()
-{
- int i;
- int j;
- struct kling *k;
- double dx, dy;
- double anglefactor, distfactor;
- struct banks *b;
- int manual, flag, extra;
- int hit;
- double tot;
- int n;
- int hitreqd[NBANKS];
- struct banks bank[NBANKS];
- struct cvntab *ptr;
-
- if (Ship.cond == DOCKED)
- return(printf("Phasers cannot fire through starbase shields\n"));
- if (damaged(PHASER))
- return (out(PHASER));
- if (Ship.shldup)
- return (printf("Sulu: Captain, we cannot fire through shields.\n"));
- if (Ship.cloaked)
- {
- printf("Sulu: Captain, surely you must realize that we cannot fire\n");
- printf(" phasers with the cloaking device up.\n");
- return;
- }
-
- /* decide if we want manual or automatic mode */
- manual = 0;
- if (testnl())
- {
- if (damaged(COMPUTER))
- {
- printf("%s", Device[COMPUTER].name);
- manual++;
- }
- else
- if (damaged(SRSCAN))
- {
- printf("%s", Device[SRSCAN].name);
- manual++;
- }
- if (manual)
- printf(" damaged, manual mode selected\n");
- }
-
- if (!manual)
- {
- ptr = getcodpar("Manual or automatic", Matab);
- manual = (long) ptr->value;
- }
- if (!manual && damaged(COMPUTER))
- {
- printf("Computer damaged, manual selected\n");
- skiptonl(0);
- manual++;
- }
-
- /* initialize the bank[] array */
- flag = 1;
- for (i = 0; i < NBANKS; i++)
- bank[i].units = 0;
- if (manual)
- {
- /* collect manual mode statistics */
- while (flag)
- {
- printf("%d units available\n", Ship.energy);
- extra = 0;
- flag = 0;
- for (i = 0; i < NBANKS; i++)
- {
- b = &bank[i];
- printf("\nBank %d:\n", i);
- hit = getintpar("units");
- if (hit < 0)
- return;
- if (hit == 0)
- break;
- extra += hit;
- if (extra > Ship.energy)
- {
- printf("available energy exceeded. ");
- skiptonl(0);
- flag++;
- break;
- }
- b->units = hit;
- hit = getintpar("course");
- if (hit < 0 || hit > 360)
- return;
- b->angle = hit * 0.0174532925;
- b->spread = getfltpar("spread");
- if (b->spread < 0 || b->spread > 1)
- return;
- }
- Ship.energy -= extra;
- }
- extra = 0;
- }
- else
- {
- /* automatic distribution of power */
- if (Etc.nkling <= 0)
- return (printf("Sulu: But there are no Klingons in this quadrant\n"));
- printf("Phasers locked on target. ");
- while (flag)
- {
- printf("%d units available\n", Ship.energy);
- hit = getintpar("Units to fire");
- if (hit <= 0)
- return;
- if (hit > Ship.energy)
- {
- printf("available energy exceeded. ");
- skiptonl(0);
- continue;
- }
- flag = 0;
- Ship.energy -= hit;
- extra = hit;
- n = Etc.nkling;
- if (n > NBANKS)
- n = NBANKS;
- tot = n * (n + 1) / 2;
- for (i = 0; i < n; i++)
- {
- k = &Etc.klingon[i];
- b = &bank[i];
- distfactor = k->dist;
- anglefactor = ALPHA * BETA * OMEGA / (distfactor * distfactor + EPSILON);
- anglefactor *= GAMMA;
- distfactor = k->power;
- distfactor /= anglefactor;
- hitreqd[i] = distfactor + 0.5;
- dx = Ship.sectx - k->x;
- dy = k->y - Ship.secty;
- b->angle = atan2(dy, dx);
- b->spread = 0.0;
- b->units = ((n - i) / tot) * extra;
-# ifdef xTRACE
- if (Trace)
- {
- printf("b%d hr%d u%d df%.2f af%.2f\n",
- i, hitreqd[i], b->units,
- distfactor, anglefactor);
- }
-# endif
- extra -= b->units;
- hit = b->units - hitreqd[i];
- if (hit > 0)
- {
- extra += hit;
- b->units -= hit;
- }
- }
-
- /* give out any extra energy we might have around */
- if (extra > 0)
- {
- for (i = 0; i < n; i++)
- {
- b = &bank[i];
- hit = hitreqd[i] - b->units;
- if (hit <= 0)
- continue;
- if (hit >= extra)
- {
- b->units += extra;
- extra = 0;
- break;
- }
- b->units = hitreqd[i];
- extra -= hit;
- }
- if (extra > 0)
- printf("%d units overkill\n", extra);
- }
- }
- }
-
-# ifdef xTRACE
- if (Trace)
- {
- for (i = 0; i < NBANKS; i++)
- {
- b = &bank[i];
- printf("b%d u%d", i, b->units);
- if (b->units > 0)
- printf(" a%.2f s%.2f\n", b->angle, b->spread);
- else
- printf("\n");
- }
- }
-# endif
-
- /* actually fire the shots */
- Move.free = 0;
- for (i = 0; i < NBANKS; i++)
- {
- b = &bank[i];
- if (b->units <= 0)
- {
- continue;
- }
- printf("\nPhaser bank %d fires:\n", i);
- n = Etc.nkling;
- k = Etc.klingon;
- for (j = 0; j < n; j++)
- {
- if (b->units <= 0)
- break;
- /*
- ** The formula for hit is as follows:
- **
- ** zap = OMEGA * [(sigma + ALPHA) * (rho + BETA)]
- ** / (dist ** 2 + EPSILON)]
- ** * [cos(delta * sigma) + GAMMA]
- ** * hit
- **
- ** where sigma is the spread factor,
- ** rho is a random number (0 -> 1),
- ** GAMMA is a crud factor for angle (essentially
- ** cruds up the spread factor),
- ** delta is the difference in radians between the
- ** angle you are shooting at and the actual
- ** angle of the klingon,
- ** ALPHA scales down the significance of sigma,
- ** BETA scales down the significance of rho,
- ** OMEGA is the magic number which makes everything
- ** up to "* hit" between zero and one,
- ** dist is the distance to the klingon
- ** hit is the number of units in the bank, and
- ** zap is the amount of the actual hit.
- **
- ** Everything up through dist squared should maximize
- ** at 1.0, so that the distance factor is never
- ** greater than one. Conveniently, cos() is
- ** never greater than one, but the same restric-
- ** tion applies.
- */
- distfactor = BETA + franf();
- distfactor *= ALPHA + b->spread;
- distfactor *= OMEGA;
- anglefactor = k->dist;
- distfactor /= anglefactor * anglefactor + EPSILON;
- distfactor *= b->units;
- dx = Ship.sectx - k->x;
- dy = k->y - Ship.secty;
- anglefactor = atan2(dy, dx) - b->angle;
- anglefactor = cos((anglefactor * b->spread) + GAMMA);
- if (anglefactor < 0.0)
- {
- k++;
- continue;
- }
- hit = anglefactor * distfactor + 0.5;
- k->power -= hit;
- printf("%d unit hit on Klingon", hit);
- if (!damaged(SRSCAN))
- printf(" at %d,%d", k->x, k->y);
- printf("\n");
- b->units -= hit;
- if (k->power <= 0)
- {
- killk(k->x, k->y);
- continue;
- }
- k++;
- }
- }
-
- /* compute overkill */
- for (i = 0; i < NBANKS; i++)
- extra += bank[i].units;
- if (extra > 0)
- printf("\n%d units expended on empty space\n", extra);
-}
diff --git a/games/trek/play.c b/games/trek/play.c
deleted file mode 100644
index c735afa..0000000
--- a/games/trek/play.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-# include <setjmp.h>
-
-/*
-** INSTRUCTION READ AND MAIN PLAY LOOP
-**
-** Well folks, this is it. Here we have the guts of the game.
-** This routine executes moves. It sets up per-move variables,
-** gets the command, and executes the command. After the command,
-** it calls events() to use up time, attack() to have Klingons
-** attack if the move was not free, and checkcond() to check up
-** on how we are doing after the move.
-*/
-extern int abandon(), capture(), shield(), computer(), dcrept(),
- destruct(), dock(), help(), impulse(), lrscan(),
- warp(), dumpgame(), rest(), srscan(),
- myreset(), torped(), visual(), setwarp(), undock(), phaser();
-
-struct cvntab Comtab[] =
-{
- "abandon", "", abandon, 0,
- "ca", "pture", capture, 0,
- "cl", "oak", shield, -1,
- "c", "omputer", computer, 0,
- "da", "mages", dcrept, 0,
- "destruct", "", destruct, 0,
- "do", "ck", dock, 0,
- "help", "", help, 0,
- "i", "mpulse", impulse, 0,
- "l", "rscan", lrscan, 0,
- "m", "ove", warp, 0,
- "p", "hasers", phaser, 0,
- "ram", "", warp, 1,
- "dump", "", dumpgame, 0,
- "r", "est", rest, 0,
- "sh", "ield", shield, 0,
- "s", "rscan", srscan, 0,
- "st", "atus", srscan, -1,
- "terminate", "", myreset, 0,
- "t", "orpedo", torped, 0,
- "u", "ndock", undock, 0,
- "v", "isual", visual, 0,
- "w", "arp", setwarp, 0,
- 0
-};
-
-myreset()
-{
- extern jmp_buf env;
-
- longjmp(env, 1);
-}
-
-play()
-{
- struct cvntab *r;
-
- while (1)
- {
- Move.free = 1;
- Move.time = 0.0;
- Move.shldchg = 0;
- Move.newquad = 0;
- Move.resting = 0;
- skiptonl(0);
- r = getcodpar("\nCommand", Comtab);
- (*r->value)(r->value2);
- events(0);
- attack(0);
- checkcond();
- }
-}
diff --git a/games/trek/ram.c b/games/trek/ram.c
deleted file mode 100644
index 0407a30..0000000
--- a/games/trek/ram.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)ram.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** RAM SOME OBJECT
-**
-** You have run into some sort of object. It may be a Klingon,
-** a star, or a starbase. If you run into a star, you are really
-** stupid, because there is no hope for you.
-**
-** If you run into something else, you destroy that object. You
-** also rack up incredible damages.
-*/
-
-ram(ix, iy)
-int ix, iy;
-{
- int i;
- char c;
-
- printf("\07RED ALERT\07: collision imminent\n");
- c = Sect[ix][iy];
- switch (c)
- {
-
- case KLINGON:
- printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy);
- killk(ix, iy);
- break;
-
- case STAR:
- case INHABIT:
- printf("Yeoman Rand: Captain, isn't it getting hot in here?\n");
- sleep(2);
- printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n");
- lose(L_STAR);
-
- case BASE:
- printf("You ran into the starbase at %d,%d\n", ix, iy);
- killb(Ship.quadx, Ship.quady);
- /* don't penalize the captain if it wasn't his fault */
- if (!damaged(SINS))
- Game.killb += 1;
- break;
- }
- sleep(2);
- printf("%s heavily damaged\n", Ship.shipname);
-
- /* select the number of deaths to occur */
- i = 10 + ranf(20 * Game.skill);
- Game.deaths += i;
- Ship.crew -= i;
- printf("McCoy: Take it easy Jim; we had %d casualties.\n", i);
-
- /* damage devices with an 80% probability */
- for (i = 0; i < NDEV; i++)
- {
- if (ranf(100) < 20)
- continue;
- damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]);
- }
-
- /* no chance that your shields remained up in all that */
- Ship.shldup = 0;
-}
diff --git a/games/trek/ranf.c b/games/trek/ranf.c
deleted file mode 100644
index 29e7fcc..0000000
--- a/games/trek/ranf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)ranf.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdio.h>
-# include <stdlib.h>
-
-ranf(max)
-int max;
-{
- if (max <= 0)
- return (0);
- return (random() % max);
-}
-
-
-double franf()
-{
- double t;
- t = random() & 077777;
- return (t / 32767.0);
-}
diff --git a/games/trek/rest.c b/games/trek/rest.c
deleted file mode 100644
index b6c6ee7..0000000
--- a/games/trek/rest.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)rest.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** REST FOR REPAIRS
-**
-** You sit around and wait for repairs to happen. Actually, you
-** sit around and wait for anything to happen. I do want to point
-** out however, that Klingons are not as patient as you are, and
-** they tend to attack you while you are resting.
-**
-** You can never rest through a long range tractor beam.
-**
-** In events() you will be given an opportunity to cancel the
-** rest period if anything momentous happens.
-*/
-
-rest()
-{
- double t;
- int percent;
-
- /* get the time to rest */
- t = getfltpar("How long");
- if (t <= 0.0)
- return;
- percent = 100 * t / Now.time + 0.5;
- if (percent >= 70)
- {
- printf("Spock: That would take %d%% of our remaining time.\n",
- percent);
- if (!getynpar("Are you really certain that is wise"))
- return;
- }
- Move.time = t;
-
- /* boundary condition is the LRTB */
- t = Now.eventptr[E_LRTB]->date - Now.date;
- if (Ship.cond != DOCKED && Move.time > t)
- Move.time = t + 0.0001;
- Move.free = 0;
- Move.resting = 1;
-}
diff --git a/games/trek/schedule.c b/games/trek/schedule.c
deleted file mode 100644
index 2297242..0000000
--- a/games/trek/schedule.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** SCHEDULE AN EVENT
-**
-** An event of type 'type' is scheduled for time NOW + 'offset'
-** into the first available slot. 'x', 'y', and 'z' are
-** considered the attributes for this event.
-**
-** The address of the slot is returned.
-*/
-
-struct event *schedule(type, offset, x, y, z)
-int type;
-double offset;
-char x, y;
-char z;
-{
- struct event *e;
- int i;
- double date;
-
- date = Now.date + offset;
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- if (e->evcode)
- continue;
- /* got a slot */
-# ifdef xTRACE
- if (Trace)
- printf("schedule: type %d @ %.2f slot %d parm %d %d %d\n",
- type, date, i, x, y, z);
-# endif
- e->evcode = type;
- e->date = date;
- e->x = x;
- e->y = y;
- e->systemname = z;
- Now.eventptr[type] = e;
- return (e);
- }
- syserr("Cannot schedule event %d parm %d %d %d", type, x, y, z);
-}
-
-
-/*
-** RESCHEDULE AN EVENT
-**
-** The event pointed to by 'e' is rescheduled to the current
-** time plus 'offset'.
-*/
-
-reschedule(e1, offset)
-struct event *e1;
-double offset;
-{
- double date;
- struct event *e;
-
- e = e1;
-
- date = Now.date + offset;
- e->date = date;
-# ifdef xTRACE
- if (Trace)
- printf("reschedule: type %d parm %d %d %d @ %.2f\n",
- e->evcode, e->x, e->y, e->systemname, date);
-# endif
- return;
-}
-
-
-/*
-** UNSCHEDULE AN EVENT
-**
-** The event at slot 'e' is deleted.
-*/
-
-unschedule(e1)
-struct event *e1;
-{
- struct event *e;
-
- e = e1;
-
-# ifdef xTRACE
- if (Trace)
- printf("unschedule: type %d @ %.2f parm %d %d %d\n",
- e->evcode, e->date, e->x, e->y, e->systemname);
-# endif
- Now.eventptr[e->evcode & E_EVENT] = 0;
- e->date = 1e50;
- e->evcode = 0;
- return;
-}
-
-
-/*
-** Abreviated schedule routine
-**
-** Parameters are the event index and a factor for the time
-** figure.
-*/
-
-struct event *xsched(ev1, factor, x, y, z)
-int ev1;
-int factor;
-int x, y, z;
-{
- int ev;
-
- ev = ev1;
- return (schedule(ev, -Param.eventdly[ev] * Param.time * log(franf()) / factor, x, y, z));
-}
-
-
-/*
-** Simplified reschedule routine
-**
-** Parameters are the event index, the initial date, and the
-** division factor. Look at the code to see what really happens.
-*/
-
-xresched(e1, ev1, factor)
-struct event *e1;
-int ev1;
-int factor;
-{
- int ev;
- struct event *e;
-
- ev = ev1;
- e = e1;
- reschedule(e, -Param.eventdly[ev] * Param.time * log(franf()) / factor);
-}
diff --git a/games/trek/score.c b/games/trek/score.c
deleted file mode 100644
index 4ed6478..0000000
--- a/games/trek/score.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** PRINT OUT THE CURRENT SCORE
-*/
-
-long score()
-{
- int u;
- int t;
- long s;
- double r;
- extern struct cvntab Skitab[];
-
- printf("\n*** Your score:\n");
- s = t = Param.klingpwr / 4 * (u = Game.killk);
- if (t != 0)
- printf("%d Klingons killed\t\t\t%6d\n", u, t);
- r = Now.date - Param.date;
- if (r < 1.0)
- r = 1.0;
- r = Game.killk / r;
- s += (t = 400 * r);
- if (t != 0)
- printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t);
- r = Now.klings;
- r /= Game.killk + 1;
- s += (t = -400 * r);
- if (t != 0)
- printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, t);
- if (Move.endgame > 0)
- {
- s += (t = 100 * (u = Game.skill));
- printf("Bonus for winning a %s%s game\t\t%6d\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t);
- }
- if (Game.killed)
- {
- s -= 500;
- printf("Penalty for getting killed\t\t -500\n");
- }
- s += (t = -100 * (u = Game.killb));
- if (t != 0)
- printf("%d starbases killed\t\t\t%6d\n", u, t);
- s += (t = -100 * (u = Game.helps));
- if (t != 0)
- printf("%d calls for help\t\t\t%6d\n", u, t);
- s += (t = -5 * (u = Game.kills));
- if (t != 0)
- printf("%d stars destroyed\t\t\t%6d\n", u, t);
- s += (t = -150 * (u = Game.killinhab));
- if (t != 0)
- printf("%d inhabited starsystems destroyed\t%6d\n", u, t);
- if (Ship.ship != ENTERPRISE)
- {
- s -= 200;
- printf("penalty for abandoning ship\t\t -200\n");
- }
- s += (t = 3 * (u = Game.captives));
- if (t != 0)
- printf("%d Klingons captured\t\t\t%6d\n", u, t);
- s += (t = -(u = Game.deaths));
- if (t != 0)
- printf("%d casualties\t\t\t\t%6d\n", u, t);
- printf("\n*** TOTAL\t\t\t%14ld\n", s);
- return (s);
-}
diff --git a/games/trek/setup.c b/games/trek/setup.c
deleted file mode 100644
index 54b3900..0000000
--- a/games/trek/setup.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdlib.h>
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** INITIALIZE THE GAME
-**
-** The length, skill, and password are read, and the game
-** is initialized. It is far too difficult to describe all
-** that goes on in here, but it is all straight-line code;
-** give it a look.
-**
-** Game restart and tournament games are handled here.
-*/
-
-struct cvntab Lentab[] =
-{
- "s", "hort", (int (*)())1, 0,
- "m", "edium", (int (*)())2, 0,
- "l", "ong", (int (*)())4, 0,
- "restart", "", 0, 0,
- 0
-};
-
-struct cvntab Skitab[] =
-{
- "n", "ovice", (int (*)())1, 0,
- "f", "air", (int (*)())2, 0,
- "g", "ood", (int (*)())3, 0,
- "e", "xpert", (int (*)())4, 0,
- "c", "ommodore", (int (*)())5, 0,
- "i", "mpossible", (int (*)())6, 0,
- 0
-};
-
-setup()
-{
- struct cvntab *r;
- int i, j;
- double f;
- int d;
- int fd;
- int klump;
- int ix, iy;
- struct quad *q;
- struct event *e;
-
- while (1)
- {
- r = getcodpar("What length game", Lentab);
- Game.length = (long) r->value;
- if (Game.length == 0)
- {
- if (restartgame())
- continue;
- return;
- }
- break;
- }
- r = getcodpar("What skill game", Skitab);
- Game.skill = (long) r->value;
- Game.tourn = 0;
- getstrpar("Enter a password", Game.passwd, 14, 0);
- if (sequal(Game.passwd, "tournament"))
- {
- getstrpar("Enter tournament code", Game.passwd, 14, 0);
- Game.tourn = 1;
- d = 0;
- for (i = 0; Game.passwd[i]; i++)
- d += Game.passwd[i] << i;
- srandom(d);
- }
- Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
- if (Game.skill == 6)
- Param.bases = Now.bases = 1;
- Param.time = Now.time = 6.0 * Game.length + 2.0;
- i = Game.skill;
- j = Game.length;
- Param.klings = Now.klings = i * j * 3.5 * (franf() + 0.75);
- if (Param.klings < i * j * 5)
- Param.klings = Now.klings = i * j * 5;
- if (Param.klings <= i) /* numerical overflow problems */
- Param.klings = Now.klings = 127;
- Param.energy = Ship.energy = 5000;
- Param.torped = Ship.torped = 10;
- Ship.ship = ENTERPRISE;
- Ship.shipname = "Enterprise";
- Param.shield = Ship.shield = 1500;
- Param.resource = Now.resource = Param.klings * Param.time;
- Param.reserves = Ship.reserves = (6 - Game.skill) * 2.0;
- Param.crew = Ship.crew = 387;
- Param.brigfree = Ship.brigfree = 400;
- Ship.shldup = 1;
- Ship.cond = GREEN;
- Ship.warp = 5.0;
- Ship.warp2 = 25.0;
- Ship.warp3 = 125.0;
- Ship.sinsbad = 0;
- Ship.cloaked = 0;
- Param.date = Now.date = (ranf(20) + 20) * 100;
- f = Game.skill;
- f = log(f + 0.5);
- for (i = 0; i < NDEV; i++)
- if (Device[i].name[0] == '*')
- Param.damfac[i] = 0;
- else
- Param.damfac[i] = f;
- /* these probabilities must sum to 1000 */
- Param.damprob[WARP] = 70; /* warp drive 7.0% */
- Param.damprob[SRSCAN] = 110; /* short range scanners 11.0% */
- Param.damprob[LRSCAN] = 110; /* long range scanners 11.0% */
- Param.damprob[PHASER] = 125; /* phasers 12.5% */
- Param.damprob[TORPED] = 125; /* photon torpedoes 12.5% */
- Param.damprob[IMPULSE] = 75; /* impulse engines 7.5% */
- Param.damprob[SHIELD] = 150; /* shield control 15.0% */
- Param.damprob[COMPUTER] = 20; /* computer 2.0% */
- Param.damprob[SSRADIO] = 35; /* subspace radio 3.5% */
- Param.damprob[LIFESUP] = 30; /* life support 3.0% */
- Param.damprob[SINS] = 20; /* navigation system 2.0% */
- Param.damprob[CLOAK] = 50; /* cloaking device 5.0% */
- Param.damprob[XPORTER] = 80; /* transporter 8.0% */
- /* check to see that I didn't blow it */
- for (i = j = 0; i < NDEV; i++)
- j += Param.damprob[i];
- if (j != 1000)
- syserr("Device probabilities sum to %d", j);
- Param.dockfac = 0.5;
- Param.regenfac = (5 - Game.skill) * 0.05;
- if (Param.regenfac < 0.0)
- Param.regenfac = 0.0;
- Param.warptime = 10;
- Param.stopengy = 50;
- Param.shupengy = 40;
- i = Game.skill;
- Param.klingpwr = 100 + 150 * i;
- if (i >= 6)
- Param.klingpwr += 150;
- Param.phasfac = 0.8;
- Param.hitfac = 0.5;
- Param.klingcrew = 200;
- Param.srndrprob = 0.0035;
- Param.moveprob[KM_OB] = 45;
- Param.movefac[KM_OB] = .09;
- Param.moveprob[KM_OA] = 40;
- Param.movefac[KM_OA] = -0.05;
- Param.moveprob[KM_EB] = 40;
- Param.movefac[KM_EB] = 0.075;
- Param.moveprob[KM_EA] = 25 + 5 * Game.skill;
- Param.movefac[KM_EA] = -0.06 * Game.skill;
- Param.moveprob[KM_LB] = 0;
- Param.movefac[KM_LB] = 0.0;
- Param.moveprob[KM_LA] = 10 + 10 * Game.skill;
- Param.movefac[KM_LA] = 0.25;
- Param.eventdly[E_SNOVA] = 0.5;
- Param.eventdly[E_LRTB] = 25.0;
- Param.eventdly[E_KATSB] = 1.0;
- Param.eventdly[E_KDESB] = 3.0;
- Param.eventdly[E_ISSUE] = 1.0;
- Param.eventdly[E_SNAP] = 0.5;
- Param.eventdly[E_ENSLV] = 0.5;
- Param.eventdly[E_REPRO] = 2.0;
- Param.navigcrud[0] = 1.50;
- Param.navigcrud[1] = 0.75;
- Param.cloakenergy = 1000;
- Param.energylow = 1000;
- for (i = 0; i < MAXEVENTS; i++)
- {
- e = &Event[i];
- e->date = 1e50;
- e->evcode = 0;
- }
- xsched(E_SNOVA, 1, 0, 0, 0);
- xsched(E_LRTB, Param.klings, 0, 0, 0);
- xsched(E_KATSB, 1, 0, 0, 0);
- xsched(E_ISSUE, 1, 0, 0, 0);
- xsched(E_SNAP, 1, 0, 0, 0);
- Ship.sectx = ranf(NSECTS);
- Ship.secty = ranf(NSECTS);
- Game.killk = Game.kills = Game.killb = 0;
- Game.deaths = Game.negenbar = 0;
- Game.captives = 0;
- Game.killinhab = 0;
- Game.helps = 0;
- Game.killed = 0;
- Game.snap = 0;
- Move.endgame = 0;
-
- /* setup stars */
- for (i = 0; i < NQUADS; i++)
- for (j = 0; j < NQUADS; j++)
- {
- q = &Quad[i][j];
- q->klings = q->bases = 0;
- q->scanned = -1;
- q->stars = ranf(9) + 1;
- q->holes = ranf(3) - q->stars / 5;
- q->qsystemname = 0;
- }
-
- /* select inhabited starsystems */
- for (d = 1; d < NINHAB; d++)
- {
- do
- {
- i = ranf(NQUADS);
- j = ranf(NQUADS);
- q = &Quad[i][j];
- } while (q->qsystemname);
- q->qsystemname = d;
- }
-
- /* position starbases */
- for (i = 0; i < Param.bases; i++)
- {
- while (1)
- {
- ix = ranf(NQUADS);
- iy = ranf(NQUADS);
- q = &Quad[ix][iy];
- if (q->bases > 0)
- continue;
- break;
- }
- q->bases = 1;
- Now.base[i].x = ix;
- Now.base[i].y = iy;
- q->scanned = 1001;
- /* start the Enterprise near starbase */
- if (i == 0)
- {
- Ship.quadx = ix;
- Ship.quady = iy;
- }
- }
-
- /* position klingons */
- for (i = Param.klings; i > 0; )
- {
- klump = ranf(4) + 1;
- if (klump > i)
- klump = i;
- while (1)
- {
- ix = ranf(NQUADS);
- iy = ranf(NQUADS);
- q = &Quad[ix][iy];
- if (q->klings + klump > MAXKLQUAD)
- continue;
- q->klings += klump;
- i -= klump;
- break;
- }
- }
-
- /* initialize this quadrant */
- printf("%d Klingons\n%d starbase", Param.klings, Param.bases);
- if (Param.bases > 1)
- printf("s");
- printf(" at %d,%d", Now.base[0].x, Now.base[0].y);
- for (i = 1; i < Param.bases; i++)
- printf(", %d,%d", Now.base[i].x, Now.base[i].y);
- printf("\nIt takes %d units to kill a Klingon\n", Param.klingpwr);
- Move.free = 0;
- initquad(0);
- srscan(1);
- attack(0);
-}
diff --git a/games/trek/setwarp.c b/games/trek/setwarp.c
deleted file mode 100644
index 3b341aa..0000000
--- a/games/trek/setwarp.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)setwarp.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** SET WARP FACTOR
-**
-** The warp factor is set for future move commands. It is
-** checked for consistancy.
-*/
-
-setwarp()
-{
- double warpfac;
-
- warpfac = getfltpar("Warp factor");
- if (warpfac < 0.0)
- return;
- if (warpfac < 1.0)
- return (printf("Minimum warp speed is 1.0\n"));
- if (warpfac > 10.0)
- return (printf("Maximum speed is warp 10.0\n"));
- if (warpfac > 6.0)
- printf("Damage to warp engines may occur above warp 6.0\n");
- Ship.warp = warpfac;
- Ship.warp2 = Ship.warp * warpfac;
- Ship.warp3 = Ship.warp2 * warpfac;
-}
diff --git a/games/trek/shield.c b/games/trek/shield.c
deleted file mode 100644
index c4a3bc2..0000000
--- a/games/trek/shield.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** SHIELD AND CLOAKING DEVICE CONTROL
-**
-** 'f' is one for auto shield up (in case of Condition RED),
-** zero for shield control, and negative one for cloaking
-** device control.
-**
-** Called with an 'up' or 'down' on the same line, it puts
-** the shields/cloak into the specified mode. Otherwise it
-** reports to the user the current mode, and asks if she wishes
-** to change.
-**
-** This is not a free move. Hits that occur as a result of
-** this move appear as though the shields are half up/down,
-** so you get partial hits.
-*/
-
-struct cvntab Udtab[] =
-{
- "u", "p", (int (*)())1, 0,
- "d", "own", 0, 0,
- 0
-};
-
-shield(f)
-int f;
-{
- int i;
- char c;
- struct cvntab *r;
- char s[100];
- char *device, *dev2, *dev3;
- int ind;
- char *stat;
-
- if (f > 0 && (Ship.shldup || damaged(SRSCAN)))
- return;
- if (f < 0)
- {
- /* cloaking device */
- if (Ship.ship == QUEENE)
- return (printf("Ye Faire Queene does not have the cloaking device.\n"));
- device = "Cloaking device";
- dev2 = "is";
- ind = CLOAK;
- dev3 = "it";
- stat = &Ship.cloaked;
- }
- else
- {
- /* shields */
- device = "Shields";
- dev2 = "are";
- dev3 = "them";
- ind = SHIELD;
- stat = &Ship.shldup;
- }
- if (damaged(ind))
- {
- if (f <= 0)
- out(ind);
- return;
- }
- if (Ship.cond == DOCKED)
- {
- printf("%s %s down while docked\n", device, dev2);
- return;
- }
- if (f <= 0 && !testnl())
- {
- r = getcodpar("Up or down", Udtab);
- i = (long) r->value;
- }
- else
- {
- if (*stat)
- (void)sprintf(s, "%s %s up. Do you want %s down", device, dev2, dev3);
- else
- (void)sprintf(s, "%s %s down. Do you want %s up", device, dev2, dev3);
- if (!getynpar(s))
- return;
- i = !*stat;
- }
- if (*stat == i)
- {
- printf("%s already ", device);
- if (i)
- printf("up\n");
- else
- printf("down\n");
- return;
- }
- if (i)
- if (f >= 0)
- Ship.energy -= Param.shupengy;
- else
- Ship.cloakgood = 0;
- Move.free = 0;
- if (f >= 0)
- Move.shldchg = 1;
- *stat = i;
- return;
-}
diff --git a/games/trek/snova.c b/games/trek/snova.c
deleted file mode 100644
index 6c206cb..0000000
--- a/games/trek/snova.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)snova.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** CAUSE SUPERNOVA TO OCCUR
-**
-** A supernova occurs. If 'ix' < 0, a random quadrant is chosen;
-** otherwise, the current quadrant is taken, and (ix, iy) give
-** the sector quadrants of the star which is blowing up.
-**
-** If the supernova turns out to be in the quadrant you are in,
-** you go into "emergency override mode", which tries to get you
-** out of the quadrant as fast as possible. However, if you
-** don't have enough fuel, or if you by chance run into something,
-** or some such thing, you blow up anyway. Oh yeh, if you are
-** within two sectors of the star, there is nothing that can
-** be done for you.
-**
-** When a star has gone supernova, the quadrant becomes uninhab-
-** itable for the rest of eternity, i.e., the game. If you ever
-** try stopping in such a quadrant, you will go into emergency
-** override mode.
-*/
-
-snova(x, y)
-int x, y;
-{
- int qx, qy;
- int ix, iy;
- int f;
- int dx, dy;
- int n;
- struct quad *q;
-
- f = 0;
- ix = x;
- if (ix < 0)
- {
- /* choose a quadrant */
- while (1)
- {
- qx = ranf(NQUADS);
- qy = ranf(NQUADS);
- q = &Quad[qx][qy];
- if (q->stars > 0)
- break;
- }
- if (Ship.quadx == qx && Ship.quady == qy)
- {
- /* select a particular star */
- n = ranf(q->stars);
- for (ix = 0; ix < NSECTS; ix++)
- {
- for (iy = 0; iy < NSECTS; iy++)
- if (Sect[ix][iy] == STAR || Sect[ix][iy] == INHABIT)
- if ((n -= 1) <= 0)
- break;
- if (n <= 0)
- break;
- }
- f = 1;
- }
- }
- else
- {
- /* current quadrant */
- iy = y;
- qx = Ship.quadx;
- qy = Ship.quady;
- q = &Quad[qx][qy];
- f = 1;
- }
- if (f)
- {
- /* supernova is in same quadrant as Enterprise */
- printf("\nRED ALERT: supernova occuring at %d,%d\n", ix, iy);
- dx = ix - Ship.sectx;
- dy = iy - Ship.secty;
- if (dx * dx + dy * dy <= 2)
- {
- printf("*** Emergency override attem");
- sleep(1);
- printf("\n");
- lose(L_SNOVA);
- }
- q->scanned = 1000;
- }
- else
- {
- if (!damaged(SSRADIO))
- {
- q->scanned = 1000;
- printf("\nUhura: Captain, Starfleet Command reports a supernova\n");
- printf(" in quadrant %d,%d. Caution is advised\n", qx, qy);
- }
- }
-
- /* clear out the supernova'ed quadrant */
- dx = q->klings;
- dy = q->stars;
- Now.klings -= dx;
- if (x >= 0)
- {
- /* Enterprise caused supernova */
- Game.kills += dy;
- if (q->bases)
- killb(qx, qy, -1);
- Game.killk += dx;
- }
- else
- if (q->bases)
- killb(qx, qy, 0);
- killd(qx, qy, (x >= 0));
- q->stars = -1;
- q->klings = 0;
- if (Now.klings <= 0)
- {
- printf("Lucky devil, that supernova destroyed the last klingon\n");
- win();
- }
- return;
-}
diff --git a/games/trek/srscan.c b/games/trek/srscan.c
deleted file mode 100644
index 2ec1e17..0000000
--- a/games/trek/srscan.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-
-/*
-** SHORT RANGE SENSOR SCAN
-**
-** A short range scan is taken of the current quadrant. If the
-** flag 'f' is one, it is an "auto srscan", which is not done
-** unless in 'fast' mode. It does a status report and a srscan.
-** If 'f' is -1, you get a status report only. If it is zero,
-** you get a srscan and an optional status report. The status
-** report is taken if you enter "srscan yes"; for all srscans
-** thereafter you get a status report with your srscan until
-** you type "srscan no". It defaults to on.
-**
-** The current quadrant is filled in on the computer chart.
-*/
-
-char *Color[4] =
-{
- "GREEN",
- "DOCKED",
- "YELLOW",
- "RED"
-};
-
-srscan(f)
-int f;
-{
- int i, j;
- int statinfo;
- char *s;
- int percent;
- struct quad *q;
- extern struct cvntab Skitab[];
- extern struct cvntab Lentab[];
- struct cvntab *p;
-
- if (f >= 0 && check_out(SRSCAN))
- {
- return;
- }
- if (f)
- statinfo = 1;
- else
- {
- if (!testnl())
- Etc.statreport = getynpar("status report");
- statinfo = Etc.statreport;
- }
- if (f > 0)
- {
- Etc.statreport = 1;
- if (!Etc.fast)
- return;
- }
- if (f >= 0)
- {
- printf("\nShort range sensor scan\n");
- q = &Quad[Ship.quadx][Ship.quady];
- q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
- printf(" ");
- for (i = 0; i < NSECTS; i++)
- {
- printf("%d ", i);
- }
- printf("\n");
- }
-
- for (i = 0; i < NSECTS; i++)
- {
- if (f >= 0)
- {
- printf("%d ", i);
- for (j = 0; j < NSECTS; j++)
- printf("%c ", Sect[i][j]);
- printf("%d", i);
- if (statinfo)
- printf(" ");
- }
- if (statinfo)
- switch (i)
- {
- case 0:
- printf("stardate %.2f", Now.date);
- break;
- case 1:
- printf("condition %s", Color[Ship.cond]);
- if (Ship.cloaked)
- printf(", CLOAKED");
- break;
- case 2:
- printf("position %d,%d/%d,%d",Ship.quadx, Ship.quady, Ship.sectx, Ship.secty);
- break;
- case 3:
- printf("warp factor %.1f", Ship.warp);
- break;
- case 4:
- printf("total energy %d", Ship.energy);
- break;
- case 5:
- printf("torpedoes %d", Ship.torped);
- break;
- case 6:
- s = "down";
- if (Ship.shldup)
- s = "up";
- if (damaged(SHIELD))
- s = "damaged";
- percent = 100.0 * Ship.shield / Param.shield;
- printf("shields %s, %d%%", s, percent);
- break;
- case 7:
- printf("Klingons left %d", Now.klings);
- break;
- case 8:
- printf("time left %.2f", Now.time);
- break;
- case 9:
- printf("life support ");
- if (damaged(LIFESUP))
- {
- printf("damaged, reserves = %.2f", Ship.reserves);
- break;
- }
- printf("active");
- break;
- }
- printf("\n");
- }
- if (f < 0)
- {
- printf("current crew %d\n", Ship.crew);
- printf("brig space %d\n", Ship.brigfree);
- printf("Klingon power %d\n", Param.klingpwr);
- p = &Lentab[Game.length - 1];
- if (Game.length > 2)
- p--;
- printf("Length, Skill %s%s, ", p->abrev, p->full);
- p = &Skitab[Game.skill - 1];
- printf("%s%s\n", p->abrev, p->full);
- return;
- }
- printf(" ");
- for (i = 0; i < NSECTS; i++)
- printf("%d ", i);
- printf("\n");
-
- if (q->qsystemname & Q_DISTRESSED)
- printf("Distressed ");
- if (q->qsystemname)
- printf("Starsystem %s\n", systemname(q));
-}
diff --git a/games/trek/systemname.c b/games/trek/systemname.c
deleted file mode 100644
index 80c842f..0000000
--- a/games/trek/systemname.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)systemname.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** RETRIEVE THE STARSYSTEM NAME
-**
-** Very straightforward, this routine just gets the starsystem
-** name. It returns zero if none in the specified quadrant
-** (which, by the way, is passed it).
-**
-** This routine knows all about such things as distressed
-** starsystems, etc.
-*/
-
-char *systemname(q1)
-struct quad *q1;
-{
- struct quad *q;
- int i;
-
- q = q1;
-
- i = q->qsystemname;
- if (i & Q_DISTRESSED)
- i = Event[i & Q_SYSTEM].systemname;
-
- i &= Q_SYSTEM;
- if (i == 0)
- return (0);
- return (Systemname[i]);
-}
diff --git a/games/trek/torped.c b/games/trek/torped.c
deleted file mode 100644
index 9eead45..0000000
--- a/games/trek/torped.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdio.h>
-# include "trek.h"
-
-/*
-** PHOTON TORPEDO CONTROL
-**
-** Either one or three photon torpedoes are fired. If three
-** are fired, it is called a "burst" and you also specify
-** a spread angle.
-**
-** Torpedoes are never 100% accurate. There is always a random
-** cludge factor in their course which is increased if you have
-** your shields up. Hence, you will find that they are more
-** accurate at close range. However, they have the advantage that
-** at long range they don't lose any of their power as phasers
-** do, i.e., a hit is a hit is a hit, by any other name.
-**
-** When the course spreads too much, you get a misfire, and the
-** course is randomized even more. You also have the chance that
-** the misfire damages your torpedo tubes.
-*/
-
-
-torped()
-{
- int ix, iy;
- double x, y, dx, dy;
- double angle;
- int course, course2;
- int k;
- double bigger;
- double sectsize;
- int burst;
- int n;
-
- if (Ship.cloaked)
- {
- return (printf("Federation regulations do not permit attack while cloaked.\n"));
- }
- if (check_out(TORPED))
- return;
- if (Ship.torped <= 0)
- {
- return (printf("All photon torpedos expended\n"));
- }
-
- /* get the course */
- course = getintpar("Torpedo course");
- if (course < 0 || course > 360)
- return;
- burst = -1;
-
- /* need at least three torpedoes for a burst */
- if (Ship.torped < 3)
- {
- printf("No-burst mode selected\n");
- burst = 0;
- }
- else
- {
- /* see if the user wants one */
- if (!testnl())
- {
- k = ungetc(cgetc(0), stdin);
- if (k >= '0' && k <= '9')
- burst = 1;
- }
- }
- if (burst < 0)
- {
- burst = getynpar("Do you want a burst");
- }
- if (burst)
- {
- burst = getintpar("burst angle");
- if (burst <= 0)
- return;
- if (burst > 15)
- return (printf("Maximum burst angle is 15 degrees\n"));
- }
- sectsize = NSECTS;
- n = -1;
- if (burst)
- {
- n = 1;
- course -= burst;
- }
- for (; n && n <= 3; n++)
- {
- /* select a nice random course */
- course2 = course + randcourse(n);
- angle = course2 * 0.0174532925; /* convert to radians */
- dx = -cos(angle);
- dy = sin(angle);
- bigger = fabs(dx);
- x = fabs(dy);
- if (x > bigger)
- bigger = x;
- dx /= bigger;
- dy /= bigger;
- x = Ship.sectx + 0.5;
- y = Ship.secty + 0.5;
- if (Ship.cond != DOCKED)
- Ship.torped -= 1;
- printf("Torpedo track");
- if (n > 0)
- printf(", torpedo number %d", n);
- printf(":\n%6.1f\t%4.1f\n", x, y);
- while (1)
- {
- ix = x += dx;
- iy = y += dy;
- if (x < 0.0 || x >= sectsize || y < 0.0 || y >= sectsize)
- {
- printf("Torpedo missed\n");
- break;
- }
- printf("%6.1f\t%4.1f\n", x, y);
- switch (Sect[ix][iy])
- {
- case EMPTY:
- continue;
-
- case HOLE:
- printf("Torpedo disappears into a black hole\n");
- break;
-
- case KLINGON:
- for (k = 0; k < Etc.nkling; k++)
- {
- if (Etc.klingon[k].x != ix || Etc.klingon[k].y != iy)
- continue;
- Etc.klingon[k].power -= 500 + ranf(501);
- if (Etc.klingon[k].power > 0)
- {
- printf("*** Hit on Klingon at %d,%d: extensive damages\n",
- ix, iy);
- break;
- }
- killk(ix, iy);
- break;
- }
- break;
-
- case STAR:
- nova(ix, iy);
- break;
-
- case INHABIT:
- kills(ix, iy, -1);
- break;
-
- case BASE:
- killb(Ship.quadx, Ship.quady);
- Game.killb += 1;
- break;
- default:
- printf("Unknown object %c at %d,%d destroyed\n",
- Sect[ix][iy], ix, iy);
- Sect[ix][iy] = EMPTY;
- break;
- }
- break;
- }
- if (damaged(TORPED) || Quad[Ship.quadx][Ship.quady].stars < 0)
- break;
- course += burst;
- }
- Move.free = 0;
-}
-
-
-/*
-** RANDOMIZE COURSE
-**
-** This routine randomizes the course for torpedo number 'n'.
-** Other things handled by this routine are misfires, damages
-** to the tubes, etc.
-*/
-
-randcourse(n)
-int n;
-{
- double r;
- int d;
-
- d = ((franf() + franf()) - 1.0) * 20;
- if (abs(d) > 12)
- {
- printf("Photon tubes misfire");
- if (n < 0)
- printf("\n");
- else
- printf(" on torpedo %d\n", n);
- if (ranf(2))
- {
- damage(TORPED, 0.2 * abs(d) * (franf() + 1.0));
- }
- d *= 1.0 + 2.0 * franf();
- }
- if (Ship.shldup || Ship.cond == DOCKED)
- {
- r = Ship.shield;
- r = 1.0 + r / Param.shield;
- if (Ship.cond == DOCKED)
- r = 2.0;
- d *= r;
- }
- return (d);
-}
diff --git a/games/trek/trek.6 b/games/trek/trek.6
deleted file mode 100644
index a0ebd20..0000000
--- a/games/trek/trek.6
+++ /dev/null
@@ -1,91 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)trek.6 8.2 (Berkeley) 12/30/93
-.\" $FreeBSD$
-.\"
-.TH TREK 6 "December 30, 1993"
-.UC 4
-.SH NAME
-trek \- trekkie game
-.SH SYNOPSIS
-.B /usr/games/trek
-[ [
-.B \-a
-] file ]
-.SH DESCRIPTION
-.I Trek
-is a game of space glory and war. Below is a summary of commands.
-For complete documentation, see
-.IR Trek
-by Eric Allman.
-.PP
-If a filename is given, a log of the game is written onto that file.
-If the
-.B \-a
-flag is given before the filename, that file is appended to, not truncated.
-.PP
-The game will ask you what length game you would like.
-Valid responses are \*(lqshort\*(rq, \*(lqmedium\*(rq, and \*(lqlong\*(rq.
-You may also type \*(lqrestart\*(rq, which restarts a previously saved game.
-You will then be prompted for the skill, to which you must respond
-\*(lqnovice\*(rq, \*(lqfair\*(rq, \*(lqgood\*(rq, \*(lqexpert\*(rq,
-\*(lqcommodore\*(rq, or \*(lqimpossible\*(rq.
-You should normally start out with a novice and work up.
-.PP
-In general, throughout the game, if you forget what is appropriate
-the game will tell you what it expects if you just type in a question mark.
-.SH AUTHOR
-Eric Allman
-.SH "SEE ALSO"
-/usr/share/doc/usd/31.trek/*
-.SH "COMMAND SUMMARY"
-.ie t .ds f \fB
-.el .ds f \fI
-.ta 3i
-.nf
-\*fabandon\fR \*fca\fRpture
-\*fcl\fRoak \*fu\fRp/\*fd\fRown
-\*fc\fRomputer request; ... \*fda\fRmages
-\*fdestruct\fR \*fdo\fRck
-\*fhelp\fR \*fi\fRmpulse course distance
-\*fl\fRrscan \*fm\fRove course distance
-\*fp\fRhasers \*fa\fRutomatic amount
-\*fp\fRhasers \*fm\fRanual amt1 course1 spread1 ...
-\*ft\fRorpedo course [\*fy\fRes] angle/\*fn\fRo
-\*fram\fR course distance \*fr\fRest time
-\*fshell\fR \*fsh\fRields \*fu\fRp/\*fd\fRown
-\*fs\fRrscan [\*fy\fRes/\*fn\fRo]
-\*fst\fRatus \*fterminate\fR \*fy\fRes/\*fn\fRo
-\*fu\fRndock \*fv\fRisual course
-\*fw\fRarp warp_factor
-.fi
-.DT
diff --git a/games/trek/trek.h b/games/trek/trek.h
deleted file mode 100644
index d628c80..0000000
--- a/games/trek/trek.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)trek.h 8.1 (Berkeley) 5/31/93
- */
-
-/*
-** Global Declarations
-**
-** Virtually all non-local variable declarations are made in this
-** file. Exceptions are those things which are initialized, which
-** are defined in "externs.c", and things which are local to one
-** program file.
-**
-** So far as I know, nothing in here must be preinitialized to
-** zero.
-**
-** You may have problems from the loader if you move this to a
-** different machine. These things actually get allocated in each
-** source file, which UNIX allows; however, you may (on other
-** systems) have to change everything in here to be "extern" and
-** actually allocate stuff in "externs.c"
-*/
-
-/* external function definitions */
-extern double franf(); /* floating random number function */
-extern double sqrt(); /* square root */
-extern double sin(), cos(); /* trig functions */
-extern double atan2(); /* fancy arc tangent function */
-extern double log(); /* log base e */
-extern double pow(); /* power function */
-extern double fabs(); /* absolute value function */
-extern double exp(); /* exponential function */
-
-/********************* GALAXY **************************/
-
-/* galactic parameters */
-# define NSECTS 10 /* dimensions of quadrant in sectors */
-# define NQUADS 8 /* dimension of galazy in quadrants */
-# define NINHAB 32 /* number of quadrants which are inhabited */
-
-struct quad /* definition for each quadrant */
-{
- char bases; /* number of bases in this quadrant */
- char klings; /* number of Klingons in this quadrant */
- char holes; /* number of black holes in this quadrant */
- int scanned; /* star chart entry (see below) */
- char stars; /* number of stars in this quadrant */
- char qsystemname; /* starsystem name (see below) */
-};
-
-# define Q_DISTRESSED 0200
-# define Q_SYSTEM 077
-
-/* systemname conventions:
- * 1 -> NINHAB index into Systemname table for live system.
- * + Q_DISTRESSED distressed starsystem -- systemname & Q_SYSTEM
- * is the index into the Event table which will
- * have the system name
- * 0 dead or nonexistent starsystem
- *
- * starchart ("scanned") conventions:
- * 0 -> 999 taken as is
- * -1 not yet scanned ("...")
- * 1000 supernova ("///")
- * 1001 starbase + ??? (".1.")
-*/
-
-/* ascii names of systems */
-extern char *Systemname[NINHAB];
-
-/* quadrant definition */
-struct quad Quad[NQUADS][NQUADS];
-
-/* defines for sector map (below) */
-# define EMPTY '.'
-# define STAR '*'
-# define BASE '#'
-# define ENTERPRISE 'E'
-# define QUEENE 'Q'
-# define KLINGON 'K'
-# define INHABIT '@'
-# define HOLE ' '
-
-/* current sector map */
-char Sect[NSECTS][NSECTS];
-
-
-/************************ DEVICES ******************************/
-
-# define NDEV 16 /* max number of devices */
-
-/* device tokens */
-# define WARP 0 /* warp engines */
-# define SRSCAN 1 /* short range scanners */
-# define LRSCAN 2 /* long range scanners */
-# define PHASER 3 /* phaser control */
-# define TORPED 4 /* photon torpedo control */
-# define IMPULSE 5 /* impulse engines */
-# define SHIELD 6 /* shield control */
-# define COMPUTER 7 /* on board computer */
-# define SSRADIO 8 /* subspace radio */
-# define LIFESUP 9 /* life support systems */
-# define SINS 10 /* Space Inertial Navigation System */
-# define CLOAK 11 /* cloaking device */
-# define XPORTER 12 /* transporter */
-# define SHUTTLE 13 /* shuttlecraft */
-
-/* device names */
-struct device
-{
- char *name; /* device name */
- char *person; /* the person who fixes it */
-};
-
-struct device Device[NDEV];
-
-/*************************** EVENTS ****************************/
-
-# define NEVENTS 12 /* number of different event types */
-
-# define E_LRTB 1 /* long range tractor beam */
-# define E_KATSB 2 /* Klingon attacks starbase */
-# define E_KDESB 3 /* Klingon destroys starbase */
-# define E_ISSUE 4 /* distress call is issued */
-# define E_ENSLV 5 /* Klingons enslave a quadrant */
-# define E_REPRO 6 /* a Klingon is reproduced */
-# define E_FIXDV 7 /* fix a device */
-# define E_ATTACK 8 /* Klingon attack during rest period */
-# define E_SNAP 9 /* take a snapshot for time warp */
-# define E_SNOVA 10 /* supernova occurs */
-
-# define E_GHOST 0100 /* ghost of a distress call if ssradio out */
-# define E_HIDDEN 0200 /* event that is unreportable because ssradio out */
-# define E_EVENT 077 /* mask to get event code */
-
-struct event
-{
- char x, y; /* coordinates */
- double date; /* trap stardate */
- char evcode; /* event type */
- char systemname; /* starsystem name */
-};
-/* systemname conventions:
- * 1 -> NINHAB index into Systemname table for reported distress calls
- *
- * evcode conventions:
- * 1 -> NEVENTS-1 event type
- * + E_HIDDEN unreported (SSradio out)
- * + E_GHOST actually already expired
- * 0 unallocated
- */
-
-# define MAXEVENTS 25 /* max number of concurrently pending events */
-
-struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
-
-/***************************** KLINGONS *******************************/
-
-struct kling
-{
- char x, y; /* coordinates */
- int power; /* power left */
- double dist; /* distance to Enterprise */
- double avgdist; /* average over this move */
- char srndreq; /* set if surrender has been requested */
-};
-
-# define MAXKLQUAD 9 /* maximum klingons per quadrant */
-
-/********************** MISCELLANEOUS ***************************/
-
-/* condition codes */
-# define GREEN 0
-# define DOCKED 1
-# define YELLOW 2
-# define RED 3
-
-/* starbase coordinates */
-# define MAXBASES 9 /* maximum number of starbases in galaxy */
-
-/* distress calls */
-# define MAXDISTR 5 /* maximum concurrent distress calls */
-
-/* phaser banks */
-# define NBANKS 6 /* number of phaser banks */
-
-struct xy
-{
- char x, y; /* coordinates */
-};
-
-
-/*
- * note that much of the stuff in the following structs CAN NOT
- * be moved around!!!!
- */
-
-
-/* information regarding the state of the starship */
-struct
-{
- double warp; /* warp factor */
- double warp2; /* warp factor squared */
- double warp3; /* warp factor cubed */
- char shldup; /* shield up flag */
- char cloaked; /* set if cloaking device on */
- int energy; /* starship's energy */
- int shield; /* energy in shields */
- double reserves; /* life support reserves */
- int crew; /* ship's complement */
- int brigfree; /* space left in brig */
- char torped; /* torpedoes */
- char cloakgood; /* set if we have moved */
- int quadx; /* quadrant x coord */
- int quady; /* quadrant y coord */
- int sectx; /* sector x coord */
- int secty; /* sector y coord */
- char cond; /* condition code */
- char sinsbad; /* Space Inertial Navigation System condition */
- char *shipname; /* name of current starship */
- char ship; /* current starship */
- int distressed; /* number of distress calls */
-} Ship;
-
-/* sinsbad is set if SINS is working but not calibrated */
-
-/* game related information, mostly scoring */
-struct
-{
- int killk; /* number of klingons killed */
- int deaths; /* number of deaths onboard Enterprise */
- char negenbar; /* number of hits on negative energy barrier */
- char killb; /* number of starbases killed */
- int kills; /* number of stars killed */
- char skill; /* skill rating of player */
- char length; /* length of game */
- char killed; /* set if you were killed */
- char killinhab; /* number of inhabited starsystems killed */
- char tourn; /* set if a tournament game */
- char passwd[15]; /* game password */
- char snap; /* set if snapshot taken */
- char helps; /* number of help calls */
- int captives; /* total number of captives taken */
-} Game;
-
-/* per move information */
-struct
-{
- char free; /* set if a move is free */
- char endgame; /* end of game flag */
- char shldchg; /* set if shields changed this move */
- char newquad; /* set if just entered this quadrant */
- char resting; /* set if this move is a rest */
- double time; /* time used this move */
-} Move;
-
-/* parametric information */
-struct
-{
- char bases; /* number of starbases */
- char klings; /* number of klingons */
- double date; /* stardate */
- double time; /* time left */
- double resource; /* Federation resources */
- int energy; /* starship's energy */
- int shield; /* energy in shields */
- double reserves; /* life support reserves */
- int crew; /* size of ship's complement */
- int brigfree; /* max possible number of captives */
- char torped; /* photon torpedos */
- double damfac[NDEV]; /* damage factor */
- double dockfac; /* docked repair time factor */
- double regenfac; /* regeneration factor */
- int stopengy; /* energy to do emergency stop */
- int shupengy; /* energy to put up shields */
- int klingpwr; /* Klingon initial power */
- int warptime; /* time chewer multiplier */
- double phasfac; /* Klingon phaser power eater factor */
- char moveprob[6]; /* probability that a Klingon moves */
- double movefac[6]; /* Klingon move distance multiplier */
- double eventdly[NEVENTS]; /* event time multipliers */
- double navigcrud[2]; /* navigation crudup factor */
- int cloakenergy; /* cloaking device energy per stardate */
- double damprob[NDEV]; /* damage probability */
- double hitfac; /* Klingon attack factor */
- int klingcrew; /* number of Klingons in a crew */
- double srndrprob; /* surrender probability */
- int energylow; /* low energy mark (cond YELLOW) */
-} Param;
-
-/* Sum of damage probabilities must add to 1000 */
-
-/* other information kept in a snapshot */
-struct
-{
- char bases; /* number of starbases */
- char klings; /* number of klingons */
- double date; /* stardate */
- double time; /* time left */
- double resource; /* Federation resources */
- char distressed; /* number of currently distressed quadrants */
- struct event *eventptr[NEVENTS]; /* pointer to event structs */
- struct xy base[MAXBASES]; /* locations of starbases */
-} Now;
-
-/* Other stuff, not dumped in a snapshot */
-struct
-{
- struct kling klingon[MAXKLQUAD]; /* sorted Klingon list */
- char nkling; /* number of Klingons in this sector */
- /* < 0 means automatic override mode */
- char fast; /* set if speed > 300 baud */
- struct xy starbase; /* starbase in current quadrant */
- char snapshot[sizeof Quad + sizeof Event + sizeof Now]; /* snapshot for time warp */
- char statreport; /* set to get a status report on a srscan */
-} Etc;
-
-/*
- * eventptr is a pointer to the event[] entry of the last
- * scheduled event of each type. Zero if no such event scheduled.
- */
-
-/* Klingon move indicies */
-# define KM_OB 0 /* Old quadrant, Before attack */
-# define KM_OA 1 /* Old quadrant, After attack */
-# define KM_EB 2 /* Enter quadrant, Before attack */
-# define KM_EA 3 /* Enter quadrant, After attack */
-# define KM_LB 4 /* Leave quadrant, Before attack */
-# define KM_LA 5 /* Leave quadrant, After attack */
-
-/* you lose codes */
-# define L_NOTIME 1 /* ran out of time */
-# define L_NOENGY 2 /* ran out of energy */
-# define L_DSTRYD 3 /* destroyed by a Klingon */
-# define L_NEGENB 4 /* ran into the negative energy barrier */
-# define L_SUICID 5 /* destroyed in a nova */
-# define L_SNOVA 6 /* destroyed in a supernova */
-# define L_NOLIFE 7 /* life support died (so did you) */
-# define L_NOHELP 8 /* you could not be rematerialized */
-# define L_TOOFAST 9 /* pretty stupid going at warp 10 */
-# define L_STAR 10 /* ran into a star */
-# define L_DSTRCT 11 /* self destructed */
-# define L_CAPTURED 12 /* captured by Klingons */
-# define L_NOCREW 13 /* you ran out of crew */
-
-/****************** COMPILE OPTIONS ***********************/
-
-/* Trace info */
-# define xTRACE 1
-int Trace;
-
-extern char *systemname();
diff --git a/games/trek/utility.c b/games/trek/utility.c
deleted file mode 100644
index 478c74f..0000000
--- a/games/trek/utility.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)utility.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
-** ASSORTED UTILITY ROUTINES
-*/
-#include <stdio.h>
-#include <varargs.h>
-
-/*
-** BLOCK MOVE
-**
-** Moves a block of storage of length `l' bytes from the data
-** area pointed to by `a' to the area pointed to by `b'.
-** Returns the address of the byte following the `b' field.
-** Overflow of `b' is not tested.
-*/
-
-char *bmove(a, b, l)
-char *a, *b;
-int l;
-{
- int n;
- char *p, *q;
-
- p = a;
- q = b;
- n = l;
- while (n--)
- *q++ = *p++;
- return (q);
-}
-
-
-/*
-** STRING EQUALITY TEST
-** null-terminated strings `a' and `b' are tested for
-** absolute equality.
-** returns one if equal, zero otherwise.
-*/
-
-sequal(a, b)
-char *a, *b;
-{
- char *p, *q;
-
- p = a;
- q = b;
- while (*p || *q)
- if (*p++ != *q++)
- return(0);
- return(1);
-}
-
-
-/*
-** STRING CONCATENATE
-**
-** The strings `s1' and `s2' are concatenated and stored into
-** `s3'. It is ok for `s1' to equal `s3', but terrible things
-** will happen if `s2' equals `s3'. The return value is is a
-** pointer to the end of `s3' field.
-*/
-
-char *concat(s1, s2, s3)
-char *s1, *s2, *s3;
-{
- char *p;
- char *q;
-
- p = s3;
- q = s1;
- while (*q)
- *p++ = *q++;
- q = s2;
- while (*q)
- *p++ = *q++;
- *p = 0;
- return (p);
-}
-
-
-/*
-** FIND STRING LENGTH
-**
-** The length of string `s' (excluding the null byte which
-** terminates the string) is returned.
-*/
-
-length(s)
-char *s;
-{
- int l;
- char *p;
-
- l = 0;
- p = s;
- while (*p++)
- l++;
- return(l);
-}
-
-
-/*
-** SYSTEM ERROR
-*/
-
-syserr(fmt, va_alist)
-const char *fmt;
-va_dcl
-{
- va_list ap;
- extern int errno;
-
- va_start(ap);
- printf("\n\07TREK SYSERR: ");
- vfprintf(stdout, fmt, ap);
- printf("\n");
- if (errno)
- printf("\tsystem error %d\n", errno);
- va_end(ap);
- exit(1);
-}
diff --git a/games/trek/visual.c b/games/trek/visual.c
deleted file mode 100644
index 5d00f6b..0000000
--- a/games/trek/visual.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)visual.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** VISUAL SCAN
-**
-** A visual scan is made in a particular direction of three sectors
-** in the general direction specified. This takes time, and
-** Klingons can attack you, so it should be done only when sensors
-** are out.
-*/
-
-/* This struct[] has the delta x, delta y for particular directions */
-struct xy Visdelta[11] =
-{
- -1, -1,
- -1, 0,
- -1, 1,
- 0, 1,
- 1, 1,
- 1, 0,
- 1, -1,
- 0, -1,
- -1, -1,
- -1, 0,
- -1, 1
-};
-
-visual()
-{
- int ix, iy;
- int co;
- struct xy *v;
-
- co = getintpar("direction");
- if (co < 0 || co > 360)
- return;
- co = (co + 22) / 45;
- v = &Visdelta[co];
- ix = Ship.sectx + v->x;
- iy = Ship.secty + v->y;
- if (ix < 0 || ix >= NSECTS || iy < 0 || iy >= NSECTS)
- co = '?';
- else
- co = Sect[ix][iy];
- printf("%d,%d %c ", ix, iy, co);
- v++;
- ix = Ship.sectx + v->x;
- iy = Ship.secty + v->y;
- if (ix < 0 || ix >= NSECTS || iy < 0 || iy >= NSECTS)
- co = '?';
- else
- co = Sect[ix][iy];
- printf("%c ", co);
- v++;
- ix = Ship.sectx + v->x;
- iy = Ship.secty + v->y;
- if (ix < 0 || ix >= NSECTS || iy < 0 || iy >= NSECTS)
- co = '?';
- else
- co = Sect[ix][iy];
- printf("%c %d,%d\n", co, ix, iy);
- Move.time = 0.05;
- Move.free = 0;
-}
diff --git a/games/trek/warp.c b/games/trek/warp.c
deleted file mode 100644
index cead28b..0000000
--- a/games/trek/warp.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)warp.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-
-/*
-** MOVE UNDER WARP POWER
-**
-** This is both the "move" and the "ram" commands, differing
-** only in the flag 'fl'. It is also used for automatic
-** emergency override mode, when 'fl' is < 0 and 'c' and 'd'
-** are the course and distance to be moved. If 'fl' >= 0,
-** the course and distance are asked of the captain.
-**
-** The guts of this routine are in the routine move(), which
-** is shared with impulse(). Also, the working part of this
-** routine is very small; the rest is to handle the slight chance
-** that you may be moving at some riduculous speed. In that
-** case, there is code to handle time warps, etc.
-*/
-
-warp(fl, c, d)
-int fl, c;
-double d;
-{
- int course;
- double power;
- double dist;
- double time;
- double speed;
- double frac;
- int percent;
- int i;
- extern double move();
-
- if (Ship.cond == DOCKED)
- return (printf("%s is docked\n", Ship.shipname));
- if (damaged(WARP))
- {
- return (out(WARP));
- }
- if (fl < 0)
- {
- course = c;
- dist = d;
- }
- else
- if (getcodi(&course, &dist))
- return;
-
- /* check to see that we are not using an absurd amount of power */
- power = (dist + 0.05) * Ship.warp3;
- percent = 100 * power / Ship.energy + 0.5;
- if (percent >= 85)
- {
- printf("Scotty: That would consume %d%% of our remaining energy.\n",
- percent);
- if (!getynpar("Are you sure that is wise"))
- return;
- }
-
- /* compute the speed we will move at, and the time it will take */
- speed = Ship.warp2 / Param.warptime;
- time = dist / speed;
-
- /* check to see that that value is not ridiculous */
- percent = 100 * time / Now.time + 0.5;
- if (percent >= 85)
- {
- printf("Spock: That would take %d%% of our remaining time.\n",
- percent);
- if (!getynpar("Are you sure that is wise"))
- return;
- }
-
- /* compute how far we will go if we get damages */
- if (Ship.warp > 6.0 && ranf(100) < 20 + 15 * (Ship.warp - 6.0))
- {
- frac = franf();
- dist *= frac;
- time *= frac;
- damage(WARP, (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20);
- }
-
- /* do the move */
- Move.time = move(fl, course, time, speed);
-
- /* see how far we actually went, and decrement energy appropriately */
- dist = Move.time * speed;
- Ship.energy -= dist * Ship.warp3 * (Ship.shldup + 1);
-
- /* test for bizarre events */
- if (Ship.warp <= 9.0)
- return;
- printf("\n\n ___ Speed exceeding warp nine ___\n\n");
- sleep(2);
- printf("Ship's safety systems malfunction\n");
- sleep(2);
- printf("Crew experiencing extreme sensory distortion\n");
- sleep(4);
- if (ranf(100) >= 100 * dist)
- {
- return (printf("Equilibrium restored -- all systems normal\n"));
- }
-
- /* select a bizzare thing to happen to us */
- percent = ranf(100);
- if (percent < 70)
- {
- /* time warp */
- if (percent < 35 || !Game.snap)
- {
- /* positive time warp */
- time = (Ship.warp - 8.0) * dist * (franf() + 1.0);
- Now.date += time;
- printf("Positive time portal entered -- it is now Stardate %.2f\n",
- Now.date);
- for (i = 0; i < MAXEVENTS; i++)
- {
- percent = Event[i].evcode;
- if (percent == E_FIXDV || percent == E_LRTB)
- Event[i].date += time;
- }
- return;
- }
-
- /* s/he got lucky: a negative time portal */
- time = Now.date;
- i = (int) Etc.snapshot;
- bmove(i, Quad, sizeof Quad);
- bmove(i += sizeof Quad, Event, sizeof Event);
- bmove(i += sizeof Event, &Now, sizeof Now);
- printf("Negative time portal entered -- it is now Stardate %.2f\n",
- Now.date);
- for (i = 0; i < MAXEVENTS; i++)
- if (Event[i].evcode == E_FIXDV)
- reschedule(&Event[i], Event[i].date - time);
- return;
- }
-
- /* test for just a lot of damage */
- if (percent < 80)
- lose(L_TOOFAST);
- printf("Equilibrium restored -- extreme damage occured to ship systems\n");
- for (i = 0; i < NDEV; i++)
- damage(i, (3.0 * (franf() + franf()) + 1.0) * Param.damfac[i]);
- Ship.shldup = 0;
-}
diff --git a/games/trek/win.c b/games/trek/win.c
deleted file mode 100644
index 0920f75..0000000
--- a/games/trek/win.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "trek.h"
-# include "getpar.h"
-# include <setjmp.h>
-
-/*
-** Signal game won
-**
-** This routine prints out the win message, arranges to print out
-** your score, tells you if you have a promotion coming to you,
-** cleans up the current input line, and arranges to have you
-** asked whether or not you want another game (via the longjmp()
-** call).
-**
-** Pretty straightforward, although the promotion algorithm is
-** pretty off the wall.
-*/
-
-win()
-{
- long s;
- extern jmp_buf env;
- extern long score();
- extern struct cvntab Skitab[];
- struct cvntab *p;
-
- sleep(1);
- printf("\nCongratulations, you have saved the Federation\n");
- Move.endgame = 1;
-
- /* print and return the score */
- s = score();
-
- /* decide if she gets a promotion */
- if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && 5 * Game.kills + Game.deaths < 100 &&
- s >= 1000 && Ship.ship == ENTERPRISE)
- {
- printf("In fact, you are promoted one step in rank,\n");
- if (Game.skill >= 6)
- printf("to the exalted rank of Commodore Emeritus\n");
- else
- {
- p = &Skitab[Game.skill - 1];
- printf("from %s%s ", p->abrev, p->full);
- p++;
- printf("to %s%s\n", p->abrev, p->full);
- }
- }
-
- /* clean out input, and request new game */
- skiptonl(0);
- longjmp(env, 1);
-}
diff --git a/games/wargames/Makefile b/games/wargames/Makefile
deleted file mode 100644
index f692921..0000000
--- a/games/wargames/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= wargames
-LDADD= -lcurses
-MAN= wargames.6
-
-.include <bsd.prog.mk>
diff --git a/games/wargames/wargames.6 b/games/wargames/wargames.6
deleted file mode 100644
index 20c31e5..0000000
--- a/games/wargames/wargames.6
+++ /dev/null
@@ -1,51 +0,0 @@
-.\" $NetBSD: wargames.6,v 1.1 2000/01/23 21:04:56 jsm Exp $
-.\"
-.\" Copyright (c) 1998 Joey Hess
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 22, 1998
-.Dt WARGAMES 6
-.Os
-.Sh NAME
-.Nm wargames
-.Nd shall we play a game?
-.Sh SYNOPSIS
-.Nm
-.Sh DESCRIPTION
-.Dq Shall we play a game?\&
--- computer,
-.Nm
-.Pp
-Just like in the movie, the computer will happily play a
-game with you. The likelihood of Global Thermonuclear Warfare
-resulting is much smaller....
-.Sh SEE ALSO
-Wargames,
-the movie (an MGM production, PG-13, directed by John Badham, 1983).
-.Sh AUTHORS
-This manual page was written by Joey Hess <joeyh@kitenet.net>.
diff --git a/games/wargames/wargames.c b/games/wargames/wargames.c
deleted file mode 100644
index 4a2282e..0000000
--- a/games/wargames/wargames.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Program: wargames(6)
- * Author: Juli Mallett <jmallett@FreeBSD.org>
- * Copyright: This file is in the public domain.
- * Description:
- * Would you like to play a game? Or is the game you chose just a practice
- * in futility... Based on the original Berkeley shell script, inspired by
- * the motion picture.
- *
- * From: @(#)wargames.sh 8.1 (Berkeley) 5/31/93
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <ncurses.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int
-main(void)
-{
- struct stat sb;
- char buffer[MAXPATHLEN];
- char *line;
- size_t len;
-
- printf("Would you like to play a game? ");
- line = fgetln(stdin, &len);
- if (line == NULL) {
- err(1, "I'm sorry to hear that");
- }
- line[len - 1] = '\0';
- snprintf(buffer, sizeof buffer, "/usr/games/%s", line);
- if (stat(buffer, &sb) != -1) {
- initscr();
- clear();
- endwin();
- execl(buffer, line, NULL);
- }
- printf("Funny, the only way to win is not to play at all.\n");
- return 0;
-}
diff --git a/games/worm/Makefile b/games/worm/Makefile
deleted file mode 100644
index 531aa8d..0000000
--- a/games/worm/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= worm
-MAN= worm.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/worm/worm.6 b/games/worm/worm.6
deleted file mode 100644
index 6fa1f41..0000000
--- a/games/worm/worm.6
+++ /dev/null
@@ -1,66 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)worm.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH WORM 6 "May 31, 1993"
-.UC 4
-.SH NAME
-worm \- play the growing worm game
-.SH SYNOPSIS
-.B worm
-[
-.I size
-]
-.SH DESCRIPTION
-In
-.I worm,
-you are a little worm, your body is the "o"'s on the screen
-and your head is the "@". You move with the hjkl keys (as in the game
-snake). If you don't press any keys, you continue in the direction you
-last moved. The upper case HJKL keys move you as if you had pressed
-several (9 for HL and 5 for JK) of the corresponding lower case key
-(unless you run into a digit, then it stops).
-.PP
-On the screen you will see a digit, if your worm eats the digit is will
-grow longer, the actual amount longer depends on which digit it was
-that you ate. The object of the game is to see how long you can make
-the worm grow.
-.PP
-The game ends when the worm runs into either the sides of the screen,
-or itself. The current score (how much the worm has grown) is kept in
-the upper left corner of the screen.
-.PP
-The optional argument, if present, is the initial length of the worm.
-.SH BUGS
-If the initial length of the worm is set to less than one or more
-than 75, various strange things happen.
diff --git a/games/worm/worm.c b/games/worm/worm.c
deleted file mode 100644
index 2282364..0000000
--- a/games/worm/worm.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Worm. Written by Michael Toy
- * UCSC
- */
-
-#include <ctype.h>
-#include <curses.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <unistd.h>
-
-#define newlink() (struct body *) malloc(sizeof (struct body));
-#define HEAD '@'
-#define BODY 'o'
-#define LENGTH 7
-#define RUNLEN 8
-#define CNTRL(p) (p-'A'+1)
-#if 0
-#ifndef baudrate
-# define baudrate() _tty.sg_ospeed
-#endif
-#endif
-
-WINDOW *tv;
-WINDOW *stw;
-struct body {
- int x;
- int y;
- struct body *prev;
- struct body *next;
-} *head, *tail, goody;
-int growing = 0;
-int running = 0;
-int slow = 0;
-int score = 0;
-int start_len = LENGTH;
-char lastch;
-char outbuf[BUFSIZ];
-
-void crash(void);
-void display(struct body *, char);
-void leave(int);
-void life(void);
-void newpos(struct body *);
-void prize(void);
-void process(char);
-long rnd(int);
-void setup(void);
-void suspend(int);
-void wake(int);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- char ch;
-
- /* revoke */
- setgid(getgid());
-
- if (argc == 2)
- start_len = atoi(argv[1]);
- if ((start_len <= 0) || (start_len > 500))
- start_len = LENGTH;
- setbuf(stdout, outbuf);
- srandomdev();
- signal(SIGALRM, wake);
- signal(SIGINT, leave);
- signal(SIGQUIT, leave);
- signal(SIGTSTP, suspend); /* process control signal */
- initscr();
- crmode();
- noecho();
- slow = (baudrate() <= B1200);
- clear();
- stw = newwin(1, COLS-1, 0, 0);
- tv = newwin(LINES-1, COLS-1, 1, 0);
- box(tv, '*', '*');
- scrollok(tv, FALSE);
- scrollok(stw, FALSE);
- wmove(stw, 0, 0);
- wprintw(stw, " Worm");
- refresh();
- wrefresh(stw);
- wrefresh(tv);
- life(); /* Create the worm */
- prize(); /* Put up a goal */
- while(1)
- {
- if (running)
- {
- running--;
- process(lastch);
- }
- else
- {
- fflush(stdout);
- if (read(0, &ch, 1) >= 0)
- process(ch);
- }
- }
-}
-
-void
-life()
-{
- struct body *bp, *np;
- int i;
-
- np = NULL;
- head = newlink();
- head->x = start_len+2;
- head->y = 12;
- head->next = NULL;
- display(head, HEAD);
- for (i = 0, bp = head; i < start_len; i++, bp = np) {
- np = newlink();
- np->next = bp;
- bp->prev = np;
- np->x = bp->x - 1;
- np->y = bp->y;
- display(np, BODY);
- }
- tail = np;
- tail->prev = NULL;
-}
-
-void
-display(pos, chr)
-struct body *pos;
-char chr;
-{
- wmove(tv, pos->y, pos->x);
- waddch(tv, chr);
-}
-
-void
-leave(sig)
-int sig;
-{
- endwin();
- exit(0);
-}
-
-void
-wake(sig)
-int sig;
-{
- signal(SIGALRM, wake);
- fflush(stdout);
- process(lastch);
-}
-
-long
-rnd(range)
-{
- return random() % range;
-}
-
-void
-newpos(bp)
-struct body * bp;
-{
- do {
- bp->y = rnd(LINES-3)+ 2;
- bp->x = rnd(COLS-3) + 1;
- wmove(tv, bp->y, bp->x);
- } while(winch(tv) != ' ');
-}
-
-void
-prize()
-{
- int value;
-
- value = rnd(9) + 1;
- newpos(&goody);
- waddch(tv, value+'0');
- wrefresh(tv);
-}
-
-void
-process(ch)
-char ch;
-{
- int x,y;
- struct body *nh;
-
- alarm(0);
- x = head->x;
- y = head->y;
- switch(ch)
- {
- case 'h': x--; break;
- case 'j': y++; break;
- case 'k': y--; break;
- case 'l': x++; break;
- case 'H': x--; running = RUNLEN; ch = tolower(ch); break;
- case 'J': y++; running = RUNLEN/2; ch = tolower(ch); break;
- case 'K': y--; running = RUNLEN/2; ch = tolower(ch); break;
- case 'L': x++; running = RUNLEN; ch = tolower(ch); break;
- case '\f': setup(); return;
- case CNTRL('Z'): suspend(0); return;
- case CNTRL('C'): crash(); return;
- case CNTRL('D'): crash(); return;
- default: if (! running) alarm(1);
- return;
- }
- lastch = ch;
- if (growing == 0)
- {
- display(tail, ' ');
- tail->next->prev = NULL;
- nh = tail->next;
- free(tail);
- tail = nh;
- }
- else growing--;
- display(head, BODY);
- wmove(tv, y, x);
- if (isdigit(ch = winch(tv)))
- {
- growing += ch-'0';
- prize();
- score += growing;
- running = 0;
- wmove(stw, 0, 68);
- wprintw(stw, "Score: %3d", score);
- wrefresh(stw);
- }
- else if(ch != ' ') crash();
- nh = newlink();
- nh->next = NULL;
- nh->prev = head;
- head->next = nh;
- nh->y = y;
- nh->x = x;
- display(nh, HEAD);
- head = nh;
- if (!(slow && running))
- wrefresh(tv);
- if (!running)
- alarm(1);
-}
-
-void
-crash()
-{
- sleep(2);
- clear();
- move(23, 0);
- refresh();
- printf("Well, you ran into something and the game is over.\n");
- printf("Your final score was %d\n", score);
- leave(0);
-}
-
-void
-suspend(sig)
-int sig;
-{
- move(LINES-1, 0);
- refresh();
- endwin();
- fflush(stdout);
- kill(getpid(), SIGTSTP);
- signal(SIGTSTP, suspend);
- crmode();
- noecho();
- setup();
-}
-
-void
-setup()
-{
- clear();
- refresh();
- touchwin(stw);
- wrefresh(stw);
- touchwin(tv);
- wrefresh(tv);
- alarm(1);
-}
diff --git a/games/worms/Makefile b/games/worms/Makefile
deleted file mode 100644
index a9d48b5..0000000
--- a/games/worms/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= worms
-MAN= worms.6
-DPADD= ${LIBCURSES}
-LDADD= -lcurses
-
-.include <bsd.prog.mk>
diff --git a/games/worms/worms.6 b/games/worms/worms.6
deleted file mode 100644
index fdb130e..0000000
--- a/games/worms/worms.6
+++ /dev/null
@@ -1,67 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)worms.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.Dd May 31, 1993
-.Dt WORMS 6
-.Os
-.Sh NAME
-.Nm worms
-.Nd animate worms on a display terminal
-.Sh SYNOPSIS
-.Nm
-.Op Fl ft
-.Op Fl d Ar delay
-.Op Fl l Ar length
-.Op Fl n Ar number
-.Sh DESCRIPTION
-A UNIX version of the DEC-2136 program
-.Dq worms .
-.Pp
-The options are as follows:
-.Bl -tag -width indent
-.It Fl f
-Makes a
-.Dq field
-for the worm(s) to eat.
-.It Fl t
-Makes each worm leave a trail behind it.
-.It Fl d
-Specifies a delay, in milliseconds, between each update. This is
-useful for fast terminals. Reasonable values are around 20-200. The
-default is 0.
-.It Fl l
-Specifies a length for each worm; the default is 16.
-.It Fl n
-Specifies the number of worms; the default is 3.
-.El
diff --git a/games/worms/worms.c b/games/worms/worms.c
deleted file mode 100644
index e605dc9..0000000
--- a/games/worms/worms.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- *
- * @@@ @@@ @@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@
- * @@@ @@@ @@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@
- * @@@ @@@ @@@@ @@@@ @@@@ @@@@ @@@ @@@@
- * @@@ @@ @@@ @@@ @@@ @@@ @@@ @@@ @@@
- * @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@
- * @@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@
- * @@@@@@@@@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@
- * @@@@ @@@@ @@@@@@@@@@@@ @@@ @@@ @@@ @@@
- * @@ @@ @@@@@@@@@@ @@@ @@@ @@@ @@@
- *
- * Eric P. Scott
- * Caltech High Energy Physics
- * October, 1980
- *
- */
-#include <sys/types.h>
-#include <curses.h>
-#include <err.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-static const struct options {
- int nopts;
- int opts[3];
-}
- normal[8] = {
- { 3, { 7, 0, 1 } },
- { 3, { 0, 1, 2 } },
- { 3, { 1, 2, 3 } },
- { 3, { 2, 3, 4 } },
- { 3, { 3, 4, 5 } },
- { 3, { 4, 5, 6 } },
- { 3, { 5, 6, 7 } },
- { 3, { 6, 7, 0 } }
-}, upper[8] = {
- { 1, { 1, 0, 0 } },
- { 2, { 1, 2, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 2, { 4, 5, 0 } },
- { 1, { 5, 0, 0 } },
- { 2, { 1, 5, 0 } }
-},
- left[8] = {
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 2, { 2, 3, 0 } },
- { 1, { 3, 0, 0 } },
- { 2, { 3, 7, 0 } },
- { 1, { 7, 0, 0 } },
- { 2, { 7, 0, 0 } }
-},
- right[8] = {
- { 1, { 7, 0, 0 } },
- { 2, { 3, 7, 0 } },
- { 1, { 3, 0, 0 } },
- { 2, { 3, 4, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 2, { 6, 7, 0 } }
-},
- lower[8] = {
- { 0, { 0, 0, 0 } },
- { 2, { 0, 1, 0 } },
- { 1, { 1, 0, 0 } },
- { 2, { 1, 5, 0 } },
- { 1, { 5, 0, 0 } },
- { 2, { 5, 6, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } }
-},
- upleft[8] = {
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 1, { 3, 0, 0 } },
- { 2, { 1, 3, 0 } },
- { 1, { 1, 0, 0 } }
-},
- upright[8] = {
- { 2, { 3, 5, 0 } },
- { 1, { 3, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 1, { 5, 0, 0 } }
-},
- lowleft[8] = {
- { 3, { 7, 0, 1 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 1, { 1, 0, 0 } },
- { 2, { 1, 7, 0 } },
- { 1, { 7, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } }
-},
- lowright[8] = {
- { 0, { 0, 0, 0 } },
- { 1, { 7, 0, 0 } },
- { 2, { 5, 7, 0 } },
- { 1, { 5, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } },
- { 0, { 0, 0, 0 } }
-};
-
-
-static const char flavor[] = {
- 'O', '*', '#', '$', '%', '0', '@', '~'
-};
-static const short xinc[] = {
- 1, 1, 1, 0, -1, -1, -1, 0
-}, yinc[] = {
- -1, 0, 1, 1, 1, 0, -1, -1
-};
-static struct worm {
- int orientation, head;
- short *xpos, *ypos;
-} *worm;
-
-volatile sig_atomic_t sig_caught = 0;
-void nomem(void);
-void onsig(int);
-
-int
-main(int argc, char *argv[])
-{
- int x, y, h, n;
- struct worm *w;
- const struct options *op;
- short *ip;
- int CO, LI, last, bottom, ch, length, number, trail;
- short **ref;
- const char *field;
- char *mp;
- unsigned int delay = 0;
-
- mp = NULL;
- length = 16;
- number = 3;
- trail = ' ';
- field = NULL;
- while ((ch = getopt(argc, argv, "d:fl:n:t")) != -1)
- switch(ch) {
- case 'd':
- if ((delay = (unsigned int)strtoul(optarg, (char **)NULL, 10)) < 1 || delay > 1000)
- errx(1, "invalid delay (1-1000)");
- delay *= 1000; /* ms -> us */
- break;
- case 'f':
- field = "WORM";
- break;
- case 'l':
- if ((length = atoi(optarg)) < 2 || length > 1024) {
- errx(1, "invalid length (%d - %d).",
- 2, 1024);
- }
- break;
- case 'n':
- if ((number = atoi(optarg)) < 1) {
- errx(1, "invalid number of worms.");
- }
- break;
- case 't':
- trail = '.';
- break;
- case '?':
- default:
- (void)fprintf(stderr,
- "usage: worms [-ft] [-d delay] [-l length] [-n number]\n");
- exit(1);
- }
-
- if (!(worm = malloc((size_t)number *
- sizeof(struct worm))) || !(mp = malloc((size_t)1024)))
- nomem();
- initscr();
- CO = COLS;
- LI = LINES;
- last = CO - 1;
- bottom = LI - 1;
- if (!(ip = malloc((size_t)(LI * CO * sizeof(short)))))
- nomem();
- if (!(ref = malloc((size_t)(LI * sizeof(short *)))))
- nomem();
- for (n = 0; n < LI; ++n) {
- ref[n] = ip;
- ip += CO;
- }
- for (ip = ref[0], n = LI * CO; --n >= 0;)
- *ip++ = 0;
- for (n = number, w = &worm[0]; --n >= 0; w++) {
- w->orientation = w->head = 0;
- if (!(ip = malloc((size_t)(length * sizeof(short)))))
- nomem();
- w->xpos = ip;
- for (x = length; --x >= 0;)
- *ip++ = -1;
- if (!(ip = malloc((size_t)(length * sizeof(short)))))
- nomem();
- w->ypos = ip;
- for (y = length; --y >= 0;)
- *ip++ = -1;
- }
-
- (void)signal(SIGHUP, onsig);
- (void)signal(SIGINT, onsig);
- (void)signal(SIGQUIT, onsig);
- (void)signal(SIGSTOP, onsig);
- (void)signal(SIGTSTP, onsig);
- (void)signal(SIGTERM, onsig);
-
- if (field) {
- const char *p = field;
-
- for (y = LI; --y >= 0;) {
- for (x = CO; --x >= 0;) {
- addch(*p++);
- if (!*p)
- p = field;
- }
- refresh();
- }
- }
- for (;;) {
- refresh();
- if (sig_caught) {
- endwin();
- exit(0);
- }
- for (n = 0, w = &worm[0]; n < number; n++, w++) {
- if ((x = w->xpos[h = w->head]) < 0) {
- mvaddch(y = w->ypos[h] = bottom,
- x = w->xpos[h] = 0,
- flavor[n % sizeof(flavor)]);
- ref[y][x]++;
- }
- else
- y = w->ypos[h];
- if (++h == length)
- h = 0;
- if (w->xpos[w->head = h] >= 0) {
- int x1, y1;
-
- x1 = w->xpos[h];
- y1 = w->ypos[h];
- if (--ref[y1][x1] == 0) {
- mvaddch(y1, x1, trail);
- }
- }
- op = &(!x ? (!y ? upleft : (y == bottom ? lowleft : left)) : (x == last ? (!y ? upright : (y == bottom ? lowright : right)) : (!y ? upper : (y == bottom ? lower : normal))))[w->orientation];
- switch (op->nopts) {
- case 0:
- refresh();
- abort();
- return(1);
- case 1:
- w->orientation = op->opts[0];
- break;
- default:
- w->orientation =
- op->opts[(int)random() % op->nopts];
- }
- mvaddch(y += yinc[w->orientation],
- x += xinc[w->orientation],
- flavor[n % sizeof(flavor)]);
- ref[w->ypos[h] = y][w->xpos[h] = x]++;
- }
- if (usleep(delay))
- onsig(SIGTERM);
- }
-}
-
-void
-onsig(int signo)
-{
- sig_caught = 1;
-}
-
-void
-nomem(void)
-{
- errx(1, "not enough memory.");
-}
diff --git a/games/wump/Makefile b/games/wump/Makefile
deleted file mode 100644
index 8e58633..0000000
--- a/games/wump/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= wump
-FILES= wump.info
-MAN= wump.6
-HIDEGAME=hidegame
-
-.include <bsd.prog.mk>
diff --git a/games/wump/pathnames.h b/games/wump/pathnames.h
deleted file mode 100644
index 0de44c0..0000000
--- a/games/wump/pathnames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_PAGER "/usr/bin/more"
-#define _PATH_WUMPINFO "/usr/share/games/wump.info"
diff --git a/games/wump/wump.6 b/games/wump/wump.6
deleted file mode 100644
index 4ad38a8..0000000
--- a/games/wump/wump.6
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Dave Taylor, of Intuitive Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)wump.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH WUMP 6 "May 31, 1993"
-.UC 7
-.SH NAME
-wump \- hunt the wumpus in an underground cave
-.SH SYNOPSIS
-.ft B
-wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels]
-.ft R
-.SH DESCRIPTION
-The game
-.I wump
-is based on a fantasy game first presented in the pages of
-.I "People's Computer Company"
-in 1973.
-In Hunt the Wumpus you are placed in a cave built of many different rooms,
-all interconnected by tunnels.
-Your quest is to find and shoot the evil Wumpus that resides elsewhere in
-the cave without running into any pits or using up your limited supply of
-arrows.
-.PP
-The options are as follows:
-.TP
-.I -a
-Specifies the number of magic arrows the adventurer gets.
-The default is five.
-.TP
-.I -b
-Specifies the number of rooms in the cave which contain bats.
-The default is three.
-.TP
-.I -h
-Play the hard version -- more pits, more bats, and a generally more
-dangerous cave.
-.TP
-.I -n
-Specifies the number of rooms in the cave which contain bottomless pits.
-The default is three.
-.TP
-.I -r
-Specifies the number of rooms in the cave.
-The default cave size is twenty-five rooms.
-.TP
-.I -t
-Specifies the number of tunnels connecting each room in the cave to
-another room.
-Beware, too many tunnels in a small cave can easily cause it to collapse!
-The default cave room has three tunnels to other rooms.
-.PP
-While wandering through the cave you'll notice that, while there are tunnels
-everywhere, there are some mysterious quirks to the cave topology, including
-some tunnels that go from one room to another, but not necessarily back!
-Also, most pesky of all are the rooms that are home to large numbers of bats,
-which, upon being disturbed, will en masse grab you and move you to another
-portion of the cave (including those housing bottomless pits, sure
-death for unwary explorers).
-.PP
-Fortunately, you're not going into the cave without any weapons or tools,
-and in fact your biggest aids are your senses; you can often smell the
-rather odiferous Wumpus up to
-.I two
-rooms away, and you can always feel the drafts created by the occasional
-bottomless pit and hear the rustle of the bats in caves they might be
-sleeping within.
-.PP
-To kill the wumpus, you'll need to shoot it with one of your magic arrows.
-Fortunately, you don't have to be in the same room as the creature, and can
-instead shoot the arrow from as far as three or four rooms away!
-.PP
-When you shoot an arrow, you do so by typing in a list of rooms that you'd
-like it to travel to.
-If at any point in its travels it cannot find a tunnel to the room you
-specify from the room it's in, it will instead randomly fly down one of the
-tunnels, possibly, if you're real unlucky, even flying back into the room
-you're in and hitting you!
diff --git a/games/wump/wump.c b/games/wump/wump.c
deleted file mode 100644
index 76e9fbd..0000000
--- a/games/wump/wump.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Dave Taylor, of Intuitive Systems.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * A very new version of the age old favorite Hunt-The-Wumpus game that has
- * been a part of the BSD distribution of Unix for longer than us old folk
- * would care to remember.
- */
-
-#include <err.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "pathnames.h"
-
-/* some defines to spec out what our wumpus cave should look like */
-
-#define MAX_ARROW_SHOT_DISTANCE 6 /* +1 for '0' stopper */
-#define MAX_LINKS_IN_ROOM 25 /* a complex cave */
-
-#define MAX_ROOMS_IN_CAVE 250
-#define ROOMS_IN_CAVE 20
-#define MIN_ROOMS_IN_CAVE 10
-
-#define LINKS_IN_ROOM 3
-#define NUMBER_OF_ARROWS 5
-#define PIT_COUNT 3
-#define BAT_COUNT 3
-
-#define EASY 1 /* levels of play */
-#define HARD 2
-
-/* some macro definitions for cleaner output */
-
-#define plural(n) (n == 1 ? "" : "s")
-
-/* simple cave data structure; +1 so we can index from '1' not '0' */
-struct room_record {
- int tunnel[MAX_LINKS_IN_ROOM];
- int has_a_pit, has_a_bat;
-} cave[MAX_ROOMS_IN_CAVE+1];
-
-/*
- * global variables so we can keep track of where the player is, how
- * many arrows they still have, where el wumpo is, and so on...
- */
-int player_loc = -1; /* player location */
-int wumpus_loc = -1; /* The Bad Guy location */
-int level = EASY; /* level of play */
-int arrows_left; /* arrows unshot */
-
-#ifdef DEBUG
-int debug = 0;
-#endif
-
-int pit_num = PIT_COUNT; /* # pits in cave */
-int bat_num = BAT_COUNT; /* # bats */
-int room_num = ROOMS_IN_CAVE; /* # rooms in cave */
-int link_num = LINKS_IN_ROOM; /* links per room */
-int arrow_num = NUMBER_OF_ARROWS; /* arrow inventory */
-
-char answer[20]; /* user input */
-
-int bats_nearby(void);
-void cave_init(void);
-void clear_things_in_cave(void);
-void display_room_stats(void);
-int getans(const char *prompt);
-void initialize_things_in_cave(void);
-void instructions(void);
-int int_compare(const void *va, const void *vb);
-void jump(int where);
-void kill_wump(void);
-int move_to(char *room_number);
-void move_wump(void);
-void no_arrows(void);
-void pit_kill(void);
-int pit_nearby(void);
-void pit_survive(void);
-int shoot(char *room_list);
-void shoot_self(void);
-int take_action(void);
-void usage(void);
-void wump_kill(void);
-int wump_nearby(void);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- int c;
-
- /* revoke */
- setgid(getgid());
-
-#ifdef DEBUG
- while ((c = getopt(argc, argv, "a:b:hp:r:t:d")) != -1)
-#else
- while ((c = getopt(argc, argv, "a:b:hp:r:t:")) != -1)
-#endif
- switch (c) {
- case 'a':
- arrow_num = atoi(optarg);
- break;
- case 'b':
- bat_num = atoi(optarg);
- break;
-#ifdef DEBUG
- case 'd':
- debug = 1;
- break;
-#endif
- case 'h':
- level = HARD;
- break;
- case 'p':
- pit_num = atoi(optarg);
- break;
- case 'r':
- room_num = atoi(optarg);
- if (room_num < MIN_ROOMS_IN_CAVE) {
- (void)fprintf(stderr,
- "No self-respecting wumpus would live in such a small cave!\n");
- exit(1);
- }
- if (room_num > MAX_ROOMS_IN_CAVE) {
- (void)fprintf(stderr,
- "Even wumpii can't furnish caves that large!\n");
- exit(1);
- }
- break;
- case 't':
- link_num = atoi(optarg);
- if (link_num < 2) {
- (void)fprintf(stderr,
- "Wumpii like extra doors in their caves!\n");
- exit(1);
- }
- break;
- case '?':
- default:
- usage();
- }
-
- if (link_num > MAX_LINKS_IN_ROOM ||
- link_num > room_num - (room_num / 4)) {
- (void)fprintf(stderr,
-"Too many tunnels! The cave collapsed!\n(Fortunately, the wumpus escaped!)\n");
- exit(1);
- }
-
- if (level == HARD) {
- bat_num += ((random() % (room_num / 2)) + 1);
- pit_num += ((random() % (room_num / 2)) + 1);
- }
-
- if (bat_num > room_num / 2) {
- (void)fprintf(stderr,
-"The wumpus refused to enter the cave, claiming it was too crowded!\n");
- exit(1);
- }
-
- if (pit_num > room_num / 2) {
- (void)fprintf(stderr,
-"The wumpus refused to enter the cave, claiming it was too dangerous!\n");
- exit(1);
- }
-
- instructions();
- cave_init();
-
- /* and we're OFF! da dum, da dum, da dum, da dum... */
- (void)printf(
-"\nYou're in a cave with %d rooms and %d tunnels leading from each room.\n\
-There are %d bat%s and %d pit%s scattered throughout the cave, and your\n\
-quiver holds %d custom super anti-evil Wumpus arrows. Good luck.\n",
- room_num, link_num, bat_num, plural(bat_num), pit_num,
- plural(pit_num), arrow_num);
-
- for (;;) {
- initialize_things_in_cave();
- arrows_left = arrow_num;
- do {
- display_room_stats();
- (void)printf("Move or shoot? (m-s) ");
- (void)fflush(stdout);
- if (!fgets(answer, sizeof(answer), stdin))
- break;
- } while (!take_action());
-
- if (!getans("\nCare to play another game? (y-n) "))
- exit(0);
- if (getans("In the same cave? (y-n) "))
- clear_things_in_cave();
- else
- cave_init();
- }
- /* NOTREACHED */
- exit(EXIT_SUCCESS);
-}
-
-void
-display_room_stats()
-{
- int i;
-
- /*
- * Routine will explain what's going on with the current room, as well
- * as describe whether there are pits, bats, & wumpii nearby. It's
- * all pretty mindless, really.
- */
- (void)printf(
-"\nYou are in room %d of the cave, and have %d arrow%s left.\n",
- player_loc, arrows_left, plural(arrows_left));
-
- if (bats_nearby())
- (void)printf("*rustle* *rustle* (must be bats nearby)\n");
- if (pit_nearby())
- (void)printf("*whoosh* (I feel a draft from some pits).\n");
- if (wump_nearby())
- (void)printf("*sniff* (I can smell the evil Wumpus nearby!)\n");
-
- (void)printf("There are tunnels to rooms %d, ",
- cave[player_loc].tunnel[0]);
-
- for (i = 1; i < link_num - 1; i++)
- if (cave[player_loc].tunnel[i] <= room_num)
- (void)printf("%d, ", cave[player_loc].tunnel[i]);
- (void)printf("and %d.\n", cave[player_loc].tunnel[link_num - 1]);
-}
-
-int
-take_action()
-{
- /*
- * Do the action specified by the player, either 'm'ove, 's'hoot
- * or something exceptionally bizarre and strange! Returns 1
- * iff the player died during this turn, otherwise returns 0.
- */
- switch (*answer) {
- case 'M':
- case 'm': /* move */
- return(move_to(answer + 1));
- case 'S':
- case 's': /* shoot */
- return(shoot(answer + 1));
- case 'Q':
- case 'q':
- case 'x':
- exit(0);
- case '\n':
- return(0);
- }
- if (random() % 15 == 1)
- (void)printf("Que pasa?\n");
- else
- (void)printf("I don't understand!\n");
- return(0);
-}
-
-int
-move_to(room_number)
- char *room_number;
-{
- int i, just_moved_by_bats, next_room, tunnel_available;
-
- /*
- * This is responsible for moving the player into another room in the
- * cave as per their directions. If room_number is a null string,
- * then we'll prompt the user for the next room to go into. Once
- * we've moved into the room, we'll check for things like bats, pits,
- * and so on. This routine returns 1 if something occurs that kills
- * the player and 0 otherwise...
- */
- tunnel_available = just_moved_by_bats = 0;
- next_room = atoi(room_number);
-
- /* crap for magic tunnels */
- if (next_room == room_num + 1 &&
- cave[player_loc].tunnel[link_num-1] != next_room)
- ++next_room;
-
- while (next_room < 1 || next_room > room_num + 1) {
- if (next_room < 0 && next_room != -1)
-(void)printf("Sorry, but we're constrained to a semi-Euclidean cave!\n");
- if (next_room > room_num + 1)
-(void)printf("What? The cave surely isn't quite that big!\n");
- if (next_room == room_num + 1 &&
- cave[player_loc].tunnel[link_num-1] != next_room) {
- (void)printf("What? The cave isn't that big!\n");
- ++next_room;
- }
- (void)printf("To which room do you wish to move? ");
- (void)fflush(stdout);
- if (!fgets(answer, sizeof(answer), stdin))
- return(1);
- next_room = atoi(answer);
- }
-
- /* now let's see if we can move to that room or not */
- tunnel_available = 0;
- for (i = 0; i < link_num; i++)
- if (cave[player_loc].tunnel[i] == next_room)
- tunnel_available = 1;
-
- if (!tunnel_available) {
- (void)printf("*Oof!* (You hit the wall)\n");
- if (random() % 6 == 1) {
-(void)printf("Your colorful comments awaken the wumpus!\n");
- move_wump();
- if (wumpus_loc == player_loc) {
- wump_kill();
- return(1);
- }
- }
- return(0);
- }
-
- /* now let's move into that room and check it out for dangers */
- if (next_room == room_num + 1)
- jump(next_room = (random() % room_num) + 1);
-
- player_loc = next_room;
- for (;;) {
- if (next_room == wumpus_loc) { /* uh oh... */
- wump_kill();
- return(1);
- }
- if (cave[next_room].has_a_pit) {
- if (random() % 12 < 2) {
- pit_survive();
- return(0);
- } else {
- pit_kill();
- return(1);
- }
- }
-
- if (cave[next_room].has_a_bat) {
- (void)printf(
-"*flap* *flap* *flap* (humongous bats pick you up and move you%s!)\n",
- just_moved_by_bats ? " again": "");
- next_room = player_loc = (random() % room_num) + 1;
- just_moved_by_bats = 1;
- }
-
- else
- break;
- }
- return(0);
-}
-
-int
-shoot(room_list)
- char *room_list;
-{
- int chance, next, roomcnt;
- int j, arrow_location, wumplink, ok;
- char *p;
-
- /*
- * Implement shooting arrows. Arrows are shot by the player indicating
- * a space-separated list of rooms that the arrow should pass through;
- * if any of the rooms they specify are not accessible via tunnel from
- * the room the arrow is in, it will instead fly randomly into another
- * room. If the player hits the wumpus, this routine will indicate
- * such. If it misses, this routine will *move* the wumpus one room.
- * If it's the last arrow, the player then dies... Returns 1 if the
- * player has won or died, 0 if nothing has happened.
- */
- arrow_location = player_loc;
- for (roomcnt = 1;; ++roomcnt, room_list = NULL) {
- if (!(p = strtok(room_list, " \t\n"))) {
- if (roomcnt == 1) {
- (void)printf(
- "The arrow falls to the ground at your feet!\n");
- return(0);
- } else
- break;
- }
- if (roomcnt > 5) {
- (void)printf(
-"The arrow wavers in its flight and and can go no further!\n");
- break;
- }
- next = atoi(p);
- for (j = 0, ok = 0; j < link_num; j++)
- if (cave[arrow_location].tunnel[j] == next)
- ok = 1;
-
- if (ok) {
- if (next > room_num) {
- (void)printf(
-"A faint gleam tells you the arrow has gone through a magic tunnel!\n");
- arrow_location = (random() % room_num) + 1;
- } else
- arrow_location = next;
- } else {
- wumplink = (random() % link_num);
- if (wumplink == player_loc)
- (void)printf(
-"*thunk* The arrow can't find a way from %d to %d and flys back into\n\
-your room!\n",
- arrow_location, next);
- else if (cave[arrow_location].tunnel[wumplink] > room_num)
- (void)printf(
-"*thunk* The arrow flys randomly into a magic tunnel, thence into\n\
-room %d!\n",
- cave[arrow_location].tunnel[wumplink]);
- else
- (void)printf(
-"*thunk* The arrow can't find a way from %d to %d and flys randomly\n\
-into room %d!\n",
- arrow_location, next,
- cave[arrow_location].tunnel[wumplink]);
- arrow_location = cave[arrow_location].tunnel[wumplink];
- break;
- }
- chance = random() % 10;
- if (roomcnt == 3 && chance < 2) {
- (void)printf(
-"Your bowstring breaks! *twaaaaaang*\n\
-The arrow is weakly shot and can go no further!\n");
- break;
- } else if (roomcnt == 4 && chance < 6) {
- (void)printf(
-"The arrow wavers in its flight and and can go no further!\n");
- break;
- }
- }
-
- /*
- * now we've gotten into the new room let us see if El Wumpo is
- * in the same room ... if so we've a HIT and the player WON!
- */
- if (arrow_location == wumpus_loc) {
- kill_wump();
- return(1);
- }
-
- if (arrow_location == player_loc) {
- shoot_self();
- return(1);
- }
-
- if (!--arrows_left) {
- no_arrows();
- return(1);
- }
-
- {
- /* each time you shoot, it's more likely the wumpus moves */
- static int lastchance = 2;
-
- if (random() % level == EASY ? 12 : 9 < (lastchance += 2)) {
- move_wump();
- if (wumpus_loc == player_loc)
- wump_kill();
- lastchance = random() % 3;
-
- }
- }
- return(0);
-}
-
-void
-cave_init()
-{
- int i, j, k, wumplink;
- int delta;
-
- /*
- * This does most of the interesting work in this program actually!
- * In this routine we'll initialize the Wumpus cave to have all rooms
- * linking to all others by stepping through our data structure once,
- * recording all forward links and backwards links too. The parallel
- * "linkcount" data structure ensures that no room ends up with more
- * than three links, regardless of the quality of the random number
- * generator that we're using.
- */
- srandomdev();
-
- /* initialize the cave first off. */
- for (i = 1; i <= room_num; ++i)
- for (j = 0; j < link_num ; ++j)
- cave[i].tunnel[j] = -1;
-
- /* choose a random 'hop' delta for our guaranteed link */
- while (!(delta = random() % room_num));
-
- for (i = 1; i <= room_num; ++i) {
- wumplink = ((i + delta) % room_num) + 1; /* connection */
- cave[i].tunnel[0] = wumplink; /* forw link */
- cave[wumplink].tunnel[1] = i; /* back link */
- }
- /* now fill in the rest of the cave with random connections */
- for (i = 1; i <= room_num; i++)
- for (j = 2; j < link_num ; j++) {
- if (cave[i].tunnel[j] != -1)
- continue;
-try_again: wumplink = (random() % room_num) + 1;
- /* skip duplicates */
- for (k = 0; k < j; k++)
- if (cave[i].tunnel[k] == wumplink)
- goto try_again;
- cave[i].tunnel[j] = wumplink;
- if (random() % 2 == 1)
- continue;
- for (k = 0; k < link_num; ++k) {
- /* if duplicate, skip it */
- if (cave[wumplink].tunnel[k] == i)
- k = link_num;
-
- /* if open link, use it, force exit */
- if (cave[wumplink].tunnel[k] == -1) {
- cave[wumplink].tunnel[k] = i;
- k = link_num;
- }
- }
- }
- /*
- * now that we're done, sort the tunnels in each of the rooms to
- * make it easier on the intrepid adventurer.
- */
- for (i = 1; i <= room_num; ++i)
- qsort(cave[i].tunnel, (u_int)link_num,
- sizeof(cave[i].tunnel[0]), int_compare);
-
-#ifdef DEBUG
- if (debug)
- for (i = 1; i <= room_num; ++i) {
- (void)printf("<room %d has tunnels to ", i);
- for (j = 0; j < link_num; ++j)
- (void)printf("%d ", cave[i].tunnel[j]);
- (void)printf(">\n");
- }
-#endif
-}
-
-void
-clear_things_in_cave()
-{
- int i;
-
- /*
- * remove bats and pits from the current cave in preparation for us
- * adding new ones via the initialize_things_in_cave() routines.
- */
- for (i = 1; i <= room_num; ++i)
- cave[i].has_a_bat = cave[i].has_a_pit = 0;
-}
-
-void
-initialize_things_in_cave()
-{
- int i, loc;
-
- /* place some bats, pits, the wumpus, and the player. */
- for (i = 0; i < bat_num; ++i) {
- do {
- loc = (random() % room_num) + 1;
- } while (cave[loc].has_a_bat);
- cave[loc].has_a_bat = 1;
-#ifdef DEBUG
- if (debug)
- (void)printf("<bat in room %d>\n", loc);
-#endif
- }
-
- for (i = 0; i < pit_num; ++i) {
- do {
- loc = (random() % room_num) + 1;
- } while (cave[loc].has_a_pit && cave[loc].has_a_bat);
- cave[loc].has_a_pit = 1;
-#ifdef DEBUG
- if (debug)
- (void)printf("<pit in room %d>\n", loc);
-#endif
- }
-
- wumpus_loc = (random() % room_num) + 1;
-#ifdef DEBUG
- if (debug)
- (void)printf("<wumpus in room %d>\n", loc);
-#endif
-
- do {
- player_loc = (random() % room_num) + 1;
- } while (player_loc == wumpus_loc || (level == HARD ?
- (link_num / room_num < 0.4 ? wump_nearby() : 0) : 0));
-}
-
-int
-getans(prompt)
- const char *prompt;
-{
- char buf[20];
-
- /*
- * simple routine to ask the yes/no question specified until the user
- * answers yes or no, then return 1 if they said 'yes' and 0 if they
- * answered 'no'.
- */
- for (;;) {
- (void)printf("%s", prompt);
- (void)fflush(stdout);
- if (!fgets(buf, sizeof(buf), stdin))
- return(0);
- if (*buf == 'N' || *buf == 'n')
- return(0);
- if (*buf == 'Y' || *buf == 'y')
- return(1);
- (void)printf(
-"I don't understand your answer; please enter 'y' or 'n'!\n");
- }
- /* NOTREACHED */
-}
-
-int
-bats_nearby()
-{
- int i;
-
- /* check for bats in the immediate vicinity */
- for (i = 0; i < link_num; ++i)
- if (cave[cave[player_loc].tunnel[i]].has_a_bat)
- return(1);
- return(0);
-}
-
-int
-pit_nearby()
-{
- int i;
-
- /* check for pits in the immediate vicinity */
- for (i = 0; i < link_num; ++i)
- if (cave[cave[player_loc].tunnel[i]].has_a_pit)
- return(1);
- return(0);
-}
-
-int
-wump_nearby()
-{
- int i, j;
-
- /* check for a wumpus within TWO caves of where we are */
- for (i = 0; i < link_num; ++i) {
- if (cave[player_loc].tunnel[i] == wumpus_loc)
- return(1);
- for (j = 0; j < link_num; ++j)
- if (cave[cave[player_loc].tunnel[i]].tunnel[j] ==
- wumpus_loc)
- return(1);
- }
- return(0);
-}
-
-void
-move_wump()
-{
- wumpus_loc = cave[wumpus_loc].tunnel[random() % link_num];
-}
-
-int
-int_compare(va, vb)
- const void *va, *vb;
-{
- const int *a, *b;
-
- a = (const int *)va;
- b = (const int *)vb;
-
- return(a < b ? -1 : 1);
-}
-
-void
-instructions()
-{
- const char *pager;
- pid_t pid;
- int status;
- int fd;
-
- /*
- * read the instructions file, if needed, and show the user how to
- * play this game!
- */
- if (!getans("Instructions? (y-n) "))
- return;
-
- if (access(_PATH_WUMPINFO, R_OK)) {
- (void)printf(
-"Sorry, but the instruction file seems to have disappeared in a\n\
-puff of greasy black smoke! (poof)\n");
- return;
- }
-
- if (!isatty(1))
- pager = "cat";
- else {
- if (!(pager = getenv("PAGER")) || (*pager == 0))
- pager = _PATH_PAGER;
- }
- switch (pid = fork()) {
- case 0: /* child */
- if ((fd = open(_PATH_WUMPINFO, O_RDONLY)) == -1)
- err(1, "open %s", _PATH_WUMPINFO);
- if (dup2(fd, 0) == -1)
- err(1, "dup2");
- (void)execl("/bin/sh", "sh", "-c", pager, (char *)NULL);
- err(1, "exec sh -c %s", pager);
- case -1:
- err(1, "fork");
- default:
- (void)waitpid(pid, &status, 0);
- break;
- }
-}
-
-void
-usage()
-{
- (void)fprintf(stderr,
-"usage: wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels]\n");
- exit(1);
-}
-
-/* messages */
-
-void
-wump_kill()
-{
- (void)printf(
-"*ROAR* *chomp* *snurfle* *chomp*!\n\
-Much to the delight of the Wumpus, you walked right into his mouth,\n\
-making you one of the easiest dinners he's ever had! For you, however,\n\
-it's a rather unpleasant death. The only good thing is that it's been\n\
-so long since the evil Wumpus cleaned his teeth that you immediately\n\
-passed out from the stench!\n");
-}
-
-void
-kill_wump()
-{
- (void)printf(
-"*thwock!* *groan* *crash*\n\n\
-A horrible roar fills the cave, and you realize, with a smile, that you\n\
-have slain the evil Wumpus and won the game! You don't want to tarry for\n\
-long, however, because not only is the Wumpus famous, but the stench of\n\
-dead Wumpus is also quite well known, a stench plenty enough to slay the\n\
-mightiest adventurer at a single whiff!!\n");
-}
-
-void
-no_arrows()
-{
- (void)printf(
-"\nYou turn and look at your quiver, and realize with a sinking feeling\n\
-that you've just shot your last arrow (figuratively, too). Sensing this\n\
-with its psychic powers, the evil Wumpus rampagees through the cave, finds\n\
-you, and with a mighty *ROAR* eats you alive!\n");
-}
-
-void
-shoot_self()
-{
- (void)printf(
-"\n*Thwack!* A sudden piercing feeling informs you that the ricochet\n\
-of your wild arrow has resulted in it wedging in your side, causing\n\
-extreme agony. The evil Wumpus, with its psychic powers, realizes this\n\
-and immediately rushes to your side, not to help, alas, but to EAT YOU!\n\
-(*CHOMP*)\n");
-}
-
-void
-jump(where)
- int where;
-{
- (void)printf(
-"\nWith a jaunty step you enter the magic tunnel. As you do, you\n\
-notice that the walls are shimmering and glowing. Suddenly you feel\n\
-a very curious, warm sensation and find yourself in room %d!!\n", where);
-}
-
-void
-pit_kill()
-{
- (void)printf(
-"*AAAUUUUGGGGGHHHHHhhhhhhhhhh...*\n\
-The whistling sound and updraft as you walked into this room of the\n\
-cave apparently wasn't enough to clue you in to the presence of the\n\
-bottomless pit. You have a lot of time to reflect on this error as\n\
-you fall many miles to the core of the earth. Look on the bright side;\n\
-you can at least find out if Jules Verne was right...\n");
-}
-
-void
-pit_survive()
-{
- (void)printf(
-"Without conscious thought you grab for the side of the cave and manage\n\
-to grasp onto a rocky outcrop. Beneath your feet stretches the limitless\n\
-depths of a bottomless pit! Rock crumbles beneath your feet!\n");
-}
diff --git a/games/wump/wump.info b/games/wump/wump.info
deleted file mode 100644
index 329e821..0000000
--- a/games/wump/wump.info
+++ /dev/null
@@ -1,41 +0,0 @@
-Welcome to the game of Hunt the Wumpus.
-
-The Wumpus typically lives in a cave of twenty rooms, with each room having
-three tunnels connecting it to other rooms in the cavern. Caves may vary,
-however, depending on options specified when starting the game.
-
-The game has the following hazards for intrepid adventurers to wind their
-way through:
-
- Pits -- If you fall into one of the bottomless pits, you find yourself
- slung back out on the far side of the Earth and in very poor
- shape to continue your quest since you're dead.
-
- Bats -- As with any other cave, the Wumpus cave has bats in residence.
- These are a bit more potent, however, and if you stumble into
- one of their rooms they will rush up and carry you elsewhere in
- the cave.
-
- Wumpus -- If you happen to walk into the room the Wumpus is in you'll find
- that he has quite an appetite for young adventurous humans! Not
- recommended.
-
-The Wumpus, by the way, is not bothered by the hazards since he has sucker
-feet and is too big for a bat to lift. If you try to shoot him and miss,
-there's also a chance that he'll up and move himself into another cave,
-though by nature the Wumpus is a sedentary creature.
-
-Each turn you may either move or shoot a crooked arrow. Moving is done
-simply by specifying "m" for move and the number of the room that you'd
-like to move down a tunnel towards. Shooting is done similarly; indicate
-that you'd like to shoot one of your magic arrows with an "s" for shoot,
-then list a set of connected room numbers through which the deadly shaft
-should fly!
-
-If your path for the arrow is incorrect, however, it will flail about in
-the room it can't understand and randomly pick a tunnel to continue
-through. You might just end up shooting yourself in the foot if you're
-not careful! On the other hand, if you shoot the Wumpus you've WON!
-
-Good luck.
-
OpenPOWER on IntegriCloud