Commit Graph
100 Commits
Author SHA1 Message Date
Ray Chason fbc586bf44 Convert map to use Xft 2026-08-19 09:37:40 +03:00
Ray Chason 23315cf857 Combine XLoadFont and XQueryFont calls
The separate calls crash if the font does not exist; the combined call
returns NULL, as the caller expects.

Resolves #1508 and possibly #569.
2026-08-18 13:40:35 +03:00
Ray Chason 0454838d13 Arrange labels more compactly 2026-08-14 11:08:26 +03:00
Ray Chason ddbea3b727 Implement remaining status labels 2026-08-14 11:08:26 +03:00
Ray Chason fbfac21aac Fix menu group accelerators
If there are, say, two or more potions in the menu, and multiple
selections are allowed, then '!' should select all potions. Such keys
were selecting only the first matching item.
2026-08-14 11:08:26 +03:00
Ray Chason 2d261f1398 Implement all text attributes for menus 2026-08-14 11:08:26 +03:00
Ray Chason 84ff4f8b7e Fix a null dereference when freeing fonts 2026-08-14 11:08:26 +03:00
Ray Chason 3398d250aa Implement blink on fancy status
and fix a bug with condition labels on the TTY status
2026-08-14 11:08:26 +03:00
Ray Chason 24d9c19378 Parenthesize the HL_ATTCLR_* symbols 2026-08-14 11:08:26 +03:00
Ray Chason 514669823b Implement bold, dim, italic, inverse, underline
Didn't get everything the last time.
2026-08-14 11:08:26 +03:00
Ray Chason 8d7d609a56 Implement attributes: bold, dim, italic, inverse
Track highlighting of recent changes separately from inverse, and
display highlight plus inverse as bordered text
2026-08-14 11:08:25 +03:00
Ray Chason 0ee7eef3ef Implement a hit point bar 2026-08-14 11:08:25 +03:00
Ray Chason 6043d189e1 Define wrapper for Label widgets
Renders to a Pixmap and then sets the Pixmap. This in itself does not
change the appearance, but provides a means to do percentage bars,
italics and more.
2026-08-14 11:08:25 +03:00
Ray Chason f7bb4eaae8 Fix timeout of fancy status colors
This was trying to retrieve the foreground color of the form created
in create_value(). Forms don't have colors, and so this was failing,
and update_color() didn't update the color.
2026-08-14 11:08:25 +03:00
Ray Chason c50f9d8176 Draw the hitpoint bar in the hitpoint colors 2026-08-10 09:28:04 +03:00
Ray Chason b9bf823100 Implement a hit point bar 2026-08-10 09:28:04 +03:00
Ray Chason ac169e7100 Clean up, and block out with STATUS_HILITES 2026-08-10 09:28:04 +03:00
Ray Chason ba2c99f28c Remove old code 2026-08-10 09:28:04 +03:00
Ray Chason b763944fb4 Implement three line status 2026-08-10 09:28:04 +03:00
Ray Chason 7521e7120a Implement blink 2026-08-10 09:28:04 +03:00
Ray Chason 8137f6cf3d Remove some debug code 2026-08-10 09:28:03 +03:00
Ray Chason 0f39437315 Implement underline and italic 2026-08-10 09:28:03 +03:00
Ray Chason a7eb50fb36 Query font for status window height 2026-08-10 09:28:03 +03:00
Ray Chason 647fd71a2d Implement bold and dim attributes 2026-08-10 09:28:03 +03:00
Ray Chason 5dd1673678 Implement colors 2026-08-10 09:28:03 +03:00
Ray Chason 725bb3d05f Display gold symbol as Unicode if so configured
Some Unicode bits from winmap.c are moved to winX.c, so that winstat.c
can also use them.
2026-08-10 09:28:03 +03:00
Ray Chason c2b4ee53e5 Begin reimplemented TTY-style status 2026-08-10 09:28:03 +03:00
Ray Chason e0ecf0e5f2 Fix highlighting in 16 color text map
vga_redrawmap did not have the inverse flag available. Provide it.
2026-08-04 16:05:27 -04:00
Ray Chason 3e800b90d3 Support pet and tile decals in 16 color mode 2026-08-04 15:55:36 -04:00
Ray Chason 9d5184562e More decal support for VESA
* Support decals in overview mode
* Draw decals when redrawing the map
2026-08-04 09:38:38 -04:00
Ray Chason 85bb8c1fbc Simplify the 24-bit case 2026-08-03 22:20:18 -04:00
Ray Chason 0c044e9c90 Add hilite flags 2026-08-03 22:12:32 -04:00
Ray Chason bd68058327 Extend decal support to all VESA modes 2026-08-03 22:12:14 -04:00
Ray Chason e00b32263e Support the Curses-only configuration 2026-07-10 09:08:55 -04:00
Ray Chason 7889eedfa5 MS-DOS: Support no-tiles and no-graphics builds
In previous versions of NetHack, setting -DUSE_TILES enabled the tile
support, while setting -DSUPPRESS_GRAPHICS produced a NetHack that
would write its TTY output to standard output, and rely on ANSI.SYS or
similar to do screen control. (USE_TILES is now TILES_IN_GLYPHMAP.)

