Some support of new code #defines to faciliate cross-compiling:
OPTIONS_AT_RUNTIME If this is defined, code to support obtaining
the compile time options and features is
included. If you define this, you'll also have
to compile sys/mdlib.c and link the resulting
object file into your game binary/executable.
CROSSCOMPILE Flags that this is a cross-compiled NetHack build,
where there are two stages:
1. makedefs and some other utilities are compiled
on the host platform and executed there to generate
some output files and header files needed by the
game.
2. the NetHack game files are compiled by a
cross-compiler to generate binary/executables for
a different platform than the one the build is
being run on. The executables produced for the
target platform may not be able to execute on the
build platform, except perhaps via a software
emulator.
The 2-stage process (1. host, 2.target) can be done
on the same platform to test the cross-compile
process. In that case, the host and target platforms
would be the same.
CROSSCOMPILE_HOST Separates/identifies code paths that should only be
be included in the compile on the host side, for
utilities that will be run on the host as part of
stage 1 to produce output files needed to build the
game. Examples are the code for makedefs, tile
conversion utilities, uudecode, dlb, etc.
CROSSCOMPILE_TARGET Separates/identifies code paths that should be
included on the build for the target platform
during stage 2, the cross-compiler stage. That
includes most of the pieces of the game itself
but the code is only flagged as such if it must
not execute on the host.
If you don't define any of those, things should build as before.
One follow-on change that is likely required is setting the new dependency
makedefs has on src/mdlib.c in Makefiles etc.
More information about the changes:
makedefs
- splinter off some of makedefs functionality into a separate file
called src/mdlib.c.
- src/mdlib.c, while included during the compile of makedefs.c
for producing the makedefs utility, can also be compiled
as a stand-alone object file for inclusion in the link step
of your NetHack game build. The src/mdlib.c code can then
deliver the same functionality that it provided to makedefs
right to your NetHack game code at run-time.
For example, do_runtime_info() will provide the caller with
the features and options that were built into the game.
Previously, that information was produced at build time on the
host and stored in a dat file. Under a cross-compile situation,
those values are highly suspect and might not even reflect the
correct options and setting for the cross-compiled target
platform's binary/executable. The compile of those values and
the functionality to obtain them needs to move to the target
cross-compiler stage of the build (stage 2).
- date information on the target-side binary is produced from
the cross-compiler preprocessor pre-defined macros __DATE__
and __TIME__, as they reflect the actual compile time of the
cross-compiled target and not host-side execution of a utility
to produce them. The cross-compiler itself, through those
pre-defined preprocessor macros, provides them to the target
platform binary/executable. They reflect the actual build
time of the target binary/executable (not values produced
at the time the makefiles utility was built and the
appropriate option selected to store them in a text file.)
- most Makefiles should not require adding the new file
src/mdlib.c because util/makedefs.c has a preprocessor
include "../src/mdlib.c" to draw in its contents. As previously
stated though, the Makefile dependency may be required:
makedefs.o: ../util/makedefs.c ../src/mdlib.c
^^^^^^^^^^^^^^^
119 lines
3.2 KiB
C
119 lines
3.2 KiB
C
/* NetHack 3.6 qtext.h $NHDT-Date: 1505170347 2017/09/11 22:52:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ */
|
|
/* Copyright (c) Mike Stephenson 1991. */
|
|
/* NetHack may be freely redistributed. See license for details. */
|
|
|
|
#ifndef QTEXT_H
|
|
#define QTEXT_H
|
|
|
|
#define N_HDR 16 /* Maximum number of categories */
|
|
/* (i.e., num roles + 1) */
|
|
#define LEN_HDR 3 /* Maximum length of a category name */
|
|
|
|
struct qtmsg {
|
|
int msgnum;
|
|
char delivery;
|
|
long offset, size, summary_size;
|
|
};
|
|
|
|
#if defined(MAKEDEFS_C) || defined(MDLIB_C) /***** MAKEDEFS *****/
|
|
|
|
#define N_MSG 100 /* arbitrary */
|
|
|
|
struct msghdr {
|
|
int n_msg;
|
|
struct qtmsg qt_msg[N_MSG];
|
|
};
|
|
|
|
struct qthdr {
|
|
int n_hdr;
|
|
char id[N_HDR][LEN_HDR];
|
|
long offset[N_HDR];
|
|
};
|
|
|
|
/* Error message macros */
|
|
#define CREC_IN_MSG "Control record encountered during message - line %d\n"
|
|
#define DUP_MSG "Duplicate message number at line %d\n"
|
|
#define END_NOT_IN_MSG "End record encountered before message - line %d\n"
|
|
#define TEXT_NOT_IN_MSG "Text encountered outside message - line %d\n"
|
|
#define UNREC_CREC "Unrecognized Control record at line %d\n"
|
|
#define MAL_SUM "Malformed summary in End record - line %d\n"
|
|
#define DUMB_SUM "Summary for single line message is useless - line %d\n"
|
|
#define CTRL_TRUNC "Control record truncated at line %d\n"
|
|
#define TEXT_TRUNC "Text record truncated at line %d\n"
|
|
#define OUT_OF_HEADERS \
|
|
"Too many message types (line %d)\nAdjust N_HDR in qtext.h and " \
|
|
"recompile.\n"
|
|
#define OUT_OF_MESSAGES \
|
|
"Too many messages in class (line %d)\nAdjust N_MSG in qtext.h and " \
|
|
"recompile.\n"
|
|
|
|
#else /***** !MAKEDEFS && !MDLIB_C *****/
|
|
|
|
struct qtlists {
|
|
struct qtmsg *common,
|
|
#if 0 /* UNUSED but available */
|
|
*chrace,
|
|
#endif
|
|
*chrole;
|
|
};
|
|
|
|
/*
|
|
* Quest message defines. Used in quest.c to trigger off "realistic"
|
|
* dialogue to the player.
|
|
*/
|
|
#define QT_FIRSTTIME 1
|
|
#define QT_NEXTTIME 2
|
|
#define QT_OTHERTIME 3
|
|
|
|
#define QT_GUARDTALK 5 /* 5 random things guards say before quest */
|
|
#define QT_GUARDTALK2 10 /* 5 random things guards say after quest */
|
|
|
|
#define QT_FIRSTLEADER 15
|
|
#define QT_NEXTLEADER 16
|
|
#define QT_OTHERLEADER 17
|
|
#define QT_LASTLEADER 18
|
|
#define QT_BADLEVEL 19
|
|
#define QT_BADALIGN 20
|
|
#define QT_ASSIGNQUEST 21
|
|
|
|
#define QT_ENCOURAGE 25 /* 1-10 random encouragement messages */
|
|
|
|
#define QT_FIRSTLOCATE 35
|
|
#define QT_NEXTLOCATE 36
|
|
|
|
#define QT_FIRSTGOAL 40
|
|
#define QT_NEXTGOAL 41
|
|
#define QT_ALTGOAL 42 /* alternate to QT_NEXTGOAL if artifact is absent */
|
|
|
|
#define QT_FIRSTNEMESIS 50
|
|
#define QT_NEXTNEMESIS 51
|
|
#define QT_OTHERNEMESIS 52
|
|
#define QT_NEMWANTSIT 53 /* you somehow got the artifact */
|
|
|
|
#define QT_DISCOURAGE 60 /* 1-10 random maledictive messages */
|
|
|
|
#define QT_GOTIT 70
|
|
|
|
#define QT_KILLEDNEM 80
|
|
#define QT_OFFEREDIT 81
|
|
#define QT_OFFEREDIT2 82
|
|
|
|
#define QT_POSTHANKS 90
|
|
#define QT_HASAMULET 91
|
|
|
|
/*
|
|
* Message defines for common text used in maledictions.
|
|
*/
|
|
#define COMMON_ID "-" /* Common message id value */
|
|
|
|
#define QT_ANGELIC 10
|
|
#define QTN_ANGELIC 10
|
|
|
|
#define QT_DEMONIC 30
|
|
#define QTN_DEMONIC 20
|
|
|
|
#define QT_BANISHED 60
|
|
#endif /***** !MAKEDEFS && !MDLIB_C *****/
|
|
|
|
#endif /* QTEXT_H */
|