Amiga: delete outdated/sys/amiga/

These 3.4.1-era files are superseded: Build/Install.ami -> README.amiga;
Makefile.ami/.agc -> sys/unix/hints/include/cross-*.500;
NetHack.cnf -> sys/amiga/nethack.cnf;
txt2iff/xpm2iff.c -> sys/amiga/*_host.c.
This commit is contained in:
Ingo Paschke
2026-05-11 20:51:06 +02:00
parent 2e61bf768f
commit d1a84de8fc
11 changed files with 0 additions and 4256 deletions
-5
View File
@@ -132,11 +132,6 @@ wceconf.h
mac-carbon.h mac-qt.h mac-term.h macconf.h macpopup.h
mactty.h macwin.h mttypriv.h
outdated/sys/amiga:
(files for Amiga versions - untested for 5.0)
Build.ami Install.ami Makefile.agc Makefile.ami NetHack.cnf
ifchange mkdmake txt2iff.c xpm2iff.c
outdated/sys/atari:
(files for Atari version - untested for 5.0)
Install.tos atarifnt.uue nethack.mnu setup.g tos.c
-2
View File
@@ -1,2 +0,0 @@
*.p NHSUBST
* NH_filestag=(file%s_for_Amiga_versions_-_untested_for_5.0)
-140
View File
@@ -1,140 +0,0 @@
Compiling Amiga NetHack 3.4
Last Revision: 21 February 2002 for NetHack 3.4.1
We would like to thank each and every one of the people who took
the time and effort to report bugs to us. THANK YOU! (And keep
up the good work!)
I. Introduction
The Amiga-specific documentation has been split since the 3.1.3 release
- please read the file Install.ami for information specific to the
Amiga port before continuing.
If you have problems with compilation, installation, or think you have
found a bug in the game, please report it by electronic mail to the
development group at nethack-bugs@nethack.org, where it will be routed
to the appropriate person. Include your configuration, the version of
NetHack you are playing (use the 'v' command or see
include/patchlevel.h), and as much specific information as possible.
As NetHack runs on many different machines, be sure to mention that you
are playing the Amiga version and also mention if you are using the
version for mc68k or ppc.
If you want to find out about distributing NetHack, read the license
(in NetHack:license or type ?i during the game).
II. Compiling Amiga NetHack 3.4
II.A. Compilation Overview
Compiling NetHack is not very hard - basically you do a little
configuration and start make. It does, however, require a good amount
of disk space and time. It also needs a good bit of memory, especially
for linking.
II.B. Basic Compilation
NetHack can be built with SAS/C version 6.5x. The commercial version
of DICE might work, but NetHack version 3.2.2 or later haven't been
compiled with it. The "official" compiler for NetHack 3.6 is SAS/C 6.58
- we have dropped support for SAS/C 5.x.
The Manx/Aztec port has not been tested recently and is certainly
broken. Anyone managing to compile NetHack with this compiler is
encouraged to submit context diffs of the required changes. When last
tested, NetHack required version 5.0B of that compiler.
Compiling with gcc should also work.
II.B.1. Introduction to Compiling NetHack
Before doing any compilation, read the README files distributed with
the source. These should familiarize you with the source tree layout
and what files are shared with what computers; everything in the
sys/amiga directory is used exclusively by the Amiga.
The makefile (sys/amiga/Makefile.ami) depends on certain assignments,
providing the developer with a fairly flexible environment. See
sys/amiga/Makefile.ami for assignment assumptions. DICE users should
see section II.B.3 for information on creating a DMakefile usable with
DMake.
Edit config.h to your liking and system configuration. The defaults
should be satisfactory for most systems.
Read VERY CAREFULLY through the Makefile to familiarize yourself
with which assignments are assumed. Otherwise, you're going to get
something like "Insert NH: in any drive." You will need uudecode,
and, if you need to modify dgn_comp or lev_comp, flex, and bison.
The first thing Makefile.ami does is build makedefs, which handles
a variety of data file generation, and then lev_comp and dgn_comp
which compile the special levels. Makedefs will then be run to create
a few files, followed by a roughly alphabetically sorted compilation
of the entire source tree. This process will compile selected files
from the sys/amiga, sys/share, win/tty, and src directories, eventually
creating sbin/nethack. After building the main binary, a make install
will build the auxiliary files including help files, special levels,
icons, and the font files and will put these files into their final
positions - most will be in dlb archives (if DLB was defined in config.h).
The first make run should be done in NH:obj and the make install should be
done in NetHack:; for both runs, the makefile is NH:sys/amiga/Makefile.ami
(or NH:sys/amiga/DMakefile for DMake and NH:sys/amiga/Makefile.agc for
gcc).
Note that not all the source is simple C code. If you are modifying
lev_comp or dgn_comp you may need bison and/or flex (depending on what
modifications you are making). You do not need any of these tools to
simply build NetHack - all the C output files are provided in the source
distribution. Also, the ifchange script requires a version of diff that
produces standard Unix format context diffs for proper operation - the
version shipped with SAS/C is not sufficient.
If you do not have bison and flex, copy the files from sys/share. The
include files go in include/ and the C files go in util/. If the compile
fails due to prototype errors for malloc and realloc, try deleting
the first line of lev_comp.c and dgn_comp.c.
II.B.2. Compiling NetHack with SAS/C version 6.58
NOTE WELL - Amiga NetHack has dropped support for SAS/C version 5.
This version of NetHack was developed with SAS/C 6.58. Earlier versions
than version of the compiler are known to cause problems - don't use them.
A couple of notes and warnings from the SAS/C users on the team:
* Included in the SAS/C port is code for generating a SnapShot.tb
file upon catching various internal disasters. That is why the
debug=l flag is in the makefile. This adds about 270K to the disk
image, but it does not increase the run time memory requirements.
* The 5.10b optimizer did not produce correct code for NetHack. The
current optimizer has not been tested.
II.B.3. Compiling NetHack with the commercial version of DICE
IMPORTANT NOTE: If you are using DMake, you need to create DMakefile
from Makefile.ami. Do the following:
cd NH:sys/amiga
edit from Makefile.ami to DMakefile with mkdmake opt w255
Some versions of DMake have been known to crash horribly on the
makefile - if this happens, you'll need to download another make
utility, such as AMake (ftp://ftp.dragonfire.net/amiga/utils/amake),
which will run in DMake-compatibility mode if invoked with the -C switch
(e.g. "amake -C -f NH:sys/amiga/DMakefile", or just
"alias dmake amake -C").
SECOND IMPORTANT NOTE: The score list is currently disabled when
compiling under DICE, due to an as-yet-unknown problem which causes
system crashes when displaying the score list.
NetHack can be compiled using the commercial version of DICE only. The
registered shareware version had a bug in it which resulted in odd-
aligned procedures. (It is possible to patch DC1 to fix this problem;
however, this is not recommended, and you should upgrade to the
commercial version.)
During compilation, DICE will output a lot of warnings; they can be
safely ignored.
-200
View File
@@ -1,200 +0,0 @@
Using and Installing Amiga NetHack 3.4
(or Everything You Never Wanted to Know Before NetHacking)
(or Not Everything That Happens Always Comes Knocking)
Last Revision: 28 March 2000 for NetHack 3.4.1
0. Pre-intro for NetHack 3.4.1:
Amiga-specific changes for 3.4.1:
Most (around 99%) known bugs fixed (volunteers welcome).
HackWB and HackCli are no longer supported. Use the main binary.
We would like to thank each and every one of the people who took
the time and effort to report bugs to us. THANK YOU!
I. Introduction
I.A. Overview
Welcome to Amiga NetHack! If this is your first visit to our fair
city, you are in for an amazing but dangerous journey; if you have
visited us before, beware! the city has changed in many strange and
subtle ways; it has also grown quite a bit. This missive brings to
light those mundane tasks which must be dealt with before beginning
your journey; for those of you who are faced with the task of
installing the pre-fabricated version of our town, section III
(Installing Amiga NetHack 3.6) will guide you through the task at
hand. If you are ready to visit, the local visitors guide is in
section II (Using Amiga NetHack 3.6); please also see the general
guide packaged separately (the file "GuideBook").
To all our visitors, a hearty Welcome! - and please be careful.
[Those responsible for the previous paragraphs have been sacked. The
documentation has been completed at great expense in a more traditional
style. -- The Management]
I.B. Getting Help
If you have questions about strategy, weapons, or monsters, the best
place to go for help is the Usenet newsgroup rec.games.roguelike.nethack.
If you have problems with installation or think you have found a bug
in the game, please report it by electronic mail to the development
team at nethack-bugs@nethack.org, where it will be routed to the
appropriate person. Include your configuration, the version of
NetHack you are playing (use the 'v' command), whether or not you are
using an official binary release (and if so which one) and as much
specific information as possible. As NetHack runs on many different
machines, be sure to mention that you are playing the Amiga version.
I.C. Credits
Olaf Seibert first ported NetHack 2.3 and 3.0 to the Amiga. Richard
Addison, Andrew Church, Jochen Erwied, Mark Gooderum, Ken Lorber,
Greg Olson, Mike Passaretti, and Gregg Wonderly polished and extended
the 3.0 and 3.1 ports. Andrew Church, Ken Lorber, and Gregg Wonderly
are responsible for the 3.2 port. Janne Salmijärvi resurrected the
amigaport for 3.3 and Teemu Suikki joined before 3.4.0.
II. Using Amiga NetHack 3.4
Run NetHack from the shell or from some tool that allows that,
ie. ToolManager. See the NetHack.txt file for command line options
and other usage.
II.A. Sources of Information
Where to go depends on what you want to find out. If you want to find
out about distributing NetHack, read the license (in NetHack:license
or type ?i during the game). For an introduction to NetHack, read
the GuideBook file. To find out what options are compiled into your
copy of NetHack, type #v during the game. Finally, for information
during the game on all kinds of things, type ? and select from the
menu or by pressing Help key.
II.B. The Amiga NetHack WorkBench Front End
Starting from 3.3.0 HackWB is not supported.
II.C. The Amiga NetHack CLI Front End
Starting from 3.3.0 CLI Front end is not supported either.
Instead, use the main binary. See NetHack.txt file for the standard Unix
flags for NetHack. In addition to those flags, Amiga NetHack accepts
the flags -l to force non-interlaced mode and -L to force interlaced mode.
II.D. Amiga-Specific Information for NetHack
There are several options that are unique to the Amiga version of
NetHack that may be specified in the NetHack.cnf file or on an
OPTIONS line:
altmeta allows the ALT keys to function as META keys. The default
is altmeta.
flush flush discards all characters in the queue except the first,
which limits typeahead accidents. The default is !flush.
silent turn off the audio output. The default is silent.
The current version of Amiga NetHack also supports menu accelerators.
See Guidebook.txt for a detailed description. Also supported is
selecting the number of stacked objects to drop, used with the (D)rop
command. Type the number and then select an item (or items with
accelerators). Items with a count associated with them are denoted
with # in place of -. I.e. 'd - 3 blessed daggers' becomes
'd # 3 blessed daggers'. You can clear the count by hitting esc
while counting or deselect and reselect the item. The default
is to drop all selected items (as before).
For other options how to configure the screen setting and colors refer
to Nethack.cnf.
III. Installing Amiga NetHack 3.4
III.A. General Installation
Installation should be easy - basically it consists of putting files
where they belong and adding an assign to your startup. If you are
installing from the official binary distribution, simply unpacking
the archive in the appropriate directory will put the files in the
places they belong.
IF YOU ALREADY HAVE A PREVIOUS VERSION INSTALLED YOU MUST DELETE THE
OLD SAVE AND BONES FILES - THEY WILL NOT WORK! This includes save
and bones files from all previous versions of NetHack (yes, even 3.3.1).
If you have a game in progress and want to finish it, use your
current version and then update.
Will NetHack fit on your machine?
NetHack 3.6 is large. NetHack 3.4 is very large. You will need:
> Any standard series Amiga: 500, 600, 1000, 1200, 2000, 2500, 3000, 4000.
> WorkBench 2.04 or later.
> At least 3 meg of RAM. NetHack will NOT run in 1 meg (probably even 2).
> Mass storage: A hard drive with over 3 meg of free space is highly
recommended.
Hard Disk Installation:
Unpack the archive to your place of choice. Since you are reading this
you've probably done that already. Now just assign NetHack: to
NetHack directory containing the executable and datafiles and other needed
directories.
Use the table in the next section to see where things should end up.
Be sure that the file 8 ends up in NetHack:hack/8.
Configuration
Using your favorite text editor, edit NetHack:NetHack.cnf to match
your system.
Create the save file directory (makedir NetHack:save) and the levels file
directory (makedir NetHack:levels), if they don't already exist.
Create the score file (echo to NetHack:record) and, if desired, the log
file (echo to NetHack:logfile), if they don't already exist. You may
leave out logfile, but record is needed.
III.B. File Location Table
NetHack:
amii.hlp Guidebook.txt hack.font
license NetHack NetHack.cnf
NetHack.txt nhdat nhsdat
record Recover Recover.txt
logfile (optional, but useful)
NetHack:hack
8
NetHack:tiles
monsters.iff objects.iff other.iff
IV. BBS Interface
[Since HackCli and split binary is no longer supported the following
probably doesn't apply anymore. Due to lack of a suitable environment
it is also untested.]
The BBS mode is based on the standard NetHack tty port and is designed
for use in a BBS setting - it is specifically not recommended for use
on the console. The current TTY mode has changed significantly since
the preliminary version released with 3.1.2. In particular, BBS mode
now works with split binaries (only), and now supports multiple games
in progress at the same time for multi-line boards (note however that
any individual user should not be allowed to run two instances of
NetHack at the same time).
To set up NetHack for use with a BBS, set OPTIONS=windowtype:tty
and unset DUNGEONS, TRAPS, and EFFECTS in NetHack.cnf. Configure
the BBS to expect I/O through stdin and stdout, and have NetHack
invoked as:
HackCLI :uid -u uname options...
where uid is any string (without embedded spaces, colons, or slashes)
that is unique for each BBS user and uname is some corresponding human-
readable name for that user. Uid is used in constructing file names
to prevent collisions between simultaneous games and to prevent
people from using other people's save files. Uname is the name the
character will have in the game and the name that will appear in the
record file.
The terminal is assumed to be a 24x80 ANSI-compatible terminal.
The present version does not deal with situations such as low
memory gracefully - as NetHack uses a considerable amount of
memory this is particularly painful with multiple games in
progress. Sysops are reminded to be familiar with the recover
utility, which may be needed from time to time and which should
probably not be available directly to users. Bug reports and
suggestions for improvements are requested from the user community -
this is still considered alpha software.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-213
View File
@@ -1,213 +0,0 @@
# A '#' at the beginning of a line means the rest of the line is a comment.
# This is an example configuration file.
# If several people are to use it, don't specify "name" or personal
# prefences like "dogname" or "packorder" in OPTIONS.
# To change configuration, comment out the unwanted configurations, and
# remove the comment from the configuration you want.
# Some options to set personal preferences. If several people are to
# use it, options like these should not be set here - use the command line
#OPTIONS=name:Janet-V,female,dogname:Fido,fruit:apricot
#OPTIONS=packorder:")[%?+/=!(*0_`,scores:10t/2a,noverbose
#OPTIONS=gender:male
#OPTIONS=role:random
#OPTIONS=race:random
#OPTIONS=align:chaotic
# Other general options
#OPTIONS=time,rest_on_space,noautopickup
# The search path for files like record, help, opthelp, etc.
PATH=NetHack:
# My own setup
#OPTIONS=nolegacy,fruit:lemon,time,autopickup,checkpoint,showexp,showscore,standout,nonews
#OPTIONS=nomail,flush,eight_bit_tty,scores:10t/2a,pickup_types:$,suppress_alert:3.3.0,autoquiver
# The windowtype option must be set before any options regarding colors and palette
# are set otherwise previously set values will be overridden by the defaults
#
# The font version of the game
OPTIONS=windowtype:amii
#
# New tile version of the game
#OPTIONS=windowtype:amitile
#
# A hard disk configuration.
#
HACKDIR=NetHack:
LEVELS=Nethack:Levels
SAVE=Nethack:Save
BONESDIR=Nethack:Levels
SCOREDIR=Nethack:
LOCKDIR=Nethack:
CONFIGDIR=Nethack:
DATADIR=Nethack:
TROUBLEDIR=Nethack:
# *** CHARACTER GRAPHICS ***
#
# See the on-line help or the Guidebook for which symbols are in which
# positions.
#
# Note that the hack.font has special graphics characters from 192 on.
# An example using the hack.font graphics character set:
DUNGEON = 032 192 193 194 195 196 197 198 216 214 \
215 213 217 145 146 147 148 035 035 217 \
218 229 060 062 060 062 095 124 092 035 \
123 125 042 125 042 042 035 035 046 035 \
125
TRAPS = 094 094 094 094 094 094 094 094 094 094 \
094 094 094 094 094 094 094 034 094 094 \
094 094
EFFECTS = 241 240 242 243 042 033 123 125 \
064 038 042 035 \
244 245 246 247 239 248 249 250 \
230 234 231 236 212 237 232 235 233
WARNINGS = 048 049 050 051 052 053
# Monitors vary greatly in their color response. If the default colors
# are not good on your monitor, here are some other alternatives for the
# font version of the game:
#
# Last color of the palette is always used for the cursor.
#
#CBM 1960, set color/contrast for good pure red, green, and blue. True colors.
#PENS=000,fff,a61,7bb,0f0,e0c,00f,f00
#CBM 1960, set color/contrast as above, better colors for NetHack.
#PENS=667,fff,da1,7bb,2f0,e0d,0af,f42
#and other suggestions:
#PENS=888,ffc,840,0b8,4e4,e8b,7be,a04
#PENS=000,fff,830,7ae,181,c06,23e,c00
#
# For an "interlaced"+ line screen, the default font is courier:13. If you want
# a different font, set it here. The format is "fontname.font:size"; i.e. the
# .font extension is required.
#FONT=courier.font:13
#FONT=topaz.font:8
#
# Proportional fonts such as CGTimes are probably not a good idea because they
# result in many things not being spaced out correctly.
#FONT=CGTimes.font:15
#
# This sized proportional font is readable, but still has spacing problems
#FONT=CGTimes.font:21
#
# FOR AGA OR OTHER DISPLAYS CAPABLE OF 5 OR MORE PLANES...
#
# For a screen of depth 5 the following dripens provide a brown border
# using pens 16-31.
#
# Pens 16-31 can be redefined with PENS= if you want different colors,
# using the PENS= values below for a 4 plane screen as the first 16 colors.
#
#DEPTH=5
#DRIPENS=0,0,0,17,27,23,1,23,15,0,23,27
#
# The APEN and BPEN values in the various types of windows can be set in
# the manner shown below. These values are for the 16 color version of
# the tile game.
#
# These values are specified as APEN,BPEN (foreground,background)
#
#MSGPENS=1,12
#STATUSPENS=1,12
#MENUPENS=1,23
#TEXTPENS=1,23
#OTHERPENS=1,23
#
# FOR ECS OR OTHERS ONLY CAPABLE OF 4 PLANES...
#
# These values work good for the TILE version of the game on ECS machines
# These are the default values for reference purposes.
#
#DEPTH=4
#defaults for tilemode:
#PENS=000,fff,0bf,f60,00f,090,69b,f00,6f0,ff0,f0f,940,466,c40,ddb,fb9
#DRIPENS=0,1,0,2,4,12,14,12,7,1,12,4
#defaults for fontmode:
#PENS=000,fff,830,7ac,181,c06,23e,c00
#DRIPENS=0,6,2,1,6,3,1,3,7,1,3,6
#
# The APEN and BPEN values in the various types of windows can be set in
# the manner shown below. These values are for a 32 color version of
# the tile game.
#
# These values are specified as APEN,BPEN (foreground,background)
#
#MSGPENS=1,12
#STATUSPENS=1,12
#MENUPENS=0,14
#TEXTPENS=0,14
#OTHERPENS=1,12
#
# New alternative color scheme for 16 color font mode.
# This changes the colors of monsters, objects etc.
#
# FGPENS and BGPENS define APEN and BPEN for objects and monsters on the map.
# The colors are in the following order:
# black, red, green, brown, blue, magenta, cyan, gray, no color, orange,
# bright green, yellow, bright blue, bright magenta, bright cyan, white
#
DEPTH=4
PENS=000,fff,830,7ac,181,c06,23e,c00,888,f60,4f4,ff0,4af,f8f,8ff,f00
FGPENS= 0, 7, 4, 2, 6, 5, 3, 8, 1, 9,10,11,12,13,14, 1
BGPENS= 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#
# Screen mode selections below should all work for either the font or tile
# version of the game. Other modes can be tried and as long as they are at
# least 640x200, the game should adapt to them...
#
# Select screenmode with a requester
#SCREENMODE=Req
# NTSC_MONITOR_ID
#SCREENMODE=0x00019000
# PAL_MONITOR_ID
#SCREENMODE=0x00029000
# NTSC_MONITOR_ID+LACE
#SCREENMODE=0x00019004
# PAL_MONITOR_ID+LACE
#SCREENMODE=0x00029004
# NTSC_MONITOR_ID+HIRES+LACE
#SCREENMODE=0x00019024
# PAL_MONITOR_ID+HIRES+LACE
#SCREENMODE=0x00029024
# VGA_MONITOR_ID
#SCREENMODE=0x00031000
# VGAPRODUCT_KEY
#SCREENMODE=0x00039024
# A2024TENHERTZ_KEY
#SCREENMODE=0x00041000
# A2024FIFTEENHERTZ_KEY
#SCREENMODE=0x00049000
# EURO72_MONITOR_ID
#SCREENMODE=0x00061000
# EURO72PRODUCT_KEY
#SCREENMODE=0x00069024
# EURO72PRODUCTLACE_KEY
#SCREENMODE=0x00069025
# EURO72PRODUCTDBL_KEY
#SCREENMODE=0x00069020
# EURO36_MONITOR_ID
#SCREENMODE=0x00071000
# SUPER72HIRESDBL_KEY
#SCREENMODE=0x00089008
# SUPER72SUPERDBL_KEY
#SCREENMODE=0x00089028
# DBLNTSCHIRES_KEY
#SCREENMODE=0x00099000
# DBLNTSCHIRESFF_KEY
#SCREENMODE=0x00099004
# DBLNTSCHIRESLACE_KEY
#SCREENMODE=0x00099005
# DBLPALHIRES_KEY
#SCREENMODE=0x000a9000
# DBLPALHIRESFF_KEY
#SCREENMODE=0x000a9004
# DBLPALHIRESLACE_KEY
#SCREENMODE=0x000a9005
-55
View File
@@ -1,55 +0,0 @@
.KEY oper/a,tmp/a,real/a,f1,f2,f3,f4,f5
. ; miscellaneous script functions for the Amiga
. ; Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1992, 1993, 1996.
. ; NetHack may be freely redistributed. See license for details.
FAILAT 6
IF <oper> EQ "MOVE"
IF EXISTS <real>
diff >T:mic -c <tmp> <real>
search from T:mic SEARCH "---" QUIET
IF WARN
echo "MOVE: no change"
delete <tmp>
ELSE
echo "MOVE: copy"
copy <tmp> <real> clone
delete <tmp>
ENDIF
ELSE
echo "MOVE: copy2"
copy <tmp> <real> clone
delete <tmp>
ENDIF
QUIT
ENDIF
IF <oper> EQ "TOUCH"
IF EXISTS <real>
diff >T:mic -c <tmp> <real>
search from T:mic SEARCH "---" QUIET
IF NOT WARN
echo "TOUCH: touch"
IF NOT <f1$@> EQ "@"
setdate <f1>
ENDIF
IF NOT <f2$@> EQ "@"
setdate <f2>
ENDIF
IF NOT <f3$@> EQ "@"
setdate <f3>
ENDIF
IF NOT <f4$@> EQ "@"
setdate <f4>
ENDIF
IF NOT <f5$@> EQ "@"
setdate <f5>
ENDIF
ENDIF
ENDIF
QUIT
ENDIF
echo "ifchange: '<oper>' not recognized"
quit 10
-13
View File
@@ -1,13 +0,0 @@
GE/$@/%(left)/
GE/$</%(right)/
GE/\#/#/
39(F B/#SFD_INSTEAD / ; E/#SFD_INSTEAD // ; N ; D )
REWIND
CG
9(F P/#SFD_BEGIN/; D ; GE /##// ; F P/#SFD_ELSE/ ; CG ; DF P/#SFD_END/ ; D )
Q
Copyright (c) Andrew Church, Olney, Maryland, 1994,1996.
NetHack may be freely redistributed. See license for details.
See IV.B.4 of Install.ami for instructions on using this file.
-446
View File
@@ -1,446 +0,0 @@
/* NetHack 3.6 txt2iff.c $NHDT-Date: 1432512795 2015/05/25 00:13:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* Copyright (c) 1995 by Gregg Wonderly, Naperville, Illinois */
/* NetHack may be freely redistributed. See license for details. */
#include <stdlib.h>
#include "config.h"
#include "tile.h"
#include <dos/dos.h>
#include <dos/dos.h>
#include <dos/dosextens.h>
#include <graphics/gfx.h>
#include <graphics/gfxbase.h>
#include <graphics/view.h>
#include <libraries/iffparse.h>
#include <libraries/dos.h>
#include <clib/dos_protos.h>
#include <clib/iffparse_protos.h>
#ifndef _DCC
#include <proto/exec.h>
#include <proto/iffparse.h>
#include <proto/dos.h>
#endif
void panic(const char *);
void map_colors(void);
int BestMatch(int, int, int);
extern pixval ColorMap[3][MAXCOLORMAPSIZE];
extern int colorsinmap;
/*
* WARNING:
* This program carries forth the assumption that the colormaps in all
* of the .txt files are the same. This is a bug.
*/
struct {
int Height;
int Width;
} IFFScreen;
/*
* We are using a hybrid form of our own design which we call a BMAP (for
* bitmap) form. It is an ILBM with the bitmaps already deinterleaved,
* completely uncompressed.
* This speeds the loading of the images from the games point of view because
* it
* does not have to deinterleave and uncompress them.
*/
#define ID_BMAP MAKE_ID('B', 'M', 'A', 'P') /* instead of ILBM */
#define ID_BMHD MAKE_ID('B', 'M', 'H', 'D') /* Same as ILBM */
#define ID_CAMG MAKE_ID('C', 'A', 'M', 'G') /* Same as ILBM */
#define ID_CMAP MAKE_ID('C', 'M', 'A', 'P') /* Same as ILBM */
#define ID_PDAT \
MAKE_ID('P', 'D', 'A', 'T') /* Extra data describing plane \
* size due to graphics.library \
* rounding requirements. \
*/
#define ID_PLNE MAKE_ID('P', 'L', 'N', 'E') /* The planes of the image */
#ifndef _DCC
extern
#endif
struct Library *IFFParseBase;
int nplanes;
/* BMHD from IFF documentation */
typedef struct {
UWORD w, h;
WORD x, y;
UBYTE nPlanes;
UBYTE masking;
UBYTE compression;
UBYTE reserved1;
UWORD transparentColor;
UBYTE xAspect, yAspect;
WORD pageWidth, pageHeight;
} BitMapHeader;
typedef struct {
UBYTE r, g, b;
} AmiColorMap;
pixel pixels[TILE_Y][TILE_X];
AmiColorMap *cmap;
int findcolor(register pixel *pix);
void packwritebody(pixel (*tile)[TILE_X], char **planes, int tileno);
void
error(char *str)
{
fprintf(stderr, "ERROR: %s\n", str);
}
/*
* This array maps the image colors to the amiga's first 16 colors. The
* colors
* are reordered to help with maintaining dripen settings.
*/
int colrmap[] = { 0, 6, 9, 15, 4, 10, 2, 3, 5, 11, 7, 13, 8, 1, 14, 12 };
/* How many tiles fit across and down. */
#define COLS 20
#define ROWS ((tiles + COLS - 1) / COLS)
main(int argc, char **argv)
{
int colors;
struct {
long nplanes;
long pbytes;
long across;
long down;
long npics;
long xsize;
long ysize;
} pdat;
long pbytes; /* Bytes of data in a plane */
int i, cnt;
BitMapHeader bmhd;
struct IFFHandle *iff;
long camg = HIRES | LACE;
int tiles = 0;
char **planes;
if (argc != 3) {
fprintf(stderr, "Usage: %s source destination\n", argv[0]);
exit(1);
}
#if defined(_DCC) || defined(__GNUC__)
IFFParseBase = OpenLibrary("iffparse.library", 0);
if (!IFFParseBase) {
error("unable to open iffparse.library");
exit(1);
}
#endif
/* First, count the files in the file */
if (fopen_text_file(argv[1], "r") != TRUE) {
perror(argv[1]);
return (1);
}
nplanes = 0;
i = colorsinmap - 1; /*IFFScreen.Colors - 1; */
while (i != 0) {
nplanes++;
i >>= 1;
}
planes = malloc(nplanes * sizeof(char *));
if (planes == 0) {
error("can not allocate planes pointer");
exit(1);
}
while (read_text_tile(pixels) == TRUE)
++tiles;
fclose_text_file();
IFFScreen.Width = COLS * TILE_X;
IFFScreen.Height = ROWS * TILE_Y;
pbytes = (COLS * ROWS * TILE_X + 15) / 16 * 2 * TILE_Y;
for (i = 0; i < nplanes; ++i) {
planes[i] = calloc(1, pbytes);
if (planes[i] == 0) {
error("can not allocate planes pointer");
exit(1);
}
}
/* Now, process it */
if (fopen_text_file(argv[1], "r") != TRUE) {
perror(argv[1]);
return (1);
}
iff = AllocIFF();
if (!iff) {
error("Can not allocate IFFHandle");
return (1);
}
iff->iff_Stream = Open(argv[2], MODE_NEWFILE);
if (!iff->iff_Stream) {
error("Can not open output file");
return (1);
}
InitIFFasDOS(iff);
OpenIFF(iff, IFFF_WRITE);
PushChunk(iff, ID_BMAP, ID_FORM, IFFSIZE_UNKNOWN);
bmhd.w = IFFScreen.Width;
bmhd.h = IFFScreen.Height;
bmhd.x = 0;
bmhd.y = 0;
bmhd.nPlanes = nplanes;
bmhd.masking = 0;
bmhd.compression = 0;
bmhd.reserved1 = 0;
bmhd.transparentColor = 0;
bmhd.xAspect = 100;
bmhd.yAspect = 100;
bmhd.pageWidth = TILE_X;
bmhd.pageHeight = TILE_Y;
PushChunk(iff, ID_BMAP, ID_BMHD, sizeof(bmhd));
WriteChunkBytes(iff, &bmhd, sizeof(bmhd));
PopChunk(iff);
PushChunk(iff, ID_BMAP, ID_CAMG, sizeof(camg));
WriteChunkBytes(iff, &camg, sizeof(camg));
PopChunk(iff);
/* We need to reorder the colors to get reasonable default pens but
* we also need to know where some of the colors are - so go find out.
*/
map_colors();
cmap = malloc((colors = (1L << nplanes)) * sizeof(AmiColorMap));
for (i = 0; i < colors; ++i) {
cmap[colrmap[i]].r = ColorMap[CM_RED][i];
cmap[colrmap[i]].g = ColorMap[CM_GREEN][i];
cmap[colrmap[i]].b = ColorMap[CM_BLUE][i];
}
PushChunk(iff, ID_BMAP, ID_CMAP, IFFSIZE_UNKNOWN);
for (i = 0; i < colors; ++i)
WriteChunkBytes(iff, &cmap[i], 3);
PopChunk(iff);
cnt = 0;
while (read_text_tile(pixels) == TRUE) {
packwritebody(pixels, planes, cnt);
if (cnt % 20 == 0)
printf("%d..", cnt);
++cnt;
fflush(stdout);
}
pdat.nplanes = nplanes;
pdat.pbytes = pbytes;
pdat.xsize = TILE_X;
pdat.ysize = TILE_Y;
pdat.across = COLS;
pdat.down = ROWS;
pdat.npics = cnt;
PushChunk(iff, ID_BMAP, ID_PDAT, IFFSIZE_UNKNOWN);
WriteChunkBytes(iff, &pdat, sizeof(pdat));
PopChunk(iff);
PushChunk(iff, ID_BMAP, ID_PLNE, IFFSIZE_UNKNOWN);
for (i = 0; i < nplanes; ++i)
WriteChunkBytes(iff, planes[i], pbytes);
PopChunk(iff);
CloseIFF(iff);
Close(iff->iff_Stream);
FreeIFF(iff);
printf("\n%d tiles converted\n", cnt);
#if defined(_DCC) || defined(__GNUC__)
CloseLibrary(IFFParseBase);
#endif
exit(0);
}
findcolor(register pixel *pix)
{
register int i;
for (i = 0; i < MAXCOLORMAPSIZE; ++i) {
if ((pix->r == ColorMap[CM_RED][i])
&& (pix->g == ColorMap[CM_GREEN][i])
&& (pix->b == ColorMap[CM_BLUE][i])) {
return (i);
}
}
return (-1);
}
void
packwritebody(pixel (*tile)[TILE_X], char **planes, int tileno)
{
register int i, j, k, col;
register char *buf;
register int across, rowbytes, xoff, yoff;
/* how many tiles fit across? */
across = COLS;
/* How many bytes per pixel row */
rowbytes = ((IFFScreen.Width + 15) / 16) * 2;
/* How many bytes to account for y distance in planes */
yoff = ((tileno / across) * TILE_Y) * rowbytes;
/* How many bytes to account for x distance in planes */
xoff = (tileno % across) * (TILE_X / 8);
/* For each row... */
for (i = 0; i < TILE_Y; ++i) {
/* For each bitplane... */
for (k = 0; k < nplanes; ++k) {
const int mask = 1l << k;
/* Go across the row */
for (j = 0; j < TILE_X; j++) {
col = findcolor(&tile[i][j]);
if (col == -1) {
error("can not convert pixel color to colormap index");
return;
}
/* Shift the colors around to have good complements and to
* know the dripen values.
*/
col = colrmap[col];
/* To top left corner of tile */
buf = planes[k] + yoff + xoff;
/*To i'th row of tile and the correct byte for the j'th
* pixel*/
buf += (i * rowbytes) + (j / 8);
/* Or in the bit for this color */
*buf |= (((col & mask) != 0) << (7 - (j % 8)));
}
}
}
}
/* #define DBG */
/* map_colors
* The incoming colormap is in arbitrary order and has arbitrary colors in
* it, but we need (some) specific colors in specific places. Find the
* colors we need and fix the mapping table to match.
*/
/* What we are aiming for: */
/* XXX was 0-7 */
#define CX_BLACK 0
#define CX_WHITE 1
#define CX_BROWN 11
#define CX_CYAN 2
#define CX_GREEN 5
#define CX_MAGENTA 10
#define CX_BLUE 4
#define CX_RED 7
/* we don't care about the rest, at least now */
/* should get: black white blue red grey greyblue ltgrey */
void
map_colors()
{
int x;
#if 1
int tmpmap[] = { 0, 2, 3, 7, 4, 5, 8, 9, 10, 11, 13, 15, 12, 1, 14, 6 };
/* still not right: gray green yellow lost somewhere? */
#else
int tmpmap[16];
int x, y;
for (x = 0; x < 16; x++)
tmpmap[x] = -1; /* set not assigned yet */
tmpmap[BestMatch(0, 0, 0)] = CX_BLACK;
tmpmap[BestMatch(255, 255, 255)] = CX_WHITE;
tmpmap[BestMatch(255, 0, 0)] = CX_RED;
tmpmap[BestMatch(0, 255, 0)] = CX_GREEN;
tmpmap[BestMatch(0, 0, 255)] = CX_BLUE;
/* clean up the rest */
for (x = 0; x < 16; x++) {
for (y = 0; y < 16; y++)
if (tmpmap[y] == x)
goto outer_cont;
for (y = 0; y < 16; y++)
if (tmpmap[y] == -1) {
tmpmap[y] = x;
break;
}
if (y == 16)
panic("too many colors?");
outer_cont:
;
}
for (x = 0; x < 16; x++)
if (tmpmap[y] == -1)
panic("lost color?");
#endif
for (x = 0; x < 16; x++) {
#ifdef DBG
printf("final: c[%d]=%d (target: %d)\n", x, tmpmap[x], colrmap[x]);
#endif
colrmap[x] = tmpmap[x];
}
}
BestMatch(r, g, b) int r, g, b;
{
int x;
int bestslot;
int bestrate = 99999999L;
for (x = 0; x < 16; x++) {
int rr = r - ColorMap[CM_RED][x];
int gg = g - ColorMap[CM_GREEN][x];
int bb = b - ColorMap[CM_BLUE][x];
int rate = rr * rr + gg * gg + bb * bb;
if (bestrate > rate) {
bestrate = rate;
bestslot = x;
}
}
#ifdef DBG
printf("map (%d,%d,%d) -> %d (error=%d)\n", r, g, b, bestslot, bestrate);
#endif
return bestslot;
}
long *
alloc(unsigned int n)
{
long *ret = malloc(n);
if (!ret) {
error("Can't allocate memory");
exit(1);
}
return (ret);
}
void
panic(const char *msg)
{
fprintf(stderr, "PANIC: %s\n", msg);
exit(1);
}
-363
View File
@@ -1,363 +0,0 @@
/* NetHack 3.6 xpm2iff.c $NHDT-Date: 1432512795 2015/05/25 00:13:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* Copyright (c) 1995 by Gregg Wonderly, Naperville, Illinois */
/* NetHack may be freely redistributed. See license for details. */
#include <stdlib.h>
#include "config.h"
#include "tile.h"
#include <dos/dos.h>
#include <dos/dos.h>
#include <dos/dosextens.h>
#include <graphics/gfx.h>
#include <graphics/gfxbase.h>
#include <graphics/view.h>
#include <libraries/iffparse.h>
#include <libraries/dos.h>
#ifndef _DCC
#include <proto/iffparse.h>
#include <proto/dos.h>
#include <proto/exec.h>
#endif
struct xpmscreen {
int Width;
int Height;
int Colors;
int ColorResolution;
int Background;
int AspectRatio;
int Interlace;
int BytesPerRow;
} XpmScreen;
/* translation table from xpm characters to RGB and colormap slots */
struct Ttable {
char flag;
char r, g, b;
int slot; /* output colortable index */
} ttable[256];
pixval ColorMap[3][MAXCOLORMAPSIZE];
int colorsinmap;
/*
* We are using a hybrid form of our own design which we call a BMAP (for
* bitmap) form. It is an ILBM with the bitmaps already deinterleaved,
* completely uncompressed.
* This speeds the loading of the images from the games point of view because
* it
* does not have to deinterleave and uncompress them.
*/
#define ID_BMAP MAKE_ID('B', 'M', 'A', 'P') /* instead of ILBM */
#define ID_BMHD MAKE_ID('B', 'M', 'H', 'D') /* Same as ILBM */
#define ID_CAMG MAKE_ID('C', 'A', 'M', 'G') /* Same as ILBM */
#define ID_CMAP MAKE_ID('C', 'M', 'A', 'P') /* Same as ILBM */
#define ID_PDAT \
MAKE_ID('P', 'D', 'A', 'T') /* Extra data describing plane \
* size due to graphics.library \
* rounding requirements. \
*/
#define ID_PLNE MAKE_ID('P', 'L', 'N', 'E') /* The planes of the image */
int nplanes;
/* BMHD from IFF documentation */
typedef struct {
UWORD w, h;
WORD x, y;
UBYTE nPlanes;
UBYTE masking;
UBYTE compression;
UBYTE reserved1;
UWORD transparentColor;
UBYTE xAspect, yAspect;
WORD pageWidth, pageHeight;
} BitMapHeader;
typedef struct {
UBYTE r, g, b;
} AmiColorMap;
pixel pixels[TILE_Y][TILE_X];
AmiColorMap *cmap;
void
error(char *str)
{
fprintf(stderr, "ERROR: %s\n", str);
}
char **planes;
main(int argc, char **argv)
{
int colors;
struct {
long nplanes;
long pbytes;
long across;
long down;
long npics;
long xsize;
long ysize;
} pdat;
long pbytes; /* Bytes of data in a plane */
int i, cnt;
BitMapHeader bmhd;
struct IFFHandle *iff;
long camg = HIRES | LACE;
int tiles = 0;
int index;
#if defined(_DCC) || defined(__GNUC__)
IFFParseBase = OpenLibrary("iffparse.library", 0);
if (!IFFParseBase) {
error("unable to open iffparse.library");
exit(1);
}
#endif
if (fopen_xpm_file(argv[1], "r") != TRUE) {
perror(argv[1]);
return (1);
}
nplanes = 0;
i = XpmScreen.Colors - 1;
while (i != 0) {
nplanes++;
i >>= 1;
}
planes = malloc(nplanes * sizeof(char *));
if (planes == 0) {
error("can not allocate planes pointer");
exit(1);
}
XpmScreen.BytesPerRow = ((XpmScreen.Width + 15) / 16) * 2;
pbytes = XpmScreen.BytesPerRow * XpmScreen.Height;
for (i = 0; i < nplanes; ++i) {
planes[i] = malloc(pbytes);
if (planes[i] == 0) {
error("can not allocate planes pointer");
exit(1);
}
memset(planes[i], 0, pbytes);
}
iff = AllocIFF();
if (!iff) {
error("Can not allocate IFFHandle");
return (1);
}
iff->iff_Stream = Open(argv[2], MODE_NEWFILE);
if (!iff->iff_Stream) {
error("Can not open output file");
return (1);
}
InitIFFasDOS(iff);
OpenIFF(iff, IFFF_WRITE);
PushChunk(iff, ID_BMAP, ID_FORM, IFFSIZE_UNKNOWN);
bmhd.w = XpmScreen.Width;
bmhd.h = XpmScreen.Height;
bmhd.x = 0;
bmhd.y = 0;
bmhd.nPlanes = nplanes;
bmhd.masking = 0;
bmhd.compression = 0;
bmhd.reserved1 = 0;
bmhd.transparentColor = 0;
bmhd.xAspect = 100;
bmhd.yAspect = 100;
bmhd.pageWidth = 0; /* not needed for this program */
bmhd.pageHeight = 0; /* not needed for this program */
PushChunk(iff, ID_BMAP, ID_BMHD, sizeof(bmhd));
WriteChunkBytes(iff, &bmhd, sizeof(bmhd));
PopChunk(iff);
PushChunk(iff, ID_BMAP, ID_CAMG, sizeof(camg));
WriteChunkBytes(iff, &camg, sizeof(camg));
PopChunk(iff);
#define SCALE(x) (x)
cmap = malloc((colors = (1L << nplanes)) * sizeof(AmiColorMap));
if (cmap == 0) {
error("Can't allocate color map");
exit(1);
}
for (index = 0; index < 256; index++) {
if (ttable[index].flag) {
cmap[ttable[index].slot].r = SCALE(ttable[index].r);
cmap[ttable[index].slot].g = SCALE(ttable[index].g);
cmap[ttable[index].slot].b = SCALE(ttable[index].b);
}
}
#undef SCALE
PushChunk(iff, ID_BMAP, ID_CMAP, IFFSIZE_UNKNOWN);
WriteChunkBytes(iff, cmap, colors * sizeof(*cmap));
PopChunk(iff);
conv_image();
pdat.nplanes = nplanes;
pdat.pbytes = pbytes;
pdat.xsize = XpmScreen.Width;
pdat.ysize = XpmScreen.Height;
pdat.across = 0;
pdat.down = 0;
pdat.npics = 1;
PushChunk(iff, ID_BMAP, ID_PDAT, IFFSIZE_UNKNOWN);
WriteChunkBytes(iff, &pdat, sizeof(pdat));
PopChunk(iff);
PushChunk(iff, ID_BMAP, ID_PLNE, IFFSIZE_UNKNOWN);
for (i = 0; i < nplanes; ++i)
WriteChunkBytes(iff, planes[i], pbytes);
PopChunk(iff);
CloseIFF(iff);
Close(iff->iff_Stream);
FreeIFF(iff);
#if defined(_DCC) || defined(__GNUC__)
CloseLibrary(IFFParseBase);
#endif
exit(0);
}
#define SETBIT(Plane, Plane_offset, Col, Value) \
if (Value) { \
planes[Plane][Plane_offset + (Col / 8)] |= 1 << (7 - (Col & 7)); \
}
conv_image()
{
int row, col, planeno;
for (row = 0; row < XpmScreen.Height; row++) {
char *xb = xpmgetline();
int plane_offset;
if (xb == 0)
return;
plane_offset = row * XpmScreen.BytesPerRow;
for (col = 0; col < XpmScreen.Width; col++) {
int slot;
int color = xb[col];
if (!ttable[color].flag) {
fprintf(stderr, "Bad image data\n");
}
slot = ttable[color].slot;
for (planeno = 0; planeno < nplanes; planeno++) {
SETBIT(planeno, plane_offset, col, slot & (1 << planeno));
}
}
}
}
long *
alloc(unsigned int n)
{
long *ret = malloc(n);
if (!ret) {
error("Can't allocate memory");
exit(1);
}
return (ret);
}
FILE *xpmfh = 0;
char initbuf[200];
char *xpmbuf = initbuf;
/* version 1. Reads the raw xpm file, NOT the compiled version. This is
* not a particularly good idea but I don't have time to do the right thing
* at this point, even if I was absolutely sure what that was. */
fopen_xpm_file(const char *fn, const char *mode)
{
int temp;
char *xb;
if (strcmp(mode, "r"))
return FALSE; /* no choice now */
if (xpmfh)
return FALSE; /* one file at a time */
xpmfh = fopen(fn, mode);
if (!xpmfh)
return FALSE; /* I'm hard to please */
/* read the header */
xb = xpmgetline();
if (xb == 0)
return FALSE;
if (4 != sscanf(xb, "%d %d %d %d", &XpmScreen.Width, &XpmScreen.Height,
&XpmScreen.Colors, &temp))
return FALSE; /* bad header */
/* replace the original buffer with one big enough for
* the real data
*/
/* XXX */
xpmbuf = malloc(XpmScreen.Width * 2);
if (!xpmbuf) {
error("Can't allocate line buffer");
exit(1);
}
if (temp != 1)
return FALSE; /* limitation of this code */
{
/* read the colormap and translation table */
int ccount = -1;
while (ccount++ < (XpmScreen.Colors - 1)) {
char index;
int r, g, b;
xb = xpmgetline();
if (xb == 0)
return FALSE;
if (4 != sscanf(xb, "%c c #%2x%2x%2x", &index, &r, &g, &b)) {
fprintf(stderr, "Bad color entry: %s\n", xb);
return FALSE;
}
ttable[index].flag = 1; /* this color is valid */
ttable[index].r = r;
ttable[index].g = g;
ttable[index].b = b;
ttable[index].slot = ccount;
}
}
return TRUE;
}
/* This deserves better. Don't read it too closely - you'll get ill. */
#define bufsz 2048
char buf[bufsz];
xpmgetline()
{
char *bp;
do {
if (fgets(buf, bufsz, xpmfh) == 0)
return 0;
} while (buf[0] != '"');
/* strip off the trailing <",> if any */
for (bp = buf; *bp; bp++)
;
bp--;
while (isspace(*bp))
bp--;
if (*bp == ',')
bp--;
if (*bp == '"')
bp--;
bp++;
*bp = '\0';
return &buf[1];
}