Commit Graph
77 Commits
Author SHA1 Message Date
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
Ray Chason 3479c471dd Qt on Win32: changes needed for Win32
* Fix an include directory
* Use strchr instead of index
* play_usersound conflicts with another function
2018-09-10 21:13:24 +03:00
Ray Chason 7de9266b04 Qt on Win32: add stub for Qt window_procs 2018-09-10 21:13:20 +03:00
Ray Chason 41fdc79b7b Qt on Win32: resolve conflict over boolean type 2018-09-10 21:13:14 +03:00
Ray Chason 8dbaafbb7b Ignore Win32 build products 2018-09-10 21:13:10 +03:00
Ray Chason 3fc2373ca2 Add build configuration for Qt 4 and 5 2018-09-10 21:13:05 +03:00
Ray Chason 6894e464d4 Win32: delete the o directory only if it exists 2018-09-10 21:13:00 +03:00
Ray Chason 5be0044c62 Add -lgdi32 to conlibs, needed to link 2018-09-10 21:12:56 +03:00
Ray Chason cdfb9cb744 Linux and Mac: ignore .moc files created in src 2018-09-10 21:12:53 +03:00
Ray Chason e7a3390d74 Add build products to make spotless
Win32 Makefile.gcc now cleans up all build products except the binary
directory.
2018-09-10 21:12:47 +03:00
Ray Chason 5e04a6e6cb New hints file for Qt 5 on Mac OS X 2018-09-10 21:12:17 +03:00
Ray Chason 08ef5ff99f Provide Qt 5 configuration on Linux
* CXX specifies -std=gnu++11
* WINQT5LIB variable added
* Hints file can specify CXX and MOC
2018-09-09 18:10:20 +03:00
Ray Chason bd5743f758 MS-DOS does not use getreturn_enabled 2018-05-23 21:44:42 -04:00
Ray Chason 2357cb3fc2 Work around quirky FreeDOS behavior 2018-05-23 21:44:20 -04:00