This change ensures that the current NetHack can be built the same
ways.

One twist is that previous NetHacks would drop all support for graphical
modes when tiles were not supported. Thus sys/msdos/vid{vga,vesa}.c have
very disordered use of TILES_IN_GLYPHMAP. There was no need to check
this. But now, the graphical modes also support Unicode. A non-tiled
build should have the graphical modes, with only the text functions
present, provided that ENHANCED_SYMBOLS is defined.

Some unused and locally used symbols were cleaned up along the way.
2026-07-09 23:48:14 -04:00
Ray Chason f3f39311e5 MS-DOS: Define a separate palette for VGA text
In 16 color mode, text colors are mapped onto the colors available in
the tileset. The mapping is a compromise, and is not one-to-one: cyan
and bright cyan are the same, and magenta and bright magenta are the
same.

This change defines a separate palette for use by the text map, and
switches palettes on any transition between text and tiled maps.
2026-07-07 16:24:35 -04:00
Ray Chason 20fb008012 Fix memory errors in qt_tilewidth and qt_tileheight
* qt_tilewidth and qt_tileheight are allocated with alloc() and need
  to be freed with free().
* Don't use them after they're freed. Instead, retrieve the size from
  the glyphs object.
2023-06-04 22:17:00 -04:00
Ray Chason 199a76eaaa Fix compile on Qt 4 2023-06-04 18:05:09 -04:00
Ray Chason f78620efd7 Qt: Convert to UTF-16 2023-06-04 17:19:45 -04:00
Ray Chason 9037592ea1 parent 97edec62b5
author Ray Chason <ray.chason@protonmail.com> 1684372172 -0400
committer nhmall <nhmall@nethack.org> 1685414340 -0400

Add configuration to support Curses on WinGUI

and enable support for Unicode on Curses.

Allow NetHackW to select the Curses interface

Reorder drawing of extended command prompt

Curses on WinGUI needs this change. This may be a bug in PDCursesMod,
but it seems to be harmless to the other ports.

Avoid calling Curses after the windows are closed

Provide erase_char and kill_char for WinGUI Curses

Set Lua version to 5.4.6
2023-05-29 22:39:43 -04:00
Ray Chason 890853a03d Restore compatibility with Qt 4
The test system is Slackware 14.2, which uses Qt 4.8.7.

* WANT_WIN_QT4 is defined, and has the expected meaning. Qt 5 is still
  the default.

* The QT_NO_SOUND macro now excludes all headers and declarations
  relating to sound; the multimedia package is not needed to build
  (on any Qt 4, 5 or 6).

* A new function, nh_qsprintf, replaces QString::asprintf, for Qt
  older than 5.5. These versions do not have QString::asprintf.

* DYNAMIC_STATUSLINES is disabled for Qt older than 5.9. These versions
  do not have QSplitter::replaceWidget.
2022-11-23 13:11:14 -08:00
Ray Chason 5a80a437a2 Free the whole list when freeing 2022-11-23 12:05:04 -08:00
Ray Chason 913a7dc0e0 Fix use after free in Unicode mappings
Shuffling gem appearances can cause mappings from object to
appearance that are not one-to-one. Copy any multiple mappings and
free any mappings that are left unused.
2022-11-23 12:05:04 -08:00
Ray Chason 5181c287d3 Parse only Unicode symbols in the current symset 2022-11-23 12:05:04 -08:00
Ray Chason 0322ea9341 Some cleanup for non-ENHANCED_SYMBOLS build 2022-11-05 18:34:44 -04:00
Ray Chason 69d76ed4b6 Free the font structure when done
Also, adjust some comments about not supporting supplementary
characters.
2022-11-05 18:24:02 -04:00
Ray Chason 6754b85294 Set registry ISO10646 at run time
We don't know at compile time whether the X server even supports
Unicode. So take the configured map font, change the registry to
ISO10646 and try the resulting font string. Keep the configured
font if that doesn't work.
2022-11-05 11:56:21 -04:00
Ray Chason 0c7d42c739 Add Unicode, IBMgraphics and DECgraphics to X11 2022-11-05 00:40:04 -04:00
Ray Chason 940c37f13e Add Xlib.h
Gets us running on XFree86 3.3.5
2022-11-03 22:13:52 -04:00
Ray Chason 14b8350bce Fix inadvertent change of strchr to index
Thanks to entrez for pointing this out.
2022-11-03 19:58:56 -04:00
Ray Chason de32aa74c7 Use "magenta" for bright magenta
Older X servers don't understand "Fuchsia," and NetHack throws
impossibles as a result. The current Xorg defines "magenta" as the
same color as "Fuchsia," namely #FF00FF, and older X servers
understand "magenta."

