diff --git a/Cross-compiling b/Cross-compiling index bccd5bce6..b3dbba6f6 100644 --- a/Cross-compiling +++ b/Cross-compiling @@ -378,8 +378,7 @@ Using the cross-compiler, build the following targets: src/priest.c, src/quest.c, src/questpgr.c, src/random.c, src/read.c, src/rect.c, src/region.c, src/restore.c, src/rip.c, src/rnd.c, src/role.c, - src/rumors.c, src/save.c, src/sfbase.c, - src/sfdata.c, src/sflendian.c, src/sfstruct.c, + src/rumors.c, src/save.c, src/sfstruct.c, src/shk.c, src/shknam.c, src/sit.c, src/sounds.c, src/sp_lev.c, src/spell.c, src/steal.c, src/steed.c, src/sys.c, src/teleport.c, src/tile.c, diff --git a/Files b/Files index b7448e53c..b04f5f544 100644 --- a/Files +++ b/Files @@ -307,25 +307,24 @@ dlb_main.c makedefs.c mdgrep.h mdgrep.pl panic.c readtags.c recover.c win/Qt: +(files for the Qt 4 or 5 widget library - X11, Windows, Mac OS X) +qt_bind.cpp qt_bind.h qt_click.cpp qt_click.h qt_clust.cpp +qt_clust.h qt_delay.cpp qt_delay.h qt_glyph.cpp qt_glyph.h +qt_icon.cpp qt_icon.h qt_inv.cpp qt_inv.h qt_kde0.h +qt_key.cpp qt_key.h qt_line.cpp qt_line.h qt_main.cpp +qt_main.h qt_map.cpp qt_map.h qt_menu.cpp qt_menu.h +qt_msg.cpp qt_msg.h qt_plsel.cpp qt_plsel.h qt_rip.cpp +qt_rip.h qt_set.cpp qt_set.h qt_stat.cpp qt_stat.h +qt_str.cpp qt_str.h qt_streq.cpp qt_streq.h qt_svsel.cpp +qt_svsel.h qt_win.cpp qt_win.h qt_xcmd.cpp qt_xcmd.h +qt_yndlg.cpp qt_yndlg.h + +win/Qt3: (files for the Qt 3 widget library - X11, Windows, Mac OS X, or Qtopia) Info.plist Install.Qt knethack.lnk -knh-mini.xpm knh.xpm nhicns.uu -nhsplash.xpm qpe-nethack.control qt_clust.cpp -qt_win.cpp qttableview.cpp tileedit.cpp -tileedit.h - -win/Qt4: -(files for the Qt 4 widget library - X11, Windows, Mac OS X) -qt4bind.cpp qt4bind.h qt4click.cpp qt4click.h qt4clust.cpp -qt4clust.h qt4delay.cpp qt4delay.h qt4glyph.cpp qt4glyph.h -qt4icon.cpp qt4icon.h qt4inv.cpp qt4inv.h qt4kde0.h -qt4key.cpp qt4key.h qt4line.cpp qt4line.h qt4main.cpp -qt4main.h qt4map.cpp qt4map.h qt4menu.cpp qt4menu.h -qt4msg.cpp qt4msg.h qt4plsel.cpp qt4plsel.h qt4rip.cpp -qt4rip.h qt4set.cpp qt4set.h qt4stat.cpp qt4stat.h -qt4str.cpp qt4str.h qt4streq.cpp qt4streq.h qt4svsel.cpp -qt4svsel.h qt4win.cpp qt4win.h qt4xcmd.cpp qt4xcmd.h -qt4yndlg.cpp qt4yndlg.h +knh-mini.xpm knh.xpm qpe-nethack.control +qt_clust.cpp qt_win.cpp qttableview.cpp +tileedit.cpp tileedit.h win/X11: (files for X versions) @@ -366,10 +365,10 @@ NetHackTerm.applescript recover.pl win/share: (files for versions using optional tiles) -bmptiles.c gifread.c giftiles.c monsters.txt objects.txt -other.txt ppmwrite.c renumtiles.pl safeproc.c thintile.c -tile.doc tile.h tile2bmp.c tilemap.c tileset.c -tiletext.c +bmptiles.c gifread.c giftiles.c monsters.txt nhicns.uu +nhsplash.xpm objects.txt other.txt ppmwrite.c renumtiles.pl +safeproc.c thintile.c tile.doc tile.h tile2bmp.c +tilemap.c tileset.c tiletext.c win/tty: (files for tty versions) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index f9f60be61..ca87a330a 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ $NHDT-Date: 1575542023 2019/12/05 10:33:43 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.19 $ $NHDT-Date: 1575755075 2019/12/07 21:44:35 $ General Fixes and Modified Features ----------------------------------- @@ -13,6 +13,9 @@ improvements to pronoun usage when hallucinating message "your knapsack can't accomodate any more items" when picking stuff up or removing such from container was inaccurate if there was some gold pending; vary the message rather than add more convoluted pickup code +function calls made from mapglyph based on dungeon level are now called once + per level +allow teleporting onto the vibrating square Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository @@ -39,7 +42,8 @@ split off some of the functionality that was in makedefs (compiled-in options build date/time, etc) so that it can be built by a cross-compiler and accessed on the target platform replace quest.txt and associated conversion to quest.dat via makedefs with - lua quest texts loaded at runtime + lua quest texts loaded at runtime +some altars are displayed in different colors (for tty and curses at least) Platform- and/or Interface-Specific New Features @@ -55,4 +59,7 @@ Code Cleanup and Reorganization move majority of global variables into instance_globals struct g move zeroobj, zeromonst, zeroany into const_globals struct cg remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR +old Qt moved from win/Qt to win/Qt3 +more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4 + moniker changed to qt_ diff --git a/include/context.h b/include/context.h index 6209a5e82..4e20f3bdc 100644 --- a/include/context.h +++ b/include/context.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 context.h $NHDT-Date: 1455907260 2016/02/19 18:41:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.6 context.h $NHDT-Date: 1575775592 2019/12/08 03:26:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -115,6 +115,7 @@ struct context_info { int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ int warnlevel; int rndencode; /* randomized escape sequence introducer */ + int mysteryforce; long next_attrib_check; /* next attribute check */ long stethoscope_move; short stethoscope_movement; diff --git a/include/decl.h b/include/decl.h index ce0ecabe8..d6100e241 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1260,6 +1260,9 @@ struct instance_globals { char lua_ver[LUA_VER_BUFSIZ]; char lua_copyright[LUA_COPYRIGHT_BUFSIZ]; + /* per-level glyph mapping flags */ + long glyphmap_perlevel_flags; + unsigned long magic; /* validate that structure layout is preserved */ }; diff --git a/include/extern.h b/include/extern.h index c0016274e..836784059 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1574648937 2019/11/25 02:28:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.760 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1575830178 2019/12/08 18:36:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.767 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1671,6 +1671,11 @@ E struct selectionvar *FDECL(l_selection_check, (lua_State *, int)); E int FDECL(l_selection_register, (lua_State *)); #endif +/* ### nhlobj.c ### */ +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +E int FDECL(l_obj_register, (lua_State *)); +#endif + /* ### nhlua.c ### */ #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) @@ -1681,6 +1686,9 @@ E void FDECL(nhl_error, (lua_State *, const char *)) NORETURN; E void FDECL(lcheck_param_table, (lua_State *)); E schar FDECL(get_table_mapchr, (lua_State *, const char *)); E schar FDECL(get_table_mapchr_opt, (lua_State *, const char *, SCHAR_P)); +E void FDECL(nhl_add_table_entry_int, (lua_State *, const char *, int)); +E void FDECL(nhl_add_table_entry_char, (lua_State *, const char *, CHAR_P)); +E void FDECL(nhl_add_table_entry_str, (lua_State *, const char *, const char *)); E schar FDECL(splev_chr2typ, (CHAR_P)); E schar FDECL(check_mapchr, (const char *)); E int FDECL(get_table_int, (lua_State *, const char *)); @@ -1796,6 +1804,9 @@ E const char *FDECL(suit_simple_name, (struct obj *)); E const char *FDECL(cloak_simple_name, (struct obj *)); E const char *FDECL(helm_simple_name, (struct obj *)); E const char *FDECL(gloves_simple_name, (struct obj *)); +E const char *FDECL(boots_simple_name, (struct obj *)); +E const char *FDECL(shield_simple_name, (struct obj *)); +E const char *FDECL(shirt_simple_name, (struct obj *)); E const char *FDECL(mimic_obj_name, (struct monst *)); E char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); @@ -2042,6 +2053,7 @@ E boolean FDECL(can_pray, (BOOLEAN_P)); E int NDECL(dopray); E const char *NDECL(u_gname); E int NDECL(doturn); +E int FDECL(altarmask_at, (int, int)); E const char *NDECL(a_gname); E const char *FDECL(a_gname_at, (XCHAR_P x, XCHAR_P y)); E const char *FDECL(align_gname, (ALIGNTYP_P)); diff --git a/include/patchlevel.h b/include/patchlevel.h index 0c8bd7c7a..0b100538d 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1574982020 2019/11/28 23:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1575775596 2019/12/08 03:26:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 1 +#define EDITLEVEL 3 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/include/sfprocs.h b/include/sfprocs.h deleted file mode 100644 index a3b3f5dd3..000000000 --- a/include/sfprocs.h +++ /dev/null @@ -1,192 +0,0 @@ -/* NetHack 3.6 sfprocs.h Tue Nov 6 19:38:48 2018 */ -/* Copyright (c) NetHack Development Team 2018. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef SFPROCS_H -#define SFPROCS_H - -#include "hack.h" -#include "integer.h" -#include "wintype.h" - -#define E extern - -/* output routines */ -E void FDECL(ascii_sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(ascii_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(ascii_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(ascii_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(ascii_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(ascii_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(ascii_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(ascii_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(ascii_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(ascii_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(ascii_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(ascii_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(ascii_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(ascii_sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(ascii_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(ascii_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(ascii_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(ascii_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(ascii_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(ascii_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(ascii_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(ascii_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(ascii_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(ascii_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(ascii_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(ascii_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* output routines */ -E void FDECL(lendian_sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(lendian_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(lendian_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(lendian_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(lendian_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(lendian_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(lendian_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(lendian_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(lendian_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(lendian_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(lendian_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(lendian_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(lendian_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(lendian_sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(lendian_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(lendian_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(lendian_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(lendian_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(lendian_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(lendian_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(lendian_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(lendian_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(lendian_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(lendian_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(lendian_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(lendian_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -#ifdef JSON_SUPPORT -/* output routines */ -E void FDECL(json_sfo_aligntyp, (NHFILE *, aligntype *, const char *, const char *, int)); -E void FDECL(json_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(json_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(json_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(json_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(json_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(json_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(json_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(json_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(json_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(json_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(json_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(json_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(json_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(json_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(json_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(json_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(json_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfo_addinfo), (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(json_sfi_aligntyp, (NHFILE *, aligntype *, const char *, const char *, int)); -E void FDECL(json_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(json_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(json_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(json_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(json_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(json_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(json_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(json_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(json_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(json_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(json_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(json_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(json_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(json_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(json_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(json_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(json_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfi_addinfo), (NHFILE *, const char *, const char *, const char *, int)); -#endif /* JSON_SUPPORT */ - -struct fieldlevel_procs { - void FDECL((*sf_aligntyp), (NHFILE *, aligntyp *, const char *, const char *, int)); - void FDECL((*sf_any), (NHFILE *, union any *d_any, const char *, const char *, int)); - void FDECL((*sf_bitfield), (NHFILE *, uint8_t *, const char *, const char *, int)); - void FDECL((*sf_boolean), (NHFILE *, boolean *, const char *, const char *, int)); - void FDECL((*sf_char), (NHFILE *, char *, const char *, const char *, int)); - void FDECL((*sf_genericptr), (NHFILE *, genericptr_t *, const char *, const char *, int)); - void FDECL((*sf_int), (NHFILE *, int *, const char *, const char *, int)); - void FDECL((*sf_long), (NHFILE *, long *, const char *, const char *, int)); - void FDECL((*sf_schar), (NHFILE *, schar *, const char *, const char *, int)); - void FDECL((*sf_short), (NHFILE *, short *, const char *, const char *, int)); - void FDECL((*sf_size_t), (NHFILE *, size_t *, const char *, const char *, int)); - void FDECL((*sf_time_t), (NHFILE *, time_t *, const char *, const char *, int)); - void FDECL((*sf_unsigned), (NHFILE *, unsigned *, const char *, const char *, int)); - void FDECL((*sf_uchar), (NHFILE *, unsigned char *, const char *, const char *, int)); - void FDECL((*sf_uint), (NHFILE *, unsigned int *, const char *, const char *, int)); - void FDECL((*sf_ulong), (NHFILE *, unsigned long *, const char *, const char *, int)); - void FDECL((*sf_ushort), (NHFILE *, unsigned short *, const char *, const char *, int)); - void FDECL((*sf_xchar), (NHFILE *, xchar *, const char *, const char *, int)); - void FDECL((*sf_str), (NHFILE *, char *, const char *, const char *, int)); - void FDECL((*sf_addinfo), (NHFILE *, const char *, const char *, const char *, int)); -}; - -struct sf_procs { - const char *ext; - struct fieldlevel_procs fn; -}; - -E void NDECL(sf_init); -E struct sf_procs sfoprocs[4], sfiprocs[4]; - -E struct sf_procs ascii_sfo_procs; -E struct sf_procs ascii_sfi_procs; -E struct sf_procs lendian_sfo_procs; -E struct sf_procs lendian_sfi_procs; -E struct sf_procs stub_sfo_procs; -E struct sf_procs stub_sfi_procs; - -#ifdef JSON_SUPPORT -E struct sf_procs json_sfo_procs; -E struct sf_procs json_sfi_procs; -#endif - -#undef E -#endif /* SFPROCS_H */ diff --git a/include/sfproto.h b/include/sfproto.h deleted file mode 100644 index bb30ac4f2..000000000 --- a/include/sfproto.h +++ /dev/null @@ -1,201 +0,0 @@ -/* NetHack 3.7 sfproto.h */ -/* Copyright (c) NetHack Development Team 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */ - -#ifndef SFPROTO_H -#define SFPROTO_H - -#include "hack.h" -#include "integer.h" -#include "wintype.h" - -#define E extern - -E int NDECL(critical_members_count); -/* sfbase.c output functions */ -E void FDECL(sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(sfo_any, (NHFILE *, anything *, const char *, const char *, int)); -E void FDECL(sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(sfo_char, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(sfo_uchar, (NHFILE *, uchar *, const char *, const char *, int)); -E void FDECL(sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(sfo_str, (NHFILE *, const char *, const char *, const char *, int)); -/* sfbase.c input functions */ -E void FDECL(sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(sfi_any, (NHFILE *, anything *, const char *, const char *, int)); -E void FDECL(sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(sfi_char, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(sfi_uchar, (NHFILE *, uchar *, const char *, const char *, int)); -E void FDECL(sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(sfi_str, (NHFILE *, const char *, const char *, const char *, int)); -/* generated output functions */ -E void FDECL(sfo_align, (NHFILE *, struct align *, const char *, const char *, int)); -E void FDECL(sfo_attribs, (NHFILE *, struct attribs *, const char *, const char *, int)); -E void FDECL(sfo_bill_x, (NHFILE *, struct bill_x *, const char *, const char *, int)); -E void FDECL(sfo_book_info, (NHFILE *, struct book_info *, const char *, const char *, int)); -E void FDECL(sfo_branch, (NHFILE *, struct branch *, const char *, const char *, int)); -E void FDECL(sfo_bubble, (NHFILE *, struct bubble *, const char *, const char *, int)); -E void FDECL(sfo_cemetery, (NHFILE *, struct cemetery *, const char *, const char *, int)); -E void FDECL(sfo_context_info, (NHFILE *, struct context_info *, const char *, const char *, int)); -E void FDECL(sfo_d_flags, (NHFILE *, struct d_flags *, const char *, const char *, int)); -E void FDECL(sfo_d_level, (NHFILE *, struct d_level *, const char *, const char *, int)); -E void FDECL(sfo_damage, (NHFILE *, struct damage *, const char *, const char *, int)); -E void FDECL(sfo_dest_area, (NHFILE *, struct dest_area *, const char *, const char *, int)); -E void FDECL(sfo_dgn_topology, (NHFILE *, struct dgn_topology *, const char *, const char *, int)); -E void FDECL(sfo_dig_info, (NHFILE *, struct dig_info *, const char *, const char *, int)); -E void FDECL(sfo_dungeon, (NHFILE *, struct dungeon *, const char *, const char *, int)); -E void FDECL(sfo_edog, (NHFILE *, struct edog *, const char *, const char *, int)); -E void FDECL(sfo_egd, (NHFILE *, struct egd *, const char *, const char *, int)); -E void FDECL(sfo_emin, (NHFILE *, struct emin *, const char *, const char *, int)); -E void FDECL(sfo_engr, (NHFILE *, struct engr *, const char *, const char *, int)); -E void FDECL(sfo_epri, (NHFILE *, struct epri *, const char *, const char *, int)); -E void FDECL(sfo_eshk, (NHFILE *, struct eshk *, const char *, const char *, int)); -E void FDECL(sfo_fakecorridor, (NHFILE *, struct fakecorridor *, const char *, const char *, int)); -E void FDECL(sfo_fe, (NHFILE *, struct fe *, const char *, const char *, int)); -E void FDECL(sfo_flag, (NHFILE *, struct flag *, const char *, const char *, int)); -E void FDECL(sfo_fruit, (NHFILE *, struct fruit *, const char *, const char *, int)); -E void FDECL(sfo_kinfo, (NHFILE *, struct kinfo *, const char *, const char *, int)); -E void FDECL(sfo_levelflags, (NHFILE *, struct levelflags *, const char *, const char *, int)); -E void FDECL(sfo_linfo, (NHFILE *, struct linfo *, const char *, const char *, int)); -E void FDECL(sfo_ls_t, (NHFILE *, struct ls_t *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_feat, (NHFILE *, struct mapseen_feat *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_flags, (NHFILE *, struct mapseen_flags *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_rooms, (NHFILE *, struct mapseen_rooms *, const char *, const char *, int)); -E void FDECL(sfo_mapseen, (NHFILE *, struct mapseen *, const char *, const char *, int)); -E void FDECL(sfo_mextra, (NHFILE *, struct mextra *, const char *, const char *, int)); -E void FDECL(sfo_mkroom, (NHFILE *, struct mkroom *, const char *, const char *, int)); -E void FDECL(sfo_monst, (NHFILE *, struct monst *, const char *, const char *, int)); -E void FDECL(sfo_mvitals, (NHFILE *, struct mvitals *, const char *, const char *, int)); -E void FDECL(sfo_nhcoord, (NHFILE *, struct nhcoord *, const char *, const char *, int)); -E void FDECL(sfo_nhrect, (NHFILE *, struct nhrect *, const char *, const char *, int)); -E void FDECL(sfo_novel_tracking, (NHFILE *, struct novel_tracking *, const char *, const char *, int)); -E void FDECL(sfo_obj, (NHFILE *, struct obj *, const char *, const char *, int)); -E void FDECL(sfo_objclass, (NHFILE *, struct objclass *, const char *, const char *, int)); -E void FDECL(sfo_obj_split, (NHFILE *, struct obj_split *, const char *, const char *, int)); -E void FDECL(sfo_oextra, (NHFILE *, struct oextra *, const char *, const char *, int)); -E void FDECL(sfo_polearm_info, (NHFILE *, struct polearm_info *, const char *, const char *, int)); -E void FDECL(sfo_prop, (NHFILE *, struct prop *, const char *, const char *, int)); -E void FDECL(sfo_q_score, (NHFILE *, struct q_score *, const char *, const char *, int)); -E void FDECL(sfo_rm, (NHFILE *, struct rm *, const char *, const char *, int)); -E void FDECL(sfo_s_level, (NHFILE *, struct s_level *, const char *, const char *, int)); -E void FDECL(sfo_savefile_info, (NHFILE *, struct savefile_info *, const char *, const char *, int)); -E void FDECL(sfo_skills, (NHFILE *, struct skills *, const char *, const char *, int)); -E void FDECL(sfo_spell, (NHFILE *, struct spell *, const char *, const char *, int)); -E void FDECL(sfo_stairway, (NHFILE *, struct stairway *, const char *, const char *, int)); -E void FDECL(sfo_takeoff_info, (NHFILE *, struct takeoff_info *, const char *, const char *, int)); -E void FDECL(sfo_tin_info, (NHFILE *, struct tin_info *, const char *, const char *, int)); -E void FDECL(sfo_trap, (NHFILE *, struct trap *, const char *, const char *, int)); -E void FDECL(sfo_tribute_info, (NHFILE *, struct tribute_info *, const char *, const char *, int)); -E void FDECL(sfo_u_achieve, (NHFILE *, struct u_achieve *, const char *, const char *, int)); -E void FDECL(sfo_u_conduct, (NHFILE *, struct u_conduct *, const char *, const char *, int)); -E void FDECL(sfo_u_event, (NHFILE *, struct u_event *, const char *, const char *, int)); -E void FDECL(sfo_u_have, (NHFILE *, struct u_have *, const char *, const char *, int)); -E void FDECL(sfo_u_realtime, (NHFILE *, struct u_realtime *, const char *, const char *, int)); -E void FDECL(sfo_u_roleplay, (NHFILE *, struct u_roleplay *, const char *, const char *, int)); -E void FDECL(sfo_version_info, (NHFILE *, struct version_info *, const char *, const char *, int)); -E void FDECL(sfo_victual_info, (NHFILE *, struct victual_info *, const char *, const char *, int)); -E void FDECL(sfo_vlaunchinfo, (NHFILE *, union vlaunchinfo *, const char *, const char *, int)); -E void FDECL(sfo_vptrs, (NHFILE *, union vptrs *, const char *, const char *, int)); -E void FDECL(sfo_warntype_info, (NHFILE *, struct warntype_info *, const char *, const char *, int)); -E void FDECL(sfo_you, (NHFILE *, struct you *, const char *, const char *, int)); -/* generated input functions */ -E void FDECL(sfi_align, (NHFILE *, struct align *, const char *, const char *, int)); -E void FDECL(sfi_attribs, (NHFILE *, struct attribs *, const char *, const char *, int)); -E void FDECL(sfi_bill_x, (NHFILE *, struct bill_x *, const char *, const char *, int)); -E void FDECL(sfi_book_info, (NHFILE *, struct book_info *, const char *, const char *, int)); -E void FDECL(sfi_branch, (NHFILE *, struct branch *, const char *, const char *, int)); -E void FDECL(sfi_bubble, (NHFILE *, struct bubble *, const char *, const char *, int)); -E void FDECL(sfi_cemetery, (NHFILE *, struct cemetery *, const char *, const char *, int)); -E void FDECL(sfi_context_info, (NHFILE *, struct context_info *, const char *, const char *, int)); -E void FDECL(sfi_d_flags, (NHFILE *, struct d_flags *, const char *, const char *, int)); -E void FDECL(sfi_d_level, (NHFILE *, struct d_level *, const char *, const char *, int)); -E void FDECL(sfi_damage, (NHFILE *, struct damage *, const char *, const char *, int)); -E void FDECL(sfi_dest_area, (NHFILE *, struct dest_area *, const char *, const char *, int)); -E void FDECL(sfi_dgn_topology, (NHFILE *, struct dgn_topology *, const char *, const char *, int)); -E void FDECL(sfi_dig_info, (NHFILE *, struct dig_info *, const char *, const char *, int)); -E void FDECL(sfi_dungeon, (NHFILE *, struct dungeon *, const char *, const char *, int)); -E void FDECL(sfi_edog, (NHFILE *, struct edog *, const char *, const char *, int)); -E void FDECL(sfi_egd, (NHFILE *, struct egd *, const char *, const char *, int)); -E void FDECL(sfi_emin, (NHFILE *, struct emin *, const char *, const char *, int)); -E void FDECL(sfi_engr, (NHFILE *, struct engr *, const char *, const char *, int)); -E void FDECL(sfi_epri, (NHFILE *, struct epri *, const char *, const char *, int)); -E void FDECL(sfi_eshk, (NHFILE *, struct eshk *, const char *, const char *, int)); -E void FDECL(sfi_fakecorridor, (NHFILE *, struct fakecorridor *, const char *, const char *, int)); -E void FDECL(sfi_fe, (NHFILE *, struct fe *, const char *, const char *, int)); -E void FDECL(sfi_flag, (NHFILE *, struct flag *, const char *, const char *, int)); -E void FDECL(sfi_fruit, (NHFILE *, struct fruit *, const char *, const char *, int)); -E void FDECL(sfi_kinfo, (NHFILE *, struct kinfo *, const char *, const char *, int)); -E void FDECL(sfi_levelflags, (NHFILE *, struct levelflags *, const char *, const char *, int)); -E void FDECL(sfi_linfo, (NHFILE *, struct linfo *, const char *, const char *, int)); -E void FDECL(sfi_ls_t, (NHFILE *, struct ls_t *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_feat, (NHFILE *, struct mapseen_feat *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_flags, (NHFILE *, struct mapseen_flags *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_rooms, (NHFILE *, struct mapseen_rooms *, const char *, const char *, int)); -E void FDECL(sfi_mapseen, (NHFILE *, struct mapseen *, const char *, const char *, int)); -E void FDECL(sfi_mextra, (NHFILE *, struct mextra *, const char *, const char *, int)); -E void FDECL(sfi_mkroom, (NHFILE *, struct mkroom *, const char *, const char *, int)); -E void FDECL(sfi_monst, (NHFILE *, struct monst *, const char *, const char *, int)); -E void FDECL(sfi_mvitals, (NHFILE *, struct mvitals *, const char *, const char *, int)); -E void FDECL(sfi_nhcoord, (NHFILE *, struct nhcoord *, const char *, const char *, int)); -E void FDECL(sfi_nhrect, (NHFILE *, struct nhrect *, const char *, const char *, int)); -E void FDECL(sfi_novel_tracking, (NHFILE *, struct novel_tracking *, const char *, const char *, int)); -E void FDECL(sfi_obj, (NHFILE *, struct obj *, const char *, const char *, int)); -E void FDECL(sfi_objclass, (NHFILE *, struct objclass *, const char *, const char *, int)); -E void FDECL(sfi_obj_split, (NHFILE *, struct obj_split *, const char *, const char *, int)); -E void FDECL(sfi_oextra, (NHFILE *, struct oextra *, const char *, const char *, int)); -E void FDECL(sfi_polearm_info, (NHFILE *, struct polearm_info *, const char *, const char *, int)); -E void FDECL(sfi_prop, (NHFILE *, struct prop *, const char *, const char *, int)); -E void FDECL(sfi_q_score, (NHFILE *, struct q_score *, const char *, const char *, int)); -E void FDECL(sfi_rm, (NHFILE *, struct rm *, const char *, const char *, int)); -E void FDECL(sfi_s_level, (NHFILE *, struct s_level *, const char *, const char *, int)); -E void FDECL(sfi_savefile_info, (NHFILE *, struct savefile_info *, const char *, const char *, int)); -E void FDECL(sfi_skills, (NHFILE *, struct skills *, const char *, const char *, int)); -E void FDECL(sfi_spell, (NHFILE *, struct spell *, const char *, const char *, int)); -E void FDECL(sfi_stairway, (NHFILE *, struct stairway *, const char *, const char *, int)); -E void FDECL(sfi_takeoff_info, (NHFILE *, struct takeoff_info *, const char *, const char *, int)); -E void FDECL(sfi_tin_info, (NHFILE *, struct tin_info *, const char *, const char *, int)); -E void FDECL(sfi_trap, (NHFILE *, struct trap *, const char *, const char *, int)); -E void FDECL(sfi_tribute_info, (NHFILE *, struct tribute_info *, const char *, const char *, int)); -E void FDECL(sfi_u_achieve, (NHFILE *, struct u_achieve *, const char *, const char *, int)); -E void FDECL(sfi_u_conduct, (NHFILE *, struct u_conduct *, const char *, const char *, int)); -E void FDECL(sfi_u_event, (NHFILE *, struct u_event *, const char *, const char *, int)); -E void FDECL(sfi_u_have, (NHFILE *, struct u_have *, const char *, const char *, int)); -E void FDECL(sfi_u_realtime, (NHFILE *, struct u_realtime *, const char *, const char *, int)); -E void FDECL(sfi_u_roleplay, (NHFILE *, struct u_roleplay *, const char *, const char *, int)); -E void FDECL(sfi_version_info, (NHFILE *, struct version_info *, const char *, const char *, int)); -E void FDECL(sfi_victual_info, (NHFILE *, struct victual_info *, const char *, const char *, int)); -E void FDECL(sfi_vlaunchinfo, (NHFILE *, union vlaunchinfo *, const char *, const char *, int)); -E void FDECL(sfi_vptrs, (NHFILE *, union vptrs *, const char *, const char *, int)); -E void FDECL(sfi_warntype_info, (NHFILE *, struct warntype_info *, const char *, const char *, int)); -E void FDECL(sfi_you, (NHFILE *, struct you *, const char *, const char *, int)); -#endif /* SFPROTO_H */ diff --git a/src/artifact.c b/src/artifact.c index f6ab3065f..e25fedb24 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -6,8 +6,6 @@ #include "hack.h" #include "artifact.h" #include "artilist.h" -#include "sfproto.h" - /* * Note: both artilist[] and artiexist[] have a dummy element #0, @@ -85,15 +83,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); bwrite(nhfp->fd, (genericptr_t) g.artidisco, sizeof g.artidisco); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < (1 + NROFARTIFACTS + 1); ++i) - sfo_boolean(nhfp, &g.artiexist[i], "artifacts", "g.artiexist", 1); - - for (i = 0; i < NROFARTIFACTS; ++i) - sfo_xchar(nhfp, &g.artidisco[i], "artifacts", "g.artidisco", 1); - } } void @@ -104,15 +93,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); mread(nhfp->fd, (genericptr_t) g.artidisco, sizeof g.artidisco); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < (1 + NROFARTIFACTS + 1); ++i) - sfi_boolean(nhfp, &g.artiexist[i], "artifacts", "g.artiexist", 1); - - for (i = 0; i < NROFARTIFACTS; ++i) - sfi_xchar(nhfp, &g.artidisco[i], "artifacts", "g.artidisco", 1); - } hack_artifacts(); /* redo non-saved special cases */ } diff --git a/src/bones.c b/src/bones.c index 0bf1a38cf..f04c4d932 100644 --- a/src/bones.c +++ b/src/bones.c @@ -5,7 +5,6 @@ #include "hack.h" #include "lev.h" -#include "sfproto.h" #ifdef MFLOPPY @@ -555,10 +554,6 @@ struct obj *corpse; bwrite(nhfp->fd, (genericptr_t) &c, sizeof c); bwrite(nhfp->fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */ } - if (nhfp->fieldlevel) { - sfo_char(nhfp, &c, "bones", "bones_count", 1); - sfo_char(nhfp, bonesid, "bones", "bonesid", (int) c); - } savefruitchn(nhfp); if (nhfp->structlevel) bflush(nhfp->fd); @@ -582,11 +577,6 @@ struct obj *corpse; bwrite(nhfp->fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */ savefruitchn(nhfp); } - if (nhfp->fieldlevel) { - sfo_char(nhfp, &c, "bones", "bones_count", 1); - sfo_char(nhfp, bonesid, "bones", "bonesid", (int) c); /* DD.nnn */ - savefruitchn(nhfp); - } update_mlstmv(); /* update monsters for eventual restoration */ savelev(nhfp, ledger_no(&u.uz)); close_nhfile(nhfp); @@ -640,11 +630,6 @@ getbones() mread(nhfp->fd, (genericptr_t) &c, sizeof c); /* length incl. '\0' */ mread(nhfp->fd, (genericptr_t) oldbonesid, (unsigned) c); /* DD.nnn */ } - if (nhfp->fieldlevel) { - sfi_char(nhfp, &c, "bones", "bones_count", 1); /* length incl. '\0' */ - for (i = 0; i < (int) c; ++i) - sfi_char(nhfp, &oldbonesid[i], "bones", "bonesid", 1); - } if (strcmp(bonesid, oldbonesid) != 0 /* from 3.3.0 through 3.6.0, bones in the quest branch stored a bogus bonesid in the file; 3.6.1 fixed that, but for diff --git a/src/cmd.c b/src/cmd.c index c49a35959..ee8b15f1b 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1575245052 2019/12/02 00:04:12 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.350 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1576201761 2019/12/13 01:49:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.383 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -946,6 +946,8 @@ wiz_load_lua(VOID_ARGS) { if (wizard) { char buf[BUFSZ]; + + buf[0] = '\0'; getlin("Load which lua file?", buf); if (buf[0] == '\033' || buf[0] == '\0') return 0; @@ -965,6 +967,7 @@ wiz_load_splua(VOID_ARGS) char buf[BUFSZ]; int ridx; + buf[0] = '\0'; getlin("Load which des lua file?", buf); if (buf[0] == '\033' || buf[0] == '\0') return 0; diff --git a/src/decl.c b/src/decl.c index a0c3a9d4a..8ae9aa6c7 100644 --- a/src/decl.c +++ b/src/decl.c @@ -695,6 +695,9 @@ const struct instance_globals g_init = { DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */ + /* per-level glyph mapping flags */ + 0L, /* glyphmap_perlevel_flags */ + IVMAGIC /* used to validate that structure layout has been preserved */ }; diff --git a/src/do.c b/src/do.c index 6ca9f68cc..f4d2e57af 100644 --- a/src/do.c +++ b/src/do.c @@ -1279,15 +1279,22 @@ boolean at_stairs, falling, portal; * -1 11.46 12.50 12.5 * -2 5.21 4.17 0.0 * -3 2.08 0.0 0.0 + * + * 3.7.0: the chance for the "mysterious force" to kick in goes down + * as it kicks in, starting at 25% per climb attempt and dropping off + * gradually but substantially. The drop off is greater when hero is + * sent down farther so benefits lawfuls more than chaotics this time. */ if (Inhell && up && u.uhave.amulet && !newdungeon && !portal && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) { - if (!rn2(4)) { + if (!rn2(4 + g.context.mysteryforce)) { int odds = 3 + (int) u.ualign.type, /* 2..4 */ - diff = odds <= 1 ? 0 : rn2(odds); /* paranoia */ + diff = (odds <= 1) ? 0 : rn2(odds); /* paranoia */ if (diff != 0) { assign_rnd_level(newlevel, &u.uz, diff); + /* assign_rnd_level() may have used a value less than diff */ + diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ /* if inside the tower, stay inside */ if (was_in_W_tower && !On_W_tower_level(newlevel)) diff = 0; @@ -1295,15 +1302,20 @@ boolean at_stairs, falling, portal; if (diff == 0) assign_level(newlevel, &u.uz); - new_ledger = ledger_no(newlevel); - pline("A mysterious force momentarily surrounds you..."); + /* each time it kicks in, the chance of doing so again may drop; + that drops faster, on average, when being sent down farther so + while the impact is reduced for everybody compared to earlier + versions, it is reduced least for chaotics, most for lawfuls */ + g.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */ + if (on_level(newlevel, &u.uz)) { (void) safe_teleds(FALSE); (void) next_to_u(); return; - } else - at_stairs = g.at_ladder = FALSE; + } + new_ledger = ledger_no(newlevel); + at_stairs = g.at_ladder = FALSE; } } @@ -1578,6 +1590,7 @@ boolean at_stairs, falling, portal; /* Reset the screen. */ vision_reset(); /* reset the blockages */ + g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */ docrt(); /* does a full vision recalc */ flush_screen(-1); diff --git a/src/do_wear.c b/src/do_wear.c index a591a9bd5..584d9fb7c 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1575214670 2019/12/01 15:37:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1575768410 2019/12/08 01:26:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.126 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1464,11 +1464,11 @@ struct obj *obj; return 0; } - reset_remarm(); /* clear g.context.takeoff.mask and g.context.takeoff.what */ + reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */ (void) select_off(obj); if (!g.context.takeoff.mask) return 0; - /* none of armoroff()/Ring_/Amulet/Blindf_off() use g.context.takeoff.mask */ + /* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */ reset_remarm(); if (obj->owornmask & W_ARMOR) { @@ -1584,70 +1584,76 @@ struct obj *otmp; if (delay) { nomul(delay); g.multi_reason = "disrobing"; - if (is_helmet(otmp)) { - what = helm_simple_name(otmp); - g.afternmv = Helmet_off; - } else if (is_gloves(otmp)) { - what = gloves_simple_name(otmp); - g.afternmv = Gloves_off; - } else if (is_boots(otmp)) { - what = c_boots; - g.afternmv = Boots_off; - } else if (is_suit(otmp)) { + switch (objects[otmp->otyp].oc_armcat) { + case ARM_SUIT: what = suit_simple_name(otmp); g.afternmv = Armor_off; - } else if (is_cloak(otmp)) { + break; + case ARM_SHIELD: + what = shield_simple_name(otmp); + g.afternmv = Shield_off; + break; + case ARM_HELM: + what = helm_simple_name(otmp); + g.afternmv = Helmet_off; + break; + case ARM_GLOVES: + what = gloves_simple_name(otmp); + g.afternmv = Gloves_off; + break; + case ARM_BOOTS: + what = boots_simple_name(otmp); + g.afternmv = Boots_off; + break; + case ARM_CLOAK: what = cloak_simple_name(otmp); g.afternmv = Cloak_off; - } else if (is_shield(otmp)) { - what = c_shield; - g.afternmv = Shield_off; - } else if (is_shirt(otmp)) { - what = c_shirt; + break; + case ARM_SHIRT: + what = shirt_simple_name(otmp); g.afternmv = Shirt_off; - } else { + break; + default: impossible("Taking off unknown armor (%d: %d), delay %d", otmp->otyp, objects[otmp->otyp].oc_armcat, delay); + break; } if (what) { + /* sizeof offdelaybuf == 60; increase it if this becomes longer */ Sprintf(offdelaybuf, "You finish taking off your %s.", what); g.nomovemsg = offdelaybuf; } } else { - /* Be warned! We want off_msg after removing the item to - * avoid "You were wearing ____ (being worn)." However, an - * item which grants fire resistance might cause some trouble - * if removed in Hell and lifesaving puts it back on; in this - * case the message will be printed at the wrong time (after - * the messages saying you died and were lifesaved). Luckily, - * no cloak, shield, or fast-removable armor grants fire - * resistance, so we can safely do the off_msg afterwards. - * Rings do grant fire resistance, but for rings we want the - * off_msg before removal anyway so there's no problem. Take - * care in adding armors granting fire resistance; this code - * might need modification. - * 3.2 (actually 3.1 even): that comment is obsolete since - * fire resistance is not required for Gehennom so setworn() - * doesn't force the resistance granting item to be re-worn - * after being lifesaved anymore. - */ - if (is_cloak(otmp)) - (void) Cloak_off(); - else if (is_shield(otmp)) - (void) Shield_off(); - else if (is_helmet(otmp)) - (void) Helmet_off(); - else if (is_gloves(otmp)) - (void) Gloves_off(); - else if (is_boots(otmp)) - (void) Boots_off(); - else if (is_shirt(otmp)) - (void) Shirt_off(); - else if (is_suit(otmp)) + /* no delay so no '(*afternmv)()' or 'nomovemsg' */ + switch (objects[otmp->otyp].oc_armcat) { + case ARM_SUIT: (void) Armor_off(); - else + break; + case ARM_SHIELD: + (void) Shield_off(); + break; + case ARM_HELM: + (void) Helmet_off(); + break; + case ARM_GLOVES: + (void) Gloves_off(); + break; + case ARM_BOOTS: + (void) Boots_off(); + break; + case ARM_CLOAK: + (void) Cloak_off(); + break; + case ARM_SHIRT: + (void) Shirt_off(); + break; + default: impossible("Taking off unknown armor (%d: %d), no delay", otmp->otyp, objects[otmp->otyp].oc_armcat); + break; + } + /* We want off_msg() after removing the item to + avoid "You were wearing ____ (being worn)." */ off_msg(otmp); } g.context.takeoff.mask = g.context.takeoff.what = 0L; diff --git a/src/dungeon.c b/src/dungeon.c index 93486b6b4..58d52227a 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -7,8 +7,6 @@ #include "dgn_file.h" #include "dlb.h" #include "lev.h" -#include "sfproto.h" - #define DUNGEON_FILE "dungeon.lua" @@ -149,26 +147,14 @@ boolean perform_write, free_data; bwrite(nhfp->fd, (genericptr_t) &g.dungeon_topology, sizeof g.dungeon_topology); bwrite(nhfp->fd, (genericptr_t) g.tune, sizeof tune); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &g.n_dgns, "dungeon", "dungeon_count", 1); - for (i = 0; i < g.n_dgns; ++i) - sfo_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); - sfo_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < (int) sizeof tune; ++i) - sfo_char(nhfp, &g.tune[i], "dungeon", "tune", 1); - } for (count = 0, curr = g.branches; curr; curr = curr->next) count++; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "dungeon", "branch_count", 1); for (curr = g.branches; curr; curr = curr->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) curr, sizeof(branch)); - if (nhfp->fieldlevel) - sfo_branch(nhfp, curr, "dungeon", "branch", 1); } count = maxledgerno(); if (nhfp->structlevel) { @@ -177,20 +163,12 @@ boolean perform_write, free_data; (unsigned) count * sizeof(struct linfo)); bwrite(nhfp->fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &count, "dungeon", "level_info_count", 1); - for (i = 0; i < count; ++i) - sfo_linfo(nhfp, &g.level_info[i], "dungeon", "g.level_info", 1); - sfo_nhcoord(nhfp, &g.inv_pos, "dungeon", "g.inv_pos", 1); - } for (count = 0, curr_ms = g.mapseenchn; curr_ms; curr_ms = curr_ms->next) count++; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "dungeon", "mapseen_count", 1); for (curr_ms = g.mapseenchn; curr_ms; curr_ms = curr_ms->next) { save_mapseen(nhfp, curr_ms); @@ -230,27 +208,15 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &g.dungeon_topology, sizeof g.dungeon_topology); mread(nhfp->fd, (genericptr_t) g.tune, sizeof tune); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &g.n_dgns, "dungeon", "dungeon_count", 1); - for (i = 0; i < g.n_dgns; ++i) - sfi_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); - sfi_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < (int) sizeof tune; ++i) - sfi_char(nhfp, &g.tune[i], "dungeon", "tune", 1); - } last = g.branches = (branch *) 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "dungeon", "branch_count", 1); for (i = 0; i < count; i++) { curr = (branch *) alloc(sizeof(branch)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) curr, sizeof(branch)); - if (nhfp->fieldlevel) - sfi_branch(nhfp, curr, "dungeon", "branch", 1); curr->next = (branch *) 0; if (last) last->next = curr; @@ -261,8 +227,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "dungeon", "level_info_count", 1); if (count >= MAXLINFO) panic("level information count larger (%d) than allocated size", @@ -270,18 +234,11 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) g.level_info, (unsigned) count * sizeof(struct linfo)); - if (nhfp->fieldlevel) - for (i = 0; i < count; ++i) - sfi_linfo(nhfp, &g.level_info[i], "dungeon", "g.level_info", 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); } - if (nhfp->fieldlevel) { - sfi_nhcoord(nhfp, &g.inv_pos, "dungeon", "inv_pos", 1); - sfi_int(nhfp, &count, "dungeon", "mapseen_count", 1); - } last_ms = (mapseen *) 0; for (i = 0; i < count; i++) { @@ -2446,8 +2403,6 @@ mapseen *mptr; break; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &brindx, sizeof brindx); - if (nhfp->fieldlevel) - sfo_int(nhfp, &brindx, "mapseen", "branch_index", 1); if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &mptr->lev, sizeof mptr->lev); @@ -2455,29 +2410,15 @@ mapseen *mptr; bwrite(nhfp->fd, (genericptr_t) &mptr->flags, sizeof mptr->flags); bwrite(nhfp->fd, (genericptr_t) &mptr->custom_lth, sizeof mptr->custom_lth); } - if (nhfp->fieldlevel) { - sfo_d_level(nhfp, &mptr->lev, "mapseen", "d_level", 1); - sfo_mapseen_feat(nhfp, &mptr->feat, "mapseen", "feat", 1); - sfo_mapseen_flags(nhfp, &mptr->flags, "mapseen", "flags", 1); - sfo_unsigned(nhfp, &mptr->custom_lth, "mapseen", "custom_lth", 1); - } if (mptr->custom_lth) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) mptr->custom, mptr->custom_lth); } - if (nhfp->fieldlevel) { - for (i = 0; i < (int) mptr->custom_lth; ++i) - sfo_char(nhfp, &mptr->custom[i], "mapseen", "custom", 1); - } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &mptr->msrooms, sizeof mptr->msrooms); } - if (nhfp->fieldlevel) { - for (i = 0; i < ((MAXNROFROOMS + 1) * 2); ++i) - sfo_mapseen_rooms(nhfp, &mptr->msrooms[i], "mapseen", "msrooms", 1); - } savecemetery(nhfp, &mptr->final_resting_place); } @@ -2493,8 +2434,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &branchnum, sizeof branchnum); - if (nhfp->fieldlevel) - sfi_int(nhfp, &branchnum, "mapseen", "branch_index", 1); for (brindx = 0, curr = g.branches; curr; curr = curr->next, ++brindx) if (brindx == branchnum) break; @@ -2506,12 +2445,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &load->flags, sizeof load->flags); mread(nhfp->fd, (genericptr_t) &load->custom_lth, sizeof load->custom_lth); } - if (nhfp->fieldlevel) { - sfi_d_level(nhfp, &load->lev, "mapseen", "d_level", 1); - sfi_mapseen_feat(nhfp, &load->feat, "mapseen", "feat", 1); - sfi_mapseen_flags(nhfp, &load->flags, "mapseen", "flags", 1); - sfi_unsigned(nhfp, &load->custom_lth, "mapseen", "custom_lth", 1); - } if (load->custom_lth) { /* length doesn't include terminator (which isn't saved & restored) */ @@ -2519,20 +2452,12 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) load->custom, load->custom_lth); } - if (nhfp->fieldlevel) { - for (i = 0; i < (int) load->custom_lth; ++i) - sfi_char(nhfp, &load->custom[i], "mapseen", "custom", 1); - } load->custom[load->custom_lth] = '\0'; } else load->custom = 0; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &load->msrooms, sizeof load->msrooms); } - if (nhfp->fieldlevel) { - for (i = 0; i < ((MAXNROFROOMS + 1) * 2); ++i) - sfi_mapseen_rooms(nhfp, &load->msrooms[i], "mapseen", "msrooms", 1); - } restcemetery(nhfp, &load->final_resting_place); return load; } diff --git a/src/end.c b/src/end.c index 381063da4..bc8cc7ead 100644 --- a/src/end.c +++ b/src/end.c @@ -15,7 +15,6 @@ #include #endif #include "dlb.h" -#include "sfproto.h" /* add b to long a, convert wraparound to max value */ @@ -2153,8 +2152,6 @@ NHFILE *nhfp; for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo)); - if (nhfp->fieldlevel) - sfo_kinfo(nhfp, kptr, "killers", "kinfo", 1); } } if (release_data(nhfp)) { @@ -2175,8 +2172,6 @@ NHFILE *nhfp; for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo)); - if (nhfp->fieldlevel) - sfi_kinfo(nhfp, kptr, "killers", "kinfo", 1); if (kptr->next) { kptr->next = (struct kinfo *) alloc(sizeof (struct kinfo)); } diff --git a/src/engrave.c b/src/engrave.c index ca8a1bc1b..35dcb5896 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -5,8 +5,6 @@ #include "hack.h" #include "lev.h" -#include "sfproto.h" - static NEARDATA struct engr *head_engr; static const char *NDECL(blengr); @@ -1194,11 +1192,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)&(ep->engr_lth), sizeof(ep->engr_lth)); bwrite(nhfp->fd, (genericptr_t)ep, sizeof(struct engr) + ep->engr_lth); } - if (nhfp->fieldlevel) { - sfo_unsigned(nhfp, &(ep->engr_lth), "engravings", "engr_lth", 1); - sfo_engr(nhfp, ep, "engravings", "engr", 1); - sfo_str(nhfp, ep->engr_txt, "engravings", "engr_txt", ep->engr_lth); - } } if (release_data(nhfp)) dealloc_engr(ep); @@ -1206,8 +1199,6 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)&no_more_engr, sizeof no_more_engr); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &no_more_engr, "engravings", "engr_lth", 1); } if (release_data(nhfp)) head_engr = 0; @@ -1224,8 +1215,6 @@ NHFILE *nhfp; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) <h, sizeof(unsigned)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, <h, "engravings", "engr_lth", 1); if (lth == 0) return; @@ -1233,11 +1222,6 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) ep, sizeof(struct engr) + lth); } - if (nhfp->fieldlevel) { - sfi_engr(nhfp, ep, "engravings", "engr", 1); - ep->engr_txt = (char *) (ep + 1); - sfi_str(nhfp, ep->engr_txt, "engravings", "engr_txt", lth); - } ep->nxt_engr = head_engr; head_engr = ep; ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */ diff --git a/src/files.c b/src/files.c index eb8f09756..d7d1b4e7c 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 files.c $NHDT-Date: 1574116097 2019/11/18 22:28:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.272 $ */ +/* NetHack 3.6 files.c $NHDT-Date: 1576096997 2019/12/11 20:43:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.301 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -8,8 +8,6 @@ #include "hack.h" #include "dlb.h" #include -#include "sfproto.h" -#include "sfprocs.h" #include "lev.h" #ifdef TTY_GRAPHICS @@ -451,18 +449,6 @@ NHFILE *nhfp; if (nhfp) { if (nhfp->structlevel && nhfp->fd != -1) (void) nhclose(nhfp->fd), nhfp->fd = -1; - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - (void) fclose(nhfp->fpdef); - nhfp->fpdef = (FILE *) 0; - } - } - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "# closing\n"); - if (nhfp->fplog) - (void) fclose(nhfp->fplog); - if (nhfp->fpdebug) - (void) fclose(nhfp->fpdebug); zero_nhfile(nhfp); free_nhfile(nhfp); } @@ -479,13 +465,6 @@ NHFILE *nhfp; (void) lseek(nhfp->fd, (off_t) 0, 0); #endif } - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - rewind(nhfp->fpdef); - nhfp->count = 0L; - nhfp->eof = FALSE; - } - } } static @@ -497,25 +476,10 @@ NHFILE *nhfp; the pointer to the nethack file descriptor */ if (nhfp) { /* check for no open file at all, - * not a structlevel legacy file, - * nor a fieldlevel file. + * not a structlevel legacy file */ - if (((nhfp->fd == -1) && !nhfp->fpdef) - || (nhfp->structlevel && nhfp->fd < 0) - || (nhfp->fieldlevel && !nhfp->fpdef)) { + if (nhfp->structlevel && nhfp->fd < 0) { /* not viable, start the cleanup */ - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - (void) fclose(nhfp->fpdef); - nhfp->fpdef = (FILE *) 0; - } - if (nhfp->fplog) { - (void) fprintf(nhfp->fplog, "# closing, not viable\n"); - (void) fclose(nhfp->fplog); - } - if (nhfp->fpdebug) - (void) fclose(nhfp->fpdebug); - } zero_nhfile(nhfp); free_nhfile(nhfp); nhfp = (NHFILE *) 0; @@ -795,8 +759,6 @@ d_level *lev; Sprintf(eos(dptr), ".%d", lev->dlevel); #ifdef SYSCF idx = sysopt.bonesformat[0]; - if (idx > historical && idx <= ascii) - Strcat(dptr, sfoprocs[idx].ext); #endif #ifdef VMS Strcat(dptr, ";1"); @@ -847,26 +809,6 @@ char errbuf[]; nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_BONESFILE; nhfp->mode = WRITING; -#ifdef SYSCF - if (sysopt.bonesformat[0] > historical && - sysopt.bonesformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.bonesformat[0] != ascii); - nhfp->fnidx = sysopt.bonesformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(file, nhfp->style.binary ? WRBMODE : WRTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("create_bonesfile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } -#endif /* SYSCF */ if (nhfp->structlevel) { #if defined(MICRO) || defined(WIN32) /* Use O_TRUNC to force the file to be shortened if it already @@ -962,26 +904,6 @@ char **bonesid; nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_BONESFILE; nhfp->mode = READING; -#ifdef SYSCF - if (sysopt.bonesformat[0] > historical && - sysopt.bonesformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.bonesformat[0] != ascii); - nhfp->fnidx = sysopt.bonesformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(fq_bones, nhfp->style.binary ? RDBMODE : RDTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("open_bonesfile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } -#endif /* SYSCF */ if (nhfp->structlevel) { #ifdef MAC nhfp->fd = macopen(fq_bones, O_RDONLY | O_BINARY, BONE_TYPE); @@ -1022,16 +944,11 @@ void set_savefile_name(regularize_it) boolean regularize_it; { - int idx = 0, regoffset = 0, overflow = 0, + int idx = historical, regoffset = 0, overflow = 0, indicator_spot = 0; /* 0=no indicator, 1=before ext, 2=after ext */ const char *postappend = (const char *) 0, *sfindicator = (const char *) 0; -#ifdef SYSCF - idx = sysopt.saveformat[0]; - if (idx > historical && idx <= ascii) - sfindicator = sfoprocs[idx].ext; -#endif if (g.program_state.in_self_recover) { /* self_recover needs to be done as historical structlevel content until that process is @@ -1041,7 +958,6 @@ boolean regularize_it; place it into the save file. */ idx = historical; - sfindicator = sfoprocs[idx].ext; } #ifdef VMS Sprintf(g.SAVEF, "[.save]%d%s", getuid(), g.plname); @@ -1112,15 +1028,7 @@ boolean regularize_it; if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) { Strcat(g.SAVEF, SAVE_EXTENSION); #ifdef MSDOS -#ifdef SYSCF - if (idx >= historical && idx <= ascii) { - /* we did leave room for the extra char in SAVE_EXTENSION */ - g.SAVEF[strlen(g.SAVEF)-1] = - (idx == lendian) ? 'l' : - (idx == ascii) ? 'a' : '\0'; - } - sfindicator = (g.program_state.in_self_recover) ? "" : sfoprocs[idx].ext; -#endif + sfindicator = ""; #endif } else overflow = 3; @@ -1140,8 +1048,8 @@ boolean regularize_it; } #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (overflow) - impossible("set_savefile_name() couldn't complete without overlow %d", - overflow); + impossible("set_savefile_name() couldn't complete without overflow %d", + overflow); #endif } @@ -1152,8 +1060,6 @@ NHFILE *nhfp; { if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) g.SAVEF, sizeof(g.SAVEF)); - if (nhfp->fieldlevel) - sfo_str(nhfp, g.SAVEF, "savefile_name", "g.savef", sizeof(g.SAVEF)); } #endif @@ -1212,23 +1118,6 @@ create_savefile() nhfp->fd = -1; nhfp->fpdef = (FILE *) 0; } - if (!do_historical) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.saveformat[0] != ascii); - nhfp->fnidx = sysopt.saveformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(fq_save, nhfp->style.binary ? WRBMODE : WRTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("create_savefile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } if (nhfp->structlevel) { #if defined(MICRO) || defined(WIN32) nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK); @@ -1274,11 +1163,6 @@ open_savefile() nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_SAVEFILE; nhfp->mode = READING; -#ifdef SYSCF - if (sysopt.saveformat[0] > historical && - sysopt.saveformat[0] <= ascii) - do_historical = FALSE; -#endif /* SYSCF */ if (g.program_state.in_self_recover) { do_historical = TRUE; /* force it */ nhfp->structlevel = TRUE; @@ -1290,23 +1174,6 @@ open_savefile() nhfp->fd = -1; nhfp->fpdef = (FILE *) 0; } - if (!do_historical) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.saveformat[0] < ascii); - nhfp->fnidx = sysopt.saveformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(fq_save, nhfp->style.binary ? RDBMODE : RDTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("open_savefile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } if (nhfp->structlevel) { #ifdef MAC nhfp->fd = macopen(fq_save, O_RDONLY | O_BINARY, SAVE_TYPE); @@ -1345,10 +1212,6 @@ restore_saved_game() nh_uncompress(fq_save); if ((nhfp = open_savefile()) != 0) { - if (nhfp && nhfp->fieldlevel && nhfp->fplog) - (void) fprintf(nhfp->fplog, "# just opened\n"); - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "NetHack", "start", "savefile", 0); if (validate(nhfp, fq_save) != 0) { close_nhfile(nhfp); nhfp = (NHFILE *)0; @@ -4051,15 +3914,6 @@ recover_savefile() */ /* - * Things are different now. We could be in a situation - * where the default save file format is not structlevel. - * self-recover is currently written to use copy_bytes() - * to move content from the level files into the savefile. - * Until the code is updated to use something other than - * copy_bytes, what we need to do is force the recovery - * save to be structlevel, finish creating it, then read - * it back in. The save after that can be fieldlevel again. - * * Set a flag for the savefile routines to know the * circumstances and act accordingly: * g.program_state.in_self_recover @@ -4088,29 +3942,11 @@ recover_savefile() */ /*store_formatindicator(snhfp); */ store_version(snhfp); -#if 0 - if (snhfp->structlevel) { - if (write(snhfp->fd, (genericptr_t) &version_data, sizeof version_data) - != sizeof version_data) - savewrite_failure = "version_info"; - } - if (snhfp->fieldlevel) { - sfo_version_info(snhfp, (struct version_info *) &version_data, - "version", "version_info", 1); - savewrite_failure = (const char *) 0; - } - if (savewrite_failure) - goto cleanup; -#endif if (snhfp->structlevel) { if (write(snhfp->fd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) savewrite_failure = "savefileinfo"; } - if (snhfp->fieldlevel) { - sfo_savefile_info(snhfp, &sfsaveinfo, "savefileinfo", "savefile_info", 1); - savewrite_failure = (const char *) 0; - } if (savewrite_failure) goto cleanup; @@ -4119,10 +3955,6 @@ recover_savefile() != sizeof pltmpsiz) savewrite_failure = "player name size"; } - if (snhfp->fieldlevel) { - sfo_int(snhfp, &pltmpsiz, "plname", "plname_size", 1); - savewrite_failure = (const char *) 0; - } if (savewrite_failure) goto cleanup; @@ -4130,18 +3962,9 @@ recover_savefile() if (write(snhfp->fd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz) savewrite_failure = "player name"; } - if (snhfp->fieldlevel) { - sfo_str(snhfp, tmpplbuf, "plname", "tmpplbuf", pltmpsiz); - savewrite_failure = (const char *) 0; - } if (savewrite_failure) goto cleanup; - /* - * copy_bytes isn't good enough anymore. - * We could be reading from a structlevel file but - * writing into a fieldlevel save file. Yikes! - */ if (!copy_bytes(lnhfp->fd, snhfp->fd)) { close_nhfile(gnhfp); close_nhfile(snhfp); diff --git a/src/light.c b/src/light.c index 4a7551c05..f1341a78d 100644 --- a/src/light.c +++ b/src/light.c @@ -4,8 +4,6 @@ #include "hack.h" #include "lev.h" /* for checking save modes */ -#include "sfproto.h" - /* * Mobile light sources. @@ -326,9 +324,6 @@ int range; if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &count, sizeof count); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &count, "lightsources", "lightsource_count", 1); - } actual = maybe_write_ls(nhfp, range, TRUE); if (actual != count) panic("counted %d light sources, wrote %d! [range=%d]", count, @@ -379,15 +374,11 @@ NHFILE *nhfp; /* restore elements */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "lightsources", "lightsource_count", 1); while (count-- > 0) { ls = (light_source *) alloc(sizeof(light_source)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfi_ls_t(nhfp, ls, "lightsources", "lightsource", 1); ls->next = g.light_base; g.light_base = ls; } @@ -529,8 +520,6 @@ light_source *ls; if (ls->flags & LSF_NEEDS_FIXUP) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfo_ls_t(nhfp, ls, "lightsources", "lightsource", 1); } else { /* replace object pointer with id for write, then put back */ arg_save = ls->id; @@ -552,8 +541,6 @@ light_source *ls; ls->flags |= LSF_NEEDS_FIXUP; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfo_ls_t(nhfp, ls, "lightsources", "lightsource", 1); ls->id = arg_save; ls->flags &= ~LSF_NEEDS_FIXUP; } diff --git a/src/mapglyph.c b/src/mapglyph.c index 082186df6..74492cc74 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mapglyph.c $NHDT-Date: 1573943501 2019/11/16 22:31:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.51 $ */ +/* NetHack 3.6 mapglyph.c $NHDT-Date: 1575830186 2019/12/08 18:36:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,9 +9,11 @@ #include "color.h" #define HI_DOMESTIC CLR_WHITE /* monst.c */ +#if 0 #if !defined(TTY_GRAPHICS) #define has_color(n) TRUE #endif +#endif #ifdef TEXTCOLOR static const int explcolors[] = { @@ -57,6 +59,10 @@ static const int explcolors[] = { #define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \ && g.level.objects[(x)][(y)]->nexthere) +#define GMAP_SET 0x00000001 +#define GMAP_ROGUELEVEL 0x00000002 +#define GMAP_ALTARCOLOR 0x00000004 + /*ARGSUSED*/ int mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags) @@ -75,6 +81,21 @@ unsigned mgflags; has_rogue_color = (has_rogue_ibm_graphics && g.symset[g.currentgraphics].nocolor == 0); + if (!g.glyphmap_perlevel_flags) { + /* + * GMAP_SET 0x00000001 + * GMAP_ROGUELEVEL 0x00000002 + * GMAP_ALTARCOLOR 0x00000004 + */ + g.glyphmap_perlevel_flags |= GMAP_SET; + + if (Is_rogue_level(&u.uz)) { + g.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL; + } else if ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) { + g.glyphmap_perlevel_flags |= GMAP_ALTARCOLOR; + } + } + /* * Map the glyph back to a character and color. * @@ -138,8 +159,54 @@ unsigned mgflags; if they use the same symbol and color is disabled */ } else if (!iflags.use_color && offset == S_lava && (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P] - || g.showsyms[idx] == g.showsyms[S_water + SYM_OFF_P])) { + || g.showsyms[idx] + == g.showsyms[S_water + SYM_OFF_P])) { special |= MG_BW_LAVA; + } else if (offset == S_altar && iflags.use_color) { + int amsk = altarmask_at(x, y); /* might be a mimic */ + + if ((g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR) + && (amsk & AM_SHRINE) != 0) { + /* high altar */ + color = CLR_BRIGHT_MAGENTA; + } else { + switch (amsk & AM_MASK) { +#if 0 /* + * On OSX with TERM=xterm-color256 these render as + * white -> tty: gray, curses: ok + * gray -> both tty and curses: black + * black -> both tty and curses: blue + * red -> both tty and curses: ok. + * Since the colors have specific associations (with the + * unicorns matched with each alignment), we shouldn't use + * scrambled colors and we don't have sufficient information + * to handle platform-specific color variations. + */ + case AM_LAWFUL: /* 4 */ + color = CLR_WHITE; + break; + case AM_NEUTRAL: /* 2 */ + color = CLR_GRAY; + break; + case AM_CHAOTIC: /* 1 */ + color = CLR_BLACK; + break; +#else /* !0: TEMP? */ + case AM_LAWFUL: /* 4 */ + case AM_NEUTRAL: /* 2 */ + case AM_CHAOTIC: /* 1 */ + cmap_color(S_altar); /* gray */ + break; +#endif /* 0 */ + case AM_NONE: /* 0 */ + color = CLR_RED; + break; + default: /* 3, 5..7 -- shouldn't happen but 3 was possible + * prior to 3.6.3 (due to faulty sink polymorph) */ + color = NO_COLOR; + break; + } + } } else { cmap_color(offset); } @@ -229,14 +296,16 @@ unsigned mgflags; if ((special & MG_PET) != 0) { ovidx = SYM_PET_OVERRIDE + SYM_OFF_X; - if (Is_rogue_level(&u.uz) ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) idx = ovidx; } if (is_you) { ovidx = SYM_HERO_OVERRIDE + SYM_OFF_X; - if (Is_rogue_level(&u.uz) ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) idx = ovidx; } } @@ -244,7 +313,8 @@ unsigned mgflags; ch = g.showsyms[idx]; #ifdef TEXTCOLOR /* Turn off color if no color defined, or rogue level w/o PC graphics. */ - if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color)) + if (!has_color(color) || + ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color)) #endif color = NO_COLOR; *ochar = (int) ch; diff --git a/src/mkmaze.c b/src/mkmaze.c index e32bb245f..275836466 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -6,8 +6,6 @@ #include "hack.h" #include "sp_lev.h" #include "lev.h" /* save & restore info */ -#include "sfproto.h" - static int FDECL(iswall, (int, int)); static int FDECL(iswall_or_stone, (int, int)); @@ -1579,18 +1577,9 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.xmax, sizeof(int)); bwrite(nhfp->fd, (genericptr_t) &g.ymax, sizeof(int)); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &n, "waterlevel", "bubble_count", 1); - sfo_int(nhfp, &g.xmin, "waterlevel", "g.xmin", 1); - sfo_int(nhfp, &g.ymin, "waterlevel", "g.ymin", 1); - sfo_int(nhfp, &g.xmax, "waterlevel", "g.xmax", 1); - sfo_int(nhfp, &g.ymax, "waterlevel", "g.ymax", 1); - } for (b = g.bbubbles; b; b = b->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) b, sizeof(struct bubble)); - if (nhfp->fieldlevel) - sfo_bubble(nhfp, b, "waterlevel", "bubble", 1); } } if (release_data(nhfp)) @@ -1623,20 +1612,11 @@ NHFILE *nhfp; mread(nhfp->fd,(genericptr_t)&g.xmax,sizeof(int)); mread(nhfp->fd,(genericptr_t)&g.ymax,sizeof(int)); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &n, "waterlevel", "bubble_count", 1); - sfi_int(nhfp, &g.xmin, "waterlevel", "g.xmin", 1); - sfi_int(nhfp, &g.ymin, "waterlevel", "g.ymin", 1); - sfi_int(nhfp, &g.xmax, "waterlevel", "g.xmax", 1); - sfi_int(nhfp, &g.ymax, "waterlevel", "g.ymax", 1); - } for (i = 0; i < n; i++) { btmp = b; b = (struct bubble *) alloc(sizeof(struct bubble)); if (nhfp->structlevel) mread(nhfp->fd,(genericptr_t) b, sizeof(struct bubble)); - if (nhfp->fieldlevel) - sfi_bubble(nhfp, b, "waterlevel", "bubble", 1); if (g.bbubbles) { btmp->next = b; b->prev = btmp; diff --git a/src/mkroom.c b/src/mkroom.c index de87a14e2..0a3319289 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -16,8 +16,6 @@ */ #include "hack.h" -#include "sfproto.h" - static boolean FDECL(isbig, (struct mkroom *)); static struct mkroom *FDECL(pick_room, (BOOLEAN_P)); @@ -811,8 +809,6 @@ struct mkroom *r; */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) r, sizeof (struct mkroom)); - if (nhfp->fieldlevel) - sfo_mkroom(nhfp, r, "room", "mkroom", 1); for (i = 0; i < r->nsubrooms; i++) { save_room(nhfp, r->sbrooms[i]); } @@ -830,8 +826,6 @@ NHFILE *nhfp; /* First, write the number of rooms */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.nroom, "room", "g.nroom", 1); for (i = 0; i < g.nroom; i++) save_room(nhfp, &g.rooms[i]); } @@ -845,8 +839,6 @@ struct mkroom *r; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) r, sizeof(struct mkroom)); - if (nhfp->fieldlevel) - sfi_mkroom(nhfp, r, "room", "mkroom", 1); for (i = 0; i < r->nsubrooms; i++) { r->sbrooms[i] = &g.subrooms[g.nsubroom]; @@ -867,8 +859,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.nroom, "room", "g.nroom", 1); g.nsubroom = 0; for (i = 0; i < g.nroom; i++) { diff --git a/src/nhlobj.c b/src/nhlobj.c new file mode 100644 index 000000000..736c3587e --- /dev/null +++ b/src/nhlobj.c @@ -0,0 +1,440 @@ +/* NetHack 3.7 nhlobj.c $NHDT-Date: 1576097301 2019/12/11 20:48:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ +/* Copyright (c) 2019 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "hack.h" +#include "sp_lev.h" + +struct _lua_obj { + int state; /* UNUSED */ + struct obj *obj; +}; + +struct _lua_obj * +l_obj_check(L, index) +lua_State *L; +int index; +{ + struct _lua_obj *lo; + + luaL_checktype(L, index, LUA_TUSERDATA); + lo = (struct _lua_obj *)luaL_checkudata(L, index, "obj"); + if (!lo) + nhl_error(L, "Obj error"); + return lo; +} + +static int +l_obj_gc(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj) { + /* free-floating objects are deallocated */ + if (lo->obj->where == OBJ_FREE) { + if (Has_contents(lo->obj)) { + struct obj *otmp; + while ((otmp = lo->obj->cobj) != 0) { + obj_extract_self(otmp); + dealloc_obj(otmp); + } + } + dealloc_obj(lo->obj); + } + lo->obj = NULL; + } + + return 0; +} + +static struct _lua_obj * +l_obj_push(L, otmp) +lua_State *L; +struct obj *otmp; +{ + struct _lua_obj *lo = (struct _lua_obj *)lua_newuserdata(L, sizeof(struct _lua_obj)); + luaL_getmetatable(L, "obj"); + lua_setmetatable(L, -2); + + lo->state = 0; + lo->obj = otmp; + + return lo; +} + +/* local o = obj.new("large chest"); + local cobj = o:contents(); */ +static int +l_obj_getcontents(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + struct obj *obj = lo->obj; + + if (!obj) + nhl_error(L, "l_obj_getcontents: no obj"); + if (!obj->cobj) + nhl_error(L, "l_obj_getcontents: no cobj"); + + (void) l_obj_push(L, obj->cobj); + return 1; +} + +/* local box = obj.new("large chest"); + box.addcontent(obj.new("rock")); +*/ +static int +l_obj_add_to_container(L) +lua_State *L; +{ + struct _lua_obj *lobox = l_obj_check(L, 1); + struct _lua_obj *lo = l_obj_check(L, 2); + struct obj *otmp; + + if (!lo->obj || !lobox->obj) + nhl_error(L, "l_obj_add_to_container: no obj"); + + if (!Is_container(lobox->obj)) + nhl_error(L, "l_obj_add_to_container: not a container"); + + otmp = add_to_container(lobox->obj, lo->obj); + + /* was lo->obj merged? FIXME: causes problems if both lo->obj and + the one it merged with are handled by lua. Use lo->state? */ + if (otmp != lo->obj) + lo->obj = otmp; + + return 0; +} + +/* Get a table of object class data. */ +/* local odata = obj.class(otbl.otyp); */ +/* local odata = obj.class(obj.new("rock")); */ +static int +l_obj_objects_to_table(L) +lua_State *L; +{ + int argc = lua_gettop(L); + int otyp = -1; + struct objclass *o; + + if (argc != 1) { + nhl_error(L, "l_obj_objects_to_table: Wrong args"); + return 0; + } + + if (lua_type(L, 1) == LUA_TNUMBER) { + otyp = luaL_checkinteger(L, 1); + } else if (lua_type(L, 1) == LUA_TUSERDATA) { + struct _lua_obj *lo = l_obj_check(L, 1); + if (lo && lo->obj) + otyp = lo->obj->otyp; + } + lua_pop(L, 1); + + if (otyp == -1) { + nhl_error(L, "l_obj_objects_to_table: Wrong args"); + return 0; + } + + o = &objects[otyp]; + + lua_newtable(L); + + if (OBJ_NAME(objects[otyp])) + nhl_add_table_entry_str(L, "name", OBJ_NAME(objects[otyp])); + if (OBJ_DESCR(objects[otyp])) + nhl_add_table_entry_str(L, "descr", + OBJ_DESCR(objects[otyp])); + if (o->oc_uname) + nhl_add_table_entry_str(L, "uname", o->oc_uname); + + nhl_add_table_entry_int(L, "name_known", o->oc_name_known); + nhl_add_table_entry_int(L, "merge", o->oc_merge); + nhl_add_table_entry_int(L, "uses_known", o->oc_uses_known); + nhl_add_table_entry_int(L, "pre_discovered", o->oc_pre_discovered); + nhl_add_table_entry_int(L, "magic", o->oc_magic); + nhl_add_table_entry_int(L, "charged", o->oc_charged); + nhl_add_table_entry_int(L, "unique", o->oc_unique); + nhl_add_table_entry_int(L, "nowish", o->oc_nowish); + nhl_add_table_entry_int(L, "big", o->oc_big); + /* TODO: oc_bimanual, oc_bulky */ + nhl_add_table_entry_int(L, "tough", o->oc_tough); + nhl_add_table_entry_int(L, "dir", o->oc_dir); /* TODO: convert to text */ + nhl_add_table_entry_int(L, "material", o->oc_material); /* TODO: convert to text */ + /* TODO: oc_subtyp, oc_skill, oc_armcat */ + nhl_add_table_entry_int(L, "oprop", o->oc_oprop); + nhl_add_table_entry_char(L, "class", + def_oc_syms[(uchar) o->oc_class].sym); + nhl_add_table_entry_int(L, "delay", o->oc_delay); + nhl_add_table_entry_int(L, "color", o->oc_color); /* TODO: text? */ + nhl_add_table_entry_int(L, "prob", o->oc_prob); + nhl_add_table_entry_int(L, "weight", o->oc_weight); + nhl_add_table_entry_int(L, "cost", o->oc_cost); + nhl_add_table_entry_int(L, "damage_small", o->oc_wsdam); + nhl_add_table_entry_int(L, "damage_large", o->oc_wldam); + /* TODO: oc_oc1, oc_oc2, oc_hitbon, a_ac, a_can, oc_level */ + nhl_add_table_entry_int(L, "nutrition", o->oc_nutrition); + + return 1; +} + +/* Create a lua table representation of the object, unpacking all the + object fields. + local o = obj.new("rock"); + local otbl = o:totable(); */ +static int +l_obj_to_table(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + struct obj *obj = lo->obj; + + lua_newtable(L); + + if (!obj) { + nhl_add_table_entry_int(L, "NO_OBJ", 1); + return 1; + } + + nhl_add_table_entry_int(L, "has_contents", Has_contents(obj)); + nhl_add_table_entry_int(L, "is_container", Is_container(obj)); + nhl_add_table_entry_int(L, "o_id", obj->o_id); + nhl_add_table_entry_int(L, "ox", obj->ox); + nhl_add_table_entry_int(L, "oy", obj->oy); + nhl_add_table_entry_int(L, "otyp", obj->otyp); + if (OBJ_NAME(objects[obj->otyp])) + nhl_add_table_entry_str(L, "otyp_name", OBJ_NAME(objects[obj->otyp])); + if (OBJ_DESCR(objects[obj->otyp])) + nhl_add_table_entry_str(L, "otyp_descr", + OBJ_DESCR(objects[obj->otyp])); + nhl_add_table_entry_int(L, "owt", obj->owt); + nhl_add_table_entry_int(L, "quan", obj->quan); + nhl_add_table_entry_int(L, "spe", obj->spe); + + if (obj->otyp == STATUE) { + nhl_add_table_entry_int(L, "historic", (obj->spe & STATUE_HISTORIC)); + nhl_add_table_entry_int(L, "statue_male", (obj->spe & STATUE_MALE)); + nhl_add_table_entry_int(L, "statue_female", (obj->spe & STATUE_FEMALE)); + } + + nhl_add_table_entry_char(L, "oclass", + def_oc_syms[(uchar) obj->oclass].sym); + nhl_add_table_entry_char(L, "invlet", obj->invlet); + /* TODO: nhl_add_table_entry_char(L, "oartifact", obj->oartifact);*/ + nhl_add_table_entry_int(L, "where", obj->where); + /* TODO: nhl_add_table_entry_int(L, "timed", obj->timed); */ + nhl_add_table_entry_int(L, "cursed", obj->cursed); + nhl_add_table_entry_int(L, "blessed", obj->blessed); + nhl_add_table_entry_int(L, "unpaid", obj->unpaid); + nhl_add_table_entry_int(L, "no_charge", obj->no_charge); + nhl_add_table_entry_int(L, "known", obj->known); + nhl_add_table_entry_int(L, "dknown", obj->dknown); + nhl_add_table_entry_int(L, "bknown", obj->bknown); + nhl_add_table_entry_int(L, "rknown", obj->rknown); + if (obj->oclass == POTION_CLASS) + nhl_add_table_entry_int(L, "odiluted", obj->odiluted); + else + nhl_add_table_entry_int(L, "oeroded", obj->oeroded); + nhl_add_table_entry_int(L, "oeroded2", obj->oeroded2); + /* TODO: orotten, norevive */ + nhl_add_table_entry_int(L, "oerodeproof", obj->oerodeproof); + nhl_add_table_entry_int(L, "olocked", obj->olocked); + nhl_add_table_entry_int(L, "obroken", obj->obroken); + if (is_poisonable(obj)) + nhl_add_table_entry_int(L, "opoisoned", obj->opoisoned); + else + nhl_add_table_entry_int(L, "otrapped", obj->otrapped); + /* TODO: degraded_horn */ + nhl_add_table_entry_int(L, "recharged", obj->recharged); + /* TODO: on_ice */ + nhl_add_table_entry_int(L, "lamplit", obj->lamplit); + nhl_add_table_entry_int(L, "globby", obj->globby); + nhl_add_table_entry_int(L, "greased", obj->greased); + nhl_add_table_entry_int(L, "nomerge", obj->nomerge); + nhl_add_table_entry_int(L, "was_thrown", obj->was_thrown); + nhl_add_table_entry_int(L, "in_use", obj->in_use); + nhl_add_table_entry_int(L, "bypass", obj->bypass); + nhl_add_table_entry_int(L, "cknown", obj->cknown); + nhl_add_table_entry_int(L, "lknown", obj->lknown); + nhl_add_table_entry_int(L, "corpsenm", obj->corpsenm); + if (obj->corpsenm != NON_PM + && (obj->otyp == TIN || obj->otyp == CORPSE || obj->otyp == EGG + || obj->otyp == FIGURINE || obj->otyp == STATUE)) + nhl_add_table_entry_str(L, "corpsenm_name", mons[obj->corpsenm].mname); + /* TODO: leashmon, fromsink, novelidx, record_achieve_special */ + nhl_add_table_entry_int(L, "usecount", obj->usecount); + /* TODO: spestudied */ + nhl_add_table_entry_int(L, "oeaten", obj->oeaten); + nhl_add_table_entry_int(L, "age", obj->age); + nhl_add_table_entry_int(L, "owornmask", obj->owornmask); + /* TODO: more of oextra */ + nhl_add_table_entry_int(L, "has_oname", has_oname(obj)); + if (has_oname(obj)) + nhl_add_table_entry_str(L, "oname", ONAME(obj)); + + return 1; +} + +/* create a new object via wishing routine */ +/* local o = obj.new("rock"); */ +static int +l_obj_new_readobjnam(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) { + char buf[BUFSZ]; + struct obj *otmp; + Sprintf(buf, "%s", luaL_checkstring(L, 1)); + lua_pop(L, 1); + otmp = readobjnam(buf, NULL); + (void) l_obj_push(L, otmp); + return 1; + } else + nhl_error(L, "l_obj_new_readobjname: Wrong args"); + return 0; +} + +/* Get the topmost object on the map at x,y */ +/* local o = obj.at(x, y); */ +static int +l_obj_at(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 2) { + int x, y; + x = luaL_checkinteger(L, 1); + y = luaL_checkinteger(L, 2); + lua_pop(L, 2); + (void) l_obj_push(L, g.level.objects[x][y]); + return 1; + } else + nhl_error(L, "l_obj_at: Wrong args"); + return 0; +} + +/* Place an object on the map at (x,y). + local o = obj.new("rock"); + o:placeobj(u.ux, u.uy); */ +static int +l_obj_placeobj(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct _lua_obj *lo = l_obj_check(L, 1); + + if (argc != 3) + nhl_error(L, "l_obj_placeobj: Wrong args"); + + if (lo && lo->obj) { + int x, y; + x = luaL_checkinteger(L, 2); + y = luaL_checkinteger(L, 3); + lua_pop(L, 3); + + place_object(lo->obj, x, y); + } else + nhl_error(L, "l_obj_placeobj: Wrong args"); + + return 0; +} + +/* Get the next object in the object chain */ +/* local o = obj.at(x, y); + local o2 = o:next(); +*/ +static int +l_obj_nextobj(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj) + (void) l_obj_push(L, lo->obj->where == OBJ_FLOOR ? lo->obj->nexthere : lo->obj->nobj); + return 1; +} + +/* Get the container object is in */ +/* local box = o:container(); */ +static int +l_obj_container(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj && lo->obj->where == OBJ_CONTAINED) { + (void) l_obj_push(L, lo->obj->ocontainer); + return 1; + } + (void) l_obj_push(L, NULL); + return 1; +} + +/* Is the object a null? */ +/* local badobj = o:isnull(); */ +static int +l_obj_isnull(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + lua_pushboolean(L, lo && lo->obj); + return 1; +} + + +static const struct luaL_Reg l_obj_methods[] = { + { "new", l_obj_new_readobjnam }, + { "isnull", l_obj_isnull }, + { "at", l_obj_at }, + { "next", l_obj_nextobj }, + { "totable", l_obj_to_table }, + { "class", l_obj_objects_to_table }, + { "placeobj", l_obj_placeobj }, + { "container", l_obj_container }, + { "contents", l_obj_getcontents }, + { "addcontent", l_obj_add_to_container }, + { NULL, NULL } +}; + +static const luaL_Reg l_obj_meta[] = { + { "__gc", l_obj_gc }, + { NULL, NULL } +}; + +int +l_obj_register(L) +lua_State *L; +{ + int lib_id, meta_id; + + /* newclass = {} */ + lua_createtable(L, 0, 0); + lib_id = lua_gettop(L); + + /* metatable = {} */ + luaL_newmetatable(L, "obj"); + meta_id = lua_gettop(L); + luaL_setfuncs(L, l_obj_meta, 0); + + /* metatable.__index = _methods */ + luaL_newlib(L, l_obj_methods); + lua_setfield(L, meta_id, "__index"); + + /* metatable.__metatable = _meta */ + luaL_newlib(L, l_obj_meta); + lua_setfield(L, meta_id, "__metatable"); + + /* class.__metatable = metatable */ + lua_setmetatable(L, lib_id); + + /* _G["obj"] = newclass */ + lua_setglobal(L, "obj"); + + return 0; +} diff --git a/src/nhlua.c b/src/nhlua.c index eaa8e9758..d5dba8465 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -114,6 +114,19 @@ int value; lua_rawset(L, -3); } +void +nhl_add_table_entry_char(L, name, value) +lua_State *L; +const char *name; +char value; +{ + char buf[2]; + Sprintf(buf, "%c", value); + lua_pushstring(L, name); + lua_pushstring(L, buf); + lua_rawset(L, -3); +} + void nhl_add_table_entry_str(L, name, value) lua_State *L; @@ -874,6 +887,8 @@ nhl_init() l_selection_register(L); l_register_des(L); + l_obj_register(L); + if (!nhl_loadlua(L, "nhlib.lua")) { lua_close(L); return (lua_State *) 0; diff --git a/src/o_init.c b/src/o_init.c index 85b39daf9..cc63fd7cc 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -5,8 +5,6 @@ #include "hack.h" #include "lev.h" /* save & restore info */ -#include "sfproto.h" - static void FDECL(setgemprobs, (d_level *)); static void FDECL(shuffle, (int, int, BOOLEAN_P)); @@ -301,14 +299,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)objects, sizeof(struct objclass) * NUM_OBJECTS); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAXOCLASSES; ++i) - sfo_int(nhfp, &g.bases[i], "names", "g.bases", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfo_short(nhfp, &g.disco[i], "names", "g.disco", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfo_objclass(nhfp, &objects[i], "names", "objclass", 1); - } } /* as long as we use only one version of Hack we need not save oc_name and oc_descr, but we must save @@ -321,11 +311,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)&len, sizeof len); bwrite(nhfp->fd, (genericptr_t)objects[i].oc_uname, len); } - if (nhfp->fieldlevel) { - sfo_unsigned(nhfp, &len, "names", "len", 1); - for (j = 0; (unsigned) j < len; ++j) - sfo_char(nhfp, &objects[i].oc_uname[j], "names", "oc_uname", 1); - } } if (release_data(nhfp)) { free((genericptr_t) objects[i].oc_uname); @@ -347,31 +332,15 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) objects, sizeof(struct objclass) * NUM_OBJECTS); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAXOCLASSES; ++i) - sfi_int(nhfp, &g.bases[i], "names", "g.bases", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfi_short(nhfp, &g.disco[i], "names", "g.disco", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfi_objclass(nhfp, &objects[i], "names", "objclass", 1); - } for (i = 0; i < NUM_OBJECTS; i++) { if (objects[i].oc_uname) { if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &len, sizeof len); } - if (nhfp->fieldlevel) { - sfi_unsigned(nhfp, &len, "names", "len", 1); - } objects[i].oc_uname = (char *) alloc(len); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t)objects[i].oc_uname, len); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < len; ++j) - sfi_char(nhfp, &objects[i].oc_uname[j], - "names", "oc_uname", 1); - } } } #ifdef USE_TILES diff --git a/src/objnam.c b/src/objnam.c index fe19f9a3c..16b41cb73 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 objnam.c $NHDT-Date: 1575245076 2019/12/02 00:04:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.255 $ */ +/* NetHack 3.7 objnam.c $NHDT-Date: 1575768412 2019/12/08 01:26:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.273 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4241,6 +4241,65 @@ struct obj *gloves; return "gloves"; } +/* boots vs shoes; depends upon discovery state */ +const char * +boots_simple_name(boots) +struct obj *boots; +{ + static const char shoes[] = "shoes"; + + if (boots && boots->dknown) { + int otyp = boots->otyp; + struct objclass *ocl = &objects[otyp]; + const char *actualn = OBJ_NAME(*ocl), + *descrpn = OBJ_DESCR(*ocl); + + if (strstri(descrpn, shoes) + || (objects[otyp].oc_name_known && strstri(actualn, shoes))) + return shoes; + } + return "boots"; +} + +/* simplified shield for messages */ +const char * +shield_simple_name(shield) +struct obj *shield; +{ + if (shield) { + /* xname() describes unknown (unseen) reflection as smooth */ + if (shield->otyp == SHIELD_OF_REFLECTION) + return shield->dknown ? "silver shield" : "smooth shield"; + /* + * We might distinguish between wooden vs metallic or + * light vs heavy to give small benefit to spell casters. + * Fighter types probably care more about the former for + * vulnerability to fire or rust. + * + * We could do that both ways: light wooden shield, light + * metallic shield (there aren't any), heavy wooden shield, + * and heavy metallic shield but that's getting away from + * "simple name" which is intended to be shorter as well + * as less detailed than xname(). + */ +#if 0 + /* spellcasting uses a division like this */ + return (weight(shield) > (int) objects[SMALL_SHIELD].oc_weight) + ? "heavy shield" + : "light shield"; +#endif + } + return "shield"; +} + +/* for completness */ +const char * +shirt_simple_name(shirt) +struct obj *shirt UNUSED; +{ + return "shirt"; +} + const char * mimic_obj_name(mtmp) struct monst *mtmp; diff --git a/src/options.c b/src/options.c index 7922a3cd4..357902582 100644 --- a/src/options.c +++ b/src/options.c @@ -18,7 +18,6 @@ NEARDATA struct instance_flags iflags; /* provide linkage */ #include "tcap.h" #include #endif -#include "sfprocs.h" #define BACKWARD_COMPAT @@ -698,8 +697,6 @@ initoptions_init() if (boolopt[i].addr) *(boolopt[i].addr) = boolopt[i].initvalue; } - /* initialize the function pointers for fieldlevel saves */ - sf_init(); #ifdef SYSFLAGS Strcpy(sysflags.sysflagsid, "sysflags"); diff --git a/src/pager.c b/src/pager.c index bf185f64e..f29cedadb 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1574722864 2019/11/25 23:01:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.162 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1575830188 2019/12/08 18:36:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.175 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -483,11 +483,8 @@ char *buf, *monbuf; switch (glyph_to_cmap(glyph)) { case S_altar: - amsk = ((mtmp = m_at(x, y)) != 0 && has_mcorpsenm(mtmp) - && M_AP_TYPE(mtmp) == M_AP_FURNITURE - && mtmp->mappearance == S_altar) ? MCORPSENM(mtmp) - : levl[x][y].altarmask; - algn = Amask2align(amsk & ~AM_SHRINE); + amsk = altarmask_at(x, y); + algn = Amask2align(amsk & AM_MASK); Sprintf(buf, "%s %saltar", /* like endgame high priests, endgame high altars are only recognizable when immediately adjacent */ diff --git a/src/pray.c b/src/pray.c index a2f667a29..0562cd7ec 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1573346192 2019/11/10 00:36:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1575830189 2019/12/08 18:36:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1384,6 +1384,7 @@ dosacrifice() /* curse the lawful/neutral altar */ pline_The("altar is stained with %s blood.", g.urace.adj); levl[u.ux][u.uy].altarmask = AM_CHAOTIC; + newsym(u.ux, u.uy); /* in case Invisible to self */ angry_priest(); } else { struct monst *dmon; @@ -1640,15 +1641,16 @@ dosacrifice() a_gname()); if (rn2(8 + u.ulevel) > 5) { struct monst *pri; + boolean shrine; + You_feel("the power of %s increase.", u_gname()); exercise(A_WIS, TRUE); change_luck(1); - /* Yes, this is supposed to be &=, not |= */ - levl[u.ux][u.uy].altarmask &= AM_SHRINE; - /* the following accommodates stupid compilers */ - levl[u.ux][u.uy].altarmask = - levl[u.ux][u.uy].altarmask - | (Align2amask(u.ualign.type)); + shrine = on_shrine(); + levl[u.ux][u.uy].altarmask = Align2amask(u.ualign.type); + if (shrine) + levl[u.ux][u.uy].altarmask |= AM_SHRINE; + newsym(u.ux, u.uy); /* in case Invisible to self */ if (!Blind) pline_The("altar glows %s.", hcolor((u.ualign.type == A_LAWFUL) @@ -2075,6 +2077,24 @@ doturn() return 1; } +int +altarmask_at(x, y) +int x, y; +{ + int res = 0; + + if (isok(x, y)) { + struct monst *mon = m_at(x, y); + + if (mon && M_AP_TYPE(mon) == M_AP_FURNITURE + && mon->mappearance == S_altar) + res = has_mcorpsenm(mon) ? MCORPSENM(mon) : 0; + else if (IS_ALTAR(levl[x][y].typ)) + res = levl[x][y].altarmask; + } + return res; +} + const char * a_gname() { diff --git a/src/questpgr.c b/src/questpgr.c index 594e4952b..c139a84ac 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 questpgr.c $NHDT-Date: 1574634383 2019/11/24 22:26:23 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.63 $ */ +/* NetHack 3.6 questpgr.c $NHDT-Date: 1575830005 2019/12/08 18:33:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright 1991, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ @@ -489,7 +489,9 @@ const char *msgid; nelems = (int) lua_tointeger(L, -1); lua_pop(L, 1); if (nelems < 2) { - impossible("com_pager: questtext[%s][%s] in %s in not an array of strings", section, msgid, QTEXT_FILE); + impossible( + "com_pager: questtext[%s][%s] in %s in not an array of strings", + section, msgid, QTEXT_FILE); lua_close(L); return FALSE; } @@ -511,12 +513,13 @@ const char *msgid; if (synopsis) { char in_line[BUFSZ], out_line[BUFSZ]; + Strcpy(in_line, synopsis); convert_line(in_line, out_line); putmsghistory(out_line, FALSE); + free(synopsis); } - free(synopsis); free(text); lua_close(L); return TRUE; diff --git a/src/region.c b/src/region.c index 548486d82..0432b5d13 100644 --- a/src/region.c +++ b/src/region.c @@ -4,8 +4,6 @@ #include "hack.h" #include "lev.h" -#include "sfproto.h" - /* * This should really go into the level structure, but @@ -641,64 +639,40 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.moves, sizeof (g.moves)); /* timestamp */ bwrite(nhfp->fd, (genericptr_t) &g.n_regions, sizeof (g.n_regions)); } - if (nhfp->fieldlevel) { - sfo_long(nhfp, &g.moves, "regions", "tmstamp", 1); - sfo_int(nhfp, &g.n_regions, "regions", "region_count", 1); - } for (i = 0; i < g.n_regions; i++) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); } - if (nhfp->fieldlevel) { - sfo_nhrect(nhfp, &g.regions[i]->bounding_box, "g.regions", "bounding_box", 1); - sfo_short(nhfp, &g.regions[i]->nrects, "g.regions", "nrects", 1); - } for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); - if (nhfp->fieldlevel) - sfo_nhrect(nhfp, &g.regions[i]->rects[j], "g.regions", "rect", 1); } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); - if (nhfp->fieldlevel) - sfo_boolean(nhfp, &g.regions[i]->attach_2_u, "g.regions", "attach_2_u", 1); n = 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.regions[i]->attach_2_m, "g.regions", "attach_2_m", 1); n = g.regions[i]->enter_msg != (const char *)0 ? strlen(g.regions[i]->enter_msg) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &n, "g.regions", "enter_msg_length", 1); if (n > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) g.regions[i]->enter_msg, n); - if (nhfp->fieldlevel) - sfo_char(nhfp, g.regions[i]->enter_msg, "g.regions", "enter_msg", 1); } n = g.regions[i]->leave_msg != (const char *)0 ? strlen(g.regions[i]->leave_msg) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &n, "g.regions", "leave_msg_length", 1); if (n > 0) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) g.regions[i]->leave_msg, n); } - if (nhfp->fieldlevel) { - for (j = 0; j < (int) n; ++j) - sfo_char(nhfp, &g.regions[i]->leave_msg[j], "g.regions", "leave_msg", 1); - } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); @@ -711,34 +685,16 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); } - if (nhfp->fieldlevel) { - sfo_long(nhfp, &g.regions[i]->ttl, "g.regions", "ttl", 1); - sfo_short(nhfp, &g.regions[i]->expire_f, "g.regions", "expire_f", 1); - sfo_short(nhfp, &g.regions[i]->can_enter_f, "g.regions", "can_enter_f", 1); - sfo_short(nhfp, &g.regions[i]->enter_f, "g.regions", "enter_f", 1); - sfo_short(nhfp, &g.regions[i]->can_leave_f, "g.regions", "can_leave_f", 1); - sfo_short(nhfp, &g.regions[i]->leave_f, "g.regions", "leave_f", 1); - sfo_short(nhfp, &g.regions[i]->inside_f, "g.regions", "inside_f", 1); - sfo_unsigned(nhfp, &g.regions[i]->player_flags, "g.regions", "player_flags", 1); - sfo_short(nhfp, &g.regions[i]->n_monst, "g.regions", "monster_count", 1); - } for (j = 0; j < g.regions[i]->n_monst; j++) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->monsters[j], sizeof (unsigned)); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.regions[i]->monsters[j], "g.regions", "monster", 1); } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); } - if (nhfp->fieldlevel) { - sfo_boolean(nhfp, &g.regions[i]->visible, "g.regions", "visible", 1); - sfo_int(nhfp, &g.regions[i]->glyph, "g.regions", "glyph", 1); - sfo_any(nhfp, &g.regions[i]->arg, "g.regions", "arg", 1); - } } skip_lots: @@ -759,8 +715,6 @@ boolean ghostly; /* If a bones file restore */ clear_regions(); /* Just for security */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &tmstamp, sizeof (tmstamp)); - if (nhfp->fieldlevel) - sfi_long(nhfp, &tmstamp, "regions", "tmstamp", 1); if (ghostly) tmstamp = 0; else @@ -768,8 +722,6 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.n_regions, sizeof (g.n_regions)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.n_regions, "regions", "region_count", 1); g.max_regions = g.n_regions; if (g.n_regions > 0) @@ -780,41 +732,25 @@ boolean ghostly; /* If a bones file restore */ mread(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); } - if (nhfp->fieldlevel) { - sfi_nhrect(nhfp, &g.regions[i]->bounding_box, "g.regions", "bounding box", 1); - sfi_short(nhfp, &g.regions[i]->nrects, "g.regions", "nrects", 1); - } if (g.regions[i]->nrects > 0) g.regions[i]->rects = (NhRect *) alloc(sizeof (NhRect) * g.regions[i]->nrects); for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); - if (nhfp->fieldlevel) - sfi_nhrect(nhfp, &g.regions[i]->rects[j], "g.regions", "rect", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); } - if (nhfp->fieldlevel) { - sfi_boolean(nhfp, &g.regions[i]->attach_2_u, "g.regions", "attach_2_u", 1); - sfi_unsigned(nhfp, &g.regions[i]->attach_2_m, "g.regions", "attach_2_m", 1); - } if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &n, "g.regions", "enter_msg_length", 1); if (n > 0) { msg_buf = (char *) alloc(n + 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) msg_buf, n); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < n; ++j) - sfi_char(nhfp, &msg_buf[j], "g.regions", "enter_msg", 1); - } msg_buf[n] = '\0'; g.regions[i]->enter_msg = (const char *) msg_buf; } else @@ -822,17 +758,11 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &n, "g.regions", "leave_msg_length", 1); - if (n > 0) { + if (n > 0) { msg_buf = (char *) alloc(n + 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) msg_buf, n); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < n; ++j) - sfi_char(nhfp, &msg_buf[j], "g.regions", "leave_msg", 1); - } msg_buf[n] = '\0'; g.regions[i]->leave_msg = (const char *) msg_buf; } else @@ -840,8 +770,6 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); - if (nhfp->fieldlevel) - sfi_long(nhfp, &g.regions[i]->ttl, "g.regions", "ttl", 1); /* check for expired region */ if (g.regions[i]->ttl >= 0L) g.regions[i]->ttl = @@ -862,23 +790,12 @@ boolean ghostly; /* If a bones file restore */ mread(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); } - if (nhfp->fieldlevel) { - sfi_short(nhfp, &g.regions[i]->expire_f, "g.regions", "expire_f", 1); - sfi_short(nhfp, &g.regions[i]->can_enter_f, "g.regions", "can_enter_f", 1); - sfi_short(nhfp, &g.regions[i]->enter_f, "g.regions", "enter_f", 1); - sfi_short(nhfp, &g.regions[i]->can_leave_f, "g.regions", "can_leave_f", 1); - sfi_short(nhfp, &g.regions[i]->leave_f, "g.regions", "leave_f", 1); - sfi_short(nhfp, &g.regions[i]->inside_f, "g.regions", "inside_f", 1); - sfi_unsigned(nhfp, &g.regions[i]->player_flags, "g.regions", "player_flags", 1); - } if (ghostly) { /* settings pertained to old player */ clear_hero_inside(g.regions[i]); clear_heros_fault(g.regions[i]); } if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); - if (nhfp->fieldlevel) - sfi_short(nhfp, &g.regions[i]->n_monst, "g.regions", "monster_count", 1); if (g.regions[i]->n_monst > 0) g.regions[i]->monsters = (unsigned *) alloc(sizeof (unsigned) * g.regions[i]->n_monst); @@ -889,19 +806,12 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->monsters[j], sizeof (unsigned)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &g.regions[i]->monsters[j], "g.regions", "monster", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); } - if (nhfp->fieldlevel) { - sfi_boolean(nhfp, &g.regions[i]->visible, "g.regions", "visible", 1); - sfi_int(nhfp, &g.regions[i]->glyph, "g.regions", "glyph", 1); - sfi_any(nhfp, &g.regions[i]->arg, "g.regions", "arg", 1); - } } /* remove expired regions, do not trigger the expire_f callback (yet!); also update monster lists if this data is coming from a bones file */ diff --git a/src/restore.c b/src/restore.c index 1cab78c8c..84eef5ee1 100644 --- a/src/restore.c +++ b/src/restore.c @@ -6,9 +6,6 @@ #include "hack.h" #include "lev.h" #include "tcap.h" /* for TERMLIB and ASCIIGRAPH */ -#include "sfproto.h" - - #if defined(MICRO) extern int dotcnt; /* shared with save */ @@ -128,15 +125,11 @@ NHFILE *nhfp; g.sp_levchn = (s_level *) 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &cnt, sizeof(int)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &cnt, "levchn", "lev_count", 1); for (; cnt > 0; cnt--) { tmplev = (s_level *) alloc(sizeof(s_level)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) tmplev, sizeof(s_level)); - if (nhfp->fieldlevel) - sfi_s_level(nhfp, tmplev, "levchn", "s_level", 1); if (!g.sp_levchn) g.sp_levchn = tmplev; @@ -160,8 +153,6 @@ boolean ghostly; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &dmgcount, sizeof(dmgcount)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &dmgcount, "damage", "damage_count", 1); counter = (int) dmgcount; if (!counter) @@ -172,8 +163,6 @@ boolean ghostly; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) tmp_dam, sizeof(*tmp_dam)); - if (nhfp->fieldlevel) - sfi_damage(nhfp, tmp_dam, "damage", "damage", 1); if (ghostly) tmp_dam->when += (g.monstermoves - g.omoves); @@ -212,8 +201,6 @@ struct obj *otmp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj)); - if (nhfp->fieldlevel) - sfi_obj(nhfp, otmp, "obj", "obj", 1); /* next object pointers are invalid; otmp->cobj needs to be left as is--being non-null is key to restoring container contents */ @@ -225,22 +212,16 @@ struct obj *otmp; /* oname - object's name */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "oname_length", 1); if (buflen > 0) { /* includes terminating '\0' */ new_oname(otmp, buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ONAME(otmp), buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, ONAME(otmp), "obj", "oname", buflen); } /* omonst - corpse or statue might retain full monster details */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omonst_length", 1); if (buflen > 0) { newomonst(otmp); /* this is actually a monst struct, so we @@ -251,42 +232,30 @@ struct obj *otmp; /* omid - monster id number, connecting corpse to ghost */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omid_length", 1); if (buflen > 0) { newomid(otmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) OMID(otmp), buflen); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, OMID(otmp), "obj", "omid", 1); } /* olong - temporary gold */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "olong_length", 1); if (buflen > 0) { newolong(otmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) OLONG(otmp), buflen); - if (nhfp->fieldlevel) - sfi_long(nhfp, OLONG(otmp), "obj", "olong", 1); } /* omailcmd - feedback mechanism for scroll of mail */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omailcmd_length", 1); if (buflen > 0) { char *omailcmd = (char *) alloc(buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) omailcmd, buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, omailcmd, "obj", "omailcmd", buflen); new_omailcmd(otmp, omailcmd); free((genericptr_t) omailcmd); } @@ -305,8 +274,6 @@ boolean ghostly, frozen; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "obj_length", 1); if (buflen == -1) break; @@ -393,8 +360,6 @@ struct monst *mtmp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) mtmp, sizeof(struct monst)); - if (nhfp->fieldlevel) - sfi_monst(nhfp, mtmp, "mon", "monst_length", 1); /* next monster pointer is invalid */ mtmp->nmon = (struct monst *) 0; @@ -405,82 +370,56 @@ struct monst *mtmp; /* mname - monster's name */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "mname_length", 1); if (buflen > 0) { /* includes terminating '\0' */ new_mname(mtmp, buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) MNAME(mtmp), buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, MNAME(mtmp), "mon", "mname", buflen); } /* egd - vault guard */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "egd_length", 1); if (buflen > 0) { newegd(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EGD(mtmp), sizeof(struct egd)); - if (nhfp->fieldlevel) - sfi_egd(nhfp, EGD(mtmp), "mon", "egd", 1); } /* epri - temple priest */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "epri_length", 1); if (buflen > 0) { newepri(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EPRI(mtmp), sizeof(struct epri)); - if (nhfp->fieldlevel) - sfi_epri(nhfp, EPRI(mtmp), "mon", "epri", 1); } /* eshk - shopkeeper */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "eshk_length", 1); if (buflen > 0) { neweshk(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ESHK(mtmp), sizeof(struct eshk)); - if (nhfp->fieldlevel) - sfi_eshk(nhfp, ESHK(mtmp), "mon", "eshk", 1); } /* emin - minion */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "emin_length", 1); if (buflen > 0) { newemin(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EMIN(mtmp), sizeof(struct emin)); - if (nhfp->fieldlevel) - sfi_emin(nhfp, EMIN(mtmp), "mon", "emin", 1); } /* edog - pet */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "edog_length", 1); if (buflen > 0) { newedog(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EDOG(mtmp), sizeof(struct edog)); - if (nhfp->fieldlevel) - sfi_edog(nhfp, EDOG(mtmp), "mon", "edog", 1); } /* mcorpsenm - obj->corpsenm for mimic posing as corpse or statue (inline int rather than pointer to something) */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &MCORPSENM(mtmp), sizeof MCORPSENM(mtmp)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &MCORPSENM(mtmp), "mon", "mcorpsenm", 1); } /* mextra */ } @@ -496,8 +435,6 @@ boolean ghostly; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "monst_length", 1); if (buflen == -1) break; @@ -572,8 +509,6 @@ NHFILE *nhfp; fnext = newfruit(); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)fnext, sizeof *fnext); - if (nhfp->fieldlevel) - sfi_fruit(nhfp, fnext, "fruit", "fruit", 1); if (fnext->fid != 0) { fnext->nextf = flist; flist = fnext; @@ -636,13 +571,8 @@ unsigned int *stuckid, *steedid; unsigned long uid = 0; boolean defer_perm_invent; - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "gamestate", "start", "", 0); - if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &uid, sizeof uid); - if (nhfp->fieldlevel) - sfi_ulong(nhfp, &uid, "gamestate", "uid", 1); if (SYSOPT_CHECK_SAVE_UID && uid != (unsigned long) getuid()) { /* strange ... */ @@ -656,8 +586,6 @@ unsigned int *stuckid, *steedid; newgamecontext = g.context; /* copy statically init'd context */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.context, sizeof (struct context_info)); - if (nhfp->fieldlevel) - sfi_context_info(nhfp, &g.context, "gamestate", "g.context", 1); g.context.warntype.species = (g.context.warntype.speciesidx >= LOW_PM) ? &mons[g.context.warntype.speciesidx] : (struct permonst *) 0; @@ -671,8 +599,6 @@ unsigned int *stuckid, *steedid; newgameflags = flags; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &flags, sizeof (struct flag)); - if (nhfp->fieldlevel) - sfi_flag(nhfp, &flags, "gamestate", "flags", 1); /* avoid keeping permanent inventory window up to date during restore (setworn() calls update_inventory); attempting to include the cost @@ -699,9 +625,6 @@ unsigned int *stuckid, *steedid; newgamesysflags = sysflags; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); - if (nhfp->fieldlevel) - sfi_sysflag(nhfp, &sysflags, "gamestate", "sysflags", 1); - mread(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif role_init(); /* Reset the initial role, race, gender, and alignment */ @@ -710,25 +633,17 @@ unsigned int *stuckid, *steedid; #endif if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &u, sizeof(struct you)); - if (nhfp->fieldlevel) - sfi_you(nhfp, &u, "gamestate", "you", 1); g.youmonst.cham = u.mcham; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) timebuf, 14); - if (nhfp->fieldlevel) - sfi_str(nhfp, timebuf, "gamestate", "ubirthday", 14); timebuf[14] = '\0'; ubirthday = time_from_yyyymmddhhmmss(timebuf); if (nhfp->structlevel) mread(nhfp->fd, &urealtime.realtime, sizeof urealtime.realtime); - if (nhfp->fieldlevel) - sfi_long(nhfp, &urealtime.realtime, "gamestate", "realtime", 1); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) timebuf, 14); - if (nhfp->fieldlevel) - sfi_str(nhfp, timebuf, "gamestate", "start_timing", 14); timebuf[14] = '\0'; urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf); @@ -767,8 +682,6 @@ unsigned int *stuckid, *steedid; restore_timers(nhfp, RANGE_GLOBAL, FALSE, 0L); restore_light_sources(nhfp); - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "objchain", "start", "invent", 0); g.invent = restobjchn(nhfp, FALSE, FALSE); /* restore dangling (not on floor or in inventory) ball and/or chain */ @@ -787,12 +700,6 @@ unsigned int *stuckid, *steedid; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < NUMMONS; ++i) - sfi_mvitals(nhfp, &g.mvitals[i], "gamestate", "g.mvitals", 1); - } /* * There are some things after this that can have unintended display @@ -824,41 +731,20 @@ unsigned int *stuckid, *steedid; mread(nhfp->fd, (genericptr_t) &g.quest_status, sizeof (struct q_score)); mread(nhfp->fd, (genericptr_t) g.spl_book, (MAXSPELL + 1) * sizeof (struct spell)); } - if (nhfp->fieldlevel) { - int i; - struct spell *sptmp; - - sfi_long(nhfp, &g.moves, "gamestate", "g.moves", 1); - sfi_long(nhfp, &g.monstermoves, "gamestate", "g.monstermoves", 1); - sfi_q_score(nhfp, &g.quest_status, "gamestate", "g.quest_status", 1); - sptmp = g.spl_book; - for (i = 0; i < (MAXSPELL + 1); ++i) - sfi_spell(nhfp, sptmp++, "gamestate", "g.spl_book", 1); - } restore_artifacts(nhfp); restore_oracles(nhfp); if (u.ustuck) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) stuckid, sizeof *stuckid); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, stuckid, "gamestate", "ustuck_id", 1); } if (u.usteed) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) steedid, sizeof *steedid); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, steedid, "gamestate", "usteed_id", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.pl_character, sizeof g.pl_character); mread(nhfp->fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit); } - if (nhfp->fieldlevel) { - sfi_char(nhfp, g.pl_character, "gamestate", "g.pl_character", - sizeof g.pl_character); - sfi_char(nhfp, g.pl_fruit, "gamestate", "g.pl_fruit", - sizeof g.pl_fruit); - } freefruitchn(g.ffruit); /* clean up fruit(s) made by initoptions() */ g.ffruit = loadfruitchn(nhfp); @@ -1039,11 +925,6 @@ NHFILE *nhfp; if (restoreinfo.mread_flags == -1) break; } - if (nhfp->fieldlevel) { - sfi_xchar(nhfp, <mp, "gamestate", "level_number", 1); - if (nhfp->eof) - break; - } getlev(nhfp, 0, ltmp, FALSE); #ifdef MICRO curs(WIN_MAP, 1 + dotcnt++, dotrow); @@ -1061,9 +942,6 @@ NHFILE *nhfp; return rtmp; /* dorecover called recursively */ } restoreinfo.mread_flags = 0; - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "NetHack", "end", "savefile", 0); - rewind_nhfile(nhfp); /* return to beginning of file */ (void) validate(nhfp, (char *) 0); get_plname_from_file(nhfp, g.plname); @@ -1130,16 +1008,12 @@ struct cemetery **cemeteryaddr; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &cflag, sizeof cflag); - if (nhfp->fieldlevel) - sfi_int(nhfp, &cflag, "cemetery", "cemetery_flag", 1); if (cflag == 0) { bonesaddr = cemeteryaddr; do { bonesinfo = (struct cemetery *) alloc(sizeof *bonesinfo); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) bonesinfo, sizeof *bonesinfo); - if (nhfp->fieldlevel) - sfi_cemetery(nhfp, bonesinfo, "bones", "bonesinfo", 1); *bonesaddr = bonesinfo; bonesaddr = &(*bonesaddr)->next; } while (*bonesaddr); @@ -1175,10 +1049,6 @@ boolean rlecomp; mread(nhfp->fd, (genericptr_t) &len, sizeof(uchar)); mread(nhfp->fd, (genericptr_t) &r, sizeof(struct rm)); } - if (nhfp->fieldlevel) { - sfi_uchar(nhfp, &len, "room", "levl", 1); - sfi_rm(nhfp, &r, "room", "rm", 1); - } } } j = 0; @@ -1192,13 +1062,6 @@ boolean rlecomp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) levl, sizeof levl); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfi_rm(nhfp, &levl[c][r], "room", "levl", 1); - } } void @@ -1246,21 +1109,15 @@ boolean ghostly; /* First some sanity checks */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &hpid, sizeof(hpid)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &hpid, "gamestate", "g.hackpid", 1); /* CHECK: This may prevent restoration */ #ifdef TOS if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &tlev, sizeof(tlev)); - if (nhfp->fieldlevel) - sfi_short(nhfp, &tlev, "gamestate", "tlev", 1); dlvl = tlev & 0x00ff; #else if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &dlvl, sizeof(dlvl)); - if (nhfp->fieldlevel) - sfi_xchar(nhfp, &dlvl, "gamestate", "dlvl", 1); #endif if ((pid && pid != hpid) || (lev && dlvl != lev)) { char trickbuf[BUFSZ]; @@ -1281,16 +1138,6 @@ boolean ghostly; mread(nhfp->fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); mread(nhfp->fd, (genericptr_t) &g.omoves, sizeof(g.omoves)); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfi_schar(nhfp, &g.lastseentyp[c][r], - "lev", "g.lastseentyp", 1); - - sfi_long(nhfp, &g.omoves, "lev", "timestmp", 1); - } elapsed = g.monstermoves - g.omoves; if (nhfp->structlevel) { @@ -1304,20 +1151,6 @@ boolean ghostly; mread(nhfp->fd, (genericptr_t)&g.level.flags, sizeof(g.level.flags)); mread(nhfp->fd, (genericptr_t)g.doors, sizeof(g.doors)); } - if (nhfp->fieldlevel) { - int i; - - sfi_stairway(nhfp, &g.upstair, "lev", "g.upstair", 1); - sfi_stairway(nhfp, &g.dnstair, "lev", "g.dnstair", 1); - sfi_stairway(nhfp, &g.upladder, "lev", "g.upladder", 1); - sfi_stairway(nhfp, &g.dnladder, "lev", "g.dnladder", 1); - sfi_stairway(nhfp, &g.sstairs, "lev", "g.sstairs", 1); - sfi_dest_area(nhfp, &g.updest, "lev", "g.updest", 1); - sfi_dest_area(nhfp, &g.dndest, "lev", "g.dndest", 1); - sfi_levelflags(nhfp, &g.level.flags, "lev", "g.level.flags", 1); - for (i = 0; i < DOORMAX; ++i) - sfi_nhcoord(nhfp, &g.doors[i], "lev", "g.doors", 1); - } rest_rooms(nhfp); /* No joke :-) */ if (g.nroom) g.doorindex = g.rooms[g.nroom - 1].fdoor + g.rooms[g.nroom - 1].doorct; @@ -1336,8 +1169,6 @@ boolean ghostly; trap = newtrap(); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)trap, sizeof(struct trap)); - if (nhfp->fieldlevel) - sfi_trap(nhfp, trap, "trap", "trap", 1); if (trap->tx != 0) { trap->ntrap = g.ftrap; g.ftrap = trap; @@ -1461,10 +1292,6 @@ char *plbuf; (void) read(nhfp->fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz)); (void) read(nhfp->fd, (genericptr_t) plbuf, pltmpsiz); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &pltmpsiz, "plname", "plname_size", 1); - sfi_str(nhfp, plbuf, "plname", "g.plname", pltmpsiz); - } return; } @@ -1478,16 +1305,12 @@ NHFILE *nhfp; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &msgsize, sizeof(msgsize)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &msgsize, "msghistory", "msghistory_length", 1); if (msgsize == -1) break; if (msgsize > (BUFSZ - 1)) panic("restore_msghistory: msg too big (%d)", msgsize); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) msg, msgsize); - if (nhfp->fieldlevel) - sfi_str(nhfp, msg, "msghistory", "msg", msgsize); msg[msgsize] = '\0'; putmsghistory(msg, TRUE); ++msgcount; @@ -1671,21 +1494,14 @@ const char *name; if (nhfp->structlevel) utdflags |= UTD_CHECKSIZES; - if (nhfp->fieldlevel) - utdflags |= UTD_CHECKFIELDCOUNTS | - UTD_SKIP_SANITY1 | UTD_SKIP_SAVEFILEINFO; if (!(reslt = uptodate(nhfp, name, utdflags))) return 1; if ((nhfp->mode & WRITING) == 0) { if (nhfp->structlevel) rlen = read(nhfp->fd, (genericptr_t) &sfi, sizeof sfi); - if (nhfp->fieldlevel) - sfi_savefile_info(nhfp, &sfi, "savefileinfo", "savefile_info", 1); } else { if (nhfp->structlevel) rlen = read(nhfp->fd, (genericptr_t) &sfi, sizeof sfi); - if (nhfp->fieldlevel) - sfi_savefile_info(nhfp, &sfi, "savefileinfo", "savefile_info", 1); minit(); /* ZEROCOMP */ if (rlen == 0) { if (verbose) { diff --git a/src/rumors.c b/src/rumors.c index b5be74ff4..4b4e7236f 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -6,8 +6,6 @@ #include "hack.h" #include "lev.h" #include "dlb.h" -#include "sfproto.h" - /* [note: this comment is fairly old, but still accurate for 3.1] * Rumors have been entirely rewritten to speed up the access. This is @@ -393,16 +391,10 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.oracle_cnt, "oracles", "g.oracle_cnt", 1); if (g.oracle_cnt) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t)g.oracle_loc, g.oracle_cnt * sizeof (long)); } - if (nhfp->fieldlevel) { - for (i = 0; (unsigned) i < g.oracle_cnt; ++i) - sfo_ulong(nhfp, &g.oracle_loc[i], "oracles", "oracle loc", 1); - } } } if (release_data(nhfp)) { @@ -420,18 +412,12 @@ NHFILE *nhfp; int i; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &g.oracle_cnt, "oracles", "g.oracle_cnt", 1); if (g.oracle_cnt) { g.oracle_loc = (unsigned long *) alloc(g.oracle_cnt * sizeof(long)); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.oracle_loc, g.oracle_cnt * sizeof (long)); } - if (nhfp->fieldlevel) { - for (i = 0; (unsigned) i < g.oracle_cnt; ++i) - sfi_ulong(nhfp, &g.oracle_loc[i], "oracles", "g.oracle_loc", 1); - } g.oracle_flg = 1; /* no need to call init_oracles() */ } } diff --git a/src/save.c b/src/save.c index 6f6c8c1fc..3cb7e1a8d 100644 --- a/src/save.c +++ b/src/save.c @@ -5,8 +5,6 @@ #include "hack.h" #include "lev.h" -#include "sfproto.h" - #ifndef NO_SIGNAL #include @@ -149,10 +147,6 @@ dosave0() (void) delete_savefile(); /* ab@unido */ return 0; } -#ifdef SAVEFILE_DEBUGGING - if (nhfp && nhfp->fieldlevel && nhfp->fplog) - (void) fprintf(nhfp->fplog, "# just opened\n"); -#endif vision_recalc(2); /* shut down vision to prevent problems in the event of an impossible() call */ @@ -202,9 +196,6 @@ dosave0() } #endif /* MFLOPPY */ - if (nhfp->fieldlevel && nhfp->addinfo && (nhfp->mode & WRITING)) - sfo_addinfo(nhfp, "NetHack", "start", "savefile", 0); - nhfp->mode = WRITING | FREEING; store_version(nhfp); store_savefileinfo(nhfp); @@ -259,8 +250,6 @@ dosave0() close_nhfile(onhfp); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) <mp, sizeof ltmp); /* level number*/ - if (nhfp->fieldlevel) - sfo_xchar(nhfp, <mp, "gamestate", "level_number", 1); /* xchar */ savelev(nhfp, ltmp); /* actual level*/ delete_levelfile(ltmp); } @@ -294,14 +283,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &flags, sizeof flags); #ifdef SYSFLAGS bwrite(nhfp->fd, (genericptr_t) &sysflags, sysflags); -#endif - } - if (nhfp->fieldlevel) { - sfo_ulong(nhfp, &uid, "gamestate", "uid", 1); - sfo_context_info(nhfp, &g.context, "gamestate", "g.context", 1); - sfo_flag(nhfp, &flags, "gamestate" , "flags", 1); -#ifdef SYSFLAGS - sfo_flag(nhfp, &sysflags, "gamestate" , "sysflags", 1); #endif } urealtime.finish_time = getnow(); @@ -318,12 +299,6 @@ NHFILE *nhfp; sizeof urealtime.realtime); bwrite(nhfp->fd, yyyymmddhhmmss(urealtime.start_timing), 14); } - if (nhfp->fieldlevel) { - sfo_you(nhfp, &u, "gamestate", "you", 1); - sfo_str(nhfp, yyyymmddhhmmss(ubirthday), "gamestate", "ubirthday", 14); - sfo_long(nhfp, &urealtime.realtime, "gamestate", "realtime", 1); - sfo_str(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate", "start_timing", 14); - } /* this is the value to use for the next update of urealtime.realtime */ urealtime.start_timing = urealtime.finish_time; save_killers(nhfp); @@ -355,12 +330,6 @@ NHFILE *nhfp; } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals); - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < NUMMONS; ++i) - sfo_mvitals(nhfp, &g.mvitals[i], "gamestate", "g.mvitals", 1); - } save_dungeon(nhfp, (boolean) !!perform_bwrite(nhfp), (boolean) !!release_data(nhfp)); savelevchn(nhfp); @@ -371,39 +340,20 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.spl_book, sizeof (struct spell) * (MAXSPELL + 1)); } - if (nhfp->fieldlevel) { - int i; - struct spell *sptmp; - - sfo_long(nhfp, &g.moves, "gamestate", "g.moves", 1); - sfo_long(nhfp, &g.monstermoves, "gamestate", "g.monstermoves", 1); - sfo_q_score(nhfp, &g.quest_status, "gamestate", "g.quest_status", 1); - sptmp = g.spl_book; - for (i = 0; i < (MAXSPELL + 1); ++i) - sfo_spell(nhfp, sptmp++, "gamestate", "g.spl_book", 1); - } save_artifacts(nhfp); save_oracles(nhfp); if (g.ustuck_id) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.ustuck_id, sizeof g.ustuck_id); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.ustuck_id, "gamestate", "g.ustuck_id", 1); } if (g.usteed_id) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.usteed_id, sizeof g.usteed_id); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.usteed_id, "gamestate", "g.usteed_id", 1); } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) g.pl_character, sizeof g.pl_character); bwrite(nhfp->fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit); } - if (nhfp->fieldlevel) { - sfo_char(nhfp, g.pl_character, "gamestate", "g.pl_character", sizeof g.pl_character); - sfo_char(nhfp, g.pl_fruit, "gamestate", "g.pl_fruit", sizeof g.pl_fruit); - } savefruitchn(nhfp); savenames(nhfp); save_waterlevel(nhfp); @@ -478,15 +428,11 @@ savestateinlock() nhfp->mode = WRITING; if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) &g.hackpid, sizeof g.hackpid); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.hackpid, "gamestate", "g.hackpid", 1); if (flags.ins_chkpt) { int currlev = ledger_no(&u.uz); if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) &currlev, sizeof currlev); - if (nhfp->fieldlevel) - sfo_int(nhfp, &currlev, "gamestate", "savestateinlock", 1); save_savefile_name(nhfp); store_version(nhfp); store_savefileinfo(nhfp); @@ -582,20 +528,14 @@ xchar lev; g.level_info[lev].flags |= VISITED; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.hackpid, sizeof g.hackpid); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.hackpid, "gamestate", "g.hackpid", 1); #ifdef TOS tlev = lev; tlev &= 0x00ff; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &tlev, sizeof tlev); - if (nhfp->fieldlevel) - sfo_short(nhfp, &tlev, "gamestate", "tlev", 1); #else if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &lev, sizeof lev); - if (nhfp->fieldlevel) - sfo_xchar(nhfp, &lev, "gamestate", "dlvl", 1); #endif } @@ -623,24 +563,6 @@ xchar lev; bwrite(nhfp->fd, (genericptr_t) &g.level.flags, sizeof g.level.flags); bwrite(nhfp->fd, (genericptr_t) g.doors, sizeof g.doors); } - if (nhfp->fieldlevel) { - int i, c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfo_schar(nhfp, &g.lastseentyp[c][r], "lev", "g.lastseentyp", 1); - sfo_long(nhfp, &g.monstermoves, "lev", "timestmp", 1); - sfo_stairway(nhfp, &g.upstair, "lev", "g.upstair", 1); - sfo_stairway(nhfp, &g.dnstair, "lev", "g.dnstair", 1); - sfo_stairway(nhfp, &g.upladder, "lev", "g.upladder", 1); - sfo_stairway(nhfp, &g.dnladder, "lev", "g.dnladder", 1); - sfo_stairway(nhfp, &g.sstairs, "lev", "g.sstairs", 1); - sfo_dest_area(nhfp, &g.updest, "lev", "g.updest", 1); - sfo_dest_area(nhfp, &g.dndest, "lev", "g.dndest", 1); - sfo_levelflags(nhfp, &g.level.flags, "lev", "g.level.flags", 1); - for (i = 0; i < DOORMAX; ++i) - sfo_nhcoord(nhfp, &g.doors[i], "lev", "door", 1); - } save_rooms(nhfp); /* no dynamic memory to reclaim */ /* from here on out, saving also involves allocated memory cleanup */ @@ -719,10 +641,6 @@ boolean rlecomp; bwrite(nhfp->fd, (genericptr_t) &match, sizeof (uchar)); bwrite(nhfp->fd, (genericptr_t) rgrm, sizeof (struct rm)); } - if (nhfp->fieldlevel) { - sfo_uchar(nhfp, &match, "levl", "match", 1); - sfo_rm(nhfp, rgrm, "levl", "rgrm", 1); - } /* start encoding again. we have at least 1 rm in the next run, viz. this one. */ match = 1; @@ -735,10 +653,6 @@ boolean rlecomp; bwrite(nhfp->fd, (genericptr_t) &match, sizeof (uchar)); bwrite(nhfp->fd, (genericptr_t) rgrm, sizeof (struct rm)); } - if (nhfp->fieldlevel) { - sfo_uchar(nhfp, &match, "levl", "match", 1); - sfo_rm(nhfp, rgrm, "levl", "rgrm", 1); - } } return; } @@ -748,13 +662,6 @@ boolean rlecomp; if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) levl, sizeof levl); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfo_rm(nhfp, &g.level.locations[c][r], "room", "levl", 1); - } } /* used when saving a level and also when saving dungeon overview data */ @@ -770,8 +677,6 @@ struct cemetery **cemeteryaddr; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &flag, sizeof flag); - if (nhfp->fieldlevel) - sfo_int(nhfp, &flag, "cemetery", "cemetery_flag", 1); } nextbones = *cemeteryaddr; while ((thisbones = nextbones) != 0) { @@ -779,8 +684,6 @@ struct cemetery **cemeteryaddr; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) thisbones, sizeof *thisbones); - if (nhfp->fieldlevel) - sfo_cemetery(nhfp, thisbones, "cemetery", "cemetery", 1); } if (release_data(nhfp)) free((genericptr_t) thisbones); @@ -802,15 +705,11 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &xl, sizeof xl); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &xl, "damage", "damage_count", 1); } while (xl--) { if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) damageptr, sizeof *damageptr); - if (nhfp->fieldlevel) - sfo_damage(nhfp, damageptr, "damage", "damage", 1); } tmp_dam = damageptr; damageptr = damageptr->next; @@ -833,22 +732,14 @@ struct obj *otmp; bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); bwrite(nhfp->fd, (genericptr_t) otmp, buflen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &buflen, "obj", "obj_length", 1); - sfo_obj(nhfp, otmp, "obj", "obj", 1); - } if (otmp->oextra) { buflen = ONAME(otmp) ? (int) strlen(ONAME(otmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "oname_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ONAME(otmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, ONAME(otmp), "obj", "oname", buflen); } /* defer to savemon() for this one */ if (OMONST(otmp)) { @@ -856,43 +747,29 @@ struct obj *otmp; } else { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerobuf, sizeof zerobuf); - if (nhfp->fieldlevel) - sfo_int(nhfp, &zerobuf, "obj", "omonst_length", 1); } buflen = OMID(otmp) ? (int) sizeof (unsigned) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omid_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OMID(otmp), buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omid_length", 1); } /* TODO: post 3.6.x, get rid of this */ buflen = OLONG(otmp) ? (int) sizeof (long) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "olong_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OLONG(otmp), buflen); - if (nhfp->fieldlevel) - sfo_long(nhfp, OLONG(otmp), "obj", "olong", 1); } buflen = OMAILCMD(otmp) ? (int) strlen(OMAILCMD(otmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omailcmd_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OMAILCMD(otmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, OMAILCMD(otmp), "obj", "omailcmd", buflen); } } } @@ -943,8 +820,6 @@ register struct obj *otmp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "obj", "obj_length", 1); } } @@ -962,83 +837,53 @@ struct monst *mtmp; bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); bwrite(nhfp->fd, (genericptr_t) mtmp, buflen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &buflen, "mon", "monst_length", 1); - sfo_monst(nhfp, mtmp, "mon", "monst", 1); - } if (mtmp->mextra) { buflen = MNAME(mtmp) ? (int) strlen(MNAME(mtmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "mname_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) MNAME(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, MNAME(mtmp), "mon", "mname", buflen); } buflen = EGD(mtmp) ? (int) sizeof (struct egd) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "egd_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EGD(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_egd(nhfp, EGD(mtmp), "mon", "egd", 1); } buflen = EPRI(mtmp) ? (int) sizeof (struct epri) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "epri_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EPRI(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_epri(nhfp, EPRI(mtmp), "mon", "epri", 1); } buflen = ESHK(mtmp) ? (int) sizeof (struct eshk) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "eshk_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ESHK(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_eshk(nhfp, ESHK(mtmp), "mon", "eshk", 1); } buflen = EMIN(mtmp) ? (int) sizeof (struct emin) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "emin_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EMIN(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_emin(nhfp, EMIN(mtmp), "mon", "emin", 1); } buflen = EDOG(mtmp) ? (int) sizeof (struct edog) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "edog_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EDOG(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_edog(nhfp, EDOG(mtmp), "mon", "edog", 1); } /* mcorpsenm is inline int rather than pointer to something, so doesn't need to be preceded by a length field */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &MCORPSENM(mtmp), sizeof MCORPSENM(mtmp)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &MCORPSENM(mtmp), "mon", "mcorpsenm", 1); } } @@ -1073,8 +918,6 @@ register struct monst *mtmp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "mon", "monst_length", 1); } } @@ -1092,8 +935,6 @@ register struct trap *trap; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) trap, sizeof *trap); - if (nhfp->fieldlevel) - sfo_trap(nhfp, trap, "trap", "trap", 1); } if (release_data(nhfp)) dealloc_trap(trap); @@ -1102,8 +943,6 @@ register struct trap *trap; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerotrap, sizeof zerotrap); - if (nhfp->fieldlevel) - sfo_trap(nhfp, &zerotrap, "trap", "trap", 1); } } @@ -1125,8 +964,6 @@ NHFILE *nhfp; if (f1->fid >= 0 && perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) f1, sizeof *f1); - if (nhfp->fieldlevel) - sfo_fruit(nhfp, f1, "fruit", "fruit", 1); } if (release_data(nhfp)) dealloc_fruit(f1); @@ -1135,8 +972,6 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerofruit, sizeof zerofruit); - if (nhfp->fieldlevel) - sfo_fruit(nhfp, &zerofruit, "fruit", "terminator", 1); } if (release_data(nhfp)) g.ffruit = 0; @@ -1156,16 +991,12 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &cnt, sizeof cnt); - if (nhfp->fieldlevel) - sfo_int(nhfp, &cnt, "levchn", "lev_count", 1); } for (tmplev = g.sp_levchn; tmplev; tmplev = tmplev2) { tmplev2 = tmplev->next; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) tmplev, sizeof *tmplev); - if (nhfp->fieldlevel) - sfo_s_level(nhfp, tmplev, "levchn", "s_level", 1); } if (release_data(nhfp)) free((genericptr_t) tmplev); @@ -1187,10 +1018,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.plname, plsiztmp); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &plsiztmp, "plname", "plname_size", 1); - sfo_str(nhfp, g.plname, "plname", "g.plname", plsiztmp); - } return; } @@ -1218,16 +1045,10 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &msglen, sizeof msglen); bwrite(nhfp->fd, (genericptr_t) msg, msglen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &msglen, "msghistory", "msghistory_length", 1); - sfo_str(nhfp, msg, "msghistory", "msg", msglen); - } ++msgcount; } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "msghistory", "msghistory_length", 1); } debugpline1("Stored %d messages into savefile.", msgcount); /* note: we don't attempt to handle release_data() here */ @@ -1254,9 +1075,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &sfsaveinfo, (unsigned) sizeof sfsaveinfo); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - sfo_savefile_info(nhfp, &sfsaveinfo, "savefileinfo", "savefile_info", 1); - } return; } diff --git a/src/sfascii.c b/src/sfascii.c deleted file mode 100644 index 673d47342..000000000 --- a/src/sfascii.c +++ /dev/null @@ -1,1233 +0,0 @@ -/* NetHack 3.7 sfascii.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) Michael Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * this is a proof-of-concept alternative output format. It doesn't - * offer value over the sflendian approach and is mostly used to test - * and confirm that alternative saveformat operates correctly. - */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -#if defined(MACOSX) || defined(VMS) -extern long long FDECL(atoll, (const char *)); -#endif - -static void FDECL(put_savefield, (NHFILE *, char *, size_t)); -char *FDECL(get_savefield, (NHFILE *, char *, size_t)); -#ifdef SAVEFILE_DEBUGGING -void FDECL(report_problem_ascii, (NHFILE *, const char *, const char *, const char *)); -#endif - -struct sf_procs ascii_sfo_procs = { - ".tx", - { - ascii_sfo_aligntyp, - ascii_sfo_any, - ascii_sfo_bitfield, - ascii_sfo_boolean, - ascii_sfo_char, - ascii_sfo_genericptr, - ascii_sfo_int, - ascii_sfo_long, - ascii_sfo_schar, - ascii_sfo_short, - ascii_sfo_size_t, - ascii_sfo_time_t, - ascii_sfo_unsigned, - ascii_sfo_uchar, - ascii_sfo_uint, - ascii_sfo_ulong, - ascii_sfo_ushort, - ascii_sfo_xchar, - ascii_sfo_str, - ascii_sfo_addinfo, - } -}; - -struct sf_procs ascii_sfi_procs = -{ - ".tx", - { - ascii_sfi_aligntyp, - ascii_sfi_any, - ascii_sfi_bitfield, - ascii_sfi_boolean, - ascii_sfi_char, - ascii_sfi_genericptr, - ascii_sfi_int, - ascii_sfi_long, - ascii_sfi_schar, - ascii_sfi_short, - ascii_sfi_size_t, - ascii_sfi_time_t, - ascii_sfi_unsigned, - ascii_sfi_uchar, - ascii_sfi_uint, - ascii_sfi_ulong, - ascii_sfi_ushort, - ascii_sfi_xchar, - ascii_sfi_str, - ascii_sfi_addinfo, - } -}; - -static char linebuf[BUFSZ]; -static char outbuf[BUFSZ]; - -/* - *---------------------------------------------------------------------------- - * sfo_def_ routines - * - * Default output routines. - * - *---------------------------------------------------------------------------- - */ - -void -ascii_sfo_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - /* const char *parent = "any"; */ - - /* nhUse(parent); */ - Sprintf(outbuf, "%llx", (unsigned long long) d_any->a_void); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%lu", d_any->a_ulong); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%ld", d_any->a_long); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%d", d_any->a_uint); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%d", d_any->a_int);; - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%hd", (short) d_any->a_char); - put_savefield(nhfp, outbuf, BUFSZ); - -#if 0 - sfo_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); /* (genericptr_t) */ - sfo_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); /* (struct obj *) */ - sfo_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); /* (struct monst *) */ - sfo_int(nhfp, &d_any->a_int, parent, "a_int", 1); /* (int) */ - sfo_char(nhfp, &d_any->a_char, parent, "a_char", 1); /* (char) */ - sfo_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); /* (schar) */ - sfo_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); /* (uchar) */ - sfo_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); /* (unsigned int) */ - sfo_long(nhfp, &d_any->a_long, parent, "a_long", 1); /* (long) */ - sfo_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); /* (unsigned long) */ - sfo_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); /* (int *) */ - sfo_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); /* (long *) */ - sfo_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); /* (unsigned long *) */ - sfo_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); /* (unsigned *) */my - sfo_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); /* (const char *) */ - sfo_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); /* (unsigned long) */ -#endif -} - -void -ascii_sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - int itmp; -#if 0 - const char *parent = "aligntyp"; - - nhUse(parent); -#endif - itmp = (int) *d_aligntyp; - Sprintf(outbuf, "%d", (short) itmp); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ -#if 0 - const char *parent = "bitfield"; - - nhUse(parent); -#endif - /* for bitfields, cnt is the number of bits, not an array */ - Sprintf(outbuf, "%hu", (unsigned short) *d_bitfield); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "boolean"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (*d_boolean) ? "TRUE" : "FALSE"); - Sprintf(outbuf, "%s", *d_boolean ? "true" : "false"); - put_savefield(nhfp, outbuf, BUFSZ); - d_boolean++; - } -} - -void -ascii_sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i = cnt; -#if 0 - const char *parent = "char"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", d_char ? d_char : ""); - Sprintf(outbuf, "%hd", (short) *d_char); - put_savefield(nhfp, outbuf, BUFSZ); - d_char++; - } -} - -void -ascii_sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - unsigned long tmp; - char *byteptr = (char *) d_genericptr; -#if 0 - const char *parent = "genericptr"; - - nhUse(parent); -#endif - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of that array and perhaps zero or non-zero. - */ - for (i = 0; i < cnt; ++i) { - tmp = (*d_genericptr) ? 1UL : 0UL; - Sprintf(outbuf, "%08lu", tmp); - put_savefield(nhfp, outbuf, BUFSZ); - if (cnt > 1) { - byteptr += sizeof(void *); - d_genericptr = (genericptr_t) byteptr; - } - } -} - -void -ascii_sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "int"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%d", *d_int); - put_savefield(nhfp, outbuf, BUFSZ); - d_int++; - } -} - -void -ascii_sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "long"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%ld", *d_long); - put_savefield(nhfp, outbuf, BUFSZ); - d_long++; - } -} - -void -ascii_sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, itmp; -#if 0 - const char *parent = "schar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - itmp = (int) *d_schar; - Sprintf(outbuf, "%d", itmp); - put_savefield(nhfp, outbuf, BUFSZ); - d_schar++; - } -} - -void -ascii_sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "short"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%hd", *d_short); - put_savefield(nhfp, outbuf, BUFSZ); - d_short++; - } -} - -void -ascii_sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "size_t"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - unsigned long ul = (unsigned long) *d_size_t; - - Sprintf(outbuf, "%lu", ul); - put_savefield(nhfp, outbuf, BUFSZ); - d_size_t++; - } -} - -void -ascii_sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ -#if 0 - const char *parent = "time_t"; - - nhUse(parent); -#endif - Sprintf(outbuf, "%s", yyyymmddhhmmss(*d_time_t)); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - ascii_sfo_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -ascii_sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "uchar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - unsigned short us = (unsigned short) *d_uchar; - - Sprintf(outbuf, "%hu", us); - put_savefield(nhfp, outbuf, BUFSZ); - d_uchar++; - } -} - -void -ascii_sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "uint"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%u", *d_uint); - put_savefield(nhfp, outbuf, BUFSZ); - d_uint++; - } -} - -void -ascii_sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "ulong"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%lu", *d_ulong); - put_savefield(nhfp, outbuf, BUFSZ); - d_ulong++; - } -} - -void -ascii_sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "ushort"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%hu", *d_ushort); - put_savefield(nhfp, outbuf, BUFSZ); - d_ushort++; - } -} - -void -ascii_sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -#if 0 - const char *parent = "xchar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - short tmp; - - tmp = (short) *d_xchar; - Sprintf(outbuf, "%hu", tmp); - put_savefield(nhfp, outbuf, BUFSZ); - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -ascii_sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, intval; -#if 0 - const char *parent = "str"; -#endif - char sval[QBUFSZ], *src = d_str, *dest = strbuf; - -#if 0 - nhUse(parent); -#endif - /* cnt is the number of characters */ - for (i = 0; i < cnt; ++i) { - if ((*src < 32) || (*src == '\\') || (*src > 127)) { - *dest++ = '\\'; - intval = (int) *src++; - Sprintf(sval, "%03d", intval); - for (j = 0; j < 3; ++j) - *dest++ = sval[j]; - } else { - *dest++ = *src++; - } - } - put_savefield(nhfp, strbuf, BUFSZ * 4); -} - -void -ascii_sfo_addinfo(nhfp, parent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *parent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* ignored */ -} - - -static void -put_savefield(nhfp, obuf, outbufsz) -NHFILE *nhfp; -char *obuf; -size_t outbufsz UNUSED; -{ - nhfp->count++; - fprintf(nhfp->fpdef, "%07ld|%s\n", nhfp->count, obuf); -} - -/* - *---------------------------------------------------------------------------- - * ascii_sfi_ routines called from functions in sfi_base.c - *---------------------------------------------------------------------------- - */ - -void -ascii_sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - long long tmp; -#if 0 - const char *parent = "any"; - - nhUse(parent); -#endif - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_void = (void *) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_ulong = (unsigned long) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_long = atol(rstr); - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_uint = (unsigned int) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_int = atoi(rstr); - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_char = (char) atoi(rstr); - -#if 0 - sfi_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); - sfi_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); - sfi_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); - sfi_int(nhfp, &d_any->a_int, parent, "a_int", 1); - sfi_char(nhfp, &d_any->a_char, parent, "a_char", 1); - sfi_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); - sfi_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); - sfi_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); - sfi_long(nhfp, &d_any->a_long, parent, "a_long", 1); - sfi_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); - sfi_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); - sfi_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); - sfi_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); - sfi_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); - sfi_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); - sfi_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); -#endif -} - -void -ascii_sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - aligntyp tmp; - long long lltmp; -#if 0 - const char *parent = "aligntyp"; - - nhUse(parent); -#endif - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (aligntyp) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_aligntyp) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_aligntyp = tmp; -} - -void -ascii_sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - uint8_t tmp; -#if 0 - const char *parent = "bitfield"; - - nhUse(parent); -#endif - /* cnt is the number of bits in the bitfield, not an array dimension */ - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (uint8_t) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_bitfield) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_bitfield = tmp; -} - -void -ascii_sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - char *rstr; - int i; -#if 0 - const char *parent = "boolean"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); -#ifdef SAVEFILE_DEBUGGING - if (!strcmpi(rstr, "false") && - !strcmpi(rstr, "true")) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - if (!strcmpi(rstr, "false")) - *d_boolean = FALSE; - else - *d_boolean = TRUE; - d_boolean++; - } -} - -void -ascii_sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - char *rstr; - int i; - char tmp; -#if 0 - const char *parent = "char"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (char) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_char) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_char = tmp; - d_char++; - } -} - -void -ascii_sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - long long lltmp; - char *rstr; -#if 0 - const char *parent = "genericptr"; -#endif - static const char *glorkum = "glorkum"; - char *byteptr = (char *) d_genericptr; - -#if 0 - nhUse(parent); -#endif - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of that array. - */ - for (i = 0; i < cnt; ++i) { - /* these pointers can't actually be valid */ - byteptr = (char *) d_genericptr; - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - *d_genericptr = lltmp ? (genericptr_t) glorkum : (genericptr_t) 0; - if (cnt > 1) { - byteptr += sizeof(void *); - d_genericptr = (genericptr_t) byteptr; - } - } -} - -void -ascii_sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, tmp; - char *rstr; - long long lltmp; -#if 0 - const char *parent = "int"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (int) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_int) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_int = tmp; - d_int++; - } -} - -void -ascii_sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - long tmp; - long long lltmp; - char *rstr; -#if 0 - const char *parent = "long"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (long) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_long) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_long = tmp; - d_long++; - } -} - -void -ascii_sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - schar tmp; - char *rstr; -#if 0 - const char *parent = "schar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (schar) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_schar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_schar = tmp; - d_schar++; - } -} - -void -ascii_sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - short tmp; - char *rstr; -#if 0 - const char *parent = "short"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (short) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_short) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_short = tmp; - d_short++; - } -} - -void -ascii_sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - size_t tmp; - char *rstr; -#if 0 - const char *parent = "size_t"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (size_t) atol(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_size_t) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_size_t = tmp; - d_size_t++; - } -} - -void -ascii_sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - int i; - time_t tmp; - char *rstr; -#if 0 - const char *parent = "time_t"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = time_from_yyyymmddhhmmss(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_time_t) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_time_t = tmp; - d_time_t++; - } -} - -void -ascii_sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - /* deferal */ - ascii_sfi_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -ascii_sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - uchar tmp; - int i, itmp; - char *rstr; -#if 0 - const char *parent = "uchar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - itmp = atoi(rstr); - tmp = (char ) itmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_uchar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_uchar = tmp; - d_uchar++; - } -} - -void -ascii_sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - char *rstr; - unsigned int tmp; - long long lltmp; -#if 0 - const char *parent = "uint"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned int) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_uint) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_uint = tmp; - d_uint++; - } -} - -void -ascii_sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - unsigned long tmp; - long long lltmp; - char *rstr; -#if 0 - const char *parent = "ulong"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned long) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_ulong) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_ulong = tmp; - d_ulong++; - } -} - -void -ascii_sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - short tmp; - long long lltmp; - char *rstr; -#if 0 - const char *parent = "ushort"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned short) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_ushort) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_ushort = tmp; - d_ushort++; - } -} - -void -ascii_sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - xchar tmp; - int i, itmp; - char *rstr; -#if 0 - const char *parent = "xchar"; - - nhUse(parent); -#endif - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - itmp = atoi(rstr); - tmp = (xchar) itmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_xchar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_xchar = tmp; - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -ascii_sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, sval; - char n[4], *rstr; -#if 0 - const char *parent = "str"; -#endif - char *src, *dest; -#ifdef SAVEFILE_DEBUGGING - boolean match; - char testbuf[BUFSZ]; -#endif - -#if 0 - nhUse(parent); -#endif - /* cnt is the length of the string */ - rstr = get_savefield(nhfp, strbuf, BUFSZ * 4); - src = rstr; - dest = -#ifdef SAVEFILE_DEBUGGING - testbuf; -#else - d_str; -#endif - - for (i = 0; i < cnt; ++i) { - if (*src == '\\') { - src++; - for (j = 0; j < 4; ++j) { - if (j < 3) - n[j] = *src++; - else - n[j] = '\0'; - } - sval = atoi(n); - *dest++ = (char) sval; - } else - *dest++ = *src++; - } -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel) { - src = testbuf; - dest = d_str; - match = TRUE; - for (i = 0; i < cnt; ++i) { - if (*src++ != *dest++) - match = FALSE; - } - if (!match) - report_problem_ascii(nhfp, myparent, myname, parent); - else { - src = testbuf; - dest = d_str; - for (i = 0; i < cnt; ++i) - *dest++ = *src++; - } - } -#endif -} - -void -ascii_sfi_addinfo(nhfp, myparent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *myparent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* not doing anything here */ -} - -char * -get_savefield(nhfp, inbuf, inbufsz) -NHFILE *nhfp; -char *inbuf; -size_t inbufsz; -{ - char *ep, *sep; - - if (fgets(inbuf, (int) inbufsz, nhfp->fpdef)) { - nhfp->count++; - ep = index(inbuf, '\n'); - if (!ep) { /* newline missing */ - if (strlen(inbuf) < (inbufsz - 2)) { - /* likely the last line of file is just - missing a newline; process it anyway */ - ep = eos(inbuf); - } - } - if (ep) - *ep = '\0'; /* remove newline */ - sep = index(inbuf, '|'); - if (sep) - sep++; - - return sep; - } - inbuf[0] = '\0'; - nhfp->eof = TRUE; - return inbuf; -} - -#ifdef SAVEFILE_DEBUGGING -void -report_problem_ascii(nhfp, s1, s2, s3) -NHFILE *nhfp; -const char *s1, *s2, *s3; -{ - fprintf(nhfp->fpdebug, "faulty value preservation " - "(%ld, %s, %s, %s)\n", nhfp->count, s1, s2, s3); -} -#endif - - diff --git a/src/sfbase.c b/src/sfbase.c deleted file mode 100644 index 396bdd03c..000000000 --- a/src/sfbase.c +++ /dev/null @@ -1,646 +0,0 @@ -/* NetHack 3.7 sf_base.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) Michael Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -struct sf_procs sfoprocs[4], sfiprocs[4], - zerosfoprocs = {0}, zerosfiprocs = {0}; - -void FDECL(sfi_log, (NHFILE *, const char *, const char *, const char *, int)); - -/* - *---------------------------------------------------------------------------- - * initialize the function pointers. These are called from initoptions_init(). - *---------------------------------------------------------------------------- - */ - -void -sf_init() -{ - sfoprocs[invalid] = zerosfoprocs; - sfiprocs[invalid] = zerosfiprocs; - sfoprocs[historical] = zerosfoprocs; - sfiprocs[historical] = zerosfiprocs; - sfoprocs[lendian] = lendian_sfo_procs; - sfiprocs[lendian] = lendian_sfi_procs; - sfoprocs[ascii] = ascii_sfo_procs; - sfiprocs[ascii] = ascii_sfi_procs; -} - -/* - *---------------------------------------- - * routines called from engine core and - * from functions in generated sfdata.c - *---------------------------------------- - */ - -void -sfo_any(nhfp, d_any, myparent, myname, cnt) - NHFILE *nhfp; -union any *d_any; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_any)(nhfp, d_any, myparent, myname, cnt); -} - -void -sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_aligntyp)(nhfp, d_aligntyp, myparent, myname, cnt); -} - -void -sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_bitfield)(nhfp, d_bitfield, myparent, myname, cnt); -} - -void -sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_boolean)(nhfp, d_boolean, myparent, myname, cnt); -} - -void -sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_char)(nhfp, d_char, myparent, myname, cnt); -} - -void -sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t d_genericptr; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_genericptr)(nhfp, d_genericptr, myparent, myname, cnt); -} - -void -sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_int)(nhfp, d_int, myparent, myname, cnt); -} - -void -sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_long)(nhfp, d_long, myparent, myname, cnt); -} - -void -sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_schar)(nhfp, d_schar, myparent, myname, cnt); -} - -void -sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_short)(nhfp, d_short, myparent, myname, cnt); -} - -void -sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_size_t)(nhfp, d_size_t, myparent, myname, cnt); -} - -void -sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_time_t)(nhfp, d_time_t, myparent, myname, cnt); -} - -void -sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_unsigned)(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_uchar)(nhfp, d_uchar, myparent, myname, cnt); -} - -void -sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_uint)(nhfp, d_uint, myparent, myname, cnt); -} - -void -sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_ulong)(nhfp, d_ulong, myparent, myname, cnt); -} - -void -sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_ushort)(nhfp, d_ushort, myparent, myname, cnt); -} - -void -sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_xchar)(nhfp, d_xchar, myparent, myname, cnt); -} - -void -sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_str)(nhfp, d_str, myparent, myname, cnt); -} - -void -sfo_addinfo(nhfp, parent, action, myname, index) -NHFILE *nhfp; -const char *parent, *action, *myname; -int index; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_addinfo)(nhfp, parent, action, myname, index); -} - -/* - *---------------------------------------------------------------------------- - * routines called from core and from functions in generated sfi_data.c - *---------------------------------------------------------------------------- - */ - -void -sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "any"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_any)(nhfp, d_any, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%ld)\n", d_any->a_long); -#endif -} - -void -sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "aligntyp"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_aligntyp)(nhfp, d_aligntyp, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%d)\n", *d_aligntyp); -#endif -} - -void -sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bitfield"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_bitfield)(nhfp, d_bitfield, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", *d_bitfield); -#endif -} - -void -sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "boolean"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_boolean)(nhfp, d_boolean, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (*d_boolean) ? "true" : "false"); -#endif -} - -void -sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "char"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_char)(nhfp, d_char, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", d_char ? d_char : ""); -#endif -} - -void -sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t d_genericptr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "genericptr"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_genericptr)(nhfp, d_genericptr, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (d_genericptr) ? "set" : "null"); -#endif -} - -void -sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "int"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_int)(nhfp, d_int, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%d)\n", *d_int); -#endif -} - -void -sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "long"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_long)(nhfp, d_long, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%ld)\n", *d_long); -#endif -} - -void -sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "schar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_schar)(nhfp, d_schar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", (short) *d_schar); -#endif -} - -void -sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "short"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_short)(nhfp, d_short, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", *d_short); -#endif -} - -void -sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "size_t"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_size_t)(nhfp, d_size_t, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%lu)\n", (unsigned long) *d_size_t); -#endif -} - -void -sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "time_t"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_time_t)(nhfp, d_time_t, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", yyyymmddhhmmss(*d_time_t)); -#endif -} - -void -sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "unsigned"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_unsigned)(nhfp, d_unsigned, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%u)\n", *d_unsigned); -#endif -} - -void -sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "uchar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_uchar)(nhfp, d_uchar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hu)\n", (unsigned short) *d_uchar); -#endif -} - -void -sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "uint"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_uint)(nhfp, d_uint, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%u)\n", *d_uint); -#endif -} - -void -sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ulong"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_ulong)(nhfp, d_ulong, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%lu)\n", *d_ulong); -#endif -} - -void -sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ushort"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_ushort)(nhfp, d_ushort, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hu)\n", *d_ushort); -#endif -} - -void -sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "xchar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_xchar)(nhfp, d_xchar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", (short) *d_xchar); -#endif -} - -void -sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "str"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_str)(nhfp, d_str, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(\"%s\")\n", d_str); -#endif -} - -void -sfi_addinfo(nhfp, myparent, action, myname, index) -NHFILE *nhfp; -const char *myparent, *action, *myname; -int index; -{ - if (nhfp) { - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "# %s %s %s %d\n", myparent, action, myname, index); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - (void) fprintf(nhfp->fpdebug, "# %s %s %s %d\n", myparent, action, myname, index); -#endif - } - (*sfiprocs[nhfp->fnidx].fn.sf_addinfo)(nhfp, myparent, action, myname, index); -} - -void -sfi_log(nhfp, t1, t2, t3, cnt) -NHFILE *nhfp; -const char *t1, *t2, *t3; -int cnt; -{ -#ifdef DO_DEBUG -#ifdef SAVEFILE_DEBUGGING - if (nhfp) { - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "%s %s %s cnt=%d\n", t1, t2, t3, cnt); - if (nhfp->fpdebug) - (void) fprintf(nhfp->fpdebug, "%s %s %s cnt=%d ", t1, t2, t3, cnt); - } -#endif -#else - nhUse(nhfp); - nhUse(t1); - nhUse(t2); - nhUse(t3); - nhUse(cnt); -#endif -} - diff --git a/src/sfdata.c b/src/sfdata.c deleted file mode 100644 index b8e29d445..000000000 --- a/src/sfdata.c +++ /dev/null @@ -1,6052 +0,0 @@ -/* NetHack 3.7 sfdata.c */ -/* Copyright (c) NetHack Development Team 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */ - -#include "hack.h" -#include "artifact.h" -#include "func_tab.h" -#include "lev.h" -#include "integer.h" -#include "wintype.h" -#include "sfproto.h" - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 -struct nhdatatypes_t { - unsigned int dtclass; - char *dtype; - size_t dtsize; -}; - -static uint8_t bitfield = 0; - -void -sfo_align(nhfp, d_align, myparent, myname, cnt) -NHFILE *nhfp; -struct align *d_align; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "align"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "align", 1); - - sfo_aligntyp(nhfp, &d_align->type, parent, "type", 1); /* (aligntyp) */ - sfo_int(nhfp, &d_align->record, parent, "record", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "align", 1); -} - -void -sfo_attribs(nhfp, d_attribs, myparent, myname, cnt) -NHFILE *nhfp; -struct attribs *d_attribs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "attribs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "attribs", 1); - - sfo_schar(nhfp, d_attribs->a, parent, "a", A_MAX); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "attribs", 1); -} - -void -sfo_bill_x(nhfp, d_bill_x, myparent, myname, cnt) -NHFILE *nhfp; -struct bill_x *d_bill_x; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bill_x"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "bill_x", 1); - - sfo_unsigned(nhfp, &d_bill_x->bo_id, parent, "bo_id", 1); /* (unsigned) */ - sfo_boolean(nhfp, &d_bill_x->useup, parent, "useup", 1); /* (boolean) */ - sfo_long(nhfp, &d_bill_x->price, parent, "price", 1); /* (long) */ - sfo_long(nhfp, &d_bill_x->bquan, parent, "bquan", 1); /* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "bill_x", 1); -} - -void -sfo_book_info(nhfp, d_book_info, myparent, myname, cnt) -NHFILE *nhfp; -struct book_info *d_book_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "book_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "book_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_book_info->book, parent, "book", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_book_info->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_schar(nhfp, &d_book_info->delay, parent, "delay", 1); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "book_info", 1); -} - -void -sfo_branch(nhfp, d_branch, myparent, myname, cnt) -NHFILE *nhfp; -struct branch *d_branch; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "branch"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "branch", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_branch->next, parent, "next", 1);/* (struct branch *) */ - sfo_int(nhfp, &d_branch->id, parent, "id", 1); /* (int) */ - sfo_int(nhfp, &d_branch->type, parent, "type", 1); /* (int) */ - sfo_d_level(nhfp, &d_branch->end1, parent, "end1", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_branch->end2, parent, "end2", 1); /* (d_level) */ - sfo_boolean(nhfp, &d_branch->end1_up, parent, "end1_up", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "branch", 1); -} - -void -sfo_bubble(nhfp, d_bubble, myparent, myname, cnt) -NHFILE *nhfp; -struct bubble *d_bubble; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bubble"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "bubble", 1); - - sfo_xchar(nhfp, &d_bubble->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_bubble->y, parent, "y", 1); /* (xchar) */ - sfo_schar(nhfp, &d_bubble->dx, parent, "dx", 1); /* (schar) */ - sfo_schar(nhfp, &d_bubble->dy, parent, "dy", 1); /* (schar) */ - sfo_uchar(nhfp, d_bubble->bm, parent, "bm", MAX_BMASK + 2); /* (uchar) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->prev, parent, "prev", 1);/* (struct bubble *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->next, parent, "next", 1);/* (struct bubble *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->cons, parent, "cons", 1);/* (struct container *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "bubble", 1); -} - -void -sfo_cemetery(nhfp, d_cemetery, myparent, myname, cnt) -NHFILE *nhfp; -struct cemetery *d_cemetery; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "cemetery"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "cemetery", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_cemetery->next, parent, "next", 1);/* (struct cemetery *) */ - sfo_char(nhfp, d_cemetery->who, parent, "who", PL_NSIZ + 4 * (1 + 3) + 1);/* (char) */ - sfo_char(nhfp, d_cemetery->how, parent, "how", 100 + 1); /* (char) */ - sfo_char(nhfp, d_cemetery->when, parent, "when", 4 + 2 + 2 + 2 + 2 + 2 + 1);/* (char) */ - sfo_schar(nhfp, &d_cemetery->frpx, parent, "frpx", 1); /* (schar) */ - sfo_schar(nhfp, &d_cemetery->frpy, parent, "frpy", 1); /* (schar) */ - sfo_boolean(nhfp, &d_cemetery->bonesknown, parent, "bonesknown", 1);/* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "cemetery", 1); -} - -void -sfo_context_info(nhfp, d_context_info, myparent, myname, cnt) -NHFILE *nhfp; -struct context_info *d_context_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "context_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "context_info", 1); - - sfo_unsigned(nhfp, &d_context_info->ident, parent, "ident", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->no_of_wizards, parent, "no_of_wizards", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->run, parent, "run", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->startingpet_mid, parent, "startingpet_mid", 1);/* (unsigned) */ - sfo_int(nhfp, &d_context_info->current_fruit, parent, "current_fruit", 1);/* (int) */ - sfo_int(nhfp, &d_context_info->warnlevel, parent, "warnlevel", 1);/* (int) */ - sfo_int(nhfp, &d_context_info->rndencode, parent, "rndencode", 1);/* (int) */ - sfo_long(nhfp, &d_context_info->next_attrib_check, parent, "next_attrib_check", 1);/* (long) */ - sfo_long(nhfp, &d_context_info->stethoscope_move, parent, "stethoscope_move", 1);/* (long) */ - sfo_short(nhfp, &d_context_info->stethoscope_movement, parent, "stethoscope_movement", 1);/* (short) */ - sfo_boolean(nhfp, &d_context_info->travel, parent, "travel", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->travel1, parent, "travel1", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->forcefight, parent, "forcefight", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->nopick, parent, "nopick", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->made_amulet, parent, "made_amulet", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->mon_moving, parent, "mon_moving", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->move, parent, "move", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->mv, parent, "mv", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->bypasses, parent, "bypasses", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->botl, parent, "botl", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->botlx, parent, "botlx", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->door_opened, parent, "door_opened", 1);/* (boolean) */ - sfo_dig_info(nhfp, &d_context_info->digging, parent, "digging", 1);/* (dig_info) */ - sfo_victual_info(nhfp, &d_context_info->victual, parent, "victual", 1);/* (victual_info) */ - sfo_tin_info(nhfp, &d_context_info->tin, parent, "tin", 1); /* (tin_info) */ - sfo_book_info(nhfp, &d_context_info->spbook, parent, "spbook", 1);/* (book_info) */ - sfo_takeoff_info(nhfp, &d_context_info->takeoff, parent, "takeoff", 1);/* (takeoff_info) */ - sfo_warntype_info(nhfp, &d_context_info->warntype, parent, "warntype", 1);/* (warntype_info) */ - sfo_polearm_info(nhfp, &d_context_info->polearm, parent, "polearm", 1);/* (polearm_info) */ - sfo_obj_split(nhfp, &d_context_info->objsplit, parent, "objsplit", 1);/* (obj_split) */ - sfo_tribute_info(nhfp, &d_context_info->tribute, parent, "tribute", 1);/* (tribute_info) */ - sfo_novel_tracking(nhfp, &d_context_info->novel, parent, "novel", 1);/* (novel_tracking) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "context_info", 1); -} - -void -sfo_d_flags(nhfp, d_d_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct d_flags *d_d_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "d_flags", 1); - - bitfield = d_d_flags->town; /* (Bitfield(town, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "town", 1); - bitfield = d_d_flags->hellish; /* (Bitfield(hellish, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hellish", 1); - bitfield = d_d_flags->maze_like; /* (Bitfield(maze_like, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "maze_like", 1); - bitfield = d_d_flags->rogue_like; /* (Bitfield(rogue_like, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "rogue_like", 1); - bitfield = d_d_flags->align; /* (Bitfield(align, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "align", 3); - bitfield = d_d_flags->unused; /* (Bitfield(unused, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "d_flags", 1); -} - -void -sfo_d_level(nhfp, d_d_level, myparent, myname, cnt) -NHFILE *nhfp; -struct d_level *d_d_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "d_level", 1); - - sfo_xchar(nhfp, &d_d_level->dnum, parent, "dnum", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_d_level->dlevel, parent, "dlevel", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "d_level", 1); -} - -void -sfo_damage(nhfp, d_damage, myparent, myname, cnt) -NHFILE *nhfp; -struct damage *d_damage; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "damage"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "damage", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_damage->next, parent, "next", 1);/* (struct damage *) */ - sfo_long(nhfp, &d_damage->when, parent, "when", 1); /* (long) */ - sfo_long(nhfp, &d_damage->cost, parent, "cost", 1); /* (long) */ - sfo_nhcoord(nhfp, &d_damage->place, parent, "place", 1); /* (nhcoord) */ - sfo_schar(nhfp, &d_damage->typ, parent, "typ", 1); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "damage", 1); -} - -void -sfo_dest_area(nhfp, d_dest_area, myparent, myname, cnt) -NHFILE *nhfp; -struct dest_area *d_dest_area; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dest_area"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dest_area", 1); - - sfo_xchar(nhfp, &d_dest_area->lx, parent, "lx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->ly, parent, "ly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->hx, parent, "hx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->hy, parent, "hy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nlx, parent, "nlx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nly, parent, "nly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nhx, parent, "nhx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nhy, parent, "nhy", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dest_area", 1); -} - -void -sfo_dgn_topology(nhfp, d_dgn_topology, myparent, myname, cnt) -NHFILE *nhfp; -struct dgn_topology *d_dgn_topology; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dgn_topology"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dgn_topology", 1); - - sfo_d_level(nhfp, &d_dgn_topology->d_oracle_level, parent, "d_oracle_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_bigroom_level, parent, "d_bigroom_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_rogue_level, parent, "d_rogue_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_medusa_level, parent, "d_medusa_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_stronghold_level, parent, "d_stronghold_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_valley_level, parent, "d_valley_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz1_level, parent, "d_wiz1_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz2_level, parent, "d_wiz2_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz3_level, parent, "d_wiz3_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_juiblex_level, parent, "d_juiblex_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_orcus_level, parent, "d_orcus_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_baalzebub_level, parent, "d_baalzebub_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_asmodeus_level, parent, "d_asmodeus_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_portal_level, parent, "d_portal_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_sanctum_level, parent, "d_sanctum_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_earth_level, parent, "d_earth_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_water_level, parent, "d_water_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_fire_level, parent, "d_fire_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_air_level, parent, "d_air_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_astral_level, parent, "d_astral_level", 1);/* (d_level) */ - sfo_xchar(nhfp, &d_dgn_topology->d_tower_dnum, parent, "d_tower_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_sokoban_dnum, parent, "d_sokoban_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_mines_dnum, parent, "d_mines_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_quest_dnum, parent, "d_quest_dnum", 1);/* (xchar) */ - sfo_d_level(nhfp, &d_dgn_topology->d_qstart_level, parent, "d_qstart_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_qlocate_level, parent, "d_qlocate_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_nemesis_level, parent, "d_nemesis_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_knox_level, parent, "d_knox_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_mineend_level, parent, "d_mineend_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_sokoend_level, parent, "d_sokoend_level", 1);/* (d_level) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dgn_topology", 1); -} - -void -sfo_dig_info(nhfp, d_dig_info, myparent, myname, cnt) -NHFILE *nhfp; -struct dig_info *d_dig_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dig_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dig_info", 1); - - sfo_int(nhfp, &d_dig_info->effort, parent, "effort", 1); /* (int) */ - sfo_d_level(nhfp, &d_dig_info->level, parent, "level", 1); /* (d_level) */ - sfo_nhcoord(nhfp, &d_dig_info->pos, parent, "pos", 1); /* (nhcoord) */ - sfo_long(nhfp, &d_dig_info->lastdigtime, parent, "lastdigtime", 1);/* (long) */ - sfo_boolean(nhfp, &d_dig_info->down, parent, "down", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->chew, parent, "chew", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->warned, parent, "warned", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->quiet, parent, "quiet", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dig_info", 1); -} - -void -sfo_dungeon(nhfp, d_dungeon, myparent, myname, cnt) -NHFILE *nhfp; -struct dungeon *d_dungeon; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dungeon"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dungeon", 1); - - sfo_char(nhfp, d_dungeon->dname, parent, "dname", 24); /* (char) */ - sfo_char(nhfp, d_dungeon->proto, parent, "proto", 15); /* (char) */ - sfo_char(nhfp, &d_dungeon->boneid, parent, "boneid", 1); /* (char) */ - sfo_d_flags(nhfp, &d_dungeon->flags, parent, "flags", 1); /* (d_flags) */ - sfo_xchar(nhfp, &d_dungeon->entry_lev, parent, "entry_lev", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dungeon->num_dunlevs, parent, "num_dunlevs", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dungeon->dunlev_ureached, parent, "dunlev_ureached", 1);/* (xchar) */ - sfo_int(nhfp, &d_dungeon->ledger_start, parent, "ledger_start", 1);/* (int) */ - sfo_int(nhfp, &d_dungeon->depth_start, parent, "depth_start", 1);/* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dungeon", 1); -} - -void -sfo_edog(nhfp, d_edog, myparent, myname, cnt) -NHFILE *nhfp; -struct edog *d_edog; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "edog"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "edog", 1); - - sfo_long(nhfp, &d_edog->droptime, parent, "droptime", 1); /* (long) */ - sfo_unsigned(nhfp, &d_edog->dropdist, parent, "dropdist", 1);/* (unsigned) */ - sfo_int(nhfp, &d_edog->apport, parent, "apport", 1); /* (int) */ - sfo_long(nhfp, &d_edog->whistletime, parent, "whistletime", 1);/* (long) */ - sfo_long(nhfp, &d_edog->hungrytime, parent, "hungrytime", 1);/* (long) */ - sfo_nhcoord(nhfp, &d_edog->ogoal, parent, "ogoal", 1); /* (nhcoord) */ - sfo_int(nhfp, &d_edog->abuse, parent, "abuse", 1); /* (int) */ - sfo_int(nhfp, &d_edog->revivals, parent, "revivals", 1); /* (int) */ - sfo_int(nhfp, &d_edog->mhpmax_penalty, parent, "mhpmax_penalty", 1);/* (int) */ - bitfield = d_edog->killed_by_u; /* (Bitfield(killed_by_u, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_by_u", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "edog", 1); -} - -void -sfo_egd(nhfp, d_egd, myparent, myname, cnt) -NHFILE *nhfp; -struct egd *d_egd; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "egd"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "egd", 1); - - sfo_int(nhfp, &d_egd->fcbeg, parent, "fcbeg", 1); /* (int) */ - sfo_int(nhfp, &d_egd->fcend, parent, "fcend", 1); /* (int) */ - sfo_int(nhfp, &d_egd->vroom, parent, "vroom", 1); /* (int) */ - sfo_xchar(nhfp, &d_egd->gdx, parent, "gdx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->gdy, parent, "gdy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->ogx, parent, "ogx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->ogy, parent, "ogy", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_egd->gdlevel, parent, "gdlevel", 1); /* (d_level) */ - sfo_xchar(nhfp, &d_egd->warncnt, parent, "warncnt", 1); /* (xchar) */ - bitfield = d_egd->gddone; /* (Bitfield(gddone, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "gddone", 1); - bitfield = d_egd->witness; /* (Bitfield(witness, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "witness", 2); - bitfield = d_egd->unused; /* (Bitfield(unused, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 5); - for (i = 0; i < FCSIZ; ++i) - sfo_fakecorridor(nhfp, &d_egd->fakecorr[i], parent, "fakecorr", 1);/* (fakecorridor) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "egd", 1); -} - -void -sfo_emin(nhfp, d_emin, myparent, myname, cnt) -NHFILE *nhfp; -struct emin *d_emin; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "emin"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "emin", 1); - - sfo_aligntyp(nhfp, &d_emin->min_align, parent, "min_align", 1);/* (aligntyp) */ - sfo_boolean(nhfp, &d_emin->renegade, parent, "renegade", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "emin", 1); -} - -void -sfo_engr(nhfp, d_engr, myparent, myname, cnt) -NHFILE *nhfp; -struct engr *d_engr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "engr"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "engr", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_engr->nxt_engr, parent, "nxt_engr", 1);/* (struct engr *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_engr->engr_txt, parent, "engr_txt", 1);/* (char *) */ - sfo_xchar(nhfp, &d_engr->engr_x, parent, "engr_x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_engr->engr_y, parent, "engr_y", 1); /* (xchar) */ - sfo_unsigned(nhfp, &d_engr->engr_lth, parent, "engr_lth", 1);/* (unsigned) */ - sfo_long(nhfp, &d_engr->engr_time, parent, "engr_time", 1); /* (long) */ - sfo_xchar(nhfp, &d_engr->engr_type, parent, "engr_type", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "engr", 1); -} - -void -sfo_epri(nhfp, d_epri, myparent, myname, cnt) -NHFILE *nhfp; -struct epri *d_epri; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "epri"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "epri", 1); - - sfo_aligntyp(nhfp, &d_epri->shralign, parent, "shralign", 1);/* (aligntyp) */ - sfo_schar(nhfp, &d_epri->shroom, parent, "shroom", 1); /* (schar) */ - sfo_nhcoord(nhfp, &d_epri->shrpos, parent, "shrpos", 1); /* (nhcoord) */ - sfo_d_level(nhfp, &d_epri->shrlevel, parent, "shrlevel", 1); /* (d_level) */ - sfo_long(nhfp, &d_epri->intone_time, parent, "intone_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->enter_time, parent, "enter_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->hostile_time, parent, "hostile_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->peaceful_time, parent, "peaceful_time", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "epri", 1); -} - -void -sfo_eshk(nhfp, d_eshk, myparent, myname, cnt) -NHFILE *nhfp; -struct eshk *d_eshk; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "eshk"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "eshk", 1); - - sfo_long(nhfp, &d_eshk->robbed, parent, "robbed", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->credit, parent, "credit", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->debit, parent, "debit", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->loan, parent, "loan", 1); /* (long) */ - sfo_int(nhfp, &d_eshk->shoptype, parent, "shoptype", 1); /* (int) */ - sfo_schar(nhfp, &d_eshk->shoproom, parent, "shoproom", 1); /* (schar) */ - sfo_schar(nhfp, &d_eshk->unused, parent, "unused", 1); /* (schar) */ - sfo_boolean(nhfp, &d_eshk->following, parent, "following", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_eshk->surcharge, parent, "surcharge", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_eshk->dismiss_kops, parent, "dismiss_kops", 1);/* (boolean) */ - sfo_nhcoord(nhfp, &d_eshk->shk, parent, "shk", 1); /* (nhcoord) */ - sfo_nhcoord(nhfp, &d_eshk->shd, parent, "shd", 1); /* (nhcoord) */ - sfo_d_level(nhfp, &d_eshk->shoplevel, parent, "shoplevel", 1);/* (d_level) */ - sfo_int(nhfp, &d_eshk->billct, parent, "billct", 1); /* (int) */ - for (i = 0; i < BILLSZ; ++i) - sfo_bill_x(nhfp, &d_eshk->bill[i], parent, "bill", 1); /* (bill_x) */ - sfo_genericptr(nhfp, (genericptr_t) &d_eshk->bill_p, parent, "bill_p", 1);/* (struct bill_x *) */ - sfo_int(nhfp, &d_eshk->visitct, parent, "visitct", 1); /* (int) */ - sfo_char(nhfp, d_eshk->customer, parent, "customer", PL_NSIZ);/* (char) */ - sfo_char(nhfp, d_eshk->shknam, parent, "shknam", PL_NSIZ); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "eshk", 1); -} - -void -sfo_fakecorridor(nhfp, d_fakecorridor, myparent, myname, cnt) -NHFILE *nhfp; -struct fakecorridor *d_fakecorridor; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fakecorridor"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fakecorridor", 1); - - sfo_xchar(nhfp, &d_fakecorridor->fx, parent, "fx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_fakecorridor->fy, parent, "fy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_fakecorridor->ftyp, parent, "ftyp", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fakecorridor", 1); -} - -void -sfo_fe(nhfp, d_fe, myparent, myname, cnt) -NHFILE *nhfp; -struct fe *d_fe; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fe"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fe", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_fe->next, parent, "next", 1);/* (struct fe *) */ - sfo_long(nhfp, &d_fe->timeout, parent, "timeout", 1); /* (long) */ - sfo_ulong(nhfp, &d_fe->tid, parent, "tid", 1); /* (unsigned long) */ - sfo_short(nhfp, &d_fe->kind, parent, "kind", 1); /* (short) */ - sfo_short(nhfp, &d_fe->func_index, parent, "func_index", 1); /* (short) */ - sfo_any(nhfp, &d_fe->arg, parent, "arg", 1); /* (any) */ - bitfield = d_fe->needs_fixup; /* (Bitfield(needs_fixup, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "needs_fixup", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fe", 1); -} - -void -sfo_flag(nhfp, d_flag, myparent, myname, cnt) -NHFILE *nhfp; -struct flag *d_flag; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "flag"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "flag", 1); - - sfo_boolean(nhfp, &d_flag->acoustics, parent, "acoustics", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->autodig, parent, "autodig", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->autoquiver, parent, "autoquiver", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->autoopen, parent, "autoopen", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->beginner, parent, "beginner", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->biff, parent, "biff", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->bones, parent, "bones", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->confirm, parent, "confirm", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->dark_room, parent, "dark_room", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->debug, parent, "debug", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->end_own, parent, "end_own", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->explore, parent, "explore", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->female, parent, "female", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->friday13, parent, "friday13", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->goldX, parent, "goldX", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->help, parent, "help", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->ignintr, parent, "ignintr", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->ins_chkpt, parent, "ins_chkpt", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->invlet_constant, parent, "invlet_constant", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->legacy, parent, "legacy", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->lit_corridor, parent, "lit_corridor", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->nap, parent, "nap", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->null, parent, "null", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->pickup, parent, "pickup", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->pickup_thrown, parent, "pickup_thrown", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->pushweapon, parent, "pushweapon", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->rest_on_space, parent, "rest_on_space", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->safe_dog, parent, "safe_dog", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showexp, parent, "showexp", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showscore, parent, "showscore", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->silent, parent, "silent", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->sortpack, parent, "sortpack", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->sparkle, parent, "sparkle", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->standout, parent, "standout", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->time, parent, "time", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->tombstone, parent, "tombstone", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->verbose, parent, "verbose", 1); /* (boolean) */ - sfo_int(nhfp, &d_flag->end_top, parent, "end_top", 1); /* (int) */ - sfo_int(nhfp, &d_flag->end_around, parent, "end_around", 1); /* (int) */ - sfo_unsigned(nhfp, &d_flag->moonphase, parent, "moonphase", 1);/* (unsigned) */ - sfo_ulong(nhfp, &d_flag->suppress_alert, parent, "suppress_alert", 1);/* (unsigned long) */ - sfo_unsigned(nhfp, &d_flag->paranoia_bits, parent, "paranoia_bits", 1);/* (unsigned) */ - sfo_int(nhfp, &d_flag->pickup_burden, parent, "pickup_burden", 1);/* (int) */ - sfo_int(nhfp, &d_flag->pile_limit, parent, "pile_limit", 1); /* (int) */ - sfo_char(nhfp, &d_flag->sortloot, parent, "sortloot", 1); /* (char) */ - sfo_char(nhfp, d_flag->inv_order, parent, "inv_order", MAXOCLASSES);/* (char) */ - sfo_char(nhfp, d_flag->pickup_types, parent, "pickup_types", MAXOCLASSES);/* (char) */ - sfo_char(nhfp, d_flag->end_disclose, parent, "end_disclose", NUM_DISCLOSURE_OPTIONS + 1);/* (char) */ - sfo_char(nhfp, &d_flag->menu_style, parent, "menu_style", 1);/* (char) */ - sfo_boolean(nhfp, &d_flag->made_fruit, parent, "made_fruit", 1);/* (boolean) */ - sfo_int(nhfp, &d_flag->initrole, parent, "initrole", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initrace, parent, "initrace", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initgend, parent, "initgend", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initalign, parent, "initalign", 1); /* (int) */ - sfo_int(nhfp, &d_flag->randomall, parent, "randomall", 1); /* (int) */ - sfo_int(nhfp, &d_flag->pantheon, parent, "pantheon", 1); /* (int) */ - sfo_boolean(nhfp, &d_flag->lootabc, parent, "lootabc", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showrace, parent, "showrace", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->travelcmd, parent, "travelcmd", 1);/* (boolean) */ - sfo_int(nhfp, &d_flag->runmode, parent, "runmode", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "flag", 1); -} - -void -sfo_fruit(nhfp, d_fruit, myparent, myname, cnt) -NHFILE *nhfp; -struct fruit *d_fruit; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fruit"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fruit", 1); - - sfo_char(nhfp, d_fruit->fname, parent, "fname", PL_FSIZ); /* (char) */ - sfo_int(nhfp, &d_fruit->fid, parent, "fid", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_fruit->nextf, parent, "nextf", 1);/* (struct fruit *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fruit", 1); -} - -void -sfo_kinfo(nhfp, d_kinfo, myparent, myname, cnt) -NHFILE *nhfp; -struct kinfo *d_kinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "kinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "kinfo", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_kinfo->next, parent, "next", 1);/* (struct kinfo *) */ - sfo_int(nhfp, &d_kinfo->id, parent, "id", 1); /* (int) */ - sfo_int(nhfp, &d_kinfo->format, parent, "format", 1); /* (int) */ - sfo_char(nhfp, d_kinfo->name, parent, "name", BUFSZ); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "kinfo", 1); -} - -void -sfo_levelflags(nhfp, d_levelflags, myparent, myname, cnt) -NHFILE *nhfp; -struct levelflags *d_levelflags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "levelflags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "levelflags", 1); - - sfo_uchar(nhfp, &d_levelflags->nfountains, parent, "nfountains", 1);/* (uchar) */ - sfo_uchar(nhfp, &d_levelflags->nsinks, parent, "nsinks", 1); /* (uchar) */ - bitfield = d_levelflags->has_shop; /* (Bitfield(has_shop, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_shop", 1); - bitfield = d_levelflags->has_vault; /* (Bitfield(has_vault, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_vault", 1); - bitfield = d_levelflags->has_zoo; /* (Bitfield(has_zoo, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_zoo", 1); - bitfield = d_levelflags->has_court; /* (Bitfield(has_court, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_court", 1); - bitfield = d_levelflags->has_morgue; /* (Bitfield(has_morgue, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_morgue", 1); - bitfield = d_levelflags->has_beehive; /* (Bitfield(has_beehive, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_beehive", 1); - bitfield = d_levelflags->has_barracks; /* (Bitfield(has_barracks, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_barracks", 1); - bitfield = d_levelflags->has_temple; /* (Bitfield(has_temple, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_temple", 1); - bitfield = d_levelflags->has_swamp; /* (Bitfield(has_swamp, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_swamp", 1); - bitfield = d_levelflags->noteleport; /* (Bitfield(noteleport, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "noteleport", 1); - bitfield = d_levelflags->hardfloor; /* (Bitfield(hardfloor, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hardfloor", 1); - bitfield = d_levelflags->nommap; /* (Bitfield(nommap, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nommap", 1); - bitfield = d_levelflags->hero_memory; /* (Bitfield(hero_memory, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hero_memory", 1); - bitfield = d_levelflags->shortsighted; /* (Bitfield(shortsighted, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "shortsighted", 1); - bitfield = d_levelflags->graveyard; /* (Bitfield(graveyard, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "graveyard", 1); - bitfield = d_levelflags->sokoban_rules; /* (Bitfield(sokoban_rules, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "sokoban_rules", 1); - bitfield = d_levelflags->is_maze_lev; /* (Bitfield(is_maze_lev, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "is_maze_lev", 1); - bitfield = d_levelflags->is_cavernous_lev; /* (Bitfield(is_cavernous_lev, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "is_cavernous_lev", 1); - bitfield = d_levelflags->arboreal; /* (Bitfield(arboreal, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "arboreal", 1); - bitfield = d_levelflags->wizard_bones; /* (Bitfield(wizard_bones, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "wizard_bones", 1); - bitfield = d_levelflags->corrmaze; /* (Bitfield(corrmaze, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "corrmaze", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "levelflags", 1); -} - -void -sfo_linfo(nhfp, d_linfo, myparent, myname, cnt) -NHFILE *nhfp; -struct linfo *d_linfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "linfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "linfo", 1); - - sfo_uchar(nhfp, &d_linfo->flags, parent, "flags", 1); /* (unsigned char) */ -#ifdef MFLOPPY - sfo_int(nhfp, &d_linfo->where, parent, "where", 1); /* (int) */ - sfo_long(nhfp, &d_linfo->time, parent, "time", 1); /* (long) */ - sfo_long(nhfp, &d_linfo->size, parent, "size", 1); /* (long) */ -#endif /*MFLOPPY*/ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "linfo", 1); -} - -void -sfo_ls_t(nhfp, d_ls_t, myparent, myname, cnt) -NHFILE *nhfp; -struct ls_t *d_ls_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ls_t"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "ls_t", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_ls_t->next, parent, "next", 1);/* (struct ls_t *) */ - sfo_xchar(nhfp, &d_ls_t->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_ls_t->y, parent, "y", 1); /* (xchar) */ - sfo_short(nhfp, &d_ls_t->range, parent, "range", 1); /* (short) */ - sfo_short(nhfp, &d_ls_t->flags, parent, "flags", 1); /* (short) */ - sfo_short(nhfp, &d_ls_t->type, parent, "type", 1); /* (short) */ - sfo_any(nhfp, &d_ls_t->id, parent, "id", 1); /* (any) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "ls_t", 1); -} - -void -sfo_mapseen_feat(nhfp, d_mapseen_feat, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_feat *d_mapseen_feat; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_feat"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_feat", 1); - - bitfield = d_mapseen_feat->nfount; /* (Bitfield(nfount, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nfount", 2); - bitfield = d_mapseen_feat->nsink; /* (Bitfield(nsink, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nsink", 2); - bitfield = d_mapseen_feat->naltar; /* (Bitfield(naltar, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "naltar", 2); - bitfield = d_mapseen_feat->nthrone; /* (Bitfield(nthrone, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nthrone", 2); - bitfield = d_mapseen_feat->ngrave; /* (Bitfield(ngrave, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ngrave", 2); - bitfield = d_mapseen_feat->ntree; /* (Bitfield(ntree, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ntree", 2); - bitfield = d_mapseen_feat->water; /* (Bitfield(water, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "water", 2); - bitfield = d_mapseen_feat->lava; /* (Bitfield(lava, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lava", 2); - bitfield = d_mapseen_feat->ice; /* (Bitfield(ice, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ice", 2); - bitfield = d_mapseen_feat->nshop; /* (Bitfield(nshop, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nshop", 2); - bitfield = d_mapseen_feat->ntemple; /* (Bitfield(ntemple, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ntemple", 2); - bitfield = d_mapseen_feat->msalign; /* (Bitfield(msalign, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msalign", 2); - bitfield = d_mapseen_feat->shoptype; /* (Bitfield(shoptype, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "shoptype", 5); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_feat", 1); -} - -void -sfo_mapseen_flags(nhfp, d_mapseen_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_flags *d_mapseen_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_flags", 1); - - bitfield = d_mapseen_flags->unreachable; /* (Bitfield(unreachable, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unreachable", 1); - bitfield = d_mapseen_flags->forgot; /* (Bitfield(forgot, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "forgot", 1); - bitfield = d_mapseen_flags->knownbones; /* (Bitfield(knownbones, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "knownbones", 1); - bitfield = d_mapseen_flags->oracle; /* (Bitfield(oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oracle", 1); - bitfield = d_mapseen_flags->sokosolved; /* (Bitfield(sokosolved, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "sokosolved", 1); - bitfield = d_mapseen_flags->bigroom; /* (Bitfield(bigroom, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bigroom", 1); - bitfield = d_mapseen_flags->castle; /* (Bitfield(castle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "castle", 1); - bitfield = d_mapseen_flags->castletune; /* (Bitfield(castletune, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "castletune", 1); - bitfield = d_mapseen_flags->valley; /* (Bitfield(valley, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "valley", 1); - bitfield = d_mapseen_flags->msanctum; /* (Bitfield(msanctum, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msanctum", 1); - bitfield = d_mapseen_flags->ludios; /* (Bitfield(ludios, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ludios", 1); - bitfield = d_mapseen_flags->roguelevel; /* (Bitfield(roguelevel, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "roguelevel", 1); - bitfield = d_mapseen_flags->quest_summons; /* (Bitfield(quest_summons, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "quest_summons", 1); - bitfield = d_mapseen_flags->questing; /* (Bitfield(questing, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "questing", 1); - bitfield = d_mapseen_flags->vibrating_square; /* (Bitfield(vibrating_square, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "vibrating_square", 1); - bitfield = d_mapseen_flags->spare1; /* (Bitfield(spare1, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "spare1", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_flags", 1); -} - -void -sfo_mapseen_rooms(nhfp, d_mapseen_rooms, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_rooms *d_mapseen_rooms; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_rooms"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_rooms", 1); - - bitfield = d_mapseen_rooms->seen; /* (Bitfield(seen, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "seen", 1); - bitfield = d_mapseen_rooms->untended; /* (Bitfield(untended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "untended", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_rooms", 1); -} - -void -sfo_mapseen(nhfp, d_mapseen, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen *d_mapseen; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_mapseen->next, parent, "next", 1);/* (struct mapseen *) */ - sfo_branch(nhfp, d_mapseen->br, parent, "br", 1); /* (branch *) */ - sfo_d_level(nhfp, &d_mapseen->lev, parent, "lev", 1); /* (d_level) */ - sfo_mapseen_feat(nhfp, &d_mapseen->feat, parent, "feat", 1); /* (}) */ - sfo_mapseen_flags(nhfp, &d_mapseen->flags, parent, "flags", 1);/* (}) */ - sfo_char(nhfp, d_mapseen->custom, parent, "custom", 1); /* (char *) */ - sfo_unsigned(nhfp, &d_mapseen->custom_lth, parent, "custom_lth", 1);/* (unsigned) */ - for (i = 0; i < (MAXNROFROOMS + 1) * 2; ++i) - sfo_mapseen_rooms(nhfp, &d_mapseen->msrooms[i], parent, "msrooms", 1);/* (}) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mapseen->final_resting_place, parent, "final_resting_place", 1);/* (struct cemetery *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen", 1); -} - -void -sfo_mextra(nhfp, d_mextra, myparent, myname, cnt) -NHFILE *nhfp; -struct mextra *d_mextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mextra", 1); - - sfo_char(nhfp, d_mextra->mname, parent, "mname", 1); /* (char *) */ - sfo_egd(nhfp, d_mextra->egd, parent, "egd", 1); /* (struct egd *) */ - sfo_epri(nhfp, d_mextra->epri, parent, "epri", 1); /* (struct epri *) */ - sfo_eshk(nhfp, d_mextra->eshk, parent, "eshk", 1); /* (struct eshk *) */ - sfo_emin(nhfp, d_mextra->emin, parent, "emin", 1); /* (struct emin *) */ - sfo_edog(nhfp, d_mextra->edog, parent, "edog", 1); /* (struct edog *) */ - sfo_int(nhfp, &d_mextra->mcorpsenm, parent, "mcorpsenm", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mextra", 1); -} - -void -sfo_mkroom(nhfp, d_mkroom, myparent, myname, cnt) -NHFILE *nhfp; -struct mkroom *d_mkroom; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mkroom"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mkroom", 1); - - sfo_schar(nhfp, &d_mkroom->lx, parent, "lx", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->hx, parent, "hx", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->ly, parent, "ly", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->hy, parent, "hy", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->rtype, parent, "rtype", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->orig_rtype, parent, "orig_rtype", 1);/* (schar) */ - sfo_schar(nhfp, &d_mkroom->rlit, parent, "rlit", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->needfill, parent, "needfill", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->needjoining, parent, "needjoining", 1);/* (schar) */ - sfo_schar(nhfp, &d_mkroom->doorct, parent, "doorct", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->fdoor, parent, "fdoor", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->nsubrooms, parent, "nsubrooms", 1);/* (schar) */ - sfo_boolean(nhfp, &d_mkroom->irregular, parent, "irregular", 1);/* (boolean) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mkroom->sbrooms[0], parent, "sbrooms", MAX_SUBROOMS);/* (struct mkroom *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mkroom->resident, parent, "resident", 1);/* (struct monst *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mkroom", 1); -} - -void -sfo_monst(nhfp, d_monst, myparent, myname, cnt) -NHFILE *nhfp; -struct monst *d_monst; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "monst"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "monst", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_monst->nmon, parent, "nmon", 1);/* (struct monst *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->data, parent, "data", 1);/* (struct permonst *) */ - sfo_unsigned(nhfp, &d_monst->m_id, parent, "m_id", 1); /* (unsigned) */ - sfo_short(nhfp, &d_monst->mnum, parent, "mnum", 1); /* (short) */ - sfo_short(nhfp, &d_monst->cham, parent, "cham", 1); /* (short) */ - sfo_short(nhfp, &d_monst->movement, parent, "movement", 1); /* (short) */ - sfo_uchar(nhfp, &d_monst->m_lev, parent, "m_lev", 1); /* (uchar) */ - sfo_aligntyp(nhfp, &d_monst->malign, parent, "malign", 1); /* (aligntyp) */ - sfo_xchar(nhfp, &d_monst->mx, parent, "mx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->my, parent, "my", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->mux, parent, "mux", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->muy, parent, "muy", 1); /* (xchar) */ - for (i = 0; i < MTSZ; ++i) - sfo_nhcoord(nhfp, &d_monst->mtrack[i], parent, "mtrack", 1);/* (nhcoord) */ - sfo_int(nhfp, &d_monst->mhp, parent, "mhp", 1); /* (int) */ - sfo_int(nhfp, &d_monst->mhpmax, parent, "mhpmax", 1); /* (int) */ - sfo_unsigned(nhfp, &d_monst->mappearance, parent, "mappearance", 1);/* (unsigned) */ - sfo_uchar(nhfp, &d_monst->m_ap_type, parent, "m_ap_type", 1);/* (uchar) */ - sfo_schar(nhfp, &d_monst->mtame, parent, "mtame", 1); /* (schar) */ - sfo_ushort(nhfp, &d_monst->mextrinsics, parent, "mextrinsics", 1);/* (unsigned short) */ - sfo_int(nhfp, &d_monst->mspec_used, parent, "mspec_used", 1);/* (int) */ - bitfield = d_monst->female; /* (Bitfield(female, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "female", 1); - bitfield = d_monst->minvis; /* (Bitfield(minvis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "minvis", 1); - bitfield = d_monst->invis_blkd; /* (Bitfield(invis_blkd, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "invis_blkd", 1); - bitfield = d_monst->perminvis; /* (Bitfield(perminvis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "perminvis", 1); - bitfield = d_monst->mcan; /* (Bitfield(mcan, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcan", 1); - bitfield = d_monst->mburied; /* (Bitfield(mburied, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mburied", 1); - bitfield = d_monst->mundetected; /* (Bitfield(mundetected, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mundetected", 1); - bitfield = d_monst->mcansee; /* (Bitfield(mcansee, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcansee", 1); - bitfield = d_monst->mspeed; /* (Bitfield(mspeed, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mspeed", 2); - bitfield = d_monst->permspeed; /* (Bitfield(permspeed, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "permspeed", 2); - bitfield = d_monst->mrevived; /* (Bitfield(mrevived, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mrevived", 1); - bitfield = d_monst->mcloned; /* (Bitfield(mcloned, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcloned", 1); - bitfield = d_monst->mavenge; /* (Bitfield(mavenge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mavenge", 1); - bitfield = d_monst->mflee; /* (Bitfield(mflee, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mflee", 1); - bitfield = d_monst->mfleetim; /* (Bitfield(mfleetim, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfleetim", 7); - bitfield = d_monst->msleeping; /* (Bitfield(msleeping, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msleeping", 1); - bitfield = d_monst->mblinded; /* (Bitfield(mblinded, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mblinded", 7); - bitfield = d_monst->mstun; /* (Bitfield(mstun, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mstun", 1); - bitfield = d_monst->mfrozen; /* (Bitfield(mfrozen, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfrozen", 7); - bitfield = d_monst->mcanmove; /* (Bitfield(mcanmove, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcanmove", 1); - bitfield = d_monst->mconf; /* (Bitfield(mconf, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mconf", 1); - bitfield = d_monst->mpeaceful; /* (Bitfield(mpeaceful, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mpeaceful", 1); - bitfield = d_monst->mtrapped; /* (Bitfield(mtrapped, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mtrapped", 1); - bitfield = d_monst->mleashed; /* (Bitfield(mleashed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mleashed", 1); - bitfield = d_monst->isshk; /* (Bitfield(isshk, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isshk", 1); - bitfield = d_monst->isminion; /* (Bitfield(isminion, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isminion", 1); - bitfield = d_monst->isgd; /* (Bitfield(isgd, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isgd", 1); - bitfield = d_monst->ispriest; /* (Bitfield(ispriest, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ispriest", 1); - bitfield = d_monst->iswiz; /* (Bitfield(iswiz, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "iswiz", 1); - bitfield = d_monst->wormno; /* (Bitfield(wormno, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "wormno", 5); - bitfield = d_monst->mtemplit; /* (Bitfield(mtemplit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mtemplit", 1); - sfo_ulong(nhfp, &d_monst->mstrategy, parent, "mstrategy", 1);/* (unsigned long) */ - sfo_long(nhfp, &d_monst->mtrapseen, parent, "mtrapseen", 1); /* (long) */ - sfo_long(nhfp, &d_monst->mlstmv, parent, "mlstmv", 1); /* (long) */ - sfo_long(nhfp, &d_monst->mstate, parent, "mstate", 1); /* (long) */ - sfo_long(nhfp, &d_monst->migflags, parent, "migflags", 1); /* (long) */ - sfo_long(nhfp, &d_monst->mspare1, parent, "mspare1", 1); /* (long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->minvent, parent, "minvent", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->mw, parent, "mw", 1);/* (struct obj *) */ - sfo_long(nhfp, &d_monst->misc_worn_check, parent, "misc_worn_check", 1);/* (long) */ - sfo_xchar(nhfp, &d_monst->weapon_check, parent, "weapon_check", 1);/* (xchar) */ - sfo_int(nhfp, &d_monst->meating, parent, "meating", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->mextra, parent, "mextra", 1);/* (struct mextra *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "monst", 1); -} - -void -sfo_mvitals(nhfp, d_mvitals, myparent, myname, cnt) -NHFILE *nhfp; -struct mvitals *d_mvitals; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mvitals"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mvitals", 1); - - sfo_uchar(nhfp, &d_mvitals->born, parent, "born", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_mvitals->died, parent, "died", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_mvitals->mvflags, parent, "mvflags", 1); /* (uchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mvitals", 1); -} - -void -sfo_nhcoord(nhfp, d_nhcoord, myparent, myname, cnt) -NHFILE *nhfp; -struct nhcoord *d_nhcoord; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhcoord"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "nhcoord", 1); - - sfo_xchar(nhfp, &d_nhcoord->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhcoord->y, parent, "y", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "nhcoord", 1); -} - -void -sfo_nhrect(nhfp, d_nhrect, myparent, myname, cnt) -NHFILE *nhfp; -struct nhrect *d_nhrect; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhrect"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "nhrect", 1); - - sfo_xchar(nhfp, &d_nhrect->lx, parent, "lx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->ly, parent, "ly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->hx, parent, "hx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->hy, parent, "hy", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "nhrect", 1); -} - -void -sfo_novel_tracking(nhfp, d_novel_tracking, myparent, myname, cnt) -NHFILE *nhfp; -struct novel_tracking *d_novel_tracking; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "novel_tracking"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "novel_tracking", 1); - - sfo_unsigned(nhfp, &d_novel_tracking->id, parent, "id", 1); /* (unsigned) */ - sfo_int(nhfp, &d_novel_tracking->count, parent, "count", 1); /* (int) */ - sfo_xchar(nhfp, d_novel_tracking->pasg, parent, "pasg", 30); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "novel_tracking", 1); -} - -void -sfo_obj(nhfp, d_obj, myparent, myname, cnt) -NHFILE *nhfp; -struct obj *d_obj; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "obj", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_obj->nobj, parent, "nobj", 1);/* (struct obj *) */ - sfo_vptrs(nhfp, &d_obj->v, parent, "v", 1); /* (vptrs) */ - sfo_genericptr(nhfp, (genericptr_t) &d_obj->cobj, parent, "cobj", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_obj->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_xchar(nhfp, &d_obj->ox, parent, "ox", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_obj->oy, parent, "oy", 1); /* (xchar) */ - sfo_short(nhfp, &d_obj->otyp, parent, "otyp", 1); /* (short) */ - sfo_unsigned(nhfp, &d_obj->owt, parent, "owt", 1); /* (unsigned) */ - sfo_long(nhfp, &d_obj->quan, parent, "quan", 1); /* (long) */ - sfo_schar(nhfp, &d_obj->spe, parent, "spe", 1); /* (schar) */ - sfo_char(nhfp, &d_obj->oclass, parent, "oclass", 1); /* (char) */ - sfo_char(nhfp, &d_obj->invlet, parent, "invlet", 1); /* (char) */ - sfo_char(nhfp, &d_obj->oartifact, parent, "oartifact", 1); /* (char) */ - sfo_xchar(nhfp, &d_obj->where, parent, "where", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_obj->timed, parent, "timed", 1); /* (xchar) */ - bitfield = d_obj->cursed; /* (Bitfield(cursed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cursed", 1); - bitfield = d_obj->blessed; /* (Bitfield(blessed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "blessed", 1); - bitfield = d_obj->unpaid; /* (Bitfield(unpaid, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unpaid", 1); - bitfield = d_obj->no_charge; /* (Bitfield(no_charge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "no_charge", 1); - bitfield = d_obj->known; /* (Bitfield(known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "known", 1); - bitfield = d_obj->dknown; /* (Bitfield(dknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "dknown", 1); - bitfield = d_obj->bknown; /* (Bitfield(bknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bknown", 1); - bitfield = d_obj->rknown; /* (Bitfield(rknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "rknown", 1); - bitfield = d_obj->oeroded; /* (Bitfield(oeroded, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oeroded", 2); - bitfield = d_obj->oeroded2; /* (Bitfield(oeroded2, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oeroded2", 2); - bitfield = d_obj->oerodeproof; /* (Bitfield(oerodeproof, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oerodeproof", 1); - bitfield = d_obj->olocked; /* (Bitfield(olocked, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "olocked", 1); - bitfield = d_obj->obroken; /* (Bitfield(obroken, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "obroken", 1); - bitfield = d_obj->otrapped; /* (Bitfield(otrapped, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "otrapped", 1); - bitfield = d_obj->recharged; /* (Bitfield(recharged, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "recharged", 3); - bitfield = d_obj->lamplit; /* (Bitfield(lamplit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lamplit", 1); - bitfield = d_obj->globby; /* (Bitfield(globby, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "globby", 1); - bitfield = d_obj->greased; /* (Bitfield(greased, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "greased", 1); - bitfield = d_obj->nomerge; /* (Bitfield(nomerge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nomerge", 1); - bitfield = d_obj->was_thrown; /* (Bitfield(was_thrown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "was_thrown", 1); - bitfield = d_obj->in_use; /* (Bitfield(in_use, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "in_use", 1); - bitfield = d_obj->bypass; /* (Bitfield(bypass, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bypass", 1); - bitfield = d_obj->cknown; /* (Bitfield(cknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cknown", 1); - bitfield = d_obj->lknown; /* (Bitfield(lknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lknown", 1); - sfo_int(nhfp, &d_obj->corpsenm, parent, "corpsenm", 1); /* (int) */ - sfo_int(nhfp, &d_obj->usecount, parent, "usecount", 1); /* (int) */ - sfo_unsigned(nhfp, &d_obj->oeaten, parent, "oeaten", 1); /* (unsigned) */ - sfo_long(nhfp, &d_obj->age, parent, "age", 1); /* (long) */ - sfo_long(nhfp, &d_obj->owornmask, parent, "owornmask", 1); /* (long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_obj->oextra, parent, "oextra", 1);/* (struct oextra *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "obj", 1); -} - -void -sfo_objclass(nhfp, d_objclass, myparent, myname, cnt) -NHFILE *nhfp; -struct objclass *d_objclass; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "objclass"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "objclass", 1); - - sfo_short(nhfp, &d_objclass->oc_name_idx, parent, "oc_name_idx", 1);/* (short) */ - sfo_short(nhfp, &d_objclass->oc_descr_idx, parent, "oc_descr_idx", 1);/* (short) */ - sfo_genericptr(nhfp, (genericptr_t) &d_objclass->oc_uname, parent, "oc_uname", 1);/* (char *) */ - bitfield = d_objclass->oc_name_known; /* (Bitfield(oc_name_known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_name_known", 1); - bitfield = d_objclass->oc_merge; /* (Bitfield(oc_merge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_merge", 1); - bitfield = d_objclass->oc_uses_known; /* (Bitfield(oc_uses_known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_uses_known", 1); - bitfield = d_objclass->oc_pre_discovered; /* (Bitfield(oc_pre_discovered, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_pre_discovered", 1); - bitfield = d_objclass->oc_magic; /* (Bitfield(oc_magic, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_magic", 1); - bitfield = d_objclass->oc_charged; /* (Bitfield(oc_charged, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_charged", 1); - bitfield = d_objclass->oc_unique; /* (Bitfield(oc_unique, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_unique", 1); - bitfield = d_objclass->oc_nowish; /* (Bitfield(oc_nowish, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_nowish", 1); - bitfield = d_objclass->oc_big; /* (Bitfield(oc_big, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_big", 1); - bitfield = d_objclass->oc_tough; /* (Bitfield(oc_tough, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_tough", 1); - bitfield = d_objclass->oc_dir; /* (Bitfield(oc_dir, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_dir", 2); - bitfield = d_objclass->oc_material; /* (Bitfield(oc_material, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_material", 5); - sfo_schar(nhfp, &d_objclass->oc_subtyp, parent, "oc_subtyp", 1);/* (schar) */ - sfo_uchar(nhfp, &d_objclass->oc_oprop, parent, "oc_oprop", 1);/* (uchar) */ - sfo_char(nhfp, &d_objclass->oc_class, parent, "oc_class", 1);/* (char) */ - sfo_schar(nhfp, &d_objclass->oc_delay, parent, "oc_delay", 1);/* (schar) */ - sfo_uchar(nhfp, &d_objclass->oc_color, parent, "oc_color", 1);/* (uchar) */ - sfo_short(nhfp, &d_objclass->oc_prob, parent, "oc_prob", 1); /* (short) */ - sfo_ushort(nhfp, &d_objclass->oc_weight, parent, "oc_weight", 1);/* (unsigned short) */ - sfo_short(nhfp, &d_objclass->oc_cost, parent, "oc_cost", 1); /* (short) */ - sfo_schar(nhfp, &d_objclass->oc_wsdam, parent, "oc_wsdam", 1);/* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_wldam, parent, "oc_wldam", 1);/* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_oc1, parent, "oc_oc1", 1); /* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_oc2, parent, "oc_oc2", 1); /* (schar) */ - sfo_ushort(nhfp, &d_objclass->oc_nutrition, parent, "oc_nutrition", 1);/* (unsigned short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "objclass", 1); -} - -void -sfo_obj_split(nhfp, d_obj_split, myparent, myname, cnt) -NHFILE *nhfp; -struct obj_split *d_obj_split; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj_split"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "obj_split", 1); - - sfo_unsigned(nhfp, &d_obj_split->parent_oid, parent, "parent_oid", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_obj_split->child_oid, parent, "child_oid", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "obj_split", 1); -} - -void -sfo_oextra(nhfp, d_oextra, myparent, myname, cnt) -NHFILE *nhfp; -struct oextra *d_oextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "oextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "oextra", 1); - - sfo_char(nhfp, d_oextra->oname, parent, "oname", 1); /* (char *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_oextra->omonst, parent, "omonst", 1);/* (struct monst *) */ - sfo_unsigned(nhfp, d_oextra->omid, parent, "omid", 1); /* (unsigned *) */ - sfo_long(nhfp, d_oextra->olong, parent, "olong", 1); /* (long *) */ - sfo_char(nhfp, d_oextra->omailcmd, parent, "omailcmd", 1); /* (char *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "oextra", 1); -} - -void -sfo_polearm_info(nhfp, d_polearm_info, myparent, myname, cnt) -NHFILE *nhfp; -struct polearm_info *d_polearm_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "polearm_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "polearm_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_polearm_info->hitmon, parent, "hitmon", 1);/* (struct monst *) */ - sfo_unsigned(nhfp, &d_polearm_info->m_id, parent, "m_id", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "polearm_info", 1); -} - -void -sfo_prop(nhfp, d_prop, myparent, myname, cnt) -NHFILE *nhfp; -struct prop *d_prop; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "prop"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "prop", 1); - - sfo_long(nhfp, &d_prop->extrinsic, parent, "extrinsic", 1); /* (long) */ - sfo_long(nhfp, &d_prop->blocked, parent, "blocked", 1); /* (long) */ - sfo_long(nhfp, &d_prop->intrinsic, parent, "intrinsic", 1); /* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "prop", 1); -} - -void -sfo_q_score(nhfp, d_q_score, myparent, myname, cnt) -NHFILE *nhfp; -struct q_score *d_q_score; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "q_score"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "q_score", 1); - - bitfield = d_q_score->first_start; /* (Bitfield(first_start, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "first_start", 1); - bitfield = d_q_score->met_leader; /* (Bitfield(met_leader, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_leader", 1); - bitfield = d_q_score->not_ready; /* (Bitfield(not_ready, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "not_ready", 3); - bitfield = d_q_score->pissed_off; /* (Bitfield(pissed_off, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "pissed_off", 1); - bitfield = d_q_score->got_quest; /* (Bitfield(got_quest, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_quest", 1); - bitfield = d_q_score->first_locate; /* (Bitfield(first_locate, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "first_locate", 1); - bitfield = d_q_score->met_intermed; /* (Bitfield(met_intermed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_intermed", 1); - bitfield = d_q_score->got_final; /* (Bitfield(got_final, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_final", 1); - bitfield = d_q_score->made_goal; /* (Bitfield(made_goal, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "made_goal", 3); - bitfield = d_q_score->met_nemesis; /* (Bitfield(met_nemesis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_nemesis", 1); - bitfield = d_q_score->killed_nemesis; /* (Bitfield(killed_nemesis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_nemesis", 1); - bitfield = d_q_score->in_battle; /* (Bitfield(in_battle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "in_battle", 1); - bitfield = d_q_score->cheater; /* (Bitfield(cheater, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cheater", 1); - bitfield = d_q_score->touched_artifact; /* (Bitfield(touched_artifact, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "touched_artifact", 1); - bitfield = d_q_score->offered_artifact; /* (Bitfield(offered_artifact, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "offered_artifact", 1); - bitfield = d_q_score->got_thanks; /* (Bitfield(got_thanks, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_thanks", 1); - bitfield = d_q_score->ldrgend; /* (Bitfield(ldrgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ldrgend", 2); - bitfield = d_q_score->nemgend; /* (Bitfield(nemgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nemgend", 2); - bitfield = d_q_score->godgend; /* (Bitfield(godgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "godgend", 2); - bitfield = d_q_score->leader_is_dead; /* (Bitfield(leader_is_dead, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "leader_is_dead", 1); - sfo_unsigned(nhfp, &d_q_score->leader_m_id, parent, "leader_m_id", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "q_score", 1); -} - -void -sfo_rm(nhfp, d_rm, myparent, myname, cnt) -NHFILE *nhfp; -struct rm *d_rm; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "rm"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "rm", 1); - - sfo_int(nhfp, &d_rm->glyph, parent, "glyph", 1); /* (int) */ - sfo_schar(nhfp, &d_rm->typ, parent, "typ", 1); /* (schar) */ - sfo_uchar(nhfp, &d_rm->seenv, parent, "seenv", 1); /* (uchar) */ - bitfield = d_rm->flags; /* (Bitfield(flags, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "flags", 5); - bitfield = d_rm->horizontal; /* (Bitfield(horizontal, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "horizontal", 1); - bitfield = d_rm->lit; /* (Bitfield(lit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lit", 1); - bitfield = d_rm->waslit; /* (Bitfield(waslit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "waslit", 1); - bitfield = d_rm->roomno; /* (Bitfield(roomno, 6)) */ - sfo_bitfield(nhfp, &bitfield, parent, "roomno", 6); - bitfield = d_rm->edge; /* (Bitfield(edge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "edge", 1); - bitfield = d_rm->candig; /* (Bitfield(candig, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "candig", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "rm", 1); -} - -void -sfo_s_level(nhfp, d_s_level, myparent, myname, cnt) -NHFILE *nhfp; -struct s_level *d_s_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "s_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "s_level", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_s_level->next, parent, "next", 1);/* (struct s_level *) */ - sfo_d_level(nhfp, &d_s_level->dlevel, parent, "dlevel", 1); /* (d_level) */ - sfo_char(nhfp, d_s_level->proto, parent, "proto", 15); /* (char) */ - sfo_char(nhfp, &d_s_level->boneid, parent, "boneid", 1); /* (char) */ - sfo_uchar(nhfp, &d_s_level->rndlevs, parent, "rndlevs", 1); /* (uchar) */ - sfo_d_flags(nhfp, &d_s_level->flags, parent, "flags", 1); /* (d_flags) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "s_level", 1); -} - -void -sfo_savefile_info(nhfp, d_savefile_info, myparent, myname, cnt) -NHFILE *nhfp; -struct savefile_info *d_savefile_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "savefile_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "savefile_info", 1); - - sfo_ulong(nhfp, &d_savefile_info->sfi1, parent, "sfi1", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_savefile_info->sfi2, parent, "sfi2", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_savefile_info->sfi3, parent, "sfi3", 1); /* (unsigned long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "savefile_info", 1); -} - -void -sfo_skills(nhfp, d_skills, myparent, myname, cnt) -NHFILE *nhfp; -struct skills *d_skills; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "skills"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "skills", 1); - - sfo_xchar(nhfp, &d_skills->skill, parent, "skill", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_skills->max_skill, parent, "max_skill", 1);/* (xchar) */ - sfo_ushort(nhfp, &d_skills->advance, parent, "advance", 1); /* (unsigned short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "skills", 1); -} - -void -sfo_spell(nhfp, d_spell, myparent, myname, cnt) -NHFILE *nhfp; -struct spell *d_spell; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "spell"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "spell", 1); - - sfo_short(nhfp, &d_spell->sp_id, parent, "sp_id", 1); /* (short) */ - sfo_xchar(nhfp, &d_spell->sp_lev, parent, "sp_lev", 1); /* (xchar) */ - sfo_int(nhfp, &d_spell->sp_know, parent, "sp_know", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "spell", 1); -} - -void -sfo_stairway(nhfp, d_stairway, myparent, myname, cnt) -NHFILE *nhfp; -struct stairway *d_stairway; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "stairway"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "stairway", 1); - - sfo_xchar(nhfp, &d_stairway->sx, parent, "sx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_stairway->sy, parent, "sy", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_stairway->tolev, parent, "tolev", 1); /* (d_level) */ - sfo_char(nhfp, &d_stairway->up, parent, "up", 1); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "stairway", 1); -} - -void -sfo_takeoff_info(nhfp, d_takeoff_info, myparent, myname, cnt) -NHFILE *nhfp; -struct takeoff_info *d_takeoff_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "takeoff_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "takeoff_info", 1); - - sfo_long(nhfp, &d_takeoff_info->mask, parent, "mask", 1); /* (long) */ - sfo_long(nhfp, &d_takeoff_info->what, parent, "what", 1); /* (long) */ - sfo_int(nhfp, &d_takeoff_info->delay, parent, "delay", 1); /* (int) */ - sfo_boolean(nhfp, &d_takeoff_info->cancelled_don, parent, "cancelled_don", 1);/* (boolean) */ - sfo_char(nhfp, d_takeoff_info->disrobing, parent, "disrobing", CONTEXTVERBSZ + 1);/* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "takeoff_info", 1); -} - -void -sfo_tin_info(nhfp, d_tin_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tin_info *d_tin_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tin_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "tin_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_tin_info->tin, parent, "tin", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_tin_info->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_int(nhfp, &d_tin_info->usedtime, parent, "usedtime", 1); /* (int) */ - sfo_int(nhfp, &d_tin_info->reqtime, parent, "reqtime", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "tin_info", 1); -} - -void -sfo_trap(nhfp, d_trap, myparent, myname, cnt) -NHFILE *nhfp; -struct trap *d_trap; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "trap"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "trap", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_trap->ntrap, parent, "ntrap", 1);/* (struct trap *) */ - sfo_xchar(nhfp, &d_trap->tx, parent, "tx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_trap->ty, parent, "ty", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_trap->dst, parent, "dst", 1); /* (d_level) */ - sfo_nhcoord(nhfp, &d_trap->launch, parent, "launch", 1); /* (nhcoord) */ - bitfield = d_trap->ttyp; /* (Bitfield(ttyp, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ttyp", 5); - bitfield = d_trap->tseen; /* (Bitfield(tseen, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "tseen", 1); - bitfield = d_trap->once; /* (Bitfield(once, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "once", 1); - bitfield = d_trap->madeby_u; /* (Bitfield(madeby_u, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "madeby_u", 1); - sfo_vlaunchinfo(nhfp, &d_trap->vl, parent, "vl", 1); /* (vlaunchinfo) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "trap", 1); -} - -void -sfo_tribute_info(nhfp, d_tribute_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tribute_info *d_tribute_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tribute_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "tribute_info", 1); - - sfo_size_t(nhfp, &d_tribute_info->tributesz, parent, "tributesz", 1);/* (size_t) */ - sfo_boolean(nhfp, &d_tribute_info->enabled, parent, "enabled", 1);/* (boolean) */ - bitfield = d_tribute_info->bookstock; /* (Bitfield(bookstock, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bookstock", 1); - bitfield = d_tribute_info->Deathnotice; /* (Bitfield(Deathnotice,1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "Deathnotice", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "tribute_info", 1); -} - -void -sfo_u_achieve(nhfp, d_u_achieve, myparent, myname, cnt) -NHFILE *nhfp; -struct u_achieve *d_u_achieve; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_achieve"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_achieve", 1); - - bitfield = d_u_achieve->amulet; /* (Bitfield(amulet, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "amulet", 1); - bitfield = d_u_achieve->bell; /* (Bitfield(bell, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bell", 1); - bitfield = d_u_achieve->book; /* (Bitfield(book, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "book", 1); - bitfield = d_u_achieve->menorah; /* (Bitfield(menorah, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "menorah", 1); - bitfield = d_u_achieve->enter_gehennom; /* (Bitfield(enter_gehennom,1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "enter_gehennom", 1); - bitfield = d_u_achieve->ascended; /* (Bitfield(ascended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ascended", 1); - bitfield = d_u_achieve->mines_luckstone; /* (Bitfield(mines_luckstone, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mines_luckstone", 1); - bitfield = d_u_achieve->finish_sokoban; /* (Bitfield(finish_sokoban, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "finish_sokoban", 1); - bitfield = d_u_achieve->killed_medusa; /* (Bitfield(killed_medusa, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_medusa", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_achieve", 1); -} - -void -sfo_u_conduct(nhfp, d_u_conduct, myparent, myname, cnt) -NHFILE *nhfp; -struct u_conduct *d_u_conduct; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_conduct"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_conduct", 1); - - sfo_long(nhfp, &d_u_conduct->unvegetarian, parent, "unvegetarian", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->unvegan, parent, "unvegan", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->food, parent, "food", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->gnostic, parent, "gnostic", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->weaphit, parent, "weaphit", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->killer, parent, "killer", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->literate, parent, "literate", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->polypiles, parent, "polypiles", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->polyselfs, parent, "polyselfs", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->wishes, parent, "wishes", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->wisharti, parent, "wisharti", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_conduct", 1); -} - -void -sfo_u_event(nhfp, d_u_event, myparent, myname, cnt) -NHFILE *nhfp; -struct u_event *d_u_event; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_event"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_event", 1); - - bitfield = d_u_event->minor_oracle; /* (Bitfield(minor_oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "minor_oracle", 1); - bitfield = d_u_event->major_oracle; /* (Bitfield(major_oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "major_oracle", 1); - bitfield = d_u_event->read_tribute; /* (Bitfield(read_tribute, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "read_tribute", 1); - bitfield = d_u_event->qcalled; /* (Bitfield(qcalled, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qcalled", 1); - bitfield = d_u_event->qexpelled; /* (Bitfield(qexpelled, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qexpelled", 1); - bitfield = d_u_event->qcompleted; /* (Bitfield(qcompleted, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qcompleted", 1); - bitfield = d_u_event->uheard_tune; /* (Bitfield(uheard_tune, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uheard_tune", 2); - bitfield = d_u_event->uopened_dbridge; /* (Bitfield(uopened_dbridge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uopened_dbridge", 1); - bitfield = d_u_event->invoked; /* (Bitfield(invoked, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "invoked", 1); - bitfield = d_u_event->gehennom_entered; /* (Bitfield(gehennom_entered, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "gehennom_entered", 1); - bitfield = d_u_event->uhand_of_elbereth; /* (Bitfield(uhand_of_elbereth, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uhand_of_elbereth", 2); - bitfield = d_u_event->udemigod; /* (Bitfield(udemigod, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "udemigod", 1); - bitfield = d_u_event->uvibrated; /* (Bitfield(uvibrated, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uvibrated", 1); - bitfield = d_u_event->ascended; /* (Bitfield(ascended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ascended", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_event", 1); -} - -void -sfo_u_have(nhfp, d_u_have, myparent, myname, cnt) -NHFILE *nhfp; -struct u_have *d_u_have; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_have"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_have", 1); - - bitfield = d_u_have->amulet; /* (Bitfield(amulet, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "amulet", 1); - bitfield = d_u_have->bell; /* (Bitfield(bell, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bell", 1); - bitfield = d_u_have->book; /* (Bitfield(book, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "book", 1); - bitfield = d_u_have->menorah; /* (Bitfield(menorah, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "menorah", 1); - bitfield = d_u_have->questart; /* (Bitfield(questart, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "questart", 1); - bitfield = d_u_have->unused; /* (Bitfield(unused, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 3); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_have", 1); -} - -void -sfo_u_realtime(nhfp, d_u_realtime, myparent, myname, cnt) -NHFILE *nhfp; -struct u_realtime *d_u_realtime; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_realtime"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_realtime", 1); - - sfo_long(nhfp, &d_u_realtime->realtime, parent, "realtime", 1);/* (long) */ - sfo_time_t(nhfp, &d_u_realtime->start_timing, parent, "start_timing", 1);/* (time_t) */ - sfo_time_t(nhfp, &d_u_realtime->finish_time, parent, "finish_time", 1);/* (time_t) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_realtime", 1); -} - -void -sfo_u_roleplay(nhfp, d_u_roleplay, myparent, myname, cnt) -NHFILE *nhfp; -struct u_roleplay *d_u_roleplay; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_roleplay"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_roleplay", 1); - - sfo_boolean(nhfp, &d_u_roleplay->blind, parent, "blind", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_u_roleplay->nudist, parent, "nudist", 1);/* (boolean) */ - sfo_long(nhfp, &d_u_roleplay->numbones, parent, "numbones", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_roleplay", 1); -} - -void -sfo_version_info(nhfp, d_version_info, myparent, myname, cnt) -NHFILE *nhfp; -struct version_info *d_version_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "version_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "version_info", 1); - - sfo_ulong(nhfp, &d_version_info->incarnation, parent, "incarnation", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->feature_set, parent, "feature_set", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->entity_count, parent, "entity_count", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->struct_sizes1, parent, "struct_sizes1", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->struct_sizes2, parent, "struct_sizes2", 1);/* (unsigned long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "version_info", 1); -} - -void -sfo_victual_info(nhfp, d_victual_info, myparent, myname, cnt) -NHFILE *nhfp; -struct victual_info *d_victual_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "victual_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "victual_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_victual_info->piece, parent, "piece", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_victual_info->o_id, parent, "o_id", 1);/* (unsigned) */ - sfo_int(nhfp, &d_victual_info->usedtime, parent, "usedtime", 1);/* (int) */ - sfo_int(nhfp, &d_victual_info->reqtime, parent, "reqtime", 1);/* (int) */ - sfo_int(nhfp, &d_victual_info->nmod, parent, "nmod", 1); /* (int) */ - bitfield = d_victual_info->canchoke; /* (Bitfield(canchoke, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "canchoke", 1); - bitfield = d_victual_info->fullwarn; /* (Bitfield(fullwarn, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "fullwarn", 1); - bitfield = d_victual_info->eating; /* (Bitfield(eating, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "eating", 1); - bitfield = d_victual_info->doreset; /* (Bitfield(doreset, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "doreset", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "victual_info", 1); -} - -void -sfo_vlaunchinfo(nhfp, d_vlaunchinfo, myparent, myname, cnt) -NHFILE *nhfp; -union vlaunchinfo *d_vlaunchinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vlaunchinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "vlaunchinfo", 1); - - sfo_short(nhfp, &d_vlaunchinfo->v_launch_otyp, parent, "v_launch_otyp", 1);/* (short) */ - sfo_nhcoord(nhfp, &d_vlaunchinfo->v_launch2, parent, "v_launch2", 1);/* (nhcoord) */ - sfo_uchar(nhfp, &d_vlaunchinfo->v_conjoined, parent, "v_conjoined", 1);/* (uchar) */ - sfo_short(nhfp, &d_vlaunchinfo->v_tnote, parent, "v_tnote", 1);/* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "vlaunchinfo", 1); -} - -void -sfo_vptrs(nhfp, d_vptrs, myparent, myname, cnt) -NHFILE *nhfp; -union vptrs *d_vptrs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vptrs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "vptrs", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_nexthere, parent, "v_nexthere", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocontainer, parent, "v_ocontainer", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocarry, parent, "v_ocarry", 1);/* (struct monst *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "vptrs", 1); -} - -void -sfo_warntype_info(nhfp, d_warntype_info, myparent, myname, cnt) -NHFILE *nhfp; -struct warntype_info *d_warntype_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "warntype_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "warntype_info", 1); - - sfo_ulong(nhfp, &d_warntype_info->obj, parent, "obj", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_warntype_info->polyd, parent, "polyd", 1);/* (unsigned long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_warntype_info->species, parent, "species", 1);/* (struct permonst *) */ - sfo_short(nhfp, &d_warntype_info->speciesidx, parent, "speciesidx", 1);/* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "warntype_info", 1); -} - -void -sfo_you(nhfp, d_you, myparent, myname, cnt) -NHFILE *nhfp; -struct you *d_you; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "you"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "you", 1); - - sfo_xchar(nhfp, &d_you->ux, parent, "ux", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->uy, parent, "uy", 1); /* (xchar) */ - sfo_schar(nhfp, &d_you->dx, parent, "dx", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->dy, parent, "dy", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->dz, parent, "dz", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->di, parent, "di", 1); /* (schar) */ - sfo_xchar(nhfp, &d_you->tx, parent, "tx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->ty, parent, "ty", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->ux0, parent, "ux0", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->uy0, parent, "uy0", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_you->uz, parent, "uz", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_you->uz0, parent, "uz0", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_you->utolev, parent, "utolev", 1); /* (d_level) */ - sfo_uchar(nhfp, &d_you->utotype, parent, "utotype", 1); /* (uchar) */ - sfo_boolean(nhfp, &d_you->umoved, parent, "umoved", 1); /* (boolean) */ - sfo_int(nhfp, &d_you->last_str_turn, parent, "last_str_turn", 1);/* (int) */ - sfo_int(nhfp, &d_you->ulevel, parent, "ulevel", 1); /* (int) */ - sfo_int(nhfp, &d_you->ulevelmax, parent, "ulevelmax", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->utrap, parent, "utrap", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_you->utraptype, parent, "utraptype", 1);/* (unsigned) */ - sfo_char(nhfp, d_you->urooms, parent, "urooms", 5); /* (char) */ - sfo_char(nhfp, d_you->urooms0, parent, "urooms0", 5); /* (char) */ - sfo_char(nhfp, d_you->uentered, parent, "uentered", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops, parent, "ushops", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops0, parent, "ushops0", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops_entered, parent, "ushops_entered", 5);/* (char) */ - sfo_char(nhfp, d_you->ushops_left, parent, "ushops_left", 5);/* (char) */ - sfo_int(nhfp, &d_you->uhunger, parent, "uhunger", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->uhs, parent, "uhs", 1); /* (unsigned) */ - sfo_prop(nhfp, d_you->uprops, parent, "uprops", LAST_PROP + 1);/* (prop) */ - sfo_unsigned(nhfp, &d_you->umconf, parent, "umconf", 1); /* (unsigned) */ - bitfield = d_you->usick_type; /* (Bitfield(usick_type, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "usick_type", 2); - sfo_int(nhfp, &d_you->nv_range, parent, "nv_range", 1); /* (int) */ - sfo_int(nhfp, &d_you->xray_range, parent, "xray_range", 1); /* (int) */ - sfo_int(nhfp, &d_you->bglyph, parent, "bglyph", 1); /* (int) */ - sfo_int(nhfp, &d_you->cglyph, parent, "cglyph", 1); /* (int) */ - sfo_int(nhfp, &d_you->bc_order, parent, "bc_order", 1); /* (int) */ - sfo_int(nhfp, &d_you->bc_felt, parent, "bc_felt", 1); /* (int) */ - sfo_int(nhfp, &d_you->umonster, parent, "umonster", 1); /* (int) */ - sfo_int(nhfp, &d_you->umonnum, parent, "umonnum", 1); /* (int) */ - sfo_int(nhfp, &d_you->mh, parent, "mh", 1); /* (int) */ - sfo_int(nhfp, &d_you->mhmax, parent, "mhmax", 1); /* (int) */ - sfo_int(nhfp, &d_you->mtimedone, parent, "mtimedone", 1); /* (int) */ - sfo_attribs(nhfp, &d_you->macurr, parent, "macurr", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->mamax, parent, "mamax", 1); /* (attribs) */ - sfo_int(nhfp, &d_you->ulycn, parent, "ulycn", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->ucreamed, parent, "ucreamed", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_you->uswldtim, parent, "uswldtim", 1); /* (unsigned) */ - bitfield = d_you->uswallow; /* (Bitfield(uswallow, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uswallow", 1); - bitfield = d_you->uinwater; /* (Bitfield(uinwater, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uinwater", 1); - bitfield = d_you->uundetected; /* (Bitfield(uundetected, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uundetected", 1); - bitfield = d_you->mfemale; /* (Bitfield(mfemale, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfemale", 1); - bitfield = d_you->uinvulnerable; /* (Bitfield(uinvulnerable, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uinvulnerable", 1); - bitfield = d_you->uburied; /* (Bitfield(uburied, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uburied", 1); - bitfield = d_you->uedibility; /* (Bitfield(uedibility, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uedibility", 1); - sfo_unsigned(nhfp, &d_you->udg_cnt, parent, "udg_cnt", 1); /* (unsigned) */ - sfo_u_achieve(nhfp, &d_you->uachieve, parent, "uachieve", 1);/* (u_achieve) */ - sfo_u_event(nhfp, &d_you->uevent, parent, "uevent", 1); /* (u_event) */ - sfo_u_have(nhfp, &d_you->uhave, parent, "uhave", 1); /* (u_have) */ - sfo_u_conduct(nhfp, &d_you->uconduct, parent, "uconduct", 1);/* (u_conduct) */ - sfo_u_roleplay(nhfp, &d_you->uroleplay, parent, "uroleplay", 1);/* (u_roleplay) */ - sfo_attribs(nhfp, &d_you->acurr, parent, "acurr", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->aexe, parent, "aexe", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->abon, parent, "abon", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->amax, parent, "amax", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->atemp, parent, "atemp", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->atime, parent, "atime", 1); /* (attribs) */ - sfo_align(nhfp, &d_you->ualign, parent, "ualign", 1); /* (align) */ - for (i = 0; i < CONVERT; ++i) - sfo_aligntyp(nhfp, &d_you->ualignbase[i], parent, "ualignbase", 1);/* (aligntyp) */ - sfo_schar(nhfp, &d_you->uluck, parent, "uluck", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->moreluck, parent, "moreluck", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->uhitinc, parent, "uhitinc", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->udaminc, parent, "udaminc", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->uac, parent, "uac", 1); /* (schar) */ - sfo_uchar(nhfp, &d_you->uspellprot, parent, "uspellprot", 1);/* (uchar) */ - sfo_uchar(nhfp, &d_you->usptime, parent, "usptime", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_you->uspmtime, parent, "uspmtime", 1); /* (uchar) */ - sfo_int(nhfp, &d_you->uhp, parent, "uhp", 1); /* (int) */ - sfo_int(nhfp, &d_you->uhpmax, parent, "uhpmax", 1); /* (int) */ - sfo_int(nhfp, &d_you->uen, parent, "uen", 1); /* (int) */ - sfo_int(nhfp, &d_you->uenmax, parent, "uenmax", 1); /* (int) */ - sfo_xchar(nhfp, d_you->uhpinc, parent, "uhpinc", MAXULEV); /* (xchar) */ - sfo_xchar(nhfp, d_you->ueninc, parent, "ueninc", MAXULEV); /* (xchar) */ - sfo_int(nhfp, &d_you->ugangr, parent, "ugangr", 1); /* (int) */ - sfo_int(nhfp, &d_you->ugifts, parent, "ugifts", 1); /* (int) */ - sfo_int(nhfp, &d_you->ublessed, parent, "ublessed", 1); /* (int) */ - sfo_int(nhfp, &d_you->ublesscnt, parent, "ublesscnt", 1); /* (int) */ - sfo_long(nhfp, &d_you->umoney0, parent, "umoney0", 1); /* (long) */ - sfo_long(nhfp, &d_you->uspare1, parent, "uspare1", 1); /* (long) */ - sfo_long(nhfp, &d_you->uexp, parent, "uexp", 1); /* (long) */ - sfo_long(nhfp, &d_you->urexp, parent, "urexp", 1); /* (long) */ - sfo_long(nhfp, &d_you->ucleansed, parent, "ucleansed", 1); /* (long) */ - sfo_long(nhfp, &d_you->usleep, parent, "usleep", 1); /* (long) */ - sfo_int(nhfp, &d_you->uinvault, parent, "uinvault", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_you->ustuck, parent, "ustuck", 1);/* (struct monst *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_you->usteed, parent, "usteed", 1);/* (struct monst *) */ - sfo_long(nhfp, &d_you->ugallop, parent, "ugallop", 1); /* (long) */ - sfo_int(nhfp, &d_you->urideturns, parent, "urideturns", 1); /* (int) */ - sfo_int(nhfp, &d_you->umortality, parent, "umortality", 1); /* (int) */ - sfo_int(nhfp, &d_you->ugrave_arise, parent, "ugrave_arise", 1);/* (int) */ - sfo_int(nhfp, &d_you->weapon_slots, parent, "weapon_slots", 1);/* (int) */ - sfo_int(nhfp, &d_you->skills_advanced, parent, "skills_advanced", 1);/* (int) */ - sfo_xchar(nhfp, d_you->skill_record, parent, "skill_record", P_SKILL_LIMIT);/* (xchar) */ - for (i = 0; i < P_NUM_SKILLS; ++i) - sfo_skills(nhfp, &d_you->weapon_skills[i], parent, "weapon_skills", 1);/* (skills) */ - sfo_boolean(nhfp, &d_you->twoweap, parent, "twoweap", 1); /* (boolean) */ - sfo_short(nhfp, &d_you->mcham, parent, "mcham", 1); /* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "you", 1); -} - -void -sfi_align(nhfp, d_align, myparent, myname, cnt) -NHFILE *nhfp; -struct align *d_align; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "align"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "align", 1); - - sfi_aligntyp(nhfp, &d_align->type, parent, "type", 1); - sfi_int(nhfp, &d_align->record, parent, "record", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "align", 1); -} - -void -sfi_attribs(nhfp, d_attribs, myparent, myname, cnt) -NHFILE *nhfp; -struct attribs *d_attribs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "attribs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "attribs", 1); - - sfi_schar(nhfp, d_attribs->a, parent, "a", A_MAX); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "attribs", 1); -} - -void -sfi_bill_x(nhfp, d_bill_x, myparent, myname, cnt) -NHFILE *nhfp; -struct bill_x *d_bill_x; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bill_x"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "bill_x", 1); - - sfi_unsigned(nhfp, &d_bill_x->bo_id, parent, "bo_id", 1); - sfi_boolean(nhfp, &d_bill_x->useup, parent, "useup", 1); - sfi_long(nhfp, &d_bill_x->price, parent, "price", 1); - sfi_long(nhfp, &d_bill_x->bquan, parent, "bquan", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "bill_x", 1); -} - -void -sfi_book_info(nhfp, d_book_info, myparent, myname, cnt) -NHFILE *nhfp; -struct book_info *d_book_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "book_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "book_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_book_info->book, parent, "book", 1); - sfi_unsigned(nhfp, &d_book_info->o_id, parent, "o_id", 1); - sfi_schar(nhfp, &d_book_info->delay, parent, "delay", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "book_info", 1); -} - -void -sfi_branch(nhfp, d_branch, myparent, myname, cnt) -NHFILE *nhfp; -struct branch *d_branch; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "branch"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "branch", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_branch->next, parent, "next", 1); - sfi_int(nhfp, &d_branch->id, parent, "id", 1); - sfi_int(nhfp, &d_branch->type, parent, "type", 1); - sfi_d_level(nhfp, &d_branch->end1, parent, "end1", 1); - sfi_d_level(nhfp, &d_branch->end2, parent, "end2", 1); - sfi_boolean(nhfp, &d_branch->end1_up, parent, "end1_up", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "branch", 1); -} - -void -sfi_bubble(nhfp, d_bubble, myparent, myname, cnt) -NHFILE *nhfp; -struct bubble *d_bubble; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bubble"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "bubble", 1); - - sfi_xchar(nhfp, &d_bubble->x, parent, "x", 1); - sfi_xchar(nhfp, &d_bubble->y, parent, "y", 1); - sfi_schar(nhfp, &d_bubble->dx, parent, "dx", 1); - sfi_schar(nhfp, &d_bubble->dy, parent, "dy", 1); - sfi_uchar(nhfp, d_bubble->bm, parent, "bm", MAX_BMASK + 2); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->prev, parent, "prev", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->next, parent, "next", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->cons, parent, "cons", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "bubble", 1); -} - -void -sfi_cemetery(nhfp, d_cemetery, myparent, myname, cnt) -NHFILE *nhfp; -struct cemetery *d_cemetery; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "cemetery"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "cemetery", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_cemetery->next, parent, "next", 1); - sfi_char(nhfp, d_cemetery->who, parent, "who", PL_NSIZ + 4 * (1 + 3) + 1); - sfi_char(nhfp, d_cemetery->how, parent, "how", 100 + 1); - sfi_char(nhfp, d_cemetery->when, parent, "when", 4 + 2 + 2 + 2 + 2 + 2 + 1); - sfi_schar(nhfp, &d_cemetery->frpx, parent, "frpx", 1); - sfi_schar(nhfp, &d_cemetery->frpy, parent, "frpy", 1); - sfi_boolean(nhfp, &d_cemetery->bonesknown, parent, "bonesknown", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "cemetery", 1); -} - -void -sfi_context_info(nhfp, d_context_info, myparent, myname, cnt) -NHFILE *nhfp; -struct context_info *d_context_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "context_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "context_info", 1); - - sfi_unsigned(nhfp, &d_context_info->ident, parent, "ident", 1); - sfi_unsigned(nhfp, &d_context_info->no_of_wizards, parent, "no_of_wizards", 1); - sfi_unsigned(nhfp, &d_context_info->run, parent, "run", 1); - sfi_unsigned(nhfp, &d_context_info->startingpet_mid, parent, "startingpet_mid", 1); - sfi_int(nhfp, &d_context_info->current_fruit, parent, "current_fruit", 1); - sfi_int(nhfp, &d_context_info->warnlevel, parent, "warnlevel", 1); - sfi_int(nhfp, &d_context_info->rndencode, parent, "rndencode", 1); - sfi_long(nhfp, &d_context_info->next_attrib_check, parent, "next_attrib_check", 1); - sfi_long(nhfp, &d_context_info->stethoscope_move, parent, "stethoscope_move", 1); - sfi_short(nhfp, &d_context_info->stethoscope_movement, parent, "stethoscope_movement", 1); - sfi_boolean(nhfp, &d_context_info->travel, parent, "travel", 1); - sfi_boolean(nhfp, &d_context_info->travel1, parent, "travel1", 1); - sfi_boolean(nhfp, &d_context_info->forcefight, parent, "forcefight", 1); - sfi_boolean(nhfp, &d_context_info->nopick, parent, "nopick", 1); - sfi_boolean(nhfp, &d_context_info->made_amulet, parent, "made_amulet", 1); - sfi_boolean(nhfp, &d_context_info->mon_moving, parent, "mon_moving", 1); - sfi_boolean(nhfp, &d_context_info->move, parent, "move", 1); - sfi_boolean(nhfp, &d_context_info->mv, parent, "mv", 1); - sfi_boolean(nhfp, &d_context_info->bypasses, parent, "bypasses", 1); - sfi_boolean(nhfp, &d_context_info->botl, parent, "botl", 1); - sfi_boolean(nhfp, &d_context_info->botlx, parent, "botlx", 1); - sfi_boolean(nhfp, &d_context_info->door_opened, parent, "door_opened", 1); - sfi_dig_info(nhfp, &d_context_info->digging, parent, "digging", 1); - sfi_victual_info(nhfp, &d_context_info->victual, parent, "victual", 1); - sfi_tin_info(nhfp, &d_context_info->tin, parent, "tin", 1); - sfi_book_info(nhfp, &d_context_info->spbook, parent, "spbook", 1); - sfi_takeoff_info(nhfp, &d_context_info->takeoff, parent, "takeoff", 1); - sfi_warntype_info(nhfp, &d_context_info->warntype, parent, "warntype", 1); - sfi_polearm_info(nhfp, &d_context_info->polearm, parent, "polearm", 1); - sfi_obj_split(nhfp, &d_context_info->objsplit, parent, "objsplit", 1); - sfi_tribute_info(nhfp, &d_context_info->tribute, parent, "tribute", 1); - sfi_novel_tracking(nhfp, &d_context_info->novel, parent, "novel", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "context_info", 1); -} - -void -sfi_d_flags(nhfp, d_d_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct d_flags *d_d_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "d_flags", 1); - - bitfield = d_d_flags->town; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "town", 1); - d_d_flags->town = bitfield; - - bitfield = d_d_flags->hellish; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hellish", 1); - d_d_flags->hellish = bitfield; - - bitfield = d_d_flags->maze_like; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "maze_like", 1); - d_d_flags->maze_like = bitfield; - - bitfield = d_d_flags->rogue_like; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "rogue_like", 1); - d_d_flags->rogue_like = bitfield; - - bitfield = d_d_flags->align; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "align", 3); - d_d_flags->align = bitfield; - - bitfield = d_d_flags->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 1); - d_d_flags->unused = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "d_flags", 1); -} - -void -sfi_d_level(nhfp, d_d_level, myparent, myname, cnt) -NHFILE *nhfp; -struct d_level *d_d_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "d_level", 1); - - sfi_xchar(nhfp, &d_d_level->dnum, parent, "dnum", 1); - sfi_xchar(nhfp, &d_d_level->dlevel, parent, "dlevel", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "d_level", 1); -} - -void -sfi_damage(nhfp, d_damage, myparent, myname, cnt) -NHFILE *nhfp; -struct damage *d_damage; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "damage"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "damage", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_damage->next, parent, "next", 1); - sfi_long(nhfp, &d_damage->when, parent, "when", 1); - sfi_long(nhfp, &d_damage->cost, parent, "cost", 1); - sfi_nhcoord(nhfp, &d_damage->place, parent, "place", 1); - sfi_schar(nhfp, &d_damage->typ, parent, "typ", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "damage", 1); -} - -void -sfi_dest_area(nhfp, d_dest_area, myparent, myname, cnt) -NHFILE *nhfp; -struct dest_area *d_dest_area; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dest_area"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dest_area", 1); - - sfi_xchar(nhfp, &d_dest_area->lx, parent, "lx", 1); - sfi_xchar(nhfp, &d_dest_area->ly, parent, "ly", 1); - sfi_xchar(nhfp, &d_dest_area->hx, parent, "hx", 1); - sfi_xchar(nhfp, &d_dest_area->hy, parent, "hy", 1); - sfi_xchar(nhfp, &d_dest_area->nlx, parent, "nlx", 1); - sfi_xchar(nhfp, &d_dest_area->nly, parent, "nly", 1); - sfi_xchar(nhfp, &d_dest_area->nhx, parent, "nhx", 1); - sfi_xchar(nhfp, &d_dest_area->nhy, parent, "nhy", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dest_area", 1); -} - -void -sfi_dgn_topology(nhfp, d_dgn_topology, myparent, myname, cnt) -NHFILE *nhfp; -struct dgn_topology *d_dgn_topology; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dgn_topology"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dgn_topology", 1); - - sfi_d_level(nhfp, &d_dgn_topology->d_oracle_level, parent, "d_oracle_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_bigroom_level, parent, "d_bigroom_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_rogue_level, parent, "d_rogue_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_medusa_level, parent, "d_medusa_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_stronghold_level, parent, "d_stronghold_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_valley_level, parent, "d_valley_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz1_level, parent, "d_wiz1_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz2_level, parent, "d_wiz2_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz3_level, parent, "d_wiz3_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_juiblex_level, parent, "d_juiblex_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_orcus_level, parent, "d_orcus_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_baalzebub_level, parent, "d_baalzebub_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_asmodeus_level, parent, "d_asmodeus_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_portal_level, parent, "d_portal_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_sanctum_level, parent, "d_sanctum_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_earth_level, parent, "d_earth_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_water_level, parent, "d_water_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_fire_level, parent, "d_fire_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_air_level, parent, "d_air_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_astral_level, parent, "d_astral_level", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_tower_dnum, parent, "d_tower_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_sokoban_dnum, parent, "d_sokoban_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_mines_dnum, parent, "d_mines_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_quest_dnum, parent, "d_quest_dnum", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_qstart_level, parent, "d_qstart_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_qlocate_level, parent, "d_qlocate_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_nemesis_level, parent, "d_nemesis_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_knox_level, parent, "d_knox_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_mineend_level, parent, "d_mineend_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_sokoend_level, parent, "d_sokoend_level", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dgn_topology", 1); -} - -void -sfi_dig_info(nhfp, d_dig_info, myparent, myname, cnt) -NHFILE *nhfp; -struct dig_info *d_dig_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dig_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dig_info", 1); - - sfi_int(nhfp, &d_dig_info->effort, parent, "effort", 1); - sfi_d_level(nhfp, &d_dig_info->level, parent, "level", 1); - sfi_nhcoord(nhfp, &d_dig_info->pos, parent, "pos", 1); - sfi_long(nhfp, &d_dig_info->lastdigtime, parent, "lastdigtime", 1); - sfi_boolean(nhfp, &d_dig_info->down, parent, "down", 1); - sfi_boolean(nhfp, &d_dig_info->chew, parent, "chew", 1); - sfi_boolean(nhfp, &d_dig_info->warned, parent, "warned", 1); - sfi_boolean(nhfp, &d_dig_info->quiet, parent, "quiet", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dig_info", 1); -} - -void -sfi_dungeon(nhfp, d_dungeon, myparent, myname, cnt) -NHFILE *nhfp; -struct dungeon *d_dungeon; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dungeon"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dungeon", 1); - - sfi_char(nhfp, d_dungeon->dname, parent, "dname", 24); - sfi_char(nhfp, d_dungeon->proto, parent, "proto", 15); - sfi_char(nhfp, &d_dungeon->boneid, parent, "boneid", 1); - sfi_d_flags(nhfp, &d_dungeon->flags, parent, "flags", 1); - sfi_xchar(nhfp, &d_dungeon->entry_lev, parent, "entry_lev", 1); - sfi_xchar(nhfp, &d_dungeon->num_dunlevs, parent, "num_dunlevs", 1); - sfi_xchar(nhfp, &d_dungeon->dunlev_ureached, parent, "dunlev_ureached", 1); - sfi_int(nhfp, &d_dungeon->ledger_start, parent, "ledger_start", 1); - sfi_int(nhfp, &d_dungeon->depth_start, parent, "depth_start", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dungeon", 1); -} - -void -sfi_edog(nhfp, d_edog, myparent, myname, cnt) -NHFILE *nhfp; -struct edog *d_edog; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "edog"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "edog", 1); - - sfi_long(nhfp, &d_edog->droptime, parent, "droptime", 1); - sfi_unsigned(nhfp, &d_edog->dropdist, parent, "dropdist", 1); - sfi_int(nhfp, &d_edog->apport, parent, "apport", 1); - sfi_long(nhfp, &d_edog->whistletime, parent, "whistletime", 1); - sfi_long(nhfp, &d_edog->hungrytime, parent, "hungrytime", 1); - sfi_nhcoord(nhfp, &d_edog->ogoal, parent, "ogoal", 1); - sfi_int(nhfp, &d_edog->abuse, parent, "abuse", 1); - sfi_int(nhfp, &d_edog->revivals, parent, "revivals", 1); - sfi_int(nhfp, &d_edog->mhpmax_penalty, parent, "mhpmax_penalty", 1); - bitfield = d_edog->killed_by_u; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_by_u", 1); - d_edog->killed_by_u = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "edog", 1); -} - -void -sfi_egd(nhfp, d_egd, myparent, myname, cnt) -NHFILE *nhfp; -struct egd *d_egd; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "egd"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "egd", 1); - - sfi_int(nhfp, &d_egd->fcbeg, parent, "fcbeg", 1); - sfi_int(nhfp, &d_egd->fcend, parent, "fcend", 1); - sfi_int(nhfp, &d_egd->vroom, parent, "vroom", 1); - sfi_xchar(nhfp, &d_egd->gdx, parent, "gdx", 1); - sfi_xchar(nhfp, &d_egd->gdy, parent, "gdy", 1); - sfi_xchar(nhfp, &d_egd->ogx, parent, "ogx", 1); - sfi_xchar(nhfp, &d_egd->ogy, parent, "ogy", 1); - sfi_d_level(nhfp, &d_egd->gdlevel, parent, "gdlevel", 1); - sfi_xchar(nhfp, &d_egd->warncnt, parent, "warncnt", 1); - bitfield = d_egd->gddone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "gddone", 1); - d_egd->gddone = bitfield; - - bitfield = d_egd->witness; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "witness", 2); - d_egd->witness = bitfield; - - bitfield = d_egd->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 5); - d_egd->unused = bitfield; - - for (i = 0; i < FCSIZ; ++i) - sfi_fakecorridor(nhfp, &d_egd->fakecorr[i], parent, "fakecorr", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "egd", 1); -} - -void -sfi_emin(nhfp, d_emin, myparent, myname, cnt) -NHFILE *nhfp; -struct emin *d_emin; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "emin"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "emin", 1); - - sfi_aligntyp(nhfp, &d_emin->min_align, parent, "min_align", 1); - sfi_boolean(nhfp, &d_emin->renegade, parent, "renegade", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "emin", 1); -} - -void -sfi_engr(nhfp, d_engr, myparent, myname, cnt) -NHFILE *nhfp; -struct engr *d_engr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "engr"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "engr", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_engr->nxt_engr, parent, "nxt_engr", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_engr->engr_txt, parent, "engr_txt", 1); - sfi_xchar(nhfp, &d_engr->engr_x, parent, "engr_x", 1); - sfi_xchar(nhfp, &d_engr->engr_y, parent, "engr_y", 1); - sfi_unsigned(nhfp, &d_engr->engr_lth, parent, "engr_lth", 1); - sfi_long(nhfp, &d_engr->engr_time, parent, "engr_time", 1); - sfi_xchar(nhfp, &d_engr->engr_type, parent, "engr_type", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "engr", 1); -} - -void -sfi_epri(nhfp, d_epri, myparent, myname, cnt) -NHFILE *nhfp; -struct epri *d_epri; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "epri"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "epri", 1); - - sfi_aligntyp(nhfp, &d_epri->shralign, parent, "shralign", 1); - sfi_schar(nhfp, &d_epri->shroom, parent, "shroom", 1); - sfi_nhcoord(nhfp, &d_epri->shrpos, parent, "shrpos", 1); - sfi_d_level(nhfp, &d_epri->shrlevel, parent, "shrlevel", 1); - sfi_long(nhfp, &d_epri->intone_time, parent, "intone_time", 1); - sfi_long(nhfp, &d_epri->enter_time, parent, "enter_time", 1); - sfi_long(nhfp, &d_epri->hostile_time, parent, "hostile_time", 1); - sfi_long(nhfp, &d_epri->peaceful_time, parent, "peaceful_time", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "epri", 1); -} - -void -sfi_eshk(nhfp, d_eshk, myparent, myname, cnt) -NHFILE *nhfp; -struct eshk *d_eshk; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "eshk"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "eshk", 1); - - sfi_long(nhfp, &d_eshk->robbed, parent, "robbed", 1); - sfi_long(nhfp, &d_eshk->credit, parent, "credit", 1); - sfi_long(nhfp, &d_eshk->debit, parent, "debit", 1); - sfi_long(nhfp, &d_eshk->loan, parent, "loan", 1); - sfi_int(nhfp, &d_eshk->shoptype, parent, "shoptype", 1); - sfi_schar(nhfp, &d_eshk->shoproom, parent, "shoproom", 1); - sfi_schar(nhfp, &d_eshk->unused, parent, "unused", 1); - sfi_boolean(nhfp, &d_eshk->following, parent, "following", 1); - sfi_boolean(nhfp, &d_eshk->surcharge, parent, "surcharge", 1); - sfi_boolean(nhfp, &d_eshk->dismiss_kops, parent, "dismiss_kops", 1); - sfi_nhcoord(nhfp, &d_eshk->shk, parent, "shk", 1); - sfi_nhcoord(nhfp, &d_eshk->shd, parent, "shd", 1); - sfi_d_level(nhfp, &d_eshk->shoplevel, parent, "shoplevel", 1); - sfi_int(nhfp, &d_eshk->billct, parent, "billct", 1); - for (i = 0; i < BILLSZ; ++i) - sfi_bill_x(nhfp, &d_eshk->bill[i], parent, "bill", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_eshk->bill_p, parent, "bill_p", 1); - sfi_int(nhfp, &d_eshk->visitct, parent, "visitct", 1); - sfi_char(nhfp, d_eshk->customer, parent, "customer", PL_NSIZ); - sfi_char(nhfp, d_eshk->shknam, parent, "shknam", PL_NSIZ); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "eshk", 1); -} - -void -sfi_fakecorridor(nhfp, d_fakecorridor, myparent, myname, cnt) -NHFILE *nhfp; -struct fakecorridor *d_fakecorridor; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fakecorridor"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fakecorridor", 1); - - sfi_xchar(nhfp, &d_fakecorridor->fx, parent, "fx", 1); - sfi_xchar(nhfp, &d_fakecorridor->fy, parent, "fy", 1); - sfi_xchar(nhfp, &d_fakecorridor->ftyp, parent, "ftyp", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fakecorridor", 1); -} - -void -sfi_fe(nhfp, d_fe, myparent, myname, cnt) -NHFILE *nhfp; -struct fe *d_fe; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fe"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fe", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_fe->next, parent, "next", 1); - sfi_long(nhfp, &d_fe->timeout, parent, "timeout", 1); - sfi_ulong(nhfp, &d_fe->tid, parent, "tid", 1); - sfi_short(nhfp, &d_fe->kind, parent, "kind", 1); - sfi_short(nhfp, &d_fe->func_index, parent, "func_index", 1); - sfi_any(nhfp, &d_fe->arg, parent, "arg", 1); - bitfield = d_fe->needs_fixup; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "needs_fixup", 1); - d_fe->needs_fixup = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fe", 1); -} - -void -sfi_flag(nhfp, d_flag, myparent, myname, cnt) -NHFILE *nhfp; -struct flag *d_flag; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "flag"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "flag", 1); - - sfi_boolean(nhfp, &d_flag->acoustics, parent, "acoustics", 1); - sfi_boolean(nhfp, &d_flag->autodig, parent, "autodig", 1); - sfi_boolean(nhfp, &d_flag->autoquiver, parent, "autoquiver", 1); - sfi_boolean(nhfp, &d_flag->autoopen, parent, "autoopen", 1); - sfi_boolean(nhfp, &d_flag->beginner, parent, "beginner", 1); - sfi_boolean(nhfp, &d_flag->biff, parent, "biff", 1); - sfi_boolean(nhfp, &d_flag->bones, parent, "bones", 1); - sfi_boolean(nhfp, &d_flag->confirm, parent, "confirm", 1); - sfi_boolean(nhfp, &d_flag->dark_room, parent, "dark_room", 1); - sfi_boolean(nhfp, &d_flag->debug, parent, "debug", 1); - sfi_boolean(nhfp, &d_flag->end_own, parent, "end_own", 1); - sfi_boolean(nhfp, &d_flag->explore, parent, "explore", 1); - sfi_boolean(nhfp, &d_flag->female, parent, "female", 1); - sfi_boolean(nhfp, &d_flag->friday13, parent, "friday13", 1); - sfi_boolean(nhfp, &d_flag->goldX, parent, "goldX", 1); - sfi_boolean(nhfp, &d_flag->help, parent, "help", 1); - sfi_boolean(nhfp, &d_flag->ignintr, parent, "ignintr", 1); - sfi_boolean(nhfp, &d_flag->ins_chkpt, parent, "ins_chkpt", 1); - sfi_boolean(nhfp, &d_flag->invlet_constant, parent, "invlet_constant", 1); - sfi_boolean(nhfp, &d_flag->legacy, parent, "legacy", 1); - sfi_boolean(nhfp, &d_flag->lit_corridor, parent, "lit_corridor", 1); - sfi_boolean(nhfp, &d_flag->nap, parent, "nap", 1); - sfi_boolean(nhfp, &d_flag->null, parent, "null", 1); - sfi_boolean(nhfp, &d_flag->pickup, parent, "pickup", 1); - sfi_boolean(nhfp, &d_flag->pickup_thrown, parent, "pickup_thrown", 1); - sfi_boolean(nhfp, &d_flag->pushweapon, parent, "pushweapon", 1); - sfi_boolean(nhfp, &d_flag->rest_on_space, parent, "rest_on_space", 1); - sfi_boolean(nhfp, &d_flag->safe_dog, parent, "safe_dog", 1); - sfi_boolean(nhfp, &d_flag->showexp, parent, "showexp", 1); - sfi_boolean(nhfp, &d_flag->showscore, parent, "showscore", 1); - sfi_boolean(nhfp, &d_flag->silent, parent, "silent", 1); - sfi_boolean(nhfp, &d_flag->sortpack, parent, "sortpack", 1); - sfi_boolean(nhfp, &d_flag->sparkle, parent, "sparkle", 1); - sfi_boolean(nhfp, &d_flag->standout, parent, "standout", 1); - sfi_boolean(nhfp, &d_flag->time, parent, "time", 1); - sfi_boolean(nhfp, &d_flag->tombstone, parent, "tombstone", 1); - sfi_boolean(nhfp, &d_flag->verbose, parent, "verbose", 1); - sfi_int(nhfp, &d_flag->end_top, parent, "end_top", 1); - sfi_int(nhfp, &d_flag->end_around, parent, "end_around", 1); - sfi_unsigned(nhfp, &d_flag->moonphase, parent, "moonphase", 1); - sfi_ulong(nhfp, &d_flag->suppress_alert, parent, "suppress_alert", 1); - sfi_unsigned(nhfp, &d_flag->paranoia_bits, parent, "paranoia_bits", 1); - sfi_int(nhfp, &d_flag->pickup_burden, parent, "pickup_burden", 1); - sfi_int(nhfp, &d_flag->pile_limit, parent, "pile_limit", 1); - sfi_char(nhfp, &d_flag->sortloot, parent, "sortloot", 1); - sfi_char(nhfp, d_flag->inv_order, parent, "inv_order", MAXOCLASSES); - sfi_char(nhfp, d_flag->pickup_types, parent, "pickup_types", MAXOCLASSES); - sfi_char(nhfp, d_flag->end_disclose, parent, "end_disclose", NUM_DISCLOSURE_OPTIONS + 1); - sfi_char(nhfp, &d_flag->menu_style, parent, "menu_style", 1); - sfi_boolean(nhfp, &d_flag->made_fruit, parent, "made_fruit", 1); - sfi_int(nhfp, &d_flag->initrole, parent, "initrole", 1); - sfi_int(nhfp, &d_flag->initrace, parent, "initrace", 1); - sfi_int(nhfp, &d_flag->initgend, parent, "initgend", 1); - sfi_int(nhfp, &d_flag->initalign, parent, "initalign", 1); - sfi_int(nhfp, &d_flag->randomall, parent, "randomall", 1); - sfi_int(nhfp, &d_flag->pantheon, parent, "pantheon", 1); - sfi_boolean(nhfp, &d_flag->lootabc, parent, "lootabc", 1); - sfi_boolean(nhfp, &d_flag->showrace, parent, "showrace", 1); - sfi_boolean(nhfp, &d_flag->travelcmd, parent, "travelcmd", 1); - sfi_int(nhfp, &d_flag->runmode, parent, "runmode", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "flag", 1); -} - -void -sfi_fruit(nhfp, d_fruit, myparent, myname, cnt) -NHFILE *nhfp; -struct fruit *d_fruit; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fruit"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fruit", 1); - - sfi_char(nhfp, d_fruit->fname, parent, "fname", PL_FSIZ); - sfi_int(nhfp, &d_fruit->fid, parent, "fid", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_fruit->nextf, parent, "nextf", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fruit", 1); -} - -void -sfi_kinfo(nhfp, d_kinfo, myparent, myname, cnt) -NHFILE *nhfp; -struct kinfo *d_kinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "kinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "kinfo", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_kinfo->next, parent, "next", 1); - sfi_int(nhfp, &d_kinfo->id, parent, "id", 1); - sfi_int(nhfp, &d_kinfo->format, parent, "format", 1); - sfi_char(nhfp, d_kinfo->name, parent, "name", BUFSZ); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "kinfo", 1); -} - -void -sfi_levelflags(nhfp, d_levelflags, myparent, myname, cnt) -NHFILE *nhfp; -struct levelflags *d_levelflags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "levelflags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "levelflags", 1); - - sfi_uchar(nhfp, &d_levelflags->nfountains, parent, "nfountains", 1); - sfi_uchar(nhfp, &d_levelflags->nsinks, parent, "nsinks", 1); - bitfield = d_levelflags->has_shop; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_shop", 1); - d_levelflags->has_shop = bitfield; - - bitfield = d_levelflags->has_vault; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_vault", 1); - d_levelflags->has_vault = bitfield; - - bitfield = d_levelflags->has_zoo; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_zoo", 1); - d_levelflags->has_zoo = bitfield; - - bitfield = d_levelflags->has_court; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_court", 1); - d_levelflags->has_court = bitfield; - - bitfield = d_levelflags->has_morgue; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_morgue", 1); - d_levelflags->has_morgue = bitfield; - - bitfield = d_levelflags->has_beehive; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_beehive", 1); - d_levelflags->has_beehive = bitfield; - - bitfield = d_levelflags->has_barracks; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_barracks", 1); - d_levelflags->has_barracks = bitfield; - - bitfield = d_levelflags->has_temple; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_temple", 1); - d_levelflags->has_temple = bitfield; - - bitfield = d_levelflags->has_swamp; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_swamp", 1); - d_levelflags->has_swamp = bitfield; - - bitfield = d_levelflags->noteleport; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "noteleport", 1); - d_levelflags->noteleport = bitfield; - - bitfield = d_levelflags->hardfloor; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hardfloor", 1); - d_levelflags->hardfloor = bitfield; - - bitfield = d_levelflags->nommap; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nommap", 1); - d_levelflags->nommap = bitfield; - - bitfield = d_levelflags->hero_memory; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hero_memory", 1); - d_levelflags->hero_memory = bitfield; - - bitfield = d_levelflags->shortsighted; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "shortsighted", 1); - d_levelflags->shortsighted = bitfield; - - bitfield = d_levelflags->graveyard; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "graveyard", 1); - d_levelflags->graveyard = bitfield; - - bitfield = d_levelflags->sokoban_rules; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "sokoban_rules", 1); - d_levelflags->sokoban_rules = bitfield; - - bitfield = d_levelflags->is_maze_lev; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "is_maze_lev", 1); - d_levelflags->is_maze_lev = bitfield; - - bitfield = d_levelflags->is_cavernous_lev; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "is_cavernous_lev", 1); - d_levelflags->is_cavernous_lev = bitfield; - - bitfield = d_levelflags->arboreal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "arboreal", 1); - d_levelflags->arboreal = bitfield; - - bitfield = d_levelflags->wizard_bones; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "wizard_bones", 1); - d_levelflags->wizard_bones = bitfield; - - bitfield = d_levelflags->corrmaze; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "corrmaze", 1); - d_levelflags->corrmaze = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "levelflags", 1); -} - -void -sfi_linfo(nhfp, d_linfo, myparent, myname, cnt) -NHFILE *nhfp; -struct linfo *d_linfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "linfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "linfo", 1); - - sfi_uchar(nhfp, &d_linfo->flags, parent, "flags", 1); -#ifdef MFLOPPY - sfi_int(nhfp, &d_linfo->where, parent, "where", 1); - sfi_long(nhfp, &d_linfo->time, parent, "time", 1); - sfi_long(nhfp, &d_linfo->size, parent, "size", 1); -#endif /*MFLOPPY*/ - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "linfo", 1); -} - -void -sfi_ls_t(nhfp, d_ls_t, myparent, myname, cnt) -NHFILE *nhfp; -struct ls_t *d_ls_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ls_t"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "ls_t", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_ls_t->next, parent, "next", 1); - sfi_xchar(nhfp, &d_ls_t->x, parent, "x", 1); - sfi_xchar(nhfp, &d_ls_t->y, parent, "y", 1); - sfi_short(nhfp, &d_ls_t->range, parent, "range", 1); - sfi_short(nhfp, &d_ls_t->flags, parent, "flags", 1); - sfi_short(nhfp, &d_ls_t->type, parent, "type", 1); - sfi_any(nhfp, &d_ls_t->id, parent, "id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "ls_t", 1); -} - -void -sfi_mapseen_feat(nhfp, d_mapseen_feat, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_feat *d_mapseen_feat; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_feat"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_feat", 1); - - bitfield = d_mapseen_feat->nfount; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nfount", 2); - d_mapseen_feat->nfount = bitfield; - - bitfield = d_mapseen_feat->nsink; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nsink", 2); - d_mapseen_feat->nsink = bitfield; - - bitfield = d_mapseen_feat->naltar; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "naltar", 2); - d_mapseen_feat->naltar = bitfield; - - bitfield = d_mapseen_feat->nthrone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nthrone", 2); - d_mapseen_feat->nthrone = bitfield; - - bitfield = d_mapseen_feat->ngrave; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ngrave", 2); - d_mapseen_feat->ngrave = bitfield; - - bitfield = d_mapseen_feat->ntree; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ntree", 2); - d_mapseen_feat->ntree = bitfield; - - bitfield = d_mapseen_feat->water; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "water", 2); - d_mapseen_feat->water = bitfield; - - bitfield = d_mapseen_feat->lava; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lava", 2); - d_mapseen_feat->lava = bitfield; - - bitfield = d_mapseen_feat->ice; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ice", 2); - d_mapseen_feat->ice = bitfield; - - bitfield = d_mapseen_feat->nshop; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nshop", 2); - d_mapseen_feat->nshop = bitfield; - - bitfield = d_mapseen_feat->ntemple; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ntemple", 2); - d_mapseen_feat->ntemple = bitfield; - - bitfield = d_mapseen_feat->msalign; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msalign", 2); - d_mapseen_feat->msalign = bitfield; - - bitfield = d_mapseen_feat->shoptype; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "shoptype", 5); - d_mapseen_feat->shoptype = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_feat", 1); -} - -void -sfi_mapseen_flags(nhfp, d_mapseen_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_flags *d_mapseen_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_flags", 1); - - bitfield = d_mapseen_flags->unreachable; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unreachable", 1); - d_mapseen_flags->unreachable = bitfield; - - bitfield = d_mapseen_flags->forgot; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "forgot", 1); - d_mapseen_flags->forgot = bitfield; - - bitfield = d_mapseen_flags->knownbones; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "knownbones", 1); - d_mapseen_flags->knownbones = bitfield; - - bitfield = d_mapseen_flags->oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oracle", 1); - d_mapseen_flags->oracle = bitfield; - - bitfield = d_mapseen_flags->sokosolved; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "sokosolved", 1); - d_mapseen_flags->sokosolved = bitfield; - - bitfield = d_mapseen_flags->bigroom; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bigroom", 1); - d_mapseen_flags->bigroom = bitfield; - - bitfield = d_mapseen_flags->castle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "castle", 1); - d_mapseen_flags->castle = bitfield; - - bitfield = d_mapseen_flags->castletune; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "castletune", 1); - d_mapseen_flags->castletune = bitfield; - - bitfield = d_mapseen_flags->valley; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "valley", 1); - d_mapseen_flags->valley = bitfield; - - bitfield = d_mapseen_flags->msanctum; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msanctum", 1); - d_mapseen_flags->msanctum = bitfield; - - bitfield = d_mapseen_flags->ludios; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ludios", 1); - d_mapseen_flags->ludios = bitfield; - - bitfield = d_mapseen_flags->roguelevel; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "roguelevel", 1); - d_mapseen_flags->roguelevel = bitfield; - - bitfield = d_mapseen_flags->quest_summons; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "quest_summons", 1); - d_mapseen_flags->quest_summons = bitfield; - - bitfield = d_mapseen_flags->questing; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "questing", 1); - d_mapseen_flags->questing = bitfield; - - bitfield = d_mapseen_flags->vibrating_square; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "vibrating_square", 1); - d_mapseen_flags->vibrating_square = bitfield; - - bitfield = d_mapseen_flags->spare1; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "spare1", 1); - d_mapseen_flags->spare1 = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_flags", 1); -} - -void -sfi_mapseen_rooms(nhfp, d_mapseen_rooms, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_rooms *d_mapseen_rooms; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_rooms"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_rooms", 1); - - bitfield = d_mapseen_rooms->seen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "seen", 1); - d_mapseen_rooms->seen = bitfield; - - bitfield = d_mapseen_rooms->untended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "untended", 1); - d_mapseen_rooms->untended = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_rooms", 1); -} - -void -sfi_mapseen(nhfp, d_mapseen, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen *d_mapseen; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_mapseen->next, parent, "next", 1); - sfi_branch(nhfp, d_mapseen->br, parent, "br", 1); - sfi_d_level(nhfp, &d_mapseen->lev, parent, "lev", 1); - sfi_mapseen_feat(nhfp, &d_mapseen->feat, parent, "feat", 1); - sfi_mapseen_flags(nhfp, &d_mapseen->flags, parent, "flags", 1); - sfi_char(nhfp, d_mapseen->custom, parent, "custom", 1); - sfi_unsigned(nhfp, &d_mapseen->custom_lth, parent, "custom_lth", 1); - for (i = 0; i < (MAXNROFROOMS + 1) * 2; ++i) - sfi_mapseen_rooms(nhfp, &d_mapseen->msrooms[i], parent, "msrooms", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_mapseen->final_resting_place, parent, "final_resting_place", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen", 1); -} - -void -sfi_mextra(nhfp, d_mextra, myparent, myname, cnt) -NHFILE *nhfp; -struct mextra *d_mextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mextra", 1); - - sfi_char(nhfp, d_mextra->mname, parent, "mname", 1); - sfi_egd(nhfp, d_mextra->egd, parent, "egd", 1); - sfi_epri(nhfp, d_mextra->epri, parent, "epri", 1); - sfi_eshk(nhfp, d_mextra->eshk, parent, "eshk", 1); - sfi_emin(nhfp, d_mextra->emin, parent, "emin", 1); - sfi_edog(nhfp, d_mextra->edog, parent, "edog", 1); - sfi_int(nhfp, &d_mextra->mcorpsenm, parent, "mcorpsenm", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mextra", 1); -} - -void -sfi_mkroom(nhfp, d_mkroom, myparent, myname, cnt) -NHFILE *nhfp; -struct mkroom *d_mkroom; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mkroom"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mkroom", 1); - - sfi_schar(nhfp, &d_mkroom->lx, parent, "lx", 1); - sfi_schar(nhfp, &d_mkroom->hx, parent, "hx", 1); - sfi_schar(nhfp, &d_mkroom->ly, parent, "ly", 1); - sfi_schar(nhfp, &d_mkroom->hy, parent, "hy", 1); - sfi_schar(nhfp, &d_mkroom->rtype, parent, "rtype", 1); - sfi_schar(nhfp, &d_mkroom->orig_rtype, parent, "orig_rtype", 1); - sfi_schar(nhfp, &d_mkroom->rlit, parent, "rlit", 1); - sfi_schar(nhfp, &d_mkroom->needfill, parent, "needfill", 1); - sfi_schar(nhfp, &d_mkroom->needjoining, parent, "needjoining", 1); - sfi_schar(nhfp, &d_mkroom->doorct, parent, "doorct", 1); - sfi_schar(nhfp, &d_mkroom->fdoor, parent, "fdoor", 1); - sfi_schar(nhfp, &d_mkroom->nsubrooms, parent, "nsubrooms", 1); - sfi_boolean(nhfp, &d_mkroom->irregular, parent, "irregular", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_mkroom->sbrooms[0], parent, "sbrooms", MAX_SUBROOMS); - sfi_genericptr(nhfp, (genericptr_t) &d_mkroom->resident, parent, "resident", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mkroom", 1); -} - -void -sfi_monst(nhfp, d_monst, myparent, myname, cnt) -NHFILE *nhfp; -struct monst *d_monst; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "monst"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "monst", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_monst->nmon, parent, "nmon", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->data, parent, "data", 1); - sfi_unsigned(nhfp, &d_monst->m_id, parent, "m_id", 1); - sfi_short(nhfp, &d_monst->mnum, parent, "mnum", 1); - sfi_short(nhfp, &d_monst->cham, parent, "cham", 1); - sfi_short(nhfp, &d_monst->movement, parent, "movement", 1); - sfi_uchar(nhfp, &d_monst->m_lev, parent, "m_lev", 1); - sfi_aligntyp(nhfp, &d_monst->malign, parent, "malign", 1); - sfi_xchar(nhfp, &d_monst->mx, parent, "mx", 1); - sfi_xchar(nhfp, &d_monst->my, parent, "my", 1); - sfi_xchar(nhfp, &d_monst->mux, parent, "mux", 1); - sfi_xchar(nhfp, &d_monst->muy, parent, "muy", 1); - for (i = 0; i < MTSZ; ++i) - sfi_nhcoord(nhfp, &d_monst->mtrack[i], parent, "mtrack", 1); - sfi_int(nhfp, &d_monst->mhp, parent, "mhp", 1); - sfi_int(nhfp, &d_monst->mhpmax, parent, "mhpmax", 1); - sfi_unsigned(nhfp, &d_monst->mappearance, parent, "mappearance", 1); - sfi_uchar(nhfp, &d_monst->m_ap_type, parent, "m_ap_type", 1); - sfi_schar(nhfp, &d_monst->mtame, parent, "mtame", 1); - sfi_ushort(nhfp, &d_monst->mextrinsics, parent, "mextrinsics", 1); - sfi_int(nhfp, &d_monst->mspec_used, parent, "mspec_used", 1); - bitfield = d_monst->female; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "female", 1); - d_monst->female = bitfield; - - bitfield = d_monst->minvis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "minvis", 1); - d_monst->minvis = bitfield; - - bitfield = d_monst->invis_blkd; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "invis_blkd", 1); - d_monst->invis_blkd = bitfield; - - bitfield = d_monst->perminvis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "perminvis", 1); - d_monst->perminvis = bitfield; - - bitfield = d_monst->mcan; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcan", 1); - d_monst->mcan = bitfield; - - bitfield = d_monst->mburied; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mburied", 1); - d_monst->mburied = bitfield; - - bitfield = d_monst->mundetected; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mundetected", 1); - d_monst->mundetected = bitfield; - - bitfield = d_monst->mcansee; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcansee", 1); - d_monst->mcansee = bitfield; - - bitfield = d_monst->mspeed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mspeed", 2); - d_monst->mspeed = bitfield; - - bitfield = d_monst->permspeed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "permspeed", 2); - d_monst->permspeed = bitfield; - - bitfield = d_monst->mrevived; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mrevived", 1); - d_monst->mrevived = bitfield; - - bitfield = d_monst->mcloned; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcloned", 1); - d_monst->mcloned = bitfield; - - bitfield = d_monst->mavenge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mavenge", 1); - d_monst->mavenge = bitfield; - - bitfield = d_monst->mflee; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mflee", 1); - d_monst->mflee = bitfield; - - bitfield = d_monst->mfleetim; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfleetim", 7); - d_monst->mfleetim = bitfield; - - bitfield = d_monst->msleeping; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msleeping", 1); - d_monst->msleeping = bitfield; - - bitfield = d_monst->mblinded; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mblinded", 7); - d_monst->mblinded = bitfield; - - bitfield = d_monst->mstun; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mstun", 1); - d_monst->mstun = bitfield; - - bitfield = d_monst->mfrozen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfrozen", 7); - d_monst->mfrozen = bitfield; - - bitfield = d_monst->mcanmove; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcanmove", 1); - d_monst->mcanmove = bitfield; - - bitfield = d_monst->mconf; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mconf", 1); - d_monst->mconf = bitfield; - - bitfield = d_monst->mpeaceful; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mpeaceful", 1); - d_monst->mpeaceful = bitfield; - - bitfield = d_monst->mtrapped; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mtrapped", 1); - d_monst->mtrapped = bitfield; - - bitfield = d_monst->mleashed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mleashed", 1); - d_monst->mleashed = bitfield; - - bitfield = d_monst->isshk; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isshk", 1); - d_monst->isshk = bitfield; - - bitfield = d_monst->isminion; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isminion", 1); - d_monst->isminion = bitfield; - - bitfield = d_monst->isgd; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isgd", 1); - d_monst->isgd = bitfield; - - bitfield = d_monst->ispriest; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ispriest", 1); - d_monst->ispriest = bitfield; - - bitfield = d_monst->iswiz; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "iswiz", 1); - d_monst->iswiz = bitfield; - - bitfield = d_monst->wormno; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "wormno", 5); - d_monst->wormno = bitfield; - - bitfield = d_monst->mtemplit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mtemplit", 1); - d_monst->mtemplit = bitfield; - - sfi_ulong(nhfp, &d_monst->mstrategy, parent, "mstrategy", 1); - sfi_long(nhfp, &d_monst->mtrapseen, parent, "mtrapseen", 1); - sfi_long(nhfp, &d_monst->mlstmv, parent, "mlstmv", 1); - sfi_long(nhfp, &d_monst->mstate, parent, "mstate", 1); - sfi_long(nhfp, &d_monst->migflags, parent, "migflags", 1); - sfi_long(nhfp, &d_monst->mspare1, parent, "mspare1", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->minvent, parent, "minvent", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->mw, parent, "mw", 1); - sfi_long(nhfp, &d_monst->misc_worn_check, parent, "misc_worn_check", 1); - sfi_xchar(nhfp, &d_monst->weapon_check, parent, "weapon_check", 1); - sfi_int(nhfp, &d_monst->meating, parent, "meating", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->mextra, parent, "mextra", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "monst", 1); -} - -void -sfi_mvitals(nhfp, d_mvitals, myparent, myname, cnt) -NHFILE *nhfp; -struct mvitals *d_mvitals; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mvitals"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mvitals", 1); - - sfi_uchar(nhfp, &d_mvitals->born, parent, "born", 1); - sfi_uchar(nhfp, &d_mvitals->died, parent, "died", 1); - sfi_uchar(nhfp, &d_mvitals->mvflags, parent, "mvflags", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mvitals", 1); -} - -void -sfi_nhcoord(nhfp, d_nhcoord, myparent, myname, cnt) -NHFILE *nhfp; -struct nhcoord *d_nhcoord; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhcoord"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "nhcoord", 1); - - sfi_xchar(nhfp, &d_nhcoord->x, parent, "x", 1); - sfi_xchar(nhfp, &d_nhcoord->y, parent, "y", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "nhcoord", 1); -} - -void -sfi_nhrect(nhfp, d_nhrect, myparent, myname, cnt) -NHFILE *nhfp; -struct nhrect *d_nhrect; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhrect"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "nhrect", 1); - - sfi_xchar(nhfp, &d_nhrect->lx, parent, "lx", 1); - sfi_xchar(nhfp, &d_nhrect->ly, parent, "ly", 1); - sfi_xchar(nhfp, &d_nhrect->hx, parent, "hx", 1); - sfi_xchar(nhfp, &d_nhrect->hy, parent, "hy", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "nhrect", 1); -} - -void -sfi_novel_tracking(nhfp, d_novel_tracking, myparent, myname, cnt) -NHFILE *nhfp; -struct novel_tracking *d_novel_tracking; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "novel_tracking"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "novel_tracking", 1); - - sfi_unsigned(nhfp, &d_novel_tracking->id, parent, "id", 1); - sfi_int(nhfp, &d_novel_tracking->count, parent, "count", 1); - sfi_xchar(nhfp, d_novel_tracking->pasg, parent, "pasg", 30); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "novel_tracking", 1); -} - -void -sfi_obj(nhfp, d_obj, myparent, myname, cnt) -NHFILE *nhfp; -struct obj *d_obj; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "obj", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_obj->nobj, parent, "nobj", 1); - sfi_vptrs(nhfp, &d_obj->v, parent, "v", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_obj->cobj, parent, "cobj", 1); - sfi_unsigned(nhfp, &d_obj->o_id, parent, "o_id", 1); - sfi_xchar(nhfp, &d_obj->ox, parent, "ox", 1); - sfi_xchar(nhfp, &d_obj->oy, parent, "oy", 1); - sfi_short(nhfp, &d_obj->otyp, parent, "otyp", 1); - sfi_unsigned(nhfp, &d_obj->owt, parent, "owt", 1); - sfi_long(nhfp, &d_obj->quan, parent, "quan", 1); - sfi_schar(nhfp, &d_obj->spe, parent, "spe", 1); - sfi_char(nhfp, &d_obj->oclass, parent, "oclass", 1); - sfi_char(nhfp, &d_obj->invlet, parent, "invlet", 1); - sfi_char(nhfp, &d_obj->oartifact, parent, "oartifact", 1); - sfi_xchar(nhfp, &d_obj->where, parent, "where", 1); - sfi_xchar(nhfp, &d_obj->timed, parent, "timed", 1); - bitfield = d_obj->cursed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cursed", 1); - d_obj->cursed = bitfield; - - bitfield = d_obj->blessed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "blessed", 1); - d_obj->blessed = bitfield; - - bitfield = d_obj->unpaid; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unpaid", 1); - d_obj->unpaid = bitfield; - - bitfield = d_obj->no_charge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "no_charge", 1); - d_obj->no_charge = bitfield; - - bitfield = d_obj->known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "known", 1); - d_obj->known = bitfield; - - bitfield = d_obj->dknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "dknown", 1); - d_obj->dknown = bitfield; - - bitfield = d_obj->bknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bknown", 1); - d_obj->bknown = bitfield; - - bitfield = d_obj->rknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "rknown", 1); - d_obj->rknown = bitfield; - - bitfield = d_obj->oeroded; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oeroded", 2); - d_obj->oeroded = bitfield; - - bitfield = d_obj->oeroded2; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oeroded2", 2); - d_obj->oeroded2 = bitfield; - - bitfield = d_obj->oerodeproof; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oerodeproof", 1); - d_obj->oerodeproof = bitfield; - - bitfield = d_obj->olocked; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "olocked", 1); - d_obj->olocked = bitfield; - - bitfield = d_obj->obroken; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "obroken", 1); - d_obj->obroken = bitfield; - - bitfield = d_obj->otrapped; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "otrapped", 1); - d_obj->otrapped = bitfield; - - bitfield = d_obj->recharged; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "recharged", 3); - d_obj->recharged = bitfield; - - bitfield = d_obj->lamplit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lamplit", 1); - d_obj->lamplit = bitfield; - - bitfield = d_obj->globby; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "globby", 1); - d_obj->globby = bitfield; - - bitfield = d_obj->greased; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "greased", 1); - d_obj->greased = bitfield; - - bitfield = d_obj->nomerge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nomerge", 1); - d_obj->nomerge = bitfield; - - bitfield = d_obj->was_thrown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "was_thrown", 1); - d_obj->was_thrown = bitfield; - - bitfield = d_obj->in_use; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "in_use", 1); - d_obj->in_use = bitfield; - - bitfield = d_obj->bypass; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bypass", 1); - d_obj->bypass = bitfield; - - bitfield = d_obj->cknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cknown", 1); - d_obj->cknown = bitfield; - - bitfield = d_obj->lknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lknown", 1); - d_obj->lknown = bitfield; - - sfi_int(nhfp, &d_obj->corpsenm, parent, "corpsenm", 1); - sfi_int(nhfp, &d_obj->usecount, parent, "usecount", 1); - sfi_unsigned(nhfp, &d_obj->oeaten, parent, "oeaten", 1); - sfi_long(nhfp, &d_obj->age, parent, "age", 1); - sfi_long(nhfp, &d_obj->owornmask, parent, "owornmask", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_obj->oextra, parent, "oextra", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "obj", 1); -} - -void -sfi_objclass(nhfp, d_objclass, myparent, myname, cnt) -NHFILE *nhfp; -struct objclass *d_objclass; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "objclass"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "objclass", 1); - - sfi_short(nhfp, &d_objclass->oc_name_idx, parent, "oc_name_idx", 1); - sfi_short(nhfp, &d_objclass->oc_descr_idx, parent, "oc_descr_idx", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_objclass->oc_uname, parent, "oc_uname", 1); - bitfield = d_objclass->oc_name_known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_name_known", 1); - d_objclass->oc_name_known = bitfield; - - bitfield = d_objclass->oc_merge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_merge", 1); - d_objclass->oc_merge = bitfield; - - bitfield = d_objclass->oc_uses_known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_uses_known", 1); - d_objclass->oc_uses_known = bitfield; - - bitfield = d_objclass->oc_pre_discovered; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_pre_discovered", 1); - d_objclass->oc_pre_discovered = bitfield; - - bitfield = d_objclass->oc_magic; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_magic", 1); - d_objclass->oc_magic = bitfield; - - bitfield = d_objclass->oc_charged; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_charged", 1); - d_objclass->oc_charged = bitfield; - - bitfield = d_objclass->oc_unique; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_unique", 1); - d_objclass->oc_unique = bitfield; - - bitfield = d_objclass->oc_nowish; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_nowish", 1); - d_objclass->oc_nowish = bitfield; - - bitfield = d_objclass->oc_big; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_big", 1); - d_objclass->oc_big = bitfield; - - bitfield = d_objclass->oc_tough; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_tough", 1); - d_objclass->oc_tough = bitfield; - - bitfield = d_objclass->oc_dir; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_dir", 2); - d_objclass->oc_dir = bitfield; - - bitfield = d_objclass->oc_material; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_material", 5); - d_objclass->oc_material = bitfield; - - sfi_schar(nhfp, &d_objclass->oc_subtyp, parent, "oc_subtyp", 1); - sfi_uchar(nhfp, &d_objclass->oc_oprop, parent, "oc_oprop", 1); - sfi_char(nhfp, &d_objclass->oc_class, parent, "oc_class", 1); - sfi_schar(nhfp, &d_objclass->oc_delay, parent, "oc_delay", 1); - sfi_uchar(nhfp, &d_objclass->oc_color, parent, "oc_color", 1); - sfi_short(nhfp, &d_objclass->oc_prob, parent, "oc_prob", 1); - sfi_ushort(nhfp, &d_objclass->oc_weight, parent, "oc_weight", 1); - sfi_short(nhfp, &d_objclass->oc_cost, parent, "oc_cost", 1); - sfi_schar(nhfp, &d_objclass->oc_wsdam, parent, "oc_wsdam", 1); - sfi_schar(nhfp, &d_objclass->oc_wldam, parent, "oc_wldam", 1); - sfi_schar(nhfp, &d_objclass->oc_oc1, parent, "oc_oc1", 1); - sfi_schar(nhfp, &d_objclass->oc_oc2, parent, "oc_oc2", 1); - sfi_ushort(nhfp, &d_objclass->oc_nutrition, parent, "oc_nutrition", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "objclass", 1); -} - -void -sfi_obj_split(nhfp, d_obj_split, myparent, myname, cnt) -NHFILE *nhfp; -struct obj_split *d_obj_split; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj_split"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "obj_split", 1); - - sfi_unsigned(nhfp, &d_obj_split->parent_oid, parent, "parent_oid", 1); - sfi_unsigned(nhfp, &d_obj_split->child_oid, parent, "child_oid", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "obj_split", 1); -} - -void -sfi_oextra(nhfp, d_oextra, myparent, myname, cnt) -NHFILE *nhfp; -struct oextra *d_oextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "oextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "oextra", 1); - - sfi_char(nhfp, d_oextra->oname, parent, "oname", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_oextra->omonst, parent, "omonst", 1); - sfi_unsigned(nhfp, d_oextra->omid, parent, "omid", 1); - sfi_long(nhfp, d_oextra->olong, parent, "olong", 1); - sfi_char(nhfp, d_oextra->omailcmd, parent, "omailcmd", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "oextra", 1); -} - -void -sfi_polearm_info(nhfp, d_polearm_info, myparent, myname, cnt) -NHFILE *nhfp; -struct polearm_info *d_polearm_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "polearm_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "polearm_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_polearm_info->hitmon, parent, "hitmon", 1); - sfi_unsigned(nhfp, &d_polearm_info->m_id, parent, "m_id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "polearm_info", 1); -} - -void -sfi_prop(nhfp, d_prop, myparent, myname, cnt) -NHFILE *nhfp; -struct prop *d_prop; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "prop"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "prop", 1); - - sfi_long(nhfp, &d_prop->extrinsic, parent, "extrinsic", 1); - sfi_long(nhfp, &d_prop->blocked, parent, "blocked", 1); - sfi_long(nhfp, &d_prop->intrinsic, parent, "intrinsic", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "prop", 1); -} - -void -sfi_q_score(nhfp, d_q_score, myparent, myname, cnt) -NHFILE *nhfp; -struct q_score *d_q_score; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "q_score"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "q_score", 1); - - bitfield = d_q_score->first_start; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "first_start", 1); - d_q_score->first_start = bitfield; - - bitfield = d_q_score->met_leader; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_leader", 1); - d_q_score->met_leader = bitfield; - - bitfield = d_q_score->not_ready; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "not_ready", 3); - d_q_score->not_ready = bitfield; - - bitfield = d_q_score->pissed_off; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "pissed_off", 1); - d_q_score->pissed_off = bitfield; - - bitfield = d_q_score->got_quest; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_quest", 1); - d_q_score->got_quest = bitfield; - - bitfield = d_q_score->first_locate; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "first_locate", 1); - d_q_score->first_locate = bitfield; - - bitfield = d_q_score->met_intermed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_intermed", 1); - d_q_score->met_intermed = bitfield; - - bitfield = d_q_score->got_final; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_final", 1); - d_q_score->got_final = bitfield; - - bitfield = d_q_score->made_goal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "made_goal", 3); - d_q_score->made_goal = bitfield; - - bitfield = d_q_score->met_nemesis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_nemesis", 1); - d_q_score->met_nemesis = bitfield; - - bitfield = d_q_score->killed_nemesis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_nemesis", 1); - d_q_score->killed_nemesis = bitfield; - - bitfield = d_q_score->in_battle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "in_battle", 1); - d_q_score->in_battle = bitfield; - - bitfield = d_q_score->cheater; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cheater", 1); - d_q_score->cheater = bitfield; - - bitfield = d_q_score->touched_artifact; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "touched_artifact", 1); - d_q_score->touched_artifact = bitfield; - - bitfield = d_q_score->offered_artifact; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "offered_artifact", 1); - d_q_score->offered_artifact = bitfield; - - bitfield = d_q_score->got_thanks; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_thanks", 1); - d_q_score->got_thanks = bitfield; - - bitfield = d_q_score->ldrgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ldrgend", 2); - d_q_score->ldrgend = bitfield; - - bitfield = d_q_score->nemgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nemgend", 2); - d_q_score->nemgend = bitfield; - - bitfield = d_q_score->godgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "godgend", 2); - d_q_score->godgend = bitfield; - - bitfield = d_q_score->leader_is_dead; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "leader_is_dead", 1); - d_q_score->leader_is_dead = bitfield; - - sfi_unsigned(nhfp, &d_q_score->leader_m_id, parent, "leader_m_id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "q_score", 1); -} - -void -sfi_rm(nhfp, d_rm, myparent, myname, cnt) -NHFILE *nhfp; -struct rm *d_rm; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "rm"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "rm", 1); - - sfi_int(nhfp, &d_rm->glyph, parent, "glyph", 1); - sfi_schar(nhfp, &d_rm->typ, parent, "typ", 1); - sfi_uchar(nhfp, &d_rm->seenv, parent, "seenv", 1); - bitfield = d_rm->flags; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "flags", 5); - d_rm->flags = bitfield; - - bitfield = d_rm->horizontal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "horizontal", 1); - d_rm->horizontal = bitfield; - - bitfield = d_rm->lit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lit", 1); - d_rm->lit = bitfield; - - bitfield = d_rm->waslit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "waslit", 1); - d_rm->waslit = bitfield; - - bitfield = d_rm->roomno; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "roomno", 6); - d_rm->roomno = bitfield; - - bitfield = d_rm->edge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "edge", 1); - d_rm->edge = bitfield; - - bitfield = d_rm->candig; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "candig", 1); - d_rm->candig = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "rm", 1); -} - -void -sfi_s_level(nhfp, d_s_level, myparent, myname, cnt) -NHFILE *nhfp; -struct s_level *d_s_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "s_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "s_level", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_s_level->next, parent, "next", 1); - sfi_d_level(nhfp, &d_s_level->dlevel, parent, "dlevel", 1); - sfi_char(nhfp, d_s_level->proto, parent, "proto", 15); - sfi_char(nhfp, &d_s_level->boneid, parent, "boneid", 1); - sfi_uchar(nhfp, &d_s_level->rndlevs, parent, "rndlevs", 1); - sfi_d_flags(nhfp, &d_s_level->flags, parent, "flags", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "s_level", 1); -} - -void -sfi_savefile_info(nhfp, d_savefile_info, myparent, myname, cnt) -NHFILE *nhfp; -struct savefile_info *d_savefile_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "savefile_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "savefile_info", 1); - - sfi_ulong(nhfp, &d_savefile_info->sfi1, parent, "sfi1", 1); - sfi_ulong(nhfp, &d_savefile_info->sfi2, parent, "sfi2", 1); - sfi_ulong(nhfp, &d_savefile_info->sfi3, parent, "sfi3", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "savefile_info", 1); -} - -void -sfi_skills(nhfp, d_skills, myparent, myname, cnt) -NHFILE *nhfp; -struct skills *d_skills; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "skills"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "skills", 1); - - sfi_xchar(nhfp, &d_skills->skill, parent, "skill", 1); - sfi_xchar(nhfp, &d_skills->max_skill, parent, "max_skill", 1); - sfi_ushort(nhfp, &d_skills->advance, parent, "advance", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "skills", 1); -} - -void -sfi_spell(nhfp, d_spell, myparent, myname, cnt) -NHFILE *nhfp; -struct spell *d_spell; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "spell"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "spell", 1); - - sfi_short(nhfp, &d_spell->sp_id, parent, "sp_id", 1); - sfi_xchar(nhfp, &d_spell->sp_lev, parent, "sp_lev", 1); - sfi_int(nhfp, &d_spell->sp_know, parent, "sp_know", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "spell", 1); -} - -void -sfi_stairway(nhfp, d_stairway, myparent, myname, cnt) -NHFILE *nhfp; -struct stairway *d_stairway; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "stairway"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "stairway", 1); - - sfi_xchar(nhfp, &d_stairway->sx, parent, "sx", 1); - sfi_xchar(nhfp, &d_stairway->sy, parent, "sy", 1); - sfi_d_level(nhfp, &d_stairway->tolev, parent, "tolev", 1); - sfi_char(nhfp, &d_stairway->up, parent, "up", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "stairway", 1); -} - -void -sfi_takeoff_info(nhfp, d_takeoff_info, myparent, myname, cnt) -NHFILE *nhfp; -struct takeoff_info *d_takeoff_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "takeoff_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "takeoff_info", 1); - - sfi_long(nhfp, &d_takeoff_info->mask, parent, "mask", 1); - sfi_long(nhfp, &d_takeoff_info->what, parent, "what", 1); - sfi_int(nhfp, &d_takeoff_info->delay, parent, "delay", 1); - sfi_boolean(nhfp, &d_takeoff_info->cancelled_don, parent, "cancelled_don", 1); - sfi_char(nhfp, d_takeoff_info->disrobing, parent, "disrobing", CONTEXTVERBSZ + 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "takeoff_info", 1); -} - -void -sfi_tin_info(nhfp, d_tin_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tin_info *d_tin_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tin_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "tin_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_tin_info->tin, parent, "tin", 1); - sfi_unsigned(nhfp, &d_tin_info->o_id, parent, "o_id", 1); - sfi_int(nhfp, &d_tin_info->usedtime, parent, "usedtime", 1); - sfi_int(nhfp, &d_tin_info->reqtime, parent, "reqtime", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "tin_info", 1); -} - -void -sfi_trap(nhfp, d_trap, myparent, myname, cnt) -NHFILE *nhfp; -struct trap *d_trap; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "trap"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "trap", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_trap->ntrap, parent, "ntrap", 1); - sfi_xchar(nhfp, &d_trap->tx, parent, "tx", 1); - sfi_xchar(nhfp, &d_trap->ty, parent, "ty", 1); - sfi_d_level(nhfp, &d_trap->dst, parent, "dst", 1); - sfi_nhcoord(nhfp, &d_trap->launch, parent, "launch", 1); - bitfield = d_trap->ttyp; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ttyp", 5); - d_trap->ttyp = bitfield; - - bitfield = d_trap->tseen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "tseen", 1); - d_trap->tseen = bitfield; - - bitfield = d_trap->once; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "once", 1); - d_trap->once = bitfield; - - bitfield = d_trap->madeby_u; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "madeby_u", 1); - d_trap->madeby_u = bitfield; - - sfi_vlaunchinfo(nhfp, &d_trap->vl, parent, "vl", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "trap", 1); -} - -void -sfi_tribute_info(nhfp, d_tribute_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tribute_info *d_tribute_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tribute_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "tribute_info", 1); - - sfi_size_t(nhfp, &d_tribute_info->tributesz, parent, "tributesz", 1); - sfi_boolean(nhfp, &d_tribute_info->enabled, parent, "enabled", 1); - bitfield = d_tribute_info->bookstock; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bookstock", 1); - d_tribute_info->bookstock = bitfield; - - bitfield = d_tribute_info->Deathnotice; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "Deathnotice", 1); - d_tribute_info->Deathnotice = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "tribute_info", 1); -} - -void -sfi_u_achieve(nhfp, d_u_achieve, myparent, myname, cnt) -NHFILE *nhfp; -struct u_achieve *d_u_achieve; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_achieve"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_achieve", 1); - - bitfield = d_u_achieve->amulet; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "amulet", 1); - d_u_achieve->amulet = bitfield; - - bitfield = d_u_achieve->bell; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bell", 1); - d_u_achieve->bell = bitfield; - - bitfield = d_u_achieve->book; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "book", 1); - d_u_achieve->book = bitfield; - - bitfield = d_u_achieve->menorah; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "menorah", 1); - d_u_achieve->menorah = bitfield; - - bitfield = d_u_achieve->enter_gehennom; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "enter_gehennom", 1); - d_u_achieve->enter_gehennom = bitfield; - - bitfield = d_u_achieve->ascended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ascended", 1); - d_u_achieve->ascended = bitfield; - - bitfield = d_u_achieve->mines_luckstone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mines_luckstone", 1); - d_u_achieve->mines_luckstone = bitfield; - - bitfield = d_u_achieve->finish_sokoban; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "finish_sokoban", 1); - d_u_achieve->finish_sokoban = bitfield; - - bitfield = d_u_achieve->killed_medusa; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_medusa", 1); - d_u_achieve->killed_medusa = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_achieve", 1); -} - -void -sfi_u_conduct(nhfp, d_u_conduct, myparent, myname, cnt) -NHFILE *nhfp; -struct u_conduct *d_u_conduct; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_conduct"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_conduct", 1); - - sfi_long(nhfp, &d_u_conduct->unvegetarian, parent, "unvegetarian", 1); - sfi_long(nhfp, &d_u_conduct->unvegan, parent, "unvegan", 1); - sfi_long(nhfp, &d_u_conduct->food, parent, "food", 1); - sfi_long(nhfp, &d_u_conduct->gnostic, parent, "gnostic", 1); - sfi_long(nhfp, &d_u_conduct->weaphit, parent, "weaphit", 1); - sfi_long(nhfp, &d_u_conduct->killer, parent, "killer", 1); - sfi_long(nhfp, &d_u_conduct->literate, parent, "literate", 1); - sfi_long(nhfp, &d_u_conduct->polypiles, parent, "polypiles", 1); - sfi_long(nhfp, &d_u_conduct->polyselfs, parent, "polyselfs", 1); - sfi_long(nhfp, &d_u_conduct->wishes, parent, "wishes", 1); - sfi_long(nhfp, &d_u_conduct->wisharti, parent, "wisharti", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_conduct", 1); -} - -void -sfi_u_event(nhfp, d_u_event, myparent, myname, cnt) -NHFILE *nhfp; -struct u_event *d_u_event; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_event"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_event", 1); - - bitfield = d_u_event->minor_oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "minor_oracle", 1); - d_u_event->minor_oracle = bitfield; - - bitfield = d_u_event->major_oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "major_oracle", 1); - d_u_event->major_oracle = bitfield; - - bitfield = d_u_event->read_tribute; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "read_tribute", 1); - d_u_event->read_tribute = bitfield; - - bitfield = d_u_event->qcalled; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qcalled", 1); - d_u_event->qcalled = bitfield; - - bitfield = d_u_event->qexpelled; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qexpelled", 1); - d_u_event->qexpelled = bitfield; - - bitfield = d_u_event->qcompleted; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qcompleted", 1); - d_u_event->qcompleted = bitfield; - - bitfield = d_u_event->uheard_tune; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uheard_tune", 2); - d_u_event->uheard_tune = bitfield; - - bitfield = d_u_event->uopened_dbridge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uopened_dbridge", 1); - d_u_event->uopened_dbridge = bitfield; - - bitfield = d_u_event->invoked; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "invoked", 1); - d_u_event->invoked = bitfield; - - bitfield = d_u_event->gehennom_entered; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "gehennom_entered", 1); - d_u_event->gehennom_entered = bitfield; - - bitfield = d_u_event->uhand_of_elbereth; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uhand_of_elbereth", 2); - d_u_event->uhand_of_elbereth = bitfield; - - bitfield = d_u_event->udemigod; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "udemigod", 1); - d_u_event->udemigod = bitfield; - - bitfield = d_u_event->uvibrated; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uvibrated", 1); - d_u_event->uvibrated = bitfield; - - bitfield = d_u_event->ascended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ascended", 1); - d_u_event->ascended = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_event", 1); -} - -void -sfi_u_have(nhfp, d_u_have, myparent, myname, cnt) -NHFILE *nhfp; -struct u_have *d_u_have; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_have"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_have", 1); - - bitfield = d_u_have->amulet; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "amulet", 1); - d_u_have->amulet = bitfield; - - bitfield = d_u_have->bell; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bell", 1); - d_u_have->bell = bitfield; - - bitfield = d_u_have->book; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "book", 1); - d_u_have->book = bitfield; - - bitfield = d_u_have->menorah; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "menorah", 1); - d_u_have->menorah = bitfield; - - bitfield = d_u_have->questart; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "questart", 1); - d_u_have->questart = bitfield; - - bitfield = d_u_have->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 3); - d_u_have->unused = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_have", 1); -} - -void -sfi_u_realtime(nhfp, d_u_realtime, myparent, myname, cnt) -NHFILE *nhfp; -struct u_realtime *d_u_realtime; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_realtime"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_realtime", 1); - - sfi_long(nhfp, &d_u_realtime->realtime, parent, "realtime", 1); - sfi_time_t(nhfp, &d_u_realtime->start_timing, parent, "start_timing", 1); - sfi_time_t(nhfp, &d_u_realtime->finish_time, parent, "finish_time", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_realtime", 1); -} - -void -sfi_u_roleplay(nhfp, d_u_roleplay, myparent, myname, cnt) -NHFILE *nhfp; -struct u_roleplay *d_u_roleplay; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_roleplay"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_roleplay", 1); - - sfi_boolean(nhfp, &d_u_roleplay->blind, parent, "blind", 1); - sfi_boolean(nhfp, &d_u_roleplay->nudist, parent, "nudist", 1); - sfi_long(nhfp, &d_u_roleplay->numbones, parent, "numbones", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_roleplay", 1); -} - -void -sfi_version_info(nhfp, d_version_info, myparent, myname, cnt) -NHFILE *nhfp; -struct version_info *d_version_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "version_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "version_info", 1); - - sfi_ulong(nhfp, &d_version_info->incarnation, parent, "incarnation", 1); - sfi_ulong(nhfp, &d_version_info->feature_set, parent, "feature_set", 1); - sfi_ulong(nhfp, &d_version_info->entity_count, parent, "entity_count", 1); - sfi_ulong(nhfp, &d_version_info->struct_sizes1, parent, "struct_sizes1", 1); - sfi_ulong(nhfp, &d_version_info->struct_sizes2, parent, "struct_sizes2", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "version_info", 1); -} - -void -sfi_victual_info(nhfp, d_victual_info, myparent, myname, cnt) -NHFILE *nhfp; -struct victual_info *d_victual_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "victual_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "victual_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_victual_info->piece, parent, "piece", 1); - sfi_unsigned(nhfp, &d_victual_info->o_id, parent, "o_id", 1); - sfi_int(nhfp, &d_victual_info->usedtime, parent, "usedtime", 1); - sfi_int(nhfp, &d_victual_info->reqtime, parent, "reqtime", 1); - sfi_int(nhfp, &d_victual_info->nmod, parent, "nmod", 1); - bitfield = d_victual_info->canchoke; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "canchoke", 1); - d_victual_info->canchoke = bitfield; - - bitfield = d_victual_info->fullwarn; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "fullwarn", 1); - d_victual_info->fullwarn = bitfield; - - bitfield = d_victual_info->eating; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "eating", 1); - d_victual_info->eating = bitfield; - - bitfield = d_victual_info->doreset; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "doreset", 1); - d_victual_info->doreset = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "victual_info", 1); -} - -void -sfi_vlaunchinfo(nhfp, d_vlaunchinfo, myparent, myname, cnt) -NHFILE *nhfp; -union vlaunchinfo *d_vlaunchinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vlaunchinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "vlaunchinfo", 1); - - sfi_short(nhfp, &d_vlaunchinfo->v_launch_otyp, parent, "v_launch_otyp", 1); - sfi_nhcoord(nhfp, &d_vlaunchinfo->v_launch2, parent, "v_launch2", 1); - sfi_uchar(nhfp, &d_vlaunchinfo->v_conjoined, parent, "v_conjoined", 1); - sfi_short(nhfp, &d_vlaunchinfo->v_tnote, parent, "v_tnote", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "vlaunchinfo", 1); -} - -void -sfi_vptrs(nhfp, d_vptrs, myparent, myname, cnt) -NHFILE *nhfp; -union vptrs *d_vptrs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vptrs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "vptrs", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_nexthere, parent, "v_nexthere", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocontainer, parent, "v_ocontainer", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocarry, parent, "v_ocarry", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "vptrs", 1); -} - -void -sfi_warntype_info(nhfp, d_warntype_info, myparent, myname, cnt) -NHFILE *nhfp; -struct warntype_info *d_warntype_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "warntype_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "warntype_info", 1); - - sfi_ulong(nhfp, &d_warntype_info->obj, parent, "obj", 1); - sfi_ulong(nhfp, &d_warntype_info->polyd, parent, "polyd", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_warntype_info->species, parent, "species", 1); - sfi_short(nhfp, &d_warntype_info->speciesidx, parent, "speciesidx", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "warntype_info", 1); -} - -void -sfi_you(nhfp, d_you, myparent, myname, cnt) -NHFILE *nhfp; -struct you *d_you; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "you"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "you", 1); - - sfi_xchar(nhfp, &d_you->ux, parent, "ux", 1); - sfi_xchar(nhfp, &d_you->uy, parent, "uy", 1); - sfi_schar(nhfp, &d_you->dx, parent, "dx", 1); - sfi_schar(nhfp, &d_you->dy, parent, "dy", 1); - sfi_schar(nhfp, &d_you->dz, parent, "dz", 1); - sfi_schar(nhfp, &d_you->di, parent, "di", 1); - sfi_xchar(nhfp, &d_you->tx, parent, "tx", 1); - sfi_xchar(nhfp, &d_you->ty, parent, "ty", 1); - sfi_xchar(nhfp, &d_you->ux0, parent, "ux0", 1); - sfi_xchar(nhfp, &d_you->uy0, parent, "uy0", 1); - sfi_d_level(nhfp, &d_you->uz, parent, "uz", 1); - sfi_d_level(nhfp, &d_you->uz0, parent, "uz0", 1); - sfi_d_level(nhfp, &d_you->utolev, parent, "utolev", 1); - sfi_uchar(nhfp, &d_you->utotype, parent, "utotype", 1); - sfi_boolean(nhfp, &d_you->umoved, parent, "umoved", 1); - sfi_int(nhfp, &d_you->last_str_turn, parent, "last_str_turn", 1); - sfi_int(nhfp, &d_you->ulevel, parent, "ulevel", 1); - sfi_int(nhfp, &d_you->ulevelmax, parent, "ulevelmax", 1); - sfi_unsigned(nhfp, &d_you->utrap, parent, "utrap", 1); - sfi_unsigned(nhfp, &d_you->utraptype, parent, "utraptype", 1); - sfi_char(nhfp, d_you->urooms, parent, "urooms", 5); - sfi_char(nhfp, d_you->urooms0, parent, "urooms0", 5); - sfi_char(nhfp, d_you->uentered, parent, "uentered", 5); - sfi_char(nhfp, d_you->ushops, parent, "ushops", 5); - sfi_char(nhfp, d_you->ushops0, parent, "ushops0", 5); - sfi_char(nhfp, d_you->ushops_entered, parent, "ushops_entered", 5); - sfi_char(nhfp, d_you->ushops_left, parent, "ushops_left", 5); - sfi_int(nhfp, &d_you->uhunger, parent, "uhunger", 1); - sfi_unsigned(nhfp, &d_you->uhs, parent, "uhs", 1); - sfi_prop(nhfp, d_you->uprops, parent, "uprops", LAST_PROP + 1); - sfi_unsigned(nhfp, &d_you->umconf, parent, "umconf", 1); - bitfield = d_you->usick_type; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "usick_type", 2); - d_you->usick_type = bitfield; - - sfi_int(nhfp, &d_you->nv_range, parent, "nv_range", 1); - sfi_int(nhfp, &d_you->xray_range, parent, "xray_range", 1); - sfi_int(nhfp, &d_you->bglyph, parent, "bglyph", 1); - sfi_int(nhfp, &d_you->cglyph, parent, "cglyph", 1); - sfi_int(nhfp, &d_you->bc_order, parent, "bc_order", 1); - sfi_int(nhfp, &d_you->bc_felt, parent, "bc_felt", 1); - sfi_int(nhfp, &d_you->umonster, parent, "umonster", 1); - sfi_int(nhfp, &d_you->umonnum, parent, "umonnum", 1); - sfi_int(nhfp, &d_you->mh, parent, "mh", 1); - sfi_int(nhfp, &d_you->mhmax, parent, "mhmax", 1); - sfi_int(nhfp, &d_you->mtimedone, parent, "mtimedone", 1); - sfi_attribs(nhfp, &d_you->macurr, parent, "macurr", 1); - sfi_attribs(nhfp, &d_you->mamax, parent, "mamax", 1); - sfi_int(nhfp, &d_you->ulycn, parent, "ulycn", 1); - sfi_unsigned(nhfp, &d_you->ucreamed, parent, "ucreamed", 1); - sfi_unsigned(nhfp, &d_you->uswldtim, parent, "uswldtim", 1); - bitfield = d_you->uswallow; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uswallow", 1); - d_you->uswallow = bitfield; - - bitfield = d_you->uinwater; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uinwater", 1); - d_you->uinwater = bitfield; - - bitfield = d_you->uundetected; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uundetected", 1); - d_you->uundetected = bitfield; - - bitfield = d_you->mfemale; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfemale", 1); - d_you->mfemale = bitfield; - - bitfield = d_you->uinvulnerable; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uinvulnerable", 1); - d_you->uinvulnerable = bitfield; - - bitfield = d_you->uburied; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uburied", 1); - d_you->uburied = bitfield; - - bitfield = d_you->uedibility; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uedibility", 1); - d_you->uedibility = bitfield; - - sfi_unsigned(nhfp, &d_you->udg_cnt, parent, "udg_cnt", 1); - sfi_u_achieve(nhfp, &d_you->uachieve, parent, "uachieve", 1); - sfi_u_event(nhfp, &d_you->uevent, parent, "uevent", 1); - sfi_u_have(nhfp, &d_you->uhave, parent, "uhave", 1); - sfi_u_conduct(nhfp, &d_you->uconduct, parent, "uconduct", 1); - sfi_u_roleplay(nhfp, &d_you->uroleplay, parent, "uroleplay", 1); - sfi_attribs(nhfp, &d_you->acurr, parent, "acurr", 1); - sfi_attribs(nhfp, &d_you->aexe, parent, "aexe", 1); - sfi_attribs(nhfp, &d_you->abon, parent, "abon", 1); - sfi_attribs(nhfp, &d_you->amax, parent, "amax", 1); - sfi_attribs(nhfp, &d_you->atemp, parent, "atemp", 1); - sfi_attribs(nhfp, &d_you->atime, parent, "atime", 1); - sfi_align(nhfp, &d_you->ualign, parent, "ualign", 1); - for (i = 0; i < CONVERT; ++i) - sfi_aligntyp(nhfp, &d_you->ualignbase[i], parent, "ualignbase", 1); - sfi_schar(nhfp, &d_you->uluck, parent, "uluck", 1); - sfi_schar(nhfp, &d_you->moreluck, parent, "moreluck", 1); - sfi_schar(nhfp, &d_you->uhitinc, parent, "uhitinc", 1); - sfi_schar(nhfp, &d_you->udaminc, parent, "udaminc", 1); - sfi_schar(nhfp, &d_you->uac, parent, "uac", 1); - sfi_uchar(nhfp, &d_you->uspellprot, parent, "uspellprot", 1); - sfi_uchar(nhfp, &d_you->usptime, parent, "usptime", 1); - sfi_uchar(nhfp, &d_you->uspmtime, parent, "uspmtime", 1); - sfi_int(nhfp, &d_you->uhp, parent, "uhp", 1); - sfi_int(nhfp, &d_you->uhpmax, parent, "uhpmax", 1); - sfi_int(nhfp, &d_you->uen, parent, "uen", 1); - sfi_int(nhfp, &d_you->uenmax, parent, "uenmax", 1); - sfi_xchar(nhfp, d_you->uhpinc, parent, "uhpinc", MAXULEV); - sfi_xchar(nhfp, d_you->ueninc, parent, "ueninc", MAXULEV); - sfi_int(nhfp, &d_you->ugangr, parent, "ugangr", 1); - sfi_int(nhfp, &d_you->ugifts, parent, "ugifts", 1); - sfi_int(nhfp, &d_you->ublessed, parent, "ublessed", 1); - sfi_int(nhfp, &d_you->ublesscnt, parent, "ublesscnt", 1); - sfi_long(nhfp, &d_you->umoney0, parent, "umoney0", 1); - sfi_long(nhfp, &d_you->uspare1, parent, "uspare1", 1); - sfi_long(nhfp, &d_you->uexp, parent, "uexp", 1); - sfi_long(nhfp, &d_you->urexp, parent, "urexp", 1); - sfi_long(nhfp, &d_you->ucleansed, parent, "ucleansed", 1); - sfi_long(nhfp, &d_you->usleep, parent, "usleep", 1); - sfi_int(nhfp, &d_you->uinvault, parent, "uinvault", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_you->ustuck, parent, "ustuck", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_you->usteed, parent, "usteed", 1); - sfi_long(nhfp, &d_you->ugallop, parent, "ugallop", 1); - sfi_int(nhfp, &d_you->urideturns, parent, "urideturns", 1); - sfi_int(nhfp, &d_you->umortality, parent, "umortality", 1); - sfi_int(nhfp, &d_you->ugrave_arise, parent, "ugrave_arise", 1); - sfi_int(nhfp, &d_you->weapon_slots, parent, "weapon_slots", 1); - sfi_int(nhfp, &d_you->skills_advanced, parent, "skills_advanced", 1); - sfi_xchar(nhfp, d_you->skill_record, parent, "skill_record", P_SKILL_LIMIT); - for (i = 0; i < P_NUM_SKILLS; ++i) - sfi_skills(nhfp, &d_you->weapon_skills[i], parent, "weapon_skills", 1); - sfi_boolean(nhfp, &d_you->twoweap, parent, "twoweap", 1); - sfi_short(nhfp, &d_you->mcham, parent, "mcham", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "you", 1); -} -struct nhdatatypes_t nhdatatypes[] = { - {NHTYPE_SIMPLE, (char *) "any", sizeof(anything)}, - {NHTYPE_SIMPLE, (char *) "genericptr_t", sizeof(genericptr_t)}, - {NHTYPE_SIMPLE, (char *) "aligntyp", sizeof(aligntyp)}, - {NHTYPE_SIMPLE, (char *) "Bitfield", sizeof(uint8_t)}, - {NHTYPE_SIMPLE, (char *) "boolean", sizeof(boolean)}, - {NHTYPE_SIMPLE, (char *) "char", sizeof(char)}, - {NHTYPE_SIMPLE, (char *) "int", sizeof(int)}, - {NHTYPE_SIMPLE, (char *) "long", sizeof(long)}, - {NHTYPE_SIMPLE, (char *) "schar", sizeof(schar)}, - {NHTYPE_SIMPLE, (char *) "short", sizeof(short)}, - {NHTYPE_SIMPLE, (char *) "size_t", sizeof(size_t)}, - {NHTYPE_SIMPLE, (char *) "string", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "time_t", sizeof(time_t)}, - {NHTYPE_SIMPLE, (char *) "uchar", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "unsigned char", sizeof(unsigned char)}, - {NHTYPE_SIMPLE, (char *) "unsigned int", sizeof(unsigned int)}, - {NHTYPE_SIMPLE, (char *) "unsigned long", sizeof(unsigned long)}, - {NHTYPE_SIMPLE, (char *) "unsigned short", sizeof(unsigned short)}, - {NHTYPE_SIMPLE, (char *) "unsigned", sizeof(unsigned)}, - {NHTYPE_SIMPLE, (char *) "xchar", sizeof(xchar)}, - {NHTYPE_COMPLEX, (char *) "align", sizeof(struct align)}, - {NHTYPE_COMPLEX, (char *) "attribs", sizeof(struct attribs)}, - {NHTYPE_COMPLEX, (char *) "dig_info", sizeof(struct dig_info)}, - {NHTYPE_COMPLEX, (char *) "tin_info", sizeof(struct tin_info)}, - {NHTYPE_COMPLEX, (char *) "book_info", sizeof(struct book_info)}, - {NHTYPE_COMPLEX, (char *) "takeoff_info", sizeof(struct takeoff_info)}, - {NHTYPE_COMPLEX, (char *) "victual_info", sizeof(struct victual_info)}, - {NHTYPE_COMPLEX, (char *) "warntype_info", sizeof(struct warntype_info)}, - {NHTYPE_COMPLEX, (char *) "polearm_info", sizeof(struct polearm_info)}, - {NHTYPE_COMPLEX, (char *) "obj_split", sizeof(struct obj_split)}, - {NHTYPE_COMPLEX, (char *) "tribute_info", sizeof(struct tribute_info)}, - {NHTYPE_COMPLEX, (char *) "novel_tracking", sizeof(struct novel_tracking)}, - {NHTYPE_COMPLEX, (char *) "context_info", sizeof(struct context_info)}, - {NHTYPE_COMPLEX, (char *) "nhcoord", sizeof(struct nhcoord)}, - {NHTYPE_COMPLEX, (char *) "dgn_topology", sizeof(struct dgn_topology)}, - {NHTYPE_COMPLEX, (char *) "kinfo", sizeof(struct kinfo)}, - {NHTYPE_COMPLEX, (char *) "mvitals", sizeof(struct mvitals)}, - {NHTYPE_COMPLEX, (char *) "ls_t", sizeof(struct ls_t)}, - {NHTYPE_COMPLEX, (char *) "bubble", sizeof(struct bubble)}, - {NHTYPE_COMPLEX, (char *) "d_flags", sizeof(struct d_flags)}, - {NHTYPE_COMPLEX, (char *) "d_level", sizeof(struct d_level)}, - {NHTYPE_COMPLEX, (char *) "s_level", sizeof(struct s_level)}, - {NHTYPE_COMPLEX, (char *) "stairway", sizeof(struct stairway)}, - {NHTYPE_COMPLEX, (char *) "dest_area", sizeof(struct dest_area)}, - {NHTYPE_COMPLEX, (char *) "dungeon", sizeof(struct dungeon)}, - {NHTYPE_COMPLEX, (char *) "branch", sizeof(struct branch)}, - {NHTYPE_COMPLEX, (char *) "linfo", sizeof(struct linfo)}, - {NHTYPE_COMPLEX, (char *) "mapseen", sizeof(struct mapseen)}, - {NHTYPE_COMPLEX, (char *) "mapseen_feat", sizeof(struct mapseen_feat)}, - {NHTYPE_COMPLEX, (char *) "mapseen_flags", sizeof(struct mapseen_flags)}, - {NHTYPE_COMPLEX, (char *) "mapseen_rooms", sizeof(struct mapseen_rooms)}, - {NHTYPE_COMPLEX, (char *) "engr", sizeof(struct engr)}, - {NHTYPE_COMPLEX, (char *) "flag", sizeof(struct flag)}, - {NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info)}, - {NHTYPE_COMPLEX, (char *) "savefile_info", sizeof(struct savefile_info)}, - {NHTYPE_COMPLEX, (char *) "fakecorridor", sizeof(struct fakecorridor)}, - {NHTYPE_COMPLEX, (char *) "egd", sizeof(struct egd)}, - {NHTYPE_COMPLEX, (char *) "epri", sizeof(struct epri)}, - {NHTYPE_COMPLEX, (char *) "bill_x", sizeof(struct bill_x)}, - {NHTYPE_COMPLEX, (char *) "eshk", sizeof(struct eshk)}, - {NHTYPE_COMPLEX, (char *) "emin", sizeof(struct emin)}, - {NHTYPE_COMPLEX, (char *) "edog", sizeof(struct edog)}, - {NHTYPE_COMPLEX, (char *) "mextra", sizeof(struct mextra)}, - {NHTYPE_COMPLEX, (char *) "mkroom", sizeof(struct mkroom)}, - {NHTYPE_COMPLEX, (char *) "monst", sizeof(struct monst)}, - {NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs)}, - {NHTYPE_COMPLEX, (char *) "oextra", sizeof(struct oextra)}, - {NHTYPE_COMPLEX, (char *) "obj", sizeof(struct obj)}, - {NHTYPE_COMPLEX, (char *) "objclass", sizeof(struct objclass)}, - {NHTYPE_COMPLEX, (char *) "fruit", sizeof(struct fruit)}, - {NHTYPE_COMPLEX, (char *) "prop", sizeof(struct prop)}, - {NHTYPE_COMPLEX, (char *) "q_score", sizeof(struct q_score)}, - {NHTYPE_COMPLEX, (char *) "nhrect", sizeof(struct nhrect)}, - {NHTYPE_COMPLEX, (char *) "rm", sizeof(struct rm)}, - {NHTYPE_COMPLEX, (char *) "damage", sizeof(struct damage)}, - {NHTYPE_COMPLEX, (char *) "cemetery", sizeof(struct cemetery)}, - {NHTYPE_COMPLEX, (char *) "levelflags", sizeof(struct levelflags)}, - {NHTYPE_COMPLEX, (char *) "skills", sizeof(struct skills)}, - {NHTYPE_COMPLEX, (char *) "spell", sizeof(struct spell)}, - {NHTYPE_COMPLEX, (char *) "fe", sizeof(struct fe)}, - {NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo)}, - {NHTYPE_COMPLEX, (char *) "trap", sizeof(struct trap)}, - {NHTYPE_COMPLEX, (char *) "u_have", sizeof(struct u_have)}, - {NHTYPE_COMPLEX, (char *) "u_event", sizeof(struct u_event)}, - {NHTYPE_COMPLEX, (char *) "u_achieve", sizeof(struct u_achieve)}, - {NHTYPE_COMPLEX, (char *) "u_realtime", sizeof(struct u_realtime)}, - {NHTYPE_COMPLEX, (char *) "u_conduct", sizeof(struct u_conduct)}, - {NHTYPE_COMPLEX, (char *) "u_roleplay", sizeof(struct u_roleplay)}, - {NHTYPE_COMPLEX, (char *) "you", sizeof(struct you)} -}; - -int nhdatatypes_size() -{ - return SIZE(nhdatatypes); -} - -const char *critical_members[] = { - "struct align:type:aligntyp", - "struct align:record:int", - "struct attribs:a:schar", - "struct bill_x:bo_id:unsigned", - "struct bill_x:useup:boolean", - "struct bill_x:price:long", - "struct bill_x:bquan:long", - "struct book_info:book:struct obj *", - "struct book_info:o_id:unsigned", - "struct book_info:delay:schar", - "struct branch:next:struct branch *", - "struct branch:id:int", - "struct branch:type:int", - "struct branch:end1:d_level", - "struct branch:end2:d_level", - "struct branch:end1_up:boolean", - "struct bubble:x:xchar", - "struct bubble:y:xchar", - "struct bubble:dx:schar", - "struct bubble:dy:schar", - "struct bubble:bm:uchar", - "struct bubble:prev:struct bubble *", - "struct bubble:next:struct bubble *", - "struct bubble:cons:struct container *", - "struct cemetery:next:struct cemetery *", - "struct cemetery:who:char", - "struct cemetery:how:char", - "struct cemetery:when:char", - "struct cemetery:frpx:schar", - "struct cemetery:frpy:schar", - "struct cemetery:bonesknown:boolean", - "struct context_info:ident:unsigned", - "struct context_info:no_of_wizards:unsigned", - "struct context_info:run:unsigned", - "struct context_info:startingpet_mid:unsigned", - "struct context_info:current_fruit:int", - "struct context_info:warnlevel:int", - "struct context_info:rndencode:int", - "struct context_info:next_attrib_check:long", - "struct context_info:stethoscope_move:long", - "struct context_info:stethoscope_movement:short", - "struct context_info:travel:boolean", - "struct context_info:travel1:boolean", - "struct context_info:forcefight:boolean", - "struct context_info:nopick:boolean", - "struct context_info:made_amulet:boolean", - "struct context_info:mon_moving:boolean", - "struct context_info:move:boolean", - "struct context_info:mv:boolean", - "struct context_info:bypasses:boolean", - "struct context_info:botl:boolean", - "struct context_info:botlx:boolean", - "struct context_info:door_opened:boolean", - "struct context_info:digging:dig_info", - "struct context_info:victual:victual_info", - "struct context_info:tin:tin_info", - "struct context_info:spbook:book_info", - "struct context_info:takeoff:takeoff_info", - "struct context_info:warntype:warntype_info", - "struct context_info:polearm:polearm_info", - "struct context_info:objsplit:obj_split", - "struct context_info:tribute:tribute_info", - "struct context_info:novel:novel_tracking", - "struct d_flags:town:Bitfield(town, 1)", - "struct d_flags:hellish:Bitfield(hellish, 1)", - "struct d_flags:maze_like:Bitfield(maze_like, 1)", - "struct d_flags:rogue_like:Bitfield(rogue_like, 1)", - "struct d_flags:align:Bitfield(align, 3)", - "struct d_flags:unused:Bitfield(unused, 1)", - "struct d_level:dnum:xchar", - "struct d_level:dlevel:xchar", - "struct damage:next:struct damage *", - "struct damage:when:long", - "struct damage:cost:long", - "struct damage:place:nhcoord", - "struct damage:typ:schar", - "struct dest_area:lx:xchar", - "struct dest_area:ly:xchar", - "struct dest_area:hx:xchar", - "struct dest_area:hy:xchar", - "struct dest_area:nlx:xchar", - "struct dest_area:nly:xchar", - "struct dest_area:nhx:xchar", - "struct dest_area:nhy:xchar", - "struct dgn_topology:d_oracle_level:d_level", - "struct dgn_topology:d_bigroom_level:d_level", - "struct dgn_topology:d_rogue_level:d_level", - "struct dgn_topology:d_medusa_level:d_level", - "struct dgn_topology:d_stronghold_level:d_level", - "struct dgn_topology:d_valley_level:d_level", - "struct dgn_topology:d_wiz1_level:d_level", - "struct dgn_topology:d_wiz2_level:d_level", - "struct dgn_topology:d_wiz3_level:d_level", - "struct dgn_topology:d_juiblex_level:d_level", - "struct dgn_topology:d_orcus_level:d_level", - "struct dgn_topology:d_baalzebub_level:d_level", - "struct dgn_topology:d_asmodeus_level:d_level", - "struct dgn_topology:d_portal_level:d_level", - "struct dgn_topology:d_sanctum_level:d_level", - "struct dgn_topology:d_earth_level:d_level", - "struct dgn_topology:d_water_level:d_level", - "struct dgn_topology:d_fire_level:d_level", - "struct dgn_topology:d_air_level:d_level", - "struct dgn_topology:d_astral_level:d_level", - "struct dgn_topology:d_tower_dnum:xchar", - "struct dgn_topology:d_sokoban_dnum:xchar", - "struct dgn_topology:d_mines_dnum:xchar", - "struct dgn_topology:d_quest_dnum:xchar", - "struct dgn_topology:d_qstart_level:d_level", - "struct dgn_topology:d_qlocate_level:d_level", - "struct dgn_topology:d_nemesis_level:d_level", - "struct dgn_topology:d_knox_level:d_level", - "struct dgn_topology:d_mineend_level:d_level", - "struct dgn_topology:d_sokoend_level:d_level", - "struct dig_info:effort:int", - "struct dig_info:level:d_level", - "struct dig_info:pos:nhcoord", - "struct dig_info:lastdigtime:long", - "struct dig_info:down:boolean", - "struct dig_info:chew:boolean", - "struct dig_info:warned:boolean", - "struct dig_info:quiet:boolean", - "struct dungeon:dname:char", - "struct dungeon:proto:char", - "struct dungeon:boneid:char", - "struct dungeon:flags:d_flags", - "struct dungeon:entry_lev:xchar", - "struct dungeon:num_dunlevs:xchar", - "struct dungeon:dunlev_ureached:xchar", - "struct dungeon:ledger_start:int", - "struct dungeon:depth_start:int", - "struct edog:droptime:long", - "struct edog:dropdist:unsigned", - "struct edog:apport:int", - "struct edog:whistletime:long", - "struct edog:hungrytime:long", - "struct edog:ogoal:nhcoord", - "struct edog:abuse:int", - "struct edog:revivals:int", - "struct edog:mhpmax_penalty:int", - "struct edog:killed_by_u:Bitfield(killed_by_u, 1)", - "struct egd:fcbeg:int", - "struct egd:fcend:int", - "struct egd:vroom:int", - "struct egd:gdx:xchar", - "struct egd:gdy:xchar", - "struct egd:ogx:xchar", - "struct egd:ogy:xchar", - "struct egd:gdlevel:d_level", - "struct egd:warncnt:xchar", - "struct egd:gddone:Bitfield(gddone, 1)", - "struct egd:witness:Bitfield(witness, 2)", - "struct egd:unused:Bitfield(unused, 5)", - "struct egd:fakecorr:fakecorridor", - "struct emin:min_align:aligntyp", - "struct emin:renegade:boolean", - "struct engr:nxt_engr:struct engr *", - "struct engr:engr_txt:char *", - "struct engr:engr_x:xchar", - "struct engr:engr_y:xchar", - "struct engr:engr_lth:unsigned", - "struct engr:engr_time:long", - "struct engr:engr_type:xchar", - "struct epri:shralign:aligntyp", - "struct epri:shroom:schar", - "struct epri:shrpos:nhcoord", - "struct epri:shrlevel:d_level", - "struct epri:intone_time:long", - "struct epri:enter_time:long", - "struct epri:hostile_time:long", - "struct epri:peaceful_time:long", - "struct eshk:robbed:long", - "struct eshk:credit:long", - "struct eshk:debit:long", - "struct eshk:loan:long", - "struct eshk:shoptype:int", - "struct eshk:shoproom:schar", - "struct eshk:unused:schar", - "struct eshk:following:boolean", - "struct eshk:surcharge:boolean", - "struct eshk:dismiss_kops:boolean", - "struct eshk:shk:nhcoord", - "struct eshk:shd:nhcoord", - "struct eshk:shoplevel:d_level", - "struct eshk:billct:int", - "struct eshk:bill:bill_x", - "struct eshk:bill_p:struct bill_x *", - "struct eshk:visitct:int", - "struct eshk:customer:char", - "struct eshk:shknam:char", - "struct fakecorridor:fx:xchar", - "struct fakecorridor:fy:xchar", - "struct fakecorridor:ftyp:xchar", - "struct fe:next:struct fe *", - "struct fe:timeout:long", - "struct fe:tid:unsigned long", - "struct fe:kind:short", - "struct fe:func_index:short", - "struct fe:arg:any", - "struct fe:needs_fixup:Bitfield(needs_fixup, 1)", - "struct flag:acoustics:boolean", - "struct flag:autodig:boolean", - "struct flag:autoquiver:boolean", - "struct flag:autoopen:boolean", - "struct flag:beginner:boolean", - "struct flag:biff:boolean", - "struct flag:bones:boolean", - "struct flag:confirm:boolean", - "struct flag:dark_room:boolean", - "struct flag:debug:boolean", - "struct flag:end_own:boolean", - "struct flag:explore:boolean", - "struct flag:female:boolean", - "struct flag:friday13:boolean", - "struct flag:goldX:boolean", - "struct flag:help:boolean", - "struct flag:ignintr:boolean", - "struct flag:ins_chkpt:boolean", - "struct flag:invlet_constant:boolean", - "struct flag:legacy:boolean", - "struct flag:lit_corridor:boolean", - "struct flag:nap:boolean", - "struct flag:null:boolean", - "struct flag:pickup:boolean", - "struct flag:pickup_thrown:boolean", - "struct flag:pushweapon:boolean", - "struct flag:rest_on_space:boolean", - "struct flag:safe_dog:boolean", - "struct flag:showexp:boolean", - "struct flag:showscore:boolean", - "struct flag:silent:boolean", - "struct flag:sortpack:boolean", - "struct flag:sparkle:boolean", - "struct flag:standout:boolean", - "struct flag:time:boolean", - "struct flag:tombstone:boolean", - "struct flag:verbose:boolean", - "struct flag:end_top:int", - "struct flag:end_around:int", - "struct flag:moonphase:unsigned", - "struct flag:suppress_alert:unsigned long", - "struct flag:paranoia_bits:unsigned", - "struct flag:pickup_burden:int", - "struct flag:pile_limit:int", - "struct flag:sortloot:char", - "struct flag:inv_order:char", - "struct flag:pickup_types:char", - "struct flag:end_disclose:char", - "struct flag:menu_style:char", - "struct flag:made_fruit:boolean", - "struct flag:initrole:int", - "struct flag:initrace:int", - "struct flag:initgend:int", - "struct flag:initalign:int", - "struct flag:randomall:int", - "struct flag:pantheon:int", - "struct flag:lootabc:boolean", - "struct flag:showrace:boolean", - "struct flag:travelcmd:boolean", - "struct flag:runmode:int", - "struct fruit:fname:char", - "struct fruit:fid:int", - "struct fruit:nextf:struct fruit *", - "struct kinfo:next:struct kinfo *", - "struct kinfo:id:int", - "struct kinfo:format:int", - "struct kinfo:name:char", - "struct levelflags:nfountains:uchar", - "struct levelflags:nsinks:uchar", - "struct levelflags:has_shop:Bitfield(has_shop, 1)", - "struct levelflags:has_vault:Bitfield(has_vault, 1)", - "struct levelflags:has_zoo:Bitfield(has_zoo, 1)", - "struct levelflags:has_court:Bitfield(has_court, 1)", - "struct levelflags:has_morgue:Bitfield(has_morgue, 1)", - "struct levelflags:has_beehive:Bitfield(has_beehive, 1)", - "struct levelflags:has_barracks:Bitfield(has_barracks, 1)", - "struct levelflags:has_temple:Bitfield(has_temple, 1)", - "struct levelflags:has_swamp:Bitfield(has_swamp, 1)", - "struct levelflags:noteleport:Bitfield(noteleport, 1)", - "struct levelflags:hardfloor:Bitfield(hardfloor, 1)", - "struct levelflags:nommap:Bitfield(nommap, 1)", - "struct levelflags:hero_memory:Bitfield(hero_memory, 1)", - "struct levelflags:shortsighted:Bitfield(shortsighted, 1)", - "struct levelflags:graveyard:Bitfield(graveyard, 1)", - "struct levelflags:sokoban_rules:Bitfield(sokoban_rules, 1)", - "struct levelflags:is_maze_lev:Bitfield(is_maze_lev, 1)", - "struct levelflags:is_cavernous_lev:Bitfield(is_cavernous_lev, 1)", - "struct levelflags:arboreal:Bitfield(arboreal, 1)", - "struct levelflags:wizard_bones:Bitfield(wizard_bones, 1)", - "struct levelflags:corrmaze:Bitfield(corrmaze, 1)", - "struct linfo:flags:unsigned char", -#ifdef MFLOPPY - "struct linfo:where:int", - "struct linfo:time:long", - "struct linfo:size:long", -#endif /*MFLOPPY*/ - "struct ls_t:next:struct ls_t *", - "struct ls_t:x:xchar", - "struct ls_t:y:xchar", - "struct ls_t:range:short", - "struct ls_t:flags:short", - "struct ls_t:type:short", - "struct ls_t:id:any", - "struct mapseen_feat:nfount:Bitfield(nfount, 2)", - "struct mapseen_feat:nsink:Bitfield(nsink, 2)", - "struct mapseen_feat:naltar:Bitfield(naltar, 2)", - "struct mapseen_feat:nthrone:Bitfield(nthrone, 2)", - "struct mapseen_feat:ngrave:Bitfield(ngrave, 2)", - "struct mapseen_feat:ntree:Bitfield(ntree, 2)", - "struct mapseen_feat:water:Bitfield(water, 2)", - "struct mapseen_feat:lava:Bitfield(lava, 2)", - "struct mapseen_feat:ice:Bitfield(ice, 2)", - "struct mapseen_feat:nshop:Bitfield(nshop, 2)", - "struct mapseen_feat:ntemple:Bitfield(ntemple, 2)", - "struct mapseen_feat:msalign:Bitfield(msalign, 2)", - "struct mapseen_feat:shoptype:Bitfield(shoptype, 5)", - "struct mapseen_flags:unreachable:Bitfield(unreachable, 1)", - "struct mapseen_flags:forgot:Bitfield(forgot, 1)", - "struct mapseen_flags:knownbones:Bitfield(knownbones, 1)", - "struct mapseen_flags:oracle:Bitfield(oracle, 1)", - "struct mapseen_flags:sokosolved:Bitfield(sokosolved, 1)", - "struct mapseen_flags:bigroom:Bitfield(bigroom, 1)", - "struct mapseen_flags:castle:Bitfield(castle, 1)", - "struct mapseen_flags:castletune:Bitfield(castletune, 1)", - "struct mapseen_flags:valley:Bitfield(valley, 1)", - "struct mapseen_flags:msanctum:Bitfield(msanctum, 1)", - "struct mapseen_flags:ludios:Bitfield(ludios, 1)", - "struct mapseen_flags:roguelevel:Bitfield(roguelevel, 1)", - "struct mapseen_flags:quest_summons:Bitfield(quest_summons, 1)", - "struct mapseen_flags:questing:Bitfield(questing, 1)", - "struct mapseen_flags:vibrating_square:Bitfield(vibrating_square, 1)", - "struct mapseen_flags:spare1:Bitfield(spare1, 1)", - "struct mapseen_rooms:seen:Bitfield(seen, 1)", - "struct mapseen_rooms:untended:Bitfield(untended, 1)", - "struct mapseen:next:struct mapseen *", - "struct mapseen:br:branch *", - "struct mapseen:lev:d_level", - "struct mapseen:feat:mapseen_feat", - "struct mapseen:flags:mapseen_flags", - "struct mapseen:custom:char *", - "struct mapseen:custom_lth:unsigned", - "struct mapseen:msrooms:mapseen_rooms", - "struct mapseen:final_resting_place:struct cemetery *", - "struct mextra:mname:char *", - "struct mextra:egd:struct egd *", - "struct mextra:epri:struct epri *", - "struct mextra:eshk:struct eshk *", - "struct mextra:emin:struct emin *", - "struct mextra:edog:struct edog *", - "struct mextra:mcorpsenm:int", - "struct mkroom:lx:schar", - "struct mkroom:hx:schar", - "struct mkroom:ly:schar", - "struct mkroom:hy:schar", - "struct mkroom:rtype:schar", - "struct mkroom:orig_rtype:schar", - "struct mkroom:rlit:schar", - "struct mkroom:needfill:schar", - "struct mkroom:needjoining:schar", - "struct mkroom:doorct:schar", - "struct mkroom:fdoor:schar", - "struct mkroom:nsubrooms:schar", - "struct mkroom:irregular:boolean", - "struct mkroom:sbrooms:struct mkroom *", - "struct mkroom:resident:struct monst *", - "struct monst:nmon:struct monst *", - "struct monst:data:struct permonst *", - "struct monst:m_id:unsigned", - "struct monst:mnum:short", - "struct monst:cham:short", - "struct monst:movement:short", - "struct monst:m_lev:uchar", - "struct monst:malign:aligntyp", - "struct monst:mx:xchar", - "struct monst:my:xchar", - "struct monst:mux:xchar", - "struct monst:muy:xchar", - "struct monst:mtrack:nhcoord", - "struct monst:mhp:int", - "struct monst:mhpmax:int", - "struct monst:mappearance:unsigned", - "struct monst:m_ap_type:uchar", - "struct monst:mtame:schar", - "struct monst:mextrinsics:unsigned short", - "struct monst:mspec_used:int", - "struct monst:female:Bitfield(female, 1)", - "struct monst:minvis:Bitfield(minvis, 1)", - "struct monst:invis_blkd:Bitfield(invis_blkd, 1)", - "struct monst:perminvis:Bitfield(perminvis, 1)", - "struct monst:mcan:Bitfield(mcan, 1)", - "struct monst:mburied:Bitfield(mburied, 1)", - "struct monst:mundetected:Bitfield(mundetected, 1)", - "struct monst:mcansee:Bitfield(mcansee, 1)", - "struct monst:mspeed:Bitfield(mspeed, 2)", - "struct monst:permspeed:Bitfield(permspeed, 2)", - "struct monst:mrevived:Bitfield(mrevived, 1)", - "struct monst:mcloned:Bitfield(mcloned, 1)", - "struct monst:mavenge:Bitfield(mavenge, 1)", - "struct monst:mflee:Bitfield(mflee, 1)", - "struct monst:mfleetim:Bitfield(mfleetim, 7)", - "struct monst:msleeping:Bitfield(msleeping, 1)", - "struct monst:mblinded:Bitfield(mblinded, 7)", - "struct monst:mstun:Bitfield(mstun, 1)", - "struct monst:mfrozen:Bitfield(mfrozen, 7)", - "struct monst:mcanmove:Bitfield(mcanmove, 1)", - "struct monst:mconf:Bitfield(mconf, 1)", - "struct monst:mpeaceful:Bitfield(mpeaceful, 1)", - "struct monst:mtrapped:Bitfield(mtrapped, 1)", - "struct monst:mleashed:Bitfield(mleashed, 1)", - "struct monst:isshk:Bitfield(isshk, 1)", - "struct monst:isminion:Bitfield(isminion, 1)", - "struct monst:isgd:Bitfield(isgd, 1)", - "struct monst:ispriest:Bitfield(ispriest, 1)", - "struct monst:iswiz:Bitfield(iswiz, 1)", - "struct monst:wormno:Bitfield(wormno, 5)", - "struct monst:mtemplit:Bitfield(mtemplit, 1)", - "struct monst:mstrategy:unsigned long", - "struct monst:mtrapseen:long", - "struct monst:mlstmv:long", - "struct monst:mstate:long", - "struct monst:migflags:long", - "struct monst:mspare1:long", - "struct monst:minvent:struct obj *", - "struct monst:mw:struct obj *", - "struct monst:misc_worn_check:long", - "struct monst:weapon_check:xchar", - "struct monst:meating:int", - "struct monst:mextra:struct mextra *", - "struct mvitals:born:uchar", - "struct mvitals:died:uchar", - "struct mvitals:mvflags:uchar", - "struct nhcoord:x:xchar", - "struct nhcoord:y:xchar", - "struct nhrect:lx:xchar", - "struct nhrect:ly:xchar", - "struct nhrect:hx:xchar", - "struct nhrect:hy:xchar", - "struct novel_tracking:id:unsigned", - "struct novel_tracking:count:int", - "struct novel_tracking:pasg:xchar", - "struct obj:nobj:struct obj *", - "struct obj:v:vptrs", - "struct obj:cobj:struct obj *", - "struct obj:o_id:unsigned", - "struct obj:ox:xchar", - "struct obj:oy:xchar", - "struct obj:otyp:short", - "struct obj:owt:unsigned", - "struct obj:quan:long", - "struct obj:spe:schar", - "struct obj:oclass:char", - "struct obj:invlet:char", - "struct obj:oartifact:char", - "struct obj:where:xchar", - "struct obj:timed:xchar", - "struct obj:cursed:Bitfield(cursed, 1)", - "struct obj:blessed:Bitfield(blessed, 1)", - "struct obj:unpaid:Bitfield(unpaid, 1)", - "struct obj:no_charge:Bitfield(no_charge, 1)", - "struct obj:known:Bitfield(known, 1)", - "struct obj:dknown:Bitfield(dknown, 1)", - "struct obj:bknown:Bitfield(bknown, 1)", - "struct obj:rknown:Bitfield(rknown, 1)", - "struct obj:oeroded:Bitfield(oeroded, 2)", - "struct obj:oeroded2:Bitfield(oeroded2, 2)", - "struct obj:oerodeproof:Bitfield(oerodeproof, 1)", - "struct obj:olocked:Bitfield(olocked, 1)", - "struct obj:obroken:Bitfield(obroken, 1)", - "struct obj:otrapped:Bitfield(otrapped, 1)", - "struct obj:recharged:Bitfield(recharged, 3)", - "struct obj:lamplit:Bitfield(lamplit, 1)", - "struct obj:globby:Bitfield(globby, 1)", - "struct obj:greased:Bitfield(greased, 1)", - "struct obj:nomerge:Bitfield(nomerge, 1)", - "struct obj:was_thrown:Bitfield(was_thrown, 1)", - "struct obj:in_use:Bitfield(in_use, 1)", - "struct obj:bypass:Bitfield(bypass, 1)", - "struct obj:cknown:Bitfield(cknown, 1)", - "struct obj:lknown:Bitfield(lknown, 1)", - "struct obj:corpsenm:int", - "struct obj:usecount:int", - "struct obj:oeaten:unsigned", - "struct obj:age:long", - "struct obj:owornmask:long", - "struct obj:oextra:struct oextra *", - "struct objclass:oc_name_idx:short", - "struct objclass:oc_descr_idx:short", - "struct objclass:oc_uname:char *", - "struct objclass:oc_name_known:Bitfield(oc_name_known, 1)", - "struct objclass:oc_merge:Bitfield(oc_merge, 1)", - "struct objclass:oc_uses_known:Bitfield(oc_uses_known, 1)", - "struct objclass:oc_pre_discovered:Bitfield(oc_pre_discovered, 1)", - "struct objclass:oc_magic:Bitfield(oc_magic, 1)", - "struct objclass:oc_charged:Bitfield(oc_charged, 1)", - "struct objclass:oc_unique:Bitfield(oc_unique, 1)", - "struct objclass:oc_nowish:Bitfield(oc_nowish, 1)", - "struct objclass:oc_big:Bitfield(oc_big, 1)", - "struct objclass:oc_tough:Bitfield(oc_tough, 1)", - "struct objclass:oc_dir:Bitfield(oc_dir, 2)", - "struct objclass:oc_material:Bitfield(oc_material, 5)", - "struct objclass:oc_subtyp:schar", - "struct objclass:oc_oprop:uchar", - "struct objclass:oc_class:char", - "struct objclass:oc_delay:schar", - "struct objclass:oc_color:uchar", - "struct objclass:oc_prob:short", - "struct objclass:oc_weight:unsigned short", - "struct objclass:oc_cost:short", - "struct objclass:oc_wsdam:schar", - "struct objclass:oc_wldam:schar", - "struct objclass:oc_oc1:schar", - "struct objclass:oc_oc2:schar", - "struct objclass:oc_nutrition:unsigned short", - "struct obj_split:parent_oid:unsigned", - "struct obj_split:child_oid:unsigned", - "struct oextra:oname:char *", - "struct oextra:omonst:struct monst *", - "struct oextra:omid:unsigned *", - "struct oextra:olong:long *", - "struct oextra:omailcmd:char *", - "struct polearm_info:hitmon:struct monst *", - "struct polearm_info:m_id:unsigned", - "struct prop:extrinsic:long", - "struct prop:blocked:long", - "struct prop:intrinsic:long", - "struct q_score:first_start:Bitfield(first_start, 1)", - "struct q_score:met_leader:Bitfield(met_leader, 1)", - "struct q_score:not_ready:Bitfield(not_ready, 3)", - "struct q_score:pissed_off:Bitfield(pissed_off, 1)", - "struct q_score:got_quest:Bitfield(got_quest, 1)", - "struct q_score:first_locate:Bitfield(first_locate, 1)", - "struct q_score:met_intermed:Bitfield(met_intermed, 1)", - "struct q_score:got_final:Bitfield(got_final, 1)", - "struct q_score:made_goal:Bitfield(made_goal, 3)", - "struct q_score:met_nemesis:Bitfield(met_nemesis, 1)", - "struct q_score:killed_nemesis:Bitfield(killed_nemesis, 1)", - "struct q_score:in_battle:Bitfield(in_battle, 1)", - "struct q_score:cheater:Bitfield(cheater, 1)", - "struct q_score:touched_artifact:Bitfield(touched_artifact, 1)", - "struct q_score:offered_artifact:Bitfield(offered_artifact, 1)", - "struct q_score:got_thanks:Bitfield(got_thanks, 1)", - "struct q_score:ldrgend:Bitfield(ldrgend, 2)", - "struct q_score:nemgend:Bitfield(nemgend, 2)", - "struct q_score:godgend:Bitfield(godgend, 2)", - "struct q_score:leader_is_dead:Bitfield(leader_is_dead, 1)", - "struct q_score:leader_m_id:unsigned", - "struct rm:glyph:int", - "struct rm:typ:schar", - "struct rm:seenv:uchar", - "struct rm:flags:Bitfield(flags, 5)", - "struct rm:horizontal:Bitfield(horizontal, 1)", - "struct rm:lit:Bitfield(lit, 1)", - "struct rm:waslit:Bitfield(waslit, 1)", - "struct rm:roomno:Bitfield(roomno, 6)", - "struct rm:edge:Bitfield(edge, 1)", - "struct rm:candig:Bitfield(candig, 1)", - "struct s_level:next:struct s_level *", - "struct s_level:dlevel:d_level", - "struct s_level:proto:char", - "struct s_level:boneid:char", - "struct s_level:rndlevs:uchar", - "struct s_level:flags:d_flags", - "struct savefile_info:sfi1:unsigned long", - "struct savefile_info:sfi2:unsigned long", - "struct savefile_info:sfi3:unsigned long", - "struct skills:skill:xchar", - "struct skills:max_skill:xchar", - "struct skills:advance:unsigned short", - "struct spell:sp_id:short", - "struct spell:sp_lev:xchar", - "struct spell:sp_know:int", - "struct stairway:sx:xchar", - "struct stairway:sy:xchar", - "struct stairway:tolev:d_level", - "struct stairway:up:char", - "struct takeoff_info:mask:long", - "struct takeoff_info:what:long", - "struct takeoff_info:delay:int", - "struct takeoff_info:cancelled_don:boolean", - "struct takeoff_info:disrobing:char", - "struct tin_info:tin:struct obj *", - "struct tin_info:o_id:unsigned", - "struct tin_info:usedtime:int", - "struct tin_info:reqtime:int", - "struct trap:ntrap:struct trap *", - "struct trap:tx:xchar", - "struct trap:ty:xchar", - "struct trap:dst:d_level", - "struct trap:launch:nhcoord", - "struct trap:ttyp:Bitfield(ttyp, 5)", - "struct trap:tseen:Bitfield(tseen, 1)", - "struct trap:once:Bitfield(once, 1)", - "struct trap:madeby_u:Bitfield(madeby_u, 1)", - "struct trap:vl:vlaunchinfo", - "struct tribute_info:tributesz:size_t", - "struct tribute_info:enabled:boolean", - "struct tribute_info:bookstock:Bitfield(bookstock, 1)", - "struct tribute_info:Deathnotice:Bitfield(Deathnotice,1)", - "struct u_achieve:amulet:Bitfield(amulet, 1)", - "struct u_achieve:bell:Bitfield(bell, 1)", - "struct u_achieve:book:Bitfield(book, 1)", - "struct u_achieve:menorah:Bitfield(menorah, 1)", - "struct u_achieve:enter_gehennom:Bitfield(enter_gehennom,1)", - "struct u_achieve:ascended:Bitfield(ascended, 1)", - "struct u_achieve:mines_luckstone:Bitfield(mines_luckstone, 1)", - "struct u_achieve:finish_sokoban:Bitfield(finish_sokoban, 1)", - "struct u_achieve:killed_medusa:Bitfield(killed_medusa, 1)", - "struct u_conduct:unvegetarian:long", - "struct u_conduct:unvegan:long", - "struct u_conduct:food:long", - "struct u_conduct:gnostic:long", - "struct u_conduct:weaphit:long", - "struct u_conduct:killer:long", - "struct u_conduct:literate:long", - "struct u_conduct:polypiles:long", - "struct u_conduct:polyselfs:long", - "struct u_conduct:wishes:long", - "struct u_conduct:wisharti:long", - "struct u_event:minor_oracle:Bitfield(minor_oracle, 1)", - "struct u_event:major_oracle:Bitfield(major_oracle, 1)", - "struct u_event:read_tribute:Bitfield(read_tribute, 1)", - "struct u_event:qcalled:Bitfield(qcalled, 1)", - "struct u_event:qexpelled:Bitfield(qexpelled, 1)", - "struct u_event:qcompleted:Bitfield(qcompleted, 1)", - "struct u_event:uheard_tune:Bitfield(uheard_tune, 2)", - "struct u_event:uopened_dbridge:Bitfield(uopened_dbridge, 1)", - "struct u_event:invoked:Bitfield(invoked, 1)", - "struct u_event:gehennom_entered:Bitfield(gehennom_entered, 1)", - "struct u_event:uhand_of_elbereth:Bitfield(uhand_of_elbereth, 2)", - "struct u_event:udemigod:Bitfield(udemigod, 1)", - "struct u_event:uvibrated:Bitfield(uvibrated, 1)", - "struct u_event:ascended:Bitfield(ascended, 1)", - "struct u_have:amulet:Bitfield(amulet, 1)", - "struct u_have:bell:Bitfield(bell, 1)", - "struct u_have:book:Bitfield(book, 1)", - "struct u_have:menorah:Bitfield(menorah, 1)", - "struct u_have:questart:Bitfield(questart, 1)", - "struct u_have:unused:Bitfield(unused, 3)", - "struct u_realtime:realtime:long", - "struct u_realtime:start_timing:time_t", - "struct u_realtime:finish_time:time_t", - "struct u_roleplay:blind:boolean", - "struct u_roleplay:nudist:boolean", - "struct u_roleplay:numbones:long", - "struct version_info:incarnation:unsigned long", - "struct version_info:feature_set:unsigned long", - "struct version_info:entity_count:unsigned long", - "struct version_info:struct_sizes1:unsigned long", - "struct version_info:struct_sizes2:unsigned long", - "struct victual_info:piece:struct obj *", - "struct victual_info:o_id:unsigned", - "struct victual_info:usedtime:int", - "struct victual_info:reqtime:int", - "struct victual_info:nmod:int", - "struct victual_info:canchoke:Bitfield(canchoke, 1)", - "struct victual_info:fullwarn:Bitfield(fullwarn, 1)", - "struct victual_info:eating:Bitfield(eating, 1)", - "struct victual_info:doreset:Bitfield(doreset, 1)", - "union vlaunchinfo:v_launch_otyp:short", - "union vlaunchinfo:v_launch2:nhcoord", - "union vlaunchinfo:v_conjoined:uchar", - "union vlaunchinfo:v_tnote:short", - "union vptrs:v_nexthere:struct obj *", - "union vptrs:v_ocontainer:struct obj *", - "union vptrs:v_ocarry:struct monst *", - "struct warntype_info:obj:unsigned long", - "struct warntype_info:polyd:unsigned long", - "struct warntype_info:species:struct permonst *", - "struct warntype_info:speciesidx:short", - "struct you:ux:xchar", - "struct you:uy:xchar", - "struct you:dx:schar", - "struct you:dy:schar", - "struct you:dz:schar", - "struct you:di:schar", - "struct you:tx:xchar", - "struct you:ty:xchar", - "struct you:ux0:xchar", - "struct you:uy0:xchar", - "struct you:uz:d_level", - "struct you:uz0:d_level", - "struct you:utolev:d_level", - "struct you:utotype:uchar", - "struct you:umoved:boolean", - "struct you:last_str_turn:int", - "struct you:ulevel:int", - "struct you:ulevelmax:int", - "struct you:utrap:unsigned", - "struct you:utraptype:unsigned", - "struct you:urooms:char", - "struct you:urooms0:char", - "struct you:uentered:char", - "struct you:ushops:char", - "struct you:ushops0:char", - "struct you:ushops_entered:char", - "struct you:ushops_left:char", - "struct you:uhunger:int", - "struct you:uhs:unsigned", - "struct you:uprops:prop", - "struct you:umconf:unsigned", - "struct you:usick_type:Bitfield(usick_type, 2)", - "struct you:nv_range:int", - "struct you:xray_range:int", - "struct you:bglyph:int", - "struct you:cglyph:int", - "struct you:bc_order:int", - "struct you:bc_felt:int", - "struct you:umonster:int", - "struct you:umonnum:int", - "struct you:mh:int", - "struct you:mhmax:int", - "struct you:mtimedone:int", - "struct you:macurr:attribs", - "struct you:mamax:attribs", - "struct you:ulycn:int", - "struct you:ucreamed:unsigned", - "struct you:uswldtim:unsigned", - "struct you:uswallow:Bitfield(uswallow, 1)", - "struct you:uinwater:Bitfield(uinwater, 1)", - "struct you:uundetected:Bitfield(uundetected, 1)", - "struct you:mfemale:Bitfield(mfemale, 1)", - "struct you:uinvulnerable:Bitfield(uinvulnerable, 1)", - "struct you:uburied:Bitfield(uburied, 1)", - "struct you:uedibility:Bitfield(uedibility, 1)", - "struct you:udg_cnt:unsigned", - "struct you:uachieve:u_achieve", - "struct you:uevent:u_event", - "struct you:uhave:u_have", - "struct you:uconduct:u_conduct", - "struct you:uroleplay:u_roleplay", - "struct you:acurr:attribs", - "struct you:aexe:attribs", - "struct you:abon:attribs", - "struct you:amax:attribs", - "struct you:atemp:attribs", - "struct you:atime:attribs", - "struct you:ualign:align", - "struct you:ualignbase:aligntyp", - "struct you:uluck:schar", - "struct you:moreluck:schar", - "struct you:uhitinc:schar", - "struct you:udaminc:schar", - "struct you:uac:schar", - "struct you:uspellprot:uchar", - "struct you:usptime:uchar", - "struct you:uspmtime:uchar", - "struct you:uhp:int", - "struct you:uhpmax:int", - "struct you:uen:int", - "struct you:uenmax:int", - "struct you:uhpinc:xchar", - "struct you:ueninc:xchar", - "struct you:ugangr:int", - "struct you:ugifts:int", - "struct you:ublessed:int", - "struct you:ublesscnt:int", - "struct you:umoney0:long", - "struct you:uspare1:long", - "struct you:uexp:long", - "struct you:urexp:long", - "struct you:ucleansed:long", - "struct you:usleep:long", - "struct you:uinvault:int", - "struct you:ustuck:struct monst *", - "struct you:usteed:struct monst *", - "struct you:ugallop:long", - "struct you:urideturns:int", - "struct you:umortality:int", - "struct you:ugrave_arise:int", - "struct you:weapon_slots:int", - "struct you:skills_advanced:int", - "struct you:skill_record:xchar", - "struct you:weapon_skills:skills", - "struct you:twoweap:boolean", - "struct you:mcham:short", -}; - -int critical_members_count() -{ - return SIZE(critical_members); -} - -/*sfdata.c*/ diff --git a/src/sflendian.c b/src/sflendian.c deleted file mode 100644 index 3953a371e..000000000 --- a/src/sflendian.c +++ /dev/null @@ -1,1339 +0,0 @@ -/* NetHack 3.7 sflendian.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) M. Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* fieldlevel little-endian binary file */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -/* -+------------+--------+------+-------+-----------+--------+-----------+ -| Data model | short | int | long | long long | pointer| OS | -+------------+--------+------+-------+-----------+--------+-----------+ -| LLP64 | 16 | 32 | 32 | 64 | 64 | Windows | -+------------+--------+------+-------+-----------+--------+-----------+ -| LP64 | 16 | 32 | 64 | 64 | 64 | Most Unix | -+------------+--------+------+-------+-----------+--------+-----------+ -| ILP64 | 16 | 64 | 64 | 64 | 64 |HAL,SPARC64| -+------------+--------+------+-------+-----------+--------+-----------+ - - We're using this for NetHack's little-endian binary fieldlevel format - because it involves the fewest compromises (sorry SPARC64, - you'll have to use one of the text file formats instead): - - Data model | short | int | long | long long | pointer| OS | - LP64 | 16 | 32 | 64 | 64 | 64 | Most Unix | -*/ - -#if defined(_MSC_VER) -#include -#define bswap16(x) _byteswap_ushort(x) -#define bswap32(x) _byteswap_ulong(x) -#define bswap64(x) _byteswap_uint64(x) -#elif defined(__GNUC__) -#define bswap16(x) __builtin_bswap16(x) -#define bswap32(x) __builtin_bswap32(x) -#define bswap64(x) __builtin_bswap64(x) -#else -/* else use ais523 approach */ -# define bswap16(x) ((((x) & 0x00ffU) << 8) | \ - (((x) & 0xff00U) >> 8)) - -# define bswap32(x) ((((x) & 0x000000ffLU) << 24) | \ - (((x) & 0x0000ff00LU) << 8) | \ - (((x) & 0x00ff0000LU) >> 8) | \ - (((x) & 0xff000000LU) >> 24)) - -# define bswap64(x) ((((x) & 0x00000000000000ffLLU) << 56) | \ - (((x) & 0x000000000000ff00LLU) << 40) | \ - (((x) & 0x0000000000ff0000LLU) << 24) | \ - (((x) & 0x00000000ff000000LLU) << 8) | \ - (((x) & 0x000000ff00000000LLU) << 8) | \ - (((x) & 0x0000ff0000000000LLU) << 24) | \ - (((x) & 0x00ff000000000000LLU) << 40) | \ - (((x) & 0xff00000000000000LLU) << 56)) -#endif - -#ifdef SAVEFILE_DEBUGGING -#if defined(__GNUC__) -#define DEBUGFORMATSTR64 "%s %s %ld %ld %d\n" -#elif defined(_MSC_VER) -#define DEBUGFORMATSTR64 "%s %s %lld %ld %d\n" -#endif -#endif - -struct sf_procs lendian_sfo_procs = { - ".le", - { - lendian_sfo_aligntyp, - lendian_sfo_any, - lendian_sfo_bitfield, - lendian_sfo_boolean, - lendian_sfo_char, - lendian_sfo_genericptr, - lendian_sfo_int, - lendian_sfo_long, - lendian_sfo_schar, - lendian_sfo_short, - lendian_sfo_size_t, - lendian_sfo_time_t, - lendian_sfo_unsigned, - lendian_sfo_uchar, - lendian_sfo_uint, - lendian_sfo_ulong, - lendian_sfo_ushort, - lendian_sfo_xchar, - lendian_sfo_str, - lendian_sfo_addinfo, - } -}; - -struct sf_procs lendian_sfi_procs = -{ - ".le", - { - lendian_sfi_aligntyp, - lendian_sfi_any, - lendian_sfi_bitfield, - lendian_sfi_boolean, - lendian_sfi_char, - lendian_sfi_genericptr, - lendian_sfi_int, - lendian_sfi_long, - lendian_sfi_schar, - lendian_sfi_short, - lendian_sfi_size_t, - lendian_sfi_time_t, - lendian_sfi_unsigned, - lendian_sfi_uchar, - lendian_sfi_uint, - lendian_sfi_ulong, - lendian_sfi_ushort, - lendian_sfi_xchar, - lendian_sfi_str, - lendian_sfi_addinfo, - } -}; - -#ifdef SAVEFILE_DEBUGGING -static long floc = 0L; -#endif - -/* - *---------------------------------------------------------------------------- - * sfo_lendian_ routines - * - * Default output routines. - * - *---------------------------------------------------------------------------- - */ - -void -lendian_sfo_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -/* const char *parent = "any"; */ - int i; - uint64_t ui64; - int64_t i64; - uint32_t ui32; - int32_t i32; - int8_t i8; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ui64 = (uint64_t) d_any->a_void; - fwrite(&ui64, sizeof ui64, 1, nhfp->fpdef); - i64 = (int64_t) d_any->a_ulong; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %ld %ld %d\n", myname, - "any", - d_any->a_ulong, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&i64, sizeof i64, 1, nhfp->fpdef); - ui32 = (uint32_t) d_any->a_uint; - fwrite(&ui32, sizeof ui32, 1, nhfp->fpdef); - i32 = (int32_t) d_any->a_int; - fwrite(&i32, sizeof i32, 1, nhfp->fpdef); - i8 = (int8_t) d_any->a_char; - fwrite(&i8, sizeof i8, 1, nhfp->fpdef); - d_any++; - } -#if 0 - sfo_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); /* (genericptr_t) */ - sfo_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); /* (struct obj *) */ - sfo_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); /* (struct monst *) */ - sfo_int(nhfp, &d_any->a_int, parent, "a_int", 1); /* (int) */ - sfo_char(nhfp, &d_any->a_char, parent, "a_char", 1); /* (char) */ - sfo_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); /* (schar) */ - sfo_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); /* (uchar) */ - sfo_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); /* (unsigned int) */ - sfo_long(nhfp, &d_any->a_long, parent, "a_long", 1); /* (long) */ - sfo_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); /* (unsigned long) */ - sfo_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); /* (int *) */ - sfo_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); /* (long *) */ - sfo_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); /* (unsigned long *) */ - sfo_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); /* (unsigned *) */my - sfo_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); /* (const char *) */ - sfo_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); /* (unsigned long) */ -#endif -} - -void -lendian_sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -/* const char *parent = "aligntyp"; */ - int i; - int16_t val; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - val = nhfp->bendian ? bswap16(*d_aligntyp) : *d_aligntyp; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "aligntyp", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_aligntyp++; - } -} - -void -lendian_sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ -/* const char *parent = "bitfield"; */ - - /* nhUse(parent); */ - /* for bitfields, cnt is the number of bits, not an array */ -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "bitfield", - (int) *d_bitfield, ftell(nhfp->fpdef), cnt); -#endif - fwrite(d_bitfield, sizeof *d_bitfield, 1, nhfp->fpdef); -} - -void -lendian_sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -/* const char *parent = "boolean"; */ - int i; - int8_t val; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - val = *d_boolean; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "boolean", - (int) val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_boolean++; - } -} - -void -lendian_sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "char"; */ - int8_t val; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - val = *d_char; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "char", - (int) val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_char++; - } -} - -void -lendian_sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t p; - - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of the elements of that array, and whether each - * is zero or non-zero. - * - * We only consume a single byte in the file for that - * and we expand it back to pointer size later when - * we read it back in, again preserving zero or non-zero. - */ - - for (i = 0; i < cnt; ++i) { - p = (*d_genericptr) ? 1 : 0; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "genericptr", - (int) p, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&p, sizeof p, 1, nhfp->fpdef); - d_genericptr++; - } -} - -void -lendian_sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "int"; */ - int32_t i32, val; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - i32 = (int32_t) *d_int; - val = nhfp->bendian ? bswap32(i32) : i32; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "int", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_int++; - } -} - -void -lendian_sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "long"; */ - int64_t i64, val64; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - i64 = (int64_t) *d_long; - val64 = nhfp->bendian ? bswap64(i64) : i64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "long", - val64, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val64, sizeof val64, 1, nhfp->fpdef); - d_long++; - } -} - -void -lendian_sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t itmp; -/* const char *parent = "schar"; */ - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - itmp = (int8_t) *d_schar; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "schar", - (int) itmp, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&itmp, sizeof itmp, 1, nhfp->fpdef); - d_schar++; - } -} - -void -lendian_sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t itmp; -/* const char *parent = "short"; */ - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - itmp = (int16_t) *d_short; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "short", - itmp, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&itmp, sizeof itmp, 1, nhfp->fpdef); - d_short++; - } -} - -void -lendian_sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t ui64, val; -/* const char *parent = "size_t"; */ - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ui64 = (uint64_t) *d_size_t; - val = nhfp->bendian ? bswap64(ui64) : ui64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "size_t", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_size_t++; - } -} - -void -lendian_sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char buf[BUFSZ]; -/* const char *parent = "time_t"; */ - - /* nhUse(parent); */ - Sprintf(buf, "%s", yyyymmddhhmmss(*d_time_t)); -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "time", - buf, ftell(nhfp->fpdef), cnt); -#endif - fwrite(buf, sizeof (char), 15, nhfp->fpdef); -} - -void -lendian_sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - lendian_sfo_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -lendian_sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "uchar"; */ - uint8_t ui8; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ui8 = (uint8_t) *d_uchar; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uchar", - (unsigned int) ui8, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&ui8, sizeof ui8, 1, nhfp->fpdef); - d_uchar++; - } -} - -void -lendian_sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "uint"; */ - uint32_t ui32, val; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ui32 = (uint32_t) *d_uint; - val = nhfp->bendian ? bswap32(ui32) : ui32; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uint", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_uint++; - } -} - -void -lendian_sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "ulong"; */ - uint64_t ul64, val64; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ul64 = (uint64_t) *d_ulong; - val64 = nhfp->bendian ? bswap64(ul64) : ul64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "ulong", - val64, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val64, sizeof val64, 1, nhfp->fpdef); - d_ulong++; - } -} - -void -lendian_sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "ushort"; */ - uint16_t ui16, val16; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - ui16 = (uint16_t) *d_ushort; - val16 = nhfp->bendian ? bswap16(ui16) : ui16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "ushort", - val16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val16, sizeof val16, 1, nhfp->fpdef); - d_ushort++; - } -} - -void -lendian_sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "xchar"; */ - int16_t i16, val16; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - i16 = (int16_t) *d_xchar; - val16 = nhfp->bendian ? bswap16(i16) : i16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "xchar", - val16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val16, sizeof val16, 1, nhfp->fpdef); - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -lendian_sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, intval; - int16_t i16, outcount = 0; -/* const char *parent = "str"; */ - char sval[QBUFSZ], *src = d_str, *dest = strbuf; - - /* nhUse(parent); */ - /* cnt is the number of characters */ - for (i = 0; i < cnt; ++i) { - if ((*src < 32) || (*src == '\\') || (*src > 127)) { - *dest++ = '\\'; - outcount++; - intval = (int) *src++; - Sprintf(sval, "%03d", intval); - for (j = 0; j < 3; ++j) { - *dest++ = sval[j]; - outcount++; - } - } else { - *dest++ = *src++; - outcount++; - } - } - *dest = '\0'; - i16 = nhfp->bendian ? bswap16(outcount) : outcount; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "str-count", - i16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&i16, sizeof i16, 1, nhfp->fpdef); -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "str", - strbuf, ftell(nhfp->fpdef), cnt); -#endif - fwrite(strbuf, sizeof (char), outcount, nhfp->fpdef); -} - -void -lendian_sfo_addinfo(nhfp, parent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *parent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* ignored */ -} - - -/* - *---------------------------------------------------------------------------- - * lendian_sfi_ routines called from functions in sfi_base.c - *---------------------------------------------------------------------------- - */ - -void -lendian_sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -/* const char *parent = "any"; */ - int i; - uint64_t ui64; - int64_t i64; - uint32_t ui32; - int32_t i32; - int8_t i8; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { - fread(&ui64, sizeof ui64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i64, sizeof i64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "any", - ui64, floc, cnt); -#endif - fread(&ui32, sizeof ui32, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - fread(&i32, sizeof i32, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - d_any->a_void = (genericptr_t) ui64; - d_any->a_ulong = (unsigned long) i64; - d_any->a_uint = (unsigned int) ui32; - d_any->a_int = (int) i32; - d_any->a_char = (char) i8; - d_any++; - } -#if 0 - sfi_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); - sfi_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); - sfi_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); - sfi_int(nhfp, &d_any->a_int, parent, "a_int", 1); - sfi_char(nhfp, &d_any->a_char, parent, "a_char", 1); - sfi_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); - sfi_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); - sfi_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); - sfi_long(nhfp, &d_any->a_long, parent, "a_long", 1); - sfi_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); - sfi_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); - sfi_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); - sfi_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); - sfi_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); - sfi_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); - sfi_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); -#endif -} - -void -lendian_sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -/* const char *parent = "aligntyp"; */ - int i; - int16_t val, i16; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "aligntyp", - i16, floc, cnt); -#endif - *d_aligntyp = (aligntyp) i16; - d_aligntyp++; - } -} - -void -lendian_sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ -/* const char *parent = "bitfield"; */ - - /* nhUse(parent); */ -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(d_bitfield, sizeof *d_bitfield, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "bitfield", - (int) *d_bitfield, floc, cnt); -#endif -} - -void -lendian_sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; -/* const char *parent = "boolean"; */ - int8_t i8; - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "boolean", - (int) i8, floc, cnt); -#endif - *d_boolean = (boolean) i8; - d_boolean++; - } -} - -void -lendian_sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t i8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "char", - (int) i8, floc, cnt); -#endif - *d_char = (char) i8; - d_char++; - } -} - -void -lendian_sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - static const char *glorkum = "glorkum"; - int8_t p; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&p, sizeof p, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "genericptr", - (int) p, floc, cnt); -#endif - *d_genericptr = p ? (genericptr_t) glorkum : (genericptr_t) 0; - d_genericptr++; - } -} - -void -lendian_sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int32_t val, i32; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i32 = nhfp->bendian ? bswap32(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "int", - i32, floc, cnt); -#endif - *d_int = (int) i32; - d_int++; - } -} - -void -lendian_sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int64_t val64, i64; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val64, sizeof val64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i64 = nhfp->bendian ? bswap64(val64) : val64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "long", - i64, floc, cnt); -#endif - *d_long = (long) i64; - d_long++; - } -} - -void -lendian_sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t i8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "schar", - (int) i8, floc, cnt); -#endif - *d_schar = (schar) i8; - d_schar++; - } -} - -void -lendian_sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t val16, i16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "short", - i16, floc, cnt); -#endif - *d_short = (short) i16; - d_short++; - } -} - -void -lendian_sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t ui64, val; -/* const char *parent = "size_t"; */ - - /* nhUse(parent); */ - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui64 = nhfp->bendian ? bswap64(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "size_t", - ui64, floc, cnt); -#endif - *d_size_t = (size_t) ui64; - d_size_t++; - } -} - -void -lendian_sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - time_t tmp; - char buf[BUFSZ]; -/* const char *parent = "time_t"; */ - - /* nhUse(parent); */ -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(buf, 1, 15, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "time", - buf, floc, cnt); -#endif - tmp = time_from_yyyymmddhhmmss(buf); - *d_time_t = tmp; -} - -void -lendian_sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - /* deferal */ - lendian_sfi_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -lendian_sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint8_t ui8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&ui8, sizeof ui8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hu %ld %d\n", myname, - "uchar", - (unsigned short) ui8, floc, cnt); -#endif - *d_uchar = (uchar) ui8; - d_uchar++; - } -} - -void -lendian_sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint32_t val, ui32; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui32 = nhfp->bendian ? bswap32(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uint", - ui32, floc, cnt); -#endif - *d_uint = (unsigned int) ui32; - d_uint++; - } -} - -void -lendian_sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t val64, ui64; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val64, sizeof val64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui64 = nhfp->bendian ? bswap64(val64) : val64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "ulong", - ui64, floc, cnt); -#endif - *d_ulong = (unsigned long) ui64; - d_ulong++; - } -} - -void -lendian_sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint16_t val16, ui16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hu %ld %d\n", myname, - "ushort", - ui16, floc, cnt); -#endif - *d_ushort = (unsigned short) ui16; - d_ushort++; - } -} - -void -lendian_sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t val16, i16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "xchar", - i16, floc, cnt); -#endif - *d_xchar = (xchar) i16; - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -lendian_sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -#ifdef SAVEFILE_DEBUGGING - char testbuf[BUFSZ]; -#endif - int i, j, sval; -/* const char *parent = "str"; */ - char n[4]; - char *src, *dest; - int16_t i16, incount = 0; - - /* nhUse(parent); */ -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i16, sizeof i16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - incount = nhfp->bendian ? bswap16(i16) : i16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "str-count", - incount, floc, cnt); -#endif - if (incount >= (BUFSZ * 4) - 1) - panic("overflow on sflendian string read %d %d", - incount, cnt); -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(strbuf, sizeof (char), incount, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - strbuf[incount] = '\0'; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "str", - strbuf, floc, cnt); -#endif - src = strbuf; - dest = -#ifdef SAVEFILE_DEBUGGING - testbuf; -#else - d_str; -#endif - - for (i = 0; i < cnt; ++i) { - if (*src == '\\') { - src++; - for (j = 0; j < 4; ++j) { - if (j < 3) - n[j] = *src++; - else - n[j] = '\0'; - } - sval = atoi(n); - *dest++ = (char) sval; - } else - *dest++ = *src++; - } -} - -void -lendian_sfi_addinfo(nhfp, myparent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *myparent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* not doing anything here */ -} - - - diff --git a/src/sp_lev.c b/src/sp_lev.c index 94a829938..5f0fcda92 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -2655,6 +2655,7 @@ lua_State *L; tmpobj.recharged = 0; tmpobj.greased = 0; tmpobj.broken = 0; + tmpobj.containment = 0; if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { const char *paramstr = luaL_checkstring(L, 1); diff --git a/src/teleport.c b/src/teleport.c index 50e179cc2..e6c1e120e 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -260,8 +260,13 @@ teleok(x, y, trapok) register int x, y; boolean trapok; { - if (!trapok && t_at(x, y)) - return FALSE; + if (!trapok) { + /* allow teleportation onto vibrating square, it's not a real trap */ + struct trap *trap = t_at(x, y); + if (trap && trap->ttyp != VIBRATING_SQUARE) { + return FALSE; + } + } if (!goodpos(x, y, &g.youmonst, 0)) return FALSE; if (!tele_jump_ok(u.ux, u.uy, x, y)) diff --git a/src/timeout.c b/src/timeout.c index 7fb57d40f..585924528 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -5,8 +5,6 @@ #include "hack.h" #include "lev.h" /* for checking save modes */ -#include "sfproto.h" - static void NDECL(stoned_dialogue); static void NDECL(vomiting_dialogue); @@ -2165,16 +2163,12 @@ timer_element *timer; /* assume no pointers in arg */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); break; case TIMER_OBJECT: if (timer->needs_fixup) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); } else { /* replace object pointer with id */ arg_save.a_obj = timer->arg.a_obj; @@ -2183,8 +2177,6 @@ timer_element *timer; timer->needs_fixup = 1; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); timer->arg.a_obj = arg_save.a_obj; timer->needs_fixup = 0; } @@ -2194,8 +2186,6 @@ timer_element *timer; if (timer->needs_fixup) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); } else { /* replace monster pointer with id */ arg_save.a_monst = timer->arg.a_monst; @@ -2204,8 +2194,6 @@ timer_element *timer; timer->needs_fixup = 1; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); timer->arg.a_monst = arg_save.a_monst; timer->needs_fixup = 0; } @@ -2343,14 +2331,10 @@ int range; if (range == RANGE_GLOBAL) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.timer_id, sizeof(g.timer_id)); - if (nhfp->fieldlevel) - sfo_ulong(nhfp, &g.timer_id, "timers", "g.timer_id", 1); } count = maybe_write_timer(nhfp, range, FALSE); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "timers", "timer_count", 1); (void) maybe_write_timer(nhfp, range, TRUE); } @@ -2389,22 +2373,16 @@ long adjust; /* how much to adjust timeout */ if (range == RANGE_GLOBAL) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.timer_id, sizeof g.timer_id); - if (nhfp->fieldlevel) - sfi_ulong(nhfp, &g.timer_id, "timers", "g.timer_id", 1); } /* restore elements */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "timers", "timer_count", 1); while (count-- > 0) { curr = (timer_element *) alloc(sizeof(timer_element)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) curr, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfi_fe(nhfp, curr, "timers", "timer", 1); if (ghostly) curr->timeout += adjust; insert_timer(curr); diff --git a/src/version.c b/src/version.c index 03ebbb60d..8af580ec4 100644 --- a/src/version.c +++ b/src/version.c @@ -7,7 +7,6 @@ #include "dlb.h" #include "date.h" #include "lev.h" -#include "sfproto.h" /* * All the references to the contents of patchlevel.h have been moved @@ -399,26 +398,17 @@ unsigned long utdflags; if (rlen == 0) return FALSE; } - if (nhfp->fieldlevel) { - sfi_char(nhfp, &indicator, "indicate", "format", 1); - sfi_int(nhfp, &filecmc, "validate", "critical_members_count", 1); - cmc = critical_members_count(); - } if (cmc != filecmc) return FALSE; - if (nhfp->fieldlevel && (nhfp->fnidx > historical)) { - sfi_version_info(nhfp, &vers_info, "version", "version_info", 1); - } else { - rlen = read(nhfp->fd, (genericptr_t) &vers_info, sizeof vers_info); - minit(); /* ZEROCOMP */ - if (rlen == 0) { - if (verbose) { - pline("File \"%s\" is empty?", name); - wait_synch(); - } - return FALSE; + rlen = read(nhfp->fd, (genericptr_t) &vers_info, sizeof vers_info); + minit(); /* ZEROCOMP */ + if (rlen == 0) { + if (verbose) { + pline("File \"%s\" is empty?", name); + wait_synch(); } + return FALSE; } if (!check_version(&vers_info, name, verbose, utdflags)) { @@ -437,17 +427,6 @@ NHFILE *nhfp; int cmc = 0; if (nhfp->mode & WRITING) { - if (nhfp->fieldlevel) { - indicate = (nhfp->fnidx == ascii) ? 'a' : 'l'; - sfo_char(nhfp, &indicate, "indicate", "format", 1); - cmc = critical_members_count(); - { -#if 0 - pline("critical-members=%d.", cmc); -#endif - } - sfo_int(nhfp, &cmc, "validate", "critical_members_count", 1); - } if (nhfp->structlevel) { indicate = 'h'; /* historical */ bwrite(nhfp->fd, (genericptr_t) &indicate, sizeof indicate); @@ -485,11 +464,6 @@ NHFILE *nhfp; (unsigned) (sizeof version_data)); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - store_formatindicator(nhfp); - sfo_version_info(nhfp, (struct version_info *) &version_data, - "version", "version_info", 1); - } return; } diff --git a/src/worm.c b/src/worm.c index 7c338bb43..6c139581f 100644 --- a/src/worm.c +++ b/src/worm.c @@ -5,8 +5,6 @@ #include "hack.h" #include "lev.h" -#include "sfproto.h" - #define newseg() (struct wseg *) alloc(sizeof (struct wseg)) #define dealloc_seg(wseg) free((genericptr_t) (wseg)) @@ -493,8 +491,6 @@ NHFILE *nhfp; /* Save number of segments */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "worm", "segment_count", 1); /* Save segment locations of the monster. */ if (count) { for (curr = wtails[i]; curr; curr = curr->nseg) { @@ -502,20 +498,12 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &(curr->wx), sizeof(xchar)); bwrite(nhfp->fd, (genericptr_t) &(curr->wy), sizeof(xchar)); } - if (nhfp->fieldlevel) { - sfo_xchar(nhfp, &(curr->wx), "worm", "wx", 1); - sfo_xchar(nhfp, &(curr->wy), "worm", "wy", 1); - } } } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) wgrowtime, sizeof(wgrowtime)); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAX_NUM_WORMS; ++i) - sfo_long(nhfp, &wgrowtime[i], "worm", "wgrowtime", 1); - } } if (release_data(nhfp)) { @@ -550,8 +538,6 @@ NHFILE *nhfp; for (i = 1; i < MAX_NUM_WORMS; i++) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(int)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "worm", "segment_count", 1); /* Get the segments. */ for (curr = (struct wseg *) 0, j = 0; j < count; j++) { @@ -561,10 +547,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &(temp->wx), sizeof(xchar)); mread(nhfp->fd, (genericptr_t) &(temp->wy), sizeof(xchar)); } - if (nhfp->fieldlevel) { - sfi_xchar(nhfp, &(temp->wx), "worm", "wx", 1); - sfi_xchar(nhfp, &(temp->wy), "worm", "wy", 1); - } if (curr) curr->nseg = temp; else @@ -576,10 +558,6 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) wgrowtime, sizeof(wgrowtime)); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAX_NUM_WORMS; ++i) - sfi_long(nhfp, &wgrowtime[i], "worm", "wgrowtime", 1); - } } /* diff --git a/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC index 3d0a4a729..fa40661c3 100644 --- a/sys/msdos/Makefile.GCC +++ b/sys/msdos/Makefile.GCC @@ -308,8 +308,7 @@ VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows. VOBJ21 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o VOBJ22 = $(O)zap.o $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o VOBJ23 = $(O)region.o $(O)sys.o $(REGEX) $(O)isaac64.o -VOBJ24 = $(O)sfbase.o $(O)sfdata.o -VOBJ25 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o +VOBJ24 = $(O)sfstruct.o SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ $(O)video.o $(O)vidtxt.o $(O)pckeys.o @@ -317,7 +316,7 @@ SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ VVOBJ = $(O)version.o ifeq "$(ADD_LUA)" "Y" -LUAOBJ = $(O)nhlua.o $(O)nhlsel.o +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o LUA_QTEXT_FILE = "quest.lua" endif @@ -1455,6 +1454,7 @@ $(O)muse.o: muse.c $(HACK_H) $(O)music.o: music.c $(HACK_H) #interp.c $(O)nhlua.o: nhlua.c $(HACK_H) $(O)nhlsel.o: nhlsel.c $(HACK_H) +$(O)nhlobj.o: nhlobj.c $(HACK_H) $(O)o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h $(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h diff --git a/sys/msdos/Makefile2.cross b/sys/msdos/Makefile2.cross index 9a88c16f9..6b0b79632 100644 --- a/sys/msdos/Makefile2.cross +++ b/sys/msdos/Makefile2.cross @@ -310,8 +310,7 @@ VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows. VOBJ21 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o VOBJ22 = $(O)zap.o $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o VOBJ23 = $(O)region.o $(O)sys.o $(REGEX) $(O)isaac64.o $(VIDEO_OBJ) -VOBJ24 = $(O)sfbase.o $(O)sfdata.o -VOBJ25 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o +VOBJ24 = $(O)sfstruct.o SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ $(O)video.o $(O)vidtxt.o $(O)pckeys.o @@ -321,7 +320,7 @@ VVOBJ = $(O)version.o MDLIB = $(O)mdlib.o ifeq "$(ADD_LUA)" "Y" -LUAOBJ = $(O)nhlua.o $(O)nhlsel.o +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o LUA_QTEXT_FILE = "quest.lua" endif diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 477ce34a3..55ca1cc98 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -7,7 +7,6 @@ #include "hack.h" #include "dlb.h" -#include "sfproto.h" #ifndef NO_SIGNAL #include @@ -450,8 +449,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ g.hackpid = 1; if (nhfp->structlevel) write(nhfp->fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.hackpid, "locking", "g.hackpid", 1); close_nhfile(nhfp); } #ifdef MFLOPPY diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat index 48d50b77c..e60e2fd06 100644 --- a/sys/unix/Makefile.dat +++ b/sys/unix/Makefile.dat @@ -65,11 +65,11 @@ rip.xpm: ../win/X11/rip.xpm mapbg.xpm: ../win/gnome/mapbg.xpm cp ../win/gnome/mapbg.xpm mapbg.xpm -nhsplash.xpm: ../win/Qt/nhsplash.xpm - cp ../win/Qt/nhsplash.xpm nhsplash.xpm +nhsplash.xpm: ../win/share/nhsplash.xpm + cp ../win/share/nhsplash.xpm nhsplash.xpm -nethack.icns: ../win/Qt/nhicns.uu - $(UUDECODE) ../win/Qt/nhicns.uu +nethack.icns: ../win/share/nhicns.uu + $(UUDECODE) ../win/share/nhicns.uu Info.plist: ../win/Qt/Info.pli cp ../win/Qt/Info.pli Info.plist diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 4ed03277e..ee4254ed9 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.6 Makefile.src $NHDT-Date: 1575076770 2019/11/30 01:19:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1575932543 2019/12/09 23:02:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ # Copyright (c) 2018 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. @@ -171,7 +171,7 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome # CFLAGS = -g -I../include #CFLAGS = -O -I../include -#LFLAGS = +#LFLAGS = # -lm required by lua LIBS += -lm @@ -224,26 +224,27 @@ WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \ WINX11OBJ = Window.o dialogs.o winX.o winmap.o winmenu.o winmesg.o \ winmisc.o winstat.o wintext.o winval.o tile.o # -# Files for a Qt port +# Files for a Qt 3 port (renamed since nethack 3.6.x) # -WINQTSRC = ../win/Qt/qt_win.cpp ../win/Qt/qt_clust.cpp ../win/Qt/qttableview.cpp -WINQTOBJ = qt_win.o qt_clust.o qttableview.o tile.o +WINQT3SRC = ../win/Qt3/qt3_win.cpp ../win/Qt3/qt3_clust.cpp \ + ../win/Qt3/qt3tableview.cpp +WINQT3OBJ = qt3_win.o qt3_clust.o qt3tableview.o tile.o # # Files for a Qt 4 or 5 port # -WINQT4SRC = ../win/Qt4/qt4bind.cpp ../win/Qt4/qt4click.cpp \ - ../win/Qt4/qt4clust.cpp ../win/Qt4/qt4delay.cpp \ - ../win/Qt4/qt4glyph.cpp ../win/Qt4/qt4icon.cpp ../win/Qt4/qt4inv.cpp \ - ../win/Qt4/qt4key.cpp ../win/Qt4/qt4line.cpp ../win/Qt4/qt4main.cpp \ - ../win/Qt4/qt4map.cpp ../win/Qt4/qt4menu.cpp ../win/Qt4/qt4msg.cpp \ - ../win/Qt4/qt4plsel.cpp ../win/Qt4/qt4rip.cpp ../win/Qt4/qt4set.cpp \ - ../win/Qt4/qt4stat.cpp ../win/Qt4/qt4str.cpp ../win/Qt4/qt4streq.cpp \ - ../win/Qt4/qt4svsel.cpp ../win/Qt4/qt4win.cpp ../win/Qt4/qt4xcmd.cpp \ - ../win/Qt4/qt4yndlg.cpp -WINQT4OBJ = qt4bind.o qt4click.o qt4clust.o qt4delay.o qt4glyph.o qt4icon.o \ - qt4inv.o qt4key.o qt4line.o qt4main.o qt4map.o qt4menu.o qt4msg.o \ - qt4plsel.o qt4rip.o qt4set.o qt4stat.o qt4str.o qt4streq.o qt4svsel.o \ - qt4win.o qt4xcmd.o qt4yndlg.o tile.o +WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \ + ../win/Qt/qt_clust.cpp ../win/Qt/qt_delay.cpp \ + ../win/Qt/qt_glyph.cpp ../win/Qt/qt_icon.cpp ../win/Qt/qt_inv.cpp \ + ../win/Qt/qt_key.cpp ../win/Qt/qt_line.cpp ../win/Qt/qt_main.cpp \ + ../win/Qt/qt_map.cpp ../win/Qt/qt_menu.cpp ../win/Qt/qt_msg.cpp \ + ../win/Qt/qt_plsel.cpp ../win/Qt/qt_rip.cpp ../win/Qt/qt_set.cpp \ + ../win/Qt/qt_stat.cpp ../win/Qt/qt_str.cpp ../win/Qt/qt_streq.cpp \ + ../win/Qt/qt_svsel.cpp ../win/Qt/qt_win.cpp ../win/Qt/qt_xcmd.cpp \ + ../win/Qt/qt_yndlg.cpp +WINQTOBJ = qt_bind.o qt_click.o qt_clust.o qt_delay.o qt_glyph.o qt_icon.o \ + qt_inv.o qt_key.o qt_line.o qt_main.o qt_map.o qt_menu.o qt_msg.o \ + qt_plsel.o qt_rip.o qt_set.o qt_stat.o qt_str.o qt_streq.o qt_svsel.o \ + qt_win.o qt_xcmd.o qt_yndlg.o tile.o # # Files for a Gnome port # @@ -302,12 +303,12 @@ WINBEOBJ = # # # libraries for Qt 3 -WINQTLIB = -L$(QTDIR)/lib -lqt +WINQT3LIB = -L$(QTDIR)/lib -lqt # # libraries for Qt 4 WINQT4LIB = `pkg-config QtGui --libs` # -# libraries for Qt 5 (use with WINQT4SRC and WINQT4OBJ) +# libraries for Qt 5 (use with WINQTSRC and WINQTOBJ) WINQT5LIB = `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs` # # libraries for KDE (with Qt) @@ -319,7 +320,7 @@ WINGNOMELIB = -lgnomeui -lgnome -lart_lgpl -lgtk -lgdk -lpopt # libraries for Gem port WINGEMLIB = -le_gem -lgem # -# libraries for BeOS +# libraries for BeOS WINBELIB = -lbe # # libraries for curses port @@ -448,11 +449,10 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \ lock.c mail.c makemon.c mapglyph.c mcastu.c mdlib.c mhitm.c \ mhitu.c minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \ mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \ - nhlua.c nhlsel.c o_init.c objects.c objnam.c \ + nhlua.c nhlsel.c nhlobj.c o_init.c objects.c objnam.c \ options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \ priest.c quest.c questpgr.c read.c rect.c region.c restore.c \ rip.c rnd.c role.c rumors.c save.c sfstruct.c \ - sfbase.c sfdata.c sfascii.c sflendian.c \ shk.c shknam.c sit.c sounds.c \ sp_lev.c spell.c steal.c steed.c sys.c teleport.c timeout.c \ topten.c track.c trap.c u_init.c \ @@ -469,12 +469,12 @@ SYSCSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ SYSCXXSRC = ../sys/share/cppregex.cpp # generated source files (tile.c is handled separately via WINxxxSRC) -GENCSRC = vis_tab.c sfdata.c #tile.c +GENCSRC = vis_tab.c #tile.c # all windowing-system-dependent .c (for dependencies and such) WINCSRC = $(WINTTYSRC) $(WINCURSESSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC) # all windowing-system-dependent .cpp (for dependencies and such) -WINCXXSRC = $(WINQTSRC) $(WINQT4SRC) $(WINBESRC) +WINCXXSRC = $(WINQTSRC) $(WINQT3SRC) $(WINBESRC) # Files for window system chaining. Requires SYSCF; include via HINTSRC/HINTOBJ CHAINSRC = ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \ @@ -516,11 +516,10 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \ light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mdlib.o mhitm.o \ mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o \ mondata.o monmove.o mplayer.o mthrowu.o muse.o music.o \ - nhlua.o nhlsel.o o_init.o objnam.o options.o \ + nhlua.o nhlsel.o nhlobj.o o_init.o objnam.o options.o \ pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \ quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \ role.o rumors.o save.o sfstruct.o \ - sfbase.o sfdata.o sfascii.o sflendian.o \ shk.o shknam.o sit.o sounds.o sp_lev.o spell.o sys.o \ steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o \ uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o \ @@ -528,6 +527,10 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \ $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) version.o # the .o files from the HACKCSRC, SYSSRC, and WINSRC lists +# first target is also the default target for 'make' without any arguments +all: $(GAME) + @echo "" + $(GAME): $(SYSTEM) @echo "$(GAME) is up to date." @@ -583,8 +586,6 @@ DUMB.Setup: ../include/extern.h cp ../include/extern.DUMB ../include/extern.h @touch DUMB.Setup -all: $(GAME) - ../lib/lua/liblua.a ../include/nhlua.h: @( cd .. ; $(MAKE) lua_support ) @@ -603,36 +604,34 @@ objects.o: @rm -f $(MAKEDEFS) # Qt 3 windowport meta-object-compiler output -qt_kde0.moc: ../include/qt_kde0.h - $(QTDIR)/bin/moc -o qt_kde0.moc ../include/qt_kde0.h - -qt_win.moc: ../include/qt_win.h - $(QTDIR)/bin/moc -o qt_win.moc ../include/qt_win.h - -qttableview.moc: ../include/qttableview.h - $(QTDIR)/bin/moc -o qttableview.moc ../include/qttableview.h +qt3_kde0.moc: ../win/Qt3/qt3_kde0.h + $(QTDIR)/bin/moc -o qt3kde0.moc ../win/Qt3/qt3_kde0.h +qt3_win.moc: ../win/Qt3/qt3_win.h + $(QTDIR)/bin/moc -o qt3win.moc ../win/Qt3/qt3_win.h +qt3tableview.moc: ../win/Qt3/qt3tableview.h + $(QTDIR)/bin/moc -o qt3tableview.moc ../win/Qt/qt3tableview.h # Qt 4 windowport meta-object-compiler output -qt4kde0.moc : ../win/Qt4/qt4kde0.h - $(QTDIR)/bin/$(MOC) -o qt4kde0.moc ../win/Qt4/qt4kde0.h -qt4main.moc : ../win/Qt4/qt4main.h - $(QTDIR)/bin/$(MOC) -o qt4main.moc ../win/Qt4/qt4main.h -qt4map.moc : ../win/Qt4/qt4map.h - $(QTDIR)/bin/$(MOC) -o qt4map.moc ../win/Qt4/qt4map.h -qt4menu.moc : ../win/Qt4/qt4menu.h - $(QTDIR)/bin/$(MOC) -o qt4menu.moc ../win/Qt4/qt4menu.h -qt4msg.moc : ../win/Qt4/qt4msg.h - $(QTDIR)/bin/$(MOC) -o qt4msg.moc ../win/Qt4/qt4msg.h -qt4plsel.moc : ../win/Qt4/qt4plsel.h - $(QTDIR)/bin/$(MOC) -o qt4plsel.moc ../win/Qt4/qt4plsel.h -qt4set.moc : ../win/Qt4/qt4set.h - $(QTDIR)/bin/$(MOC) -o qt4set.moc ../win/Qt4/qt4set.h -qt4stat.moc : ../win/Qt4/qt4stat.h - $(QTDIR)/bin/$(MOC) -o qt4stat.moc ../win/Qt4/qt4stat.h -qt4xcmd.moc : ../win/Qt4/qt4xcmd.h - $(QTDIR)/bin/$(MOC) -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h -qt4yndlg.moc : ../win/Qt4/qt4yndlg.h - $(QTDIR)/bin/$(MOC) -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h +qt_kde0.moc : ../win/Qt/qt_kde0.h + $(QTDIR)/bin/$(MOC) -o qt_kde0.moc ../win/Qt/qt_kde0.h +qt_main.moc : ../win/Qt/qt_main.h + $(QTDIR)/bin/$(MOC) -o qt_main.moc ../win/Qt/qt_main.h +qt_map.moc : ../win/Qt/qt_map.h + $(QTDIR)/bin/$(MOC) -o qt_map.moc ../win/Qt/qt_map.h +qt_menu.moc : ../win/Qt/qt_menu.h + $(QTDIR)/bin/$(MOC) -o qt_menu.moc ../win/Qt/qt_menu.h +qt_msg.moc : ../win/Qt/qt_msg.h + $(QTDIR)/bin/$(MOC) -o qt_msg.moc ../win/Qt/qt_msg.h +qt_plsel.moc : ../win/Qt/qt_plsel.h + $(QTDIR)/bin/$(MOC) -o qt_plsel.moc ../win/Qt/qt_plsel.h +qt_set.moc : ../win/Qt/qt_set.h + $(QTDIR)/bin/$(MOC) -o qt_set.moc ../win/Qt/qt_set.h +qt_stat.moc : ../win/Qt/qt_stat.h + $(QTDIR)/bin/$(MOC) -o qt_stat.moc ../win/Qt/qt_stat.h +qt_xcmd.moc : ../win/Qt/qt_xcmd.h + $(QTDIR)/bin/$(MOC) -o qt_xcmd.moc ../win/Qt/qt_xcmd.h +qt_yndlg.moc : ../win/Qt/qt_yndlg.h + $(QTDIR)/bin/$(MOC) -o qt_yndlg.moc ../win/Qt/qt_yndlg.h # build monst.o and objects.o before executing '$(MAKE) makedefs' $(MAKEDEFS): $(FIRSTOBJ) \ @@ -666,26 +665,7 @@ tile.c: ../win/share/tilemap.c $(HACK_H) ../win/gnome/gn_rip.h: ../win/X11/rip.xpm cp ../win/X11/rip.xpm ../win/gnome/gn_rip.h -# readtags dependencies -# -# sfstruct.o: sfstruct.c $(HACK_H) -sfbase.o: sfbase.c $(HACK_H) ../include/sfproto.h ../include/sfprocs.h -sfascii.o: sfascii.c $(HACK_H) ../include/sfprocs.h -sflendian.o: sflendian.c $(HACK_H) ../include/sfprocs.h -sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h - -#../util/readtags: -# @( cd ../util ; $(MAKE) readtags ) -# -#../util/nethack.tags: -# @( cd ../util ; $(MAKE) nethack.tags ) -# -#sfdata.c: ../util/readtags ../util/nethack.tags -# @( cd ../util ; ./readtags ) -# -#../include/sfproto.h: ../util/readtags ../util/nethack.tags -# @( cd ../util ; ./readtags ) # date.h should be remade any time any of the source or include code # is modified. Unfortunately, this would make the contents of this @@ -730,7 +710,7 @@ spotless: clean depend: ../sys/unix/depend.awk \ $(SYSCSRC) $(WINCSRC) $(SYSCXXSRC) $(WINCXXSRC) \ $(CHAINSRC) $(GENCSRC) $(HACKCSRC) - $(AWK) -f ../sys/unix/depend.awk ../include/*.h \ + $(AWK) -f ../sys/unix/depend.awk ../include/*.h ../win/*/*.h \ $(SYSCSRC) $(WINCSRC) $(SYSCXXSRC) $(WINCXXSRC) \ $(CHAINSRC) $(GENCSRC) $(HACKCSRC) >makedep @echo '/^# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT/+2,$$d' >eddep @@ -750,11 +730,10 @@ depend: ../sys/unix/depend.awk \ # config.h timestamp $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/global.h ../include/coord.h ../include/vmsconf.h \ - ../include/system.h ../include/unixconf.h ../include/os2conf.h \ - ../include/micro.h ../include/pcconf.h ../include/tosconf.h \ - ../include/amiconf.h ../include/macconf.h ../include/beconf.h \ - ../include/wceconf.h ../include/ntconf.h \ - ../include/nhlua.h + ../include/system.h ../include/nhlua.h ../include/unixconf.h \ + ../include/os2conf.h ../include/micro.h ../include/pcconf.h \ + ../include/tosconf.h ../include/amiconf.h ../include/macconf.h \ + ../include/beconf.h ../include/wceconf.h ../include/ntconf.h touch $(CONFIG_H) # hack.h timestamp $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ @@ -762,15 +741,16 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ ../include/objclass.h ../include/youprop.h ../include/prop.h \ ../include/permonst.h ../include/monattk.h \ ../include/monflag.h ../include/mondata.h ../include/pm.h \ - ../include/wintype.h ../include/context.h ../include/decl.h \ - ../include/quest.h ../include/spell.h ../include/color.h \ - ../include/obj.h ../include/you.h ../include/attrib.h \ - ../include/monst.h ../include/mextra.h ../include/skills.h \ - ../include/onames.h ../include/timeout.h ../include/trap.h \ - ../include/flag.h ../include/rm.h ../include/vision.h \ - ../include/display.h ../include/engrave.h ../include/rect.h \ - ../include/region.h ../include/winprocs.h ../include/botl.h \ - ../include/sys.h ../include/wintty.h ../include/trampoli.h + ../include/wintype.h ../include/context.h ../include/rm.h \ + ../include/botl.h ../include/qtext.h ../include/rect.h \ + ../include/region.h ../include/decl.h ../include/quest.h \ + ../include/spell.h ../include/color.h ../include/obj.h \ + ../include/you.h ../include/attrib.h ../include/monst.h \ + ../include/mextra.h ../include/skills.h ../include/onames.h \ + ../include/timeout.h ../include/trap.h ../include/flag.h \ + ../include/vision.h ../include/display.h ../include/engrave.h \ + ../include/winprocs.h ../include/sys.h ../include/wintty.h \ + ../include/trampoli.h touch $(HACK_H) # tos.o: ../sys/atari/tos.c $(HACK_H) ../include/tcap.h @@ -862,44 +842,82 @@ tile.o: tile.c $(HACK_H) gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \ ../win/gnome/gnmain.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnaskstr.c -gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnmain.h \ - ../win/gnome/gnmenu.h ../win/gnome/gnaskstr.h \ - ../win/gnome/gnyesno.h +gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnomeprv.h \ + $(HACK_H) ../include/dlb.h ../include/patchlevel.h \ + ../include/winGnome.h ../win/gnome/gnmain.h \ + ../win/gnome/gnmap.h ../win/gnome/gnmenu.h \ + ../win/gnome/gnplayer.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnstatus.h \ + ../win/gnome/gntext.h ../win/gnome/gnmesg.h \ + ../win/gnome/gnyesno.h ../win/gnome/gnworn.h \ + ../win/gnome/gnaskstr.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnbind.c -gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h ../include/tile2x11.h +gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h $(CONFIG_H) \ + ../include/tile2x11.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnglyph.c gnmain.o: ../win/gnome/gnmain.c ../win/gnome/gnmain.h ../win/gnome/gnsignal.h \ - ../win/gnome/gnbind.h ../win/gnome/gnopts.h $(HACK_H) \ - ../include/date.h + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnbind.h \ + ../win/gnome/gnmap.h ../win/gnome/gnmenu.h \ + ../win/gnome/gnplayer.h ../win/gnome/gnstatus.h \ + ../win/gnome/gntext.h ../win/gnome/gnmesg.h \ + ../win/gnome/gnyesno.h ../win/gnome/gnworn.h \ + ../win/gnome/gnopts.h ../include/date.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmain.c -gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnsignal.h $(HACK_H) +gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h $(CONFIG_H) \ + ../win/gnome/gnglyph.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmap.c -gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h ../win/gnome/gnmain.h \ - ../win/gnome/gnbind.h ../include/func_tab.h +gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h $(CONFIG_H) \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnmain.h ../win/gnome/gnbind.h \ + ../win/gnome/gnmap.h ../win/gnome/gnplayer.h \ + ../win/gnome/gnsignal.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnstatus.h ../win/gnome/gntext.h \ + ../win/gnome/gnmesg.h ../win/gnome/gnyesno.h \ + ../win/gnome/gnworn.h ../include/func_tab.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmenu.c -gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h ../win/gnome/gnsignal.h +gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h $(CONFIG_H) \ + ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h $(HACK_H) \ + ../include/dlb.h ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmesg.c gnopts.o: ../win/gnome/gnopts.c ../win/gnome/gnopts.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H) + $(CONFIG_H) ../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H) $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnopts.c gnplayer.o: ../win/gnome/gnplayer.c ../win/gnome/gnplayer.h \ ../win/gnome/gnmain.h $(HACK_H) $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnplayer.c gnsignal.o: ../win/gnome/gnsignal.c ../win/gnome/gnsignal.h \ - ../win/gnome/gnmain.h + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnmain.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnsignal.c -gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h \ - ../win/gnome/gnsignal.h ../win/gnome/gn_xpms.h \ - ../win/gnome/gnomeprv.h +gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h $(CONFIG_H) \ + ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h $(HACK_H) \ + ../include/dlb.h ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gn_xpms.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnstatus.c -gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \ - ../win/gnome/gn_rip.h +gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h $(CONFIG_H) \ + ../win/gnome/gnmain.h ../win/gnome/gn_rip.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gntext.c -gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h +gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnmain.h ../win/gnome/gnmap.h \ + ../win/gnome/gnmenu.h ../win/gnome/gnplayer.h \ + ../win/gnome/gnsignal.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnstatus.h ../win/gnome/gntext.h \ + ../win/gnome/gnmesg.h ../win/gnome/gnyesno.h \ + ../win/gnome/gnworn.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnyesno.c -gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h +gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h $(CONFIG_H) \ + ../win/gnome/gnglyph.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnworn.c wingem.o: ../win/gem/wingem.c $(HACK_H) ../include/func_tab.h ../include/dlb.h \ ../include/patchlevel.h ../include/wingem.h @@ -914,92 +932,105 @@ gr_rect.o: ../win/gem/gr_rect.c ../include/gr_rect.h tile.o: tile.c $(HACK_H) cppregex.o: ../sys/share/cppregex.cpp $(CXX) $(CXXFLAGS) -c -o $@ ../sys/share/cppregex.cpp -qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../include/func_tab.h \ - ../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \ - ../include/qt_win.h ../include/qt_clust.h ../include/qt_kde0.h \ - ../include/qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp -qt_clust.o: ../win/Qt/qt_clust.cpp ../include/qt_clust.h +qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_bind.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_click.h \ + ../win/Qt/qt_delay.h ../win/Qt/qt_xcmd.h ../win/Qt/qt_key.h \ + ../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h \ + ../win/Qt/qt_menu.h ../win/Qt/qt_rip.h ../win/Qt/qt_msg.h \ + ../win/Qt/qt_plsel.h ../win/Qt/qt_svsel.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h \ + ../include/dlb.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp +qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_click.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp +qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp -qttableview.o: ../win/Qt/qttableview.cpp ../include/qttableview.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qttableview.cpp -qt4bind.o: ../win/Qt4/qt4bind.cpp $(HACK_H) ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4click.h ../win/Qt4/qt4delay.h \ - ../win/Qt4/qt4xcmd.h ../win/Qt4/qt4key.h ../win/Qt4/qt4map.h \ - ../win/Qt4/qt4menu.h ../win/Qt4/qt4msg.h ../win/Qt4/qt4plsel.h \ - ../win/Qt4/qt4svsel.h ../win/Qt4/qt4set.h ../win/Qt4/qt4stat.h \ - ../win/Qt4/qt4streq.h ../win/Qt4/qt4yndlg.h \ - ../win/Qt4/qt4str.h ../include/dlb.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4bind.cpp -qt4click.o: ../win/Qt4/qt4click.cpp $(HACK_H) ../win/Qt4/qt4click.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4click.cpp -qt4clust.o: ../win/Qt4/qt4clust.cpp ../win/Qt4/qt4clust.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4clust.cpp -qt4delay.o: ../win/Qt4/qt4delay.cpp $(HACK_H) ../win/Qt4/qt4delay.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4delay.cpp -qt4glyph.o: ../win/Qt4/qt4glyph.cpp $(HACK_H) ../include/tile2x11.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4glyph.cpp -qt4icon.o: ../win/Qt4/qt4icon.cpp $(HACK_H) ../win/Qt4/qt4icon.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4icon.cpp -qt4inv.o: ../win/Qt4/qt4inv.cpp $(HACK_H) ../win/Qt4/qt4inv.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4inv.cpp -qt4key.o: ../win/Qt4/qt4key.cpp $(HACK_H) ../win/Qt4/qt4key.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4key.cpp -qt4line.o: ../win/Qt4/qt4line.cpp $(HACK_H) ../win/Qt4/qt4line.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4line.cpp -qt4main.o: ../win/Qt4/qt4main.cpp $(HACK_H) ../include/patchlevel.h \ - ../win/Qt4/qt4main.h qt4main.moc ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4inv.h ../win/Qt4/qt4key.h \ - ../win/Qt4/qt4map.h ../win/Qt4/qt4msg.h ../win/Qt4/qt4set.h \ - ../win/Qt4/qt4stat.h ../win/Qt4/qt4str.h qt4kde0.moc - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4main.cpp -qt4map.o: ../win/Qt4/qt4map.cpp $(HACK_H) ../win/Qt4/qt4map.h qt4map.moc \ - ../win/Qt4/qt4click.h ../win/Qt4/qt4glyph.h \ - ../include/qt_xpms.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4map.cpp -qt4menu.o: ../win/Qt4/qt4menu.cpp $(HACK_H) ../win/Qt4/qt4menu.h qt4menu.moc \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h \ - ../win/Qt4/qt4streq.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4menu.cpp -qt4msg.o: ../win/Qt4/qt4msg.cpp $(HACK_H) ../win/Qt4/qt4msg.h qt4msg.moc \ - ../win/Qt4/qt4map.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4msg.cpp -qt4plsel.o: ../win/Qt4/qt4plsel.cpp $(HACK_H) ../win/Qt4/qt4plsel.h \ - qt4plsel.moc ../win/Qt4/qt4bind.h ../win/Qt4/qt4glyph.h \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4plsel.cpp -qt4rip.o: ../win/Qt4/qt4rip.cpp $(HACK_H) ../win/Qt4/qt4rip.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4rip.cpp -qt4set.o: ../win/Qt4/qt4set.cpp $(HACK_H) ../win/Qt4/qt4set.h qt4set.moc \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4set.cpp -qt4stat.o: ../win/Qt4/qt4stat.cpp $(HACK_H) ../win/Qt4/qt4stat.h qt4stat.moc \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h ../include/qt_xpms.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4stat.cpp -qt4str.o: ../win/Qt4/qt4str.cpp ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4str.cpp -qt4streq.o: ../win/Qt4/qt4streq.cpp $(HACK_H) ../win/Qt4/qt4streq.h \ - ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4streq.cpp -qt4svsel.o: ../win/Qt4/qt4svsel.cpp $(HACK_H) ../win/Qt4/qt4svsel.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4svsel.cpp -qt4win.o: ../win/Qt4/qt4win.cpp $(HACK_H) ../win/Qt4/qt4win.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4click.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4inv.h ../win/Qt4/qt4key.h \ - ../win/Qt4/qt4icon.h ../win/Qt4/qt4map.h ../win/Qt4/qt4menu.h \ - ../win/Qt4/qt4msg.h ../win/Qt4/qt4set.h ../win/Qt4/qt4clust.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4win.cpp -qt4xcmd.o: ../win/Qt4/qt4xcmd.cpp $(HACK_H) ../include/func_tab.h \ - ../win/Qt4/qt4xcmd.h qt4xcmd.moc ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4xcmd.cpp -qt4yndlg.o: ../win/Qt4/qt4yndlg.cpp $(HACK_H) ../win/Qt4/qt4yndlg.h \ - qt4yndlg.moc ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4yndlg.cpp +qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_delay.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp +qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) ../include/tile2x11.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp +qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_icon.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp +qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_inv.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp +qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_key.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp +qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_line.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp +qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../include/patchlevel.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h qt_main.moc \ + ../win/Qt/qt_bind.h ../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h \ + ../win/Qt/qt_key.h ../win/Qt/qt_map.h ../win/Qt/qt_win.h \ + ../win/Qt/qt_clust.h ../win/Qt/qt_msg.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h ../win/Qt/qt_str.h \ + qt_kde0.moc + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp +qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_map.h ../win/Qt/qt_win.h \ + ../win/Qt/qt_clust.h qt_map.moc ../win/Qt/qt_click.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_xpms.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp +qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_menu.h \ + ../win/Qt/qt_win.h ../win/Qt/qt_rip.h qt_menu.moc \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp +qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_msg.h ../win/Qt/qt_win.h \ + qt_msg.moc ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \ + ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp +qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_plsel.h qt_plsel.moc \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp +qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_rip.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp +qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_set.h qt_set.moc \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp +qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_stat.h \ + ../win/Qt/qt_win.h ../win/Qt/qt_icon.h qt_stat.moc \ + ../win/Qt/qt_set.h ../win/Qt/qt_str.h ../win/Qt/qt_xpms.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp +qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp +qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp +qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_svsel.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp +qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_win.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_click.h ../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h \ + ../win/Qt/qt_key.h ../win/Qt/qt_icon.h ../win/Qt/qt_map.h \ + ../win/Qt/qt_clust.h ../win/Qt/qt_menu.h ../win/Qt/qt_rip.h \ + ../win/Qt/qt_msg.h ../win/Qt/qt_set.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp +qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \ + ../win/Qt/qt_xcmd.h qt_xcmd.moc ../win/Qt/qt_bind.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp +qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_yndlg.h qt_yndlg.moc \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp +qt3_win.o: ../win/Qt3/qt3_win.cpp $(HACK_H) ../include/func_tab.h \ + ../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \ + ../win/Qt3/qt3_win.h ../win/Qt3/qt3_clust.h \ + ../win/Qt3/qt3_kde0.h ../win/Qt3/qt3_xpms.h qt3_win.moc \ + qt3_kde0.moc qt3tableview.moc + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3_win.cpp +qt3_clust.o: ../win/Qt3/qt3_clust.cpp ../win/Qt3/qt3_clust.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3_clust.cpp +qt3tableview.o: ../win/Qt3/qt3tableview.cpp ../win/Qt3/qt3tableview.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3tableview.cpp wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H) $(CC) $(CFLAGS) -c -o $@ ../win/chain/wc_chainin.c wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H) @@ -1021,7 +1052,7 @@ decl.o: decl.c $(HACK_H) detect.o: detect.c $(HACK_H) ../include/artifact.h dig.o: dig.c $(HACK_H) display.o: display.c $(HACK_H) -dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h +dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h ../include/patchlevel.h do.o: do.c $(HACK_H) ../include/lev.h do_name.o: do_name.c $(HACK_H) do_wear.o: do_wear.c $(HACK_H) @@ -1038,23 +1069,26 @@ engrave.o: engrave.c $(HACK_H) ../include/lev.h exper.o: exper.c $(HACK_H) explode.o: explode.c $(HACK_H) extralev.o: extralev.c $(HACK_H) -files.o: files.c $(HACK_H) ../include/dlb.h #zlib.h +files.o: files.c $(HACK_H) ../include/dlb.h ../include/lev.h #zlib.h fountain.o: fountain.c $(HACK_H) hack.o: hack.c $(HACK_H) hacklib.o: hacklib.c $(HACK_H) invent.o: invent.c $(HACK_H) -isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h ../include/integer.h +isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h light.o: light.c $(HACK_H) ../include/lev.h lock.o: lock.c $(HACK_H) mail.o: mail.c $(HACK_H) ../include/mail.h makemon.o: makemon.c $(HACK_H) mapglyph.o: mapglyph.c $(HACK_H) mcastu.o: mcastu.c $(HACK_H) -mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h ../include/objclass.h \ - ../include/monsym.h ../include/artilist.h \ - ../include/dungeon.h ../include/obj.h ../include/monst.h \ - ../include/you.h ../include/context.h ../include/flag.h \ - ../include/dlb.h ../include/patchlevel.h +mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h ../include/align.h \ + ../include/monattk.h ../include/monflag.h \ + ../include/objclass.h ../include/monsym.h \ + ../include/artilist.h ../include/dungeon.h ../include/obj.h \ + ../include/monst.h ../include/mextra.h ../include/you.h \ + ../include/attrib.h ../include/prop.h ../include/skills.h \ + ../include/context.h ../include/flag.h ../include/dlb.h \ + ../include/patchlevel.h mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h minion.o: minion.c $(HACK_H) @@ -1072,9 +1106,9 @@ monst.o: monst.c $(CONFIG_H) ../include/permonst.h ../include/align.h \ mplayer.o: mplayer.c $(HACK_H) mthrowu.o: mthrowu.c $(HACK_H) muse.o: muse.c $(HACK_H) -music.o: music.c $(HACK_H) #interp.c -nhlua.o: nhlua.c $(HACK_H) -nhlsel.o: nhlsel.c $(HACK_H) +music.o: music.c $(HACK_H) +nhlua.o: nhlua.c $(HACK_H) ../include/dlb.h +nhlsel.o: nhlsel.c $(HACK_H) ../include/sp_lev.h o_init.o: o_init.c $(HACK_H) ../include/lev.h objects.o: objects.c $(CONFIG_H) ../include/obj.h ../include/objclass.h \ ../include/prop.h ../include/skills.h ../include/color.h @@ -1088,22 +1122,23 @@ polyself.o: polyself.c $(HACK_H) potion.o: potion.c $(HACK_H) pray.o: pray.c $(HACK_H) priest.o: priest.c $(HACK_H) ../include/mfndpos.h -quest.o: quest.c $(HACK_H) ../include/qtext.h -questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h ../include/qtext.h +quest.o: quest.c $(HACK_H) +questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h read.o: read.c $(HACK_H) rect.o: rect.c $(HACK_H) region.o: region.c $(HACK_H) ../include/lev.h restore.o: restore.c $(HACK_H) ../include/lev.h ../include/tcap.h rip.o: rip.c $(HACK_H) -rnd.o: rnd.c $(HACK_H) +rnd.o: rnd.c $(HACK_H) ../include/isaac64.h role.o: role.c $(HACK_H) rumors.o: rumors.c $(HACK_H) ../include/lev.h ../include/dlb.h save.o: save.c $(HACK_H) ../include/lev.h +sfstruct.o: sfstruct.c $(HACK_H) shk.o: shk.c $(HACK_H) shknam.o: shknam.c $(HACK_H) sit.o: sit.c $(HACK_H) ../include/artifact.h sounds.o: sounds.c $(HACK_H) -sp_lev.o: sp_lev.c $(HACK_H) ../include/dlb.h ../include/sp_lev.h +sp_lev.o: sp_lev.c $(HACK_H) ../include/sp_lev.h spell.o: spell.c $(HACK_H) steal.o: steal.c $(HACK_H) steed.o: steed.c $(HACK_H) @@ -1117,13 +1152,13 @@ u_init.o: u_init.c $(HACK_H) uhitm.o: uhitm.c $(HACK_H) vault.o: vault.c $(HACK_H) version.o: version.c $(HACK_H) ../include/dlb.h ../include/date.h \ - ../include/patchlevel.h + ../include/lev.h ../include/patchlevel.h vision.o: vision.c $(HACK_H) ../include/vis_tab.h weapon.o: weapon.c $(HACK_H) were.o: were.c $(HACK_H) wield.o: wield.c $(HACK_H) windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h -wizard.o: wizard.c $(HACK_H) ../include/qtext.h +wizard.o: wizard.c $(HACK_H) worm.o: worm.c $(HACK_H) ../include/lev.h worn.o: worn.c $(HACK_H) write.o: write.c $(HACK_H) diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 9d930aaa1..dc7c2bc0b 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -1,5 +1,5 @@ # NetHack Top-level Makefile. -# NetHack 3.6 Makefile.top $NHDT-Date: 1574825215 2019/11/27 03:26:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ +# NetHack 3.6 Makefile.top $NHDT-Date: 1575932543 2019/12/09 23:02:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -94,6 +94,14 @@ DATNODLB = $(VARDATND) license symbols DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DAT = $(DATNODLB) $(DATDLB) +# first target is also the default target for 'make' without any arguments +all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb + true; $(MOREALL) + @echo "Done." + +$(GAME): lua_support + ( cd src ; $(MAKE) $(GAME) ) + lua_support: lib/lua/liblua.a include/nhlua.h @true lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h @@ -110,13 +118,6 @@ include/nhlua.h: lib/lua/liblua.a @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ @echo '/*nhlua.h*/' >> $@ -$(GAME): lua_support - ( cd src ; $(MAKE) ) - -all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb - true; $(MOREALL) - @echo "Done." - # Note: many of the dependencies below are here to allow parallel make # to generate valid output diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index be6299298..b27e91ded 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -129,11 +129,6 @@ LEXYYC = lex.yy.c # YTABH = y_tab.h # LEXYYC = lexyy.c -# This is the universal ctags utility which produces the tags in the -# format that util/readtags requires. -# https://github.com/universal-ctags/ctags.git -CTAGSCMD = universal-ctags - # if you change this to 1, feedback while building will omit -Dthis -Wthat # -Isomewhere so that each file being compiled is listed on one short line; # it requires support for '$<' in rules with more than one prerequisite @@ -189,7 +184,6 @@ MAKESRC = makedefs.c ../src/mdlib.c RECOVSRC = recover.c DLBSRC = dlb_main.c UTILSRCS = $(MAKESRC) panic.c $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC) -READTAGSSRC = readtags.c # files that define all monsters and objects CMONOBJ = ../src/monst.c ../src/objects.c @@ -210,9 +204,6 @@ RECOVOBJS = recover.o # object files for the data librarian DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC) -# object files for readtags -READTAGSOBJS = readtags.o - # flags for creating distribution versions of sys/share/*_lex.c, using # a more portable flex skeleton, which is not included in the distribution. # hopefully keeping this out of the section to be edited will keep too @@ -369,67 +360,6 @@ tileedit: tileedit.cpp $(TEXT_IO) $(CC) -o tileedit -I../include -I$(QTDIR)/include -L$(QTDIR)/lib \ tileedit.cpp $(TEXT_IO) -lqt -# dependencies for readtags -# -CTAGDEP = ../include/align.h ../include/artifact.h ../include/artilist.h \ - ../include/attrib.h ../include/context.h ../include/coord.h \ - ../include/decl.h ../include/dungeon.h ../include/engrave.h \ - ../include/flag.h ../include/func_tab.h ../include/global.h \ - ../include/hack.h ../include/lev.h ../include/mextra.h \ - ../include/mkroom.h ../include/monst.h ../include/monsym.h \ - ../include/obj.h ../include/objclass.h ../include/prop.h \ - ../include/quest.h ../include/rect.h ../include/region.h \ - ../include/rm.h ../include/skills.h ../include/spell.h \ - ../include/sys.h ../include/timeout.h ../include/trap.h \ - ../include/you.h ../include/onames.h ../include/wintype.h -# ../include/permonst.h -CTAGSOPT = --language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern - -readtags: $(READTAGSOBJS) - $(CC) $(LFLAGS) -o readtags $(READTAGSOBJS) $(LIBS) - -readtags.o: readtags.c $(HACK_H) - $(CC) $(CFLAGS) -c readtags.c - -nethack.tags: $(CTAGDEP) -# -# tested with universal ctags from https://github.com/universal-ctags/ctags.git -# - $(CTAGSCMD) $(CTAGSOPT) -f nethack.tags ../include/align.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/artifact.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/artilist.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/attrib.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/context.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/coord.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/decl.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/dungeon.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/engrave.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/flag.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/func_tab.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/global.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/hack.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/lev.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/mextra.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/mkroom.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/monst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/monsym.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/obj.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/objclass.h -# $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/permonst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/prop.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/quest.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/rect.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/region.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/rm.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/skills.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/spell.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/sys.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/timeout.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/trap.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/you.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/onames.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/wintype.h - # using dependencies like # ../src/foo:: # @( cd ../src ; $(MAKE) foo ) diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index bd3b7cbbf..ee85f2590 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -142,10 +142,6 @@ 31B8A46021A26AE70055BD01 /* dlb_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A45F21A26AE70055BD01 /* dlb_main.c */; }; 31B8A46121A26AF60055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; }; 31B8A46221A26B020055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; }; - 544768A323994965004B9739 /* sfascii.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A223994965004B9739 /* sfascii.c */; }; - 544768A5239949A8004B9739 /* sfbase.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A4239949A8004B9739 /* sfbase.c */; }; - 544768A9239949FA004B9739 /* sfdata.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A6239949FA004B9739 /* sfdata.c */; }; - 544768AA239949FA004B9739 /* sflendian.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A7239949FA004B9739 /* sflendian.c */; }; 544768AB239949FA004B9739 /* sfstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A8239949FA004B9739 /* sfstruct.c */; }; 544768AE23994A17004B9739 /* nhlsel.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AC23994A17004B9739 /* nhlsel.c */; }; 544768AF23994A17004B9739 /* nhlua.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AD23994A17004B9739 /* nhlua.c */; }; @@ -486,18 +482,12 @@ 31B8A45F21A26AE70055BD01 /* dlb_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dlb_main.c; path = ../../util/dlb_main.c; sourceTree = ""; }; 31B8A46421A278AC0055BD01 /* dgn_comp.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; name = dgn_comp.y; path = ../../util/dgn_comp.y; sourceTree = ""; }; 31B8A46821A288770055BD01 /* dgn_comp.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; name = dgn_comp.l; path = ../../util/dgn_comp.l; sourceTree = ""; }; - 544768A223994965004B9739 /* sfascii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sfascii.c; path = ../../src/sfascii.c; sourceTree = ""; }; - 544768A4239949A8004B9739 /* sfbase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sfbase.c; path = ../../src/sfbase.c; sourceTree = ""; }; - 544768A6239949FA004B9739 /* sfdata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sfdata.c; path = ../../src/sfdata.c; sourceTree = ""; }; - 544768A7239949FA004B9739 /* sflendian.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sflendian.c; path = ../../src/sflendian.c; sourceTree = ""; }; 544768A8239949FA004B9739 /* sfstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sfstruct.c; path = ../../src/sfstruct.c; sourceTree = ""; }; 544768AC23994A17004B9739 /* nhlsel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nhlsel.c; path = ../../src/nhlsel.c; sourceTree = ""; }; 544768AD23994A17004B9739 /* nhlua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nhlua.c; path = ../../src/nhlua.c; sourceTree = ""; }; 544768B023994A2C004B9739 /* mdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mdlib.c; path = ../../src/mdlib.c; sourceTree = ""; }; 544768B423995447004B9739 /* isaac64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isaac64.h; path = ../../include/isaac64.h; sourceTree = ""; }; 544768B523995488004B9739 /* nhlua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nhlua.h; path = ../../include/nhlua.h; sourceTree = ""; }; - 544768B623995488004B9739 /* sfprocs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sfprocs.h; path = ../../include/sfprocs.h; sourceTree = ""; }; - 544768B723995488004B9739 /* sfproto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sfproto.h; path = ../../include/sfproto.h; sourceTree = ""; }; 544768B923995BB7004B9739 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../lib/lua/liblua.a; sourceTree = ""; }; 54FCE8282223261F00F393C8 /* isaac64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = isaac64.c; path = ../../src/isaac64.c; sourceTree = ""; }; /* End PBXFileReference section */ @@ -567,11 +557,7 @@ 544768B023994A2C004B9739 /* mdlib.c */, 544768AC23994A17004B9739 /* nhlsel.c */, 544768AD23994A17004B9739 /* nhlua.c */, - 544768A6239949FA004B9739 /* sfdata.c */, - 544768A7239949FA004B9739 /* sflendian.c */, 544768A8239949FA004B9739 /* sfstruct.c */, - 544768A4239949A8004B9739 /* sfbase.c */, - 544768A223994965004B9739 /* sfascii.c */, 31B8A35521A238030055BD01 /* allmain.c */, 31B8A36521A238040055BD01 /* alloc.c */, 31B8A35E21A238040055BD01 /* apply.c */, @@ -710,8 +696,6 @@ isa = PBXGroup; children = ( 544768B523995488004B9739 /* nhlua.h */, - 544768B623995488004B9739 /* sfprocs.h */, - 544768B723995488004B9739 /* sfproto.h */, 544768B423995447004B9739 /* isaac64.h */, 3186A3B721A4B0FD0052BF02 /* align.h */, 3186A38021A4B0FB0052BF02 /* amiconf.h */, @@ -1460,7 +1444,6 @@ files = ( 31B8A3BC21A238060055BD01 /* eat.c in Sources */, 31B8A3A921A238060055BD01 /* music.c in Sources */, - 544768A9239949FA004B9739 /* sfdata.c in Sources */, 544768B123994A2C004B9739 /* mdlib.c in Sources */, 31B8A3D221A238060055BD01 /* engrave.c in Sources */, 31B8A3A021A238060055BD01 /* exper.c in Sources */, @@ -1479,7 +1462,6 @@ 31B8A41921A244940055BD01 /* objects.c in Sources */, 31B8A3AA21A238060055BD01 /* wizard.c in Sources */, 31B8A3D021A238060055BD01 /* explode.c in Sources */, - 544768A5239949A8004B9739 /* sfbase.c in Sources */, 31B8A3DE21A238060055BD01 /* sys.c in Sources */, 31B8A38021A238060055BD01 /* sit.c in Sources */, 31B8A3AF21A238060055BD01 /* lock.c in Sources */, @@ -1580,7 +1562,6 @@ 31B8A38E21A238060055BD01 /* quest.c in Sources */, 31B8A3D621A238060055BD01 /* region.c in Sources */, 31B8A3D421A238060055BD01 /* worm.c in Sources */, - 544768AA239949FA004B9739 /* sflendian.c in Sources */, 31B8A3C921A238060055BD01 /* sounds.c in Sources */, 31B8A37C21A238060055BD01 /* pager.c in Sources */, 31B8A39F21A238060055BD01 /* fountain.c in Sources */, @@ -1589,7 +1570,6 @@ 31B8A3D321A238060055BD01 /* cmd.c in Sources */, 31B8A3AB21A238060055BD01 /* mplayer.c in Sources */, 31B8A3CC21A238060055BD01 /* pickup.c in Sources */, - 544768A323994965004B9739 /* sfascii.c in Sources */, 31B8A39721A238060055BD01 /* invent.c in Sources */, 31B8A40021A23E6E0055BD01 /* getline.c in Sources */, 31B8A3B521A238060055BD01 /* rect.c in Sources */, diff --git a/sys/unix/depend.awk b/sys/unix/depend.awk index d10f48a57..ac4416230 100644 --- a/sys/unix/depend.awk +++ b/sys/unix/depend.awk @@ -1,6 +1,6 @@ # depend.awk -- awk script used to construct makefile dependencies # for nethack's source files (`make depend' support for Makefile.src). -# $NHDT-Date: 1546220373 2018/12/31 01:39:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.8 $ +# $NHDT-Date: 1575916941 2019/12/09 18:42:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ # # usage: # cd src ; nawk -f depend.awk ../include/*.h list-of-.c/.cpp-files @@ -41,14 +41,25 @@ FNR == 1 { output_dep() #finish previous file #[3.4.0: gnomehack headers currently aren't in include] #[3.6.2: Qt4 headers aren't in include either] #[3.6.2: curses headers likewise] + #[3.7.0: Qt headers have moved] if (incl ~ /\.h$/) { - if (incl ~ "curses\.h") - incl = "" # skip "curses.h"; it should be + if (incl ~ "curses\.h") + incl = "" # skip "curses.h"; it should be + else if (incl ~ /^..\/lib\/lua-.*\/src\/l/) + incl = "" # skip lua headers else if (incl ~ /^curs/) # curses special case incl = "../win/curses/" incl - else if (incl ~ /^qt4/) # Qt v4 special case - incl = "../win/Qt4/" incl - else if (incl ~ /^gn/) # gnomehack special case + else if (incl ~ /^qt/) { # Qt special cases + # qtext.h is a core header that accidentally matches... + if (incl ~ /^qtext.h/) # ...the Qt exception + incl = "../include/" incl + # Qt v3 headers are in ../win/Qt3 + # Qt v4/v5 headers are in ../win/Qt + else if (FILENAME ~ /^\.\.\/win\/Qt3\/.*/) + incl = "../win/Qt3/" incl + else # Qt v4 + incl = "../win/Qt/" incl + } else if (incl ~ /^gn/) # gnomehack special case incl = "../win/gnome/" incl else incl = "../include/" incl @@ -100,7 +111,7 @@ function output_specials( i, sp, alt_sp) # write a target and its dependency list in pretty-printed format; # if target's primary source file has a path prefix, also write build command # -function format_dep(target, source, n, i, list) +function format_dep(target, source, col, n, i, list) { split("", done) #``for (x in done) delete done[x]'' printf("%s:", target); col = length(target) + 1 diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5 index c1b13d890..bcf1a06ef 100644 --- a/sys/unix/hints/linux-qt5 +++ b/sys/unix/hints/linux-qt5 @@ -33,8 +33,8 @@ CFLAGS+=`pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags` -fPIC LINK=g++ CXX=g++ -std=gnu++11 -WINSRC = $(WINQT4SRC) -WINOBJ = $(WINQT4OBJ) +WINSRC = $(WINQTSRC) +WINOBJ = $(WINQTOBJ) WINLIB = $(WINQT5LIB) #MOC = moc MOC = moc-qt5 diff --git a/sys/vms/vmsbuild.com b/sys/vms/vmsbuild.com index cacf60126..0ab402d1a 100755 --- a/sys/vms/vmsbuild.com +++ b/sys/vms/vmsbuild.com @@ -320,7 +320,7 @@ $ gosub compile_list $! $! Files added in 3.7 $! -$ c_list = "sfbase,sfdata,sfstruct,sflendian,sfascii,nhlua,nhlsel" +$ c_list = "sfstruct,nhlua,nhlsel" $ gosub compile_list $! $! 3.7 runtime LUA level parser/loader diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 58cf34eb6..5ba9ef68a 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -323,12 +323,11 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o -VOBJ28 = $(O)sfbase.o $(O)sfdata.o -VOBJ29 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o +VOBJ28 = $(O)sfstruct.o #VOBJ31 = $(O)win10.o ifeq "$(ADD_LUA)" "Y" -LUAOBJ = $(O)nhlua.o $(O)nhlsel.o +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o LUA_QTEXT_FILE = "quest.lua" endif @@ -1594,6 +1593,7 @@ $(O)muse.o: muse.c $(HACK_H) $(O)music.o: music.c $(HACK_H) #interp.c $(O)nhlua.o: nhlua.c $(HACK_H) $(O)nhlsel.o: nhlsel.c $(HACK_H) +$(O)nhlobj.o: nhlobj.c $(HACK_H) $(O)o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h $(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 614b32533..aff743a53 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -325,10 +325,9 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o -VOBJ28 = $(O)sfbase.o $(O)sfdata.o -VOBJ29 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o +VOBJ28 = $(O)sfstruct.o -LUAOBJ = $(O)nhlua.o $(O)nhlsel.o +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o LUA_QTEXT_FILE = "quest.lua" !IFDEF CROSSCOMPILE_HOST @@ -1604,92 +1603,12 @@ $(O)ttystub.o: $(HACK_H) $(MSWSYS)\stubs.c # #============================================ -# fieldlevel save dependencies +# save dependencies #============================================ -$(O)sfbase.o: $(HACK_H) $(INCL)\sfproto.h $(INCL)\sfprocs.h \ - $(SRC)\sfbase.c -# @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfbase.c - -$(O)sfdata.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sfdata.c -# @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfdata.c - $(O)sfstruct.o: $(HACK_H) $(SRC)\sfstruct.c # @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfstruct.c -$(O)sfascii.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sfascii.c -# @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfascii.c - -$(O)sflendian.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sflendian.c -# @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sflendian.c - -$(SRC)\sfdata.c: $(U)readtags.exe $(U)nethack.tags - $(U)readtags.exe - -$(INCL)\sfproto.h: $(U)readtags.exe $(U)nethack.tags - $(U)readtags.exe - -$(U)readtags.exe: $(O)readtags$(HOST).o - @$(link) $(lflagsBuild) -out:$@ $(O)readtags$(HOST).o - -$(O)readtags$(HOST).o: $(U)readtags.c $(U)nethack.tags $(CONFIG_H) $(PATCHLEVEL_H) - @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) $(TEMPL) -Fo$@ $(U)readtags.c - -# -#tested only with exuberant ctags from http://ctags.sourceforge.net -# -CTAGDEP = ..\include\align.h ..\include\artifact.h ..\include\artilist.h \ - ..\include\attrib.h ..\include\context.h ..\include\coord.h \ - ..\include\decl.h ..\include\dungeon.h ..\include\engrave.h \ - ..\include\flag.h ..\include\func_tab.h ..\include\global.h \ - ..\include\hack.h ..\include\lev.h ..\include\mextra.h \ - ..\include\mkroom.h ..\include\monst.h ..\include\monsym.h \ - ..\include\obj.h ..\include\objclass.h ..\include\prop.h \ - ..\include\quest.h ..\include\rect.h ..\include\region.h \ - ..\include\rm.h ..\include\skills.h ..\include\spell.h \ - ..\include\sys.h ..\include\timeout.h ..\include\trap.h \ - ..\include\you.h ..\include\onames.h ..\include\wintype.h - -$(U)nethack.tags: $(CTAGDEP) - $(CTAGSCMD) $(CTAGSOPT) -f $(U)nethack.tags $(TINC)/align.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/artifact.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/artifact.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/artilist.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/attrib.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/bones.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/context.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/coord.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/decl.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/decl.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/dungeon.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/engrave.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/engrave.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/flag.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/func_tab.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/global.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/hack.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/lev.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/mextra.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/mkroom.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/monst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/monsym.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/obj.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/objclass.h -# $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/permonst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/prop.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/quest.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/rect.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/region.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/rm.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/skills.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/spell.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/sys.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/timeout.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/trap.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/you.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/onames.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/wintype.h - # # util dependencies # These have dual-roles and need to be build for host and targt platforms. @@ -1963,6 +1882,7 @@ $(O)muse.o: muse.c $(HACK_H) $(O)music.o: music.c $(HACK_H) #interp.c $(O)nhlua.o: nhlua.c $(HACK_H) $(O)nhlsel.o: nhlsel.c $(HACK_H) +$(O)nhlobj.o: nhlobj.c $(HACK_H) $(O)o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h $(O)objnam.o: objnam.c $(HACK_H) $(O)options.o: options.c $(CONFIG_H) $(INCL)\objclass.h $(INCL)\flag.h \ diff --git a/test/test_obj.lua b/test/test_obj.lua new file mode 100644 index 000000000..a72232465 --- /dev/null +++ b/test/test_obj.lua @@ -0,0 +1,66 @@ + +local o = obj.new("rock"); +o:placeobj(u.ux, u.uy); + +local o2 = obj.at(u.ux, u.uy); +local o2tbl = o2:totable(); +if (o2tbl.otyp_name ~= "rock") then + error("no rock under you"); +end + + +local box = obj.new("empty large box"); +local boxtbl = box:totable(); +if (boxtbl.has_contents ~= 0) then + error("empty box has contents"); +end + +box:addcontent(obj.new("diamond")); +boxtbl = box:totable(); +if (boxtbl.has_contents ~= 1) then + error("box has no contents"); +end + +local diamond = box:contents():totable(); +if (diamond.otyp_name ~= "diamond") then + error("box contents is not a diamond"); +end + +box:placeobj(u.ux, u.uy); + +local o3 = obj.at(u.ux, u.uy); +local o3tbl = o3:totable(); +if (o3tbl.otyp_name ~= "large box") then + error("no large box under you"); +end + +local o4 = o3:next(); +local o4tbl = o4:totable(); +if (o4tbl.otyp_name ~= "rock") then + error("no rock under the large box"); +end + + +local oc = obj.class(o4tbl.otyp); +if (oc.name ~= "rock") then + error("object class is not rock, part 1"); +end +if (oc.class ~= "*") then + error("object class is not *, part 1"); +end + +local oc2 = obj.class(o); +if (oc2.name ~= "rock") then + error("object class is not rock, part 2"); +end +if (oc2.class ~= "*") then + error("object class is not *, part 2"); +end + +local oc3 = obj.class(obj.new("rock")); +if (oc3.name ~= "rock") then + error("object class is not rock, part 3"); +end +if (oc3.class ~= "*") then + error("object class is not *, part 3"); +end diff --git a/test/testwish.lua b/test/testwish.lua new file mode 100644 index 000000000..0f301e25f --- /dev/null +++ b/test/testwish.lua @@ -0,0 +1,64 @@ + +local wishtest_objects = { + ["a rock"] = { otyp_name = "rock", quan = 1, oclass = "*" }, + ["5 +3 blessed silver daggers"] = { otyp_name = "silver dagger", blessed = 1, cursed = 0, spe = 3, quan = 5 }, + ["an empty locked large box"] = { otyp_name = "large box", is_container = 1, has_contents = 0, olocked = 1 }, + ["an empty trapped unlocked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, otrapped = 1 }, + ["an empty untrapped locked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 1, otrapped = 0 }, + ["an empty locked broken chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, obroken = 1 }, + ["broken empty chest"] = { otyp_name = "chest", obroken = 1 }, + ["potion of holy water"] = { otyp_name = "water", oclass = "!", blessed = 1, cursed = 0 }, + ["potion of unholy water"] = { otyp_name = "water", oclass = "!", blessed = 0, cursed = 1 }, + ["cursed greased +2 grey dragon scale mail"] = { otyp_name = "gray dragon scale mail", oclass = "[", blessed = 0, cursed = 1, spe = 2, greased = 1 }, + ["uncursed magic marker (11)"] = { otyp_name = "magic marker", blessed = 0, cursed = 0, spe = 11 }, + ["lit oil lamp"] = { otyp_name = "oil lamp", lamplit = 1 }, + ["6 burning tallow candles"] = { otyp_name = "tallow candle", lamplit = 1, quan = 6 }, + ["unlit oil lamp"] = { otyp_name = "oil lamp", lamplit = 0 }, + ["7 extinguished wax candles"] = { otyp_name = "wax candle", lamplit = 0, quan = 7 }, + ["2 blank scrolls"] = { otyp_name = "blank paper", quan = 2 }, + ["3 unlabeled scrolls"] = { otyp_name = "blank paper", quan = 3 }, + ["1 unlabelled scroll"] = { otyp_name = "blank paper", quan = 1 }, + ["3 rusty poisoned darts"] = { otyp_name = "dart", quan = 3, opoisoned = 1, oeroded = 1 }, + ["4 diluted dark green potions named whisky"] = { otyp_descr = "dark green", oclass = "!", quan = 4, odiluted = 1, has_oname = 1, oname = "whisky" }, + ["poisoned food ration"] = { otyp_name = "food ration", oclass = "%", age = 1 }, + ["empty tin"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 0 }, + ["blessed tin of spinach"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 1, blessed = 1 }, + ["trapped tin of floating eye meat"] = { otyp_name = "tin", oclass = "%", otrapped = 1, corpsenm_name = "floating eye" }, + ["hill orc corpse"] = { otyp_name = "corpse", oclass = "%", corpsenm_name = "hill orc" }, + ["destroy armor"] = { otyp_name = "destroy armor", oclass = "?" }, + ["enchant weapon"] = { otyp_name = "enchant weapon", oclass = "?" }, + ["scroll of food detection"] = { otyp_name = "food detection", oclass = "?" }, + ["scroll of detect food"] = { otyp_name = "food detection", oclass = "?" }, + ["spellbook of food detection"] = { otyp_name = "detect food", oclass = "+" }, + ["spell"] = { NO_OBJ = 1 }, + ["-1 ring mail"] = { otyp_name = "ring mail", oclass = "[", spe = -1 }, + ["studded leather armor"] = { otyp_name = "studded leather armor", oclass = "[" }, + ["leather armor"] = { otyp_name = "leather armor", oclass = "[" }, + ["tooled horn"] = { otyp_name = "tooled horn", oclass = "(" }, + ["meat ring"] = { otyp_name = "meat ring", oclass = "%" }, + ["beartrap"] = { otyp_name = "beartrap", oclass = "(" }, + ["bear trap"] = { otyp_name = "beartrap", oclass = "(" }, + ["landmine"] = { otyp_name = "land mine", oclass = "(" }, + ["land mine"] = { otyp_name = "land mine", oclass = "(" }, + ["blessed historic statue of woodland-elf named Foo"] = { otyp_name = "statue", blessed = 1, historic = 1, corpsenm_name = "Woodland-elf", oname = "Foo" }, + ["blessed figurine of a ki-rin"] = { otyp_name = "figurine", blessed = 1, corpsenm_name = "ki-rin" }, + ["partly eaten orange"] = { otyp_name = "orange", oclass = "%", oeaten = function () + local oc = obj.class(obj.new("orange")); + return (oc.nutrition // 2); + end }, +}; + +for str, tbl in pairs(wishtest_objects) do + local o = obj.new(str):totable(); + for field, value in pairs(tbl) do + local val; + if (type(value) == "function") then + val = value(); + else + val = value; + end + if (o[field] ~= val) then + error("wished " .. str .. ", but " .. field .. " is " .. o[field] .. ", not " .. val); + end + end +end diff --git a/util/readtags.c b/util/readtags.c deleted file mode 100644 index d74298303..000000000 --- a/util/readtags.c +++ /dev/null @@ -1,1677 +0,0 @@ -/* NetHack 3.6 readtags.c $Date$ $Revision$ */ -/* Copyright (c) Michael Allison, 2018 */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * Read the given ctags file and generate: - * Intermediate temp files: - * include/sfo_proto.tmp - * include/sfi_proto.tmp - * src/sfi_data.tmp - * src/sfo_data.tmp - * Final files: - * sfdata.c - * sfproto.h - * - */ - -#include "hack.h" -#include "lev.h" -#include "integer.h" -#include "wintype.h" -#include -#include -#include - -#ifdef __GNUC__ -#define strncmpi strncasecmp -#endif - -/* version information */ -#ifdef SHORT_FILENAMES -#include "patchlev.h" -#else -#include "patchlevel.h" -#endif - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 -struct nhdatatypes_t { - unsigned int dtclass; - char *dtype; - size_t dtsize; -}; - -struct tagstruct { - int linenum; - char ptr[128]; - char tag[100]; - char filename[128]; - char searchtext[255]; - char tagtype; - char parent[100]; - char parenttype[100]; - char arraysize1[100]; - char arraysize2[100]; - struct tagstruct *next; -}; - -struct needs_array_handling { - const char *nm; - const char *parent; -}; - -#define SFO_DATA c_sfodata -#define SFI_DATA c_sfidata -#define SFDATATMP c_sfdatatmp -#define SFO_PROTO c_sfoproto -#define SFI_PROTO c_sfiproto -#define SFDATA c_sfdata -#define SFPROTO c_sfproto -#define SFPROTO_NAME "../include/sfproto.h" -#define SFDATA_NAME "../src/sfdata.c" - -static char *fgetline(FILE*); -static void quit(void); -static void out_of_memory(void); -static void doline(char *); -static void chain(struct tagstruct *); -#if 0 -static void showthem(void); -static char *stripspecial(char *); -#endif -static char *deblank(char *); -static char *deeol(char *); -static void generate_c_files(); -static char *findtype(char *, char *); -#if 0 -static boolean FDECL(is_prim, (char *)); -#endif -static void taglineparse(char *, struct tagstruct *); -static void parseExtensionFields(struct tagstruct *, char *); -static void set_member_array_size(struct tagstruct *); -#if 0 -static char *member_array_dims(struct tagstruct *, char *); -static char *member_array_size(struct tagstruct *, char *); -#endif -static void output_types(FILE *); -#if 0 -static char *FDECL(dtmacro,(const char *,int)); -#endif -static char *FDECL(dtfn,(const char *,int, boolean *)); -static char *FDECL(bfsize,(const char *)); -static char *FDECL(fieldfix,(char *,char *)); - -#ifdef VMS -static FILE *vms_fopen(name, mode) const char *name, *mode; -{ - return fopen(name, mode, "mbc=64", "shr=nil"); -} -# define fopen(f,m) vms_fopen(f,m) -#endif - -#define Fprintf (void) fprintf -#ifndef __GO32__ -#define DEFAULTTAGNAME "../util/nethack.tags" -#else -#define DEFAULTTAGNAME "../util/nhtags.tag" -#endif -#ifndef _MAX_PATH -#define _MAX_PATH 120 -#endif - -#define TAB '\t' -#define SPACE ' ' - -struct tagstruct *first; -struct tagstruct zerotag; - -static int tagcount; -static const char *infilenm; -static FILE *infile; -static char line[255]; -static long lineno; -static char ssdef[BUFSZ]; -static char fieldfixbuf[BUFSZ]; - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 - -struct nhdatatypes_t readtagstypes[] = { - {NHTYPE_SIMPLE, (char *) "any", sizeof(anything)}, - {NHTYPE_SIMPLE, (char *) "genericptr_t", sizeof(genericptr_t)}, - {NHTYPE_SIMPLE, (char *) "aligntyp", sizeof(aligntyp)}, - {NHTYPE_SIMPLE, (char *) "Bitfield", sizeof(uint8_t)}, - {NHTYPE_SIMPLE, (char *) "boolean", sizeof(boolean)}, - {NHTYPE_SIMPLE, (char *) "char", sizeof(char)}, - {NHTYPE_SIMPLE, (char *) "int", sizeof(int)}, - {NHTYPE_SIMPLE, (char *) "long", sizeof(long)}, - {NHTYPE_SIMPLE, (char *) "schar", sizeof(schar)}, - {NHTYPE_SIMPLE, (char *) "short", sizeof(short)}, - {NHTYPE_SIMPLE, (char *) "size_t", sizeof(size_t)}, - {NHTYPE_SIMPLE, (char *) "string", 1}, - {NHTYPE_SIMPLE, (char *) "time_t", sizeof(time_t)}, - {NHTYPE_SIMPLE, (char *) "uchar", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "unsigned char", sizeof(unsigned char)}, - {NHTYPE_SIMPLE, (char *) "unsigned int", sizeof(unsigned int)}, - {NHTYPE_SIMPLE, (char *) "unsigned long", sizeof(unsigned long)}, - {NHTYPE_SIMPLE, (char *) "unsigned short", sizeof(unsigned short)}, - {NHTYPE_SIMPLE, (char *) "unsigned", sizeof(unsigned)}, - {NHTYPE_SIMPLE, (char *) "xchar", sizeof(xchar)}, - {NHTYPE_COMPLEX, (char *) "align", sizeof(struct align)}, -/* {NHTYPE_COMPLEX, (char *) "attack", sizeof(struct attack)}, */ /* permonst affil */ - {NHTYPE_COMPLEX, (char *) "attribs", sizeof(struct attribs)}, - {NHTYPE_COMPLEX, (char *) "bill_x", sizeof(struct bill_x)}, - {NHTYPE_COMPLEX, (char *) "book_info", sizeof(struct book_info)}, - {NHTYPE_COMPLEX, (char *) "branch", sizeof(struct branch)}, - {NHTYPE_COMPLEX, (char *) "bubble", sizeof(struct bubble)}, - {NHTYPE_COMPLEX, (char *) "cemetery", sizeof(struct cemetery)}, -/* {NHTYPE_COMPLEX, (char *) "container", sizeof(struct container)}, */ - {NHTYPE_COMPLEX, (char *) "context_info", sizeof(struct context_info)}, - {NHTYPE_COMPLEX, (char *) "d_flags", sizeof(struct d_flags)}, - {NHTYPE_COMPLEX, (char *) "d_level", sizeof(struct d_level)}, - {NHTYPE_COMPLEX, (char *) "damage", sizeof(struct damage)}, - {NHTYPE_COMPLEX, (char *) "dest_area", sizeof(struct dest_area)}, - {NHTYPE_COMPLEX, (char *) "dgn_topology", sizeof(struct dgn_topology)}, - {NHTYPE_COMPLEX, (char *) "dig_info", sizeof(struct dig_info)}, - {NHTYPE_COMPLEX, (char *) "dungeon", sizeof(struct dungeon)}, - {NHTYPE_COMPLEX, (char *) "edog", sizeof(struct edog)}, - {NHTYPE_COMPLEX, (char *) "egd", sizeof(struct egd)}, - {NHTYPE_COMPLEX, (char *) "emin", sizeof(struct emin)}, - {NHTYPE_COMPLEX, (char *) "engr", sizeof(struct engr)}, - {NHTYPE_COMPLEX, (char *) "epri", sizeof(struct epri)}, - {NHTYPE_COMPLEX, (char *) "eshk", sizeof(struct eshk)}, - {NHTYPE_COMPLEX, (char *) "fakecorridor", sizeof(struct fakecorridor)}, - {NHTYPE_COMPLEX, (char *) "fe", sizeof(struct fe)}, - {NHTYPE_COMPLEX, (char *) "flag", sizeof(struct flag)}, - {NHTYPE_COMPLEX, (char *) "fruit", sizeof(struct fruit)}, - {NHTYPE_COMPLEX, (char *) "kinfo", sizeof(struct kinfo)}, - {NHTYPE_COMPLEX, (char *) "levelflags", sizeof(struct levelflags)}, - {NHTYPE_COMPLEX, (char *) "linfo", sizeof(struct linfo)}, - {NHTYPE_COMPLEX, (char *) "ls_t", sizeof(struct ls_t)}, - {NHTYPE_COMPLEX, (char *) "mapseen_feat", sizeof(struct mapseen_feat)}, - {NHTYPE_COMPLEX, (char *) "mapseen_flags", sizeof(struct mapseen_flags)}, - {NHTYPE_COMPLEX, (char *) "mapseen_rooms", sizeof(struct mapseen_rooms)}, - {NHTYPE_COMPLEX, (char *) "mapseen", sizeof(struct mapseen)}, - {NHTYPE_COMPLEX, (char *) "mextra", sizeof(struct mextra)}, - {NHTYPE_COMPLEX, (char *) "mkroom", sizeof(struct mkroom)}, - {NHTYPE_COMPLEX, (char *) "monst", sizeof(struct monst)}, - {NHTYPE_COMPLEX, (char *) "mvitals", sizeof(struct mvitals)}, - {NHTYPE_COMPLEX, (char *) "nhcoord", sizeof(struct nhcoord)}, - {NHTYPE_COMPLEX, (char *) "nhrect", sizeof(struct nhrect)}, - {NHTYPE_COMPLEX, (char *) "novel_tracking", sizeof(struct novel_tracking)}, - {NHTYPE_COMPLEX, (char *) "obj", sizeof(struct obj)}, - {NHTYPE_COMPLEX, (char *) "objclass", sizeof(struct objclass)}, - {NHTYPE_COMPLEX, (char *) "obj_split", sizeof(struct obj_split)}, - {NHTYPE_COMPLEX, (char *) "oextra", sizeof(struct oextra)}, -/* {NHTYPE_COMPLEX, (char *) "permonst", sizeof(struct permonst)}, */ - {NHTYPE_COMPLEX, (char *) "polearm_info", sizeof(struct polearm_info)}, - {NHTYPE_COMPLEX, (char *) "prop", sizeof(struct prop)}, - {NHTYPE_COMPLEX, (char *) "q_score", sizeof(struct q_score)}, - {NHTYPE_COMPLEX, (char *) "rm", sizeof(struct rm)}, - {NHTYPE_COMPLEX, (char *) "s_level", sizeof(struct s_level)}, - {NHTYPE_COMPLEX, (char *) "savefile_info", sizeof(struct savefile_info)}, - {NHTYPE_COMPLEX, (char *) "skills", sizeof(struct skills)}, - {NHTYPE_COMPLEX, (char *) "spell", sizeof(struct spell)}, - {NHTYPE_COMPLEX, (char *) "stairway", sizeof(struct stairway)}, -#ifdef SYSFLAGS - {NHTYPE_COMPLEX, (char *) "sysflag", sizeof(struct sysflag)}, -#endif - {NHTYPE_COMPLEX, (char *) "takeoff_info", sizeof(struct takeoff_info)}, - {NHTYPE_COMPLEX, (char *) "tin_info", sizeof(struct tin_info)}, - {NHTYPE_COMPLEX, (char *) "trap", sizeof(struct trap)}, - {NHTYPE_COMPLEX, (char *) "tribute_info", sizeof(struct tribute_info)}, - {NHTYPE_COMPLEX, (char *) "u_achieve", sizeof(struct u_achieve)}, - {NHTYPE_COMPLEX, (char *) "u_conduct", sizeof(struct u_conduct)}, - {NHTYPE_COMPLEX, (char *) "u_event", sizeof(struct u_event)}, - {NHTYPE_COMPLEX, (char *) "u_have", sizeof(struct u_have)}, - {NHTYPE_COMPLEX, (char *) "u_realtime", sizeof(struct u_realtime)}, - {NHTYPE_COMPLEX, (char *) "u_roleplay", sizeof(struct u_roleplay)}, - {NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info)}, - {NHTYPE_COMPLEX, (char *) "victual_info", sizeof(struct victual_info)}, - {NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo)}, - {NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs)}, - {NHTYPE_COMPLEX, (char *) "warntype_info", sizeof(struct warntype_info)}, - {NHTYPE_COMPLEX, (char *) "you", sizeof(struct you)} -}; - -/* - * These have arrays of other structs, not just arrays of - * simple types. We need to put array handling right into - * the code for these ones. - */ -struct needs_array_handling nah[] = { - {"fakecorr", (char *) "egd"}, - {"bill", "eshk"}, - {"msrooms", "mapseen"}, - {"mtrack", "monst"}, - {"ualignbase", "you"}, - {"weapon_skills", "you"}, -}; - -/* conditional code tags - eecch */ -const char *condtag[] = { -#ifdef SYSFLAGS - "sysflag","altmeta","#ifdef AMIFLUSH", "", - "sysflag","amiflush","","#endif /*AMIFLUSH*/", - "sysflag","numcols", "#ifdef AMII_GRAPHICS", "", - "sysflag","amii_dripens","","", - "sysflag","amii_curmap","","#endif", - "sysflag","fast_map", "#ifdef OPT_DISMAP", "#endif", - "sysflag","asksavedisk","#ifdef MFLOPPY","#endif", - "sysflag","page_wait", "#ifdef MAC", "#endif", -#endif - "linfo","where","#ifdef MFLOPPY","", - "linfo","time","","", - "linfo","size","","#endif /*MFLOPPY*/", - "obj","oinvis","#ifdef INVISIBLE_OBJECTS", "#endif", - (char *)0,(char *)0,(char *)0, (char *)0 -}; - - - -int main(argc, argv) -int argc; -char *argv[]; -{ - tagcount = 0; - - if (argc > 1) infilenm = argv[1]; - if (!infilenm || !*infilenm) infilenm = DEFAULTTAGNAME; - - infile = fopen(infilenm,"r"); - if (!infile) { - printf("%s not found or unavailable\n",infilenm); - quit(); - } - - while (fgets(line, sizeof line, infile)) { - ++lineno; -/* if (lineno == 868) DebugBreak(); */ - doline(line); - } - - fclose(infile); - printf("\nRead in %ld lines and stored %d tags.\n", lineno, tagcount); -#if 0 - showthem(); -#endif - generate_c_files(); - printf("Created %s\n", SFDATA_NAME); - printf("Created %s\n", SFPROTO_NAME); - exit(EXIT_SUCCESS); - /*NOTREACHED*/ - return 0; -} - -static void doline(aline) -char *aline; -{ - char buf[255]; - struct tagstruct *tmptag = malloc(sizeof(struct tagstruct)); - - if (!tmptag) { - out_of_memory(); - } - *tmptag = zerotag; - - if (!aline || (aline && *aline == '!')) { - free(tmptag); - return; - } - - strncpy(buf, deeol(aline), 254); - taglineparse(buf,tmptag); - chain(tmptag); - return; -} - -static void chain(tag) -struct tagstruct *tag; -{ - static struct tagstruct *prev = (struct tagstruct *)0; - if (!first) { - tag->next = (struct tagstruct *)0; - first = tag; - } else { - tag->next = (struct tagstruct *)0; - if (prev) { - prev->next = tag; - } else { - printf("Error - No previous tag at %s\n", tag->tag); - } - } - prev = tag; - ++tagcount; -} -static void quit() -{ - exit(EXIT_FAILURE); -} - -static void out_of_memory() -{ - printf("maketags: out of memory at line %ld of %s\n", - lineno, infilenm); - quit(); -} - -#if 0 -static char empt[] = {0, 0, 0, 0, 0, 0, 0, 0}; -#endif - -#if 0 -static char *member_array_dims(struct tagstruct *tmptag, char *buf) -{ - if (buf && tmptag) { - if (tmptag->arraysize1[0]) - Sprintf(buf, "[%s]", tmptag->arraysize1); - if (tmptag->arraysize2[0]) - Sprintf(eos(buf), "[%s]", tmptag->arraysize2); - return buf; - } - return empt; -} - -static char *member_array_size(struct tagstruct *tmptag, char *buf) -{ - if (buf && tmptag) { - if (tmptag->arraysize1[0]) - strcpy(buf, tmptag->arraysize1); - if (tmptag->arraysize2[0]) - Sprintf(eos(buf), " * %s", tmptag->arraysize2); - return buf; - } - return empt; -} -#endif - -void set_member_array_size(struct tagstruct *tmptag) -{ - char buf[BUFSZ]; - /* static char result[49]; */ - char *arr1 = (char *)0, *arr2 = (char *)0, *tmp; - int cnt = 0; - - if (!tmptag) return; - strcpy(buf, tmptag->searchtext); - - tmptag->arraysize1[0] = '\0'; - tmptag->arraysize2[0] = '\0'; - - /* find left-open square bracket */ - tmp = strchr(buf, '['); - if (tmp) { - arr1 = tmp; - *tmp = '\0'; - --tmp; - /* backup and make sure the [] are on the right tag */ - while (!(*tmp == SPACE || *tmp == TAB || *tmp ==',' || cnt > 50)) { - --tmp; - cnt++; - } - if (cnt > 50) return; - tmp++; - if (strcmp(tmp, tmptag->tag) == 0) { - ++arr1; - tmp = strchr(arr1, ']'); - if (tmp) { - arr2 = tmp; - ++arr2; - *tmp = '\0'; - if (*arr2 == '[') { /* two-dimensional array */ - ++arr2; - tmp = strchr(arr2, ']'); - if (tmp) *tmp = '\0'; - } else { - arr2 = (char *)0; - } - } - } else { - arr1 = (char *)0; - } - } - if (arr1) (void)strcpy(tmptag->arraysize1, arr1); - if (arr2) (void)strcpy(tmptag->arraysize2, arr2); -} - -static void parseExtensionFields (tmptag, buf) -struct tagstruct *tmptag; -char *buf; -{ - char *p = buf; - while (p != (char *)0 && *p != '\0') { - while (*p == TAB) - *p++ = '\0'; - if (*p != '\0') { - char *colon; - char *field = p; - - p = strchr (p, TAB); - if (p != (char *)0) - *p++ = '\0'; - colon = strchr (field, ':'); - if (colon == (char *)0) { - tmptag->tagtype = *field; - } else { - const char *key = field; - const char *value = colon + 1; - *colon = '\0'; - if ((strcmp (key, "struct") == 0) || - (strcmp (key, "union") == 0)) { - colon = strstr(value,"::"); - if (colon) - value = colon +2; - strcpy(tmptag->parenttype, key); - strcpy(tmptag->parent, value); - } - } - } - } -} - -void -taglineparse(p,tmptag) -char *p; -struct tagstruct *tmptag; -{ - int fieldsPresent = 0; - char *filenm = 0, *pattern = 0, *tmp1 = 0; - int linenumber = 0; - char *tab = strchr (p, TAB); - - if (tab != NULL) { - *tab = '\0'; - strcpy(tmptag->tag,p); - p = tab + 1; - filenm = p; - tab = strchr (p, TAB); - if (tab != NULL) { - *tab = '\0'; - p = tab + 1; - if (*p == '/' || *p == '?') { - /* parse pattern */ - int delimiter = *(unsigned char *) p; - linenumber = 0; - pattern = p; - do { - p = strchr (p + 1, delimiter); - } while (p != (char *)0 && *(p - 1) == '\\'); - - if (p == (char *)0) { - /* invalid pattern */ - } else - ++p; - } else if (isdigit ((int) *(unsigned char *) p)) { - /* parse line number */ - pattern = p; - linenumber = atol(p); - while (isdigit((int) *(unsigned char *) p)) - ++p; - } else { - /* invalid pattern */ - } - fieldsPresent = (strncmp (p, ";\"", 2) == 0); - *p = '\0'; - - if (fieldsPresent) - parseExtensionFields (tmptag, p + 2); - } - } - - strcpy(tmptag->searchtext, pattern); - tmptag->linenum = linenumber; - - /* add the array dimensions */ - set_member_array_size(tmptag); - - /* determine if this is a pointer and mark it as such */ - if (tmptag->searchtext[0] && - (tmptag->tagtype == 'm' || tmptag->tagtype == 's')) { - char ptrbuf[BUFSZ], searchbuf[BUFSZ]; - - (void) strcpy(ptrbuf, tmptag->searchtext); - Sprintf(searchbuf,"*%s", tmptag->tag); - tmp1 = strstr(ptrbuf, searchbuf); - if (!tmp1) { - Sprintf(searchbuf,"* %s", tmptag->tag); - tmp1 = strstr(ptrbuf, searchbuf); - } - if (tmp1) { - while ((tmp1 > ptrbuf) && (*tmp1 != SPACE) && - (*tmp1 != TAB) && (*tmp1 != ',')) - tmp1--; - tmp1++; - while (*tmp1 == '*') - tmp1++; - *tmp1 = '\0'; - /* now find the first * before this in case multiple things - are declared on this line */ - tmp1 = strchr(ptrbuf+2, '*'); - if (tmp1) { - tmp1++; - *tmp1 = '\0'; - tmp1 = ptrbuf + 2; - while (*tmp1 == SPACE || *tmp1 == TAB || *tmp1 == ',') - ++tmp1; - (void)strcpy(tmptag->ptr, tmp1); - } - } - } -} - -/* eos() is copied from hacklib.c */ -/* return the end of a string (pointing at '\0') */ -char * -eos(s) -char *s; -{ - while (*s) s++; /* s += strlen(s); */ - return s; -} - -static char stripbuf[255]; - -#if 0 -static char *stripspecial(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if (*st >= SPACE) - *out++ = *st++; - else - st++; - } - *out = '\0'; - return stripbuf; -} -#endif - -static char *deblank(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if (*st == SPACE) { - *out++ = '_'; - st++; - } else - *out++ = *st++; - } - *out = '\0'; - return stripbuf; -} - -static char *deeol(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if ((*st == '\r') || (*st == '\n')) { - st++; - } else - *out++ = *st++; - } - *out = '\0'; - return stripbuf; -} - -#if 0 -static void showthem() -{ - char buf[BUFSZ], *tmp; - struct tagstruct *t = first; - while(t) { - printf("%-28s %c, %-16s %-10s", t->tag, t->tagtype, - t->parent, t->parenttype); -#if 0 - t->parent[0] ? t->searchtext : ""); -#endif - buf[0] = '\0'; - tmp = member_array_dims(t,buf); - if (tmp) printf("%s", tmp); - printf("%s","\n"); - t = t->next; - } -} -#endif - -#if 0 -static boolean -is_prim(sdt) -char *sdt; -{ - int k = 0; - if (sdt) { - /* special case where we don't match entire thing */ - if (!strncmpi(sdt, "Bitfield",8)) - return TRUE; - for (k = 0; k < SIZE(readtagstypes); ++k) { - if (!strcmpi(readtagstypes[k].dtype, sdt)) { - if (readtagstypes[k].dtclass == NHTYPE_SIMPLE) - return TRUE; - else - return FALSE; - } - } - } - return FALSE; -} -#endif - -char * -findtype(st, tag) -char *st; -char *tag; -{ - static char ftbuf[512]; - static char prevbuf[512]; - char *tmp1, *tmp2, *tmp3, *tmp4; - const char *r; - - if (!st) return (char *)0; - if (st[0] == '/' && st[1] == '^') { - tmp2 = tmp3 = tmp4 = (char *)0; - tmp1 = &st[3]; - while (*tmp1) { - if (isspace(*tmp1)) - ; /* skip it */ - else - break; - ++tmp1; - } - if (!strncmp(tmp1, tag, strlen(tag))) { - if(strlen(tag) == 1) { - char *sc = tmp1; - /* Kludge: single char match is too iffy, - check to make sure its a complete - token that we're comparing to. */ - ++sc; - if (!(*sc == '_' || (*sc > 'a' && *sc < 'z') || - (*sc > 'A' && *sc < 'Z') || (*sc > '0' && *sc < '9'))) - return (char *)0; - } else { - return (char *)0; - } - } - if (*tmp1) { - if (!strncmp(tmp1, "Bitfield", 8)) { - strcpy(ftbuf, tmp1); - tmp1 = ftbuf; - tmp3 = strchr(tmp1, ')'); - if (tmp3) { - tmp3++; - *tmp3 = '\0'; - return ftbuf; - } - return (char *)0; - } - } - if (*tmp1) { - int prevchar = 0; - strcpy(ftbuf, tmp1); - tmp1 = ftbuf; - /* find space separating first word with second */ - while (!isspace(*tmp1)) { - prevchar = *tmp1; - ++tmp1; - } - - /* some oddball cases */ - if (prevchar == ',' || prevchar == ';') { - tmp3 = strchr(ftbuf, ','); - tmp2 = strstr(ftbuf, tag); - return prevbuf; - } else { - /* a comma means that more than one thing declared on ine */ - tmp3 = strchr(tmp1, ','); - tmp2 = strstr(tmp1, tag); - } - /* make sure we're matching a complete token */ - if (tmp2) { - tmp4 = tmp2 + strlen(tag); - if ((*tmp4 == '_') || (*tmp4 >= 'a' && *tmp4 <= 'z') || - (*tmp4 >= 'A' && *tmp4 <= 'Z') || (*tmp4 >= '0' && *tmp4 <= '9')) - /* jump to next occurence then */ - tmp2 = strstr(tmp4, tag); - } - /* tag w/o comma OR tag found w comma and tag before comma */ - if ((tmp2 && !tmp3) || ((tmp2 && tmp3) && (tmp2 < tmp3))) { - *tmp2 = '\0'; - --tmp2; - while (isspace(*tmp2)) - --tmp2; - tmp2++; - *tmp2 = '\0'; - } - /* comma and no tag OR tag w comma and comma before tag */ - else if ((tmp3 && !tmp2) || ((tmp2 && tmp3) && (tmp3 < tmp2))) { - --tmp3; - if (isspace(*tmp3)) { - while (isspace(*tmp3)) - --tmp3; - } - while (!isspace(*tmp3) && (*tmp3 != '*')) - --tmp3; - while (isspace(*tmp3)) - --tmp3; - tmp3++; - *tmp3 = '\0'; - } - /* comma or semicolon immediately following tag */ - else { - volatile int y; - y = 1; - } - if (strncmpi(ftbuf, "struct ", 7) == 0) - r = (const char *) (ftbuf + 7); - else if (strncmpi(ftbuf, "union ", 6) == 0) - r = (const char *) (ftbuf + 6); - /* a couple of kludges follow unfortunately */ - else if (strncmpi(ftbuf, "coord", 5) == 0) - r = "nhcoord"; - else if (strncmpi(ftbuf, "anything", 8) == 0) - r = "any"; - else if (strncmpi(ftbuf, "const char", 10) == 0) - r = "char"; - else - r = (const char *) ftbuf; - strcpy(prevbuf, r); - return prevbuf; - } - } - prevbuf[0] = '\0'; - return (char *)0; -} - -boolean -listed(t) -struct tagstruct *t; -{ - int k; - - if ((strncmpi(t->tag, "Bitfield", 8) == 0) || - (strcmpi(t->tag, "string") == 0)) - return TRUE; - for (k = 0; k < SIZE(readtagstypes); ++k) { - /* This needs to be case-sensitive to avoid generating collision - * between 'align' and 'Align'. - */ - if (strcmp(readtagstypes[k].dtype, t->tag) == 0) - return TRUE; - } - return FALSE; -} - -/* TIME_type: type of the argument to time(); we actually use &(time_t) */ -#if defined(BSD) && !defined(POSIX_TYPES) -#define TIME_type long * -#else -#define TIME_type time_t * -#endif -/* LOCALTIME_type: type of the argument to localtime() */ -#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) \ - || (defined(BSD) && !defined(POSIX_TYPES)) -#define LOCALTIME_type long * -#else -#define LOCALTIME_type time_t * -#endif - -const char *preamble[] = { - "/* Copyright (c) NetHack Development Team %d. */\n", - "/* NetHack may be freely redistributed. See license for details. */\n\n", - "/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */\n\n", - "#include \"hack.h\"\n", - "#include \"artifact.h\"\n", - "#include \"func_tab.h\"\n", - "#include \"lev.h\"\n", - "#include \"integer.h\"\n", - "#include \"wintype.h\"\n", - (char *)0 -}; -char crbuf[BUFSZ]; - -static const char *get_preamble(n) -int n; -{ - const char *r = preamble[n]; - - if (!n) { - time_t datetime = 0; - struct tm *lt; - - (void) time((TIME_type) &datetime); - lt = localtime((LOCALTIME_type) &datetime); - Sprintf(crbuf, preamble[0], (1900 + lt->tm_year)); - r = crbuf; - } - return r; -} - -static void output_types(fp1) -FILE *fp1; -{ - int k, cnt /*, hcnt = 1 */; - struct tagstruct *t = first; - - Fprintf(fp1, "%s", - "struct nhdatatypes_t nhdatatypes[] = {\n"); - - for (k = 0; k < SIZE(readtagstypes); ++k) { - if (readtagstypes[k].dtclass == NHTYPE_SIMPLE) { - Fprintf(fp1,"\t{NHTYPE_SIMPLE, (char *) \"%s\", sizeof(%s)},\n", - readtagstypes[k].dtype, - (strncmpi(readtagstypes[k].dtype, "Bitfield", 8) == 0) ? - "uint8_t" : - (strcmpi(readtagstypes[k].dtype, "string") == 0) ? - "uchar" : - (strcmpi(readtagstypes[k].dtype, "any") == 0) ? - "anything" : readtagstypes[k].dtype); -/* dtmacro(readtagstypes[k].dtype,0)); */ -#if 0 - Fprintf(fp2, "#define %s\t%s%d\n", dtmacro(readtagstypes[k].dtype,1), - (strlen(readtagstypes[k].dtype) > 12) ? "" : - (strlen(readtagstypes[k].dtype) < 5) ? "\t\t" : - "\t", hcnt++); -#endif - } - } - cnt = 0; - while(t) { - if (listed(t) && ((t->tagtype == 's') || (t->tagtype == 'u'))) { - if (!strcmp(t->tag, "any")) { - t = t->next; - continue; - } - if (cnt > 0) - Fprintf(fp1, "%s", ",\n"); - Fprintf(fp1, "\t{NHTYPE_COMPLEX, (char *) \"%s\", sizeof(%s %s)}", - t->tag, - (t->tagtype == 's') ? "struct" : "union", t->tag); - cnt += 1; - } - t = t->next; - } - Fprintf(fp1, "%s", "\n};\n\n"); - Fprintf(fp1, "int nhdatatypes_size()\n{\n\treturn SIZE(nhdatatypes);\n}\n\n"); -} - -static void generate_c_files() -{ - struct tagstruct *t = first; -#ifdef KR1ED - long clocktim = 0; -#else - time_t clocktim = 0; -#endif - char *c, cbuf[60], sfparent[BUFSZ], *substruct, *gline; - FILE *SFO_DATA, *SFI_DATA, *SFDATATMP, *SFO_PROTO, *SFI_PROTO, - *SFDATA, *SFPROTO; - int k = 0, j, opening /*, closetag = 0 */; - const char *pt; - char *ft, *layout, *last_ft = (char *)0; - int okeydokey, x, a; - boolean did_i; - - SFDATA = fopen(SFDATA_NAME, "w"); - if (!SFDATA) return; - - SFPROTO = fopen(SFPROTO_NAME, "w"); - if (!SFPROTO) return; - - SFO_DATA = fopen("../src/sfo_data.tmp", "w"); - if (!SFO_DATA) return; - - SFO_PROTO = fopen("../include/sfo_proto.tmp", "w"); - if (!SFO_PROTO) return; - - SFI_PROTO = fopen("../include/sfi_proto.tmp", "w"); - if (!SFI_PROTO) return; - - SFI_DATA = fopen("../src/sfi_data.tmp", "w"); - if (!SFI_DATA) return; - - SFDATATMP = fopen("../src/sfdata.tmp", "w"); - if (!SFDATATMP) return; - - (void) time(&clocktim); - Strcpy(cbuf, ctime(&clocktim)); - - for (c = cbuf; *c; c++) - if (*c == '\n') - break; - *c = '\0'; /* strip off the '\n' */ - - /* begin sfproto.h */ - Fprintf(SFPROTO,"/* NetHack %d.%d sfproto.h */\n", - VERSION_MAJOR, VERSION_MINOR); - for (j = 0; j < 3; ++j) - Fprintf(SFPROTO, "%s", get_preamble(j)); - Fprintf(SFPROTO, "#ifndef SFPROTO_H\n#define SFPROTO_H\n\n"); - Fprintf(SFPROTO, "#include \"hack.h\"\n#include \"integer.h\"\n#include \"wintype.h\"\n\n" - "#define E extern\n\n"); - - /* sfbase.c function prototypes */ - Fprintf(SFPROTO,"%s\n", "E int NDECL(critical_members_count);"); - Fprintf(SFPROTO,"/* sfbase.c output functions */\n"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_any, (NHFILE *, anything *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_char, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_int, (NHFILE *, int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_long, (NHFILE *, long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_schar, (NHFILE *, schar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_short, (NHFILE *, short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uchar, (NHFILE *, uchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_str, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"/* sfbase.c input functions */\n"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_any, (NHFILE *, anything *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_char, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_int, (NHFILE *, int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_long, (NHFILE *, long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_schar, (NHFILE *, schar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_short, (NHFILE *, short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uchar, (NHFILE *, uchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_str, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFO_PROTO, "/* generated output functions */\n"); - Fprintf(SFI_PROTO, "/* generated input functions */\n"); - - /* begin sfdata.c */ - Fprintf(SFDATA,"/* NetHack %d.%d sfdata.c */\n", - VERSION_MAJOR, VERSION_MINOR); - for (j = 0; preamble[j]; ++j) - Fprintf(SFDATA, "%s", get_preamble(j)); - Fprintf(SFDATA, "#include \"sfproto.h\"\n\n"); - Fprintf(SFDATA, "#define NHTYPE_SIMPLE 1\n"); - Fprintf(SFDATA, "#define NHTYPE_COMPLEX 2\n"); - Fprintf(SFDATA, "struct nhdatatypes_t {\n"); - Fprintf(SFDATA, " unsigned int dtclass;\n"); - Fprintf(SFDATA, " char *dtype;\n"); - Fprintf(SFDATA, " size_t dtsize;\n};\n\n"); - Fprintf(SFDATA,"static uint8_t bitfield = 0;\n"); - - output_types(SFDATATMP); - Fprintf(SFDATATMP,"const char *critical_members[] = {\n"); - - k = 0; - opening = 1; - did_i = FALSE; - while(k < SIZE(readtagstypes)) { - boolean insert_const = FALSE; - - if (readtagstypes[k].dtclass == NHTYPE_COMPLEX) { - - if (!strncmpi(readtagstypes[k].dtype,"Bitfield",8)) { - Fprintf(SFO_DATA, - "\nvoid\nsfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "uint8_t *d_bitfield;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n"); - - Fprintf(SFI_DATA, - "\nvoid\nsfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "uint8_t *d_bitfield;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n"); - } - -#if 0 - if (!strncmpi(readtagstypes[k].dtype,"version_info",8)) - insert_const = TRUE; -#endif - - pt = (const char *) 0; - layout = (char *) 0; - t = first; - while(t) { - if (t->tagtype == 'u' && !strcmp(t->tag, readtagstypes[k].dtype)) { - pt = "union"; - break; - } - t = t->next; - } - - if (!pt) { - pt = "struct"; - } - Fprintf(SFO_PROTO, - "E void FDECL(sfo_%s, (NHFILE *, %s%s %s *, const char *, const char *, int));\n", - readtagstypes[k].dtype, - insert_const ? "const " : "", - pt, readtagstypes[k].dtype); - - Fprintf(SFO_DATA, - "\nvoid\nsfo_%s(nhfp, d_%s, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "%s%s %s *d_%s;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n", - readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype), - insert_const ? "const " : "", - pt, readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype)); - - Fprintf(SFO_DATA, - " const char *parent = \"%s\";\n", - readtagstypes[k].dtype); - - Fprintf(SFI_PROTO, - "E void FDECL(sfi_%s, (NHFILE *, %s%s %s *, const char *, const char *, int));\n", - readtagstypes[k].dtype, - insert_const ? "const " : "", - pt, readtagstypes[k].dtype); - - Fprintf(SFI_DATA, - "\nvoid\nsfi_%s(nhfp, d_%s, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "%s%s %s *d_%s;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n", - readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype), - insert_const ? "const " : "", - pt, readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype)); - - Fprintf(SFI_DATA, - " const char *parent = \"%s\";\n", - readtagstypes[k].dtype); - - Sprintf(sfparent, "%s %s", pt, readtagstypes[k].dtype); - - for (a = 0; a < SIZE(nah); ++a) { - if (!strcmp(nah[a].parent, readtagstypes[k].dtype)) { - if (!did_i) { - Fprintf(SFO_DATA, " int i;\n"); - Fprintf(SFI_DATA, " int i;\n"); - did_i = TRUE; - } - } - } - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - Fprintf(SFO_DATA, " nhUse(myname);\n nhUse(cnt);\n"); - Fprintf(SFO_DATA, - " if (nhfp->addinfo)\n" - " sfo_addinfo(nhfp, myparent, \"start\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFI_DATA, " nhUse(myname);\n nhUse(cnt);\n"); - Fprintf(SFI_DATA, - " if (nhfp->addinfo)\n" - " sfi_addinfo(nhfp, myparent, \"start\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - /******************************************************** - * cycle through all the tags and find every tag with * - * a parent matching readtagstypes[k].dtype * - ********************************************************/ - - t = first; - - while(t) { - x = 0; - okeydokey = 0; - - if (t->tagtype == 's') { - char *ss = strstr(t->searchtext,"{$/"); - - if (ss) { - strcpy(ssdef, t->tag); - } - t = t->next; - continue; - } - - /************insert opening conditional if needed ********/ - while(condtag[x]) { - if (!strcmp(condtag[x],readtagstypes[k].dtype) && - !strcmp(condtag[x+1],t->tag)) { - okeydokey = 1; - break; - } - x = x + 4; - } - - /* some structs are entirely defined within another struct declaration. - * Legal, but unfortunate for us here. - */ - substruct = strstr(t->parent, "::"); - if (substruct) { - substruct += 2; - } - - if ((strcmp(readtagstypes[k].dtype, t->parent) == 0) || - (substruct && strcmp(readtagstypes[k].dtype, substruct) == 0)) { - ft = (char *)0; - if (t->ptr[0]) - ft = &t->ptr[0]; - else - ft = findtype(t->searchtext, t->tag); - if (ft) { - last_ft = ft; - if (okeydokey && condtag[x+2] && strlen(condtag[x+2]) > 0) { - Fprintf(SFO_DATA,"%s\n", condtag[x+2]); - Fprintf(SFI_DATA,"%s\n", condtag[x+2]); - Fprintf(SFDATATMP,"%s\n", condtag[x+2]); - } - } else { - /* use the last found one as last resort then */ - ft = last_ft; - } - - /***************** Bitfield *******************/ - if (!strncmpi(ft, "Bitfield", 8)) { - char lbuf[BUFSZ]; - int j2, z; - - Sprintf(lbuf, - " " - "bitfield = d_%s->%s;", - readtagstypes[k].dtype, t->tag); - z = (int) strlen(lbuf); - for (j2 = 0; j2 < (65 - z); ++j2) - Strcat(lbuf, " "); - Sprintf(eos(lbuf), "/* (%s) */\n", ft); - Fprintf(SFO_DATA, "%s", lbuf); - Fprintf(SFO_DATA, - " " - "sfo_bitfield(nhfp, &bitfield, parent, \"%s\", %s);\n", - t->tag, bfsize(ft)); -#if 0 - Fprintf(SFI_DATA, - " " - "bitfield = 0;\n"); -#else - Fprintf(SFI_DATA, - " " - "bitfield = d_%s->%s; /* set it to current value for testing */\n", - readtagstypes[k].dtype, t->tag); -#endif - Fprintf(SFI_DATA, - " " - "sfi_bitfield(nhfp, &bitfield, parent, \"%s\", %s);\n", - t->tag, bfsize(ft)); - - Fprintf(SFI_DATA, - " " - "d_%s->%s = bitfield;\n\n", - readtagstypes[k].dtype, t->tag); - Fprintf(SFDATATMP, - "\t\"%s:%s:%s\",\n", - sfparent, t->tag, ft); - } else { - /**************** not a bitfield ****************/ - char arrbuf[BUFSZ]; - char lbuf[BUFSZ * 2]; /* sprintf target for others, gcc complaint */ - char fnbuf[BUFSZ]; - char altbuf[BUFSZ]; - boolean isptr = FALSE, kludge_sbrooms = FALSE; - boolean insert_loop = FALSE; - int j2, z; - - /*************** kludge for sbrooms *************/ - if (!strcmp(t->tag, "sbrooms")) { - kludge_sbrooms = TRUE; - (void) strcpy(t->arraysize1,"MAX_SUBROOMS"); - } - - if (t->arraysize2[0]) { - Sprintf(arrbuf, "(%s * %s)", - t->arraysize1, t->arraysize2); - isptr = TRUE; /* suppress the & in function args */ - } else if (t->arraysize1[0]) { - Sprintf(arrbuf, "%s", t->arraysize1); - isptr = TRUE; /* suppress the & in function args */ - } else { - Strcpy(arrbuf, "1"); - } - Strcpy(fnbuf, dtfn(ft,0,&isptr)); - /* - * determine if this is one of the special cases - * where there's an array of structs instead of - * an array of simple types. We need to insert - * a for loop in those cases. - */ - for (a = 0; a < SIZE(nah); ++a) { - if (!strcmp(nah[a].parent, t->parent)) - if (!strcmp(nah[a].nm, t->tag)) - insert_loop = TRUE; - } - - if (isptr && !strcmp(fnbuf, readtagstypes[k].dtype)) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && - (!strcmp(t->ptr, "struct permonst *") || - !strcmp(t->ptr, "struct monst *") || - !strcmp(t->ptr, "struct obj *") || - !strcmp(t->ptr, "struct cemetery *") || - !strcmp(t->ptr, "struct container *") || - !strcmp(t->ptr, "struct mextra *") || - !strcmp(t->ptr, "struct oextra *") || - !strcmp(t->ptr, "struct s_level *") || - !strcmp(t->ptr, "struct bill_x *") || - !strcmp(t->ptr, "struct trap *"))) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && - (!strcmp(t->parent, "engr") && - !strcmp(t->tag, "engr_txt"))) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && !strcmp(t->tag, "oc_uname")) { - Strcpy(altbuf, "genericptr"); - } else { - Strcpy(altbuf, fnbuf); - } - - if (insert_loop) { - Fprintf(SFO_DATA, - " for (i = 0; i < %s; ++i)\n", - arrbuf); - Fprintf(SFI_DATA, - " for (i = 0; i < %s; ++i)\n", - arrbuf); - arrbuf[0] = '1'; - arrbuf[1] = '\0'; - } - - Sprintf(lbuf, - " " - "%ssfo_%s(nhfp, %s%sd_%s->%s%s, parent, \"%s\", %s);", - insert_loop ? " " : "", - altbuf, - (isptr && !strcmp(altbuf, "genericptr")) ? "(genericptr_t) " : "", - (isptr && !insert_loop && !kludge_sbrooms - && strcmp(altbuf, "genericptr")) ? "" : "&", - readtagstypes[k].dtype, - t->tag, - kludge_sbrooms ? "[0]" : insert_loop ? "[i]" : "", - t->tag, - arrbuf); - /* align comments */ - z = (int) strlen(lbuf); - for (j2 = 0; j2 < (65 - z); ++j2) - Strcat(lbuf, " "); - Sprintf(eos(lbuf), "/* (%s) */\n", ft); - Fprintf(SFO_DATA, "%s", lbuf); - - Sprintf(lbuf, - " " - "%ssfi_%s(nhfp, %s%sd_%s->%s%s, parent, \"%s\", %s);\n", - insert_loop ? " " : "", - altbuf, - (isptr && !strcmp(altbuf, "genericptr")) ? "(genericptr_t) " : "", - (isptr && !insert_loop && !kludge_sbrooms - && strcmp(altbuf, "genericptr")) ? "" : "&", - readtagstypes[k].dtype, - t->tag, - kludge_sbrooms ? "[0]" : insert_loop ? "[i]" : "", - t->tag, - arrbuf); - Fprintf(SFI_DATA, "%s", lbuf); - Fprintf(SFDATATMP, - "\t\"%s:%s:%s\",\n", - sfparent, t->tag,fieldfix(ft,ssdef)); - kludge_sbrooms = FALSE; - } - - /************insert closing conditional if needed ********/ - if (okeydokey && condtag[x+3] && strlen(condtag[x+3]) > 0) { - Fprintf(SFO_DATA,"%s\n", condtag[x+3]); - Fprintf(SFI_DATA,"%s\n", condtag[x+3]); - Fprintf(SFDATATMP,"%s\n", condtag[x+3]); - } - } - t = t->next; - } - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - Fprintf(SFO_DATA, - " if (nhfp->addinfo)\n" - " sfo_addinfo(nhfp, myparent, \"end\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFI_DATA, - " if (nhfp->addinfo)\n" - " sfi_addinfo(nhfp, myparent, \"end\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFO_DATA, "}\n"); - Fprintf(SFI_DATA, "}\n"); - opening = 0; - } - ++k; - did_i = FALSE; - } - - Fprintf(SFDATATMP,"};\n\n"); - Fprintf(SFDATATMP, "int critical_members_count()\n{\n\treturn SIZE(critical_members);\n}\n\n"); - - fclose(SFO_DATA); - fclose(SFI_DATA); - fclose(SFO_PROTO); - fclose(SFI_PROTO); - fclose(SFDATATMP); - - /* Consolidate SFO_* and SFI_* into single files */ - - SFO_DATA = fopen("../src/sfo_data.tmp", "r"); - if (!SFO_DATA) return; - while ((gline = fgetline(SFO_DATA)) != 0) { - (void) fputs(gline, SFDATA); - free(gline); - } - (void) fclose(SFO_DATA); - (void) remove("../src/sfo_data.tmp"); - - SFI_DATA = fopen("../src/sfi_data.tmp", "r"); - if (!SFI_DATA) return; - while ((gline = fgetline(SFI_DATA)) != 0) { - (void) fputs(gline, SFDATA); - free(gline); - } - (void) fclose(SFI_DATA); - (void) remove("../src/sfi_data.tmp"); - - SFO_PROTO = fopen("../include/sfo_proto.tmp", "r"); - if (!SFO_PROTO) return; - while ((gline = fgetline(SFO_PROTO)) != 0) { - (void) fputs(gline, SFPROTO); - free(gline); - } - (void) fclose(SFO_PROTO); - (void) remove("../include/sfo_proto.tmp"); - - SFI_PROTO = fopen("../include/sfi_proto.tmp", "r"); - if (!SFI_PROTO) return; - while ((gline = fgetline(SFI_PROTO)) != 0) { - (void) fputs(gline, SFPROTO); - free(gline); - } - (void) fclose(SFI_PROTO); - (void) remove("../include/sfi_proto.tmp"); - - SFDATATMP = fopen("../src/sfdata.tmp", "r"); - if (!SFDATATMP) return; - while ((gline = fgetline(SFDATATMP)) != 0) { - (void) fputs(gline, SFDATA); - free(gline); - } - (void) fclose(SFDATATMP); - (void) remove("../src/sfdata.tmp"); - - Fprintf(SFDATA, "/*sfdata.c*/\n"); - Fprintf(SFPROTO,"#endif /* SFPROTO_H */\n"); - (void) fclose(SFDATA); - (void) fclose(SFPROTO); -} - -#if 0 -static char * -dtmacro(str,n) -const char *str; -int n; /* 1 = supress appending |SF_PTRMASK */ -{ - static char buf[128], buf2[128]; - char *nam, *c; - int ispointer = 0; - - if (!str) - return (char *)0; - (void)strncpy(buf, str, 127); - - c = buf; - while (*c) - c++; /* eos */ - - c--; - if (*c == '*') { - ispointer = 1; - *c = '\0'; - c--; - } - while(isspace(*c)) { - c--; - } - *(c+1) = '\0'; - c = buf; - - if (strncmpi(c, "Bitfield", 8) == 0) { - *(c+8) = '\0'; - } else if (strcmpi(c, "genericptr_t") == 0) { - ispointer = 1; - } else if (strncmpi(c, "const ", 6) == 0) { - c = buf + 6; - } else if ((strncmpi(c, "struct ", 7) == 0) || - (strncmpi(c, "struct\t", 7) == 0)) { - c = buf + 7; - } else if (strncmpi(c, "union ", 6) == 0) { - c = buf + 6; - } - - /* end of substruct within struct definition */ - if (strcmp(buf,"}") == 0 && strlen(ssdef) > 0) { - strcpy(buf,ssdef); - c = buf; - } - - for (nam = c; *c; c++) { - if (*c >= 'a' && *c <= 'z') - *c -= (char)('a' - 'A'); - else if (*c < 'A' || *c > 'Z') - *c = '_'; - } - (void)sprintf(buf2, "SF_%s%s", nam, - (ispointer && (n == 0)) ? " | SF_PTRMASK" : ""); - return buf2; -} -#endif - -static char * -dtfn(str,n, isptr) -const char *str; -int n; /* 1 = supress appending |SF_PTRMASK */ -boolean *isptr; -{ - static char buf[128], buf2[128]; - const char *nam; - char *c; - int ispointer = 0; - - if (!str) - return (char *)0; - (void)strncpy(buf, str, 127); - - c = buf; - while (*c) c++; /* eos */ - - c--; - if (*c == '*') { - ispointer = 1; - *c = '\0'; - c--; - } - while(isspace(*c)) { - c--; - } - *(c+1) = '\0'; - c = buf; - - if (strncmpi(c, "Bitfield", 8) == 0) { - *(c+8) = '\0'; - } else if (strcmpi(c, "genericptr_t") == 0) { - ispointer = 1; - } else if (strncmpi(c, "const ", 6) == 0) { - c = buf + 6; - } else if ((strncmpi(c, "struct ", 7) == 0) || - (strncmpi(c, "struct\t", 7) == 0)) { - c = buf + 7; - } else if (strncmpi(c, "union ", 6) == 0) { - c = buf + 6; - } - - /* end of substruct within struct definition */ - if (strcmp(buf,"}") == 0 && strlen(ssdef) > 0) { - strcpy(buf,ssdef); - c = buf; - } - - for (nam = (const char *) c; *c; c++) { - if (*c >= 'A' && *c <= 'Z') - *c = tolower(*c); - else if (*c == ' ') - *c = '_'; - } - /* some fix-ups */ - if (!strcmp(nam, "genericptr_t")) - nam = "genericptr"; - else if (!strcmp(nam, "unsigned_int")) - nam = "uint"; - else if (!strcmp(nam, "unsigned_long")) - nam = "ulong"; - else if (!strcmp(nam, "unsigned_char")) - nam = "uchar"; - else if (!strcmp(nam, "unsigned_short")) - nam = "ushort"; - - if (ispointer && isptr && n == 0) - *isptr = TRUE; - (void)sprintf(buf2, "%s%s", nam, ""); - return buf2; -} - -static char * -fieldfix(f,ss) -char *f, *ss; -{ - char *c /*, *dest = fieldfixbuf */; - - if (strcmp(f,"}") == 0 && strlen(ss) > 0 && strlen(ss) < BUFSZ - 1) { - /* (void)sprintf(fieldfixbuf,"struct %s", ss); */ - strcpy(fieldfixbuf,ss); - } else { - if (strlen(f) < BUFSZ - 1) strcpy(fieldfixbuf,f); - } - - /* converting any tabs to space */ - for (c = fieldfixbuf; *c; c++) - if (*c == TAB) *c = SPACE; - - return fieldfixbuf; -} - -static char * -bfsize(str) -const char *str; -{ - static char buf[128]; - const char *c1; - char *c2, *subst; - - if (!str) - return (char *)0; - - /* kludge */ - subst = strstr(str, ",$/"); - if (subst != 0) { - subst++; - *subst++ = ' '; - *subst++ = '1'; - } - - c2 = buf; - c1 = str; - while (*c1) { - if (*c1 == ',') - break; - c1++; - } - - if (*c1 == ',') { - c1++; - while (*c1 && *c1 != ')') { - *c2++ = *c1++; - } - *c2 = '\0'; - } else { - return (char *)0; - } - return buf; -} - -/* Read one line from input, up to and including the next newline - * character. Returns a pointer to the heap-allocated string, or a - * null pointer if no characters were read. - */ -static char * -fgetline(fd) -FILE *fd; -{ - static const int inc = 256; - int len = inc; - char *c = malloc(len), *ret; - - for (;;) { - ret = fgets(c + len - inc, inc, fd); - if (!ret) { - free(c); - c = NULL; - break; - } else if (index(c, '\n')) { - /* normal case: we have a full line */ - break; - } - len += inc; - c = realloc(c, len); - } - return c; -} - -/*readtags2.c*/ - - diff --git a/win/Qt/.gitattributes b/win/Qt/.gitattributes index 7b924974c..ef4b40804 100644 --- a/win/Qt/.gitattributes +++ b/win/Qt/.gitattributes @@ -1,4 +1 @@ -Install.Qt NHSUBST -qpe-nethack.control NH_header=no -knethack.lnk NH_header=no -* NH_filestag=(file%s_for_the_Qt_3_widget_library_-_X11,_Windows,_Mac_OS_X,_or_Qtopia) +* NH_filestag=(file%s_for_the_Qt_4_or_5_widget_library_-_X11,_Windows,_Mac_OS_X) diff --git a/win/Qt4/.gitignore b/win/Qt/.gitignore similarity index 100% rename from win/Qt4/.gitignore rename to win/Qt/.gitignore diff --git a/win/Qt4/qt4bind.cpp b/win/Qt/qt_bind.cpp similarity index 88% rename from win/Qt4/qt4bind.cpp rename to win/Qt/qt_bind.cpp index b0f2e6b65..842daf9d9 100644 --- a/win/Qt4/qt4bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4bind.cpp -- bindings between the Qt 4 interface and the main code +// qt_bind.cpp -- bindings between the Qt 4 interface and the main code extern "C" { #include "hack.h" @@ -25,23 +25,23 @@ extern "C" { #else #include #endif -#include "qt4bind.h" -#include "qt4click.h" +#include "qt_bind.h" +#include "qt_click.h" #ifdef TIMED_DELAY -#include "qt4delay.h" +#include "qt_delay.h" #endif -#include "qt4xcmd.h" -#include "qt4key.h" -#include "qt4map.h" -#include "qt4menu.h" -#include "qt4msg.h" -#include "qt4plsel.h" -#include "qt4svsel.h" -#include "qt4set.h" -#include "qt4stat.h" -#include "qt4streq.h" -#include "qt4yndlg.h" -#include "qt4str.h" +#include "qt_xcmd.h" +#include "qt_key.h" +#include "qt_map.h" +#include "qt_menu.h" +#include "qt_msg.h" +#include "qt_plsel.h" +#include "qt_svsel.h" +#include "qt_set.h" +#include "qt_stat.h" +#include "qt_streq.h" +#include "qt_yndlg.h" +#include "qt_str.h" extern "C" { #include "dlb.h" @@ -51,7 +51,7 @@ extern "C" { extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // XXX Should be from Options // @@ -721,7 +721,7 @@ boolean NetHackQtBind::msgs_initd = false; static void Qt_positionbar(char *) {} -} // namespace nethack_qt4 +} // namespace nethack_qt_ struct window_procs Qt_procs = { "Qt", @@ -731,48 +731,48 @@ struct window_procs Qt_procs = { | WC_PLAYER_SELECTION | WC_SPLASH_SCREEN, 0L, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ - nethack_qt4::NetHackQtBind::qt_init_nhwindows, - nethack_qt4::NetHackQtBind::qt_player_selection, - nethack_qt4::NetHackQtBind::qt_askname, - nethack_qt4::NetHackQtBind::qt_get_nh_event, - nethack_qt4::NetHackQtBind::qt_exit_nhwindows, - nethack_qt4::NetHackQtBind::qt_suspend_nhwindows, - nethack_qt4::NetHackQtBind::qt_resume_nhwindows, - nethack_qt4::NetHackQtBind::qt_create_nhwindow, - nethack_qt4::NetHackQtBind::qt_clear_nhwindow, - nethack_qt4::NetHackQtBind::qt_display_nhwindow, - nethack_qt4::NetHackQtBind::qt_destroy_nhwindow, - nethack_qt4::NetHackQtBind::qt_curs, - nethack_qt4::NetHackQtBind::qt_putstr, + nethack_qt_::NetHackQtBind::qt_init_nhwindows, + nethack_qt_::NetHackQtBind::qt_player_selection, + nethack_qt_::NetHackQtBind::qt_askname, + nethack_qt_::NetHackQtBind::qt_get_nh_event, + nethack_qt_::NetHackQtBind::qt_exit_nhwindows, + nethack_qt_::NetHackQtBind::qt_suspend_nhwindows, + nethack_qt_::NetHackQtBind::qt_resume_nhwindows, + nethack_qt_::NetHackQtBind::qt_create_nhwindow, + nethack_qt_::NetHackQtBind::qt_clear_nhwindow, + nethack_qt_::NetHackQtBind::qt_display_nhwindow, + nethack_qt_::NetHackQtBind::qt_destroy_nhwindow, + nethack_qt_::NetHackQtBind::qt_curs, + nethack_qt_::NetHackQtBind::qt_putstr, genl_putmixed, - nethack_qt4::NetHackQtBind::qt_display_file, - nethack_qt4::NetHackQtBind::qt_start_menu, - nethack_qt4::NetHackQtBind::qt_add_menu, - nethack_qt4::NetHackQtBind::qt_end_menu, - nethack_qt4::NetHackQtBind::qt_select_menu, + nethack_qt_::NetHackQtBind::qt_display_file, + nethack_qt_::NetHackQtBind::qt_start_menu, + nethack_qt_::NetHackQtBind::qt_add_menu, + nethack_qt_::NetHackQtBind::qt_end_menu, + nethack_qt_::NetHackQtBind::qt_select_menu, genl_message_menu, /* no need for X-specific handling */ - nethack_qt4::NetHackQtBind::qt_update_inventory, - nethack_qt4::NetHackQtBind::qt_mark_synch, - nethack_qt4::NetHackQtBind::qt_wait_synch, + nethack_qt_::NetHackQtBind::qt_update_inventory, + nethack_qt_::NetHackQtBind::qt_mark_synch, + nethack_qt_::NetHackQtBind::qt_wait_synch, #ifdef CLIPPING - nethack_qt4::NetHackQtBind::qt_cliparound, + nethack_qt_::NetHackQtBind::qt_cliparound, #endif #ifdef POSITIONBAR - nethack_qt4::Qt_positionbar, + nethack_qt_::Qt_positionbar, #endif - nethack_qt4::NetHackQtBind::qt_print_glyph, + nethack_qt_::NetHackQtBind::qt_print_glyph, //NetHackQtBind::qt_print_glyph_compose, - nethack_qt4::NetHackQtBind::qt_raw_print, - nethack_qt4::NetHackQtBind::qt_raw_print_bold, - nethack_qt4::NetHackQtBind::qt_nhgetch, - nethack_qt4::NetHackQtBind::qt_nh_poskey, - nethack_qt4::NetHackQtBind::qt_nhbell, - nethack_qt4::NetHackQtBind::qt_doprev_message, - nethack_qt4::NetHackQtBind::qt_yn_function, - nethack_qt4::NetHackQtBind::qt_getlin, - nethack_qt4::NetHackQtBind::qt_get_ext_cmd, - nethack_qt4::NetHackQtBind::qt_number_pad, - nethack_qt4::NetHackQtBind::qt_delay_output, + nethack_qt_::NetHackQtBind::qt_raw_print, + nethack_qt_::NetHackQtBind::qt_raw_print_bold, + nethack_qt_::NetHackQtBind::qt_nhgetch, + nethack_qt_::NetHackQtBind::qt_nh_poskey, + nethack_qt_::NetHackQtBind::qt_nhbell, + nethack_qt_::NetHackQtBind::qt_doprev_message, + nethack_qt_::NetHackQtBind::qt_yn_function, + nethack_qt_::NetHackQtBind::qt_getlin, + nethack_qt_::NetHackQtBind::qt_get_ext_cmd, + nethack_qt_::NetHackQtBind::qt_number_pad, + nethack_qt_::NetHackQtBind::qt_delay_output, #ifdef CHANGE_COLOR /* only a Mac option currently */ donull, donull, @@ -780,17 +780,17 @@ struct window_procs Qt_procs = { donull, #endif /* other defs that really should go away (they're tty specific) */ - nethack_qt4::NetHackQtBind::qt_start_screen, - nethack_qt4::NetHackQtBind::qt_end_screen, + nethack_qt_::NetHackQtBind::qt_start_screen, + nethack_qt_::NetHackQtBind::qt_end_screen, #ifdef GRAPHIC_TOMBSTONE - nethack_qt4::NetHackQtBind::qt_outrip, + nethack_qt_::NetHackQtBind::qt_outrip, #else genl_outrip, #endif genl_preference_update, - nethack_qt4::NetHackQtBind::qt_getmsghistory, - nethack_qt4::NetHackQtBind::qt_putmsghistory, + nethack_qt_::NetHackQtBind::qt_getmsghistory, + nethack_qt_::NetHackQtBind::qt_putmsghistory, genl_status_init, genl_status_finish, genl_status_enablefield, #ifdef STATUS_HILITES diff --git a/win/Qt4/qt4bind.h b/win/Qt/qt_bind.h similarity index 95% rename from win/Qt4/qt4bind.h rename to win/Qt/qt_bind.h index 820341cae..04d2a43d7 100644 --- a/win/Qt4/qt4bind.h +++ b/win/Qt/qt_bind.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4bind.h -- bindings between the Qt 4 interface and the main code +// qt_bind.h -- bindings between the Qt 4 interface and the main code #ifndef QT4BIND_H #define QT4BIND_H -#include "qt4main.h" +#include "qt_main.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer; @@ -94,6 +94,6 @@ private: static boolean msgs_initd; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4click.cpp b/win/Qt/qt_click.cpp similarity index 89% rename from win/Qt4/qt4click.cpp rename to win/Qt/qt_click.cpp index 78177a14f..6cee16258 100644 --- a/win/Qt4/qt4click.cpp +++ b/win/Qt/qt_click.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4click.cpp -- a mouse click buffer +// qt_click.cpp -- a mouse click buffer #include "hack.h" #undef Invisible @@ -16,9 +16,9 @@ #undef max #include -#include "qt4click.h" +#include "qt_click.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtClickBuffer::NetHackQtClickBuffer() : in(0), out(0) @@ -45,4 +45,4 @@ void NetHackQtClickBuffer::Get() out=(out+1)%maxclick; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4click.h b/win/Qt/qt_click.h similarity index 85% rename from win/Qt4/qt4click.h rename to win/Qt/qt_click.h index 50fd8b1cc..325f455fd 100644 --- a/win/Qt4/qt4click.h +++ b/win/Qt/qt_click.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4click.h -- a mouse click buffer +// qt_click.h -- a mouse click buffer #ifndef QT4CLICK_H #define QT4CLICK_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer { public: @@ -32,6 +32,6 @@ private: int in,out; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt/qt_clust.cpp b/win/Qt/qt_clust.cpp index c5063a6a3..b21a53a74 100644 --- a/win/Qt/qt_clust.cpp +++ b/win/Qt/qt_clust.cpp @@ -1,10 +1,9 @@ -/* NetHack 3.6 qt_clust.cpp $NHDT-Date: 1524684507 2018/04/25 19:28:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.8 $ */ +/* SCCS Id: @(#)qt_clust.cpp 3.4 1999/11/19 */ /* Copyright (c) Warwick Allison, 1999. */ /* NetHack may be freely redistributed. See license for details. */ #include "qt_clust.h" -static -void include(QRect& r, const QRect& rect) +static void include(QRect& r, const QRect& rect) { if (rect.left() -#include "qt4delay.h" +#include "qt_delay.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // RLC Can we use QTimer::single_shot for this? NetHackQtDelay::NetHackQtDelay(int ms) : @@ -39,4 +39,4 @@ void NetHackQtDelay::timerEvent(QTimerEvent* timer) m_timer = 0; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4delay.h b/win/Qt/qt_delay.h similarity index 82% rename from win/Qt4/qt4delay.h rename to win/Qt/qt_delay.h index 2e0085edf..8c918856f 100644 --- a/win/Qt4/qt4delay.h +++ b/win/Qt/qt_delay.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4delay.h -- implement a delay +// qt_delay.h -- implement a delay #ifndef QT4DELAY_H #define QT4DELAY_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtDelay : QObject { private: @@ -21,6 +21,6 @@ public: virtual void timerEvent(QTimerEvent* timer); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4glyph.cpp b/win/Qt/qt_glyph.cpp similarity index 94% rename from win/Qt4/qt4glyph.cpp rename to win/Qt/qt_glyph.cpp index 942f3a1ab..a3e4f24ef 100644 --- a/win/Qt4/qt4glyph.cpp +++ b/win/Qt/qt_glyph.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4glyph.cpp -- class to manage the glyphs in a tile set +// qt_glyph.cpp -- class to manage the glyphs in a tile set extern "C" { #include "hack.h" @@ -22,13 +22,13 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_str.h" extern short glyph2tile[]; // from tile.c -namespace nethack_qt4 { +namespace nethack_qt_ { static int tilefile_tile_W=16; static int tilefile_tile_H=16; @@ -138,4 +138,4 @@ void NetHackQtGlyphs::setSize(int w, int h) (was1 ? pm2 : pm1) = pm; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4glyph.h b/win/Qt/qt_glyph.h similarity index 85% rename from win/Qt4/qt4glyph.h rename to win/Qt/qt_glyph.h index 12fd915fd..b85c4f4d3 100644 --- a/win/Qt4/qt4glyph.h +++ b/win/Qt/qt_glyph.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4glyph.h -- class to manage the glyphs in a tile set +// qt_glyph.h -- class to manage the glyphs in a tile set #ifndef QT4GLYPH_H #define QT4GLYPH_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtGlyphs { public: @@ -29,6 +29,6 @@ private: int tiles_per_row; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4icon.cpp b/win/Qt/qt_icon.cpp similarity index 97% rename from win/Qt4/qt4icon.cpp rename to win/Qt/qt_icon.cpp index 0876cb59d..160fc7e10 100644 --- a/win/Qt4/qt4icon.cpp +++ b/win/Qt/qt_icon.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4icon.cpp -- a labelled icon +// qt_icon.cpp -- a labelled icon #include "hack.h" #undef Invisible @@ -19,9 +19,9 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4icon.h" +#include "qt_icon.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : QWidget(parent), @@ -200,4 +200,4 @@ void NetHackQtLabelledIcon::setAlignments() if (icon) icon->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4icon.h b/win/Qt/qt_icon.h similarity index 93% rename from win/Qt4/qt4icon.h rename to win/Qt/qt_icon.h index bdaf8183c..f1974ba44 100644 --- a/win/Qt4/qt4icon.h +++ b/win/Qt/qt_icon.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4icon.cpp -- a labelled icon +// qt_icon.cpp -- a labelled icon #ifndef QT4ICON_H #define QT4ICON_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtLabelledIcon : public QWidget { public: @@ -48,6 +48,6 @@ private: QLabel* icon; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4inv.cpp b/win/Qt/qt_inv.cpp similarity index 93% rename from win/Qt4/qt4inv.cpp rename to win/Qt/qt_inv.cpp index 6d1a201b4..be31d536e 100644 --- a/win/Qt4/qt4inv.cpp +++ b/win/Qt/qt_inv.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4inv.cpp -- inventory usage window +// qt_inv.cpp -- inventory usage window // This is at the top center of the main window extern "C" { @@ -22,11 +22,11 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4inv.h" -#include "qt4glyph.h" -#include "qt4set.h" +#include "qt_inv.h" +#include "qt_glyph.h" +#include "qt_set.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : QWidget(parent) @@ -96,4 +96,4 @@ QSize NetHackQtInvUsageWindow::sizeHint(void) const } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4inv.h b/win/Qt/qt_inv.h similarity index 85% rename from win/Qt4/qt4inv.h rename to win/Qt/qt_inv.h index 51cdd4d0b..4c74b8a6a 100644 --- a/win/Qt4/qt4inv.h +++ b/win/Qt/qt_inv.h @@ -2,13 +2,13 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4inv.h -- inventory usage window +// qt_inv.h -- inventory usage window // This is at the top center of the main window #ifndef QT4INV_H #define QT4INV_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtInvUsageWindow : public QWidget { public: @@ -20,6 +20,6 @@ private: void drawWorn(QPainter& painter, obj*, int x, int y, bool canbe=true); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4kde0.h b/win/Qt/qt_kde0.h similarity index 91% rename from win/Qt4/qt4kde0.h rename to win/Qt/qt_kde0.h index 27a678c01..8ac1f9595 100644 --- a/win/Qt4/qt4kde0.h +++ b/win/Qt/qt_kde0.h @@ -4,7 +4,7 @@ #ifndef QT_DUMMYKDE #define QT_DUMMYKDE -namespace nethack_qt4 { +namespace nethack_qt_ { class KTopLevelWidget : public QMainWindow { Q_OBJECT diff --git a/win/Qt4/qt4key.cpp b/win/Qt/qt_key.cpp similarity index 93% rename from win/Qt4/qt4key.cpp rename to win/Qt/qt_key.cpp index ff16616fe..2a43f7c85 100644 --- a/win/Qt4/qt4key.cpp +++ b/win/Qt/qt_key.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4key.cpp -- a key buffer +// qt_key.cpp -- a key buffer #include "hack.h" #undef Invisible @@ -16,9 +16,9 @@ #undef max #include -#include "qt4key.h" +#include "qt_key.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtKeyBuffer::NetHackQtKeyBuffer() : in(0), out(0) @@ -88,4 +88,4 @@ Qt::KeyboardModifiers NetHackQtKeyBuffer::TopState() const return state[out]; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4key.h b/win/Qt/qt_key.h similarity index 89% rename from win/Qt4/qt4key.h rename to win/Qt/qt_key.h index 0333269cd..c2ef3a89b 100644 --- a/win/Qt4/qt4key.h +++ b/win/Qt/qt_key.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4key.h -- a key buffer +// qt_key.h -- a key buffer #ifndef QT4KEY_H #define QT4KEY_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtKeyBuffer { public: @@ -35,6 +35,6 @@ private: int in,out; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4line.cpp b/win/Qt/qt_line.cpp similarity index 86% rename from win/Qt4/qt4line.cpp rename to win/Qt/qt_line.cpp index dd9b18c5f..6374bea3f 100644 --- a/win/Qt4/qt4line.cpp +++ b/win/Qt/qt_line.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4line.cpp -- a one line input window +// qt_line.cpp -- a one line input window #include "hack.h" #undef Invisible @@ -19,9 +19,9 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4line.h" +#include "qt_line.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtLineEdit::NetHackQtLineEdit() : QLineEdit(0) @@ -39,4 +39,4 @@ void NetHackQtLineEdit::fakeEvent(int key, int ascii, Qt::KeyboardModifiers stat keyPressEvent(&fake); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4line.h b/win/Qt/qt_line.h similarity index 81% rename from win/Qt4/qt4line.h rename to win/Qt/qt_line.h index bb5067f79..4b3c10cef 100644 --- a/win/Qt4/qt4line.h +++ b/win/Qt/qt_line.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4line.h -- a one line input window +// qt_line.h -- a one line input window #ifndef QT4LINE_H #define QT4LINE_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtLineEdit : public QLineEdit { public: @@ -17,6 +17,6 @@ public: void fakeEvent(int key, int ascii, Qt::KeyboardModifiers state); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4main.cpp b/win/Qt/qt_main.cpp similarity index 98% rename from win/Qt4/qt4main.cpp rename to win/Qt/qt_main.cpp index 694415b24..06e47c3c5 100644 --- a/win/Qt4/qt4main.cpp +++ b/win/Qt/qt_main.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4main.cpp -- the main window +// qt_main.cpp -- the main window extern "C" { #include "hack.h" @@ -22,20 +22,20 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4main.h" -#include "qt4main.moc" -#include "qt4bind.h" -#include "qt4glyph.h" -#include "qt4inv.h" -#include "qt4key.h" -#include "qt4map.h" -#include "qt4msg.h" -#include "qt4set.h" -#include "qt4stat.h" -#include "qt4str.h" +#include "qt_main.h" +#include "qt_main.moc" +#include "qt_bind.h" +#include "qt_glyph.h" +#include "qt_inv.h" +#include "qt_key.h" +#include "qt_map.h" +#include "qt_msg.h" +#include "qt_set.h" +#include "qt_stat.h" +#include "qt_str.h" #ifndef KDE -#include "qt4kde0.moc" +#include "qt_kde0.moc" #endif // temporary @@ -44,7 +44,7 @@ extern char *qt_tileheight; extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -1073,4 +1073,4 @@ void NetHackQtMainWindow::ShowIfReady() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4main.h b/win/Qt/qt_main.h similarity index 95% rename from win/Qt4/qt4main.h rename to win/Qt/qt_main.h index a3ec15ac2..2e4a2a5d0 100644 --- a/win/Qt4/qt4main.h +++ b/win/Qt/qt_main.h @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4main.h -- the main window +// qt_main.h -- the main window #ifndef QT4MAIN_H #define QT4MAIN_H @@ -11,10 +11,10 @@ #include #include #else -#include "qt4kde0.h" +#include "qt_kde0.h" #endif -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtInvUsageWindow; class NetHackQtKeyBuffer; @@ -90,6 +90,6 @@ private: int dirkey; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4map.cpp b/win/Qt/qt_map.cpp similarity index 99% rename from win/Qt4/qt4map.cpp rename to win/Qt/qt_map.cpp index 00598e79b..74d30b3c8 100644 --- a/win/Qt4/qt4map.cpp +++ b/win/Qt/qt_map.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4map.cpp -- the map window +// qt_map.cpp -- the map window extern "C" { #include "hack.h" @@ -21,19 +21,19 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4map.h" -#include "qt4map.moc" -#include "qt4click.h" -#include "qt4glyph.h" +#include "qt_map.h" +#include "qt_map.moc" +#include "qt_click.h" +#include "qt_glyph.h" #include "qt_xpms.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_set.h" +#include "qt_str.h" // temporary extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { #ifdef TEXTCOLOR static const QPen& nhcolor_to_pen(int c) @@ -971,4 +971,4 @@ void NetHackQtMapWindow::Changed(int x, int y) } #endif -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4map.h b/win/Qt/qt_map.h similarity index 93% rename from win/Qt4/qt4map.h rename to win/Qt/qt_map.h index 337a726aa..8849a18da 100644 --- a/win/Qt4/qt4map.h +++ b/win/Qt/qt_map.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4map.h -- the map window +// qt_map.h -- the map window #ifndef QT4MAP_H #define QT4MAP_H -#include "qt4win.h" -#include "qt4clust.h" +#include "qt_win.h" +#include "qt_clust.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer; @@ -77,6 +77,6 @@ private: QString messages; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4menu.cpp b/win/Qt/qt_menu.cpp similarity index 98% rename from win/Qt4/qt4menu.cpp rename to win/Qt/qt_menu.cpp index 19d073cfe..8a0106b4d 100644 --- a/win/Qt4/qt4menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4menu.cpp -- a menu or text-list widget +// qt_menu.cpp -- a menu or text-list widget extern "C" { #include "hack.h" @@ -21,12 +21,12 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4menu.h" -#include "qt4menu.moc" -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4streq.h" -#include "qt4str.h" +#include "qt_menu.h" +#include "qt_menu.moc" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_streq.h" +#include "qt_str.h" // temporary extern "C" int qt_compact_mode; @@ -34,7 +34,7 @@ extern "C" int qt_compact_mode; extern "C" struct menucoloring *menu_colorings; -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -827,4 +827,4 @@ int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) return actual->SelectMenu(how,menu_list); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4menu.h b/win/Qt/qt_menu.h similarity index 96% rename from win/Qt4/qt4menu.h rename to win/Qt/qt_menu.h index 5bc265920..1b278a89f 100644 --- a/win/Qt4/qt4menu.h +++ b/win/Qt/qt_menu.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4menu.cpp -- a menu or text-list widget +// qt_menu.cpp -- a menu or text-list widget #ifndef QT4MENU_H #define QT4MENU_H -#include "qt4win.h" -#include "qt4rip.h" +#include "qt_win.h" +#include "qt_rip.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtTextListBox : public QListWidget { public: @@ -178,6 +178,6 @@ public: }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4msg.cpp b/win/Qt/qt_msg.cpp similarity index 94% rename from win/Qt4/qt4msg.cpp rename to win/Qt/qt_msg.cpp index d82e102fe..6236f9817 100644 --- a/win/Qt4/qt4msg.cpp +++ b/win/Qt/qt_msg.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4msg.cpp -- a message window +// qt_msg.cpp -- a message window extern "C" { #include "hack.h" @@ -21,13 +21,13 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4msg.h" -#include "qt4msg.moc" -#include "qt4map.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_msg.h" +#include "qt_msg.moc" +#include "qt_map.h" +#include "qt_set.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtMessageWindow::NetHackQtMessageWindow() : list(new QListWidget()) @@ -152,4 +152,4 @@ void NetHackQtMessageWindow::PutStr(int attr, const QString& text) map->putMessage(attr, text2); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4msg.h b/win/Qt/qt_msg.h similarity index 88% rename from win/Qt4/qt4msg.h rename to win/Qt/qt_msg.h index f4091ad18..08c029b9b 100644 --- a/win/Qt4/qt4msg.h +++ b/win/Qt/qt_msg.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4msg.h -- a message window +// qt_msg.h -- a message window #ifndef QT4MSG_H #define QT4MSG_H -#include "qt4win.h" +#include "qt_win.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtMapWindow2; @@ -40,6 +40,6 @@ private slots: void updateFont(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4plsel.cpp b/win/Qt/qt_plsel.cpp similarity index 98% rename from win/Qt4/qt4plsel.cpp rename to win/Qt/qt_plsel.cpp index fc1e105b3..c77203bec 100644 --- a/win/Qt4/qt4plsel.cpp +++ b/win/Qt/qt_plsel.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4plsel.cpp -- player selector dialog +// qt_plsel.cpp -- player selector dialog extern "C" { #include "hack.h" @@ -21,17 +21,17 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4plsel.h" -#include "qt4plsel.moc" -#include "qt4bind.h" -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_plsel.h" +#include "qt_plsel.moc" +#include "qt_bind.h" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_str.h" // Warwick prefers it this way... #define QT_CHOOSE_RACE_FIRST -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -533,4 +533,4 @@ bool NetHackQtPlayerSelector::Choose() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4plsel.h b/win/Qt/qt_plsel.h similarity index 90% rename from win/Qt4/qt4plsel.h rename to win/Qt/qt_plsel.h index de070d147..5e2f7923e 100644 --- a/win/Qt4/qt4plsel.h +++ b/win/Qt/qt_plsel.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4plsel.h -- player selector dialog +// qt_plsel.h -- player selector dialog #ifndef QT4PLSEL_H #define QT4PLSEL_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtKeyBuffer; @@ -43,6 +43,6 @@ private: int chosen_align; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4rip.cpp b/win/Qt/qt_rip.cpp similarity index 92% rename from win/Qt4/qt4rip.cpp rename to win/Qt/qt_rip.cpp index d509f8895..cbe795f85 100644 --- a/win/Qt4/qt4rip.cpp +++ b/win/Qt/qt_rip.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4rip.cpp -- tombstone window +// qt_rip.cpp -- tombstone window #include "hack.h" #undef Invisible @@ -19,11 +19,11 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4rip.h" -#include "qt4bind.h" -#include "qt4str.h" +#include "qt_rip.h" +#include "qt_bind.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { QPixmap* NetHackQtRIP::pixmap=0; @@ -91,4 +91,4 @@ void NetHackQtRIP::paintEvent(QPaintEvent* event) } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4rip.h b/win/Qt/qt_rip.h similarity index 84% rename from win/Qt4/qt4rip.h rename to win/Qt/qt_rip.h index 792a4e32f..97670f0d0 100644 --- a/win/Qt4/qt4rip.h +++ b/win/Qt/qt_rip.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4rip.h -- tombstone window +// qt_rip.h -- tombstone window #ifndef QT4RIP_H #define QT4RIP_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtRIP : public QWidget { private: @@ -25,6 +25,6 @@ protected: QSize sizeHint() const; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4set.cpp b/win/Qt/qt_set.cpp similarity index 96% rename from win/Qt4/qt4set.cpp rename to win/Qt/qt_set.cpp index f9bfa246e..2ac70fd9d 100644 --- a/win/Qt4/qt4set.cpp +++ b/win/Qt/qt_set.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4set.cpp -- the Qt settings +// qt_set.cpp -- the Qt settings #include "hack.h" #undef Invisible @@ -19,10 +19,10 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4set.h" -#include "qt4set.moc" -#include "qt4glyph.h" -#include "qt4str.h" +#include "qt_set.h" +#include "qt_set.moc" +#include "qt_glyph.h" +#include "qt_str.h" /* Used by tile/font-size patch below and in ../../src/files.c */ char *qt_tilewidth=NULL; @@ -34,7 +34,7 @@ int qt_compact_mode = 1; int qt_compact_mode = 0; #endif -namespace nethack_qt4 { +namespace nethack_qt_ { #define TILEWMIN 6 #define TILEHMIN 6 @@ -192,4 +192,4 @@ bool NetHackQtSettings::ynInMessages() NetHackQtSettings* qt_settings; -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4set.h b/win/Qt/qt_set.h similarity index 92% rename from win/Qt4/qt4set.h rename to win/Qt/qt_set.h index 48b90f306..6b2aa6a4a 100644 --- a/win/Qt4/qt4set.h +++ b/win/Qt/qt_set.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4set.h -- the Qt settings +// qt_set.h -- the Qt settings #ifndef QT4SET_H #define QT4SET_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtGlyphs; @@ -54,6 +54,6 @@ private slots: extern NetHackQtSettings* qt_settings; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4stat.cpp b/win/Qt/qt_stat.cpp similarity index 98% rename from win/Qt4/qt4stat.cpp rename to win/Qt/qt_stat.cpp index c8d250718..5e6918f00 100644 --- a/win/Qt4/qt4stat.cpp +++ b/win/Qt/qt_stat.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4stat.cpp -- bindings between the Qt 4 interface and the main code +// qt_stat.cpp -- bindings between the Qt 4 interface and the main code extern "C" { #include "hack.h" @@ -21,16 +21,16 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4stat.h" -#include "qt4stat.moc" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_stat.h" +#include "qt_stat.moc" +#include "qt_set.h" +#include "qt_str.h" #include "qt_xpms.h" extern const char *enc_stat[]; /* from botl.c */ extern const char *hu_stat[]; /* from eat.c */ -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtStatusWindow::NetHackQtStatusWindow() : // Notes: @@ -537,4 +537,4 @@ void NetHackQtStatusWindow::checkTurnEvents() { } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4stat.h b/win/Qt/qt_stat.h similarity index 92% rename from win/Qt4/qt4stat.h rename to win/Qt/qt_stat.h index a0a00a46f..73d7d8eca 100644 --- a/win/Qt4/qt4stat.h +++ b/win/Qt/qt_stat.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4stat.h -- bindings between the Qt 4 interface and the main code +// qt_stat.h -- bindings between the Qt 4 interface and the main code #ifndef QT4STAT_H #define QT4STAT_H -#include "qt4win.h" -#include "qt4icon.h" +#include "qt_win.h" +#include "qt_icon.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtStatusWindow : QWidget, public NetHackQtWindow { Q_OBJECT @@ -101,6 +101,6 @@ private: void checkTurnEvents(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4str.cpp b/win/Qt/qt_str.cpp similarity index 96% rename from win/Qt4/qt4str.cpp rename to win/Qt/qt_str.cpp index b6b4440eb..fc9cd26d7 100644 --- a/win/Qt4/qt4str.cpp +++ b/win/Qt/qt_str.cpp @@ -2,13 +2,13 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4str.cpp -- some string functions +// qt_str.cpp -- some string functions #include #include -#include "qt4str.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // Bounded string copy size_t str_copy(char *dest, const char *src, size_t max) @@ -80,4 +80,4 @@ int cp437(int ch) return cp437table[(unsigned char)ch]; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4str.h b/win/Qt/qt_str.h similarity index 83% rename from win/Qt4/qt4str.h rename to win/Qt/qt_str.h index 05f25f4c4..2d5449363 100644 --- a/win/Qt4/qt4str.h +++ b/win/Qt/qt_str.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4str.h -- various string functions +// qt_str.h -- various string functions #ifndef QT4STR_H #define QT4STR_H -namespace nethack_qt4 { +namespace nethack_qt_ { // Bounded string copy extern size_t str_copy(char *dest, const char *src, size_t max); @@ -19,6 +19,6 @@ extern QString nh_capitalize_words(const QString& str); // Map symbol conversion extern int cp437(int ch); -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4streq.cpp b/win/Qt/qt_streq.cpp similarity index 94% rename from win/Qt4/qt4streq.cpp rename to win/Qt/qt_streq.cpp index abe910ff7..c489e5800 100644 --- a/win/Qt4/qt4streq.cpp +++ b/win/Qt/qt_streq.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4streq.cpp -- string requestor +// qt_streq.cpp -- string requestor #include "hack.h" #undef Invisible @@ -19,10 +19,10 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4streq.h" -#include "qt4str.h" +#include "qt_streq.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -99,4 +99,4 @@ bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4streq.h b/win/Qt/qt_streq.h similarity index 84% rename from win/Qt4/qt4streq.h rename to win/Qt/qt_streq.h index a5f05d769..12fd0a776 100644 --- a/win/Qt4/qt4streq.h +++ b/win/Qt/qt_streq.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4streq.h -- string requestor +// qt_streq.h -- string requestor #ifndef QT4STREQ_H #define QT4STREQ_H -#include "qt4line.h" +#include "qt_line.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtStringRequestor : QDialog { private: @@ -25,6 +25,6 @@ public: virtual void resizeEvent(QResizeEvent*); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4svsel.cpp b/win/Qt/qt_svsel.cpp similarity index 93% rename from win/Qt4/qt4svsel.cpp rename to win/Qt/qt_svsel.cpp index 0b5271588..6950afd79 100644 --- a/win/Qt4/qt4svsel.cpp +++ b/win/Qt/qt_svsel.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4svsel.cpp -- saved game selector +// qt_svsel.cpp -- saved game selector #include "hack.h" #undef Invisible @@ -19,11 +19,11 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4svsel.h" -#include "qt4bind.h" -#include "qt4str.h" +#include "qt_svsel.h" +#include "qt_bind.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : QDialog(NetHackQtBind::mainWidget()) @@ -77,4 +77,4 @@ int NetHackQtSavedGameSelector::choose() return exec()-2; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4svsel.h b/win/Qt/qt_svsel.h similarity index 79% rename from win/Qt4/qt4svsel.h rename to win/Qt/qt_svsel.h index 918e6f7e3..3a5498758 100644 --- a/win/Qt4/qt4svsel.h +++ b/win/Qt/qt_svsel.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4svsel.h -- saved game selector +// qt_svsel.h -- saved game selector #ifndef QT4SVSEL_H #define QT4SVSEL_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtSavedGameSelector : public QDialog { public: @@ -16,6 +16,6 @@ public: int choose(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 919018c41..664591834 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -1,5 +1,5 @@ -// NetHack 3.6 qt_win.cpp $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ // Copyright (c) Warwick Allison, 1999. +// Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. // Qt Binding for NetHack 3.4 @@ -25,8 +25,8 @@ // key events by overiding QApplicion::notify(...), and putting them in // a buffer. Mouse clicks on the map window are treated with a similar // buffer. When the NetHack engine calls for a key, one is taken from -// the buffer, or if that is empty, QApplication::enter_loop() is called. -// Whenever keys or clicks go into the buffer, QApplication::exit_loop() +// the buffer, or if that is empty, QApplication::exec() is called. +// Whenever keys or clicks go into the buffer, QApplication::exit() // is called. // // Another problem is that some NetHack players are decade-long players who @@ -40,1400 +40,78 @@ // by the key event buffer. // -extern "C" { - // This includes all the definitions we need from the NetHack main // engine. We pretend MSC is a STDC compiler, because C++ is close // enough, and we undefine NetHack macros which conflict with Qt // identifiers. -#define alloc hide_alloc // avoid treading on STL symbol -#define lock hide_lock // avoid treading on STL symbol -#ifdef _MSC_VER -#define NHSTDC -#endif +#define QT_DEPRECATED_WARNINGS #include "hack.h" -#include "func_tab.h" -#include "dlb.h" -#include "patchlevel.h" -#include "tile2x11.h" #undef Invisible #undef Warning -#undef red -#undef green -#undef blue -#undef Black -#undef curs -#undef TRUE -#undef FALSE +#undef index +#undef msleep +#undef rindex +#undef wizard +#undef yn #undef min #undef max -#undef alloc -#undef lock -#undef yn - -} +#include +#if QT_VERSION >= 0x050000 +#include +#endif #include "qt_win.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include +#include "qt_bind.h" +#include "qt_click.h" +#include "qt_glyph.h" +#include "qt_inv.h" +#include "qt_key.h" +#include "qt_icon.h" +#include "qt_map.h" +#include "qt_menu.h" +#include "qt_msg.h" +#include "qt_set.h" #include #include "qt_clust.h" -#include "qt_xpms.h" #include -#ifdef Q_WS_MACX -# include -#else -# include -#endif #ifdef _WS_X11_ // For userid control #include #endif -// Some distributors released Qt 2.1.0beta4 -#if QT_VERSION < 220 -# define nh_WX11BypassWM 0x01000000 -#else -# define nh_WX11BypassWM WX11BypassWM -#endif - #ifdef USER_SOUNDS -# if QT_VERSION < 220 -# undef USER_SOUNDS +#if QT_VERSION >= 0x050000 +# include # else -# include +# include # endif #endif #ifdef USER_SOUNDS -extern "C" void play_sound_for_message(const char* str); +extern void play_sound_for_message(const std::string& str); #endif -#ifdef SAFERHANGUP -#include -#endif +namespace nethack_qt_ { -// Warwick prefers it this way... -#define QT_CHOOSE_RACE_FIRST - -static const char nh_attribution[] = "
NetHack" - "
by the NetHack DevTeam
"; - -static QString -aboutMsg() -{ - QString msg; - msg.sprintf( - "Qt NetHack is a version of NetHack built\n" -#ifdef KDE - "using KDE and the Qt GUI toolkit.\n" -#else - "using the Qt GUI toolkit.\n" -#endif - "This is version %d.%d.%d\n\n" - "Homepage:\n http://trolls.troll.no/warwick/nethack/\n\n" -#ifdef KDE - "KDE:\n http://www.kde.org\n" -#endif - "Qt:\n http://www.troll.no", - VERSION_MAJOR, - VERSION_MINOR, - PATCHLEVEL); - return msg; -} - -static void +void centerOnMain( QWidget* w ) { - QWidget* m = qApp->mainWidget(); + QWidget* m = NetHackQtBind::mainWidget(); if (!m) m = qApp->desktop(); QPoint p = m->mapToGlobal(QPoint(0,0)); w->move( p.x() + m->width()/2 - w->width()/2, p.y() + m->height()/2 - w->height()/2 ); } -NetHackQtLineEdit::NetHackQtLineEdit() : - QLineEdit(0) -{ -} - -NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) : - QLineEdit(parent,name) -{ -} - -void NetHackQtLineEdit::fakeEvent(int key, int ascii, int state) -{ - QKeyEvent fake(QEvent::KeyPress,key,ascii,state); - keyPressEvent(&fake); -} - -extern "C" { -/* Used by tile/font-size patch below and in ../../src/files.c */ -char *qt_tilewidth=NULL; -char *qt_tileheight=NULL; -char *qt_fontsize=NULL; -#if defined(QWS) -int qt_compact_mode = 1; -#else -int qt_compact_mode = 0; -#endif -extern const char *enc_stat[]; /* from botl.c */ -extern const char *hu_stat[]; /* from eat.c */ -extern int total_tiles_used; // from tile.c -extern short glyph2tile[]; // from tile.c -} - -static int tilefile_tile_W=16; -static int tilefile_tile_H=16; - -#define TILEWMIN 1 -#define TILEHMIN 1 - - -/* XPM */ -static const char * nh_icon[] = { -"40 40 6 1", -" s None c none", -". c #ffffff", -"X c #dadab6", -"o c #6c91b6", -"O c #476c6c", -"+ c #000000", -" ", -" ", -" ", -" . .X..XX.XX X ", -" .. .....X.XXXXXX XX ", -" ... ....X..XX.XXXXX XXX ", -" .. ..........X.XXXXXXXXXXX XX ", -" .... ........X..XX.XXXXXXXXX XXXX ", -" .... ..........X.XXXXXXXXXXX XXXX ", -" ooOOO..ooooooOooOOoOOOOOOOXX+++OO++ ", -" ooOOO..ooooooooOoOOOOOOOOOXX+++OO++ ", -" ....O..ooooooOooOOoOOOOOOOXX+XXXX++ ", -" ....O..ooooooooOoOOOOOOOOOXX+XXXX++ ", -" ..OOO..ooooooOooOOoOOOOOOOXX+++XX++ ", -" ++++..ooooooooOoOOOOOOOOOXX+++ +++ ", -" +++..ooooooOooOOoOOOOOOOXX+++ + ", -" ++..ooooooooOoOOOOOOOOOXX+++ ", -" ..ooooooOooOOoOOOOOOOXX+++ ", -" ..ooooooooOoOOOOOOOOOXX+++ ", -" ..ooooooOooOOoOOOOOOOXX+++ ", -" ..ooooooooOoOOOOOOOOOXX+++ ", -" ..oooooOooOOoOOOOOOXX+++ ", -" ..oooooooOoOOOOOOOOXX+++ ", -" ..ooooOooOOoOOOOOXX+++ ", -" ..ooooooOoOOOOOOOXX++++ ", -" ..o..oooOooOOoOOOOXX+XX+++ ", -" ...o..oooooOoOOOOOXX++XXX++ ", -" ....OO..ooOooOOoOOXX+++XXXX++ ", -" ...oo..+..oooOoOOOXX++XXooXXX++ ", -" ...ooo..++..OooOOoXX+++XXooOXXX+ ", -" ..oooOOXX+++....XXXX++++XXOOoOOXX+ ", -" ..oooOOXX+++ ...XXX+++++XXOOooOXX++ ", -" ..oooOXXX+++ ..XX+++ +XXOOooOXX++ ", -" .....XXX++++ XXXXXXX++ ", -" ....XX++++ XXXXXXX+ ", -" ...XX+++ XXXXX++ ", -" ", -" ", -" ", -" "}; -/* XPM */ -static const char * nh_icon_small[] = { -/* width height ncolors chars_per_pixel */ -"16 16 16 1", -/* colors */ -" c #587070", -". c #D1D5C9", -"X c #8B8C84", -"o c #2A2A28", -"O c #9AABA9", -"+ c #6A8FB2", -"@ c #C4CAC4", -"# c #B6BEB6", -"$ c None", -"% c #54564E", -"& c #476C6C", -"* c #ADB2AB", -"= c #ABABA2", -"- c #5E8295", -"; c #8B988F", -": c #E8EAE7", -/* pixels */ -"$$$$$$$$$$$$$$$$", -"$$$.$#::.#==*$$$", -"$.*:::::....#*=$", -"$@#:..@#*==#;XX;", -"$@O:+++- &&; X%X", -"$#%.+++- &&;% oX", -"$$o.++-- &&;%%X$", -"$$$:++-- &&;%%$$", -"$$$.O++- &&=o $$", -"$$$=:++- & XoX$$", -"$$*:@O-- ;%Xo$$", -"$*:O#$+--;oOOX $", -"$:+ =o::=oo=-;%X", -"$::.%o$*;X;##@%$", -"$$@# ;$$$$$=*;X$", -"$$$$$$$$$$$$$$$$" -}; - -/* XPM */ -static const char * map_xpm[] = { -"12 13 4 1", -". c None", -" c #000000000000", -"X c #0000B6DAFFFF", -"o c #69A69248B6DA", -" .", -" XXXXX ooo ", -" XoooX o ", -" XoooX o o ", -" XoooX ooo ", -" XXoXX o ", -" oooooXXX ", -" oo o oooX ", -" o XooX ", -" oooo XooX ", -" o o XXXX ", -" ", -". "}; -/* XPM */ -static const char * msg_xpm[] = { -"12 13 4 1", -". c None", -" c #FFFFFFFFFFFF", -"X c #69A69248B6DA", -"o c #000000000000", -" .", -" XXX XXX X o", -" o", -" XXXXX XX o", -" o", -" XX XXXXX o", -" o", -" XXXXXX o", -" o", -" XX XXX XX o", -" o", -" o", -".ooooooooooo"}; -/* XPM */ -static const char * stat_xpm[] = { -"12 13 5 1", -" c None", -". c #FFFF00000000", -"X c #000000000000", -"o c #FFFFFFFF0000", -"O c #69A6FFFF0000", -" ", -" ", -"... ", -"...X ", -"...X ... ", -"oooX oooX", -"oooXooo oooX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -" XXXXXXXXXXX"}; -/* XPM */ -static const char * info_xpm[] = { -"12 13 4 1", -" c None", -". c #00000000FFFF", -"X c #FFFFFFFFFFFF", -"o c #000000000000", -" ... ", -" ....... ", -" ...XXX... ", -" .........o ", -"...XXXX.... ", -"....XXX....o", -"....XXX....o", -"....XXX....o", -" ...XXX...oo", -" ..XXXXX..o ", -" .......oo ", -" o...ooo ", -" ooo "}; - - -/* XPM */ -static const char * again_xpm[] = { -"12 13 2 1", -" c None", -". c #000000000000", -" .. ", -" .. ", -" ..... ", -" ....... ", -"... .. .. ", -".. .. .. ", -".. ..", -".. ..", -".. ..", -" .. .. ", -" .......... ", -" ...... ", -" "}; -/* XPM */ -static const char * kick_xpm[] = { -"12 13 3 1", -" c None", -". c #000000000000", -"X c #FFFF6DB60000", -" ", -" ", -" . . . ", -" ... . . ", -" ... . ", -" ... . ", -" ... ", -"XXX ... ", -"XXX. ... ", -"XXX. ... ", -"XXX. .. ", -" ... ", -" "}; -/* XPM */ -static const char * throw_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" ", -" ", -" ", -" ", -".... X ", -"....X X ", -"....X XXXXXX", -"....X X ", -" XXXX X ", -" ", -" ", -" ", -" "}; -/* XPM */ -static const char * fire_xpm[] = { -"12 13 5 1", -" c None", -". c #B6DA45140000", -"X c #FFFFB6DA9658", -"o c #000000000000", -"O c #FFFF6DB60000", -" . ", -" X. ", -" X . ", -" X .o ", -" X . o ", -" X .o o ", -"OOOOOOOOoooo", -" X .o o ", -" X . o o ", -" X .o ", -" X. o ", -" . o ", -" o "}; -/* XPM */ -static const char * get_xpm[] = { -"12 13 3 1", -" c None", -". c #000000000000", -"X c #FFFF6DB60000", -" ", -" . ", -" ... ", -" . . . ", -" . ", -" . ", -" ", -" XXXXX ", -" XXXXX. ", -" XXXXX. ", -" XXXXX. ", -" ..... ", -" "}; -/* XPM */ -static const char * drop_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" ", -" ..... ", -" .....X ", -" .....X ", -" .....X ", -" XXXXX ", -" ", -" X ", -" X ", -" X X X ", -" XXX ", -" X ", -" "}; -/* XPM */ -static const char * eat_xpm[] = { -"12 13 4 1", -" c None", -". c #000000000000", -"X c #FFFFB6DA9658", -"o c #FFFF6DB60000", -" .X. .. ", -" .X. .. ", -" .X. .. ", -" .X. .. ", -" ... .. ", -" .. .. ", -" .. .. ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo "}; -/* XPM */ -static const char * rest_xpm[] = { -"12 13 2 1", -" c None", -". c #000000000000", -" ..... ", -" . ", -" . ", -" . ....", -" ..... . ", -" . ", -" ....", -" ", -" .... ", -" . ", -" . ", -" .... ", -" "}; -/* XPM */ -static const char * cast_a_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XX ", -" .. X X ", -" .. X X ", -" .. XXXX ", -" . X X ", -" . X X "}; -/* XPM */ -static const char * cast_b_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XXX ", -" .. X X ", -" .. XXX ", -" .. X X ", -" . X X ", -" . XXX "}; -/* XPM */ -static const char * cast_c_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XX ", -" .. X X ", -" .. X ", -" .. X ", -" . X X ", -" . XX "}; - -NetHackQtSettings::NetHackQtSettings(int w, int h) : - tilewidth(TILEWMIN,64,1,this), - tileheight(TILEHMIN,64,1,this), - widthlbl(&tilewidth,"&Width:",this), - heightlbl(&tileheight,"&Height:",this), - whichsize("&Zoomed",this), - fontsize(this), - normal("times"), -#ifdef WS_WIN - normalfixed("courier new"), -#else - normalfixed("fixed"), -#endif - large("times"), - theglyphs(0) - -{ - int default_fontsize; - - if (w<=300) { - // ~240x320 - default_fontsize=4; - tilewidth.setValue(8); - tileheight.setValue(12); - } else if (w<=700) { - // ~640x480 - default_fontsize=3; - tilewidth.setValue(8); - tileheight.setValue(14); - } else if (w<=900) { - // ~800x600 - default_fontsize=3; - tilewidth.setValue(10); - tileheight.setValue(17); - } else if (w<=1100) { - // ~1024x768 - default_fontsize=2; - tilewidth.setValue(12); - tileheight.setValue(22); - } else if (w<=1200) { - // ~1152x900 - default_fontsize=1; - tilewidth.setValue(14); - tileheight.setValue(26); - } else { - // ~1280x1024 and larger - default_fontsize=0; - tilewidth.setValue(16); - tileheight.setValue(30); - } - - // Tile/font sizes read from .nethackrc - if (qt_tilewidth != NULL) { - tilewidth.setValue(atoi(qt_tilewidth)); - free(qt_tilewidth); - } - if (qt_tileheight != NULL) { - tileheight.setValue(atoi(qt_tileheight)); - free(qt_tileheight); - } - if (qt_fontsize != NULL) { - switch (tolower(qt_fontsize[0])) { - case 'h': default_fontsize = 0; break; - case 'l': default_fontsize = 1; break; - case 'm': default_fontsize = 2; break; - case 's': default_fontsize = 3; break; - case 't': default_fontsize = 4; break; - } - free(qt_fontsize); - } - - theglyphs=new NetHackQtGlyphs(); - resizeTiles(); - - connect(&tilewidth,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); - connect(&tileheight,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); - connect(&whichsize,SIGNAL(toggled(bool)),this,SLOT(setGlyphSize(bool))); - - fontsize.insertItem("Huge"); - fontsize.insertItem("Large"); - fontsize.insertItem("Medium"); - fontsize.insertItem("Small"); - fontsize.insertItem("Tiny"); - fontsize.setCurrentItem(default_fontsize); - connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged())); - - QGridLayout* grid = new QGridLayout(this, 5, 2, 8); - grid->addMultiCellWidget(&whichsize, 0, 0, 0, 1); - grid->addWidget(&tilewidth, 1, 1); grid->addWidget(&widthlbl, 1, 0); - grid->addWidget(&tileheight, 2, 1); grid->addWidget(&heightlbl, 2, 0); - QLabel* flabel=new QLabel(&fontsize, "&Font:",this); - grid->addWidget(flabel, 3, 0); grid->addWidget(&fontsize, 3, 1); - QPushButton* dismiss=new QPushButton("Dismiss",this); - dismiss->setDefault(TRUE); - grid->addMultiCellWidget(dismiss, 4, 4, 0, 1); - grid->setRowStretch(4,0); - grid->setColStretch(1,1); - grid->setColStretch(2,2); - grid->activate(); - - connect(dismiss,SIGNAL(clicked()),this,SLOT(accept())); - resize(150,140); -} - -NetHackQtGlyphs& NetHackQtSettings::glyphs() -{ - return *theglyphs; -} - -void NetHackQtSettings::resizeTiles() -{ - int w = tilewidth.value(); - int h = tileheight.value(); - - theglyphs->setSize(w,h); - emit tilesChanged(); -} - -void NetHackQtSettings::toggleGlyphSize() -{ - whichsize.toggle(); -} - -void NetHackQtSettings::setGlyphSize(bool which) -{ - QSize n = QSize(tilewidth.value(),tileheight.value()); - if ( othersize.isValid() ) { - tilewidth.blockSignals(TRUE); - tileheight.blockSignals(TRUE); - tilewidth.setValue(othersize.width()); - tileheight.setValue(othersize.height()); - tileheight.blockSignals(FALSE); - tilewidth.blockSignals(FALSE); - resizeTiles(); - } - othersize = n; -} - -const QFont& NetHackQtSettings::normalFont() -{ - static int size[]={ 18, 14, 12, 10, 8 }; - normal.setPointSize(size[fontsize.currentItem()]); - return normal; -} - -const QFont& NetHackQtSettings::normalFixedFont() -{ - static int size[]={ 18, 14, 13, 10, 8 }; - normalfixed.setPointSize(size[fontsize.currentItem()]); - return normalfixed; -} - -const QFont& NetHackQtSettings::largeFont() -{ - static int size[]={ 24, 18, 14, 12, 10 }; - large.setPointSize(size[fontsize.currentItem()]); - return large; -} - -bool NetHackQtSettings::ynInMessages() -{ - return !qt_compact_mode; -} - - -NetHackQtSettings* qt_settings; - - - -NetHackQtKeyBuffer::NetHackQtKeyBuffer() : - in(0), out(0) -{ -} - -bool NetHackQtKeyBuffer::Empty() const { return in==out; } -bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } - -void NetHackQtKeyBuffer::Put(int k, int a, int state) -{ - if ( Full() ) return; // Safety - key[in]=k; - ascii[in]=a; - in=(in+1)%maxkey; -} - -void NetHackQtKeyBuffer::Put(char a) -{ - Put(0,a,0); -} - -void NetHackQtKeyBuffer::Put(const char* str) -{ - while (*str) Put(*str++); -} - -int NetHackQtKeyBuffer::GetKey() -{ - if ( Empty() ) return 0; - int r=TopKey(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::GetAscii() -{ - if ( Empty() ) return 0; // Safety - int r=TopAscii(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::GetState() -{ - if ( Empty() ) return 0; - int r=TopState(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::TopKey() const -{ - if ( Empty() ) return 0; - return key[out]; -} - -int NetHackQtKeyBuffer::TopAscii() const -{ - if ( Empty() ) return 0; - return ascii[out]; -} - -int NetHackQtKeyBuffer::TopState() const -{ - if ( Empty() ) return 0; - return state[out]; -} - - -NetHackQtClickBuffer::NetHackQtClickBuffer() : - in(0), out(0) -{ -} - -bool NetHackQtClickBuffer::Empty() const { return in==out; } -bool NetHackQtClickBuffer::Full() const { return (in+1)%maxclick==out; } - -void NetHackQtClickBuffer::Put(int x, int y, int mod) -{ - click[in].x=x; - click[in].y=y; - click[in].mod=mod; - in=(in+1)%maxclick; -} - -int NetHackQtClickBuffer::NextX() const { return click[out].x; } -int NetHackQtClickBuffer::NextY() const { return click[out].y; } -int NetHackQtClickBuffer::NextMod() const { return click[out].mod; } - -void NetHackQtClickBuffer::Get() -{ - out=(out+1)%maxclick; -} - -class NhPSListViewItem : public QListViewItem { -public: - NhPSListViewItem( QListView* parent, const QString& name ) : - QListViewItem(parent, name) - { - } - - void setGlyph(int g) - { - NetHackQtGlyphs& glyphs = qt_settings->glyphs(); - int gw = glyphs.width(); - int gh = glyphs.height(); - QPixmap pm(gw,gh); - QPainter p(&pm); - glyphs.drawGlyph(p, g, 0, 0); - p.end(); - setPixmap(0,pm); - setHeight(QMAX(pm.height()+1,height())); - } - - void paintCell( QPainter *p, const QColorGroup &cg, - int column, int width, int alignment ) - { - if ( isSelectable() ) { - QListViewItem::paintCell( p, cg, column, width, alignment ); - } else { - QColorGroup disabled( - cg.foreground().light(), - cg.button().light(), - cg.light(), cg.dark(), cg.mid(), - gray, cg.base() ); - QListViewItem::paintCell( p, disabled, column, width, alignment ); - } - } -}; - -class NhPSListViewRole : public NhPSListViewItem { -public: - NhPSListViewRole( QListView* parent, int id ) : - NhPSListViewItem(parent, -#ifdef QT_CHOOSE_RACE_FIRST // Lowerize - looks better - QString(QChar(roles[id].name.m[0])).lower()+QString(roles[id].name.m+1) -#else - roles[id].name.m -#endif - ) - { - setGlyph(monnum_to_glyph(roles[id].malenum)); - } -}; - -class NhPSListViewRace : public NhPSListViewItem { -public: - NhPSListViewRace( QListView* parent, int id ) : - NhPSListViewItem(parent, -#ifdef QT_CHOOSE_RACE_FIRST // Capitalize - looks better - QString(QChar(races[id].noun[0])).upper()+QString(races[id].noun+1) -#else - QString(QChar(races[id].noun[0])+QString(races[id].noun+1)) -#endif - ) - { - setGlyph(monnum_to_glyph(races[id].malenum)); - } -}; - -class NhPSListView : public QListView { -public: - NhPSListView( QWidget* parent ) : - QListView(parent) - { - setSorting(-1); // order is identity - header()->setClickEnabled(FALSE); - } - - QSizePolicy sizePolicy() const - { - return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - } - - QSize minimumSizeHint() const - { - return sizeHint(); - } - - QSize sizeHint() const - { - QListView::sizeHint(); - QSize sz = header()->sizeHint(); - int h=0; - QListViewItem* c=firstChild(); - while (c) h+=c->height(),c = c->nextSibling(); - sz += QSize(frameWidth()*2, h+frameWidth()*2); - return sz; - } - - int selectedItemNumber() const - { - int i=0; - QListViewItem* c = firstChild(); - while (c) { - if (c == selectedItem()) { - return i; - } - i++; - c = c->nextSibling(); - } - return -1; - } - - void setSelectedItemNumber(int i) - { - QListViewItem* c=firstChild(); - while (i--) - c = c->nextSibling(); - c->setSelected(TRUE); - } -}; - -NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) : - QDialog(qApp->mainWidget(),"plsel",TRUE), - keysource(ks), - fully_specified_role(TRUE) -{ - /* - 0 1 2 - + Name ------------------------------------+ - 0 | | - + ---- ------------------------------------+ - + Role ---+ + Race ---+ + Gender ------+ - | | | | | * Male | - 1 | | | | | * Female | - | | | | +--------------+ - | | | | - | | | | + Alignment ---+ - 2 | | | | | * Male | - | | | | | * Female | - | | | | +--------------+ - 3 | | | | ...stretch... - | | | | - 4 | | | | [ Play ] - 5 | | | | [ Quit ] - +---------+ +---------+ - */ - - int marg=4; - QGridLayout *l = new QGridLayout(this,6,3,marg,marg); - - QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this); - QLineEdit* name = new QLineEdit(namebox); - name->setMaxLength(sizeof(g.plname)-1); - if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) ) - name->setText(g.plname); - connect(name, SIGNAL(textChanged(const QString&)), - this, SLOT(selectName(const QString&)) ); - name->setFocus(); - QButtonGroup* genderbox = new QButtonGroup("Sex",this); - QButtonGroup* alignbox = new QButtonGroup("Alignment",this); - QVBoxLayout* vbgb = new QVBoxLayout(genderbox,3,1); - vbgb->setAutoAdd(TRUE); - vbgb->addSpacing(fontMetrics().height()*3/4); - QVBoxLayout* vbab = new QVBoxLayout(alignbox,3,1); - vbab->setAutoAdd(TRUE); - vbab->addSpacing(fontMetrics().height()); - QLabel* logo = new QLabel(nh_attribution, this); - - l->addMultiCellWidget( namebox, 0,0,0,2 ); -#ifdef QT_CHOOSE_RACE_FIRST - race = new NhPSListView(this); - role = new NhPSListView(this); - l->addMultiCellWidget( race, 1,5,0,0 ); - l->addMultiCellWidget( role, 1,5,1,1 ); -#else - role = new NhPSListView(this); - race = new NhPSListView(this); - l->addMultiCellWidget( role, 1,5,0,0 ); - l->addMultiCellWidget( race, 1,5,1,1 ); -#endif - role->addColumn("Role"); - race->addColumn("Race"); - - l->addWidget( genderbox, 1, 2 ); - l->addWidget( alignbox, 2, 2 ); - l->addWidget( logo, 3, 2, AlignCenter ); - l->setRowStretch( 3, 5 ); - - int i; - int nrole; - - for (nrole=0; roles[nrole].name.m; nrole++) - ; - for (i=nrole-1; i>=0; i--) { // XXX QListView unsorted goes in rev. - new NhPSListViewRole( role, i ); - } - connect( role, SIGNAL(selectionChanged()), this, SLOT(selectRole()) ); - - int nrace; - for (nrace=0; races[nrace].noun; nrace++) - ; - for (i=nrace-1; i>=0; i--) { - new NhPSListViewRace( race, i ); - } - connect( race, SIGNAL(selectionChanged()), this, SLOT(selectRace()) ); - - gender = new QRadioButton*[ROLE_GENDERS]; - for (i=0; iaddWidget( ok, 4, 2 ); - ok->setDefault(TRUE); - connect( ok, SIGNAL(clicked()), this, SLOT(accept()) ); - - QPushButton* cancel = new QPushButton("Quit",this); - l->addWidget( cancel, 5, 2 ); - connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); - - // Randomize race and role, unless specified in config - int ro = flags.initrole; - if (ro == ROLE_NONE || ro == ROLE_RANDOM) { - ro = rn2(nrole); - if (flags.initrole != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - int ra = flags.initrace; - if (ra == ROLE_NONE || ra == ROLE_RANDOM) { - ra = rn2(nrace); - if (flags.initrace != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - - // make sure we have a valid combination, honoring - // the users request if possible. - bool choose_race_first; -#ifdef QT_CHOOSE_RACE_FIRST - choose_race_first = TRUE; - if (flags.initrole >= 0 && flags.initrace < 0) { - choose_race_first = FALSE; - } -#else - choose_race_first = FALSE; - if (flags.initrace >= 0 && flags.initrole < 0) { - choose_race_first = TRUE; - } -#endif - while (!validrace(ro,ra)) { - if (choose_race_first) { - ro = rn2(nrole); - if (flags.initrole != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } else { - ra = rn2(nrace); - if (flags.initrace != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - } - - int g = flags.initgend; - if (g == -1) { - g = rn2(ROLE_GENDERS); - fully_specified_role = FALSE; - } - while (!validgend(ro,ra,g)) { - g = rn2(ROLE_GENDERS); - } - gender[g]->setChecked(TRUE); - selectGender(g); - - int a = flags.initalign; - if (a == -1) { - a = rn2(ROLE_ALIGNS); - fully_specified_role = FALSE; - } - while (!validalign(ro,ra,a)) { - a = rn2(ROLE_ALIGNS); - } - alignment[a]->setChecked(TRUE); - selectAlignment(a); - - QListViewItem* li; - - li = role->firstChild(); - while (ro--) li=li->nextSibling(); - role->setSelected(li,TRUE); - - li = race->firstChild(); - while (ra--) li=li->nextSibling(); - race->setSelected(li,TRUE); - - flags.initrace = race->selectedItemNumber(); - flags.initrole = role->selectedItemNumber(); -} - - -void NetHackQtPlayerSelector::selectName(const QString& n) -{ - strncpy(g.plname,n.latin1(),sizeof(g.plname)-1); -} - -void NetHackQtPlayerSelector::selectRole() -{ - int ra = race->selectedItemNumber(); - int ro = role->selectedItemNumber(); - if (ra == -1 || ro == -1) return; - -#ifdef QT_CHOOSE_RACE_FIRST - selectRace(); -#else - QListViewItem* i=role->currentItem(); - QListViewItem* valid=0; - int j; - NhPSListViewItem* item; - item = (NhPSListViewItem*)role->firstChild(); - for (j=0; roles[j].name.m; j++) { - bool v = validrace(j,ra); - item->setSelectable(TRUE); - if ( !valid && v ) valid = item; - item=(NhPSListViewItem*)item->nextSibling(); - } - if ( !validrace(role->selectedItemNumber(),ra) ) - i = valid; - role->setSelected(i,TRUE); - item = (NhPSListViewItem*)role->firstChild(); - for (j=0; roles[j].name.m; j++) { - bool v = validrace(j,ra); - item->setSelectable(v); - item->repaint(); - item=(NhPSListViewItem*)item->nextSibling(); - } -#endif - - flags.initrole = role->selectedItemNumber(); - setupOthers(); -} - -void NetHackQtPlayerSelector::selectRace() -{ - int ra = race->selectedItemNumber(); - int ro = role->selectedItemNumber(); - if (ra == -1 || ro == -1) return; - -#ifndef QT_CHOOSE_RACE_FIRST - selectRole(); -#else - QListViewItem* i=race->currentItem(); - QListViewItem* valid=0; - int j; - NhPSListViewItem* item; - item = (NhPSListViewItem*)race->firstChild(); - for (j=0; races[j].noun; j++) { - bool v = validrace(ro,j); - item->setSelectable(TRUE); - if ( !valid && v ) valid = item; - item=(NhPSListViewItem*)item->nextSibling(); - } - if ( !validrace(ro,race->selectedItemNumber()) ) - i = valid; - race->setSelected(i,TRUE); - item = (NhPSListViewItem*)race->firstChild(); - for (j=0; races[j].noun; j++) { - bool v = validrace(ro,j); - item->setSelectable(v); - item->repaint(); - item=(NhPSListViewItem*)item->nextSibling(); - } -#endif - - flags.initrace = race->selectedItemNumber(); - setupOthers(); -} - -void NetHackQtPlayerSelector::setupOthers() -{ - int ro = role->selectedItemNumber(); - int ra = race->selectedItemNumber(); - int valid=-1; - int c=0; - int j; - for (j=0; jisChecked() ) - c = j; - gender[j]->setEnabled(v); - if ( valid<0 && v ) valid = j; - } - if ( !validgend(ro,ra,c) ) - c = valid; - int k; - for (k=0; ksetChecked(c==k); - } - selectGender(c); - - valid=-1; - for (j=0; jisChecked() ) - c = j; - alignment[j]->setEnabled(v); - if ( valid<0 && v ) valid = j; - } - if ( !validalign(ro,ra,c) ) - c = valid; - for (k=0; ksetChecked(c==k); - } - selectAlignment(c); -} - -void NetHackQtPlayerSelector::selectGender(int i) -{ - flags.initgend = i; -} - -void NetHackQtPlayerSelector::selectAlignment(int i) -{ - flags.initalign = i; -} - - -void NetHackQtPlayerSelector::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -void NetHackQtPlayerSelector::Quit() -{ - done(R_Quit); - qApp->exit_loop(); -} - -void NetHackQtPlayerSelector::Random() -{ - done(R_Rand); - qApp->exit_loop(); -} - -bool NetHackQtPlayerSelector::Choose() -{ - if (fully_specified_role) return TRUE; - -#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). - if ( qt_compact_mode ) { - showMaximized(); - } else -#endif - { - adjustSize(); - centerOnMain(this); - } - - if ( exec() ) { - return TRUE; - } else { - return FALSE; - } -} - - -NetHackQtStringRequestor::NetHackQtStringRequestor(NetHackQtKeyBuffer& ks, const char* p, const char* cancelstr) : - QDialog(qApp->mainWidget(),"string",FALSE), - prompt(p,this,"prompt"), - input(this,"input"), - keysource(ks) -{ - cancel=new QPushButton(cancelstr,this); - connect(cancel,SIGNAL(clicked()),this,SLOT(reject())); - - okay=new QPushButton("Okay",this); - connect(okay,SIGNAL(clicked()),this,SLOT(accept())); - connect(&input,SIGNAL(returnPressed()),this,SLOT(accept())); - okay->setDefault(TRUE); - - setFocusPolicy(StrongFocus); -} - -void NetHackQtStringRequestor::resizeEvent(QResizeEvent*) -{ - const int margin=5; - const int gutter=5; - - int h=(height()-margin*2-gutter); - - if (strlen(prompt.text()) > 16) { - h/=3; - prompt.setGeometry(margin,margin,width()-margin*2,h); - input.setGeometry(width()*1/5,margin+h+gutter, - (width()-margin-2-gutter)*4/5,h); - } else { - h/=2; - prompt.setGeometry(margin,margin,(width()-margin*2-gutter)*2/5,h); - input.setGeometry(prompt.geometry().right()+gutter,margin, - (width()-margin-2-gutter)*3/5,h); - } - - cancel->setGeometry(margin,input.geometry().bottom()+gutter, - (width()-margin*2-gutter)/2,h); - okay->setGeometry(cancel->geometry().right()+gutter,cancel->geometry().y(), - cancel->width(),h); -} - -void NetHackQtStringRequestor::SetDefault(const char* d) -{ - input.setText(d); -} - -bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) -{ - input.setMaxLength(maxchar); - if (strlen(prompt.text()) > 16) { - resize(fontMetrics().width(prompt.text())+50,fontMetrics().height()*6); - } else { - resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4); - } - - centerOnMain(this); - show(); - input.setFocus(); - setResult(-1); - while (result()==-1) { - // Put keys in buffer (eg. from macros, from out-of-focus input) - if (!keysource.Empty()) { - while (!keysource.Empty()) { - int key=keysource.TopKey(); - int ascii=keysource.TopAscii(); - int state=keysource.GetState(); - if (ascii=='\r' || ascii=='\n') { - // CR or LF in buffer causes confirmation - strcpy(buffer,input.text()); - return TRUE; - } else if (ascii=='\033') { - return FALSE; - } else { - input.fakeEvent(key,ascii,state); - } - } - } - qApp->enter_loop(); - } - // XXX Get rid of extra keys, since we couldn't get focus! - while (!keysource.Empty()) keysource.GetKey(); - - if (result()) { - strcpy(buffer,input.text()); - return TRUE; - } else { - return FALSE; - } -} -void NetHackQtStringRequestor::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - - NetHackQtWindow::NetHackQtWindow() { } - NetHackQtWindow::~NetHackQtWindow() { } @@ -1442,3871 +120,17 @@ NetHackQtWindow::~NetHackQtWindow() // void NetHackQtWindow::Clear() { puts("unexpected Clear"); } void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } -bool NetHackQtWindow::Destroy() { return TRUE; } +bool NetHackQtWindow::Destroy() { return true; } void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } -void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } +void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const char* str, bool presel) { puts("unexpected AddMenu"); } -void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } + const QString& str, bool presel) { puts("unexpected AddMenu"); } +void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } //void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } - - -// XXX Hmmm... crash after saving bones file if Map window is -// XXX deleted. Strange bug somewhere. -bool NetHackQtMapWindow::Destroy() { return FALSE; } - -NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) : - clicksink(click_sink), - change(10), - rogue_font(0) -{ - viewport.addChild(this); - - setBackgroundColor(black); - viewport.setBackgroundColor(black); - - pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm); - - cursor.setX(0); - cursor.setY(0); - Clear(); - - connect(qt_settings,SIGNAL(tilesChanged()),this,SLOT(updateTiles())); - connect(&viewport, SIGNAL(contentsMoving(int,int)), this, - SLOT(moveMessages(int,int))); - - updateTiles(); - //setFocusPolicy(StrongFocus); -#ifdef SAFERHANGUP - QTimer* deadman = new QTimer(this); - connect(deadman, SIGNAL(timeout()), SLOT(timeout())); - deadman->start(2000); // deadman timer every 2 seconds -#endif -} - -#ifdef SAFERHANGUP -// The "deadman" timer is received by this slot -void NetHackQtMapWindow::timeout() {} -#endif - -void NetHackQtMapWindow::moveMessages(int x, int y) -{ - QRect u = messages_rect; - messages_rect.moveTopLeft(QPoint(x,y)); - u |= messages_rect; - update(u); -} - -void NetHackQtMapWindow::clearMessages() -{ - messages = ""; - update(messages_rect); - messages_rect = QRect(); -} - -void NetHackQtMapWindow::putMessage(int attr, const char* text) -{ - if ( !messages.isEmpty() ) - messages += "\n"; - messages += text; - QFontMetrics fm = fontMetrics(); - messages_rect = fm.boundingRect(viewport.contentsX(), viewport.contentsY(), - viewport.width(), 0, - WordBreak|AlignTop|AlignLeft|DontClip, - messages); - update(messages_rect); -} - -void NetHackQtMapWindow::updateTiles() -{ - NetHackQtGlyphs& glyphs = qt_settings->glyphs(); - int gw = glyphs.width(); - int gh = glyphs.height(); - // Be exactly the size we want to be - full map... - resize(COLNO*gw,ROWNO*gh); - - viewport.verticalScrollBar()->setSteps(gh,gh); - viewport.horizontalScrollBar()->setSteps(gw,gw); - /* - viewport.setMaximumSize( - gw*COLNO + viewport.verticalScrollBar()->width(), - gh*ROWNO + viewport.horizontalScrollBar()->height() - ); - */ - viewport.updateScrollBars(); - - change.clear(); - change.add(0,0,COLNO,ROWNO); - delete rogue_font; rogue_font = 0; - Display(FALSE); - - emit resized(); -} - -NetHackQtMapWindow::~NetHackQtMapWindow() -{ - // Remove from viewport porthole, since that is a destructible member. - viewport.removeChild(this); - recreate(0,0,QPoint(0,0)); -} - -QWidget* NetHackQtMapWindow::Widget() -{ - return &viewport; -} - -void NetHackQtMapWindow::Scroll(int dx, int dy) -{ - if (viewport.horizontalScrollBar()->isVisible()) { - while (dx<0) { viewport.horizontalScrollBar()->subtractPage(); dx++; } - while (dx>0) { viewport.horizontalScrollBar()->addPage(); dx--; } - } - if (viewport.verticalScrollBar()->isVisible()) { - while (dy<0) { viewport.verticalScrollBar()->subtractPage(); dy++; } - while (dy>0) { viewport.verticalScrollBar()->addPage(); dy--; } - } -} - -void NetHackQtMapWindow::Clear() -{ - unsigned short stone=cmap_to_glyph(S_stone); - - for (int j=0; jexit_loop(); -} - -void NetHackQtMapWindow::mousePressEvent(QMouseEvent* event) -{ - clicksink.Put( - event->pos().x()/qt_settings->glyphs().width(), - event->pos().y()/qt_settings->glyphs().height(), - event->button()==LeftButton ? CLICK_1 : CLICK_2 - ); - qApp->exit_loop(); -} - -#ifdef TEXTCOLOR -static -const QPen& nhcolor_to_pen(int c) -{ - static QPen* pen=0; - if ( !pen ) { - pen = new QPen[17]; - pen[0] = QColor(24,24,24); // "black" on black - pen[1] = Qt::red; - pen[2] = QColor(0,191,0); - pen[3] = QColor(127,127,0); - pen[4] = Qt::blue; - pen[5] = Qt::magenta; - pen[6] = Qt::cyan; - pen[7] = Qt::gray; - pen[8] = Qt::white; // no color - pen[9] = QColor(255,127,0); - pen[10] = QColor(127,255,127); - pen[11] = Qt::yellow; - pen[12] = QColor(127,127,255); - pen[13] = QColor(255,127,255); - pen[14] = QColor(127,255,255); - pen[15] = Qt::white; - pen[16] = QColor(24,24,24); // "black" on black - } - - return pen[c]; -} -#endif - -void NetHackQtMapWindow::paintEvent(QPaintEvent* event) -{ - QRect area=event->rect(); - QRect garea; - garea.setCoords( - QMAX(0,area.left()/qt_settings->glyphs().width()), - QMAX(0,area.top()/qt_settings->glyphs().height()), - QMIN(COLNO-1,area.right()/qt_settings->glyphs().width()), - QMIN(ROWNO-1,area.bottom()/qt_settings->glyphs().height()) - ); - - QPainter painter; - - painter.begin(this); - - if (Is_rogue_level(&u.uz) || iflags.wc_ascii_map) - { - // You enter a VERY primitive world! - - painter.setClipRect( event->rect() ); // (normally we don't clip) - painter.fillRect( event->rect(), black ); - - if ( !rogue_font ) { - // Find font... - int pts = 5; - QString fontfamily = iflags.wc_font_map - ? iflags.wc_font_map : "Courier"; - bool bold = FALSE; - if ( fontfamily.right(5).lower() == "-bold" ) { - fontfamily.truncate(fontfamily.length()-5); - bold = TRUE; - } - while ( pts < 32 ) { - QFont f(fontfamily, pts, bold ? QFont::Bold : QFont::Normal); - painter.setFont(QFont(fontfamily, pts)); - QFontMetrics fm = painter.fontMetrics(); - if ( fm.width("M") > qt_settings->glyphs().width() ) - break; - if ( fm.height() > qt_settings->glyphs().height() ) - break; - pts++; - } - rogue_font = new QFont(fontfamily,pts-1); - } - painter.setFont(*rogue_font); - - for (int j=garea.top(); j<=garea.bottom(); j++) { - for (int i=garea.left(); i<=garea.right(); i++) { - unsigned short g=Glyph(i,j); - uchar ch; - int color, och; - unsigned special; - - painter.setPen( green ); - /* map glyph to character and color */ - (void)mapglyph(g, &och, &color, &special, i, j, 0); - ch = (uchar)och; -#ifdef TEXTCOLOR - painter.setPen( nhcolor_to_pen(color) ); -#endif - painter.drawText( - i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height(), - qt_settings->glyphs().width(), - qt_settings->glyphs().height(), - AlignCenter, - (const char*)&ch, 1 - ); - if (glyph_is_pet(g) -#ifdef TEXTCOLOR - && ::iflags.hilite_pet -#endif - ) { - painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height()), - pet_annotation); - } - } - } - - painter.setFont(font()); - } else { - for (int j=garea.top(); j<=garea.bottom(); j++) { - for (int i=garea.left(); i<=garea.right(); i++) { - unsigned short g=Glyph(i,j); - qt_settings->glyphs().drawCell(painter, g, i, j); - if (glyph_is_pet(g) -#ifdef TEXTCOLOR - && ::iflags.hilite_pet -#endif - ) { - painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height()), - pet_annotation); - } - } - } - } - - if (garea.contains(cursor)) { - if (Is_rogue_level(&u.uz)) { -#ifdef TEXTCOLOR - painter.setPen( white ); -#else - painter.setPen( green ); // REALLY primitive -#endif - } else - { - int hp100; - if (u.mtimedone) { - hp100=u.mhmax ? u.mh*100/u.mhmax : 100; - } else { - hp100=u.uhpmax ? u.uhp*100/u.uhpmax : 100; - } - - if (hp100 > 75) painter.setPen(white); - else if (hp100 > 50) painter.setPen(yellow); - else if (hp100 > 25) painter.setPen(QColor(0xff,0xbf,0x00)); // orange - else if (hp100 > 10) painter.setPen(red); - else painter.setPen(magenta); - } - - painter.drawRect( - cursor.x()*qt_settings->glyphs().width(),cursor.y()*qt_settings->glyphs().height(), - qt_settings->glyphs().width(),qt_settings->glyphs().height()); - } - - if (area.intersects(messages_rect)) { - painter.setPen(black); - painter.drawText(viewport.contentsX()+1,viewport.contentsY()+1, - viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); - painter.setPen(white); - painter.drawText(viewport.contentsX(),viewport.contentsY(), - viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); - } - - painter.end(); -} - -void NetHackQtMapWindow::Display(bool block) -{ - for (int i=0; iglyphs().width(), - ch.y()*qt_settings->glyphs().height(), - ch.width()*qt_settings->glyphs().width(), - ch.height()*qt_settings->glyphs().height(), - FALSE - ); - } - - change.clear(); - - if (block) { - yn_function("Press a key when done viewing",0,'\0'); - } -} - -void NetHackQtMapWindow::CursorTo(int x,int y) -{ - Changed(cursor.x(),cursor.y()); - cursor.setX(x); - cursor.setY(y); - Changed(cursor.x(),cursor.y()); -} - -void NetHackQtMapWindow::PutStr(int attr, const char* text) -{ - puts("unexpected PutStr in MapWindow"); -} - -void NetHackQtMapWindow::ClipAround(int x,int y) -{ - // Convert to pixel of center of tile - x=x*qt_settings->glyphs().width()+qt_settings->glyphs().width()/2; - y=y*qt_settings->glyphs().height()+qt_settings->glyphs().height()/2; - - // Then ensure that pixel is visible - viewport.center(x,y,0.45,0.45); -} - -void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph) -{ - Glyph(x,y)=glyph; - Changed(x,y); -} - -//void NetHackQtMapWindow::PrintGlyphCompose(int x,int y,int glyph1, int glyph2) -//{ - // TODO: composed graphics -//} - -void NetHackQtMapWindow::Changed(int x, int y) -{ - change.add(x,y); -} - - -class NetHackQtScrollText : public QTableView { - struct UData { - UData() : text(0), attr(0) { } - ~UData() { if (text) free(text); } - - char* text; - int attr; - }; -public: - int uncleared; - - NetHackQtScrollText(int maxlength) : - uncleared(0), - maxitems(maxlength), - first(0), - count(0), - item_cycle(maxlength) - { - setNumCols(1); - setCellWidth(200); - setCellHeight(fontMetrics().height()); - setBackgroundColor(white); - setTableFlags(Tbl_vScrollBar - |Tbl_autoHScrollBar - |Tbl_clipCellPainting - |Tbl_smoothScrolling); - } - - ~NetHackQtScrollText() - { - } - - void Scroll(int dx, int dy) - { - setXOffset(xOffset()+dx*viewWidth()); - setYOffset(yOffset()+dy*viewHeight()); - } - - void insertItem(int attr, const char* text) - { - setTopCell(count); - - setAutoUpdate(FALSE); - - int i; - if (count cellWidth()) { - // Get wider. - setCellWidth(w); - } - setTopCell(count); - - setAutoUpdate(TRUE); - - if (viewHeight() >= totalHeight()-cellHeight()) { - repaint(); - } else { - scroll(0,cellHeight()); - } - } - - virtual void setFont(const QFont& font) - { - QTableView::setFont(font); - setCellHeight(fontMetrics().height()); - } - -protected: - - UData& item(int i) - { - return item_cycle[(first+i)%maxitems]; - } - - const int maxitems; - int first, count; - QArray item_cycle; - - int datumWidth(const UData& uitem) - { - if (uitem.text) { - int width=fontMetrics().width(uitem.text)+3; - if (uitem.attr) { - // XXX Too expensive to do properly, because - // XXX we have to set the font of the widget - // XXX just to get the font metrics information! - // XXX Could hold a fake widget for that - // XXX purpose, but this hack is less ugly. - width+=width/10; - } - return width; - } else { - return 0; - } - } - - virtual void setupPainter(QPainter *p) - { - // XXX This shouldn't be needed - we set the bg in the constructor. - p->setBackgroundColor(white); - } - - virtual void paintCell(QPainter *p, int row, int col) - { - bool sel=FALSE; - UData& uitem=item(row); - - if (!sel && row < count-uncleared) { - p->setPen(darkGray); - } else { - p->setPen(black); - } - - if (uitem.attr) { - // XXX only bold - QFont bold(font().family(),font().pointSize(),QFont::Bold); - p->setFont(bold); - } - - p->drawText(3, 0, cellWidth(), cellHeight(), - AlignLeft|AlignVCenter, uitem.text); - - if (uitem.attr) { - p->setFont(font()); - } - } -}; - -NetHackQtMessageWindow::NetHackQtMessageWindow() : - list(new NetHackQtScrollText(::iflags.msg_history)) -{ - ::iflags.window_inited = 1; - map = 0; - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(updateFont())); - updateFont(); -} - -NetHackQtMessageWindow::~NetHackQtMessageWindow() -{ - ::iflags.window_inited = 0; - delete list; -} - -QWidget* NetHackQtMessageWindow::Widget() { return list; } - -void NetHackQtMessageWindow::setMap(NetHackQtMapWindow* m) -{ - map = m; - updateFont(); -} - -void NetHackQtMessageWindow::updateFont() -{ - list->setFont(qt_settings->normalFont()); - if ( map ) - map->setFont(qt_settings->normalFont()); -} - -void NetHackQtMessageWindow::Scroll(int dx, int dy) -{ - list->Scroll(dx,dy); -} - -void NetHackQtMessageWindow::Clear() -{ - if ( map ) - map->clearMessages(); - if (list->uncleared) { - list->uncleared=0; - changed=TRUE; - Display(FALSE); - } -} - -void NetHackQtMessageWindow::Display(bool block) -{ - if (changed) { - list->repaint(); - changed=FALSE; - } -} - -void NetHackQtMessageWindow::PutStr(int attr, const char* text) -{ -#ifdef USER_SOUNDS - play_sound_for_message(text); -#endif - - changed=TRUE; - list->uncleared++; - list->insertItem(attr,text); - - // Force scrollbar to bottom - // XXX list->setTopItem(list->count()); - - if ( map ) - map->putMessage(attr, text); -} - - - -NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : - QWidget(parent), - low_is_good(FALSE), - prev_value(-123), - turn_count(-1), - label(new QLabel(l,this)), - icon(0) -{ - initHighlight(); -} -NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) : - QWidget(parent), - low_is_good(FALSE), - prev_value(-123), - turn_count(-1), - label(new QLabel(l,this)), - icon(new QLabel(this)) -{ - setIcon(i); - initHighlight(); -} -void NetHackQtLabelledIcon::initHighlight() -{ - const QPalette& pal=palette(); - const QColorGroup& pa=pal.normal(); - //QColorGroup good(white,darkGreen,pa.light(),pa.dark(),pa.mid(),white,pa.base()); - QColorGroup good(black,green,pa.light(),pa.dark(),pa.mid(),black,pa.base()); - QColorGroup bad(white,red,pa.light(),pa.dark(),pa.mid(),white,pa.base()); - hl_good=pal.copy(); - hl_good.setNormal(good); - hl_good.setActive(good); - hl_bad=pal.copy(); - hl_bad.setNormal(bad); - hl_bad.setActive(bad); -} - -void NetHackQtLabelledIcon::setLabel(const char* t, bool lower) -{ - if (!label) { - label=new QLabel(this); - label->setFont(font()); - resizeEvent(0); - } - if (0!=strcmp(label->text(),t)) { - label->setText(t); - highlight(lower==low_is_good ? hl_good : hl_bad); - } -} -void NetHackQtLabelledIcon::setLabel(const char* t, long v, long cv, const char* tail) -{ - char buf[BUFSZ]; - if (v==NoNum) { - Sprintf(buf,"%s%s",t,tail); - } else { - Sprintf(buf,"%s%ld%s",t,v,tail); - } - setLabel(buf,cvsetPixmap(i); - else { icon=new QLabel(this); icon->setPixmap(i); resizeEvent(0); } - icon->resize(i.width(),i.height()); -} -void NetHackQtLabelledIcon::setFont(const QFont& f) -{ - QWidget::setFont(f); - if (label) label->setFont(f); -} -void NetHackQtLabelledIcon::show() -{ -#if QT_VERSION >= 300 - if (isHidden()) -#else - if (!isVisible()) -#endif - highlight(hl_bad); - QWidget::show(); -} -void NetHackQtLabelledIcon::highlightWhenChanging() -{ - turn_count=0; -} -void NetHackQtLabelledIcon::lowIsGood() -{ - low_is_good=TRUE; -} -void NetHackQtLabelledIcon::dissipateHighlight() -{ - if (turn_count>0) { - turn_count--; - if (!turn_count) - unhighlight(); - } -} -void NetHackQtLabelledIcon::highlight(const QPalette& hl) -{ - if (label) { // Surely it is?! - if (turn_count>=0) { - label->setPalette(hl); - turn_count=4; - // `4' includes this turn, so dissipates after - // 3 more keypresses. - } else { - label->setPalette(palette()); - } - } -} -void NetHackQtLabelledIcon::unhighlight() -{ - if (label) { // Surely it is?! - label->setPalette(palette()); - } -} -void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*) -{ - setAlignments(); - - //int labw=label ? label->fontMetrics().width(label->text()) : 0; - int labh=label ? label->fontMetrics().height() : 0; - int icoh=icon ? icon->height() : 0; - int h=icoh+labh; - int icoy=(h>height() ? height()-labh-icoh : height()/2-h/2); - int laby=icoy+icoh; - if (icon) { - icon->setGeometry(0,icoy,width(),icoh); - } - if (label) { - label->setGeometry(0,laby,width(),labh); - } -} - -void NetHackQtLabelledIcon::setAlignments() -{ - if (label) label->setAlignment(AlignHCenter|AlignVCenter); - if (icon) icon->setAlignment(AlignHCenter|AlignVCenter); -} - -static void -tryload(QPixmap& pm, const char* fn) -{ - if (!pm.load(fn)) { - QString msg; - msg.sprintf("Cannot load \"%s\"", fn); - QMessageBox::warning(0, "IO Error", msg); - } -} - -NetHackQtStatusWindow::NetHackQtStatusWindow() : - // Notes: - // Alignment needs -2 init value, because -1 is an alignment. - // Armor Class is an schar, so 256 is out of range. - // Blank value is 0 and should never change. - name(this,"(name)"), - dlevel(this,"(dlevel)"), - str(this,"STR"), - dex(this,"DEX"), - con(this,"CON"), - intel(this,"INT"), - wis(this,"WIS"), - cha(this,"CHA"), - gold(this,"Gold"), - hp(this,"Hit Points"), - power(this,"Power"), - ac(this,"Armour Class"), - level(this,"Level"), - exp(this,"Experience"), - align(this,"Alignment"), - time(this,"Time"), - score(this,"Score"), - hunger(this,""), - confused(this,"Confused"), - sick_fp(this,"Sick"), - sick_il(this,"Ill"), - blind(this,"Blind"), - stunned(this,"Stunned"), - hallu(this,"Hallu"), - encumber(this,""), - hline1(this), - hline2(this), - hline3(this), - first_set(TRUE) -{ - p_str = QPixmap(str_xpm); - p_str = QPixmap(str_xpm); - p_dex = QPixmap(dex_xpm); - p_con = QPixmap(cns_xpm); - p_int = QPixmap(int_xpm); - p_wis = QPixmap(wis_xpm); - p_cha = QPixmap(cha_xpm); - - p_chaotic = QPixmap(chaotic_xpm); - p_neutral = QPixmap(neutral_xpm); - p_lawful = QPixmap(lawful_xpm); - - p_satiated = QPixmap(satiated_xpm); - p_hungry = QPixmap(hungry_xpm); - - p_confused = QPixmap(confused_xpm); - p_sick_fp = QPixmap(sick_fp_xpm); - p_sick_il = QPixmap(sick_il_xpm); - p_blind = QPixmap(blind_xpm); - p_stunned = QPixmap(stunned_xpm); - p_hallu = QPixmap(hallu_xpm); - - p_encumber[0] = QPixmap(slt_enc_xpm); - p_encumber[1] = QPixmap(mod_enc_xpm); - p_encumber[2] = QPixmap(hvy_enc_xpm); - p_encumber[3] = QPixmap(ext_enc_xpm); - p_encumber[4] = QPixmap(ovr_enc_xpm); - - str.setIcon(p_str); - dex.setIcon(p_dex); - con.setIcon(p_con); - intel.setIcon(p_int); - wis.setIcon(p_wis); - cha.setIcon(p_cha); - - align.setIcon(p_neutral); - hunger.setIcon(p_hungry); - - confused.setIcon(p_confused); - sick_fp.setIcon(p_sick_fp); - sick_il.setIcon(p_sick_il); - blind.setIcon(p_blind); - stunned.setIcon(p_stunned); - hallu.setIcon(p_hallu); - - encumber.setIcon(p_encumber[0]); - - hline1.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline2.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline3.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline1.setLineWidth(1); - hline2.setLineWidth(1); - hline3.setLineWidth(1); - - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); - doUpdate(); -} - -void NetHackQtStatusWindow::doUpdate() -{ - const QFont& large=qt_settings->largeFont(); - name.setFont(large); - dlevel.setFont(large); - - const QFont& normal=qt_settings->normalFont(); - str.setFont(normal); - dex.setFont(normal); - con.setFont(normal); - intel.setFont(normal); - wis.setFont(normal); - cha.setFont(normal); - gold.setFont(normal); - hp.setFont(normal); - power.setFont(normal); - ac.setFont(normal); - level.setFont(normal); - exp.setFont(normal); - align.setFont(normal); - time.setFont(normal); - score.setFont(normal); - hunger.setFont(normal); - confused.setFont(normal); - sick_fp.setFont(normal); - sick_il.setFont(normal); - blind.setFont(normal); - stunned.setFont(normal); - hallu.setFont(normal); - encumber.setFont(normal); - - updateStats(); -} - -QWidget* NetHackQtStatusWindow::Widget() { return this; } - -void NetHackQtStatusWindow::Clear() -{ -} -void NetHackQtStatusWindow::Display(bool block) -{ -} -void NetHackQtStatusWindow::CursorTo(int,int y) -{ - cursy=y; -} -void NetHackQtStatusWindow::PutStr(int attr, const char* text) -{ - // do a complete update when line 0 is done (as per X11 fancy status) - if (cursy==0) updateStats(); -} - -void NetHackQtStatusWindow::resizeEvent(QResizeEvent*) -{ - const float SP_name=0.13; // the (large) - const float SP_dlev=0.13; // Level 3 in The Dungeons of Doom (large) - const float SP_atr1=0.25; // STR DEX CON INT WIS CHA - const float SP_hln1=0.02; // --- - const float SP_atr2=0.09; // Au HP PW AC LVL EXP - const float SP_hln2=0.02; // --- - const float SP_time=0.09; // time score - const float SP_hln3=0.02; // --- - const float SP_stat=0.25; // Alignment, Poisoned, Hungry, Sick, etc. - - int h=height(); - int x=0,y=0; - - int iw; // Width of an item across line - int lh; // Height of a line of values - - lh=int(h*SP_name); - name.setGeometry(0,0,width(),lh); y+=lh; - lh=int(h*SP_dlev); - dlevel.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_hln1); - hline1.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_atr1); - iw=width()/6; - str.setGeometry(x,y,iw,lh); x+=iw; - dex.setGeometry(x,y,iw,lh); x+=iw; - con.setGeometry(x,y,iw,lh); x+=iw; - intel.setGeometry(x,y,iw,lh); x+=iw; - wis.setGeometry(x,y,iw,lh); x+=iw; - cha.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_hln2); - hline2.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_atr2); - iw=width()/6; - gold.setGeometry(x,y,iw,lh); x+=iw; - hp.setGeometry(x,y,iw,lh); x+=iw; - power.setGeometry(x,y,iw,lh); x+=iw; - ac.setGeometry(x,y,iw,lh); x+=iw; - level.setGeometry(x,y,iw,lh); x+=iw; - exp.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_hln3); - hline3.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_time); - iw=width()/3; x+=iw/2; - time.setGeometry(x,y,iw,lh); x+=iw; - score.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_stat); - iw=width()/9; - align.setGeometry(x,y,iw,lh); x+=iw; - hunger.setGeometry(x,y,iw,lh); x+=iw; - confused.setGeometry(x,y,iw,lh); x+=iw; - sick_fp.setGeometry(x,y,iw,lh); x+=iw; - sick_il.setGeometry(x,y,iw,lh); x+=iw; - blind.setGeometry(x,y,iw,lh); x+=iw; - stunned.setGeometry(x,y,iw,lh); x+=iw; - hallu.setGeometry(x,y,iw,lh); x+=iw; - encumber.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; -} - - -/* - * Set all widget values to a null string. This is used after all spacings - * have been calculated so that when the window is popped up we don't get all - * kinds of funny values being displayed. - */ -void NetHackQtStatusWindow::nullOut() -{ -} - -void NetHackQtStatusWindow::fadeHighlighting() -{ - name.dissipateHighlight(); - dlevel.dissipateHighlight(); - - str.dissipateHighlight(); - dex.dissipateHighlight(); - con.dissipateHighlight(); - intel.dissipateHighlight(); - wis.dissipateHighlight(); - cha.dissipateHighlight(); - - gold.dissipateHighlight(); - hp.dissipateHighlight(); - power.dissipateHighlight(); - ac.dissipateHighlight(); - level.dissipateHighlight(); - exp.dissipateHighlight(); - align.dissipateHighlight(); - - time.dissipateHighlight(); - score.dissipateHighlight(); - - hunger.dissipateHighlight(); - confused.dissipateHighlight(); - sick_fp.dissipateHighlight(); - sick_il.dissipateHighlight(); - blind.dissipateHighlight(); - stunned.dissipateHighlight(); - hallu.dissipateHighlight(); - encumber.dissipateHighlight(); -} - -/* - * Update the displayed status. The current code in botl.c updates - * two lines of information. Both lines are always updated one after - * the other. So only do our update when we update the second line. - * - * Information on the first line: - * name, attributes, alignment, score - * - * Information on the second line: - * dlvl, gold, hp, power, ac, {level & exp or HD **} - * status (hunger, conf, halu, stun, sick, blind), time, encumbrance - * - * [**] HD is shown instead of level and exp if mtimedone is non-zero. - */ -void NetHackQtStatusWindow::updateStats() -{ - if (!parentWidget()) return; - - char buf[BUFSZ]; - - if (cursy != 0) return; /* do a complete update when line 0 is done */ - - if (ACURR(A_STR) > 118) { - Sprintf(buf,"STR:%d",ACURR(A_STR)-100); - } else if (ACURR(A_STR)==118) { - Sprintf(buf,"STR:18/**"); - } else if(ACURR(A_STR) > 18) { - Sprintf(buf,"STR:18/%02d",ACURR(A_STR)-18); - } else { - Sprintf(buf,"STR:%d",ACURR(A_STR)); - } - str.setLabel(buf,NetHackQtLabelledIcon::NoNum,ACURR(A_STR)); - - dex.setLabel("DEX:",(long)ACURR(A_DEX)); - con.setLabel("CON:",(long)ACURR(A_CON)); - intel.setLabel("INT:",(long)ACURR(A_INT)); - wis.setLabel("WIS:",(long)ACURR(A_WIS)); - cha.setLabel("CHA:",(long)ACURR(A_CHA)); - const char* hung=hu_stat[u.uhs]; - if (hung[0]==' ') { - hunger.hide(); - } else { - hunger.setIcon(u.uhs ? p_hungry : p_satiated); - hunger.setLabel(hung); - hunger.show(); - } - if (Confusion) confused.show(); else confused.hide(); - if (Sick) { - if (u.usick_type & SICK_VOMITABLE) { - sick_fp.show(); - } else { - sick_fp.hide(); - } - if (u.usick_type & SICK_NONVOMITABLE) { - sick_il.show(); - } else { - sick_il.hide(); - } - } else { - sick_fp.hide(); - sick_il.hide(); - } - if (Blind) blind.show(); else blind.hide(); - if (Stunned) stunned.show(); else stunned.hide(); - if (Hallucination) hallu.show(); else hallu.hide(); - const char* enc=enc_stat[near_capacity()]; - if (enc[0]==' ' || !enc[0]) { - encumber.hide(); - } else { - encumber.setIcon(p_encumber[near_capacity()-1]); - encumber.setLabel(enc); - encumber.show(); - } - Strcpy(buf, g.plname); - if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a'; - Strcat(buf, " the "); - if (u.mtimedone) { - char mname[BUFSZ]; - int k = 0; - - Strcpy(mname, mons[u.umonnum].mname); - while(mname[k] != 0) { - if ((k == 0 || (k > 0 && mname[k-1] == ' ')) - && 'a' <= mname[k] && mname[k] <= 'z') - { - mname[k] += 'A' - 'a'; - } - k++; - } - Strcat(buf, mname); - } else { - Strcat(buf, rank_of(u.ulevel, pl_character[0], ::flags.female)); - } - name.setLabel(buf,NetHackQtLabelledIcon::NoNum,u.ulevel); - - if (describe_level(buf)) { - dlevel.setLabel(buf,(bool)TRUE); - } else { - Sprintf(buf, "%s, level ", dungeons[u.uz.dnum].dname); - dlevel.setLabel(buf,(long)depth(&u.uz)); - } - - gold.setLabel("Au:", money_cnt(g.invent)); - if (u.mtimedone) { - // You're a monster! - - Sprintf(buf, "/%d", u.mhmax); - hp.setLabel("HP:",u.mh > 0 ? u.mh : 0,buf); - level.setLabel("HD:",(long)mons[u.umonnum].mlevel); - } else { - // You're normal. - - Sprintf(buf, "/%d", u.uhpmax); - hp.setLabel("HP:",u.uhp > 0 ? u.uhp : 0,buf); - level.setLabel("Level:",(long)u.ulevel); - } - Sprintf(buf, "/%d", u.uenmax); - power.setLabel("Pow:",u.uen,buf); - ac.setLabel("AC:",(long)u.uac); - if (::flags.showexp) { - exp.setLabel("Exp:",(long)u.uexp); - } else - { - exp.setLabel(""); - } - if (u.ualign.type==A_CHAOTIC) { - align.setIcon(p_chaotic); - align.setLabel("Chaotic"); - } else if (u.ualign.type==A_NEUTRAL) { - align.setIcon(p_neutral); - align.setLabel("Neutral"); - } else { - align.setIcon(p_lawful); - align.setLabel("Lawful"); - } - - if (::flags.time) time.setLabel("Time:",(long)g.moves); - else time.setLabel(""); -#ifdef SCORE_ON_BOTL - if (::flags.showscore) { - score.setLabel("Score:",(long)botl_score()); - } else -#endif - { - score.setLabel(""); - } - - if (first_set) - { - first_set=FALSE; - - name.highlightWhenChanging(); - dlevel.highlightWhenChanging(); - - str.highlightWhenChanging(); - dex.highlightWhenChanging(); - con.highlightWhenChanging(); - intel.highlightWhenChanging(); - wis.highlightWhenChanging(); - cha.highlightWhenChanging(); - - gold.highlightWhenChanging(); - hp.highlightWhenChanging(); - power.highlightWhenChanging(); - ac.highlightWhenChanging(); ac.lowIsGood(); - level.highlightWhenChanging(); - exp.highlightWhenChanging(); - align.highlightWhenChanging(); - - //time.highlightWhenChanging(); - score.highlightWhenChanging(); - - hunger.highlightWhenChanging(); - confused.highlightWhenChanging(); - sick_fp.highlightWhenChanging(); - sick_il.highlightWhenChanging(); - blind.highlightWhenChanging(); - stunned.highlightWhenChanging(); - hallu.highlightWhenChanging(); - encumber.highlightWhenChanging(); - } -} - -/* - * Turn off hilighted status values after a certain amount of turns. - */ -void NetHackQtStatusWindow::checkTurnEvents() -{ -} - - - -NetHackQtMenuDialog::NetHackQtMenuDialog() : - QDialog(qApp->mainWidget(),0,FALSE) -{ -} - -void NetHackQtMenuDialog::resizeEvent(QResizeEvent*) -{ - emit Resized(); -} - -void NetHackQtMenuDialog::Accept() -{ - accept(); -} - -void NetHackQtMenuDialog::Reject() -{ - reject(); -} - -void NetHackQtMenuDialog::SetResult(int r) -{ - setResult(r); -} - -void NetHackQtMenuDialog::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -// Table view columns: -// -// [pick-count] [accel] [glyph] [string] -// -// Maybe accel should be near string. We'll see. -// pick-count normally blank. -// double-clicking or click-on-count gives pop-up entry -// string is green when selected -// -NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : - QTableView(), - keysource(ks), - dialog(new NetHackQtMenuDialog()), - prompt(0), - pressed(-1) -{ - setNumCols(4); - setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height())); - setBackgroundColor(lightGray); - setFrameStyle(Panel|Sunken); - setLineWidth(2); - - ok=new QPushButton("Ok",dialog); - connect(ok,SIGNAL(clicked()),dialog,SLOT(accept())); - - cancel=new QPushButton("Cancel",dialog); - connect(cancel,SIGNAL(clicked()),dialog,SLOT(reject())); - - all=new QPushButton("All",dialog); - connect(all,SIGNAL(clicked()),this,SLOT(All())); - - none=new QPushButton("None",dialog); - connect(none,SIGNAL(clicked()),this,SLOT(ChooseNone())); - - invert=new QPushButton("Invert",dialog); - connect(invert,SIGNAL(clicked()),this,SLOT(Invert())); - - search=new QPushButton("Search",dialog); - connect(search,SIGNAL(clicked()),this,SLOT(Search())); - - QPoint pos(0,ok->height()); - recreate(dialog,0,pos); - prompt.recreate(dialog,0,pos); - - setBackgroundColor(lightGray); - - connect(dialog,SIGNAL(Resized()),this,SLOT(Layout())); - - setTableFlags(Tbl_autoHScrollBar|Tbl_autoVScrollBar - |Tbl_smoothScrolling|Tbl_clipCellPainting); - setFocusPolicy(StrongFocus); -} - -NetHackQtMenuWindow::~NetHackQtMenuWindow() -{ - // Remove from dialog before we destruct it - recreate(0,0,QPoint(0,0)); - delete dialog; -} - -void NetHackQtMenuWindow::focusInEvent(QFocusEvent *) -{ - // Don't repaint at all, since nothing is using the focus colour -} -void NetHackQtMenuWindow::focusOutEvent(QFocusEvent *) -{ - // Don't repaint at all, since nothing is using the focus colour -} - -int NetHackQtMenuWindow::cellWidth(int col) -{ - switch (col) { - case 0: - return fontMetrics().width("All "); - break; case 1: - return fontMetrics().width(" m "); - break; case 2: - return qt_settings->glyphs().width(); - break; case 3: - return str_width; - } - impossible("Extra column (#%d) in MenuWindow",col); - return 0; -} - -QWidget* NetHackQtMenuWindow::Widget() { return dialog; } - -void NetHackQtMenuWindow::StartMenu() -{ - setNumRows((itemcount=0)); - str_width=200; - str_fixed=FALSE; - next_accel=0; - has_glyphs=FALSE; -} - -NetHackQtMenuWindow::MenuItem::MenuItem() : - str(0) -{ -} - -NetHackQtMenuWindow::MenuItem::~MenuItem() -{ - if (str) free((void*)str); -} - -#define STR_MARGIN 4 - -void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, - char ch, char gch, int attr, const char* str, bool presel) -{ - if (!ch && identifier->a_void!=0) { - // Supply a keyboard accelerator. Limited supply. - static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - if (accel[next_accel]) { - ch=accel[next_accel++]; - } - } - - if ((int)item.size() < itemcount+1) { - item.resize(itemcount*4+10); - } - item[itemcount].glyph=glyph; - item[itemcount].identifier=*identifier; - item[itemcount].ch=ch; - item[itemcount].attr=attr; - item[itemcount].str=strdup(str); - item[itemcount].selected=presel; - item[itemcount].count=-1; - ++itemcount; - - str_fixed=str_fixed || strstr(str," "); - if (glyph!=NO_GLYPH) has_glyphs=TRUE; -} -void NetHackQtMenuWindow::EndMenu(const char* p) -{ - prompt.setText(p ? p : ""); -} -void NetHackQtMenuWindow::Layout() -{ - int butw=totalWidth()/6; // 6 buttons - int buth=fontMetrics().height()+8; // 8 for spacing & mitres - int prompth=(prompt.text().isNull() ? 0 : buth); - - prompt.setGeometry(6,buth,dialog->width()-6,prompth); - int h=dialog->height()-buth-prompth; - setGeometry(0,buth+prompth, dialog->width(), h); - - // Below, we take care to use up full width - int x=0; - ok->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/5; - cancel->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/4; - all->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/3; - none->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/2; - invert->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/1; - search->setGeometry(x,0,butw,buth); -} - -int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) -{ - setFont(str_fixed ? - qt_settings->normalFixedFont() : qt_settings->normalFont()); - - for (int i=0; iglyphs().height()+1,fontMetrics().height())); - setNumRows(itemcount); - - int buth=fontMetrics().height()+8; // 8 for spacing & mitres - - how=h; - - ok->setEnabled(how!=PICK_ONE);ok->setDefault(how!=PICK_ONE); - cancel->setEnabled(TRUE); - all->setEnabled(how==PICK_ANY); - none->setEnabled(how==PICK_ANY); - invert->setEnabled(how==PICK_ANY); - search->setEnabled(how!=PICK_NONE); - - dialog->SetResult(-1); - - // 20 allows for scrollbar or spacing - // 4 for frame borders - int mh = QApplication::desktop()->height()*3/5; - if ( qt_compact_mode && totalHeight() > mh ) { - // big, so make it fill - dialog->showMaximized(); - } else { - dialog->resize(totalWidth()+20, - QMIN(totalHeight(), mh)+buth+4+(prompt.text().isNull() ? 0 : buth)); - if ( dialog->width() > QApplication::desktop()->width() ) - dialog->resize(QApplication::desktop()->width(),dialog->height()+16); - centerOnMain(dialog); - dialog->show(); - } - - setFocus(); - while (dialog->result()<0) { - // changed the defaults below to the values in wintype.h 000119 - azy - if (!keysource.Empty()) { - char k=keysource.GetAscii(); - k=map_menu_cmd(k); /* added 000119 - azy */ - if (k=='\033') - dialog->Reject(); - else if (k=='\r' || k=='\n' || k==' ') - dialog->Accept(); - else if (k==MENU_SEARCH) - Search(); - else if (k==MENU_SELECT_ALL) - All(); - else if (k==MENU_INVERT_ALL) - Invert(); - else if (k==MENU_UNSELECT_ALL) - ChooseNone(); - else { - for (int i=0; iresult()<0) - qApp->enter_loop(); - } - //if ( (nhid != WIN_INVEN || !iflags.perm_invent) ) // doesn't work yet - { - dialog->hide(); - } - int result=dialog->result(); - - // Consume ^M (which QDialog steals for default button) - while (!keysource.Empty() && - (keysource.TopAscii()=='\n' || keysource.TopAscii()=='\r')) - keysource.GetAscii(); - - *menu_list=0; - if (how==PICK_NONE) - return result==0 ? -1 : 0; - - if (result>0) { - if (how==PICK_ONE) { - int i; - for (i=0; istate()&ShiftButton)) { - if (event->key()==Key_Prior) { - setYOffset(yOffset()-viewHeight()); - } else if (event->key()==Key_Next) { - setYOffset(yOffset()+viewHeight()); - } else { - event->ignore(); - } - } else { - event->ignore(); - } -} - -void NetHackQtMenuWindow::All() -{ - for (int i=0; iAccept(); - } - } -} - - -void NetHackQtMenuWindow::paintCell(QPainter* painter, int row, int col) -{ - // [pick-count] [accel] [glyph] [string] - - MenuItem& i = item[row]; - - painter->setPen(black); - painter->setFont(font()); - - if (i.selected) { - painter->setPen(darkGreen); - } - - switch (col) { - case 0: - if ( i.ch || i.attr!=ATR_INVERSE ) { - QString text; - if ( i.selected && i.count == -1 ) { - if ( i.str[0]>='0' && i.str[0]<='9' ) - text = "All"; - else - text = "*"; - } else if ( i.count<0 ) { - text = "-"; - } else { - text.sprintf("%d",i.count); - } - painter->drawText(0,0,cellWidth(col),cellHeight(), - AlignHCenter|AlignVCenter,text); - } - break; case 1: - if ((signed char)i.ch >= 0) { - char text[2]={i.ch,0}; - painter->drawText(0,0,cellWidth(col),cellHeight(), - AlignHCenter|AlignVCenter,text); - } - break; case 2: - if (i.glyph!=NO_GLYPH) { - // Centered in height - int y=(cellHeight()-qt_settings->glyphs().height())/2; - if (y<0) y=0; - qt_settings->glyphs().drawGlyph(*painter, i.glyph, 0, y); - } - break; case 3: - // XXX should qt_settings have ALL the various fonts - QFont newfont=font(); - - if (i.attr) { - switch(i.attr) { - case ATR_ULINE: - newfont.setUnderline(TRUE); - break; case ATR_BOLD: - painter->setPen(red); - break; case ATR_BLINK: - newfont.setItalic(TRUE); - break; case ATR_INVERSE: - newfont=qt_settings->largeFont(); - newfont.setWeight(QFont::Bold); - - if (i.selected) { - painter->setPen(blue); - } else { - painter->setPen(darkBlue); - } - } - } - painter->setFont(newfont); - - painter->drawText(STR_MARGIN,0,cellWidth(col),cellHeight(), - AlignLeft|AlignVCenter,i.str); - } -} - -void NetHackQtMenuWindow::mousePressEvent(QMouseEvent* event) -{ - int col=findCol(event->pos().x()); - int row=findRow(event->pos().y()); - - if (col<0 || row<0 || !item[row].Selectable()) return; - - if (how!=PICK_NONE) { - if (col==0) { - // Changing count. - NetHackQtStringRequestor requestor(keysource,"Count:"); - char buf[BUFSZ]; - - if (item[row].count>0) - Sprintf(buf,"%d", item[row].count); - else - Strcpy(buf, ""); - - requestor.SetDefault(buf); - if (requestor.Get(buf)) { - item[row].count=atoi(buf); - if (item[row].count==0) { - item[row].count=-1; - if (item[row].selected) ToggleSelect(row); - } else { - if (!item[row].selected) ToggleSelect(row); - } - updateCell(row,0); - } - } else { - pressed=row; - was_sel=item[row].selected; - ToggleSelect(row); - updateCell(row,0); - } - } -} - -void NetHackQtMenuWindow::mouseReleaseEvent(QMouseEvent* event) -{ - if (pressed>=0) { - int p=pressed; - pressed=-1; - updateCell(p,3); - } -} - -void NetHackQtMenuWindow::mouseMoveEvent(QMouseEvent* event) -{ - if (pressed>=0) { - int col=findCol(event->pos().x()); - int row=findRow(event->pos().y()); - - if (row>=0 && col>=0) { - if (pressed!=row) { - // reset to initial state - if (item[pressed].selected!=was_sel) - ToggleSelect(pressed); - } else { - // reset to new state - if (item[pressed].selected==was_sel) - ToggleSelect(pressed); - } - } - } -} - - -class NetHackQtTextListBox : public QListBox { -public: - NetHackQtTextListBox(QWidget* parent) : QListBox(parent) { } - - int TotalWidth() - { - doLayout(); - return contentsWidth(); - } - int TotalHeight() - { - doLayout(); - return contentsHeight(); - } - - virtual void setFont(const QFont &font) - { - QListBox::setFont(font); - } - void keyPressEvent(QKeyEvent* e) - { - QListBox::keyPressEvent(e); - } -}; - - -QPixmap* NetHackQtRIP::pixmap=0; - -NetHackQtRIP::NetHackQtRIP(QWidget* parent) : - QWidget(parent) -{ - if (!pixmap) { - pixmap=new QPixmap; - tryload(*pixmap, "rip.xpm"); - } - riplines=0; - resize(pixmap->width(),pixmap->height()); - setFont(QFont("times",12)); // XXX may need to be configurable -} - -void NetHackQtRIP::setLines(char** l, int n) -{ - line=l; - riplines=n; -} - -QSize NetHackQtRIP::sizeHint() const -{ - return pixmap->size(); -} - -void NetHackQtRIP::paintEvent(QPaintEvent* event) -{ - if ( riplines ) { - int pix_x=(width()-pixmap->width())/2; - int pix_y=(height()-pixmap->height())/2; - - // XXX positions based on RIP image - int rip_text_x=pix_x+156; - int rip_text_y=pix_y+67; - int rip_text_h=94/riplines; - - QPainter painter; - painter.begin(this); - painter.drawPixmap(pix_x,pix_y,*pixmap); - for (int i=0; imainWidget(),0,FALSE), - keysource(ks), - use_rip(FALSE), - str_fixed(FALSE), - ok("Dismiss",this), - search("Search",this), - lines(new NetHackQtTextListBox(this)), - rip(this) -{ - ok.setDefault(TRUE); - connect(&ok,SIGNAL(clicked()),this,SLOT(accept())); - connect(&search,SIGNAL(clicked()),this,SLOT(Search())); - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); - - QVBoxLayout* vb = new QVBoxLayout(this); - vb->addWidget(&rip); - QHBoxLayout* hb = new QHBoxLayout(vb); - hb->addWidget(&ok); - hb->addWidget(&search); - vb->addWidget(lines); -} - -void NetHackQtTextWindow::doUpdate() -{ - update(); -} - - -NetHackQtTextWindow::~NetHackQtTextWindow() -{ - -} - -QWidget* NetHackQtTextWindow::Widget() -{ - return this; -} - -bool NetHackQtTextWindow::Destroy() -{ - return !isVisible(); -} - -void NetHackQtTextWindow::UseRIP(int how, time_t when) -{ -// Code from X11 windowport -#define STONE_LINE_LEN 16 /* # chars that fit on one line */ -#define NAME_LINE 0 /* line # for player name */ -#define GOLD_LINE 1 /* line # for amount of gold */ -#define DEATH_LINE 2 /* line # for death description */ -#define YEAR_LINE 6 /* line # for year */ - -static char** rip_line=0; - if (!rip_line) { - rip_line=new char*[YEAR_LINE+1]; - for (int i=0; i STONE_LINE_LEN) { - for(i = STONE_LINE_LEN; - ((i0 > STONE_LINE_LEN) && i); i--) - if(dpx[i] == ' ') i0 = i; - if(!i) i0 = STONE_LINE_LEN; - } - tmpchar = dpx[i0]; - dpx[i0] = 0; - strcpy(rip_line[line], dpx); - if (tmpchar != ' ') { - dpx[i0] = tmpchar; - dpx= &dpx[i0]; - } else dpx= &dpx[i0+1]; - } - - /* Put year on stone */ - year = yyyymmdd(when) / 10000L; - Sprintf(rip_line[YEAR_LINE], "%4ld", year); - - rip.setLines(rip_line,YEAR_LINE+1); - - use_rip=TRUE; -} - -void NetHackQtTextWindow::Clear() -{ - lines->clear(); - use_rip=FALSE; - str_fixed=FALSE; -} - -void NetHackQtTextWindow::Display(bool block) -{ - if (str_fixed) { - lines->setFont(qt_settings->normalFixedFont()); - } else { - lines->setFont(qt_settings->normalFont()); - } - - int h=0; - if (use_rip) { - h+=rip.height(); - ok.hide(); - search.hide(); - rip.show(); - } else { - h+=ok.height()*2; - ok.show(); - search.show(); - rip.hide(); - } - int mh = QApplication::desktop()->height()*3/5; - if ( qt_compact_mode && (lines->TotalHeight() > mh || use_rip) ) { - // big, so make it fill - showMaximized(); - } else { - resize(QMAX(use_rip ? rip.width() : 200, - lines->TotalWidth()+24), - QMIN(mh, lines->TotalHeight()+h)); - centerOnMain(this); - show(); - } - if (block) { - setResult(-1); - while (result()==-1) { - qApp->enter_loop(); - if (result()==-1 && !keysource.Empty()) { - char k=keysource.GetAscii(); - if (k=='\033' || k==' ' || k=='\r' || k=='\n') { - accept(); - } else if (k=='/') { - Search(); - } - } - } - } -} - -void NetHackQtTextWindow::PutStr(int attr, const char* text) -{ - str_fixed=str_fixed || strstr(text," "); - lines->insertItem(text); -} - -void NetHackQtTextWindow::done(int i) -{ - setResult(i+1000); - hide(); - qApp->exit_loop(); -} - -void NetHackQtTextWindow::keyPressEvent(QKeyEvent* e) -{ - if ( e->ascii() != '\r' && e->ascii() != '\n' && e->ascii() != '\033' ) - lines->keyPressEvent(e); - else - QDialog::keyPressEvent(e); -} - -void NetHackQtTextWindow::Search() -{ - NetHackQtStringRequestor requestor(keysource,"Search for:"); - static char line[256]=""; - requestor.SetDefault(line); - if (requestor.Get(line)) { - int current=lines->currentItem(); - for (uint i=1; icount(); i++) { - int lnum=(i+current)%lines->count(); - QString str=lines->text(lnum); - if (str.contains(line)) { - lines->setCurrentItem(lnum); - lines->centerCurrentItem(); - return; - } - } - lines->setCurrentItem(-1); - } -} - - -NetHackQtDelay::NetHackQtDelay(int ms) : - msec(ms) -{ -} - -void NetHackQtDelay::wait() -{ - startTimer(msec); - qApp->enter_loop(); -} - -void NetHackQtDelay::timerEvent(QTimerEvent* timer) -{ - qApp->exit_loop(); - killTimers(); -} - -NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : - QWidget(parent) -{ -} - -void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int y, bool canbe) -{ - short int glyph; - if (nhobj) - glyph=obj_to_glyph(nhobj, rn2_on_display_rng); - else if (canbe) - glyph=cmap_to_glyph(S_room); - else - glyph=cmap_to_glyph(S_stone); - - qt_settings->glyphs().drawCell(painter,glyph,x,y); -} - -void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*) -{ - // 012 - // - //0 WhB - //1 s"w - //2 gCg - //3 =A= - //4 T - //5 S - - QPainter painter; - painter.begin(this); - - // Blanks - drawWorn(painter,0,0,4,FALSE); - drawWorn(painter,0,0,5,FALSE); - drawWorn(painter,0,2,4,FALSE); - drawWorn(painter,0,2,5,FALSE); - - drawWorn(painter,uarm,1,3); // Armour - drawWorn(painter,uarmc,1,2); // Cloak - drawWorn(painter,uarmh,1,0); // Helmet - drawWorn(painter,uarms,0,1); // Shield - drawWorn(painter,uarmg,0,2); // Gloves - repeated - drawWorn(painter,uarmg,2,2); // Gloves - repeated - drawWorn(painter,uarmf,1,5); // Shoes (feet) - drawWorn(painter,uarmu,1,4); // Undershirt - drawWorn(painter,uleft,0,3); // RingL - drawWorn(painter,uright,2,3); // RingR - - drawWorn(painter,uwep,2,1); // Weapon - drawWorn(painter,uswapwep,0,0); // Secondary weapon - drawWorn(painter,uamul,1,1); // Amulet - drawWorn(painter,ublindf,2,0); // Blindfold - - painter.end(); -} - -class SmallToolButton : public QToolButton { -public: - SmallToolButton(const QPixmap & pm, const QString &textLabel, - const QString& grouptext, - QObject * receiver, const char* slot, - QToolBar * parent) : - QToolButton(pm, textLabel, -#if QT_VERSION < 210 - QString::null, -#else - grouptext, -#endif - receiver, slot, parent) - { - } - - QSize sizeHint() const - { - // get just a couple more pixels for the map - return QToolButton::sizeHint()-QSize(0,2); - } -}; - - -NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : - message(0), map(0), status(0), invusage(0), - keysink(ks), dirkey(0) -{ - QToolBar* toolbar = new QToolBar(this); -#if QT_VERSION >= 210 - setToolBarsMovable(FALSE); - toolbar->setHorizontalStretchable(TRUE); - toolbar->setVerticalStretchable(TRUE); -#endif - addToolBar(toolbar); - menubar = menuBar(); - - setCaption("Qt NetHack"); - if ( qt_compact_mode ) - setIcon(QPixmap(nh_icon_small)); - else - setIcon(QPixmap(nh_icon)); - - QPopupMenu* game=new QPopupMenu; - QPopupMenu* apparel=new QPopupMenu; - QPopupMenu* act1=new QPopupMenu; - QPopupMenu* act2 = qt_compact_mode ? new QPopupMenu : act1; - QPopupMenu* magic=new QPopupMenu; - QPopupMenu* info=new QPopupMenu; - - QPopupMenu *help; - -#ifdef KDE - help = kapp->getHelpMenu( TRUE, "" ); - help->insertSeparator(); -#else - help = qt_compact_mode ? info : new QPopupMenu; -#endif - - enum { OnDesktop=1, OnHandhelds=2 }; - struct Macro { - QPopupMenu* menu; - const char* name; - const char* action; - int flags; - } item[] = { - { game, 0, 0, 3}, - { game, "Version\tv", "v", 3}, - { game, "Compilation\tAlt+V", "\366", 3}, - { game, "History\tShift+V", "V", 3}, - { game, "Redraw\tCtrl+R", "\022", 0}, // useless - { game, "Options\tShift+O", "O", 3}, - { game, "Explore mode\tShift+X", "X", 3}, - { game, 0, 0, 3}, - { game, "Save\tSy", "Sy", 3}, - { game, "Quit\tAlt+Q", "\361", 3}, - - { apparel, "Apparel off\tShift+A", "A", 2}, - { apparel, "Remove many\tShift+A", "A", 1}, - { apparel, 0, 0, 3}, - { apparel, "Wield weapon\tw", "w", 3}, - { apparel, "Exchange weapons\tx", "x", 3}, - { apparel, "Two weapon combat\t#two", "#tw", 3}, - { apparel, "Load quiver\tShift+Q", "Q", 3}, - { apparel, 0, 0, 3}, - { apparel, "Wear armour\tShift+W", "W", 3}, - { apparel, "Take off armour\tShift+T", "T", 3}, - { apparel, 0, 0, 3}, - { apparel, "Put on non-armour\tShift+P", "P", 3}, - { apparel, "Remove non-armour\tShift+R", "R", 3}, - - { act1, "Again\tCtrl+A", "\001", 2}, - { act1, 0, 0, 3}, - { act1, "Apply\ta?", "a?", 3}, - { act1, "Chat\tAlt+C", "\343", 3}, - { act1, "Close door\tc", "c", 3}, - { act1, "Down\t>", ">", 3}, - { act1, "Drop many\tShift+D", "D", 2}, - { act1, "Drop\td?", "d?", 2}, - { act1, "Eat\te?", "e?", 2}, - { act1, "Engrave\tShift+E", "E", 3}, - { act1, "Fight\tShift+F", "F", 3}, - { act1, "Fire from quiver\tf", "f", 2}, - { act1, "Force\tAlt+F", "\346", 3}, - { act1, "Get\t,", ",", 2}, - { act1, "Jump\tAlt+J", "\352", 3}, - { act2, "Kick\tCtrl+D", "\004", 2}, - { act2, "Loot\tAlt+L", "\354", 3}, - { act2, "Open door\to", "o", 3}, - { act2, "Pay\tp", "p", 3}, - { act2, "Rest\t.", ".", 2}, - { act2, "Ride\t#ri", "#ri", 3}, - { act2, "Search\ts", "s", 3}, - { act2, "Sit\tAlt+S", "\363", 3}, - { act2, "Throw\tt", "t", 2}, - { act2, "Untrap\t#u", "#u", 3}, - { act2, "Up\t<", "<", 3}, - { act2, "Wipe face\tAlt+W", "\367", 3}, - - { magic, "Quaff potion\tq?", "q?", 3}, - { magic, "Read scroll/book\tr?", "r?", 3}, - { magic, "Zap wand\tz?", "z?", 3}, - { magic, "Zap spell\tShift+Z", "Z", 3}, - { magic, "Dip\tAlt+D", "\344", 3}, - { magic, "Rub\tAlt+R", "\362", 3}, - { magic, "Invoke\tAlt+I", "\351", 3}, - { magic, 0, 0, 3}, - { magic, "Offer\tAlt+O", "\357", 3}, - { magic, "Pray\tAlt+P", "\360", 3}, - { magic, 0, 0, 3}, - { magic, "Teleport\tCtrl+T", "\024", 3}, - { magic, "Monster action\tAlt+M", "\355", 3}, - { magic, "Turn undead\tAlt+T", "\364", 3}, - - { help, "Help\t?", "?", 3}, - { help, 0, 0, 3}, - { help, "What is here\t:", ":", 3}, - { help, "What is there\t;", ";", 3}, - { help, "What is...\t/y", "/y", 2}, - { help, 0, 0, 1}, - - { info, "Inventory\ti", "i", 3}, -#ifdef SLASHEM - { info, "Angbandish inventory\t*", "*", 3}, -#endif - { info, "Conduct\t#co", "#co", 3}, - { info, "Discoveries\t\\", "\\", 3}, - { info, "List/reorder spells\t+", "+", 3}, - { info, "Adjust letters\tAlt+A", "\341", 2}, - { info, 0, 0, 3}, - { info, "Name object\tAlt+N", "\356y?", 3}, - { info, "Name object type\tAlt+N", "\356n?", 3}, - { info, "Name creature\tShift+C", "C", 3}, - { info, 0, 0, 3}, - { info, "Qualifications\tAlt+E", "\345", 3}, - - { 0, 0, 0, 0 } - }; - - int i; - int count=0; - for (i=0; item[i].menu; i++) - if (item[i].name) count++; - - macro=new const char* [count]; - - game->insertItem("Qt settings...",1000); - help->insertItem("About Qt NetHack...",2000); - //help->insertItem("NetHack Guidebook...",3000); - help->insertSeparator(); - - count=0; - for (i=0; item[i].menu; i++) { - if ( item[i].flags & (qt_compact_mode ? 1 : 2) ) { - if (item[i].name) { - QString name = item[i].name; - if ( qt_compact_mode ) // accelerators aren't - name.replace(QRegExp("\t.*"),""); - item[i].menu->insertItem(name,count); - macro[count++]=item[i].action; - } else { - item[i].menu->insertSeparator(); - } - } - } - - menubar->insertItem("Game",game); - menubar->insertItem("Gear",apparel); - - if ( qt_compact_mode ) { - menubar->insertItem("A-J",act1); - menubar->insertItem("K-Z",act2); - menubar->insertItem("Magic",magic); - menubar->insertItem(QPixmap(info_xpm),info); - menubar->insertItem(QPixmap(map_xpm), this, SLOT(raiseMap())); - menubar->insertItem(QPixmap(msg_xpm), this, SLOT(raiseMessages())); - menubar->insertItem(QPixmap(stat_xpm), this, SLOT(raiseStatus())); - } else { - menubar->insertItem("Action",act1); - menubar->insertItem("Magic",magic); - menubar->insertItem("Info",info); - menubar->insertSeparator(); - menubar->insertItem("Help",help); - } - - QSignalMapper* sm = new QSignalMapper(this); - connect(sm, SIGNAL(mapped(const QString&)), this, SLOT(doKeys(const QString&))); - QToolButton* tb; - tb = new SmallToolButton( QPixmap(again_xpm),"Again","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "\001" ); - tb = new SmallToolButton( QPixmap(get_xpm),"Get","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "," ); - tb = new SmallToolButton( QPixmap(kick_xpm),"Kick","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "\004" ); - tb = new SmallToolButton( QPixmap(throw_xpm),"Throw","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "t" ); - tb = new SmallToolButton( QPixmap(fire_xpm),"Fire","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "f" ); - tb = new SmallToolButton( QPixmap(drop_xpm),"Drop","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "D" ); - tb = new SmallToolButton( QPixmap(eat_xpm),"Eat","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "e" ); - tb = new SmallToolButton( QPixmap(rest_xpm),"Rest","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "." ); - tb = new SmallToolButton( QPixmap(cast_a_xpm),"Cast A","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Za" ); - tb = new SmallToolButton( QPixmap(cast_b_xpm),"Cast B","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Zb" ); - tb = new SmallToolButton( QPixmap(cast_c_xpm),"Cast C","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Zc" ); - if ( !qt_compact_mode ) { - QWidget* filler = new QWidget(toolbar); - filler->setBackgroundMode(PaletteButton); - toolbar->setStretchableWidget(filler); - } - - connect(menubar,SIGNAL(activated(int)),this,SLOT(doMenuItem(int))); - -#ifdef KDE - setMenu (menubar); -#endif - - int x=0,y=0; - int w=QApplication::desktop()->width()-10; // XXX arbitrary extra space for frame - int h=QApplication::desktop()->height()-50; - - int maxwn; - int maxhn; - if (qt_tilewidth != NULL) { - maxwn = atoi(qt_tilewidth) * COLNO + 10; - } else { - maxwn = 1400; - } - if (qt_tileheight != NULL) { - maxhn = atoi(qt_tileheight) * ROWNO * 6/4; - } else { - maxhn = 1024; - } - - // Be exactly the size we want to be - full map... - if (w>maxwn) { - x+=(w-maxwn)/2; - w=maxwn; // Doesn't need to be any wider - } - if (h>maxhn) { - y+=(h-maxhn)/2; - h=maxhn; // Doesn't need to be any taller - } - - setGeometry(x,y,w,h); - - if ( qt_compact_mode ) { - stack = new QWidgetStack(this); - setCentralWidget(stack); - } else { - setCentralWidget(new QWidget(this)); - invusage = new NetHackQtInvUsageWindow(centralWidget()); - } -} - -void NetHackQtMainWindow::zoomMap() -{ - qt_settings->toggleGlyphSize(); -} - -void NetHackQtMainWindow::raiseMap() -{ - if ( stack->id(stack->visibleWidget()) == 0 ) { - zoomMap(); - } else { - stack->raiseWidget(0); - } -} - -void NetHackQtMainWindow::raiseMessages() -{ - stack->raiseWidget(1); -} - -void NetHackQtMainWindow::raiseStatus() -{ - stack->raiseWidget(2); -} - -class NetHackMimeSourceFactory : public QMimeSourceFactory { -public: - const QMimeSource* data(const QString& abs_name) const - { - const QMimeSource* r = 0; - if ( (NetHackMimeSourceFactory*)this == QMimeSourceFactory::defaultFactory() ) - r = QMimeSourceFactory::data(abs_name); - else - r = QMimeSourceFactory::defaultFactory()->data(abs_name); - if ( !r ) { - int sl = abs_name.length(); - do { - sl = abs_name.findRev('/',sl-1); - QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; - int dot = name.findRev('.'); - if ( dot >= 0 ) - name = name.left(dot); - if ( name == "map" ) - r = new QImageDrag(QImage(map_xpm)); - else if ( name == "msg" ) - r = new QImageDrag(QImage(msg_xpm)); - else if ( name == "stat" ) - r = new QImageDrag(QImage(stat_xpm)); - } while (!r && sl>0); - } - return r; - } -}; - -void NetHackQtMainWindow::doMenuItem(int id) -{ - switch (id) { - case 1000: - centerOnMain(qt_settings); - qt_settings->show(); - break; - case 2000: - QMessageBox::about(this, "About Qt NetHack", aboutMsg()); - break; - case 3000: { - QDialog dlg(this,0,TRUE); - (new QVBoxLayout(&dlg))->setAutoAdd(TRUE); - QTextBrowser browser(&dlg); - NetHackMimeSourceFactory ms; - browser.setMimeSourceFactory(&ms); - browser.setSource(QDir::currentDirPath()+"/Guidebook.html"); - if ( qt_compact_mode ) - dlg.showMaximized(); - dlg.exec(); - } - break; - default: - if ( id >= 0 ) - doKeys(macro[id]); - } -} - -void NetHackQtMainWindow::doKeys(const QString& k) -{ - keysink.Put(k); - qApp->exit_loop(); -} - -void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window) -{ - message=window; - ShowIfReady(); -} - -void NetHackQtMainWindow::AddMapWindow(NetHackQtMapWindow* window) -{ - map=window; - ShowIfReady(); - connect(map,SIGNAL(resized()),this,SLOT(layout())); -} - -void NetHackQtMainWindow::AddStatusWindow(NetHackQtStatusWindow* window) -{ - status=window; - ShowIfReady(); -} - -void NetHackQtMainWindow::RemoveWindow(NetHackQtWindow* window) -{ - if (window==status) { - status=0; - ShowIfReady(); - } else if (window==map) { - map=0; - ShowIfReady(); - } else if (window==message) { - message=0; - ShowIfReady(); - } -} - -void NetHackQtMainWindow::updateInventory() -{ - if ( invusage ) - invusage->repaint(FALSE); -} - -void NetHackQtMainWindow::fadeHighlighting() -{ - if (status) { - status->fadeHighlighting(); - } -} - -void NetHackQtMainWindow::layout() -{ - if ( qt_compact_mode ) - return; - if (message && map && status) { - QSize maxs=map->Widget()->maximumSize(); - int maph=QMIN(height()*2/3,maxs.height()); - - QWidget* c = centralWidget(); - int h=c->height(); - int toph=h-maph; - int iuw=3*qt_settings->glyphs().width(); - int topw=(c->width()-iuw)/2; - - message->Widget()->setGeometry(0,0,topw,toph); - invusage->setGeometry(topw,0,iuw,toph); - status->Widget()->setGeometry(topw+iuw,0,topw,toph); - map->Widget()->setGeometry(QMAX(0,(c->width()-maxs.width())/2), - toph,c->width(),maph); - } -} - -void NetHackQtMainWindow::resizeEvent(QResizeEvent*) -{ - layout(); -#ifdef KDE - updateRects(); -#endif -} - -void NetHackQtMainWindow::keyReleaseEvent(QKeyEvent* event) -{ - if ( dirkey ) { - doKeys(QString(QChar(dirkey))); - if ( !event->isAutoRepeat() ) - dirkey = 0; - } -} - -void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event) -{ - // Global key controls - - // For desktop, arrow keys scroll map, since we don't want players - // to think that's the way to move. For handhelds, the normal way is to - // click-to-travel, so we allow the cursor keys for fine movements. - - // 321 - // 4 0 - // 567 - - if ( event->isAutoRepeat() && - event->key() >= Key_Left && event->key() <= Key_Down ) - return; - - const char* d = Cmd.dirchars; - switch (event->key()) { - case Key_Up: - if ( dirkey == d[0] ) - dirkey = d[1]; - else if ( dirkey == d[4] ) - dirkey = d[3]; - else - dirkey = d[2]; - break; case Key_Down: - if ( dirkey == d[0] ) - dirkey = d[7]; - else if ( dirkey == d[4] ) - dirkey = d[5]; - else - dirkey = d[6]; - break; case Key_Left: - if ( dirkey == d[2] ) - dirkey = d[1]; - else if ( dirkey == d[6] ) - dirkey = d[7]; - else - dirkey = d[0]; - break; case Key_Right: - if ( dirkey == d[2] ) - dirkey = d[3]; - else if ( dirkey == d[6] ) - dirkey = d[5]; - else - dirkey = d[4]; - break; case Key_Prior: - dirkey = 0; - if (message) message->Scroll(0,-1); - break; case Key_Next: - dirkey = 0; - if (message) message->Scroll(0,+1); - break; case Key_Space: - if ( flags.rest_on_space ) { - event->ignore(); - return; - } - case Key_Enter: - if ( map ) - map->clickCursor(); - break; default: - dirkey = 0; - event->ignore(); - } -} - -void NetHackQtMainWindow::closeEvent(QCloseEvent* e) -{ - if ( g.program_state.something_worth_saving ) { - switch ( QMessageBox::information( this, "NetHack", - "This will end your NetHack session", - "&Save", "&Cancel", 0, 1 ) ) - { - case 0: - // See dosave() function - if (dosave0()) { - u.uhp = -1; - NetHackQtBind::qt_exit_nhwindows(0); - nh_terminate(EXIT_SUCCESS); - } - break; - case 1: - break; // ignore the event - } - } else { - e->accept(); - } -} - -void NetHackQtMainWindow::ShowIfReady() -{ - if (message && map && status) { - QPoint pos(0,0); - QWidget* p = qt_compact_mode ? stack : centralWidget(); - message->Widget()->recreate(p,0,pos); - map->Widget()->recreate(p,0,pos); - status->Widget()->recreate(p,0,pos); - if ( qt_compact_mode ) { - message->setMap(map); - stack->addWidget(map->Widget(), 0); - stack->addWidget(message->Widget(), 1); - stack->addWidget(status->Widget(), 2); - raiseMap(); - } else { - layout(); - } - showMaximized(); - } else if (isVisible()) { - hide(); - } -} - - -NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) : - QDialog(qApp->mainWidget(),0,FALSE), - question(q), choices(ch), def(df), - keysource(keysrc) -{ - setCaption("NetHack: Question"); -} - -char NetHackQtYnDialog::Exec() -{ - QString ch(choices); - int ch_per_line=6; - QString qlabel; - QString enable; - if ( qt_compact_mode && !choices ) { - // expand choices from prompt - // ##### why isn't choices set properly??? - const char* c=question; - while ( *c && *c != '[' ) - c++; - qlabel = QString(question).left(c-question); - if ( *c ) { - c++; - if ( *c == '-' ) - ch.append(*c++); - char from=0; - while ( *c && *c != ']' && *c != ' ' ) { - if ( *c == '-' ) { - from = c[-1]; - } else if ( from ) { - for (char f=from+1; f<=*c; f++) - ch.append(f); - from = 0; - } else { - ch.append(*c); - from = 0; - } - c++; - } - if ( *c == ' ' ) { - while ( *c && *c != ']' ) { - if ( *c == '*' || *c == '?' ) - ch.append(*c); - c++; - } - } - } - if ( strstr(question, "what direction") ) { - // We replace this regardless, since sometimes you get choices. - const char* d = Cmd.dirchars; - enable=ch; - ch=""; - ch.append(d[1]); - ch.append(d[2]); - ch.append(d[3]); - ch.append(d[0]); - ch.append('.'); - ch.append(d[4]); - ch.append(d[7]); - ch.append(d[6]); - ch.append(d[5]); - ch.append(d[8]); - ch.append(d[9]); - ch_per_line = 3; - def = ' '; - } else { - // Hmm... they'll have to use a virtual keyboard - } - } else { - qlabel = question; - } - if (!ch.isNull()) { - QVBoxLayout vb(this); - vb.setAutoAdd(TRUE); - bool bigq = qlabel.length()>40; - if ( bigq ) { - QLabel* q = new QLabel(qlabel,this); - q->setAlignment(AlignLeft|WordBreak); - q->setMargin(4); - } - QButtonGroup group(ch_per_line, Horizontal, - bigq ? QString::null : qlabel, this); - - int nchoices=ch.length(); - - bool allow_count=ch.contains('#'); - - const int margin=8; - const int gutter=8; - const int extra=fontMetrics().height(); // Extra for group - int x=margin, y=extra+margin; - int butsize=fontMetrics().height()*2+5; - - QPushButton* button; - for (int i=0; isetEnabled(FALSE); - } - button->setFixedSize(butsize,butsize); // Square - if (ch[i]==def) button->setDefault(TRUE); - if (i%10==9) { - // last in row - x=margin; - y+=butsize+gutter; - } else { - x+=butsize+gutter; - } - } - - connect(&group,SIGNAL(clicked(int)),this,SLOT(doneItem(int))); - - QLabel* lb=0; - QLineEdit* le=0; - - if (allow_count) { - QHBox *hb = new QHBox(this); - lb=new QLabel("Count: ",hb); - le=new QLineEdit(hb); - } - - adjustSize(); - centerOnMain(this); - show(); - char choice=0; - char ch_esc=0; - for (uint i=0; i= 1000 ) { - choice = ch[result() - 1000].latin1(); - } - if ( !choice ) - qApp->enter_loop(); - } - hide(); - if (allow_count && !le->text().isEmpty()) { - yn_number=atoi(le->text()); - choice='#'; - } - return choice; - } else { - QLabel label(qlabel,this); - QPushButton cancel("Dismiss",this); - label.setFrameStyle(QFrame::Box|QFrame::Sunken); - label.setAlignment(AlignCenter); - label.resize(fontMetrics().width(qlabel)+60,30+fontMetrics().height()); - cancel.move(width()/2-cancel.width()/2,label.geometry().bottom()+8); - connect(&cancel,SIGNAL(clicked()),this,SLOT(reject())); - centerOnMain(this); - setResult(-1); - show(); - while (result()<0 && keysource.Empty()) { - qApp->enter_loop(); - } - hide(); - if (keysource.Empty()) { - return '\033'; - } else { - return keysource.GetAscii(); - } - } -} -void NetHackQtYnDialog::keyPressEvent(QKeyEvent* event) -{ - // Don't want QDialog's Return/Esc behaviour - event->ignore(); -} - -void NetHackQtYnDialog::doneItem(int i) -{ - done(i+1000); -} - -void NetHackQtYnDialog::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -NetHackQtGlyphs::NetHackQtGlyphs() -{ - const char* tile_file = "nhtiles.bmp"; - if ( iflags.wc_tile_file ) - tile_file = iflags.wc_tile_file; - - if (!img.load(tile_file)) { - tile_file = "x11tiles"; - if (!img.load(tile_file)) { - QString msg; - msg.sprintf("Cannot load x11tiles or nhtiles.bmp"); - QMessageBox::warning(0, "IO Error", msg); - } else { - tiles_per_row = TILES_PER_ROW; - if (img.width()%tiles_per_row) { - impossible( - "Tile file \"%s\" has %d columns, not multiple of row count (%d)", - tile_file, img.width(), tiles_per_row); - } - } - } else { - tiles_per_row = 40; - } - - if ( iflags.wc_tile_width ) - tilefile_tile_W = iflags.wc_tile_width; - else - tilefile_tile_W = img.width() / tiles_per_row; - if ( iflags.wc_tile_height ) - tilefile_tile_H = iflags.wc_tile_height; - else - tilefile_tile_H = tilefile_tile_W; - - setSize(tilefile_tile_W, tilefile_tile_H); -} - -void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y) -{ - int tile = glyph2tile[glyph]; - int px = (tile%tiles_per_row)*width(); - int py = tile/tiles_per_row*height(); - - painter.drawPixmap( - x, - y, - pm, - px,py, - width(),height() - ); -} -void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, int cellx, int celly) -{ - drawGlyph(painter,glyph,cellx*width(),celly*height()); -} -void NetHackQtGlyphs::setSize(int w, int h) -{ - if ( size == QSize(w,h) ) - return; - - bool was1 = size == pm1.size(); - size = QSize(w,h); - if (!w || !h) - return; // Still not decided - - if ( size == pm1.size() ) { - pm = pm1; - return; - } - if ( size == pm2.size() ) { - pm = pm2; - return; - } - - if (w==tilefile_tile_W && h==tilefile_tile_H) { - pm.convertFromImage(img); - } else { - QApplication::setOverrideCursor( Qt::waitCursor ); - QImage scaled = img.smoothScale( - w*img.width()/tilefile_tile_W, - h*img.height()/tilefile_tile_H - ); - pm.convertFromImage(scaled,Qt::ThresholdDither|Qt::PreferDither); - QApplication::restoreOverrideCursor(); - } - (was1 ? pm2 : pm1) = pm; -} - - -////////////////////////////////////////////////////////////// -// -// The ugly C binding classes... -// -////////////////////////////////////////////////////////////// - - -NetHackQtMenuOrTextWindow::NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer& ks) : - actual(0), - keysource(ks) -{ -} - -QWidget* NetHackQtMenuOrTextWindow::Widget() -{ - if (!actual) impossible("Widget called before we know if Menu or Text"); - return actual->Widget(); -} - -// Text -void NetHackQtMenuOrTextWindow::Clear() -{ - if (!actual) - impossible("Clear called before we know if Menu or Text"); - else - actual->Clear(); -} - -void NetHackQtMenuOrTextWindow::Display(bool block) -{ - if (!actual) - impossible("Display called before we know if Menu or Text"); - else - actual->Display(block); -} - -bool NetHackQtMenuOrTextWindow::Destroy() -{ - bool res = FALSE; - - if (!actual) - impossible("Destroy called before we know if Menu or Text"); - else - res = actual->Destroy(); - - return res; -} - -void NetHackQtMenuOrTextWindow::PutStr(int attr, const char* text) -{ - if (!actual) actual=new NetHackQtTextWindow(keysource); - actual->PutStr(attr,text); -} - -// Menu -void NetHackQtMenuOrTextWindow::StartMenu() -{ - if (!actual) actual=new NetHackQtMenuWindow(keysource); - actual->StartMenu(); -} - -void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const char* str, bool presel) -{ - if (!actual) impossible("AddMenu called before we know if Menu or Text"); - actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); -} - -void NetHackQtMenuOrTextWindow::EndMenu(const char* prompt) -{ - if (!actual) impossible("EndMenu called before we know if Menu or Text"); - actual->EndMenu(prompt); -} - -int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) -{ - if (!actual) impossible("SelectMenu called before we know if Menu or Text"); - return actual->SelectMenu(how,menu_list); -} - - -// XXX Should be from Options -// -// XXX Hmm. Tricky part is that perhaps some macros should only be active -// XXX when a key is about to be gotten. For example, the user could -// XXX define "-" to do "E-yyyyyyyy\r", but would still need "-" for -// XXX other purposes. Maybe just too bad. -// -struct { - int key; - int state; - const char* macro; -} key_macro[]={ - { Qt::Key_F1, 0, "n100." }, // Rest (x100) - { Qt::Key_F2, 0, "n20s" }, // Search (x20) - { Qt::Key_F3, 0, "o8o4o6o2o8o4o6o2o8o4o6o2" }, // Open all doors (x3) - { Qt::Key_Tab, 0, "\001" }, - { 0, 0, 0 } -}; - - -NetHackQtBind::NetHackQtBind(int& argc, char** argv) : -#ifdef KDE - KApplication(argc,argv) -#elif defined(QWS) // not quite the right condition - QPEApplication(argc,argv) -#else - QApplication(argc,argv) -#endif -{ - QPixmap pm("nhsplash.xpm"); - if ( iflags.wc_splash_screen && !pm.isNull() ) { - QVBox *vb = new QVBox(0,0, - WStyle_Customize | WStyle_NoBorder | nh_WX11BypassWM | WStyle_StaysOnTop ); - splash = vb; - QLabel *lsplash = new QLabel(vb); - lsplash->setAlignment(AlignCenter); - lsplash->setPixmap(pm); - QLabel* capt = new QLabel("Loading...",vb); - capt->setAlignment(AlignCenter); - if ( pm.mask() ) { - lsplash->setFixedSize(pm.size()); - lsplash->setMask(*pm.mask()); - } - splash->move((QApplication::desktop()->width()-pm.width())/2, - (QApplication::desktop()->height()-pm.height())/2); - //splash->setGeometry(0,0,100,100); - if ( qt_compact_mode ) { - splash->showMaximized(); - } else { - vb->setFrameStyle(QFrame::WinPanel|QFrame::Raised); - vb->setMargin(10); - splash->adjustSize(); - splash->show(); - } - - // force content refresh outside event loop - splash->repaint(FALSE); - lsplash->repaint(FALSE); - capt->repaint(FALSE); - qApp->flushX(); - - } else { - splash = 0; - } - main = new NetHackQtMainWindow(keybuffer); -#if defined(QWS) // not quite the right condition - showMainWidget(main); -#else - setMainWidget(main); -#endif - qt_settings=new NetHackQtSettings(main->width(),main->height()); -} - -void NetHackQtBind::qt_init_nhwindows(int* argc, char** argv) -{ -#ifdef UNIX -// Userid control -// -// Michael Hohmuth ... -// -// As the game runs setuid games, it must seteuid(getuid()) before -// calling XOpenDisplay(), and reset the euid afterwards. -// Otherwise, it can't read the $HOME/.Xauthority file and whines about -// not being able to open the X display (if a magic-cookie -// authorization mechanism is being used). - - uid_t gamesuid=geteuid(); - seteuid(getuid()); -#endif - - QApplication::setColorSpec(ManyColor); - instance=new NetHackQtBind(*argc,argv); - -#ifdef UNIX - seteuid(gamesuid); -#endif - -#ifdef _WS_WIN_ - // This nethack engine feature should be moved into windowport API - nt_kbhit = NetHackQtBind::qt_kbhit; -#endif -} - -int NetHackQtBind::qt_kbhit() -{ - return !keybuffer.Empty(); -} - -static bool have_asked = FALSE; - -void NetHackQtBind::qt_player_selection() -{ - if ( !have_asked ) - qt_askname(); -} - -NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : - QDialog(qApp->mainWidget(),"sgsel",TRUE) -{ - QVBoxLayout *vbl = new QVBoxLayout(this,6); - QHBox* hb; - - QLabel* logo = new QLabel(this); vbl->addWidget(logo); - logo->setAlignment(AlignCenter); - logo->setPixmap(QPixmap("nhsplash.xpm")); - QLabel* attr = new QLabel("by the NetHack DevTeam",this); - attr->setAlignment(AlignCenter); - vbl->addWidget(attr); - vbl->addStretch(2); - /* - QLabel* logo = new QLabel(hb); - hb = new QHBox(this); - vbl->addWidget(hb, AlignCenter); - logo->setPixmap(QPixmap(nh_icon)); - logo->setAlignment(AlignRight|AlignVCenter); - new QLabel(nh_attribution,hb); - */ - - hb = new QHBox(this); - vbl->addWidget(hb, AlignCenter); - QPushButton* q = new QPushButton("Quit",hb); - connect(q, SIGNAL(clicked()), this, SLOT(reject())); - QPushButton* c = new QPushButton("New Game",hb); - connect(c, SIGNAL(clicked()), this, SLOT(accept())); - c->setDefault(TRUE); - - QButtonGroup* bg = new QButtonGroup(3, Horizontal, "Saved Characters",this); - vbl->addWidget(bg); - connect(bg, SIGNAL(clicked(int)), this, SLOT(done(int))); - for (int i=0; saved[i]; i++) { - QPushButton* b = new QPushButton(saved[i],bg); - bg->insert(b, i+2); - } -} - -int NetHackQtSavedGameSelector::choose() -{ -#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). - if ( qt_compact_mode ) - showMaximized(); -#endif - return exec()-2; -} - -void NetHackQtBind::qt_askname() -{ - have_asked = TRUE; - - // We do it all here, and nothing in askname - - char** saved = get_saved_games(); - int ch = -1; - if ( saved && *saved ) { - if ( splash ) splash->hide(); - NetHackQtSavedGameSelector sgsel((const char**)saved); - ch = sgsel.choose(); - if ( ch >= 0 ) - strcpy(g.plname,saved[ch]); - } - free_saved_games(saved); - - switch (ch) { - case -1: - if ( splash ) splash->hide(); - if (NetHackQtPlayerSelector(keybuffer).Choose()) - return; - case -2: - break; - default: - return; - } - - // Quit - clearlocks(); - qt_exit_nhwindows(0); - nh_terminate(0); -} - -void NetHackQtBind::qt_get_nh_event() -{ -} - -#if defined(QWS) -// Kludge to access lastWindowClosed() signal. -class TApp : public QApplication { -public: - TApp(int& c, char**v) : QApplication(c,v) {} - void lwc() { emit lastWindowClosed(); } -}; -#endif - -void NetHackQtBind::qt_exit_nhwindows(const char *) -{ -#if defined(QWS) - // Avoids bug in SHARP SL5500 - ((TApp*)qApp)->lwc(); - qApp->quit(); -#endif - - delete instance; // ie. qApp -} - -void NetHackQtBind::qt_suspend_nhwindows(const char *) -{ -} - -void NetHackQtBind::qt_resume_nhwindows() -{ -} - -static QArray id_to_window; - -winid NetHackQtBind::qt_create_nhwindow(int type) -{ - winid id; - for (id = 0; id < (winid) id_to_window.size(); id++) { - if ( !id_to_window[id] ) - break; - } - if ( id == (winid) id_to_window.size() ) - id_to_window.resize(id+1); - - NetHackQtWindow* window=0; - - switch (type) { - case NHW_MAP: { - NetHackQtMapWindow* w=new NetHackQtMapWindow(clickbuffer); - main->AddMapWindow(w); - window=w; - } break; case NHW_MESSAGE: { - NetHackQtMessageWindow* w=new NetHackQtMessageWindow; - main->AddMessageWindow(w); - window=w; - } break; case NHW_STATUS: { - NetHackQtStatusWindow* w=new NetHackQtStatusWindow; - main->AddStatusWindow(w); - window=w; - } break; case NHW_MENU: - window=new NetHackQtMenuOrTextWindow(keybuffer); - break; case NHW_TEXT: - window=new NetHackQtTextWindow(keybuffer); - } - - window->nhid = id; - - // Note: use of isHidden does not work with Qt 2.1 - if ( splash -#if QT_VERSION >= 300 - && !main->isHidden() -#else - && main->isVisible() -#endif - ) - { - delete splash; - splash = 0; - } - - id_to_window[id] = window; - return id; -} - -void NetHackQtBind::qt_clear_nhwindow(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->Clear(); -} - -void NetHackQtBind::qt_display_nhwindow(winid wid, BOOLEAN_P block) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->Display(block); -} - -void NetHackQtBind::qt_destroy_nhwindow(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - main->RemoveWindow(window); - if (window->Destroy()) - delete window; - id_to_window[wid] = 0; -} - -void NetHackQtBind::qt_curs(winid wid, int x, int y) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->CursorTo(x,y); -} - -void NetHackQtBind::qt_putstr(winid wid, int attr, const char *text) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->PutStr(attr,text); -} - -void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) -{ - NetHackQtTextWindow* window=new NetHackQtTextWindow(keybuffer); - bool complain = FALSE; - -#ifdef DLB - { - dlb *f; - char buf[BUFSZ]; - char *cr; - - window->Clear(); - f = dlb_fopen(filename, "r"); - if (!f) { - complain = must_exist; - } else { - while (dlb_fgets(buf, BUFSZ, f)) { - if ((cr = index(buf, '\n')) != 0) *cr = 0; -#ifdef MSDOS - if ((cr = index(buf, '\r')) != 0) *cr = 0; -#endif - if (index(buf, '\t') != 0) (void) tabexpand(buf); - window->PutStr(ATR_NONE, buf); - } - window->Display(FALSE); - (void) dlb_fclose(f); - } - } -#else - QFile file(filename); - - if (file.open(IO_ReadOnly)) { - char line[128]; - while (file.readLine(line,127) >= 0) { - line[strlen(line)-1]=0;// remove newline - window->PutStr(ATR_NONE,line); - } - window->Display(FALSE); - } else { - complain = must_exist; - } -#endif - - if (complain) { - QString message; - message.sprintf("File not found: %s\n",filename); - QMessageBox::message("File Error", (const char*)message, "Ignore"); - } -} - -void NetHackQtBind::qt_start_menu(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->StartMenu(); -} - -void NetHackQtBind::qt_add_menu(winid wid, int glyph, - const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, BOOLEAN_P presel) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); -} - -void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->EndMenu(prompt); -} - -int NetHackQtBind::qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list) -{ - NetHackQtWindow* window=id_to_window[wid]; - return window->SelectMenu(how,menu_list); -} - -void NetHackQtBind::qt_update_inventory() -{ - if (main) - main->updateInventory(); - /* doesn't work yet - if (g.program_state.something_worth_saving && iflags.perm_invent) - display_inventory(NULL, FALSE); - */ -} - -void NetHackQtBind::qt_mark_synch() -{ -} - -void NetHackQtBind::qt_wait_synch() -{ -} - -void NetHackQtBind::qt_cliparound(int x, int y) -{ - // XXXNH - winid should be a parameter! - qt_cliparound_window(WIN_MAP,x,y); -} - -void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->ClipAround(x,y); -} -void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, int bkglyph) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->PrintGlyph(x,y,glyph); -} -//void NetHackQtBind::qt_print_glyph_compose(winid wid,XCHAR_P x,XCHAR_P y,int glyph1, int glyph2) -//{ - //NetHackQtWindow* window=id_to_window[wid]; - //window->PrintGlyphCompose(x,y,glyph1,glyph2); -//} - -void NetHackQtBind::qt_raw_print(const char *str) -{ - puts(str); -} - -void NetHackQtBind::qt_raw_print_bold(const char *str) -{ - puts(str); -} - -int NetHackQtBind::qt_nhgetch() -{ - if (main) - main->fadeHighlighting(); - - // Process events until a key arrives. - // - while (keybuffer.Empty() -#ifdef SAFERHANGUP - && !g.program_state.done_hup -#endif - ) { - qApp->enter_loop(); - } - -#ifdef SAFERHANGUP - if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; -#endif - return keybuffer.GetAscii(); -} - -int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod) -{ - if (main) - main->fadeHighlighting(); - - // Process events until a key or map-click arrives. - // - while (keybuffer.Empty() && clickbuffer.Empty() -#ifdef SAFERHANGUP - && !g.program_state.done_hup -#endif - ) { - qApp->enter_loop(); - } -#ifdef SAFERHANGUP - if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; -#endif - if (!keybuffer.Empty()) { - return keybuffer.GetAscii(); - } else { - *x=clickbuffer.NextX(); - *y=clickbuffer.NextY(); - *mod=clickbuffer.NextMod(); - clickbuffer.Get(); - return 0; - } -} - -void NetHackQtBind::qt_nhbell() -{ - QApplication::beep(); -} - -int NetHackQtBind::qt_doprev_message() -{ - // Don't need it - uses scrollbar - // XXX but could make this a shortcut - return 0; -} - -char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CHAR_P def) -{ - if (qt_settings->ynInMessages() && WIN_MESSAGE!=WIN_ERR) { - // Similar to X11 windowport `slow' feature. - - char message[BUFSZ]; - char yn_esc_map='\033'; - - if (choices) { - char *cb, choicebuf[QBUFSZ]; - Strcpy(choicebuf, choices); - if ((cb = index(choicebuf, '\033')) != 0) { - // anything beyond is hidden - *cb = '\0'; - } - (void)strncpy(message, question, QBUFSZ-1); - message[QBUFSZ-1] = '\0'; - Sprintf(eos(message), " [%s]", choicebuf); - if (def) Sprintf(eos(message), " (%c)", def); - Strcat(message, " "); - // escape maps to 'q' or 'n' or default, in that order - yn_esc_map = (index(choices, 'q') ? 'q' : - (index(choices, 'n') ? 'n' : def)); - } else { - Strcpy(message, question); - } - -#ifdef USE_POPUPS - // Improve some special-cases (DIRKS 08/02/23) - if (strcmp (choices,"ynq") == 0) { - switch (QMessageBox::information (qApp->mainWidget(),"NetHack",question,"&Yes","&No","&Quit",0,2)) - { - case 0: return 'y'; - case 1: return 'n'; - case 2: return 'q'; - } - } - - if (strcmp (choices,"yn") == 0) { - switch (QMessageBox::information(qApp->mainWidget(),"NetHack",question,"&Yes", "&No",0,1)) - { - case 0: return 'y'; - case 1: return 'n'; - } - } -#endif - - NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, message); - - int result=-1; - while (result<0) { - char ch=NetHackQtBind::qt_nhgetch(); - if (ch=='\033') { - result=yn_esc_map; - } else if (choices && !index(choices,ch)) { - if (def && (ch==' ' || ch=='\r' || ch=='\n')) { - result=def; - } else { - NetHackQtBind::qt_nhbell(); - // and try again... - } - } else { - result=ch; - } - } - - NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE); - - return result; - } else { - NetHackQtYnDialog dialog(keybuffer,question,choices,def); - return dialog.Exec(); - } -} - -void NetHackQtBind::qt_getlin(const char *prompt, char *line) -{ - NetHackQtStringRequestor requestor(keybuffer,prompt); - if (!requestor.Get(line)) { - line[0]=0; - } -} - -NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks) : - QDialog(qApp->mainWidget(), "ext-cmd", FALSE), - keysource(ks) -{ - int marg=4; - QVBoxLayout *l = new QVBoxLayout(this,marg,marg); - - QPushButton* can = new QPushButton("Cancel", this); - can->setDefault(TRUE); - can->setMinimumSize(can->sizeHint()); - l->addWidget(can); - - QButtonGroup *group=new QButtonGroup("",0); - QGroupBox *grid=new QGroupBox("Extended commands",this); - l->addWidget(grid); - - int i; - int butw=50; - QFontMetrics fm = fontMetrics(); - for (i=0; extcmdlist[i].ef_txt; i++) { - butw = QMAX(butw,30+fm.width(extcmdlist[i].ef_txt)); - } - int ncols=4; - int nrows=(i+ncols-1)/ncols; - - QVBoxLayout* bl = new QVBoxLayout(grid,marg); - bl->addSpacing(fm.height()); - QGridLayout* gl = new QGridLayout(nrows,ncols,marg); - bl->addLayout(gl); - for (i=0; extcmdlist[i].ef_txt; i++) { - QPushButton* pb=new QPushButton(extcmdlist[i].ef_txt, grid); - pb->setMinimumSize(butw,pb->sizeHint().height()); - group->insert(pb); - gl->addWidget(pb,i/ncols,i%ncols); - } - connect(group,SIGNAL(clicked(int)),this,SLOT(done(int))); - - bl->activate(); - l->activate(); - resize(1,1); - - connect(can,SIGNAL(clicked()),this,SLOT(cancel())); -} - -void NetHackQtExtCmdRequestor::cancel() -{ - setResult(-1); - qApp->exit_loop(); -} - -void NetHackQtExtCmdRequestor::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -int NetHackQtExtCmdRequestor::get() -{ - const int none = -10; - char str[32]; - int cursor=0; - resize(1,1); // pack - centerOnMain(this); - show(); - setResult(none); - while (result()==none) { - while (result()==none && !keysource.Empty()) { - char k=keysource.GetAscii(); - if (k=='\r' || k=='\n' || k==' ' || k=='\033') { - setResult(-1); - } else { - str[cursor++] = k; - int r=-1; - for (int i=0; extcmdlist[i].ef_txt; i++) { - if (qstrnicmp(str, extcmdlist[i].ef_txt, cursor)==0) { - if ( r == -1 ) - r = i; - else - r = -2; - } - } - if ( r == -1 ) { // no match! - QApplication::beep(); - cursor=0; - } else if ( r != -2 ) { // only one match - setResult(r); - } - } - } - if (result()==none) - qApp->enter_loop(); - } - hide(); - return result(); -} - - -int NetHackQtBind::qt_get_ext_cmd() -{ - NetHackQtExtCmdRequestor requestor(keybuffer); - return requestor.get(); -} - -void NetHackQtBind::qt_number_pad(int) -{ - // Ignore. -} - -void NetHackQtBind::qt_delay_output() -{ - NetHackQtDelay delay(15); - delay.wait(); -} - -void NetHackQtBind::qt_start_screen() -{ - // Ignore. -} - -void NetHackQtBind::qt_end_screen() -{ - // Ignore. -} - -void NetHackQtBind::qt_outrip(winid wid, int how, time_t when) -{ - NetHackQtWindow* window=id_to_window[wid]; - - window->UseRIP(how, when); -} - -bool NetHackQtBind::notify(QObject *receiver, QEvent *event) -{ - // Ignore Alt-key navigation to menubar, it's annoying when you - // use Alt-Direction to move around. - if ( main && event->type()==QEvent::KeyRelease && main==receiver - && ((QKeyEvent*)event)->key() == Key_Alt ) - return TRUE; - - bool result=QApplication::notify(receiver,event); -#ifdef SAFERHANGUP - if (g.program_state.done_hup) { - keybuffer.Put('\033'); - qApp->exit_loop(); - return TRUE; - } -#endif - if (event->type()==QEvent::KeyPress) { - QKeyEvent* key_event=(QKeyEvent*)event; - - if (!key_event->isAccepted()) { - const int k=key_event->key(); - bool macro=FALSE; - for (int i=0; !macro && key_macro[i].key; i++) { - if (key_macro[i].key==k - && ((key_macro[i].state&key_event->state())==key_macro[i].state)) - { - keybuffer.Put(key_macro[i].macro); - macro=TRUE; - } - } - char ch=key_event->ascii(); - if ( !ch && (key_event->state() & Qt::ControlButton) ) { - // On Mac, it aint-ncessarily-control - if ( k>=Qt::Key_A && k<=Qt::Key_Z ) - ch = k - Qt::Key_A + 1; - } - if (!macro && ch) { - bool alt = (key_event->state()&AltButton) || - (k >= Key_0 && k <= Key_9 && (key_event->state()&ControlButton)); - keybuffer.Put(key_event->key(),ch + (alt ? 128 : 0), - key_event->state()); - key_event->accept(); - result=TRUE; - } - - if (ch || macro) { - qApp->exit_loop(); - } - } - } - return result; -} - -NetHackQtBind* NetHackQtBind::instance=0; -NetHackQtKeyBuffer NetHackQtBind::keybuffer; -NetHackQtClickBuffer NetHackQtBind::clickbuffer; -NetHackQtMainWindow* NetHackQtBind::main=0; -QWidget* NetHackQtBind::splash=0; - - -extern "C" struct window_procs Qt_procs; - -struct window_procs Qt_procs = { - "Qt", - WC_COLOR|WC_HILITE_PET| - WC_ASCII_MAP|WC_TILED_MAP| - WC_FONT_MAP|WC_TILE_FILE|WC_TILE_WIDTH|WC_TILE_HEIGHT| - WC_PLAYER_SELECTION|WC_SPLASH_SCREEN, - 0L, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ - NetHackQtBind::qt_init_nhwindows, - NetHackQtBind::qt_player_selection, - NetHackQtBind::qt_askname, - NetHackQtBind::qt_get_nh_event, - NetHackQtBind::qt_exit_nhwindows, - NetHackQtBind::qt_suspend_nhwindows, - NetHackQtBind::qt_resume_nhwindows, - NetHackQtBind::qt_create_nhwindow, - NetHackQtBind::qt_clear_nhwindow, - NetHackQtBind::qt_display_nhwindow, - NetHackQtBind::qt_destroy_nhwindow, - NetHackQtBind::qt_curs, - NetHackQtBind::qt_putstr, - genl_putmixed, - NetHackQtBind::qt_display_file, - NetHackQtBind::qt_start_menu, - NetHackQtBind::qt_add_menu, - NetHackQtBind::qt_end_menu, - NetHackQtBind::qt_select_menu, - genl_message_menu, /* no need for X-specific handling */ - NetHackQtBind::qt_update_inventory, - NetHackQtBind::qt_mark_synch, - NetHackQtBind::qt_wait_synch, -#ifdef CLIPPING - NetHackQtBind::qt_cliparound, -#endif -#ifdef POSITIONBAR - donull, -#endif - NetHackQtBind::qt_print_glyph, - //NetHackQtBind::qt_print_glyph_compose, - NetHackQtBind::qt_raw_print, - NetHackQtBind::qt_raw_print_bold, - NetHackQtBind::qt_nhgetch, - NetHackQtBind::qt_nh_poskey, - NetHackQtBind::qt_nhbell, - NetHackQtBind::qt_doprev_message, - NetHackQtBind::qt_yn_function, - NetHackQtBind::qt_getlin, - NetHackQtBind::qt_get_ext_cmd, - NetHackQtBind::qt_number_pad, - NetHackQtBind::qt_delay_output, -#ifdef CHANGE_COLOR /* only a Mac option currently */ - donull, - donull, -#endif - /* other defs that really should go away (they're tty specific) */ - NetHackQtBind::qt_start_screen, - NetHackQtBind::qt_end_screen, -#ifdef GRAPHIC_TOMBSTONE - NetHackQtBind::qt_outrip, -#else - genl_outrip, -#endif - genl_preference_update, - genl_getmsghistory, - genl_putmsghistory, - genl_status_init, - genl_status_finish, - genl_status_enablefield, - genl_status_update, - genl_can_suspend_yes, -}; - -extern "C" void play_usersound(const char* filename, int volume) -{ -#ifdef USER_SOUNDS -#ifndef QT_NO_SOUND - QSound::play(filename); -#endif -#endif -} - -#include "qt_win.moc" -#ifndef KDE -#include "qt_kde0.moc" -#endif -#if QT_VERSION >= 300 -#include "qttableview.moc" -#endif +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4win.h b/win/Qt/qt_win.h similarity index 93% rename from win/Qt4/qt4win.h rename to win/Qt/qt_win.h index 02e96cd31..b85104414 100644 --- a/win/Qt4/qt4win.h +++ b/win/Qt/qt_win.h @@ -11,10 +11,10 @@ // major application of Qt. // -#ifndef qt4win_h -#define qt4win_h +#ifndef qt_win_h +#define qt_win_h -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtWindow { public: @@ -44,6 +44,6 @@ public: int nhid; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4xcmd.cpp b/win/Qt/qt_xcmd.cpp similarity index 94% rename from win/Qt4/qt4xcmd.cpp rename to win/Qt/qt_xcmd.cpp index 7c078f640..a994d4eae 100644 --- a/win/Qt4/qt4xcmd.cpp +++ b/win/Qt/qt_xcmd.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4xcmd.cpp -- extended command widget +// qt_xcmd.cpp -- extended command widget #include "hack.h" #include "func_tab.h" @@ -20,13 +20,13 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4xcmd.h" -#include "qt4xcmd.moc" -#include "qt4bind.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_xcmd.h" +#include "qt_xcmd.moc" +#include "qt_bind.h" +#include "qt_set.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -145,4 +145,4 @@ void NetHackQtExtCmdRequestor::enableButtons() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4xcmd.h b/win/Qt/qt_xcmd.h similarity index 85% rename from win/Qt4/qt4xcmd.h rename to win/Qt/qt_xcmd.h index 338ef3370..fe8b027a6 100644 --- a/win/Qt4/qt4xcmd.h +++ b/win/Qt/qt_xcmd.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4xcmd.h -- extended command widget +// qt_xcmd.h -- extended command widget #ifndef QT4XCMD_H #define QT4XCMD_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtExtCmdRequestor : public QDialog { Q_OBJECT @@ -28,6 +28,6 @@ private slots: void cancel(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/include/qt_xpms.h b/win/Qt/qt_xpms.h similarity index 100% rename from include/qt_xpms.h rename to win/Qt/qt_xpms.h diff --git a/win/Qt4/qt4yndlg.cpp b/win/Qt/qt_yndlg.cpp similarity index 97% rename from win/Qt4/qt4yndlg.cpp rename to win/Qt/qt_yndlg.cpp index 7b1725924..8d1caf400 100644 --- a/win/Qt4/qt4yndlg.cpp +++ b/win/Qt/qt_yndlg.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4yndlg.cpp -- yes/no dialog +// qt_yndlg.cpp -- yes/no dialog #include "hack.h" #undef Invisible @@ -19,15 +19,15 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4yndlg.h" -#include "qt4yndlg.moc" -#include "qt4str.h" +#include "qt_yndlg.h" +#include "qt_yndlg.moc" +#include "qt_str.h" // temporary extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -241,4 +241,4 @@ void NetHackQtYnDialog::doneItem(int i) done(i+1000); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4yndlg.h b/win/Qt/qt_yndlg.h similarity index 86% rename from win/Qt4/qt4yndlg.h rename to win/Qt/qt_yndlg.h index d1474f541..079d7119f 100644 --- a/win/Qt4/qt4yndlg.h +++ b/win/Qt/qt_yndlg.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4yndlg.h -- yes/no dialog +// qt_yndlg.h -- yes/no dialog #ifndef QT4YNDLG_H #define QT4YNDLG_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtYnDialog : QDialog { Q_OBJECT @@ -29,6 +29,6 @@ public: char Exec(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt3/.gitattributes b/win/Qt3/.gitattributes new file mode 100644 index 000000000..7b924974c --- /dev/null +++ b/win/Qt3/.gitattributes @@ -0,0 +1,4 @@ +Install.Qt NHSUBST +qpe-nethack.control NH_header=no +knethack.lnk NH_header=no +* NH_filestag=(file%s_for_the_Qt_3_widget_library_-_X11,_Windows,_Mac_OS_X,_or_Qtopia) diff --git a/win/Qt/Info.plist b/win/Qt3/Info.plist similarity index 100% rename from win/Qt/Info.plist rename to win/Qt3/Info.plist diff --git a/win/Qt/Install.Qt b/win/Qt3/Install.Qt similarity index 100% rename from win/Qt/Install.Qt rename to win/Qt3/Install.Qt diff --git a/win/Qt/knethack.lnk b/win/Qt3/knethack.lnk similarity index 100% rename from win/Qt/knethack.lnk rename to win/Qt3/knethack.lnk diff --git a/win/Qt/knh-mini.xpm b/win/Qt3/knh-mini.xpm similarity index 100% rename from win/Qt/knh-mini.xpm rename to win/Qt3/knh-mini.xpm diff --git a/win/Qt/knh.xpm b/win/Qt3/knh.xpm similarity index 100% rename from win/Qt/knh.xpm rename to win/Qt3/knh.xpm diff --git a/win/Qt/qpe-nethack.control b/win/Qt3/qpe-nethack.control similarity index 100% rename from win/Qt/qpe-nethack.control rename to win/Qt3/qpe-nethack.control diff --git a/win/Qt4/qt4clust.cpp b/win/Qt3/qt3_clust.cpp similarity index 93% rename from win/Qt4/qt4clust.cpp rename to win/Qt3/qt3_clust.cpp index 1cd080c11..6b1039f9b 100644 --- a/win/Qt4/qt4clust.cpp +++ b/win/Qt3/qt3_clust.cpp @@ -1,9 +1,10 @@ -/* SCCS Id: @(#)qt_clust.cpp 3.4 1999/11/19 */ +/* NetHack 3.6 qt_clust.cpp $NHDT-Date: 1575917719 2019/12/09 18:55:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ /* Copyright (c) Warwick Allison, 1999. */ /* NetHack may be freely redistributed. See license for details. */ -#include "qt4clust.h" +#include "qt3_clust.h" -static void include(QRect& r, const QRect& rect) +static +void include(QRect& r, const QRect& rect) { if (rect.left() +// - Userid control +// Svante Gerhard +// - .nethackrc tile and font size settings +// Dirk Schoenberger +// - KDE support +// - SlashEm support +// and many others for bug reports. +// +// Unfortunately, this doesn't use Qt as well as I would like, +// primarily because NetHack is fundamentally a getkey-type program +// rather than being event driven (hence the ugly key and click buffer) +// and also because this is my first major application of Qt. +// +// The problem of NetHack's getkey requirement is solved by intercepting +// key events by overiding QApplicion::notify(...), and putting them in +// a buffer. Mouse clicks on the map window are treated with a similar +// buffer. When the NetHack engine calls for a key, one is taken from +// the buffer, or if that is empty, QApplication::enter_loop() is called. +// Whenever keys or clicks go into the buffer, QApplication::exit_loop() +// is called. +// +// Another problem is that some NetHack players are decade-long players who +// demand complete keyboard control (while Qt and X11 conspire to make this +// difficult by having widget-based focus rather than application based - +// a good thing in general). This problem is solved by again using the key +// event buffer. +// +// Out of all this hackery comes a silver lining however, as macros for +// the super-expert and menus for the ultra-newbie are also made possible +// by the key event buffer. +// + +extern "C" { + +// This includes all the definitions we need from the NetHack main +// engine. We pretend MSC is a STDC compiler, because C++ is close +// enough, and we undefine NetHack macros which conflict with Qt +// identifiers. + +#define alloc hide_alloc // avoid treading on STL symbol +#define lock hide_lock // avoid treading on STL symbol +#ifdef _MSC_VER +#define NHSTDC +#endif +#include "hack.h" +#include "func_tab.h" +#include "dlb.h" +#include "patchlevel.h" +#include "tile2x11.h" +#undef Invisible +#undef Warning +#undef red +#undef green +#undef blue +#undef Black +#undef curs +#undef TRUE +#undef FALSE +#undef min +#undef max +#undef alloc +#undef lock +#undef yn + +} + +#include "qt3_win.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +//#include + +#include + +#include "qt3_clust.h" +#include "qt3_xpms.h" + +#include +#ifdef Q_WS_MACX +# include +#else +# include +#endif + +#ifdef _WS_X11_ +// For userid control +#include +#endif + +// Some distributors released Qt 2.1.0beta4 +#if QT_VERSION < 220 +# define nh_WX11BypassWM 0x01000000 +#else +# define nh_WX11BypassWM WX11BypassWM +#endif + +#ifdef USER_SOUNDS +# if QT_VERSION < 220 +# undef USER_SOUNDS +# else +# include +# endif +#endif + + +#ifdef USER_SOUNDS +extern "C" void play_sound_for_message(const char* str); +#endif + +#ifdef SAFERHANGUP +#include +#endif + +// Warwick prefers it this way... +#define QT_CHOOSE_RACE_FIRST + +static const char nh_attribution[] = "
NetHack" + "
by the NetHack DevTeam
"; + +static QString +aboutMsg() +{ + QString msg; + msg.sprintf( + "Qt NetHack is a version of NetHack built\n" +#ifdef KDE + "using KDE and the Qt GUI toolkit.\n" +#else + "using the Qt GUI toolkit.\n" +#endif + "This is version %d.%d.%d\n\n" + "Homepage:\n http://trolls.troll.no/warwick/nethack/\n\n" +#ifdef KDE + "KDE:\n http://www.kde.org\n" +#endif + "Qt:\n http://www.troll.no", + VERSION_MAJOR, + VERSION_MINOR, + PATCHLEVEL); + return msg; +} + +static void +centerOnMain( QWidget* w ) +{ + QWidget* m = qApp->mainWidget(); + if (!m) m = qApp->desktop(); + QPoint p = m->mapToGlobal(QPoint(0,0)); + w->move( p.x() + m->width()/2 - w->width()/2, + p.y() + m->height()/2 - w->height()/2 ); +} + +NetHackQtLineEdit::NetHackQtLineEdit() : + QLineEdit(0) +{ +} + +NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) : + QLineEdit(parent,name) +{ +} + +void NetHackQtLineEdit::fakeEvent(int key, int ascii, int state) +{ + QKeyEvent fake(QEvent::KeyPress,key,ascii,state); + keyPressEvent(&fake); +} + +extern "C" { +/* Used by tile/font-size patch below and in ../../src/files.c */ +char *qt_tilewidth=NULL; +char *qt_tileheight=NULL; +char *qt_fontsize=NULL; +#if defined(QWS) +int qt_compact_mode = 1; +#else +int qt_compact_mode = 0; +#endif +extern const char *enc_stat[]; /* from botl.c */ +extern const char *hu_stat[]; /* from eat.c */ +extern int total_tiles_used; // from tile.c +extern short glyph2tile[]; // from tile.c +} + +static int tilefile_tile_W=16; +static int tilefile_tile_H=16; + +#define TILEWMIN 1 +#define TILEHMIN 1 + + +/* XPM */ +static const char * nh_icon[] = { +"40 40 6 1", +" s None c none", +". c #ffffff", +"X c #dadab6", +"o c #6c91b6", +"O c #476c6c", +"+ c #000000", +" ", +" ", +" ", +" . .X..XX.XX X ", +" .. .....X.XXXXXX XX ", +" ... ....X..XX.XXXXX XXX ", +" .. ..........X.XXXXXXXXXXX XX ", +" .... ........X..XX.XXXXXXXXX XXXX ", +" .... ..........X.XXXXXXXXXXX XXXX ", +" ooOOO..ooooooOooOOoOOOOOOOXX+++OO++ ", +" ooOOO..ooooooooOoOOOOOOOOOXX+++OO++ ", +" ....O..ooooooOooOOoOOOOOOOXX+XXXX++ ", +" ....O..ooooooooOoOOOOOOOOOXX+XXXX++ ", +" ..OOO..ooooooOooOOoOOOOOOOXX+++XX++ ", +" ++++..ooooooooOoOOOOOOOOOXX+++ +++ ", +" +++..ooooooOooOOoOOOOOOOXX+++ + ", +" ++..ooooooooOoOOOOOOOOOXX+++ ", +" ..ooooooOooOOoOOOOOOOXX+++ ", +" ..ooooooooOoOOOOOOOOOXX+++ ", +" ..ooooooOooOOoOOOOOOOXX+++ ", +" ..ooooooooOoOOOOOOOOOXX+++ ", +" ..oooooOooOOoOOOOOOXX+++ ", +" ..oooooooOoOOOOOOOOXX+++ ", +" ..ooooOooOOoOOOOOXX+++ ", +" ..ooooooOoOOOOOOOXX++++ ", +" ..o..oooOooOOoOOOOXX+XX+++ ", +" ...o..oooooOoOOOOOXX++XXX++ ", +" ....OO..ooOooOOoOOXX+++XXXX++ ", +" ...oo..+..oooOoOOOXX++XXooXXX++ ", +" ...ooo..++..OooOOoXX+++XXooOXXX+ ", +" ..oooOOXX+++....XXXX++++XXOOoOOXX+ ", +" ..oooOOXX+++ ...XXX+++++XXOOooOXX++ ", +" ..oooOXXX+++ ..XX+++ +XXOOooOXX++ ", +" .....XXX++++ XXXXXXX++ ", +" ....XX++++ XXXXXXX+ ", +" ...XX+++ XXXXX++ ", +" ", +" ", +" ", +" "}; +/* XPM */ +static const char * nh_icon_small[] = { +/* width height ncolors chars_per_pixel */ +"16 16 16 1", +/* colors */ +" c #587070", +". c #D1D5C9", +"X c #8B8C84", +"o c #2A2A28", +"O c #9AABA9", +"+ c #6A8FB2", +"@ c #C4CAC4", +"# c #B6BEB6", +"$ c None", +"% c #54564E", +"& c #476C6C", +"* c #ADB2AB", +"= c #ABABA2", +"- c #5E8295", +"; c #8B988F", +": c #E8EAE7", +/* pixels */ +"$$$$$$$$$$$$$$$$", +"$$$.$#::.#==*$$$", +"$.*:::::....#*=$", +"$@#:..@#*==#;XX;", +"$@O:+++- &&; X%X", +"$#%.+++- &&;% oX", +"$$o.++-- &&;%%X$", +"$$$:++-- &&;%%$$", +"$$$.O++- &&=o $$", +"$$$=:++- & XoX$$", +"$$*:@O-- ;%Xo$$", +"$*:O#$+--;oOOX $", +"$:+ =o::=oo=-;%X", +"$::.%o$*;X;##@%$", +"$$@# ;$$$$$=*;X$", +"$$$$$$$$$$$$$$$$" +}; + +/* XPM */ +static const char * map_xpm[] = { +"12 13 4 1", +". c None", +" c #000000000000", +"X c #0000B6DAFFFF", +"o c #69A69248B6DA", +" .", +" XXXXX ooo ", +" XoooX o ", +" XoooX o o ", +" XoooX ooo ", +" XXoXX o ", +" oooooXXX ", +" oo o oooX ", +" o XooX ", +" oooo XooX ", +" o o XXXX ", +" ", +". "}; +/* XPM */ +static const char * msg_xpm[] = { +"12 13 4 1", +". c None", +" c #FFFFFFFFFFFF", +"X c #69A69248B6DA", +"o c #000000000000", +" .", +" XXX XXX X o", +" o", +" XXXXX XX o", +" o", +" XX XXXXX o", +" o", +" XXXXXX o", +" o", +" XX XXX XX o", +" o", +" o", +".ooooooooooo"}; +/* XPM */ +static const char * stat_xpm[] = { +"12 13 5 1", +" c None", +". c #FFFF00000000", +"X c #000000000000", +"o c #FFFFFFFF0000", +"O c #69A6FFFF0000", +" ", +" ", +"... ", +"...X ", +"...X ... ", +"oooX oooX", +"oooXooo oooX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +" XXXXXXXXXXX"}; +/* XPM */ +static const char * info_xpm[] = { +"12 13 4 1", +" c None", +". c #00000000FFFF", +"X c #FFFFFFFFFFFF", +"o c #000000000000", +" ... ", +" ....... ", +" ...XXX... ", +" .........o ", +"...XXXX.... ", +"....XXX....o", +"....XXX....o", +"....XXX....o", +" ...XXX...oo", +" ..XXXXX..o ", +" .......oo ", +" o...ooo ", +" ooo "}; + + +/* XPM */ +static const char * again_xpm[] = { +"12 13 2 1", +" c None", +". c #000000000000", +" .. ", +" .. ", +" ..... ", +" ....... ", +"... .. .. ", +".. .. .. ", +".. ..", +".. ..", +".. ..", +" .. .. ", +" .......... ", +" ...... ", +" "}; +/* XPM */ +static const char * kick_xpm[] = { +"12 13 3 1", +" c None", +". c #000000000000", +"X c #FFFF6DB60000", +" ", +" ", +" . . . ", +" ... . . ", +" ... . ", +" ... . ", +" ... ", +"XXX ... ", +"XXX. ... ", +"XXX. ... ", +"XXX. .. ", +" ... ", +" "}; +/* XPM */ +static const char * throw_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" ", +" ", +" ", +" ", +".... X ", +"....X X ", +"....X XXXXXX", +"....X X ", +" XXXX X ", +" ", +" ", +" ", +" "}; +/* XPM */ +static const char * fire_xpm[] = { +"12 13 5 1", +" c None", +". c #B6DA45140000", +"X c #FFFFB6DA9658", +"o c #000000000000", +"O c #FFFF6DB60000", +" . ", +" X. ", +" X . ", +" X .o ", +" X . o ", +" X .o o ", +"OOOOOOOOoooo", +" X .o o ", +" X . o o ", +" X .o ", +" X. o ", +" . o ", +" o "}; +/* XPM */ +static const char * get_xpm[] = { +"12 13 3 1", +" c None", +". c #000000000000", +"X c #FFFF6DB60000", +" ", +" . ", +" ... ", +" . . . ", +" . ", +" . ", +" ", +" XXXXX ", +" XXXXX. ", +" XXXXX. ", +" XXXXX. ", +" ..... ", +" "}; +/* XPM */ +static const char * drop_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" ", +" ..... ", +" .....X ", +" .....X ", +" .....X ", +" XXXXX ", +" ", +" X ", +" X ", +" X X X ", +" XXX ", +" X ", +" "}; +/* XPM */ +static const char * eat_xpm[] = { +"12 13 4 1", +" c None", +". c #000000000000", +"X c #FFFFB6DA9658", +"o c #FFFF6DB60000", +" .X. .. ", +" .X. .. ", +" .X. .. ", +" .X. .. ", +" ... .. ", +" .. .. ", +" .. .. ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo "}; +/* XPM */ +static const char * rest_xpm[] = { +"12 13 2 1", +" c None", +". c #000000000000", +" ..... ", +" . ", +" . ", +" . ....", +" ..... . ", +" . ", +" ....", +" ", +" .... ", +" . ", +" . ", +" .... ", +" "}; +/* XPM */ +static const char * cast_a_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XX ", +" .. X X ", +" .. X X ", +" .. XXXX ", +" . X X ", +" . X X "}; +/* XPM */ +static const char * cast_b_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XXX ", +" .. X X ", +" .. XXX ", +" .. X X ", +" . X X ", +" . XXX "}; +/* XPM */ +static const char * cast_c_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XX ", +" .. X X ", +" .. X ", +" .. X ", +" . X X ", +" . XX "}; + +NetHackQtSettings::NetHackQtSettings(int w, int h) : + tilewidth(TILEWMIN,64,1,this), + tileheight(TILEHMIN,64,1,this), + widthlbl(&tilewidth,"&Width:",this), + heightlbl(&tileheight,"&Height:",this), + whichsize("&Zoomed",this), + fontsize(this), + normal("times"), +#ifdef WS_WIN + normalfixed("courier new"), +#else + normalfixed("fixed"), +#endif + large("times"), + theglyphs(0) + +{ + int default_fontsize; + + if (w<=300) { + // ~240x320 + default_fontsize=4; + tilewidth.setValue(8); + tileheight.setValue(12); + } else if (w<=700) { + // ~640x480 + default_fontsize=3; + tilewidth.setValue(8); + tileheight.setValue(14); + } else if (w<=900) { + // ~800x600 + default_fontsize=3; + tilewidth.setValue(10); + tileheight.setValue(17); + } else if (w<=1100) { + // ~1024x768 + default_fontsize=2; + tilewidth.setValue(12); + tileheight.setValue(22); + } else if (w<=1200) { + // ~1152x900 + default_fontsize=1; + tilewidth.setValue(14); + tileheight.setValue(26); + } else { + // ~1280x1024 and larger + default_fontsize=0; + tilewidth.setValue(16); + tileheight.setValue(30); + } + + // Tile/font sizes read from .nethackrc + if (qt_tilewidth != NULL) { + tilewidth.setValue(atoi(qt_tilewidth)); + free(qt_tilewidth); + } + if (qt_tileheight != NULL) { + tileheight.setValue(atoi(qt_tileheight)); + free(qt_tileheight); + } + if (qt_fontsize != NULL) { + switch (tolower(qt_fontsize[0])) { + case 'h': default_fontsize = 0; break; + case 'l': default_fontsize = 1; break; + case 'm': default_fontsize = 2; break; + case 's': default_fontsize = 3; break; + case 't': default_fontsize = 4; break; + } + free(qt_fontsize); + } + + theglyphs=new NetHackQtGlyphs(); + resizeTiles(); + + connect(&tilewidth,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); + connect(&tileheight,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); + connect(&whichsize,SIGNAL(toggled(bool)),this,SLOT(setGlyphSize(bool))); + + fontsize.insertItem("Huge"); + fontsize.insertItem("Large"); + fontsize.insertItem("Medium"); + fontsize.insertItem("Small"); + fontsize.insertItem("Tiny"); + fontsize.setCurrentItem(default_fontsize); + connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged())); + + QGridLayout* grid = new QGridLayout(this, 5, 2, 8); + grid->addMultiCellWidget(&whichsize, 0, 0, 0, 1); + grid->addWidget(&tilewidth, 1, 1); grid->addWidget(&widthlbl, 1, 0); + grid->addWidget(&tileheight, 2, 1); grid->addWidget(&heightlbl, 2, 0); + QLabel* flabel=new QLabel(&fontsize, "&Font:",this); + grid->addWidget(flabel, 3, 0); grid->addWidget(&fontsize, 3, 1); + QPushButton* dismiss=new QPushButton("Dismiss",this); + dismiss->setDefault(TRUE); + grid->addMultiCellWidget(dismiss, 4, 4, 0, 1); + grid->setRowStretch(4,0); + grid->setColStretch(1,1); + grid->setColStretch(2,2); + grid->activate(); + + connect(dismiss,SIGNAL(clicked()),this,SLOT(accept())); + resize(150,140); +} + +NetHackQtGlyphs& NetHackQtSettings::glyphs() +{ + return *theglyphs; +} + +void NetHackQtSettings::resizeTiles() +{ + int w = tilewidth.value(); + int h = tileheight.value(); + + theglyphs->setSize(w,h); + emit tilesChanged(); +} + +void NetHackQtSettings::toggleGlyphSize() +{ + whichsize.toggle(); +} + +void NetHackQtSettings::setGlyphSize(bool which) +{ + QSize n = QSize(tilewidth.value(),tileheight.value()); + if ( othersize.isValid() ) { + tilewidth.blockSignals(TRUE); + tileheight.blockSignals(TRUE); + tilewidth.setValue(othersize.width()); + tileheight.setValue(othersize.height()); + tileheight.blockSignals(FALSE); + tilewidth.blockSignals(FALSE); + resizeTiles(); + } + othersize = n; +} + +const QFont& NetHackQtSettings::normalFont() +{ + static int size[]={ 18, 14, 12, 10, 8 }; + normal.setPointSize(size[fontsize.currentItem()]); + return normal; +} + +const QFont& NetHackQtSettings::normalFixedFont() +{ + static int size[]={ 18, 14, 13, 10, 8 }; + normalfixed.setPointSize(size[fontsize.currentItem()]); + return normalfixed; +} + +const QFont& NetHackQtSettings::largeFont() +{ + static int size[]={ 24, 18, 14, 12, 10 }; + large.setPointSize(size[fontsize.currentItem()]); + return large; +} + +bool NetHackQtSettings::ynInMessages() +{ + return !qt_compact_mode; +} + + +NetHackQtSettings* qt_settings; + + + +NetHackQtKeyBuffer::NetHackQtKeyBuffer() : + in(0), out(0) +{ +} + +bool NetHackQtKeyBuffer::Empty() const { return in==out; } +bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } + +void NetHackQtKeyBuffer::Put(int k, int a, int state) +{ + if ( Full() ) return; // Safety + key[in]=k; + ascii[in]=a; + in=(in+1)%maxkey; +} + +void NetHackQtKeyBuffer::Put(char a) +{ + Put(0,a,0); +} + +void NetHackQtKeyBuffer::Put(const char* str) +{ + while (*str) Put(*str++); +} + +int NetHackQtKeyBuffer::GetKey() +{ + if ( Empty() ) return 0; + int r=TopKey(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::GetAscii() +{ + if ( Empty() ) return 0; // Safety + int r=TopAscii(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::GetState() +{ + if ( Empty() ) return 0; + int r=TopState(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::TopKey() const +{ + if ( Empty() ) return 0; + return key[out]; +} + +int NetHackQtKeyBuffer::TopAscii() const +{ + if ( Empty() ) return 0; + return ascii[out]; +} + +int NetHackQtKeyBuffer::TopState() const +{ + if ( Empty() ) return 0; + return state[out]; +} + + +NetHackQtClickBuffer::NetHackQtClickBuffer() : + in(0), out(0) +{ +} + +bool NetHackQtClickBuffer::Empty() const { return in==out; } +bool NetHackQtClickBuffer::Full() const { return (in+1)%maxclick==out; } + +void NetHackQtClickBuffer::Put(int x, int y, int mod) +{ + click[in].x=x; + click[in].y=y; + click[in].mod=mod; + in=(in+1)%maxclick; +} + +int NetHackQtClickBuffer::NextX() const { return click[out].x; } +int NetHackQtClickBuffer::NextY() const { return click[out].y; } +int NetHackQtClickBuffer::NextMod() const { return click[out].mod; } + +void NetHackQtClickBuffer::Get() +{ + out=(out+1)%maxclick; +} + +class NhPSListViewItem : public QListViewItem { +public: + NhPSListViewItem( QListView* parent, const QString& name ) : + QListViewItem(parent, name) + { + } + + void setGlyph(int g) + { + NetHackQtGlyphs& glyphs = qt_settings->glyphs(); + int gw = glyphs.width(); + int gh = glyphs.height(); + QPixmap pm(gw,gh); + QPainter p(&pm); + glyphs.drawGlyph(p, g, 0, 0); + p.end(); + setPixmap(0,pm); + setHeight(QMAX(pm.height()+1,height())); + } + + void paintCell( QPainter *p, const QColorGroup &cg, + int column, int width, int alignment ) + { + if ( isSelectable() ) { + QListViewItem::paintCell( p, cg, column, width, alignment ); + } else { + QColorGroup disabled( + cg.foreground().light(), + cg.button().light(), + cg.light(), cg.dark(), cg.mid(), + gray, cg.base() ); + QListViewItem::paintCell( p, disabled, column, width, alignment ); + } + } +}; + +class NhPSListViewRole : public NhPSListViewItem { +public: + NhPSListViewRole( QListView* parent, int id ) : + NhPSListViewItem(parent, +#ifdef QT_CHOOSE_RACE_FIRST // Lowerize - looks better + QString(QChar(roles[id].name.m[0])).lower()+QString(roles[id].name.m+1) +#else + roles[id].name.m +#endif + ) + { + setGlyph(monnum_to_glyph(roles[id].malenum)); + } +}; + +class NhPSListViewRace : public NhPSListViewItem { +public: + NhPSListViewRace( QListView* parent, int id ) : + NhPSListViewItem(parent, +#ifdef QT_CHOOSE_RACE_FIRST // Capitalize - looks better + QString(QChar(races[id].noun[0])).upper()+QString(races[id].noun+1) +#else + QString(QChar(races[id].noun[0])+QString(races[id].noun+1)) +#endif + ) + { + setGlyph(monnum_to_glyph(races[id].malenum)); + } +}; + +class NhPSListView : public QListView { +public: + NhPSListView( QWidget* parent ) : + QListView(parent) + { + setSorting(-1); // order is identity + header()->setClickEnabled(FALSE); + } + + QSizePolicy sizePolicy() const + { + return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + } + + QSize minimumSizeHint() const + { + return sizeHint(); + } + + QSize sizeHint() const + { + QListView::sizeHint(); + QSize sz = header()->sizeHint(); + int h=0; + QListViewItem* c=firstChild(); + while (c) h+=c->height(),c = c->nextSibling(); + sz += QSize(frameWidth()*2, h+frameWidth()*2); + return sz; + } + + int selectedItemNumber() const + { + int i=0; + QListViewItem* c = firstChild(); + while (c) { + if (c == selectedItem()) { + return i; + } + i++; + c = c->nextSibling(); + } + return -1; + } + + void setSelectedItemNumber(int i) + { + QListViewItem* c=firstChild(); + while (i--) + c = c->nextSibling(); + c->setSelected(TRUE); + } +}; + +NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) : + QDialog(qApp->mainWidget(),"plsel",TRUE), + keysource(ks), + fully_specified_role(TRUE) +{ + /* + 0 1 2 + + Name ------------------------------------+ + 0 | | + + ---- ------------------------------------+ + + Role ---+ + Race ---+ + Gender ------+ + | | | | | * Male | + 1 | | | | | * Female | + | | | | +--------------+ + | | | | + | | | | + Alignment ---+ + 2 | | | | | * Male | + | | | | | * Female | + | | | | +--------------+ + 3 | | | | ...stretch... + | | | | + 4 | | | | [ Play ] + 5 | | | | [ Quit ] + +---------+ +---------+ + */ + + int marg=4; + QGridLayout *l = new QGridLayout(this,6,3,marg,marg); + + QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this); + QLineEdit* name = new QLineEdit(namebox); + name->setMaxLength(sizeof(g.plname)-1); + if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) ) + name->setText(g.plname); + connect(name, SIGNAL(textChanged(const QString&)), + this, SLOT(selectName(const QString&)) ); + name->setFocus(); + QButtonGroup* genderbox = new QButtonGroup("Sex",this); + QButtonGroup* alignbox = new QButtonGroup("Alignment",this); + QVBoxLayout* vbgb = new QVBoxLayout(genderbox,3,1); + vbgb->setAutoAdd(TRUE); + vbgb->addSpacing(fontMetrics().height()*3/4); + QVBoxLayout* vbab = new QVBoxLayout(alignbox,3,1); + vbab->setAutoAdd(TRUE); + vbab->addSpacing(fontMetrics().height()); + QLabel* logo = new QLabel(nh_attribution, this); + + l->addMultiCellWidget( namebox, 0,0,0,2 ); +#ifdef QT_CHOOSE_RACE_FIRST + race = new NhPSListView(this); + role = new NhPSListView(this); + l->addMultiCellWidget( race, 1,5,0,0 ); + l->addMultiCellWidget( role, 1,5,1,1 ); +#else + role = new NhPSListView(this); + race = new NhPSListView(this); + l->addMultiCellWidget( role, 1,5,0,0 ); + l->addMultiCellWidget( race, 1,5,1,1 ); +#endif + role->addColumn("Role"); + race->addColumn("Race"); + + l->addWidget( genderbox, 1, 2 ); + l->addWidget( alignbox, 2, 2 ); + l->addWidget( logo, 3, 2, AlignCenter ); + l->setRowStretch( 3, 5 ); + + int i; + int nrole; + + for (nrole=0; roles[nrole].name.m; nrole++) + ; + for (i=nrole-1; i>=0; i--) { // XXX QListView unsorted goes in rev. + new NhPSListViewRole( role, i ); + } + connect( role, SIGNAL(selectionChanged()), this, SLOT(selectRole()) ); + + int nrace; + for (nrace=0; races[nrace].noun; nrace++) + ; + for (i=nrace-1; i>=0; i--) { + new NhPSListViewRace( race, i ); + } + connect( race, SIGNAL(selectionChanged()), this, SLOT(selectRace()) ); + + gender = new QRadioButton*[ROLE_GENDERS]; + for (i=0; iaddWidget( ok, 4, 2 ); + ok->setDefault(TRUE); + connect( ok, SIGNAL(clicked()), this, SLOT(accept()) ); + + QPushButton* cancel = new QPushButton("Quit",this); + l->addWidget( cancel, 5, 2 ); + connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + + // Randomize race and role, unless specified in config + int ro = flags.initrole; + if (ro == ROLE_NONE || ro == ROLE_RANDOM) { + ro = rn2(nrole); + if (flags.initrole != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + int ra = flags.initrace; + if (ra == ROLE_NONE || ra == ROLE_RANDOM) { + ra = rn2(nrace); + if (flags.initrace != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + + // make sure we have a valid combination, honoring + // the users request if possible. + bool choose_race_first; +#ifdef QT_CHOOSE_RACE_FIRST + choose_race_first = TRUE; + if (flags.initrole >= 0 && flags.initrace < 0) { + choose_race_first = FALSE; + } +#else + choose_race_first = FALSE; + if (flags.initrace >= 0 && flags.initrole < 0) { + choose_race_first = TRUE; + } +#endif + while (!validrace(ro,ra)) { + if (choose_race_first) { + ro = rn2(nrole); + if (flags.initrole != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } else { + ra = rn2(nrace); + if (flags.initrace != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + } + + int g = flags.initgend; + if (g == -1) { + g = rn2(ROLE_GENDERS); + fully_specified_role = FALSE; + } + while (!validgend(ro,ra,g)) { + g = rn2(ROLE_GENDERS); + } + gender[g]->setChecked(TRUE); + selectGender(g); + + int a = flags.initalign; + if (a == -1) { + a = rn2(ROLE_ALIGNS); + fully_specified_role = FALSE; + } + while (!validalign(ro,ra,a)) { + a = rn2(ROLE_ALIGNS); + } + alignment[a]->setChecked(TRUE); + selectAlignment(a); + + QListViewItem* li; + + li = role->firstChild(); + while (ro--) li=li->nextSibling(); + role->setSelected(li,TRUE); + + li = race->firstChild(); + while (ra--) li=li->nextSibling(); + race->setSelected(li,TRUE); + + flags.initrace = race->selectedItemNumber(); + flags.initrole = role->selectedItemNumber(); +} + + +void NetHackQtPlayerSelector::selectName(const QString& n) +{ + strncpy(g.plname,n.latin1(),sizeof(g.plname)-1); +} + +void NetHackQtPlayerSelector::selectRole() +{ + int ra = race->selectedItemNumber(); + int ro = role->selectedItemNumber(); + if (ra == -1 || ro == -1) return; + +#ifdef QT_CHOOSE_RACE_FIRST + selectRace(); +#else + QListViewItem* i=role->currentItem(); + QListViewItem* valid=0; + int j; + NhPSListViewItem* item; + item = (NhPSListViewItem*)role->firstChild(); + for (j=0; roles[j].name.m; j++) { + bool v = validrace(j,ra); + item->setSelectable(TRUE); + if ( !valid && v ) valid = item; + item=(NhPSListViewItem*)item->nextSibling(); + } + if ( !validrace(role->selectedItemNumber(),ra) ) + i = valid; + role->setSelected(i,TRUE); + item = (NhPSListViewItem*)role->firstChild(); + for (j=0; roles[j].name.m; j++) { + bool v = validrace(j,ra); + item->setSelectable(v); + item->repaint(); + item=(NhPSListViewItem*)item->nextSibling(); + } +#endif + + flags.initrole = role->selectedItemNumber(); + setupOthers(); +} + +void NetHackQtPlayerSelector::selectRace() +{ + int ra = race->selectedItemNumber(); + int ro = role->selectedItemNumber(); + if (ra == -1 || ro == -1) return; + +#ifndef QT_CHOOSE_RACE_FIRST + selectRole(); +#else + QListViewItem* i=race->currentItem(); + QListViewItem* valid=0; + int j; + NhPSListViewItem* item; + item = (NhPSListViewItem*)race->firstChild(); + for (j=0; races[j].noun; j++) { + bool v = validrace(ro,j); + item->setSelectable(TRUE); + if ( !valid && v ) valid = item; + item=(NhPSListViewItem*)item->nextSibling(); + } + if ( !validrace(ro,race->selectedItemNumber()) ) + i = valid; + race->setSelected(i,TRUE); + item = (NhPSListViewItem*)race->firstChild(); + for (j=0; races[j].noun; j++) { + bool v = validrace(ro,j); + item->setSelectable(v); + item->repaint(); + item=(NhPSListViewItem*)item->nextSibling(); + } +#endif + + flags.initrace = race->selectedItemNumber(); + setupOthers(); +} + +void NetHackQtPlayerSelector::setupOthers() +{ + int ro = role->selectedItemNumber(); + int ra = race->selectedItemNumber(); + int valid=-1; + int c=0; + int j; + for (j=0; jisChecked() ) + c = j; + gender[j]->setEnabled(v); + if ( valid<0 && v ) valid = j; + } + if ( !validgend(ro,ra,c) ) + c = valid; + int k; + for (k=0; ksetChecked(c==k); + } + selectGender(c); + + valid=-1; + for (j=0; jisChecked() ) + c = j; + alignment[j]->setEnabled(v); + if ( valid<0 && v ) valid = j; + } + if ( !validalign(ro,ra,c) ) + c = valid; + for (k=0; ksetChecked(c==k); + } + selectAlignment(c); +} + +void NetHackQtPlayerSelector::selectGender(int i) +{ + flags.initgend = i; +} + +void NetHackQtPlayerSelector::selectAlignment(int i) +{ + flags.initalign = i; +} + + +void NetHackQtPlayerSelector::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +void NetHackQtPlayerSelector::Quit() +{ + done(R_Quit); + qApp->exit_loop(); +} + +void NetHackQtPlayerSelector::Random() +{ + done(R_Rand); + qApp->exit_loop(); +} + +bool NetHackQtPlayerSelector::Choose() +{ + if (fully_specified_role) return TRUE; + +#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). + if ( qt_compact_mode ) { + showMaximized(); + } else +#endif + { + adjustSize(); + centerOnMain(this); + } + + if ( exec() ) { + return TRUE; + } else { + return FALSE; + } +} + + +NetHackQtStringRequestor::NetHackQtStringRequestor(NetHackQtKeyBuffer& ks, const char* p, const char* cancelstr) : + QDialog(qApp->mainWidget(),"string",FALSE), + prompt(p,this,"prompt"), + input(this,"input"), + keysource(ks) +{ + cancel=new QPushButton(cancelstr,this); + connect(cancel,SIGNAL(clicked()),this,SLOT(reject())); + + okay=new QPushButton("Okay",this); + connect(okay,SIGNAL(clicked()),this,SLOT(accept())); + connect(&input,SIGNAL(returnPressed()),this,SLOT(accept())); + okay->setDefault(TRUE); + + setFocusPolicy(StrongFocus); +} + +void NetHackQtStringRequestor::resizeEvent(QResizeEvent*) +{ + const int margin=5; + const int gutter=5; + + int h=(height()-margin*2-gutter); + + if (strlen(prompt.text()) > 16) { + h/=3; + prompt.setGeometry(margin,margin,width()-margin*2,h); + input.setGeometry(width()*1/5,margin+h+gutter, + (width()-margin-2-gutter)*4/5,h); + } else { + h/=2; + prompt.setGeometry(margin,margin,(width()-margin*2-gutter)*2/5,h); + input.setGeometry(prompt.geometry().right()+gutter,margin, + (width()-margin-2-gutter)*3/5,h); + } + + cancel->setGeometry(margin,input.geometry().bottom()+gutter, + (width()-margin*2-gutter)/2,h); + okay->setGeometry(cancel->geometry().right()+gutter,cancel->geometry().y(), + cancel->width(),h); +} + +void NetHackQtStringRequestor::SetDefault(const char* d) +{ + input.setText(d); +} + +bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) +{ + input.setMaxLength(maxchar); + if (strlen(prompt.text()) > 16) { + resize(fontMetrics().width(prompt.text())+50,fontMetrics().height()*6); + } else { + resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4); + } + + centerOnMain(this); + show(); + input.setFocus(); + setResult(-1); + while (result()==-1) { + // Put keys in buffer (eg. from macros, from out-of-focus input) + if (!keysource.Empty()) { + while (!keysource.Empty()) { + int key=keysource.TopKey(); + int ascii=keysource.TopAscii(); + int state=keysource.GetState(); + if (ascii=='\r' || ascii=='\n') { + // CR or LF in buffer causes confirmation + strcpy(buffer,input.text()); + return TRUE; + } else if (ascii=='\033') { + return FALSE; + } else { + input.fakeEvent(key,ascii,state); + } + } + } + qApp->enter_loop(); + } + // XXX Get rid of extra keys, since we couldn't get focus! + while (!keysource.Empty()) keysource.GetKey(); + + if (result()) { + strcpy(buffer,input.text()); + return TRUE; + } else { + return FALSE; + } +} +void NetHackQtStringRequestor::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + + +NetHackQtWindow::NetHackQtWindow() +{ +} + +NetHackQtWindow::~NetHackQtWindow() +{ +} + +// XXX Use "expected ..." for now, abort or default later. +// +void NetHackQtWindow::Clear() { puts("unexpected Clear"); } +void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } +bool NetHackQtWindow::Destroy() { return TRUE; } +void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } +void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } +void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } +void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, + const char* str, bool presel) { puts("unexpected AddMenu"); } +void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } +int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } +void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } +void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } +//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } +void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } + + + +// XXX Hmmm... crash after saving bones file if Map window is +// XXX deleted. Strange bug somewhere. +bool NetHackQtMapWindow::Destroy() { return FALSE; } + +NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) : + clicksink(click_sink), + change(10), + rogue_font(0) +{ + viewport.addChild(this); + + setBackgroundColor(black); + viewport.setBackgroundColor(black); + + pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm); + + cursor.setX(0); + cursor.setY(0); + Clear(); + + connect(qt_settings,SIGNAL(tilesChanged()),this,SLOT(updateTiles())); + connect(&viewport, SIGNAL(contentsMoving(int,int)), this, + SLOT(moveMessages(int,int))); + + updateTiles(); + //setFocusPolicy(StrongFocus); +#ifdef SAFERHANGUP + QTimer* deadman = new QTimer(this); + connect(deadman, SIGNAL(timeout()), SLOT(timeout())); + deadman->start(2000); // deadman timer every 2 seconds +#endif +} + +#ifdef SAFERHANGUP +// The "deadman" timer is received by this slot +void NetHackQtMapWindow::timeout() {} +#endif + +void NetHackQtMapWindow::moveMessages(int x, int y) +{ + QRect u = messages_rect; + messages_rect.moveTopLeft(QPoint(x,y)); + u |= messages_rect; + update(u); +} + +void NetHackQtMapWindow::clearMessages() +{ + messages = ""; + update(messages_rect); + messages_rect = QRect(); +} + +void NetHackQtMapWindow::putMessage(int attr, const char* text) +{ + if ( !messages.isEmpty() ) + messages += "\n"; + messages += text; + QFontMetrics fm = fontMetrics(); + messages_rect = fm.boundingRect(viewport.contentsX(), viewport.contentsY(), + viewport.width(), 0, + WordBreak|AlignTop|AlignLeft|DontClip, + messages); + update(messages_rect); +} + +void NetHackQtMapWindow::updateTiles() +{ + NetHackQtGlyphs& glyphs = qt_settings->glyphs(); + int gw = glyphs.width(); + int gh = glyphs.height(); + // Be exactly the size we want to be - full map... + resize(COLNO*gw,ROWNO*gh); + + viewport.verticalScrollBar()->setSteps(gh,gh); + viewport.horizontalScrollBar()->setSteps(gw,gw); + /* + viewport.setMaximumSize( + gw*COLNO + viewport.verticalScrollBar()->width(), + gh*ROWNO + viewport.horizontalScrollBar()->height() + ); + */ + viewport.updateScrollBars(); + + change.clear(); + change.add(0,0,COLNO,ROWNO); + delete rogue_font; rogue_font = 0; + Display(FALSE); + + emit resized(); +} + +NetHackQtMapWindow::~NetHackQtMapWindow() +{ + // Remove from viewport porthole, since that is a destructible member. + viewport.removeChild(this); + recreate(0,0,QPoint(0,0)); +} + +QWidget* NetHackQtMapWindow::Widget() +{ + return &viewport; +} + +void NetHackQtMapWindow::Scroll(int dx, int dy) +{ + if (viewport.horizontalScrollBar()->isVisible()) { + while (dx<0) { viewport.horizontalScrollBar()->subtractPage(); dx++; } + while (dx>0) { viewport.horizontalScrollBar()->addPage(); dx--; } + } + if (viewport.verticalScrollBar()->isVisible()) { + while (dy<0) { viewport.verticalScrollBar()->subtractPage(); dy++; } + while (dy>0) { viewport.verticalScrollBar()->addPage(); dy--; } + } +} + +void NetHackQtMapWindow::Clear() +{ + unsigned short stone=cmap_to_glyph(S_stone); + + for (int j=0; jexit_loop(); +} + +void NetHackQtMapWindow::mousePressEvent(QMouseEvent* event) +{ + clicksink.Put( + event->pos().x()/qt_settings->glyphs().width(), + event->pos().y()/qt_settings->glyphs().height(), + event->button()==LeftButton ? CLICK_1 : CLICK_2 + ); + qApp->exit_loop(); +} + +#ifdef TEXTCOLOR +static +const QPen& nhcolor_to_pen(int c) +{ + static QPen* pen=0; + if ( !pen ) { + pen = new QPen[17]; + pen[0] = QColor(24,24,24); // "black" on black + pen[1] = Qt::red; + pen[2] = QColor(0,191,0); + pen[3] = QColor(127,127,0); + pen[4] = Qt::blue; + pen[5] = Qt::magenta; + pen[6] = Qt::cyan; + pen[7] = Qt::gray; + pen[8] = Qt::white; // no color + pen[9] = QColor(255,127,0); + pen[10] = QColor(127,255,127); + pen[11] = Qt::yellow; + pen[12] = QColor(127,127,255); + pen[13] = QColor(255,127,255); + pen[14] = QColor(127,255,255); + pen[15] = Qt::white; + pen[16] = QColor(24,24,24); // "black" on black + } + + return pen[c]; +} +#endif + +void NetHackQtMapWindow::paintEvent(QPaintEvent* event) +{ + QRect area=event->rect(); + QRect garea; + garea.setCoords( + QMAX(0,area.left()/qt_settings->glyphs().width()), + QMAX(0,area.top()/qt_settings->glyphs().height()), + QMIN(COLNO-1,area.right()/qt_settings->glyphs().width()), + QMIN(ROWNO-1,area.bottom()/qt_settings->glyphs().height()) + ); + + QPainter painter; + + painter.begin(this); + + if (Is_rogue_level(&u.uz) || iflags.wc_ascii_map) + { + // You enter a VERY primitive world! + + painter.setClipRect( event->rect() ); // (normally we don't clip) + painter.fillRect( event->rect(), black ); + + if ( !rogue_font ) { + // Find font... + int pts = 5; + QString fontfamily = iflags.wc_font_map + ? iflags.wc_font_map : "Courier"; + bool bold = FALSE; + if ( fontfamily.right(5).lower() == "-bold" ) { + fontfamily.truncate(fontfamily.length()-5); + bold = TRUE; + } + while ( pts < 32 ) { + QFont f(fontfamily, pts, bold ? QFont::Bold : QFont::Normal); + painter.setFont(QFont(fontfamily, pts)); + QFontMetrics fm = painter.fontMetrics(); + if ( fm.width("M") > qt_settings->glyphs().width() ) + break; + if ( fm.height() > qt_settings->glyphs().height() ) + break; + pts++; + } + rogue_font = new QFont(fontfamily,pts-1); + } + painter.setFont(*rogue_font); + + for (int j=garea.top(); j<=garea.bottom(); j++) { + for (int i=garea.left(); i<=garea.right(); i++) { + unsigned short g=Glyph(i,j); + uchar ch; + int color, och; + unsigned special; + + painter.setPen( green ); + /* map glyph to character and color */ + (void)mapglyph(g, &och, &color, &special, i, j, 0); + ch = (uchar)och; +#ifdef TEXTCOLOR + painter.setPen( nhcolor_to_pen(color) ); +#endif + painter.drawText( + i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height(), + qt_settings->glyphs().width(), + qt_settings->glyphs().height(), + AlignCenter, + (const char*)&ch, 1 + ); + if (glyph_is_pet(g) +#ifdef TEXTCOLOR + && ::iflags.hilite_pet +#endif + ) { + painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height()), + pet_annotation); + } + } + } + + painter.setFont(font()); + } else { + for (int j=garea.top(); j<=garea.bottom(); j++) { + for (int i=garea.left(); i<=garea.right(); i++) { + unsigned short g=Glyph(i,j); + qt_settings->glyphs().drawCell(painter, g, i, j); + if (glyph_is_pet(g) +#ifdef TEXTCOLOR + && ::iflags.hilite_pet +#endif + ) { + painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height()), + pet_annotation); + } + } + } + } + + if (garea.contains(cursor)) { + if (Is_rogue_level(&u.uz)) { +#ifdef TEXTCOLOR + painter.setPen( white ); +#else + painter.setPen( green ); // REALLY primitive +#endif + } else + { + int hp100; + if (u.mtimedone) { + hp100=u.mhmax ? u.mh*100/u.mhmax : 100; + } else { + hp100=u.uhpmax ? u.uhp*100/u.uhpmax : 100; + } + + if (hp100 > 75) painter.setPen(white); + else if (hp100 > 50) painter.setPen(yellow); + else if (hp100 > 25) painter.setPen(QColor(0xff,0xbf,0x00)); // orange + else if (hp100 > 10) painter.setPen(red); + else painter.setPen(magenta); + } + + painter.drawRect( + cursor.x()*qt_settings->glyphs().width(),cursor.y()*qt_settings->glyphs().height(), + qt_settings->glyphs().width(),qt_settings->glyphs().height()); + } + + if (area.intersects(messages_rect)) { + painter.setPen(black); + painter.drawText(viewport.contentsX()+1,viewport.contentsY()+1, + viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); + painter.setPen(white); + painter.drawText(viewport.contentsX(),viewport.contentsY(), + viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); + } + + painter.end(); +} + +void NetHackQtMapWindow::Display(bool block) +{ + for (int i=0; iglyphs().width(), + ch.y()*qt_settings->glyphs().height(), + ch.width()*qt_settings->glyphs().width(), + ch.height()*qt_settings->glyphs().height(), + FALSE + ); + } + + change.clear(); + + if (block) { + yn_function("Press a key when done viewing",0,'\0'); + } +} + +void NetHackQtMapWindow::CursorTo(int x,int y) +{ + Changed(cursor.x(),cursor.y()); + cursor.setX(x); + cursor.setY(y); + Changed(cursor.x(),cursor.y()); +} + +void NetHackQtMapWindow::PutStr(int attr, const char* text) +{ + puts("unexpected PutStr in MapWindow"); +} + +void NetHackQtMapWindow::ClipAround(int x,int y) +{ + // Convert to pixel of center of tile + x=x*qt_settings->glyphs().width()+qt_settings->glyphs().width()/2; + y=y*qt_settings->glyphs().height()+qt_settings->glyphs().height()/2; + + // Then ensure that pixel is visible + viewport.center(x,y,0.45,0.45); +} + +void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph) +{ + Glyph(x,y)=glyph; + Changed(x,y); +} + +//void NetHackQtMapWindow::PrintGlyphCompose(int x,int y,int glyph1, int glyph2) +//{ + // TODO: composed graphics +//} + +void NetHackQtMapWindow::Changed(int x, int y) +{ + change.add(x,y); +} + + +class NetHackQtScrollText : public QTableView { + struct UData { + UData() : text(0), attr(0) { } + ~UData() { if (text) free(text); } + + char* text; + int attr; + }; +public: + int uncleared; + + NetHackQtScrollText(int maxlength) : + uncleared(0), + maxitems(maxlength), + first(0), + count(0), + item_cycle(maxlength) + { + setNumCols(1); + setCellWidth(200); + setCellHeight(fontMetrics().height()); + setBackgroundColor(white); + setTableFlags(Tbl_vScrollBar + |Tbl_autoHScrollBar + |Tbl_clipCellPainting + |Tbl_smoothScrolling); + } + + ~NetHackQtScrollText() + { + } + + void Scroll(int dx, int dy) + { + setXOffset(xOffset()+dx*viewWidth()); + setYOffset(yOffset()+dy*viewHeight()); + } + + void insertItem(int attr, const char* text) + { + setTopCell(count); + + setAutoUpdate(FALSE); + + int i; + if (count cellWidth()) { + // Get wider. + setCellWidth(w); + } + setTopCell(count); + + setAutoUpdate(TRUE); + + if (viewHeight() >= totalHeight()-cellHeight()) { + repaint(); + } else { + scroll(0,cellHeight()); + } + } + + virtual void setFont(const QFont& font) + { + QTableView::setFont(font); + setCellHeight(fontMetrics().height()); + } + +protected: + + UData& item(int i) + { + return item_cycle[(first+i)%maxitems]; + } + + const int maxitems; + int first, count; + QArray item_cycle; + + int datumWidth(const UData& uitem) + { + if (uitem.text) { + int width=fontMetrics().width(uitem.text)+3; + if (uitem.attr) { + // XXX Too expensive to do properly, because + // XXX we have to set the font of the widget + // XXX just to get the font metrics information! + // XXX Could hold a fake widget for that + // XXX purpose, but this hack is less ugly. + width+=width/10; + } + return width; + } else { + return 0; + } + } + + virtual void setupPainter(QPainter *p) + { + // XXX This shouldn't be needed - we set the bg in the constructor. + p->setBackgroundColor(white); + } + + virtual void paintCell(QPainter *p, int row, int col) + { + bool sel=FALSE; + UData& uitem=item(row); + + if (!sel && row < count-uncleared) { + p->setPen(darkGray); + } else { + p->setPen(black); + } + + if (uitem.attr) { + // XXX only bold + QFont bold(font().family(),font().pointSize(),QFont::Bold); + p->setFont(bold); + } + + p->drawText(3, 0, cellWidth(), cellHeight(), + AlignLeft|AlignVCenter, uitem.text); + + if (uitem.attr) { + p->setFont(font()); + } + } +}; + +NetHackQtMessageWindow::NetHackQtMessageWindow() : + list(new NetHackQtScrollText(::iflags.msg_history)) +{ + ::iflags.window_inited = 1; + map = 0; + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(updateFont())); + updateFont(); +} + +NetHackQtMessageWindow::~NetHackQtMessageWindow() +{ + ::iflags.window_inited = 0; + delete list; +} + +QWidget* NetHackQtMessageWindow::Widget() { return list; } + +void NetHackQtMessageWindow::setMap(NetHackQtMapWindow* m) +{ + map = m; + updateFont(); +} + +void NetHackQtMessageWindow::updateFont() +{ + list->setFont(qt_settings->normalFont()); + if ( map ) + map->setFont(qt_settings->normalFont()); +} + +void NetHackQtMessageWindow::Scroll(int dx, int dy) +{ + list->Scroll(dx,dy); +} + +void NetHackQtMessageWindow::Clear() +{ + if ( map ) + map->clearMessages(); + if (list->uncleared) { + list->uncleared=0; + changed=TRUE; + Display(FALSE); + } +} + +void NetHackQtMessageWindow::Display(bool block) +{ + if (changed) { + list->repaint(); + changed=FALSE; + } +} + +void NetHackQtMessageWindow::PutStr(int attr, const char* text) +{ +#ifdef USER_SOUNDS + play_sound_for_message(text); +#endif + + changed=TRUE; + list->uncleared++; + list->insertItem(attr,text); + + // Force scrollbar to bottom + // XXX list->setTopItem(list->count()); + + if ( map ) + map->putMessage(attr, text); +} + + + +NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : + QWidget(parent), + low_is_good(FALSE), + prev_value(-123), + turn_count(-1), + label(new QLabel(l,this)), + icon(0) +{ + initHighlight(); +} +NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) : + QWidget(parent), + low_is_good(FALSE), + prev_value(-123), + turn_count(-1), + label(new QLabel(l,this)), + icon(new QLabel(this)) +{ + setIcon(i); + initHighlight(); +} +void NetHackQtLabelledIcon::initHighlight() +{ + const QPalette& pal=palette(); + const QColorGroup& pa=pal.normal(); + //QColorGroup good(white,darkGreen,pa.light(),pa.dark(),pa.mid(),white,pa.base()); + QColorGroup good(black,green,pa.light(),pa.dark(),pa.mid(),black,pa.base()); + QColorGroup bad(white,red,pa.light(),pa.dark(),pa.mid(),white,pa.base()); + hl_good=pal.copy(); + hl_good.setNormal(good); + hl_good.setActive(good); + hl_bad=pal.copy(); + hl_bad.setNormal(bad); + hl_bad.setActive(bad); +} + +void NetHackQtLabelledIcon::setLabel(const char* t, bool lower) +{ + if (!label) { + label=new QLabel(this); + label->setFont(font()); + resizeEvent(0); + } + if (0!=strcmp(label->text(),t)) { + label->setText(t); + highlight(lower==low_is_good ? hl_good : hl_bad); + } +} +void NetHackQtLabelledIcon::setLabel(const char* t, long v, long cv, const char* tail) +{ + char buf[BUFSZ]; + if (v==NoNum) { + Sprintf(buf,"%s%s",t,tail); + } else { + Sprintf(buf,"%s%ld%s",t,v,tail); + } + setLabel(buf,cvsetPixmap(i); + else { icon=new QLabel(this); icon->setPixmap(i); resizeEvent(0); } + icon->resize(i.width(),i.height()); +} +void NetHackQtLabelledIcon::setFont(const QFont& f) +{ + QWidget::setFont(f); + if (label) label->setFont(f); +} +void NetHackQtLabelledIcon::show() +{ +#if QT_VERSION >= 300 + if (isHidden()) +#else + if (!isVisible()) +#endif + highlight(hl_bad); + QWidget::show(); +} +void NetHackQtLabelledIcon::highlightWhenChanging() +{ + turn_count=0; +} +void NetHackQtLabelledIcon::lowIsGood() +{ + low_is_good=TRUE; +} +void NetHackQtLabelledIcon::dissipateHighlight() +{ + if (turn_count>0) { + turn_count--; + if (!turn_count) + unhighlight(); + } +} +void NetHackQtLabelledIcon::highlight(const QPalette& hl) +{ + if (label) { // Surely it is?! + if (turn_count>=0) { + label->setPalette(hl); + turn_count=4; + // `4' includes this turn, so dissipates after + // 3 more keypresses. + } else { + label->setPalette(palette()); + } + } +} +void NetHackQtLabelledIcon::unhighlight() +{ + if (label) { // Surely it is?! + label->setPalette(palette()); + } +} +void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*) +{ + setAlignments(); + + //int labw=label ? label->fontMetrics().width(label->text()) : 0; + int labh=label ? label->fontMetrics().height() : 0; + int icoh=icon ? icon->height() : 0; + int h=icoh+labh; + int icoy=(h>height() ? height()-labh-icoh : height()/2-h/2); + int laby=icoy+icoh; + if (icon) { + icon->setGeometry(0,icoy,width(),icoh); + } + if (label) { + label->setGeometry(0,laby,width(),labh); + } +} + +void NetHackQtLabelledIcon::setAlignments() +{ + if (label) label->setAlignment(AlignHCenter|AlignVCenter); + if (icon) icon->setAlignment(AlignHCenter|AlignVCenter); +} + +static void +tryload(QPixmap& pm, const char* fn) +{ + if (!pm.load(fn)) { + QString msg; + msg.sprintf("Cannot load \"%s\"", fn); + QMessageBox::warning(0, "IO Error", msg); + } +} + +NetHackQtStatusWindow::NetHackQtStatusWindow() : + // Notes: + // Alignment needs -2 init value, because -1 is an alignment. + // Armor Class is an schar, so 256 is out of range. + // Blank value is 0 and should never change. + name(this,"(name)"), + dlevel(this,"(dlevel)"), + str(this,"STR"), + dex(this,"DEX"), + con(this,"CON"), + intel(this,"INT"), + wis(this,"WIS"), + cha(this,"CHA"), + gold(this,"Gold"), + hp(this,"Hit Points"), + power(this,"Power"), + ac(this,"Armour Class"), + level(this,"Level"), + exp(this,"Experience"), + align(this,"Alignment"), + time(this,"Time"), + score(this,"Score"), + hunger(this,""), + confused(this,"Confused"), + sick_fp(this,"Sick"), + sick_il(this,"Ill"), + blind(this,"Blind"), + stunned(this,"Stunned"), + hallu(this,"Hallu"), + encumber(this,""), + hline1(this), + hline2(this), + hline3(this), + first_set(TRUE) +{ + p_str = QPixmap(str_xpm); + p_str = QPixmap(str_xpm); + p_dex = QPixmap(dex_xpm); + p_con = QPixmap(cns_xpm); + p_int = QPixmap(int_xpm); + p_wis = QPixmap(wis_xpm); + p_cha = QPixmap(cha_xpm); + + p_chaotic = QPixmap(chaotic_xpm); + p_neutral = QPixmap(neutral_xpm); + p_lawful = QPixmap(lawful_xpm); + + p_satiated = QPixmap(satiated_xpm); + p_hungry = QPixmap(hungry_xpm); + + p_confused = QPixmap(confused_xpm); + p_sick_fp = QPixmap(sick_fp_xpm); + p_sick_il = QPixmap(sick_il_xpm); + p_blind = QPixmap(blind_xpm); + p_stunned = QPixmap(stunned_xpm); + p_hallu = QPixmap(hallu_xpm); + + p_encumber[0] = QPixmap(slt_enc_xpm); + p_encumber[1] = QPixmap(mod_enc_xpm); + p_encumber[2] = QPixmap(hvy_enc_xpm); + p_encumber[3] = QPixmap(ext_enc_xpm); + p_encumber[4] = QPixmap(ovr_enc_xpm); + + str.setIcon(p_str); + dex.setIcon(p_dex); + con.setIcon(p_con); + intel.setIcon(p_int); + wis.setIcon(p_wis); + cha.setIcon(p_cha); + + align.setIcon(p_neutral); + hunger.setIcon(p_hungry); + + confused.setIcon(p_confused); + sick_fp.setIcon(p_sick_fp); + sick_il.setIcon(p_sick_il); + blind.setIcon(p_blind); + stunned.setIcon(p_stunned); + hallu.setIcon(p_hallu); + + encumber.setIcon(p_encumber[0]); + + hline1.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline2.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline3.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline1.setLineWidth(1); + hline2.setLineWidth(1); + hline3.setLineWidth(1); + + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); + doUpdate(); +} + +void NetHackQtStatusWindow::doUpdate() +{ + const QFont& large=qt_settings->largeFont(); + name.setFont(large); + dlevel.setFont(large); + + const QFont& normal=qt_settings->normalFont(); + str.setFont(normal); + dex.setFont(normal); + con.setFont(normal); + intel.setFont(normal); + wis.setFont(normal); + cha.setFont(normal); + gold.setFont(normal); + hp.setFont(normal); + power.setFont(normal); + ac.setFont(normal); + level.setFont(normal); + exp.setFont(normal); + align.setFont(normal); + time.setFont(normal); + score.setFont(normal); + hunger.setFont(normal); + confused.setFont(normal); + sick_fp.setFont(normal); + sick_il.setFont(normal); + blind.setFont(normal); + stunned.setFont(normal); + hallu.setFont(normal); + encumber.setFont(normal); + + updateStats(); +} + +QWidget* NetHackQtStatusWindow::Widget() { return this; } + +void NetHackQtStatusWindow::Clear() +{ +} +void NetHackQtStatusWindow::Display(bool block) +{ +} +void NetHackQtStatusWindow::CursorTo(int,int y) +{ + cursy=y; +} +void NetHackQtStatusWindow::PutStr(int attr, const char* text) +{ + // do a complete update when line 0 is done (as per X11 fancy status) + if (cursy==0) updateStats(); +} + +void NetHackQtStatusWindow::resizeEvent(QResizeEvent*) +{ + const float SP_name=0.13; // the (large) + const float SP_dlev=0.13; // Level 3 in The Dungeons of Doom (large) + const float SP_atr1=0.25; // STR DEX CON INT WIS CHA + const float SP_hln1=0.02; // --- + const float SP_atr2=0.09; // Au HP PW AC LVL EXP + const float SP_hln2=0.02; // --- + const float SP_time=0.09; // time score + const float SP_hln3=0.02; // --- + const float SP_stat=0.25; // Alignment, Poisoned, Hungry, Sick, etc. + + int h=height(); + int x=0,y=0; + + int iw; // Width of an item across line + int lh; // Height of a line of values + + lh=int(h*SP_name); + name.setGeometry(0,0,width(),lh); y+=lh; + lh=int(h*SP_dlev); + dlevel.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_hln1); + hline1.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_atr1); + iw=width()/6; + str.setGeometry(x,y,iw,lh); x+=iw; + dex.setGeometry(x,y,iw,lh); x+=iw; + con.setGeometry(x,y,iw,lh); x+=iw; + intel.setGeometry(x,y,iw,lh); x+=iw; + wis.setGeometry(x,y,iw,lh); x+=iw; + cha.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_hln2); + hline2.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_atr2); + iw=width()/6; + gold.setGeometry(x,y,iw,lh); x+=iw; + hp.setGeometry(x,y,iw,lh); x+=iw; + power.setGeometry(x,y,iw,lh); x+=iw; + ac.setGeometry(x,y,iw,lh); x+=iw; + level.setGeometry(x,y,iw,lh); x+=iw; + exp.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_hln3); + hline3.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_time); + iw=width()/3; x+=iw/2; + time.setGeometry(x,y,iw,lh); x+=iw; + score.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_stat); + iw=width()/9; + align.setGeometry(x,y,iw,lh); x+=iw; + hunger.setGeometry(x,y,iw,lh); x+=iw; + confused.setGeometry(x,y,iw,lh); x+=iw; + sick_fp.setGeometry(x,y,iw,lh); x+=iw; + sick_il.setGeometry(x,y,iw,lh); x+=iw; + blind.setGeometry(x,y,iw,lh); x+=iw; + stunned.setGeometry(x,y,iw,lh); x+=iw; + hallu.setGeometry(x,y,iw,lh); x+=iw; + encumber.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; +} + + +/* + * Set all widget values to a null string. This is used after all spacings + * have been calculated so that when the window is popped up we don't get all + * kinds of funny values being displayed. + */ +void NetHackQtStatusWindow::nullOut() +{ +} + +void NetHackQtStatusWindow::fadeHighlighting() +{ + name.dissipateHighlight(); + dlevel.dissipateHighlight(); + + str.dissipateHighlight(); + dex.dissipateHighlight(); + con.dissipateHighlight(); + intel.dissipateHighlight(); + wis.dissipateHighlight(); + cha.dissipateHighlight(); + + gold.dissipateHighlight(); + hp.dissipateHighlight(); + power.dissipateHighlight(); + ac.dissipateHighlight(); + level.dissipateHighlight(); + exp.dissipateHighlight(); + align.dissipateHighlight(); + + time.dissipateHighlight(); + score.dissipateHighlight(); + + hunger.dissipateHighlight(); + confused.dissipateHighlight(); + sick_fp.dissipateHighlight(); + sick_il.dissipateHighlight(); + blind.dissipateHighlight(); + stunned.dissipateHighlight(); + hallu.dissipateHighlight(); + encumber.dissipateHighlight(); +} + +/* + * Update the displayed status. The current code in botl.c updates + * two lines of information. Both lines are always updated one after + * the other. So only do our update when we update the second line. + * + * Information on the first line: + * name, attributes, alignment, score + * + * Information on the second line: + * dlvl, gold, hp, power, ac, {level & exp or HD **} + * status (hunger, conf, halu, stun, sick, blind), time, encumbrance + * + * [**] HD is shown instead of level and exp if mtimedone is non-zero. + */ +void NetHackQtStatusWindow::updateStats() +{ + if (!parentWidget()) return; + + char buf[BUFSZ]; + + if (cursy != 0) return; /* do a complete update when line 0 is done */ + + if (ACURR(A_STR) > 118) { + Sprintf(buf,"STR:%d",ACURR(A_STR)-100); + } else if (ACURR(A_STR)==118) { + Sprintf(buf,"STR:18/**"); + } else if(ACURR(A_STR) > 18) { + Sprintf(buf,"STR:18/%02d",ACURR(A_STR)-18); + } else { + Sprintf(buf,"STR:%d",ACURR(A_STR)); + } + str.setLabel(buf,NetHackQtLabelledIcon::NoNum,ACURR(A_STR)); + + dex.setLabel("DEX:",(long)ACURR(A_DEX)); + con.setLabel("CON:",(long)ACURR(A_CON)); + intel.setLabel("INT:",(long)ACURR(A_INT)); + wis.setLabel("WIS:",(long)ACURR(A_WIS)); + cha.setLabel("CHA:",(long)ACURR(A_CHA)); + const char* hung=hu_stat[u.uhs]; + if (hung[0]==' ') { + hunger.hide(); + } else { + hunger.setIcon(u.uhs ? p_hungry : p_satiated); + hunger.setLabel(hung); + hunger.show(); + } + if (Confusion) confused.show(); else confused.hide(); + if (Sick) { + if (u.usick_type & SICK_VOMITABLE) { + sick_fp.show(); + } else { + sick_fp.hide(); + } + if (u.usick_type & SICK_NONVOMITABLE) { + sick_il.show(); + } else { + sick_il.hide(); + } + } else { + sick_fp.hide(); + sick_il.hide(); + } + if (Blind) blind.show(); else blind.hide(); + if (Stunned) stunned.show(); else stunned.hide(); + if (Hallucination) hallu.show(); else hallu.hide(); + const char* enc=enc_stat[near_capacity()]; + if (enc[0]==' ' || !enc[0]) { + encumber.hide(); + } else { + encumber.setIcon(p_encumber[near_capacity()-1]); + encumber.setLabel(enc); + encumber.show(); + } + Strcpy(buf, g.plname); + if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a'; + Strcat(buf, " the "); + if (u.mtimedone) { + char mname[BUFSZ]; + int k = 0; + + Strcpy(mname, mons[u.umonnum].mname); + while(mname[k] != 0) { + if ((k == 0 || (k > 0 && mname[k-1] == ' ')) + && 'a' <= mname[k] && mname[k] <= 'z') + { + mname[k] += 'A' - 'a'; + } + k++; + } + Strcat(buf, mname); + } else { + Strcat(buf, rank_of(u.ulevel, pl_character[0], ::flags.female)); + } + name.setLabel(buf,NetHackQtLabelledIcon::NoNum,u.ulevel); + + if (describe_level(buf)) { + dlevel.setLabel(buf,(bool)TRUE); + } else { + Sprintf(buf, "%s, level ", dungeons[u.uz.dnum].dname); + dlevel.setLabel(buf,(long)depth(&u.uz)); + } + + gold.setLabel("Au:", money_cnt(g.invent)); + if (u.mtimedone) { + // You're a monster! + + Sprintf(buf, "/%d", u.mhmax); + hp.setLabel("HP:",u.mh > 0 ? u.mh : 0,buf); + level.setLabel("HD:",(long)mons[u.umonnum].mlevel); + } else { + // You're normal. + + Sprintf(buf, "/%d", u.uhpmax); + hp.setLabel("HP:",u.uhp > 0 ? u.uhp : 0,buf); + level.setLabel("Level:",(long)u.ulevel); + } + Sprintf(buf, "/%d", u.uenmax); + power.setLabel("Pow:",u.uen,buf); + ac.setLabel("AC:",(long)u.uac); + if (::flags.showexp) { + exp.setLabel("Exp:",(long)u.uexp); + } else + { + exp.setLabel(""); + } + if (u.ualign.type==A_CHAOTIC) { + align.setIcon(p_chaotic); + align.setLabel("Chaotic"); + } else if (u.ualign.type==A_NEUTRAL) { + align.setIcon(p_neutral); + align.setLabel("Neutral"); + } else { + align.setIcon(p_lawful); + align.setLabel("Lawful"); + } + + if (::flags.time) time.setLabel("Time:",(long)g.moves); + else time.setLabel(""); +#ifdef SCORE_ON_BOTL + if (::flags.showscore) { + score.setLabel("Score:",(long)botl_score()); + } else +#endif + { + score.setLabel(""); + } + + if (first_set) + { + first_set=FALSE; + + name.highlightWhenChanging(); + dlevel.highlightWhenChanging(); + + str.highlightWhenChanging(); + dex.highlightWhenChanging(); + con.highlightWhenChanging(); + intel.highlightWhenChanging(); + wis.highlightWhenChanging(); + cha.highlightWhenChanging(); + + gold.highlightWhenChanging(); + hp.highlightWhenChanging(); + power.highlightWhenChanging(); + ac.highlightWhenChanging(); ac.lowIsGood(); + level.highlightWhenChanging(); + exp.highlightWhenChanging(); + align.highlightWhenChanging(); + + //time.highlightWhenChanging(); + score.highlightWhenChanging(); + + hunger.highlightWhenChanging(); + confused.highlightWhenChanging(); + sick_fp.highlightWhenChanging(); + sick_il.highlightWhenChanging(); + blind.highlightWhenChanging(); + stunned.highlightWhenChanging(); + hallu.highlightWhenChanging(); + encumber.highlightWhenChanging(); + } +} + +/* + * Turn off hilighted status values after a certain amount of turns. + */ +void NetHackQtStatusWindow::checkTurnEvents() +{ +} + + + +NetHackQtMenuDialog::NetHackQtMenuDialog() : + QDialog(qApp->mainWidget(),0,FALSE) +{ +} + +void NetHackQtMenuDialog::resizeEvent(QResizeEvent*) +{ + emit Resized(); +} + +void NetHackQtMenuDialog::Accept() +{ + accept(); +} + +void NetHackQtMenuDialog::Reject() +{ + reject(); +} + +void NetHackQtMenuDialog::SetResult(int r) +{ + setResult(r); +} + +void NetHackQtMenuDialog::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +// Table view columns: +// +// [pick-count] [accel] [glyph] [string] +// +// Maybe accel should be near string. We'll see. +// pick-count normally blank. +// double-clicking or click-on-count gives pop-up entry +// string is green when selected +// +NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : + QTableView(), + keysource(ks), + dialog(new NetHackQtMenuDialog()), + prompt(0), + pressed(-1) +{ + setNumCols(4); + setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height())); + setBackgroundColor(lightGray); + setFrameStyle(Panel|Sunken); + setLineWidth(2); + + ok=new QPushButton("Ok",dialog); + connect(ok,SIGNAL(clicked()),dialog,SLOT(accept())); + + cancel=new QPushButton("Cancel",dialog); + connect(cancel,SIGNAL(clicked()),dialog,SLOT(reject())); + + all=new QPushButton("All",dialog); + connect(all,SIGNAL(clicked()),this,SLOT(All())); + + none=new QPushButton("None",dialog); + connect(none,SIGNAL(clicked()),this,SLOT(ChooseNone())); + + invert=new QPushButton("Invert",dialog); + connect(invert,SIGNAL(clicked()),this,SLOT(Invert())); + + search=new QPushButton("Search",dialog); + connect(search,SIGNAL(clicked()),this,SLOT(Search())); + + QPoint pos(0,ok->height()); + recreate(dialog,0,pos); + prompt.recreate(dialog,0,pos); + + setBackgroundColor(lightGray); + + connect(dialog,SIGNAL(Resized()),this,SLOT(Layout())); + + setTableFlags(Tbl_autoHScrollBar|Tbl_autoVScrollBar + |Tbl_smoothScrolling|Tbl_clipCellPainting); + setFocusPolicy(StrongFocus); +} + +NetHackQtMenuWindow::~NetHackQtMenuWindow() +{ + // Remove from dialog before we destruct it + recreate(0,0,QPoint(0,0)); + delete dialog; +} + +void NetHackQtMenuWindow::focusInEvent(QFocusEvent *) +{ + // Don't repaint at all, since nothing is using the focus colour +} +void NetHackQtMenuWindow::focusOutEvent(QFocusEvent *) +{ + // Don't repaint at all, since nothing is using the focus colour +} + +int NetHackQtMenuWindow::cellWidth(int col) +{ + switch (col) { + case 0: + return fontMetrics().width("All "); + break; case 1: + return fontMetrics().width(" m "); + break; case 2: + return qt_settings->glyphs().width(); + break; case 3: + return str_width; + } + impossible("Extra column (#%d) in MenuWindow",col); + return 0; +} + +QWidget* NetHackQtMenuWindow::Widget() { return dialog; } + +void NetHackQtMenuWindow::StartMenu() +{ + setNumRows((itemcount=0)); + str_width=200; + str_fixed=FALSE; + next_accel=0; + has_glyphs=FALSE; +} + +NetHackQtMenuWindow::MenuItem::MenuItem() : + str(0) +{ +} + +NetHackQtMenuWindow::MenuItem::~MenuItem() +{ + if (str) free((void*)str); +} + +#define STR_MARGIN 4 + +void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, + char ch, char gch, int attr, const char* str, bool presel) +{ + if (!ch && identifier->a_void!=0) { + // Supply a keyboard accelerator. Limited supply. + static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + if (accel[next_accel]) { + ch=accel[next_accel++]; + } + } + + if ((int)item.size() < itemcount+1) { + item.resize(itemcount*4+10); + } + item[itemcount].glyph=glyph; + item[itemcount].identifier=*identifier; + item[itemcount].ch=ch; + item[itemcount].attr=attr; + item[itemcount].str=strdup(str); + item[itemcount].selected=presel; + item[itemcount].count=-1; + ++itemcount; + + str_fixed=str_fixed || strstr(str," "); + if (glyph!=NO_GLYPH) has_glyphs=TRUE; +} +void NetHackQtMenuWindow::EndMenu(const char* p) +{ + prompt.setText(p ? p : ""); +} +void NetHackQtMenuWindow::Layout() +{ + int butw=totalWidth()/6; // 6 buttons + int buth=fontMetrics().height()+8; // 8 for spacing & mitres + int prompth=(prompt.text().isNull() ? 0 : buth); + + prompt.setGeometry(6,buth,dialog->width()-6,prompth); + int h=dialog->height()-buth-prompth; + setGeometry(0,buth+prompth, dialog->width(), h); + + // Below, we take care to use up full width + int x=0; + ok->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/5; + cancel->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/4; + all->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/3; + none->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/2; + invert->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/1; + search->setGeometry(x,0,butw,buth); +} + +int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) +{ + setFont(str_fixed ? + qt_settings->normalFixedFont() : qt_settings->normalFont()); + + for (int i=0; iglyphs().height()+1,fontMetrics().height())); + setNumRows(itemcount); + + int buth=fontMetrics().height()+8; // 8 for spacing & mitres + + how=h; + + ok->setEnabled(how!=PICK_ONE);ok->setDefault(how!=PICK_ONE); + cancel->setEnabled(TRUE); + all->setEnabled(how==PICK_ANY); + none->setEnabled(how==PICK_ANY); + invert->setEnabled(how==PICK_ANY); + search->setEnabled(how!=PICK_NONE); + + dialog->SetResult(-1); + + // 20 allows for scrollbar or spacing + // 4 for frame borders + int mh = QApplication::desktop()->height()*3/5; + if ( qt_compact_mode && totalHeight() > mh ) { + // big, so make it fill + dialog->showMaximized(); + } else { + dialog->resize(totalWidth()+20, + QMIN(totalHeight(), mh)+buth+4+(prompt.text().isNull() ? 0 : buth)); + if ( dialog->width() > QApplication::desktop()->width() ) + dialog->resize(QApplication::desktop()->width(),dialog->height()+16); + centerOnMain(dialog); + dialog->show(); + } + + setFocus(); + while (dialog->result()<0) { + // changed the defaults below to the values in wintype.h 000119 - azy + if (!keysource.Empty()) { + char k=keysource.GetAscii(); + k=map_menu_cmd(k); /* added 000119 - azy */ + if (k=='\033') + dialog->Reject(); + else if (k=='\r' || k=='\n' || k==' ') + dialog->Accept(); + else if (k==MENU_SEARCH) + Search(); + else if (k==MENU_SELECT_ALL) + All(); + else if (k==MENU_INVERT_ALL) + Invert(); + else if (k==MENU_UNSELECT_ALL) + ChooseNone(); + else { + for (int i=0; iresult()<0) + qApp->enter_loop(); + } + //if ( (nhid != WIN_INVEN || !iflags.perm_invent) ) // doesn't work yet + { + dialog->hide(); + } + int result=dialog->result(); + + // Consume ^M (which QDialog steals for default button) + while (!keysource.Empty() && + (keysource.TopAscii()=='\n' || keysource.TopAscii()=='\r')) + keysource.GetAscii(); + + *menu_list=0; + if (how==PICK_NONE) + return result==0 ? -1 : 0; + + if (result>0) { + if (how==PICK_ONE) { + int i; + for (i=0; istate()&ShiftButton)) { + if (event->key()==Key_Prior) { + setYOffset(yOffset()-viewHeight()); + } else if (event->key()==Key_Next) { + setYOffset(yOffset()+viewHeight()); + } else { + event->ignore(); + } + } else { + event->ignore(); + } +} + +void NetHackQtMenuWindow::All() +{ + for (int i=0; iAccept(); + } + } +} + + +void NetHackQtMenuWindow::paintCell(QPainter* painter, int row, int col) +{ + // [pick-count] [accel] [glyph] [string] + + MenuItem& i = item[row]; + + painter->setPen(black); + painter->setFont(font()); + + if (i.selected) { + painter->setPen(darkGreen); + } + + switch (col) { + case 0: + if ( i.ch || i.attr!=ATR_INVERSE ) { + QString text; + if ( i.selected && i.count == -1 ) { + if ( i.str[0]>='0' && i.str[0]<='9' ) + text = "All"; + else + text = "*"; + } else if ( i.count<0 ) { + text = "-"; + } else { + text.sprintf("%d",i.count); + } + painter->drawText(0,0,cellWidth(col),cellHeight(), + AlignHCenter|AlignVCenter,text); + } + break; case 1: + if ((signed char)i.ch >= 0) { + char text[2]={i.ch,0}; + painter->drawText(0,0,cellWidth(col),cellHeight(), + AlignHCenter|AlignVCenter,text); + } + break; case 2: + if (i.glyph!=NO_GLYPH) { + // Centered in height + int y=(cellHeight()-qt_settings->glyphs().height())/2; + if (y<0) y=0; + qt_settings->glyphs().drawGlyph(*painter, i.glyph, 0, y); + } + break; case 3: + // XXX should qt_settings have ALL the various fonts + QFont newfont=font(); + + if (i.attr) { + switch(i.attr) { + case ATR_ULINE: + newfont.setUnderline(TRUE); + break; case ATR_BOLD: + painter->setPen(red); + break; case ATR_BLINK: + newfont.setItalic(TRUE); + break; case ATR_INVERSE: + newfont=qt_settings->largeFont(); + newfont.setWeight(QFont::Bold); + + if (i.selected) { + painter->setPen(blue); + } else { + painter->setPen(darkBlue); + } + } + } + painter->setFont(newfont); + + painter->drawText(STR_MARGIN,0,cellWidth(col),cellHeight(), + AlignLeft|AlignVCenter,i.str); + } +} + +void NetHackQtMenuWindow::mousePressEvent(QMouseEvent* event) +{ + int col=findCol(event->pos().x()); + int row=findRow(event->pos().y()); + + if (col<0 || row<0 || !item[row].Selectable()) return; + + if (how!=PICK_NONE) { + if (col==0) { + // Changing count. + NetHackQtStringRequestor requestor(keysource,"Count:"); + char buf[BUFSZ]; + + if (item[row].count>0) + Sprintf(buf,"%d", item[row].count); + else + Strcpy(buf, ""); + + requestor.SetDefault(buf); + if (requestor.Get(buf)) { + item[row].count=atoi(buf); + if (item[row].count==0) { + item[row].count=-1; + if (item[row].selected) ToggleSelect(row); + } else { + if (!item[row].selected) ToggleSelect(row); + } + updateCell(row,0); + } + } else { + pressed=row; + was_sel=item[row].selected; + ToggleSelect(row); + updateCell(row,0); + } + } +} + +void NetHackQtMenuWindow::mouseReleaseEvent(QMouseEvent* event) +{ + if (pressed>=0) { + int p=pressed; + pressed=-1; + updateCell(p,3); + } +} + +void NetHackQtMenuWindow::mouseMoveEvent(QMouseEvent* event) +{ + if (pressed>=0) { + int col=findCol(event->pos().x()); + int row=findRow(event->pos().y()); + + if (row>=0 && col>=0) { + if (pressed!=row) { + // reset to initial state + if (item[pressed].selected!=was_sel) + ToggleSelect(pressed); + } else { + // reset to new state + if (item[pressed].selected==was_sel) + ToggleSelect(pressed); + } + } + } +} + + +class NetHackQtTextListBox : public QListBox { +public: + NetHackQtTextListBox(QWidget* parent) : QListBox(parent) { } + + int TotalWidth() + { + doLayout(); + return contentsWidth(); + } + int TotalHeight() + { + doLayout(); + return contentsHeight(); + } + + virtual void setFont(const QFont &font) + { + QListBox::setFont(font); + } + void keyPressEvent(QKeyEvent* e) + { + QListBox::keyPressEvent(e); + } +}; + + +QPixmap* NetHackQtRIP::pixmap=0; + +NetHackQtRIP::NetHackQtRIP(QWidget* parent) : + QWidget(parent) +{ + if (!pixmap) { + pixmap=new QPixmap; + tryload(*pixmap, "rip.xpm"); + } + riplines=0; + resize(pixmap->width(),pixmap->height()); + setFont(QFont("times",12)); // XXX may need to be configurable +} + +void NetHackQtRIP::setLines(char** l, int n) +{ + line=l; + riplines=n; +} + +QSize NetHackQtRIP::sizeHint() const +{ + return pixmap->size(); +} + +void NetHackQtRIP::paintEvent(QPaintEvent* event) +{ + if ( riplines ) { + int pix_x=(width()-pixmap->width())/2; + int pix_y=(height()-pixmap->height())/2; + + // XXX positions based on RIP image + int rip_text_x=pix_x+156; + int rip_text_y=pix_y+67; + int rip_text_h=94/riplines; + + QPainter painter; + painter.begin(this); + painter.drawPixmap(pix_x,pix_y,*pixmap); + for (int i=0; imainWidget(),0,FALSE), + keysource(ks), + use_rip(FALSE), + str_fixed(FALSE), + ok("Dismiss",this), + search("Search",this), + lines(new NetHackQtTextListBox(this)), + rip(this) +{ + ok.setDefault(TRUE); + connect(&ok,SIGNAL(clicked()),this,SLOT(accept())); + connect(&search,SIGNAL(clicked()),this,SLOT(Search())); + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); + + QVBoxLayout* vb = new QVBoxLayout(this); + vb->addWidget(&rip); + QHBoxLayout* hb = new QHBoxLayout(vb); + hb->addWidget(&ok); + hb->addWidget(&search); + vb->addWidget(lines); +} + +void NetHackQtTextWindow::doUpdate() +{ + update(); +} + + +NetHackQtTextWindow::~NetHackQtTextWindow() +{ + +} + +QWidget* NetHackQtTextWindow::Widget() +{ + return this; +} + +bool NetHackQtTextWindow::Destroy() +{ + return !isVisible(); +} + +void NetHackQtTextWindow::UseRIP(int how, time_t when) +{ +// Code from X11 windowport +#define STONE_LINE_LEN 16 /* # chars that fit on one line */ +#define NAME_LINE 0 /* line # for player name */ +#define GOLD_LINE 1 /* line # for amount of gold */ +#define DEATH_LINE 2 /* line # for death description */ +#define YEAR_LINE 6 /* line # for year */ + +static char** rip_line=0; + if (!rip_line) { + rip_line=new char*[YEAR_LINE+1]; + for (int i=0; i STONE_LINE_LEN) { + for(i = STONE_LINE_LEN; + ((i0 > STONE_LINE_LEN) && i); i--) + if(dpx[i] == ' ') i0 = i; + if(!i) i0 = STONE_LINE_LEN; + } + tmpchar = dpx[i0]; + dpx[i0] = 0; + strcpy(rip_line[line], dpx); + if (tmpchar != ' ') { + dpx[i0] = tmpchar; + dpx= &dpx[i0]; + } else dpx= &dpx[i0+1]; + } + + /* Put year on stone */ + year = yyyymmdd(when) / 10000L; + Sprintf(rip_line[YEAR_LINE], "%4ld", year); + + rip.setLines(rip_line,YEAR_LINE+1); + + use_rip=TRUE; +} + +void NetHackQtTextWindow::Clear() +{ + lines->clear(); + use_rip=FALSE; + str_fixed=FALSE; +} + +void NetHackQtTextWindow::Display(bool block) +{ + if (str_fixed) { + lines->setFont(qt_settings->normalFixedFont()); + } else { + lines->setFont(qt_settings->normalFont()); + } + + int h=0; + if (use_rip) { + h+=rip.height(); + ok.hide(); + search.hide(); + rip.show(); + } else { + h+=ok.height()*2; + ok.show(); + search.show(); + rip.hide(); + } + int mh = QApplication::desktop()->height()*3/5; + if ( qt_compact_mode && (lines->TotalHeight() > mh || use_rip) ) { + // big, so make it fill + showMaximized(); + } else { + resize(QMAX(use_rip ? rip.width() : 200, + lines->TotalWidth()+24), + QMIN(mh, lines->TotalHeight()+h)); + centerOnMain(this); + show(); + } + if (block) { + setResult(-1); + while (result()==-1) { + qApp->enter_loop(); + if (result()==-1 && !keysource.Empty()) { + char k=keysource.GetAscii(); + if (k=='\033' || k==' ' || k=='\r' || k=='\n') { + accept(); + } else if (k=='/') { + Search(); + } + } + } + } +} + +void NetHackQtTextWindow::PutStr(int attr, const char* text) +{ + str_fixed=str_fixed || strstr(text," "); + lines->insertItem(text); +} + +void NetHackQtTextWindow::done(int i) +{ + setResult(i+1000); + hide(); + qApp->exit_loop(); +} + +void NetHackQtTextWindow::keyPressEvent(QKeyEvent* e) +{ + if ( e->ascii() != '\r' && e->ascii() != '\n' && e->ascii() != '\033' ) + lines->keyPressEvent(e); + else + QDialog::keyPressEvent(e); +} + +void NetHackQtTextWindow::Search() +{ + NetHackQtStringRequestor requestor(keysource,"Search for:"); + static char line[256]=""; + requestor.SetDefault(line); + if (requestor.Get(line)) { + int current=lines->currentItem(); + for (uint i=1; icount(); i++) { + int lnum=(i+current)%lines->count(); + QString str=lines->text(lnum); + if (str.contains(line)) { + lines->setCurrentItem(lnum); + lines->centerCurrentItem(); + return; + } + } + lines->setCurrentItem(-1); + } +} + + +NetHackQtDelay::NetHackQtDelay(int ms) : + msec(ms) +{ +} + +void NetHackQtDelay::wait() +{ + startTimer(msec); + qApp->enter_loop(); +} + +void NetHackQtDelay::timerEvent(QTimerEvent* timer) +{ + qApp->exit_loop(); + killTimers(); +} + +NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : + QWidget(parent) +{ +} + +void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int y, bool canbe) +{ + short int glyph; + if (nhobj) + glyph=obj_to_glyph(nhobj, rn2_on_display_rng); + else if (canbe) + glyph=cmap_to_glyph(S_room); + else + glyph=cmap_to_glyph(S_stone); + + qt_settings->glyphs().drawCell(painter,glyph,x,y); +} + +void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*) +{ + // 012 + // + //0 WhB + //1 s"w + //2 gCg + //3 =A= + //4 T + //5 S + + QPainter painter; + painter.begin(this); + + // Blanks + drawWorn(painter,0,0,4,FALSE); + drawWorn(painter,0,0,5,FALSE); + drawWorn(painter,0,2,4,FALSE); + drawWorn(painter,0,2,5,FALSE); + + drawWorn(painter,uarm,1,3); // Armour + drawWorn(painter,uarmc,1,2); // Cloak + drawWorn(painter,uarmh,1,0); // Helmet + drawWorn(painter,uarms,0,1); // Shield + drawWorn(painter,uarmg,0,2); // Gloves - repeated + drawWorn(painter,uarmg,2,2); // Gloves - repeated + drawWorn(painter,uarmf,1,5); // Shoes (feet) + drawWorn(painter,uarmu,1,4); // Undershirt + drawWorn(painter,uleft,0,3); // RingL + drawWorn(painter,uright,2,3); // RingR + + drawWorn(painter,uwep,2,1); // Weapon + drawWorn(painter,uswapwep,0,0); // Secondary weapon + drawWorn(painter,uamul,1,1); // Amulet + drawWorn(painter,ublindf,2,0); // Blindfold + + painter.end(); +} + +class SmallToolButton : public QToolButton { +public: + SmallToolButton(const QPixmap & pm, const QString &textLabel, + const QString& grouptext, + QObject * receiver, const char* slot, + QToolBar * parent) : + QToolButton(pm, textLabel, +#if QT_VERSION < 210 + QString::null, +#else + grouptext, +#endif + receiver, slot, parent) + { + } + + QSize sizeHint() const + { + // get just a couple more pixels for the map + return QToolButton::sizeHint()-QSize(0,2); + } +}; + + +NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : + message(0), map(0), status(0), invusage(0), + keysink(ks), dirkey(0) +{ + QToolBar* toolbar = new QToolBar(this); +#if QT_VERSION >= 210 + setToolBarsMovable(FALSE); + toolbar->setHorizontalStretchable(TRUE); + toolbar->setVerticalStretchable(TRUE); +#endif + addToolBar(toolbar); + menubar = menuBar(); + + setCaption("Qt NetHack"); + if ( qt_compact_mode ) + setIcon(QPixmap(nh_icon_small)); + else + setIcon(QPixmap(nh_icon)); + + QPopupMenu* game=new QPopupMenu; + QPopupMenu* apparel=new QPopupMenu; + QPopupMenu* act1=new QPopupMenu; + QPopupMenu* act2 = qt_compact_mode ? new QPopupMenu : act1; + QPopupMenu* magic=new QPopupMenu; + QPopupMenu* info=new QPopupMenu; + + QPopupMenu *help; + +#ifdef KDE + help = kapp->getHelpMenu( TRUE, "" ); + help->insertSeparator(); +#else + help = qt_compact_mode ? info : new QPopupMenu; +#endif + + enum { OnDesktop=1, OnHandhelds=2 }; + struct Macro { + QPopupMenu* menu; + const char* name; + const char* action; + int flags; + } item[] = { + { game, 0, 0, 3}, + { game, "Version\tv", "v", 3}, + { game, "Compilation\tAlt+V", "\366", 3}, + { game, "History\tShift+V", "V", 3}, + { game, "Redraw\tCtrl+R", "\022", 0}, // useless + { game, "Options\tShift+O", "O", 3}, + { game, "Explore mode\tShift+X", "X", 3}, + { game, 0, 0, 3}, + { game, "Save\tSy", "Sy", 3}, + { game, "Quit\tAlt+Q", "\361", 3}, + + { apparel, "Apparel off\tShift+A", "A", 2}, + { apparel, "Remove many\tShift+A", "A", 1}, + { apparel, 0, 0, 3}, + { apparel, "Wield weapon\tw", "w", 3}, + { apparel, "Exchange weapons\tx", "x", 3}, + { apparel, "Two weapon combat\t#two", "#tw", 3}, + { apparel, "Load quiver\tShift+Q", "Q", 3}, + { apparel, 0, 0, 3}, + { apparel, "Wear armour\tShift+W", "W", 3}, + { apparel, "Take off armour\tShift+T", "T", 3}, + { apparel, 0, 0, 3}, + { apparel, "Put on non-armour\tShift+P", "P", 3}, + { apparel, "Remove non-armour\tShift+R", "R", 3}, + + { act1, "Again\tCtrl+A", "\001", 2}, + { act1, 0, 0, 3}, + { act1, "Apply\ta?", "a?", 3}, + { act1, "Chat\tAlt+C", "\343", 3}, + { act1, "Close door\tc", "c", 3}, + { act1, "Down\t>", ">", 3}, + { act1, "Drop many\tShift+D", "D", 2}, + { act1, "Drop\td?", "d?", 2}, + { act1, "Eat\te?", "e?", 2}, + { act1, "Engrave\tShift+E", "E", 3}, + { act1, "Fight\tShift+F", "F", 3}, + { act1, "Fire from quiver\tf", "f", 2}, + { act1, "Force\tAlt+F", "\346", 3}, + { act1, "Get\t,", ",", 2}, + { act1, "Jump\tAlt+J", "\352", 3}, + { act2, "Kick\tCtrl+D", "\004", 2}, + { act2, "Loot\tAlt+L", "\354", 3}, + { act2, "Open door\to", "o", 3}, + { act2, "Pay\tp", "p", 3}, + { act2, "Rest\t.", ".", 2}, + { act2, "Ride\t#ri", "#ri", 3}, + { act2, "Search\ts", "s", 3}, + { act2, "Sit\tAlt+S", "\363", 3}, + { act2, "Throw\tt", "t", 2}, + { act2, "Untrap\t#u", "#u", 3}, + { act2, "Up\t<", "<", 3}, + { act2, "Wipe face\tAlt+W", "\367", 3}, + + { magic, "Quaff potion\tq?", "q?", 3}, + { magic, "Read scroll/book\tr?", "r?", 3}, + { magic, "Zap wand\tz?", "z?", 3}, + { magic, "Zap spell\tShift+Z", "Z", 3}, + { magic, "Dip\tAlt+D", "\344", 3}, + { magic, "Rub\tAlt+R", "\362", 3}, + { magic, "Invoke\tAlt+I", "\351", 3}, + { magic, 0, 0, 3}, + { magic, "Offer\tAlt+O", "\357", 3}, + { magic, "Pray\tAlt+P", "\360", 3}, + { magic, 0, 0, 3}, + { magic, "Teleport\tCtrl+T", "\024", 3}, + { magic, "Monster action\tAlt+M", "\355", 3}, + { magic, "Turn undead\tAlt+T", "\364", 3}, + + { help, "Help\t?", "?", 3}, + { help, 0, 0, 3}, + { help, "What is here\t:", ":", 3}, + { help, "What is there\t;", ";", 3}, + { help, "What is...\t/y", "/y", 2}, + { help, 0, 0, 1}, + + { info, "Inventory\ti", "i", 3}, +#ifdef SLASHEM + { info, "Angbandish inventory\t*", "*", 3}, +#endif + { info, "Conduct\t#co", "#co", 3}, + { info, "Discoveries\t\\", "\\", 3}, + { info, "List/reorder spells\t+", "+", 3}, + { info, "Adjust letters\tAlt+A", "\341", 2}, + { info, 0, 0, 3}, + { info, "Name object\tAlt+N", "\356y?", 3}, + { info, "Name object type\tAlt+N", "\356n?", 3}, + { info, "Name creature\tShift+C", "C", 3}, + { info, 0, 0, 3}, + { info, "Qualifications\tAlt+E", "\345", 3}, + + { 0, 0, 0, 0 } + }; + + int i; + int count=0; + for (i=0; item[i].menu; i++) + if (item[i].name) count++; + + macro=new const char* [count]; + + game->insertItem("Qt settings...",1000); + help->insertItem("About Qt NetHack...",2000); + //help->insertItem("NetHack Guidebook...",3000); + help->insertSeparator(); + + count=0; + for (i=0; item[i].menu; i++) { + if ( item[i].flags & (qt_compact_mode ? 1 : 2) ) { + if (item[i].name) { + QString name = item[i].name; + if ( qt_compact_mode ) // accelerators aren't + name.replace(QRegExp("\t.*"),""); + item[i].menu->insertItem(name,count); + macro[count++]=item[i].action; + } else { + item[i].menu->insertSeparator(); + } + } + } + + menubar->insertItem("Game",game); + menubar->insertItem("Gear",apparel); + + if ( qt_compact_mode ) { + menubar->insertItem("A-J",act1); + menubar->insertItem("K-Z",act2); + menubar->insertItem("Magic",magic); + menubar->insertItem(QPixmap(info_xpm),info); + menubar->insertItem(QPixmap(map_xpm), this, SLOT(raiseMap())); + menubar->insertItem(QPixmap(msg_xpm), this, SLOT(raiseMessages())); + menubar->insertItem(QPixmap(stat_xpm), this, SLOT(raiseStatus())); + } else { + menubar->insertItem("Action",act1); + menubar->insertItem("Magic",magic); + menubar->insertItem("Info",info); + menubar->insertSeparator(); + menubar->insertItem("Help",help); + } + + QSignalMapper* sm = new QSignalMapper(this); + connect(sm, SIGNAL(mapped(const QString&)), this, SLOT(doKeys(const QString&))); + QToolButton* tb; + tb = new SmallToolButton( QPixmap(again_xpm),"Again","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "\001" ); + tb = new SmallToolButton( QPixmap(get_xpm),"Get","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "," ); + tb = new SmallToolButton( QPixmap(kick_xpm),"Kick","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "\004" ); + tb = new SmallToolButton( QPixmap(throw_xpm),"Throw","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "t" ); + tb = new SmallToolButton( QPixmap(fire_xpm),"Fire","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "f" ); + tb = new SmallToolButton( QPixmap(drop_xpm),"Drop","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "D" ); + tb = new SmallToolButton( QPixmap(eat_xpm),"Eat","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "e" ); + tb = new SmallToolButton( QPixmap(rest_xpm),"Rest","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "." ); + tb = new SmallToolButton( QPixmap(cast_a_xpm),"Cast A","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Za" ); + tb = new SmallToolButton( QPixmap(cast_b_xpm),"Cast B","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Zb" ); + tb = new SmallToolButton( QPixmap(cast_c_xpm),"Cast C","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Zc" ); + if ( !qt_compact_mode ) { + QWidget* filler = new QWidget(toolbar); + filler->setBackgroundMode(PaletteButton); + toolbar->setStretchableWidget(filler); + } + + connect(menubar,SIGNAL(activated(int)),this,SLOT(doMenuItem(int))); + +#ifdef KDE + setMenu (menubar); +#endif + + int x=0,y=0; + int w=QApplication::desktop()->width()-10; // XXX arbitrary extra space for frame + int h=QApplication::desktop()->height()-50; + + int maxwn; + int maxhn; + if (qt_tilewidth != NULL) { + maxwn = atoi(qt_tilewidth) * COLNO + 10; + } else { + maxwn = 1400; + } + if (qt_tileheight != NULL) { + maxhn = atoi(qt_tileheight) * ROWNO * 6/4; + } else { + maxhn = 1024; + } + + // Be exactly the size we want to be - full map... + if (w>maxwn) { + x+=(w-maxwn)/2; + w=maxwn; // Doesn't need to be any wider + } + if (h>maxhn) { + y+=(h-maxhn)/2; + h=maxhn; // Doesn't need to be any taller + } + + setGeometry(x,y,w,h); + + if ( qt_compact_mode ) { + stack = new QWidgetStack(this); + setCentralWidget(stack); + } else { + setCentralWidget(new QWidget(this)); + invusage = new NetHackQtInvUsageWindow(centralWidget()); + } +} + +void NetHackQtMainWindow::zoomMap() +{ + qt_settings->toggleGlyphSize(); +} + +void NetHackQtMainWindow::raiseMap() +{ + if ( stack->id(stack->visibleWidget()) == 0 ) { + zoomMap(); + } else { + stack->raiseWidget(0); + } +} + +void NetHackQtMainWindow::raiseMessages() +{ + stack->raiseWidget(1); +} + +void NetHackQtMainWindow::raiseStatus() +{ + stack->raiseWidget(2); +} + +class NetHackMimeSourceFactory : public QMimeSourceFactory { +public: + const QMimeSource* data(const QString& abs_name) const + { + const QMimeSource* r = 0; + if ( (NetHackMimeSourceFactory*)this == QMimeSourceFactory::defaultFactory() ) + r = QMimeSourceFactory::data(abs_name); + else + r = QMimeSourceFactory::defaultFactory()->data(abs_name); + if ( !r ) { + int sl = abs_name.length(); + do { + sl = abs_name.findRev('/',sl-1); + QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; + int dot = name.findRev('.'); + if ( dot >= 0 ) + name = name.left(dot); + if ( name == "map" ) + r = new QImageDrag(QImage(map_xpm)); + else if ( name == "msg" ) + r = new QImageDrag(QImage(msg_xpm)); + else if ( name == "stat" ) + r = new QImageDrag(QImage(stat_xpm)); + } while (!r && sl>0); + } + return r; + } +}; + +void NetHackQtMainWindow::doMenuItem(int id) +{ + switch (id) { + case 1000: + centerOnMain(qt_settings); + qt_settings->show(); + break; + case 2000: + QMessageBox::about(this, "About Qt NetHack", aboutMsg()); + break; + case 3000: { + QDialog dlg(this,0,TRUE); + (new QVBoxLayout(&dlg))->setAutoAdd(TRUE); + QTextBrowser browser(&dlg); + NetHackMimeSourceFactory ms; + browser.setMimeSourceFactory(&ms); + browser.setSource(QDir::currentDirPath()+"/Guidebook.html"); + if ( qt_compact_mode ) + dlg.showMaximized(); + dlg.exec(); + } + break; + default: + if ( id >= 0 ) + doKeys(macro[id]); + } +} + +void NetHackQtMainWindow::doKeys(const QString& k) +{ + keysink.Put(k); + qApp->exit_loop(); +} + +void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window) +{ + message=window; + ShowIfReady(); +} + +void NetHackQtMainWindow::AddMapWindow(NetHackQtMapWindow* window) +{ + map=window; + ShowIfReady(); + connect(map,SIGNAL(resized()),this,SLOT(layout())); +} + +void NetHackQtMainWindow::AddStatusWindow(NetHackQtStatusWindow* window) +{ + status=window; + ShowIfReady(); +} + +void NetHackQtMainWindow::RemoveWindow(NetHackQtWindow* window) +{ + if (window==status) { + status=0; + ShowIfReady(); + } else if (window==map) { + map=0; + ShowIfReady(); + } else if (window==message) { + message=0; + ShowIfReady(); + } +} + +void NetHackQtMainWindow::updateInventory() +{ + if ( invusage ) + invusage->repaint(FALSE); +} + +void NetHackQtMainWindow::fadeHighlighting() +{ + if (status) { + status->fadeHighlighting(); + } +} + +void NetHackQtMainWindow::layout() +{ + if ( qt_compact_mode ) + return; + if (message && map && status) { + QSize maxs=map->Widget()->maximumSize(); + int maph=QMIN(height()*2/3,maxs.height()); + + QWidget* c = centralWidget(); + int h=c->height(); + int toph=h-maph; + int iuw=3*qt_settings->glyphs().width(); + int topw=(c->width()-iuw)/2; + + message->Widget()->setGeometry(0,0,topw,toph); + invusage->setGeometry(topw,0,iuw,toph); + status->Widget()->setGeometry(topw+iuw,0,topw,toph); + map->Widget()->setGeometry(QMAX(0,(c->width()-maxs.width())/2), + toph,c->width(),maph); + } +} + +void NetHackQtMainWindow::resizeEvent(QResizeEvent*) +{ + layout(); +#ifdef KDE + updateRects(); +#endif +} + +void NetHackQtMainWindow::keyReleaseEvent(QKeyEvent* event) +{ + if ( dirkey ) { + doKeys(QString(QChar(dirkey))); + if ( !event->isAutoRepeat() ) + dirkey = 0; + } +} + +void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event) +{ + // Global key controls + + // For desktop, arrow keys scroll map, since we don't want players + // to think that's the way to move. For handhelds, the normal way is to + // click-to-travel, so we allow the cursor keys for fine movements. + + // 321 + // 4 0 + // 567 + + if ( event->isAutoRepeat() && + event->key() >= Key_Left && event->key() <= Key_Down ) + return; + + const char* d = Cmd.dirchars; + switch (event->key()) { + case Key_Up: + if ( dirkey == d[0] ) + dirkey = d[1]; + else if ( dirkey == d[4] ) + dirkey = d[3]; + else + dirkey = d[2]; + break; case Key_Down: + if ( dirkey == d[0] ) + dirkey = d[7]; + else if ( dirkey == d[4] ) + dirkey = d[5]; + else + dirkey = d[6]; + break; case Key_Left: + if ( dirkey == d[2] ) + dirkey = d[1]; + else if ( dirkey == d[6] ) + dirkey = d[7]; + else + dirkey = d[0]; + break; case Key_Right: + if ( dirkey == d[2] ) + dirkey = d[3]; + else if ( dirkey == d[6] ) + dirkey = d[5]; + else + dirkey = d[4]; + break; case Key_Prior: + dirkey = 0; + if (message) message->Scroll(0,-1); + break; case Key_Next: + dirkey = 0; + if (message) message->Scroll(0,+1); + break; case Key_Space: + if ( flags.rest_on_space ) { + event->ignore(); + return; + } + case Key_Enter: + if ( map ) + map->clickCursor(); + break; default: + dirkey = 0; + event->ignore(); + } +} + +void NetHackQtMainWindow::closeEvent(QCloseEvent* e) +{ + if ( g.program_state.something_worth_saving ) { + switch ( QMessageBox::information( this, "NetHack", + "This will end your NetHack session", + "&Save", "&Cancel", 0, 1 ) ) + { + case 0: + // See dosave() function + if (dosave0()) { + u.uhp = -1; + NetHackQtBind::qt_exit_nhwindows(0); + nh_terminate(EXIT_SUCCESS); + } + break; + case 1: + break; // ignore the event + } + } else { + e->accept(); + } +} + +void NetHackQtMainWindow::ShowIfReady() +{ + if (message && map && status) { + QPoint pos(0,0); + QWidget* p = qt_compact_mode ? stack : centralWidget(); + message->Widget()->recreate(p,0,pos); + map->Widget()->recreate(p,0,pos); + status->Widget()->recreate(p,0,pos); + if ( qt_compact_mode ) { + message->setMap(map); + stack->addWidget(map->Widget(), 0); + stack->addWidget(message->Widget(), 1); + stack->addWidget(status->Widget(), 2); + raiseMap(); + } else { + layout(); + } + showMaximized(); + } else if (isVisible()) { + hide(); + } +} + + +NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) : + QDialog(qApp->mainWidget(),0,FALSE), + question(q), choices(ch), def(df), + keysource(keysrc) +{ + setCaption("NetHack: Question"); +} + +char NetHackQtYnDialog::Exec() +{ + QString ch(choices); + int ch_per_line=6; + QString qlabel; + QString enable; + if ( qt_compact_mode && !choices ) { + // expand choices from prompt + // ##### why isn't choices set properly??? + const char* c=question; + while ( *c && *c != '[' ) + c++; + qlabel = QString(question).left(c-question); + if ( *c ) { + c++; + if ( *c == '-' ) + ch.append(*c++); + char from=0; + while ( *c && *c != ']' && *c != ' ' ) { + if ( *c == '-' ) { + from = c[-1]; + } else if ( from ) { + for (char f=from+1; f<=*c; f++) + ch.append(f); + from = 0; + } else { + ch.append(*c); + from = 0; + } + c++; + } + if ( *c == ' ' ) { + while ( *c && *c != ']' ) { + if ( *c == '*' || *c == '?' ) + ch.append(*c); + c++; + } + } + } + if ( strstr(question, "what direction") ) { + // We replace this regardless, since sometimes you get choices. + const char* d = Cmd.dirchars; + enable=ch; + ch=""; + ch.append(d[1]); + ch.append(d[2]); + ch.append(d[3]); + ch.append(d[0]); + ch.append('.'); + ch.append(d[4]); + ch.append(d[7]); + ch.append(d[6]); + ch.append(d[5]); + ch.append(d[8]); + ch.append(d[9]); + ch_per_line = 3; + def = ' '; + } else { + // Hmm... they'll have to use a virtual keyboard + } + } else { + qlabel = question; + } + if (!ch.isNull()) { + QVBoxLayout vb(this); + vb.setAutoAdd(TRUE); + bool bigq = qlabel.length()>40; + if ( bigq ) { + QLabel* q = new QLabel(qlabel,this); + q->setAlignment(AlignLeft|WordBreak); + q->setMargin(4); + } + QButtonGroup group(ch_per_line, Horizontal, + bigq ? QString::null : qlabel, this); + + int nchoices=ch.length(); + + bool allow_count=ch.contains('#'); + + const int margin=8; + const int gutter=8; + const int extra=fontMetrics().height(); // Extra for group + int x=margin, y=extra+margin; + int butsize=fontMetrics().height()*2+5; + + QPushButton* button; + for (int i=0; isetEnabled(FALSE); + } + button->setFixedSize(butsize,butsize); // Square + if (ch[i]==def) button->setDefault(TRUE); + if (i%10==9) { + // last in row + x=margin; + y+=butsize+gutter; + } else { + x+=butsize+gutter; + } + } + + connect(&group,SIGNAL(clicked(int)),this,SLOT(doneItem(int))); + + QLabel* lb=0; + QLineEdit* le=0; + + if (allow_count) { + QHBox *hb = new QHBox(this); + lb=new QLabel("Count: ",hb); + le=new QLineEdit(hb); + } + + adjustSize(); + centerOnMain(this); + show(); + char choice=0; + char ch_esc=0; + for (uint i=0; i= 1000 ) { + choice = ch[result() - 1000].latin1(); + } + if ( !choice ) + qApp->enter_loop(); + } + hide(); + if (allow_count && !le->text().isEmpty()) { + yn_number=atoi(le->text()); + choice='#'; + } + return choice; + } else { + QLabel label(qlabel,this); + QPushButton cancel("Dismiss",this); + label.setFrameStyle(QFrame::Box|QFrame::Sunken); + label.setAlignment(AlignCenter); + label.resize(fontMetrics().width(qlabel)+60,30+fontMetrics().height()); + cancel.move(width()/2-cancel.width()/2,label.geometry().bottom()+8); + connect(&cancel,SIGNAL(clicked()),this,SLOT(reject())); + centerOnMain(this); + setResult(-1); + show(); + while (result()<0 && keysource.Empty()) { + qApp->enter_loop(); + } + hide(); + if (keysource.Empty()) { + return '\033'; + } else { + return keysource.GetAscii(); + } + } +} +void NetHackQtYnDialog::keyPressEvent(QKeyEvent* event) +{ + // Don't want QDialog's Return/Esc behaviour + event->ignore(); +} + +void NetHackQtYnDialog::doneItem(int i) +{ + done(i+1000); +} + +void NetHackQtYnDialog::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +NetHackQtGlyphs::NetHackQtGlyphs() +{ + const char* tile_file = "nhtiles.bmp"; + if ( iflags.wc_tile_file ) + tile_file = iflags.wc_tile_file; + + if (!img.load(tile_file)) { + tile_file = "x11tiles"; + if (!img.load(tile_file)) { + QString msg; + msg.sprintf("Cannot load x11tiles or nhtiles.bmp"); + QMessageBox::warning(0, "IO Error", msg); + } else { + tiles_per_row = TILES_PER_ROW; + if (img.width()%tiles_per_row) { + impossible( + "Tile file \"%s\" has %d columns, not multiple of row count (%d)", + tile_file, img.width(), tiles_per_row); + } + } + } else { + tiles_per_row = 40; + } + + if ( iflags.wc_tile_width ) + tilefile_tile_W = iflags.wc_tile_width; + else + tilefile_tile_W = img.width() / tiles_per_row; + if ( iflags.wc_tile_height ) + tilefile_tile_H = iflags.wc_tile_height; + else + tilefile_tile_H = tilefile_tile_W; + + setSize(tilefile_tile_W, tilefile_tile_H); +} + +void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y) +{ + int tile = glyph2tile[glyph]; + int px = (tile%tiles_per_row)*width(); + int py = tile/tiles_per_row*height(); + + painter.drawPixmap( + x, + y, + pm, + px,py, + width(),height() + ); +} +void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, int cellx, int celly) +{ + drawGlyph(painter,glyph,cellx*width(),celly*height()); +} +void NetHackQtGlyphs::setSize(int w, int h) +{ + if ( size == QSize(w,h) ) + return; + + bool was1 = size == pm1.size(); + size = QSize(w,h); + if (!w || !h) + return; // Still not decided + + if ( size == pm1.size() ) { + pm = pm1; + return; + } + if ( size == pm2.size() ) { + pm = pm2; + return; + } + + if (w==tilefile_tile_W && h==tilefile_tile_H) { + pm.convertFromImage(img); + } else { + QApplication::setOverrideCursor( Qt::waitCursor ); + QImage scaled = img.smoothScale( + w*img.width()/tilefile_tile_W, + h*img.height()/tilefile_tile_H + ); + pm.convertFromImage(scaled,Qt::ThresholdDither|Qt::PreferDither); + QApplication::restoreOverrideCursor(); + } + (was1 ? pm2 : pm1) = pm; +} + + +////////////////////////////////////////////////////////////// +// +// The ugly C binding classes... +// +////////////////////////////////////////////////////////////// + + +NetHackQtMenuOrTextWindow::NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer& ks) : + actual(0), + keysource(ks) +{ +} + +QWidget* NetHackQtMenuOrTextWindow::Widget() +{ + if (!actual) impossible("Widget called before we know if Menu or Text"); + return actual->Widget(); +} + +// Text +void NetHackQtMenuOrTextWindow::Clear() +{ + if (!actual) + impossible("Clear called before we know if Menu or Text"); + else + actual->Clear(); +} + +void NetHackQtMenuOrTextWindow::Display(bool block) +{ + if (!actual) + impossible("Display called before we know if Menu or Text"); + else + actual->Display(block); +} + +bool NetHackQtMenuOrTextWindow::Destroy() +{ + bool res = FALSE; + + if (!actual) + impossible("Destroy called before we know if Menu or Text"); + else + res = actual->Destroy(); + + return res; +} + +void NetHackQtMenuOrTextWindow::PutStr(int attr, const char* text) +{ + if (!actual) actual=new NetHackQtTextWindow(keysource); + actual->PutStr(attr,text); +} + +// Menu +void NetHackQtMenuOrTextWindow::StartMenu() +{ + if (!actual) actual=new NetHackQtMenuWindow(keysource); + actual->StartMenu(); +} + +void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, + const char* str, bool presel) +{ + if (!actual) impossible("AddMenu called before we know if Menu or Text"); + actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); +} + +void NetHackQtMenuOrTextWindow::EndMenu(const char* prompt) +{ + if (!actual) impossible("EndMenu called before we know if Menu or Text"); + actual->EndMenu(prompt); +} + +int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) +{ + if (!actual) impossible("SelectMenu called before we know if Menu or Text"); + return actual->SelectMenu(how,menu_list); +} + + +// XXX Should be from Options +// +// XXX Hmm. Tricky part is that perhaps some macros should only be active +// XXX when a key is about to be gotten. For example, the user could +// XXX define "-" to do "E-yyyyyyyy\r", but would still need "-" for +// XXX other purposes. Maybe just too bad. +// +struct { + int key; + int state; + const char* macro; +} key_macro[]={ + { Qt::Key_F1, 0, "n100." }, // Rest (x100) + { Qt::Key_F2, 0, "n20s" }, // Search (x20) + { Qt::Key_F3, 0, "o8o4o6o2o8o4o6o2o8o4o6o2" }, // Open all doors (x3) + { Qt::Key_Tab, 0, "\001" }, + { 0, 0, 0 } +}; + + +NetHackQtBind::NetHackQtBind(int& argc, char** argv) : +#ifdef KDE + KApplication(argc,argv) +#elif defined(QWS) // not quite the right condition + QPEApplication(argc,argv) +#else + QApplication(argc,argv) +#endif +{ + QPixmap pm("nhsplash.xpm"); + if ( iflags.wc_splash_screen && !pm.isNull() ) { + QVBox *vb = new QVBox(0,0, + WStyle_Customize | WStyle_NoBorder | nh_WX11BypassWM | WStyle_StaysOnTop ); + splash = vb; + QLabel *lsplash = new QLabel(vb); + lsplash->setAlignment(AlignCenter); + lsplash->setPixmap(pm); + QLabel* capt = new QLabel("Loading...",vb); + capt->setAlignment(AlignCenter); + if ( pm.mask() ) { + lsplash->setFixedSize(pm.size()); + lsplash->setMask(*pm.mask()); + } + splash->move((QApplication::desktop()->width()-pm.width())/2, + (QApplication::desktop()->height()-pm.height())/2); + //splash->setGeometry(0,0,100,100); + if ( qt_compact_mode ) { + splash->showMaximized(); + } else { + vb->setFrameStyle(QFrame::WinPanel|QFrame::Raised); + vb->setMargin(10); + splash->adjustSize(); + splash->show(); + } + + // force content refresh outside event loop + splash->repaint(FALSE); + lsplash->repaint(FALSE); + capt->repaint(FALSE); + qApp->flushX(); + + } else { + splash = 0; + } + main = new NetHackQtMainWindow(keybuffer); +#if defined(QWS) // not quite the right condition + showMainWidget(main); +#else + setMainWidget(main); +#endif + qt_settings=new NetHackQtSettings(main->width(),main->height()); +} + +void NetHackQtBind::qt_init_nhwindows(int* argc, char** argv) +{ +#ifdef UNIX +// Userid control +// +// Michael Hohmuth ... +// +// As the game runs setuid games, it must seteuid(getuid()) before +// calling XOpenDisplay(), and reset the euid afterwards. +// Otherwise, it can't read the $HOME/.Xauthority file and whines about +// not being able to open the X display (if a magic-cookie +// authorization mechanism is being used). + + uid_t gamesuid=geteuid(); + seteuid(getuid()); +#endif + + QApplication::setColorSpec(ManyColor); + instance=new NetHackQtBind(*argc,argv); + +#ifdef UNIX + seteuid(gamesuid); +#endif + +#ifdef _WS_WIN_ + // This nethack engine feature should be moved into windowport API + nt_kbhit = NetHackQtBind::qt_kbhit; +#endif +} + +int NetHackQtBind::qt_kbhit() +{ + return !keybuffer.Empty(); +} + +static bool have_asked = FALSE; + +void NetHackQtBind::qt_player_selection() +{ + if ( !have_asked ) + qt_askname(); +} + +NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : + QDialog(qApp->mainWidget(),"sgsel",TRUE) +{ + QVBoxLayout *vbl = new QVBoxLayout(this,6); + QHBox* hb; + + QLabel* logo = new QLabel(this); vbl->addWidget(logo); + logo->setAlignment(AlignCenter); + logo->setPixmap(QPixmap("nhsplash.xpm")); + QLabel* attr = new QLabel("by the NetHack DevTeam",this); + attr->setAlignment(AlignCenter); + vbl->addWidget(attr); + vbl->addStretch(2); + /* + QLabel* logo = new QLabel(hb); + hb = new QHBox(this); + vbl->addWidget(hb, AlignCenter); + logo->setPixmap(QPixmap(nh_icon)); + logo->setAlignment(AlignRight|AlignVCenter); + new QLabel(nh_attribution,hb); + */ + + hb = new QHBox(this); + vbl->addWidget(hb, AlignCenter); + QPushButton* q = new QPushButton("Quit",hb); + connect(q, SIGNAL(clicked()), this, SLOT(reject())); + QPushButton* c = new QPushButton("New Game",hb); + connect(c, SIGNAL(clicked()), this, SLOT(accept())); + c->setDefault(TRUE); + + QButtonGroup* bg = new QButtonGroup(3, Horizontal, "Saved Characters",this); + vbl->addWidget(bg); + connect(bg, SIGNAL(clicked(int)), this, SLOT(done(int))); + for (int i=0; saved[i]; i++) { + QPushButton* b = new QPushButton(saved[i],bg); + bg->insert(b, i+2); + } +} + +int NetHackQtSavedGameSelector::choose() +{ +#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). + if ( qt_compact_mode ) + showMaximized(); +#endif + return exec()-2; +} + +void NetHackQtBind::qt_askname() +{ + have_asked = TRUE; + + // We do it all here, and nothing in askname + + char** saved = get_saved_games(); + int ch = -1; + if ( saved && *saved ) { + if ( splash ) splash->hide(); + NetHackQtSavedGameSelector sgsel((const char**)saved); + ch = sgsel.choose(); + if ( ch >= 0 ) + strcpy(g.plname,saved[ch]); + } + free_saved_games(saved); + + switch (ch) { + case -1: + if ( splash ) splash->hide(); + if (NetHackQtPlayerSelector(keybuffer).Choose()) + return; + case -2: + break; + default: + return; + } + + // Quit + clearlocks(); + qt_exit_nhwindows(0); + nh_terminate(0); +} + +void NetHackQtBind::qt_get_nh_event() +{ +} + +#if defined(QWS) +// Kludge to access lastWindowClosed() signal. +class TApp : public QApplication { +public: + TApp(int& c, char**v) : QApplication(c,v) {} + void lwc() { emit lastWindowClosed(); } +}; +#endif + +void NetHackQtBind::qt_exit_nhwindows(const char *) +{ +#if defined(QWS) + // Avoids bug in SHARP SL5500 + ((TApp*)qApp)->lwc(); + qApp->quit(); +#endif + + delete instance; // ie. qApp +} + +void NetHackQtBind::qt_suspend_nhwindows(const char *) +{ +} + +void NetHackQtBind::qt_resume_nhwindows() +{ +} + +static QArray id_to_window; + +winid NetHackQtBind::qt_create_nhwindow(int type) +{ + winid id; + for (id = 0; id < (winid) id_to_window.size(); id++) { + if ( !id_to_window[id] ) + break; + } + if ( id == (winid) id_to_window.size() ) + id_to_window.resize(id+1); + + NetHackQtWindow* window=0; + + switch (type) { + case NHW_MAP: { + NetHackQtMapWindow* w=new NetHackQtMapWindow(clickbuffer); + main->AddMapWindow(w); + window=w; + } break; case NHW_MESSAGE: { + NetHackQtMessageWindow* w=new NetHackQtMessageWindow; + main->AddMessageWindow(w); + window=w; + } break; case NHW_STATUS: { + NetHackQtStatusWindow* w=new NetHackQtStatusWindow; + main->AddStatusWindow(w); + window=w; + } break; case NHW_MENU: + window=new NetHackQtMenuOrTextWindow(keybuffer); + break; case NHW_TEXT: + window=new NetHackQtTextWindow(keybuffer); + } + + window->nhid = id; + + // Note: use of isHidden does not work with Qt 2.1 + if ( splash +#if QT_VERSION >= 300 + && !main->isHidden() +#else + && main->isVisible() +#endif + ) + { + delete splash; + splash = 0; + } + + id_to_window[id] = window; + return id; +} + +void NetHackQtBind::qt_clear_nhwindow(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->Clear(); +} + +void NetHackQtBind::qt_display_nhwindow(winid wid, BOOLEAN_P block) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->Display(block); +} + +void NetHackQtBind::qt_destroy_nhwindow(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + main->RemoveWindow(window); + if (window->Destroy()) + delete window; + id_to_window[wid] = 0; +} + +void NetHackQtBind::qt_curs(winid wid, int x, int y) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->CursorTo(x,y); +} + +void NetHackQtBind::qt_putstr(winid wid, int attr, const char *text) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->PutStr(attr,text); +} + +void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) +{ + NetHackQtTextWindow* window=new NetHackQtTextWindow(keybuffer); + bool complain = FALSE; + +#ifdef DLB + { + dlb *f; + char buf[BUFSZ]; + char *cr; + + window->Clear(); + f = dlb_fopen(filename, "r"); + if (!f) { + complain = must_exist; + } else { + while (dlb_fgets(buf, BUFSZ, f)) { + if ((cr = index(buf, '\n')) != 0) *cr = 0; +#ifdef MSDOS + if ((cr = index(buf, '\r')) != 0) *cr = 0; +#endif + if (index(buf, '\t') != 0) (void) tabexpand(buf); + window->PutStr(ATR_NONE, buf); + } + window->Display(FALSE); + (void) dlb_fclose(f); + } + } +#else + QFile file(filename); + + if (file.open(IO_ReadOnly)) { + char line[128]; + while (file.readLine(line,127) >= 0) { + line[strlen(line)-1]=0;// remove newline + window->PutStr(ATR_NONE,line); + } + window->Display(FALSE); + } else { + complain = must_exist; + } +#endif + + if (complain) { + QString message; + message.sprintf("File not found: %s\n",filename); + QMessageBox::message("File Error", (const char*)message, "Ignore"); + } +} + +void NetHackQtBind::qt_start_menu(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->StartMenu(); +} + +void NetHackQtBind::qt_add_menu(winid wid, int glyph, + const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, + const char *str, BOOLEAN_P presel) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); +} + +void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->EndMenu(prompt); +} + +int NetHackQtBind::qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list) +{ + NetHackQtWindow* window=id_to_window[wid]; + return window->SelectMenu(how,menu_list); +} + +void NetHackQtBind::qt_update_inventory() +{ + if (main) + main->updateInventory(); + /* doesn't work yet + if (g.program_state.something_worth_saving && iflags.perm_invent) + display_inventory(NULL, FALSE); + */ +} + +void NetHackQtBind::qt_mark_synch() +{ +} + +void NetHackQtBind::qt_wait_synch() +{ +} + +void NetHackQtBind::qt_cliparound(int x, int y) +{ + // XXXNH - winid should be a parameter! + qt_cliparound_window(WIN_MAP,x,y); +} + +void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->ClipAround(x,y); +} +void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, int bkglyph) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->PrintGlyph(x,y,glyph); +} +//void NetHackQtBind::qt_print_glyph_compose(winid wid,XCHAR_P x,XCHAR_P y,int glyph1, int glyph2) +//{ + //NetHackQtWindow* window=id_to_window[wid]; + //window->PrintGlyphCompose(x,y,glyph1,glyph2); +//} + +void NetHackQtBind::qt_raw_print(const char *str) +{ + puts(str); +} + +void NetHackQtBind::qt_raw_print_bold(const char *str) +{ + puts(str); +} + +int NetHackQtBind::qt_nhgetch() +{ + if (main) + main->fadeHighlighting(); + + // Process events until a key arrives. + // + while (keybuffer.Empty() +#ifdef SAFERHANGUP + && !g.program_state.done_hup +#endif + ) { + qApp->enter_loop(); + } + +#ifdef SAFERHANGUP + if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; +#endif + return keybuffer.GetAscii(); +} + +int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod) +{ + if (main) + main->fadeHighlighting(); + + // Process events until a key or map-click arrives. + // + while (keybuffer.Empty() && clickbuffer.Empty() +#ifdef SAFERHANGUP + && !g.program_state.done_hup +#endif + ) { + qApp->enter_loop(); + } +#ifdef SAFERHANGUP + if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; +#endif + if (!keybuffer.Empty()) { + return keybuffer.GetAscii(); + } else { + *x=clickbuffer.NextX(); + *y=clickbuffer.NextY(); + *mod=clickbuffer.NextMod(); + clickbuffer.Get(); + return 0; + } +} + +void NetHackQtBind::qt_nhbell() +{ + QApplication::beep(); +} + +int NetHackQtBind::qt_doprev_message() +{ + // Don't need it - uses scrollbar + // XXX but could make this a shortcut + return 0; +} + +char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CHAR_P def) +{ + if (qt_settings->ynInMessages() && WIN_MESSAGE!=WIN_ERR) { + // Similar to X11 windowport `slow' feature. + + char message[BUFSZ]; + char yn_esc_map='\033'; + + if (choices) { + char *cb, choicebuf[QBUFSZ]; + Strcpy(choicebuf, choices); + if ((cb = index(choicebuf, '\033')) != 0) { + // anything beyond is hidden + *cb = '\0'; + } + (void)strncpy(message, question, QBUFSZ-1); + message[QBUFSZ-1] = '\0'; + Sprintf(eos(message), " [%s]", choicebuf); + if (def) Sprintf(eos(message), " (%c)", def); + Strcat(message, " "); + // escape maps to 'q' or 'n' or default, in that order + yn_esc_map = (index(choices, 'q') ? 'q' : + (index(choices, 'n') ? 'n' : def)); + } else { + Strcpy(message, question); + } + +#ifdef USE_POPUPS + // Improve some special-cases (DIRKS 08/02/23) + if (strcmp (choices,"ynq") == 0) { + switch (QMessageBox::information (qApp->mainWidget(),"NetHack",question,"&Yes","&No","&Quit",0,2)) + { + case 0: return 'y'; + case 1: return 'n'; + case 2: return 'q'; + } + } + + if (strcmp (choices,"yn") == 0) { + switch (QMessageBox::information(qApp->mainWidget(),"NetHack",question,"&Yes", "&No",0,1)) + { + case 0: return 'y'; + case 1: return 'n'; + } + } +#endif + + NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, message); + + int result=-1; + while (result<0) { + char ch=NetHackQtBind::qt_nhgetch(); + if (ch=='\033') { + result=yn_esc_map; + } else if (choices && !index(choices,ch)) { + if (def && (ch==' ' || ch=='\r' || ch=='\n')) { + result=def; + } else { + NetHackQtBind::qt_nhbell(); + // and try again... + } + } else { + result=ch; + } + } + + NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE); + + return result; + } else { + NetHackQtYnDialog dialog(keybuffer,question,choices,def); + return dialog.Exec(); + } +} + +void NetHackQtBind::qt_getlin(const char *prompt, char *line) +{ + NetHackQtStringRequestor requestor(keybuffer,prompt); + if (!requestor.Get(line)) { + line[0]=0; + } +} + +NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks) : + QDialog(qApp->mainWidget(), "ext-cmd", FALSE), + keysource(ks) +{ + int marg=4; + QVBoxLayout *l = new QVBoxLayout(this,marg,marg); + + QPushButton* can = new QPushButton("Cancel", this); + can->setDefault(TRUE); + can->setMinimumSize(can->sizeHint()); + l->addWidget(can); + + QButtonGroup *group=new QButtonGroup("",0); + QGroupBox *grid=new QGroupBox("Extended commands",this); + l->addWidget(grid); + + int i; + int butw=50; + QFontMetrics fm = fontMetrics(); + for (i=0; extcmdlist[i].ef_txt; i++) { + butw = QMAX(butw,30+fm.width(extcmdlist[i].ef_txt)); + } + int ncols=4; + int nrows=(i+ncols-1)/ncols; + + QVBoxLayout* bl = new QVBoxLayout(grid,marg); + bl->addSpacing(fm.height()); + QGridLayout* gl = new QGridLayout(nrows,ncols,marg); + bl->addLayout(gl); + for (i=0; extcmdlist[i].ef_txt; i++) { + QPushButton* pb=new QPushButton(extcmdlist[i].ef_txt, grid); + pb->setMinimumSize(butw,pb->sizeHint().height()); + group->insert(pb); + gl->addWidget(pb,i/ncols,i%ncols); + } + connect(group,SIGNAL(clicked(int)),this,SLOT(done(int))); + + bl->activate(); + l->activate(); + resize(1,1); + + connect(can,SIGNAL(clicked()),this,SLOT(cancel())); +} + +void NetHackQtExtCmdRequestor::cancel() +{ + setResult(-1); + qApp->exit_loop(); +} + +void NetHackQtExtCmdRequestor::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +int NetHackQtExtCmdRequestor::get() +{ + const int none = -10; + char str[32]; + int cursor=0; + resize(1,1); // pack + centerOnMain(this); + show(); + setResult(none); + while (result()==none) { + while (result()==none && !keysource.Empty()) { + char k=keysource.GetAscii(); + if (k=='\r' || k=='\n' || k==' ' || k=='\033') { + setResult(-1); + } else { + str[cursor++] = k; + int r=-1; + for (int i=0; extcmdlist[i].ef_txt; i++) { + if (qstrnicmp(str, extcmdlist[i].ef_txt, cursor)==0) { + if ( r == -1 ) + r = i; + else + r = -2; + } + } + if ( r == -1 ) { // no match! + QApplication::beep(); + cursor=0; + } else if ( r != -2 ) { // only one match + setResult(r); + } + } + } + if (result()==none) + qApp->enter_loop(); + } + hide(); + return result(); +} + + +int NetHackQtBind::qt_get_ext_cmd() +{ + NetHackQtExtCmdRequestor requestor(keybuffer); + return requestor.get(); +} + +void NetHackQtBind::qt_number_pad(int) +{ + // Ignore. +} + +void NetHackQtBind::qt_delay_output() +{ + NetHackQtDelay delay(15); + delay.wait(); +} + +void NetHackQtBind::qt_start_screen() +{ + // Ignore. +} + +void NetHackQtBind::qt_end_screen() +{ + // Ignore. +} + +void NetHackQtBind::qt_outrip(winid wid, int how, time_t when) +{ + NetHackQtWindow* window=id_to_window[wid]; + + window->UseRIP(how, when); +} + +bool NetHackQtBind::notify(QObject *receiver, QEvent *event) +{ + // Ignore Alt-key navigation to menubar, it's annoying when you + // use Alt-Direction to move around. + if ( main && event->type()==QEvent::KeyRelease && main==receiver + && ((QKeyEvent*)event)->key() == Key_Alt ) + return TRUE; + + bool result=QApplication::notify(receiver,event); +#ifdef SAFERHANGUP + if (g.program_state.done_hup) { + keybuffer.Put('\033'); + qApp->exit_loop(); + return TRUE; + } +#endif + if (event->type()==QEvent::KeyPress) { + QKeyEvent* key_event=(QKeyEvent*)event; + + if (!key_event->isAccepted()) { + const int k=key_event->key(); + bool macro=FALSE; + for (int i=0; !macro && key_macro[i].key; i++) { + if (key_macro[i].key==k + && ((key_macro[i].state&key_event->state())==key_macro[i].state)) + { + keybuffer.Put(key_macro[i].macro); + macro=TRUE; + } + } + char ch=key_event->ascii(); + if ( !ch && (key_event->state() & Qt::ControlButton) ) { + // On Mac, it aint-ncessarily-control + if ( k>=Qt::Key_A && k<=Qt::Key_Z ) + ch = k - Qt::Key_A + 1; + } + if (!macro && ch) { + bool alt = (key_event->state()&AltButton) || + (k >= Key_0 && k <= Key_9 && (key_event->state()&ControlButton)); + keybuffer.Put(key_event->key(),ch + (alt ? 128 : 0), + key_event->state()); + key_event->accept(); + result=TRUE; + } + + if (ch || macro) { + qApp->exit_loop(); + } + } + } + return result; +} + +NetHackQtBind* NetHackQtBind::instance=0; +NetHackQtKeyBuffer NetHackQtBind::keybuffer; +NetHackQtClickBuffer NetHackQtBind::clickbuffer; +NetHackQtMainWindow* NetHackQtBind::main=0; +QWidget* NetHackQtBind::splash=0; + + +extern "C" struct window_procs Qt_procs; + +struct window_procs Qt_procs = { + "Qt", + WC_COLOR|WC_HILITE_PET| + WC_ASCII_MAP|WC_TILED_MAP| + WC_FONT_MAP|WC_TILE_FILE|WC_TILE_WIDTH|WC_TILE_HEIGHT| + WC_PLAYER_SELECTION|WC_SPLASH_SCREEN, + 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + NetHackQtBind::qt_init_nhwindows, + NetHackQtBind::qt_player_selection, + NetHackQtBind::qt_askname, + NetHackQtBind::qt_get_nh_event, + NetHackQtBind::qt_exit_nhwindows, + NetHackQtBind::qt_suspend_nhwindows, + NetHackQtBind::qt_resume_nhwindows, + NetHackQtBind::qt_create_nhwindow, + NetHackQtBind::qt_clear_nhwindow, + NetHackQtBind::qt_display_nhwindow, + NetHackQtBind::qt_destroy_nhwindow, + NetHackQtBind::qt_curs, + NetHackQtBind::qt_putstr, + genl_putmixed, + NetHackQtBind::qt_display_file, + NetHackQtBind::qt_start_menu, + NetHackQtBind::qt_add_menu, + NetHackQtBind::qt_end_menu, + NetHackQtBind::qt_select_menu, + genl_message_menu, /* no need for X-specific handling */ + NetHackQtBind::qt_update_inventory, + NetHackQtBind::qt_mark_synch, + NetHackQtBind::qt_wait_synch, +#ifdef CLIPPING + NetHackQtBind::qt_cliparound, +#endif +#ifdef POSITIONBAR + donull, +#endif + NetHackQtBind::qt_print_glyph, + //NetHackQtBind::qt_print_glyph_compose, + NetHackQtBind::qt_raw_print, + NetHackQtBind::qt_raw_print_bold, + NetHackQtBind::qt_nhgetch, + NetHackQtBind::qt_nh_poskey, + NetHackQtBind::qt_nhbell, + NetHackQtBind::qt_doprev_message, + NetHackQtBind::qt_yn_function, + NetHackQtBind::qt_getlin, + NetHackQtBind::qt_get_ext_cmd, + NetHackQtBind::qt_number_pad, + NetHackQtBind::qt_delay_output, +#ifdef CHANGE_COLOR /* only a Mac option currently */ + donull, + donull, +#endif + /* other defs that really should go away (they're tty specific) */ + NetHackQtBind::qt_start_screen, + NetHackQtBind::qt_end_screen, +#ifdef GRAPHIC_TOMBSTONE + NetHackQtBind::qt_outrip, +#else + genl_outrip, +#endif + genl_preference_update, + genl_getmsghistory, + genl_putmsghistory, + genl_status_init, + genl_status_finish, + genl_status_enablefield, + genl_status_update, + genl_can_suspend_yes, +}; + +extern "C" void play_usersound(const char* filename, int volume) +{ +#ifdef USER_SOUNDS +#ifndef QT_NO_SOUND + QSound::play(filename); +#endif +#endif +} + +#include "qt3_win.moc" +#ifndef KDE +#include "qt3_kde0.moc" +#endif +#if QT_VERSION >= 300 +#include "qt3tableview.moc" +#endif diff --git a/include/qt_win.h b/win/Qt3/qt3_win.h similarity index 99% rename from include/qt_win.h rename to win/Qt3/qt3_win.h index 136e8a6ef..8de29d92f 100644 --- a/include/qt_win.h +++ b/win/Qt3/qt3_win.h @@ -1,4 +1,4 @@ -// NetHack 3.6 qt_win.h $NHDT-Date: 1447755972 2015/11/17 10:26:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ +// NetHack 3.6 qt_win.h $NHDT-Date: 1575917700 2019/12/09 18:55:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ // Copyright (c) Warwick Allison, 1999. // NetHack may be freely redistributed. See license for details. // @@ -52,7 +52,7 @@ #include #endif -#include "qt_clust.h" +#include "qt3_clust.h" class QVBox; class QMenuBar; @@ -737,7 +737,7 @@ class NetHackQtInvUsageWindow : public QWidget // note the actual class of the windows. // #ifndef KDE -#include "qt_kde0.h" +#include "qt3_kde0.h" #endif class NetHackQtMainWindow : public KTopLevelWidget diff --git a/win/Qt3/qt3_xpms.h b/win/Qt3/qt3_xpms.h new file mode 100644 index 000000000..5667c13c0 --- /dev/null +++ b/win/Qt3/qt3_xpms.h @@ -0,0 +1,1422 @@ +/* clang-format off */ +/* XPM */ +static const char *blind_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 5 1", +/* colors */ +" c #000000", +". c None", +"X c #909090", +"o c #606060", +"O c #303030", +/* pixels */ +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"....ooooooooooooooooooooooooooooooooX...", +".... o...", +".... o...", +".... o...", +".... o...", +"......o ..o ......", +"......X O..X O......", +"....... o... o......", +".......o ....o .......", +"........O X.....O X.......", +".........O X.......O X........", +"..........o OX.........o OX.........", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................" +}; +/* XPM */ +static const char *cha_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 14 1", +/* colors */ +" c #F85848", +". c #949E9E", +"X c #F8B090", +"o c #E00028", +"O c #D4D4D4", +"+ c None", +"@ c #B0B0B0", +"# c #F82C24", +"$ c #F89E6C", +"% c #FF0000", +"& c #909090", +"* c #FFFFFF", +"= c #CEAA90", +"- c #DADAB6", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"+++++++++++++++=#%#=+=#%% ++++++++++++++", +"++++++++++++++ %O%%%#%$$%o%=++++++++++++", +"+++++++++++++# +#%%o%%o%%%%% +++++++++++", +"+++++++++++ %%%%%%%%%%%%%%%%o#=+++++++++", +"+++++++++ o%%%%%%%%%%%%%%%%%%%%# +++++++", +"++++++ #%%%%%%o%%%o%%o%%o%o%%%%%o%o +++", +"++=#%%o%%%#= =*+**O*+**O*+- = =%%%%#@+++", +"++++ %=++*+*+**O****O****O*O*O*OO%=+++++", +"+++++.%=OO+*O*OO****+****+*O*+O&%=@+++++", +"++++++=%=*OO+**O**O*O**O*O*OO+$%=+++++++", +"+++++++#% +*OOOO****+****@O+*#%=++++++++", +"++++++++#%#*+**+O+OO+O+OOO*O#o#+++++++++", +"+++++++++o% O**+****O****O*#%%=+++++++++", +"+++++++++ %%#O*O****+****+ %o#++++++++++", +"++++++++++o%% XO*O**O*O**#%%%+++++++++++", +"++++++++++ %%%o%$-**+**$%%%%=+++++++++++", +"+++++++++++o%%$X$%%%%%%#= o#++++++++++++", +"++++++++++@ %%%o#O$$+$$$%%%=++++++++++++", +"++++++++++++#o%%%%%%%%o%%%=@++++++++++++", +"+++++++++++++ %%%%%%%%%%o=++++++++++++++", +"+++++++++++++++= & & @++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++" +}; +/* XPM */ +static const char *chaotic_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 9 1", +/* colors */ +" c #000000", +". c #5C7A7A", +"X c None", +"o c #B0B0B0", +"O c #909090", +"+ c #788C8C", +"@ c #606060", +"# c #FFFFFF", +"$ c #303030", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXX@$ @XXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXX$$+#X$ $XXXXXXXXXX", +"XXXXXXXXXXXXXXXXXX@$#o @XXXXXXXXX", +"XXXXXXXXXXXXXXXXXX$XX OXXXXXXXX", +"XXXXXXXXXXXXXXXXX@ # $@$ $XXXXXXXX", +"XXXXXXXXXXXXXXXXX@.+ $XXXO @XXXXXXX", +"XXXXXXXXXXXXXXXXX O@ XXXXX@ @XXXXXXX", +"XXXXXXXXXXXXXXXXX @O $XXXXX@$ @XXXXXXX", +"XXXXXXXXXXXXXXXXX O+ @XXXXO++ @XXXXXXX", +"XXXXXXXXXXXXXXXXX @+ $@OXO$#$ XXXXXXXX", +"XXXXXXXXXXXXXXXXX O@ $ @$Xo $XXXXXXXX", +"XXXXXXXXXXXXXXXXX +O $X##+ $XXXXXXXXX", +"XXXXXXXXXXXXXXXXX +@ $XXXXXXXXXX", +"XXXXXXXXXXXXXXXXX oO $XXXXXXXXXXX", +"XXXXXXXXO@@@@@ +# $XXXXXXXXXXXX", +"XXXXXXO +o########$ $@XXXXXXXXX", +"XXXXXX +#+.$XXXXXXXX", +"XXXXXX @O @XXXXXXX", +"XXXXXX$ $@ $@@$ @XXXXXXX", +"XXXXXXX@@@@XXXXXX + @XXXX@$ OXXXXXXX", +"XXXXXXXXXXXXXXXX@ # @XXXXXXX@@OXXXXXXXX", +"XXXXXXXXXXXXXXXX@.+ @XXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX$O@ XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX @O XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX #$ @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@ # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@ # OXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@.X XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX ++ XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX @+ XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX O@ @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX +O @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX$ OXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX@@OXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +}; +/* XPM */ +static const char *cns_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 19 1", +/* colors */ +" c #000000", +". c #F85848", +"X c #949E9E", +"o c #F8B090", +"O c #E00028", +"+ c #7C3400", +"@ c None", +"# c #B0B0B0", +"$ c #F82C24", +"% c #F89E6C", +"& c #FF0000", +"* c #B64700", +"= c #909090", +"- c #788C8C", +"; c #606060", +": c #C80050", +"> c #CEAA90", +", c #303030", +"< c #FFB691", +/* pixels */ +"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@.oo.o$ ;@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@>.o.%%O,@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@$oo.o. ,@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@.oo$oo+ =@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@..o&oo$ ,@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@#.o.oo. =@.$%@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o..oo& O.%ooo@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o.&%o.$oo%O++;@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o.+$%$o.@@@@@@@@@@@", +"@@@@@@@@@@@@@.oo++o%$$ ,@@$.oo@@@@@@@@@@", +"@@@@@@@@@@@@>.oo+Oo$o%.@@$oo..-@@@@@@@@@", +"@@@@@@@@@@@@..o%;.o&%.$..o%O ++>@@@@@@@@", +"@@@@@@@@@@@@>.$O:%o.O::::O* $oooo@@@@@@@", +"@@@@@@@@@@@@::::::$$:OO&OO::oo%.;=@@@@@@", +"@@@@@@@@@@@.::::::::O&&&&&O::++ ,@@@@@@", +"@@@@@@@@@@>:::O&&OO&&&&&&&&:: ;@@@@@", +"@@@@@@@@@@=::O&&&&&O:O&&&&&O: ,=@@@@@@@", +"@@@@@@@@@@:::&&&&&&&&:&&&&&O: ;@@@@@@@@", +"@@@@@@@@@@::O&&&&&&&&:&O&&&O:, ;@@@@@@@@", +"@@@@@@@@@@::O&&&&O&O&OO&O&&O:+ ;@@@@@@@@", +"@@@@@@@@@@::&&&O&&&&&O:&&&&O:, @@@@@@@@", +"@@@@@@@@@@::O&&&&&O&&&:O&O&::+ @@@@@@@@", +"@@@@@@@@@@::O&&O&&&&O&OO&&&:: @@@@@@@@", +"@@@@@@@@@@=::O&&&&O&&&O:&&&:: @@@@@@@@", +"@@@@@@@@@@.:::O&&O&&&&&:&OO:: @@@@@@@@", +"@@@@@@@@@@@:::::&&&&O&O:&&O:, @@@@@@@@", +"@@@@@@@@@@.>:::::O&&&&&:&&::+ ;@@@@@@@@", +"@@@@@@@@@@>.<::::O&&O&O:&&:: @@@@@@@@@", +"@@@@@@@@@@@.o%,:::O&&&O:&O:, @@@@@@@@@", +"@@@@@@@@@@@$o. :::OO&OO&::, ;@@@@@@@@@", +"@@@@@@@@@@@&o%+ ,::O&OO&O:: =@@@@@@@@@", +"@@@@@@@@@@@.oo+ :::OO::: ,@@@@@@@@@@", +"@@@@@@@@@@@..oO +::::: =@@@@@@@@@@", +"@@@@@@@@@@@@.<.+ ,+, ,@@@@@@@@@@@", +"@@@@@@@@@@@@Oo<+ @X, ,@@@@@@@@@@@@", +"@@@@@@@@@@@@.%o$ @@@@@;, ;@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o., =@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" +}; +/* XPM */ +static const char *confused_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO.=.+OO=.+O.OO+O+OO.+OOOOOO", +"OOOOOOOOOOO++=====O=====+=O+==++=O+OOOOO", +"OOOOOOOOOOO+=.=====.=++++===OO==+O=+OOOO", +"OOOOOOOOOOO=+===.+=o==o===+&OoO======OOO", +"OOOOOOOO+O+====OO+=o&&&&Oo==o&oO+==+=.O.", +"OOOO+.+=+O==+&&o=oooOo&o&ooo=&oooO==O=+=", +"OOOOOOOO++O===oo=oo&=&o&&oo=o==&o+==++==", +"OOOOOOOO=o.=O====o&OO&o&oo&o&&oo=======O", +"OOOOOOOo===+=O=O=ooO=ooooOOo=o&O=====OOO", +"OOOOOOOOO+==+=======O=oo====O=o=O===+OOO", +"OOOOOOOOO.=#=X=+====O========O======OOOO", +"OOOOOOO.#Xo++.=#%====O==========OO==+OOO", +"OOOOOO+Xo#+#+.#=.==X====+====O=+=+==+OOO", +"OOOOO.+.+O===##.#=X.====oX##===o+OO.OOOO", +"OOOOO#+####O#O##o.#+==#X#O#+...=OOo=+OOO", +"OOOO++#o+#+X++++#.#O.#+#X.#+X+==+OO=oOOO", +"OOOO#+.+..X+.##X++#++#..+XX#+##+..OOOOOO", +"OOOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOO", +"OOOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOO", +"OOOOO#+#+.+++#++.+++##+X###+X+X##+**OOOO", +"OOOOO#..#OO#+.##o###.+..++.+#X+#+#* @OOO", +"OOOOO+#.#O+#+#O.+++.###+##++###+.#* $OOO", +"OOOOOOXX+#+#+#o..X##++#+..##.#+### *OOO", +"OOOOOOOX#.#X+#+#+#+.#+..+####%XX%% OOO", +"OOOOOOOO.%%X.#+#+#.++#+#+#+.X++=.% *OOO", +"OOOOOOOOO.* *##+#+.O####.+XX%%%%#% $OOO", +"OOOOOOOOOOO. %X.+.#+++XXX=.+++#X $OOO", +"OOOOOOOOOOOO.* %%X..#X%=.####%X* $OOO", +"OOOOOOOOOOOOOO.$ *XX%%%=.#X%###=* OOOO", +"OOOOOOOOOOOOOOOOOO+%%%=%%#.+.#=* @OOOO", +"OOOOOOOOOOOOOOOOOOo=%%%==X##X%* OOOOO", +"OOOOOOOOOOOOOOOOOOO+X%%%%X=%* @OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X *@OOOOOO", +"OOOOOOOOOOOOOOOOOOOO=%%%X* *$$OOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+X%%= .OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOX%%% OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO=%%* $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO=%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO+%%% $OOOOOOOOOOOOO" +}; +/* XPM */ +static const char *dex_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 19 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #F8B090", +"o c #5C7A7A", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #B64700", +"* c #909090", +"= c #606060", +"- c #CEAA90", +"; c #DADAB6", +": c #303030", +"> c #F86800", +", c #FFB691", +"< c #F88C48", +/* pixels */ +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"###############-%-######################", +"##############-%X<-#####################", +"#########-<<-#-%XX+==###################", +"#########%,X< :<,X%@ :##################", +"#########-XX%: @;X%+ *#################", +"##########<,X& :<<%+: :#################", +"######->+#-%%%: <,XX@ #################", +"######%X%@ <,,& @XXX+ :++-#############", +"######-: +XX+ #########", +"#####+%%@@,X%<,XXXXXXX<:@XXX<: =########", +"####$%XX< <,<,XX& ########", +"#####$%<%X@%XXXX<%XX< =#######", +"#######<;X%XXXXX<<,XXXXXX%,XXXXXXXXX%@ #######", +"##########- c #788C8C", +", c #606060", +"< c #406868", +"1 c #C80050", +"2 c #FFFFFF", +"3 c #FFFF00", +"4 c #00B6FF", +"5 c #CEAA90", +"6 c #DADAB6", +"7 c #F86800", +"8 c #FFB691", +"9 c #6C91B6", +"0 c #F88C48", +"q c #0000FF", +/* pixels */ +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$353333335*$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$*33333333#7@3335$$$$$$$$$$$$", +"$$$$$$$$$65333333333@7777#333*$$$$$$$$$$", +"$$$$$$$$$3333333333377777733333===%$$$$$", +"$$$$$$$533333333333#7777777333%=====$$$$", +"$$$$$$ #3333333333o>7777773330======%$$$", +"$$$$5---O#33333o3944077777333*=======$$$", +"$$$$-----O333333>4444.77333330======%$$$", +"$$$ ---O--;3333344444443333333:====5$$$$", +"$$$ O-----733333444444433333333 ==035$$$", +"$$$3--O--O333333>44444>33333333333333$$$", +"$$533---O33333333944493333#333333333356$", +"$$33867733333o33333:o333333o3333333333$$", +"$532+2233333#333333333333oooo3#3333333%$", +"6522222+33333333333333333oooooo33o3333*$", +"$+22+22263333333o3333333ooooooo333333356", +"662222+2533333333333333#ooooooo33333333$", +"$32+22223333o3#33333o333ooooooo3#333333%", +"$33222233333333333#333333ooooo333333333$", +"$33368333333333333330626*oooo#333333o33%", +"%333335== 33oo333333222223#333333333333$", +"$3333=====:ooooo333+22+2263333333.>o333%", +"$5333=====oooooo33322222223333339444935$", +"$*33 ====>ooooooo3362+222633333.44444>3$", +"$%330====:ooooooo333222+23333334444444$$", +"$$333177 =oooXoo#333*626333333;4444444$$", +"$$53##777&3oooo3333333333333#--,444449$$", +"$$$3;77777#3o333333333333333O---94449$$$", +"$$%*@77777#33333333333333337O----O:o3$$$", +"$$$5777777333 333333333333;---O-O73$$$$", +"$$$$#7777730====#:.,33333333------3$$$$$", +"$$$$$577333=====qqqq<0333333#O---35$$$$$", +"$$$$$%53335====qqqqqq.33o333337735$$$$$$", +"$$$$$$$533 ====qqqqqqq3333333333%$$$$$$$", +"$$$$$$$$%33====qqqqqqq333333333%$$$$$$$$", +"$$$$$$$$$$50===qqqqqq,3333333:$$$$$$$$$$", +"$$$$$$$$$%6%5503,qqq<333#335%$$$$$$$$$$$", +"$$$$$$$$$$$$$%$*53,03335o$%%$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$%$$+$$$$$$$$$$$$$$$" +}; +/* XPM */ +static const char *hungry_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 15 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #CEAA90", +"= c #DADAB6", +"- c #303030", +"; c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO========OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO=============OOOOOOOOOOOOO", +"OO;XX;@OOOOO================OOOOOOOO;XOO", +"OO;%-;$OOOO==================OOOOOOO;XOO", +"OO;-%;$OOO========@$#@========OOOOO+;;$O", +"OO;%-;$OO=======- -*======*OOOO.;;$O", +"OO;-%;$O======* @====.$$&=====@OOO.;;$O", +"OO;X%;$O====== -========*@=====*.OO+;;$O", +"OO;;;X$o====* -==========@======$OO;;;$O", +"OO+;;-+o====- =============o====#@O+;;$O", +"OOO;%$O===== @=============&====*$O;;;$O", +"OOO+%OO====@ ==============&=====-OO;;$O", +"OOo;-Oo====$ ==============o&==== OO;;$O", +"OOO+%OO====@ ==============&===== O+;;#O", +"OOO;-Oo====$-==============&&==== O+;;-O", +"OOO;;+O=====$*============&&====* OO;;%+", +"OOO;;$o=====$.============&&====X-OO;;$O", +"OOO;;$O======*.===&======&&=====-$=O;;$O", +"OOO;;$Oo=====.==========&&=====* @O+;;$O", +"OOO;;$OO=======oo=====&&&======$-OOO;;$O", +"OOO;;$OOo=======&o&&&&&&======$ @OOO;;$O", +"OOO;;$OOOO========&=&========* $OOOO;;$O", +"OO+;;$OOOOo=================* -OOOOO#;$O", +"OOO;;$OOOOO=*==============@ -=OOOOO;;$O", +"OOO;;$OOOOOOO+*==========*- $OOOOOOO;;$O", +"OOOX-$OOOOOOOO@X@*====*#- -.OOOOOOOOX-$O", +"OOOOOOOOOOOOOO=*@$- -$.=OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOO=O==O=O=OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *hvy_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOO&&&&&&&&&&&&&&&.OOOOOOOOOOOOO", +"OOOOOOOOOOOo==============X*OOOOOOOOOOOO", +"OOOOOOOOOOoO===X====X=====X**OOOOOOOOOOO", +"OOOOOOOOOO&============X===% $OOOOOOOOOO", +"OOOOOOOOOoo===*%====***%===%* OOOOOOOOOO", +"OOOOOOOOOoO==% %===* %==X* @OOOOOOOOO", +"OOOOOOOOO&===% *==% X==**===% $OOOOOOOOO", +"OOOOOOOOoo===% %==% ===% ===X OOOOOOOOO", +"OOOOOOOOoO==== *== *==== *==X* @OOOOOOOO", +"OOOOOOOO&===== %== %==== %===% $OOOOOOOO", +"OOOOOOOoo===== *== *==== *===%* OOOOOOOO", +"OOOOOOOoO===== %==% ===* ====X* @OOOOOOO", +"OOOOOOO&===X== *==% X==**=====% $OOOOOOO", +"OOOOOOoo===== *==* %=====X OOOOOOO", +"OOOOOOoO=====*%%X===*%*X======%* @OOOOOO", +"OOOOOOo====================X===* $OOOOOO", +"OOOOOOO=%X%XXXX%XXXXXXXXX%X=%X% OOOOOO", +"OOOOOOO.=********************** OOOOOO", +"OOOOOOOOO OOOOOO", +"OOOOOOOOO. @OOOOOO", +"OOOOOOOOOOOoOOoOoOoOoOoOoOOoOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *int_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 12 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #303030", +"* c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOO+#.X.##@#OOOOOOOOOOOOOOOOOO", +"OOOOOOOO+##@X#O++.#+#.##OOOOOOOOOOOOOOOO", +"OOOOOO+#Xo++#X#%#+##o#O#.#+OOOOOOOOOOOOO", +"OOOOO.Xo#+#++##+.XX#..+.+..XOOOOOOOOOOOO", +"OOOO++.+O.+O##+#.X###..OX#.+X+OOOOOOOOOO", +"OOOO#+####O#O##o##+###X#+#+.#..OOOOOOOOO", +"OOO.+#o+#+X++++#.#O+#+#X.#+X++X+OOOOOOOO", +"OOO.+.+..X+.##X++#++#..+XX#+#X+..OOOOOOO", +"OOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOOO", +"OOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOOO", +"OOOO#+#+.+++#++.+++##+X###+X+X##+&&OOOOO", +"OOOO#..#OO#+.##o###.+..++.+#X+#+#& @OOOO", +"OOOO.#.#O+#+#O.+++.###+##++###+.# $OOOO", +"OOOOOXX+#+#+#o..X##++#+..##.#+### &OOOO", +"OOOOOOX#.#X+#+#+#+.#+..+####XX%X% OOOO", +"OOOOOOO.%%X.#+#+#.++#+#+#+.%++*+% &OOOO", +"OOOOOOOO@& &##+#+.O####.+XXX%%%#% $OOOO", +"OOOOOOOOOO. %X.+.#+++XXX*.+++#% $OOOO", +"OOOOOOOOOOO@& %%X..#XXX.####%%& $OOOO", +"OOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOOO", +"OOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOOO", +"OOOOOOOOOOOOOOOOOO*%%%*.X##XX& OOOOOO", +"OOOOOOOOOOOOOOOOOOOX%%%%X*%& @OOOOOO", +"OOOOOOOOOOOOOOOOOOOX%%%%% &@OOOOOOO", +"OOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO+%%%* .OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO+*%%% OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%& $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+%%& $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOoOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *lawful_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 10 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #606060", +"$ c #FFFFFF", +"% c #303030", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOo$$$$$$oOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO$$o$$o$$$$$OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOo$$$$$$$o$$ooOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO$o$$$o$$$$$$$oOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$$+ .o$$$$$oOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$+%OOOO$o$$$oOOOOOOO", +"OOOOOOOOOOOOOOOOO$$o$X@OOOOo$$$ooOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$%OOOOOo$$$..OOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$@OOOOo$$oo##OOOOOOO", +"OOOOOOOOOOOOOOOO+$$o$$ooOoo$$$o OOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$$$$o$$$$o#%OOOOOOOO", +"OOOOOOOOOOOOOOOO+$$o$$o$$$$$o@%OOOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$$$$$o$o.%OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$o$$oo@#%OOOOOOOOOOO", +"OOOOOOOOoooooo$$$$$$$$$$$% %OOOOOOOOOOOO", +"OOOOOOO$$$$$$$$$$$$o$$o$$$$$$$oOOOOOOOOO", +"OOOOOO$$$$$$$$$o$$$$$$$$$$$$o$$oOOOOOOOO", +"OOOOOO$$o$ooooo##+o$$+##@oo$$$$$oOOOOOOO", +"OOOOOOo$$#% %#$$$+%##%%#ooo$O#OOOOOOO", +"OOOOOOOo@##OOOOO+$$$##OOOO#%%##%@OOOOOOO", +"OOOOOOOOOOOOOOOOo$$$##OOOOOOO##@OOOOOOOO", +"OOOOOOOOOOOOOOOOo$$o##OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+$$$o OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$o$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$o%@OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$o OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$$o OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$o##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$# @OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO.#@OOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *mod_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOo&&&&&&&&&oXOOOOOOOOOOOOOOO", +"OOOOOOOOOOOO+&=========X%@OOOOOOOOOOOOOO", +"OOOOOOOOOOOOO&=====X====% @OOOOOOOOOOOOO", +"OOOOOOOOOOOOoO==X=======X* OOOOOOOOOOOOO", +"OOOOOOOOOOOO&====*%*%*===* $OOOOOOOOOOOO", +"OOOOOOOOOOO+&===X ===% *OOOOOOOOOOOO", +"OOOOOOOOOOOoO===**=======X* OOOOOOOOOOOO", +"OOOOOOOOOOO&===% %=======X% $OOOOOOOOOOO", +"OOOOOOOOOOO&===% %*%%=====% *OOOOOOOOOOO", +"OOOOOOOOOOoO===* ====X* OOOOOOOOOOO", +"OOOOOOOOOO&=========* X===X% $OOOOOOOOOO", +"OOOOOOOOO+&=========% *====% *OOOOOOOOOO", +"OOOOOOOOOoO===% %=== %====%* OOOOOOOOOO", +"OOOOOOOOO&====* *==X===% $OOOOOOOOO", +"OOOOOOOOO&======*%*%X=======% *OOOOOOOOO", +"OOOOOOOOOo==X===============% OOOOOOOOO", +"OOOOOOOOO=XXXXXXXXXX%X%X%X%%% $OOOOOOOO", +"OOOOOOOOOO=%**************** $OOOOOOOO", +"OOOOOOOOOOO$ $OOOOOOOO", +"OOOOOOOOOOOO* *OOOOOOOOO", +"OOOOOOOOOOOOOoOOoOoOoOoOoOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *neutral_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 14 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #00B6FF", +"= c #303030", +"- c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO.------.OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO-+O&o.-----OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+-&o--------.OOOOOOOOO", +"OOOOOOOOOOOOOOOOOO-oo----------+OOOOOOOO", +"OOOOOOOOOOOOOOOOO+-&--% #-------OOOOOOOO", +"OOOOOOOOOOOOOOOOO-OO-X=OOO.-----+OOOOOOO", +"OOOOOOOOOOOOOOOOO-oO-%#OOOO.-----OOOOOOO", +"OOOOOOOOOOOOOOOOO--O-=OOOOO+---X#OOOOOOO", +"OOOOOOOOOOOOOOOOO-oO-XOOOO+OO--=$OOOOOOO", +"OOOOOOOOOOOOOOOOO-OO--++OO-&--- OOOOOOOO", +"OOOOOOOOOOOOOOOOO-OO-----+oo--%=OOOOOOOO", +"OOOOOOOOOOOOOOOOO--O--+o&&o--%=OOOOOOOOO", +"OOOOOOOOOOOOOOOOO-oo*-------%=OOOOOOOOOO", +"OOOOOOOOOOOOOOOOO-oO------%%=OOOOOOOOOOO", +"OOOOOOOO+.+-+.---O&------= =OOOOOOOOOOOO", +"OOOOOO+-oo&&&&&&&&------------.OOOOOOOOO", +"OOOOOO---------------X-----O&Oo-OOOOOOOO", +"OOOOOO---------%=%---%%=%----OO-.OOOOOOO", +"OOOOOO---== =%---%=%%===----%XOOOOOOO", +"OOOOOOO-#$%OOOOOO-+-%$OOOO%===%=@OOOOOOO", +"OOOOOOOOOOOOOOOO.-&-=%OOOOOOO%%#OOOOOOOO", +"OOOOOOOOOOOOOOOo-O+-%$OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-%%OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-%$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-=$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO--o-%$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+-&- .OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-Oo- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-OO%%OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-o-%$OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO---%$OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO--% #OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOX$@OOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *ovr_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOoO+=+OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOo=#===+OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo=.OO@X=OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo#OO* #X @OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+=.XX+=#* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO+=O=.=OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOO#.=+OO@ $OOOOOOOOOOOOOO", +"OOOOOOOOOooooooooo&O.#+#XooooOOOOOOOOOOO", +"OOOOOOOOO&OOoOoOoOOOOOOOOOoO%@OOOOOOOOOO", +"OOOOOOOOoO==================X*@OOOOOOOOO", +"OOOOOOOO&===================X% @OOOOOOOO", +"OOOOOOOO&==%*%*%*%*%*%*%*%*==% *OOOOOOOO", +"OOOOOOOoO==%*%%*%%*%%*%*%*%==X* OOOOOOOO", +"OOOOOOO&======================* $OOOOOOO", +"OOOOOO+&=== ===% *OOOOOOO", +"OOOOOOoO======================X* OOOOOOO", +"OOOOOO&=======================X% $OOOOOO", +"OOOOOOo========================% *OOOOOO", +"OOOOOoO===*%X=====%%======%%===X* OOOOOO", +"OOOOO&==% %==% *==== %==* $OOOOO", +"OOOOO&== *==**== **% *=X% %%* ==% *OOOOO", +"OOOOoO==%%==* =* ===% == %=== %=X* OOOOO", +"OOOO&=======% =**===% %X %X==* =X% $OOOO", +"OOOO&======% %= %==== %% ====* ==% *OOOO", +"OOOoO=====% *== *==== %* ====% ==X* OOOO", +"OOO&====XX *===**===% X% X=== *===* $OOO", +"OO+&====X *====* ===% == *=== %===% *OOO", +"OOoO===% %*%*== *** %==% %** ====X* OOO", +"OO&====% ==X *====* %====X% $OO", +"OO&================================% *OO", +"OOo===X============================% OO", +"OO=XXXXXXXXXXXX%XXXX%X%X%XXXXX%X%X%% $O", +"OOO=%****************************** $O", +"OOOO$ $O", +"OOOOO* *OO", +"OOOOOOOOOOoOOoOOoOOoOOoOOoOOoOOoOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *pet_mark_xpm[] = { +/* width height ncolors chars_per_pixel */ +"8 7 2 1", +/* colors */ +". c None", +" c #FF0000", +/* pixels */ +"........", +".. . .", +". ", +". ", +".. .", +"... ..", +".... ..." +}; +/* XPM */ +static const char *pet_mark_small_xpm[] = { +/* width height ncolors chars_per_pixel */ +"5 5 2 1", +/* colors */ +". c None", +"X c #FF0000", +/* pixels */ +".X.X.", +"XXXXX", +".XXX.", +"..X.." +}; +/* XPM */ +static const char *pile_mark_xpm[] = { +/* width height ncolors chars_per_pixel */ +"5 5 2 1", +/* colors */ +". c None", +"X c #00FF00", +/* pixels */ +"..X..", +"..X..", +"XXXXX", +"..X..", +"..X.." +}; +/* XPM */ +static const char *satiated_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 23 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #F8B090", +"o c #5C7A7A", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #914700", +"* c #B64700", +"= c #909090", +"- c #788C8C", +"; c #606060", +": c #406868", +"> c #FFFFFF", +", c #CEAA90", +"< c #DADAB6", +"1 c #303030", +"2 c #FFB691", +"3 c #6C91B6", +"4 c #F88C48", +/* pixels */ +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"################<<<<<<<<################", +"##############<<<<<<<<<<$#$$$###########", +"############<<<<<<<<<<$:31:3:###########", +"###########<<<<<<%42<<#:3:133-##########", +"##########<<<<<%<<;;=o$131:33;##########", +"#########<<<<<<,1 ::31:33;,#########", +"########<<<<<<, =<<<<.13:133;<=########", +"########<<<%2, 1<<<<<<#333:33;<,=#######", +"#######<<<3-=<33;<<@o######", +"#######O<<<<<,#<<<<<<<<.3:<3-;<, =######", +"########<<<<2<<<<<<<<<>#31<33o<11#######", +"########O<<<<44<>O>>>>>#3:<3.;- =#######", +"##########<<<4<<<<><><<$3:<331 ;<#######", +"##########<<<<<<<%2<<<<$3:<33 1#########", +"###########O,<<<<<<<<<<#31<331##########", +"#############.<<<<<<<<<$3:133;##########", +"##############=;=,<<<<,o 1;;=##########", +"###############<=;1 1;=##############", +"#################<# c #B64700", +", c #909090", +"< c #788C8C", +"1 c #606060", +"2 c #406868", +"3 c #FFFFFF", +"4 c #CEAA90", +"5 c #DADAB6", +"6 c #303030", +"7 c #F86800", +"8 c #FFB691", +"9 c #6C91B6", +"0 c #F88C48", +"q c #0000FF", +/* pixels */ +"****************************************", +"*************#333333333#****************", +"***********##33333#333333#**************", +"**********#33333#33333#33*==************", +"*********#33##33-;-3#3333399************", +"********#33#33#3-@ 33333#33=.***********", +"********#3*#33-;;;;;-33333#99***********", +"*******#3*3333-;;;;@ 33#333#9=**********", +"*******#333#33#3-;-33#*##33399**********", +"******#3#3333333-@-#333#9933*9=*********", +"******#333#33#3333333#333*9999=*********", +"******#333333333#3#33333333*999*********", +"******#3#33#33333333#33#3333#9=*********", +"******#333334>&&:&&>::44,3#33#9*********", +"******#33*::&41OOO6:4O 0::4433=*********", +"******#3:>,0:O0O1O+O:OXO,O+2+OOo4<+1104:>:#*********", +"******.&:1OOO,14X2O48:O80,440:,*********", +"******4::>OOO%8-X4O4%O,84+O0X&>=********", +"******.::>,O 99*X+<$,+.o*1O4&0:*********", +"******>:0&4O5qq9#10OO3qq9,+X:1:*********", +"****=>,,::,O4qq9X+O>O-qq9O2X0,>*********", +"******4:>OOOO48882OOOO+4OOO07*4*********", +"******4*,4OO+OXX3O5************", +"*********=0%,OO,>:>>O +1OO4*************", +"**********=%+OO:::1:::6+:7**************", +"***********7&OO:O+O,O1OO+1**************", +"***********40OO,O4:OOO11O<5*************", +"**********=4 +O1O2+O2+O0O***************", +"************72O+1+21-OOO%5**************", +"************0%1OOOO+O+174***************", +"*************%%O,OO1407-=***************", +"**************-$>%0%:74*****************", +"****************54044*=*****************", +"*****************=*=********************" +}; +/* XPM */ +static const char *sick_il_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 23 1", +/* colors */ +" c #F85848", +". c #949E9E", +"X c #F8B090", +"o c #E00028", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #FF0000", +"* c #914700", +"= c #B64700", +"- c #909090", +"; c #606060", +": c #FFFFFF", +"> c #CEAA90", +", c #DADAB6", +"< c #F86800", +"1 c #FFB691", +"2 c #6C91B6", +"3 c #F88C48", +"4 c #0000FF", +/* pixels */ +"########################################", +"#############O:::::::::O################", +"###########OO:::::O::::::O##############", +"##########O:::::O:::::O::#$$############", +"#########O::OO::%&%:O:::::22############", +"########O::O::O:%o :::::O::$.###########", +"########O:#O::%&&&&&%:::::O22###########", +"#######O:#::::%&&&&o ::O:::O2$##########", +"#######O:::O::O:%&%::O#OO:::22##########", +"######O:O:::::::%o%O:::O22::#2$#########", +"######O:::O::O:::::::O:::#2222$#########", +"######O:::::::::O:O::::::::#222#########", +"######O:O::O::::::::O::O::::O2$#########", +"######O:::::>=@@=**=**>>-:O::O2#########", +"######O::#**@3>%* ;=>=3;<@>>::$#########", +"######O:** >=>XXXX1X >>+>%*%*;O#########", +"######O3@*,X%XXXXXXX>X%XX >*=*O#########", +"######.@@3XXXXXXXXXXXXXXX>X>3*-#########", +"######>***>X% >XXXXX3XXXXXX%>*=>########", +"######.***> 22#XXX<%X22#XXX@+;#########", +"######=*3@X>O442OXX==%XX11111O1+%X111XX%<#>#########", +"######.,;XXXXXX1O1X%3XXXXX%+3###########", +"########3=XXXXXX:XXXXXXXXX+<>$##########", +"########>+XXXXXX%-3->XXXX%+<############", +"#########%3XXXXXX>- -%XXX%<%$###########", +"#########$############", +"##########+%XXXXXXXXXXXX%+<#############", +"##########%3XXX>=****3XX%<%#############", +"##########>+XXX**=3-*@3>3+##############", +"###########<%XX >XX%X;%X3+##############", +"###########%3XX>XX++XXXX<%$#############", +"##########$>+XXXXXXXXXXX<###############", +"############<%XXXXXXXXX3+###############", +"###########$%+XXXXXXXX%<>###############", +"#############++XXXXXX%<%$###############", +"#############$%<<3333<%#################", +"#################%3>>$##################", +"#################$#$####################" +}; +/* XPM */ +static const char *slt_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO&&&&&&&X @OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo======X*OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOoO======X**OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO&====X===% $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOoo==%* %==%* OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOoO=% % =X* @OOOOOOOOOOOOO", +"OOOOOOOOOOOOO&==**==% %=% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOoo==%%==* %=X OOOOOOOOOOOOO", +"OOOOOOOOOOOOoO=====* X==X* @OOOOOOOOOOOO", +"OOOOOOOOOOOO&=====* %====% $OOOOOOOOOOOO", +"OOOOOOOOOOOoo==== X=====%* OOOOOOOOOOOO", +"OOOOOOOOOOOo+===* *%*%%==X* @OOOOOOOOOOO", +"OOOOOOOOOOO&==== %===% $OOOOOOOOOOO", +"OOOOOOOOOOO&==============% OOOOOOOOOOO", +"OOOOOOOOOOO==============X% @OOOOOOOOOO", +"OOOOOOOOOOO+%%%%%%%%%%%%%% $OOOOOOOOOO", +"OOOOOOOOOOOOO% $OOOOOOOOOO", +"OOOOOOOOOOOOO@ @OOOOOOOOOO", +"OOOOOOOOOOOOOO@$$$$$$$$$$$$$@OOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *str_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 17 1", +/* colors */ +" c #000000", +". c #F8B090", +"X c #5C7A7A", +"o c #F87A24", +"O c #7C3400", +"+ c None", +"@ c #B0B0B0", +"# c #F89E6C", +"$ c #B64700", +"% c #909090", +"& c #606060", +"* c #CEAA90", +"= c #DADAB6", +"- c #303030", +"; c #F86800", +": c #FFB691", +"> c #F88C48", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"+++++++++++++++++++*>*>#++++++++++++++++", +"++++++++++++++++*#o>..*#o*++++++++++++++", +"+++++++++++++++o#.#>.....o++++++++++++++", +"+++++++++++++++;>;#.o.>..#$X++++++++++++", +"+++++++++++++++o#>.o.>:...o %++++++++++", +"++++++++++++++o##>>#o##>..#O -++++++++++", +"++++++++++++++>#.oo#>..>...O ++++++++++", +"++++++++++++++*o##.>>;o#...o ++++++++++", +"+++++++++++++++*;o#........>- &+++++++++", +"+++++++++++++++++#>>;o......O -+++++++++", +"+++++++++++++++++@+@+o>.....$ +++++++++", +"+++++++++++++++++++++*;.#...>- %++++++++", +"++++++++++++++++++++++;>o....$ &++++++++", +"++++++++++++++++++++++#>>....>- %+++++++", +"+++++++++++++++++++++++;#>....; -+++++++", +"+++++++++++++++++++++++o#>....>O %++++++", +"+++++++++++++++++++++++*>o.....; -++++++", +"+++++++++++++#>**+++++++;#.....>O %+++++", +"+o#+++++++*o;>>>>o#+++++o##.....; -+++++", +"+:#o*++++oo#..*..*>;*+++#>#.....>O %++++", +"+:=#o#+*;>.:==:....#;*++@o.......; &++++", +"+::..>;o#.=::::......o*++;.......>O ++++", +"+.....#o.:.=:.........o#+;........$ ++++", +"+......#o..:...........#o;>.......o &+++", +"+........#..............*>o......:o- +++", +"+..................#o>#...#o.......O +++", +"+...............>o>#.......#>......O &++", +"+..................................o -++", +"+..................................> ++", +"+..................................> ++", +"+.................................#$ &+", +"+................................>$ &+", +"+..#>$o>#..............#>;>>>oOOO- ++", +"+...#O OOOOO$>>>>>>>$OO %++", +"+...o -&&++++", +"+..#O -&&%++++++++++", +"++++++++++++++++++++++++++++++++++++++++" +}; +/* XPM */ +static const char *stunned_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 12 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #303030", +"* c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOO&$OOOO@OOO@@OO@OOOOOOOOOOOOO", +"OOOOOOOOOOO@& $OO@&&$$@ O@$$OOOOOOOOOOOO", +"OOOOOOOOOOOO$$ @@@$ &&OOO@$OOOOOOOOOOOO", +"OOOOOOOOOOOOO@@&$$$$&O$OO$O &@O@OOOOOOOO", +"OOOOOO@@@@@@OO@$$O$&$@@OO& &&$O&OOOOOOO", +"OOOOOO&&&& & $ &&@$ &O@$& &&&$ & $OOOOOO", +"OOOOOO$&OO &&&$ $$ $& $$&$&&&OOOOOOO", +"OOOOOO@@O@$ &+ # &O$$ $$&O@OOOOO", +"OOOOOOOO@X%$ %& %% & && $$@@@@OOOO", +"OOOOOOO+$$@+ &%%%&%& & &@OOO&&OOO", +"OOOOOO.Xo%+ &&%%%%%&& & OO@$&&OOO", +"OOOOO++ $$&&$ && %&%%& &O@&$&OOOO", +"OOOOO####$ X&&& && &%& & &&OOOO", +"OOOO++#.+## $&# %& & & &$ OOOO", +"OOOO#+++.@&%&& &#&%& & $ @OOOOOO", +"OOOO##....#+$#@%#& $%$&@&$$% & X##$@OOOO", +"OOOO.+#+.+@#+#+$&$X#%&%.+& %&#++.$&OOOOO", +"OOOOO#+#+.+++#$$%&++&X+X#&#+&+&##+ &OOOO", +"OOOOO#..#OO#+@%#o##X.@..++.+$&+#+#& @OOO", +"OOOOO+#.#O+#+#O@++@$$##+##++###+.#& $OOO", +"OOOOOOXX+#+#+#o.@%&$++#+..##.#+### &OOO", +"OOOOOOOX#.#X+#+#+##&#+..+####%XX%% OOO", +"OOOOOOOO+%%X.#+#+#.++#+#+#+.X++*.% &OOO", +"OOOOOOOOO@& &##+#+.O####.+XX%%%%#% $OOO", +"OOOOOOOOOOO. %X.+.#+++XXX*.+++#X $OOO", +"OOOOOOOOOOOO@& %%X..#X%#.####%X& $OOO", +"OOOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOO", +"OOOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOO", +"OOOOOOOOOOOOOOOOOOO*%%%**X##X%& OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X*X& @OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X &@OOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+X%%* @OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOX%%& OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO.X%& $OOOOOOOOOOOOO" +}; +/* XPM */ +static const char *wis_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c None", +"O c #B0B0B0", +"+ c #909090", +"@ c #788C8C", +"# c #606060", +"$ c #406868", +"% c #FFFFFF", +"& c #303030", +"* c #6C91B6", +"= c #0000FF", +/* pixels */ +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooo+#& &#oooooooooooooooooooo", +"oooooooooooo+& #oooooooooooooooooo", +"ooooooooooo+ &====&& &ooooooooooooooooo", +"oooooooooo+ &==& ===%& +ooooooooooooooo", +"ooooooooo+&%=== ===%%o&&oooooooooooooo", +"oooooooo.&%%===& ===%o& #+ooooooooooo", +"oooo&###&&%%*=======$#&ooo#& #+oooooooo", +"ooooo###o+&X$=====& #oo##oooo+######oooo", +"oooooooooooo######@oo##ooooooooooooooooo", +"oooooooooooooOoOoOo##ooooooooooooooooooo", +"ooooooooooooooooo+#+ooo+&#oooooooooooooo", +"ooooooooooooooooooooooo#oooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo" +}; +/* clang-format on */ diff --git a/win/Qt/qttableview.cpp b/win/Qt3/qt3tableview.cpp similarity index 99% rename from win/Qt/qttableview.cpp rename to win/Qt3/qt3tableview.cpp index b53e8a415..8bbc78cd6 100644 --- a/win/Qt/qttableview.cpp +++ b/win/Qt3/qt3tableview.cpp @@ -1,5 +1,5 @@ /********************************************************************** -** $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.4 $ $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ +** $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ $NHDT-Date: 1575917720 2019/12/09 18:55:20 $ ** $Id: qttableview.cpp,v 1.2 2002/03/09 03:13:15 jwalz Exp $ ** ** Implementation of QtTableView class @@ -13,7 +13,7 @@ ** **********************************************************************/ -#include "qttableview.h" +#include "qt3tableview.h" #if QT_VERSION >= 300 #ifndef QT_NO_QTTABLEVIEW #include diff --git a/include/qttableview.h b/win/Qt3/qt3tableview.h similarity index 100% rename from include/qttableview.h rename to win/Qt3/qt3tableview.h diff --git a/win/Qt/tileedit.cpp b/win/Qt3/tileedit.cpp similarity index 100% rename from win/Qt/tileedit.cpp rename to win/Qt3/tileedit.cpp diff --git a/win/Qt/tileedit.h b/win/Qt3/tileedit.h similarity index 100% rename from win/Qt/tileedit.h rename to win/Qt3/tileedit.h diff --git a/win/Qt4/.gitattributes b/win/Qt4/.gitattributes deleted file mode 100644 index 68792d904..000000000 --- a/win/Qt4/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* NH_filestag=(file%s_for_the_Qt_4_widget_library_-_X11,_Windows,_Mac_OS_X) diff --git a/win/Qt4/qt4win.cpp b/win/Qt4/qt4win.cpp deleted file mode 100644 index ca0abe57b..000000000 --- a/win/Qt4/qt4win.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Warwick Allison, 1999. -// Qt4 conversion copyright (c) Ray Chason, 2012-2014. -// NetHack may be freely redistributed. See license for details. - -// Qt Binding for NetHack 3.4 -// -// Copyright (C) 1996-2001 by Warwick W. Allison (warwick@troll.no) -// -// Contributors: -// Michael Hohmuth -// - Userid control -// Svante Gerhard -// - .nethackrc tile and font size settings -// Dirk Schoenberger -// - KDE support -// - SlashEm support -// and many others for bug reports. -// -// Unfortunately, this doesn't use Qt as well as I would like, -// primarily because NetHack is fundamentally a getkey-type program -// rather than being event driven (hence the ugly key and click buffer) -// and also because this is my first major application of Qt. -// -// The problem of NetHack's getkey requirement is solved by intercepting -// key events by overiding QApplicion::notify(...), and putting them in -// a buffer. Mouse clicks on the map window are treated with a similar -// buffer. When the NetHack engine calls for a key, one is taken from -// the buffer, or if that is empty, QApplication::exec() is called. -// Whenever keys or clicks go into the buffer, QApplication::exit() -// is called. -// -// Another problem is that some NetHack players are decade-long players who -// demand complete keyboard control (while Qt and X11 conspire to make this -// difficult by having widget-based focus rather than application based - -// a good thing in general). This problem is solved by again using the key -// event buffer. -// -// Out of all this hackery comes a silver lining however, as macros for -// the super-expert and menus for the ultra-newbie are also made possible -// by the key event buffer. -// - -// This includes all the definitions we need from the NetHack main -// engine. We pretend MSC is a STDC compiler, because C++ is close -// enough, and we undefine NetHack macros which conflict with Qt -// identifiers. - -#define QT_DEPRECATED_WARNINGS -#include "hack.h" -#undef Invisible -#undef Warning -#undef index -#undef msleep -#undef rindex -#undef wizard -#undef yn -#undef min -#undef max - -#include -#if QT_VERSION >= 0x050000 -#include -#endif -#include "qt4win.h" -#include "qt4bind.h" -#include "qt4click.h" -#include "qt4glyph.h" -#include "qt4inv.h" -#include "qt4key.h" -#include "qt4icon.h" -#include "qt4map.h" -#include "qt4menu.h" -#include "qt4msg.h" -#include "qt4set.h" - -#include - -#include "qt4clust.h" - -#include - -#ifdef _WS_X11_ -// For userid control -#include -#endif - -#ifdef USER_SOUNDS -#if QT_VERSION >= 0x050000 -# include -# else -# include -# endif -#endif - - -#ifdef USER_SOUNDS -extern void play_sound_for_message(const std::string& str); -#endif - -namespace nethack_qt4 { - -void -centerOnMain( QWidget* w ) -{ - QWidget* m = NetHackQtBind::mainWidget(); - if (!m) m = qApp->desktop(); - QPoint p = m->mapToGlobal(QPoint(0,0)); - w->move( p.x() + m->width()/2 - w->width()/2, - p.y() + m->height()/2 - w->height()/2 ); -} - -NetHackQtWindow::NetHackQtWindow() -{ -} -NetHackQtWindow::~NetHackQtWindow() -{ -} - -// XXX Use "expected ..." for now, abort or default later. -// -void NetHackQtWindow::Clear() { puts("unexpected Clear"); } -void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } -bool NetHackQtWindow::Destroy() { return true; } -void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } -void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } -void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } -void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel) { puts("unexpected AddMenu"); } -void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } -int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } -void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } -void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } -//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } -void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } - -} // namespace nethack_qt4 diff --git a/win/Qt/nhicns.uu b/win/share/nhicns.uu similarity index 100% rename from win/Qt/nhicns.uu rename to win/share/nhicns.uu diff --git a/win/Qt/nhsplash.xpm b/win/share/nhsplash.xpm similarity index 100% rename from win/Qt/nhsplash.xpm rename to win/share/nhsplash.xpm diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 565e21794..5f539114f 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -169,10 +169,6 @@ - - - - diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index 12b4dbd62..1ea3ce9e5 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -163,10 +163,6 @@ - - - -