The resulting X11 NetHack is known to work with XFree86 4.2.0.
The minimum version remains undetermined.
2022-11-03 19:35:41 -04:00
Ray Chason 5eaa162c82 Define and use PRINTF_F_PTR
GCCs older than 3.1 understand __attribute__(printf(...)), but only
with functions; it doesn't work with function pointers. This change
uses PRINTF_F_PTR to remove the attribute from two function pointers.

This change establishes GCC 3.0 as the minimum version to build
NetHack. Older versions have trouble with the variadic macros and
variable declarations in mid-block.
2022-11-03 19:33:30 -04:00
Ray Chason 57617da39b PR913 - Another Qt 6 signal: mapped -> mappedString 2022-10-27 22:59:30 -04:00
Ray Chason defecc5110 Another Qt 6 signal: mapped -> mappedString 2022-10-27 22:50:17 -04:00
Ray Chason 5c001d3a32 Use idPressed signal for Qt 6 2022-10-27 21:51:10 -04:00
Ray Chason 8e457002a3 Add WC2_U_UTF8STR and WC2_U_24BITCOLOR 2022-10-26 22:33:47 -04:00
Ray Chason c801f3ce00 Write Unicode to text save file 2022-10-16 22:57:28 -04:00
Ray Chason f7aa79f939 Copy Unicode to the clipboard 2022-10-16 22:32:11 -04:00
Ray Chason c5674fd10c Fix crashes when copying to clipboard 2022-10-16 21:42:42 -04:00
Ray Chason 426ef4d8d2 Add Unicode support to the map 2022-10-16 21:42:18 -04:00
Ray Chason 5683f88d36 A note on makefonts.lua 2022-10-05 20:25:34 -04:00
Ray Chason 31859f562e Make the Terminus fonts an external package
Credit to Michael Allison for the patch and for the previous one
to build the fonts in the cross-compile.
2022-10-05 20:03:11 -04:00
Ray Chason 03a82720ef Build fonts in the native build 2022-10-03 20:53:07 -04:00
Ray Chason cb010b9859 Ignore the PSFs 2022-10-03 20:24:20 -04:00
Ray Chason daf18eac91 Build the PSF fonts in the cross-compile 2022-10-03 20:22:11 -04:00
Ray Chason 176e94d1b9 Merge branch 'unicode' of https://github.com/chasonr/nethack into unicode 2022-10-02 20:41:21 -04:00
Ray Chason d3cb84a313 Update the README for the fonts 2022-10-02 20:41:02 -04:00
Ray Chason 37f43c3b79 Rewrite the makefont program in Lua 2022-10-02 20:41:02 -04:00
Ray Chason b4832b40fc Support the DOSVGA build 2022-10-02 20:41:02 -04:00
Ray Chason db74f82101 More native compile fixes
* subst doesn't seem to work in variable assignments
* LUADLL isn't meaningful for MS-DOS
2022-10-02 20:41:02 -04:00
Ray Chason 76a88ef2b0 Updates to the native compile 2022-10-02 20:41:02 -04:00
Ray Chason 8b6fe9d205 Support wide Curses on MS-DOS
Also, fix IBMGraphics on Curses
2022-10-02 20:41:02 -04:00
Ray Chason df7bea0dbd Update the README for the fonts 2022-10-02 20:38:30 -04:00
Ray Chason b259184fad Rewrite the makefont program in Lua 2022-10-02 13:29:47 -04:00
Ray Chason 05612f5c0f Support the DOSVGA build 2022-10-02 03:12:03 -04:00
Ray Chason 53be334eff More native compile fixes
* subst doesn't seem to work in variable assignments
* LUADLL isn't meaningful for MS-DOS
2022-10-02 01:44:06 -04:00
Ray Chason 85be4b8ac6 Updates to the native compile 2022-10-02 01:05:46 -04:00
Ray Chason cab1f6d8c5 Support wide Curses on MS-DOS
Also, fix IBMGraphics on Curses
2022-10-01 23:44:42 -04:00
Ray Chason 31862b95b0 Fix undefined behavior when exiting Curses
* When saving: curses_exit_nhwindows calls curses_uncurse_terminal,
  which calls endwin. curses_exit_nhwindows then calls raw_print,
  which calls more Curses functions after endwin has been called.
  Fix this by having curses_raw_print use puts if window_inited
  is false.

* When dying, quitting, etc.: really_done opens the "Goodbye" window,
  which refreshes the other windows when it closes. But the status
  window (and possibly the map and message windows) are gone by that
  point. The window pointers are properly NULLed, but the NULL is then
  passed to touchwin. Fix this by checking window pointers for NULL.
2022-09-28 14:23:27 -07:00
Ray Chason 1f2a1efee5 Use QApplication::desktop for screen size on Qt5
5.15 has QWidget::screen, but older versions don't.
2021-12-30 10:56:07 -08:00
Ray Chason 35c12e2518 Use QApplication::desktop for screen size on Qt5
5.15 has QWidget::screen, but older versions don't.
2021-12-29 01:44:02 -05:00
chasonr 1ab84e055e Merge branch 'NetHack-3.7' into msdos-video-doc 2020-02-02 10:15:32 -05:00
Ray Chason 1fb1967e42 Enable statue glyphs for cross compile 2020-02-01 16:48:37 -05:00
Ray Chason f9b4ebae87 Remove code fragment causing compile error 2020-02-01 16:48:07 -05:00
Ray Chason a391bf0e7b Update description of OPTIONS=video
Document OPTIONS=video:vesa. Also, OPTIONS=video_width and video_height
work with vesa, not vga; and the TeX guidebook needs some syntax fixes.
2020-02-01 11:03:36 -05:00
Ray Chason b52392a5bc Make background appear as a proper black 2020-01-27 09:54:59 +02:00
Ray Chason b296196a4a Scale the font for large resolutions 2020-01-27 09:54:58 +02:00
Ray Chason 82a219c227 Lift restrictions on tilesets
Support full color tilesets with tiles of arbitrary size.
2020-01-27 09:54:58 +02:00
Ray Chason 34da5ea372 MSDOS/VESA: Make clipy and clipymax available to MS-DOS
VESA mode may need to scroll up and down as well as left and right.
2020-01-27 09:54:58 +02:00
Ray Chason b2c8d916f6 Add set_tile_type, stretch_tile and free_tile
set_tile_type frees tileset memory not in use for the current tile
type (paletted or full color).
stretch_tile and free_tile support resizing tiles at run time.
2020-01-27 09:54:58 +02:00
Ray Chason 1870e5a41b Fix bugs affecting full-color BMP files 2020-01-27 09:54:58 +02:00
Ray Chason 9460796a2b MSDOS/VESA: Add video_width and video_height
To be used to set the video mode
2020-01-27 09:54:58 +02:00
Ray Chason aa3303cafc More bits for linear frame buffer 2020-01-27 09:54:58 +02:00
Ray Chason 8d9f31e91f Support the linear frame buffer if available
If the linear frame buffer is in use, the entire frame buffer is
visible all at once, and no calls to the window function are needed.
2020-01-27 09:54:58 +02:00
Ray Chason ab6424b31c Call the window function directly if supported
Some BIOSes allow calling the window function directly, bypassing the
logic that distinguishes this call from other BIOS calls. Should be
faster on some systems.
2020-01-27 09:54:58 +02:00
Ray Chason c0d1c4efb7 Use 8 bit mode if available
This was not previously done because the palette was not correctly set
up, and QEMU gave incorrect colors. The palette setup function now
falls back to the standard BIOS function if the VESA BIOS function
fails, which resolves the issue with QEMU. The mode selection logic now
favors 8 bit color if the tile set is compatible.

Using 8 bit mode means fewer writes to memory and fewer uses of the
BIOS window function.
2020-01-27 09:54:58 +02:00
Ray Chason 6f9e7b6b97 Fixes to build NetHack 3.7.0 on FreeDOS 2019-12-23 18:03:26 -05:00
Ray Chason 59c6425f4c Deal with FreeDOS bugs when building pdcurses.a 2019-11-04 22:26:47 -05:00
Ray Chason d5104c622f Use faster method to write to VGA 2019-09-12 23:04:15 -04:00
Ray Chason c13eed7369 Qt4: Hide buttons not matching typed command
There are way too many buttons on the extended command window.
Let the user type a letter or two, and hide the buttons that don't
match.
2018-09-10 21:13:32 +03:00