Commit graph

52 commits

Author SHA1 Message Date
John "Elwin" Edwards
35c5e434e6 Rearrange some Autoconf files.
Autoconf was failing to detect install-sh at the top level and needed
some explicit directions.  It also wants config.guess and config.sub to
be provided too.

A few other macros have also been updated.
2023-09-05 20:05:24 -04:00
John "Elwin" Edwards
6a654fbe69 Update the Autoconf files.
These are mostly automatic updates for obsolete macros.
2021-05-11 22:30:03 -04:00
John "Elwin" Edwards
6c3cd116ff Fix many compiler warnings.
There should only be two changes in behavior:

arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly
applied to characters who are not monks instead of monks who are not
empty-handed.

urogue/fight.c: fixed an interaction with the "debug" macro that could
cause the wrong message to be displayed.
2021-04-14 18:55:33 -04:00
John "Elwin" Edwards
7d459d7d36 Fix an assortment of compiler warnings.
A few potential bugs were removed in the process.  Much code cleanup
remains to be done.
2019-11-22 21:18:27 -05:00
John "Elwin" Edwards
82dca01969 Rogue V5: fix elemental wands.
Bolts often failed to hit, due to some struct members not being
initialized.

Reported by 'LazyCat' from RogueTemple.
2018-01-12 18:02:39 -05:00
John "Elwin" Edwards
bb37c1c3f7 Improve the documentation build process.
The choice between troff implementations is now made at configure time,
rather than using shell logic in the Makefile to choose while building.
2017-12-30 14:15:52 -05:00
John "Elwin" Edwards
338214459d Fix a portability issue with md_hasclreol().
Some games' implementation of md_hasclreol() poked around in ncurses
internals, which does not work for some ncurses build configuration.
Most games did not actually call md_hasclreol(), so it was removed.
There is a standard terminfo function which can retrieve the value of
the clr_eol capability, so this was used for rogue5.
2017-12-27 10:26:06 -05:00
John "Elwin" Edwards
359d0987a4 Remove version numbers from docdir paths.
Most Unix systems prefer to omit the versions.
2017-10-16 19:53:38 -04:00
John "Elwin" Edwards
0936c8f216 Excise md_putchar().
The function wrapped the standard putchar(), doing nothing beside
discarding the return value.  That could cause problems with tputs(),
which expects an int to be returned.
2017-09-18 19:11:57 -04:00
John "Elwin" Edwards
f8d1f422c8 Remove an extra bracket from some Autoconf macros. 2017-09-10 17:30:13 -04:00
John "Elwin" Edwards
62047972cc Use more portable random seed generation.
The new function md_random_seed() has replaced time() + getpid() and
similar methods.  Putting everything in mdport.c slightly reduces the
warnings and workarounds.
2017-01-28 15:49:41 -05:00
John "Elwin" Edwards
714bad8c3c Rogue V5: fix save/restore making levitation, hallucination permanent.
Like an earlier bug with detecting monsters, the fuses responsible for
ending levitation and hallucination were not recognized by
rs_write_daemons().  They got left out of the savefile, so after
restoring, the effect never wore off.

I think this is the first bugfix I've ever made that reduced the game's
difficulty.
2016-07-20 20:44:41 -04:00
John "Elwin" Edwards
63b2707739 Enable the logfile on 64-bit Windows.
It seems to work without any problems.

One use of a non-portable function was corrected in the process.
2016-05-17 21:28:34 -04:00
John "Elwin" Edwards
c5f4f359ea Rogue V5: don't limit the high score list to 1 on Windows.
The Visual Studio project file failed to define ALLSCORES, causing the
score file to be limited to one entry per UID.  Since the UID is always
set to 42 on Windows, only one entry could ever appear in the list.
2016-05-15 19:04:46 -04:00
John "Elwin" Edwards
ca1c442db2 Rogue V[345], Super-Rogue: Fix violet fungi/venus flytraps.
Violet fungi (renamed venus flytraps in Rogue V5) do an increasing
amount of damage each time they hit.  If they miss, you still suffer
the same number of HP.  This worked by keeping a counter and printing
new damage strings into monsters[5].m_stats.s_dmg, which is the
"prototype" of that particular monster.

Each individual monster has its own damage string.  Apparently these
were once char *, pointing to the same string as the prototype.  When
the s_dmg member was changed to be an internal char array, changing the
prototype's damage string no longer had any effect on actual monsters.

As a result, flytraps did no damage on a hit, or only one point in V5.
The mechanism for doing damage on a miss continued to work.

This has been fixed by overwriting the individual monster's damage
string instead of the prototype's.  It is now no longer necessary to
reset the damage string when the flytrap is killed.  The method for
resetting it when the hero teleports away had to be modified.  Comments
referencing the long-unused xstr have been removed.
2016-05-01 19:39:56 -04:00
John "Elwin" Edwards
718c807339 Rogue V4, V5: fix messages when viewing the identified items.
The functions for displaying the list of identified items begin by
prompting for the category of item, using msg().  Rogue V4 left this
prompt on the screen after displaying the discovery list.  Rogue V5
erased the message window even if the process of printing the list
created another message which the player had not read.

Messages are now cleared in endline(), which is capable of checking
whether clearing should be done.
2016-04-24 13:33:17 -04:00
John "Elwin" Edwards
e30aa0e491 Makefiles: don't rely on built-in implicit rules.
Not all make implementations will use CPPFLAGS when compiling C files.
2016-03-08 19:45:41 -05:00
John "Elwin" Edwards
5738b681d8 Rogue V5: prevent error messages from 'make clean'.
Using 'rm -f' will not cause an error if the file to be removed is
already gone.
2016-03-06 17:03:47 -05:00
John "Elwin" Edwards
6dfde944f0 Rogue V4, V5: disable a cheat granting permanent monster detection.
In these two games, a potion of monster detection turns on the player's
SEEMONST flag.  A fuse is set to call turn_see() to turn the flag back
off.  But the save and restore functions do not recognize turn_see() and
fail to set the fuse up again.

When restoring, Rogue V4 merely sets the fuse's function to NULL and
leaves it burning.  When it goes off, a segfault results.  Rogue V5
clears all the fuse's fields, and the player retains the ability to see
all monsters on the level.

The save and restore code can now handle the fuse.  The function used is
a new wrapper, turn_see_off(), which should lead to less problems with
daemons being multiple incompatible types.

Also, Rogue V4 and Super-Rogue now properly clear unrecognized daemon
and fuse slots when restoring a saved game.
2016-03-05 12:10:20 -05:00
John "Elwin" Edwards
8bf09d3064 Merge the GCC5 and build fix branches. 2016-03-02 21:28:34 -05:00
John "Elwin" Edwards
f5c2898524 Makefile fixes related to installation.
'make install' and 'make uninstall' should now work correctly, placing
the documentation in the proper places.  Any directories needed will be
created.
2016-02-26 17:30:30 -05:00
John "Elwin" Edwards
c6f7d67623 Generate text documentation from the troff source files.
This is done by make, in the 'docs' target, which is now part of the
normal build process.

Unfortunately, not all the games include troff sources.  Getting decent
HTML output from groff is still a difficult process which will not be
attempted at this time.  There are a few bugs in the 'install' and
'uninstall' rules.

Not to mention that the documentation is sometimes inaccurate.
2016-02-21 20:47:12 -05:00
John "Elwin" Edwards
c4365554c4 Rogue V5: remove troublesome automatic platform detection.
configure.ac used AC_CANONICAL_SYSTEM to guess the GNU system
description triplets.  The target description was substituted into the
Makefile and formatted into the filename for the binary distribution
tarball.  But 'target' is only intended for cross-compilers.  'host_os'
might have been a better choice.

The tarball filename can still be changed manually, by running make with
an argument of 'DESTSYS=systemname'.

Cross-compiling may be more difficult now, but I am not certain that it
worked properly previously, and due to pending autoconf changes, it was
likely to break anyway.

The top-level config.guess and config.sub are no longer needed, but they
may reappear if better support for cross-compilation is added.
2016-02-12 14:25:47 -05:00
John "Elwin" Edwards
384386d71c rogue3, rogue5: fix all GCC5 warnings.
GCC5 enables more warnings by default, including pre-ANSI implicit
function definitions.  These two games now build cleanly, but the others
will require more effort.
2016-01-23 09:35:14 -05:00
John "Elwin" Edwards
b937606ef8 rogue5: fix 'make install'.
The location of install-sh was hardcoded, so installation has not worked
since that script was moved to the top directory in 78ca6502.
2016-01-22 21:16:54 -05:00
John "Elwin" Edwards
d20fe81e22 Update the Visual Studio project files.
These files were produced by Visual Studio 2015 on Windows 8.1.
2015-08-18 13:23:56 -04:00
John "Elwin" Edwards
3c792f4898 Move some autotools files to where configure can find them.
rogue5 uses config.guess and config.sub to find the canonical system
names.  The configure script expects them to be in the same directory
as install-sh.  So they have been relocated to the top level.

This is a quick and dirty fix.  The eventual plan is to relocate them
to /dev/null.

I also suspect they should be used to set HOST, not TARGET.  Rogue is
not a cross-compiler.
2015-06-16 11:44:49 -04:00
John "Elwin" Edwards
5d0e3dd646 Don't swap signal handlers in md_shellescape().
md_shellescape() sets SIGINT and SIGQUIT to be ignored, storing the
previous handlers, and restores them after the shell exits.  But it
mixed up the two handlers.

Since the signals were usually handled by the same function, this fix
doesn't have much effect, but anything that makes signal code less
confusing is a good thing.
2015-06-08 10:01:25 -04:00
John "Elwin" Edwards
6ab6c944fb Only include one copy of the install-sh script. 2015-06-05 18:02:17 -04:00
John "Elwin" Edwards
321e437f47 Fix a typo in configure.ac.
'test' had been misspelled 'text', and the error had propagated to all
seven games.
2015-06-04 14:48:25 -04:00
John "Elwin" Edwards
6af92da76a rogue5: ignore the file name stored in the save file.
state.c had put file_name into the save file.  The saved value was used
to overwrite file_name on restore.  If the save file had been renamed,
unlink(file_name) would then fail, because file_name held the old name.

To avoid breaking savefile compatibility, file_name is still saved, but
it is read back into a temporary buffer and then ignored.

I thought I fixed this already.
2015-01-16 13:42:30 -05:00
John "Elwin" Edwards
9dc4559375 rogue5: save the game when SIGHUP is received.
This vital feature was turned off by default, requiring DUMP to be
defined to turn it on.  DUMP has the opposite effect in the other
games.
2014-04-26 08:52:26 -07:00
John "Elwin" Edwards
9a8022c683 Makefiles: don't set defaults for CFLAGS.
CFLAGS is now empty by default.  If its value must be set, it should be
done in the command line for make.
2014-03-29 09:45:33 -07:00
John "Elwin" Edwards
67ec840c3c Don't truncate player name in savefile name or log message.
The player name is stored in whoami[], which is length 80 in most games
(1024 in rogue5).  Only the first 10 chars were used to create
file_name, because that buffer is the same length.  Increasing the size
of file_name to 256 permits using all of whoami.

The name is also no longer truncated to 20 chars when writing the log.

All games should now be able to handle 79-character names without
collisions.  Anything more would break save compatibility.
2014-03-23 21:27:14 -07:00
John "Elwin" Edwards
082cd54126 Fix some terribly depressing corruption during restore.
In rogue5/state.c, rs_read_daemons() zeroes out the argument and delay
if the daemon slot is empty.  Unfortunately that code ended up on the
wrong side of the brace that closes the for loop, so instead of running
after each daemon, it got run once after the loop exited, when the
index was of course out of bounds.

This tended to manifest, when compiled with -O2, by overwriting hw and
setting it to NULL.  When inventory() next ran, hw would be passed to
wgetch(), which returns ERR when it gets a NULL argument.  This made
md_readchar() think something was wrong and autosave the game.

Upon investigation, rogue3 was found to commit the same mistake.
rogue4 and srogue don't zero the data.  arogue5 already does it
properly.

Someday I am going to run all this through Valgrind.  Someday when I
am a kinder person who will not be driven to invoke hordes of trolls
and centaurs upon the original authors.
2014-01-08 16:44:16 -05:00
John "Elwin" Edwards
36769ea3e4 Add config.h to the list of headers in the Makefiles.
Some .o files need to be rebuilt if config.h changes.  Adding it to the
list of headers may still fail to solve the problem, because some of
the Makefiles use implicit rules or do not list dependencies properly.
2013-09-03 14:14:48 -07:00
John "Elwin" Edwards
9506edfdc4 Fix some 'test' failures when running 'make install'.
When shell variables are unexpectedly empty, 'test' gets the wrong
number of arguments and becomes unhappy.  Logical AND should not be
done with 'test EXPR1 -a EXPR2' in such cases, because 'test' logic
does not short-circuit.  Replace with 'test EXPR1 && test EXPR2'.
Shell logic does short-circuit, and if the first test invocation
fails, the second will never occur, and will never encounter missing
arguments.
2013-08-27 22:54:28 -07:00
John "Elwin" Edwards
5a25cd89da rogue[345]: fix backspace key in prompts.
md_readchar() mapped KEY_BACKSPACE to CTRL-H, but get_str(), which
handles prompts for strings, only backs up when it receives the erase
character.  The key should be mapped to md_erasechar().

This fixes Red Hat Bugzilla #847852.
2013-08-27 09:25:30 -07:00
John "Elwin" Edwards
fef5939ab1 Don't set DESTDIR via configure.
DESTDIR ought to be set via option passed to 'make install'.
2013-08-26 19:58:44 -07:00
John "Elwin" Edwards
0e8809de2b Don't set the player's ISRUN flag.
rogue4 and rogue5 set the player's ISRUN flag upon exit from sleep or
holding.  This is apparently supposed to indicate that the player can
move again.  What it actually does is make it harder for monsters to
hit the player, until the flag is reset.

As this behavior makes little sense and seems like a cheat, it has
been deemed a bug and removed.
2013-08-13 09:19:56 -07:00
John "Elwin" Edwards
e375c8bd05 Properly handle invalid room references in savefiles.
In all games, rs_write_room_reference() stored -1 for a nonexistent
room, but rs_read_room_reference() did not check for out-of-bounds
values, leading to pointers to rooms[-1], which sometimes caused
crashes.  rs_read_room_reference() has now been modified to use NULL
instead.

Some of the games required further changes to replace NULL with the
pointer to the actual room.  Others are capable of handling NULL for
objects not in any room.
2013-08-08 12:41:35 -07:00
John "Elwin" Edwards
75f5abe998 Improve support for keypad 5. 2011-10-28 16:00:05 +00:00
John "Elwin" Edwards
955892f163 rogue5: improve defaults for SAVEDIR. 2011-10-14 16:31:58 +00:00
John "Elwin" Edwards
a59d5df42b rogue5: make sure SAVEDIR is a directory. 2011-10-10 20:57:51 +00:00
John "Elwin" Edwards
a54b3789c4 rogue5: SAVEDIR off by default, remove generated files from version control. 2011-10-10 15:11:07 +00:00
John "Elwin" Edwards
2f9a559716 rogue5: DESTDIR is not needed in config.h. 2011-10-07 22:26:51 +00:00
John "Elwin" Edwards
b5102d4a76 rogue5: Add chroot support to the autotools system. 2011-10-07 21:19:14 +00:00
John "Elwin" Edwards
86578e0943 rogue5: Clear encerror so scoreboard writing works. 2011-10-07 06:15:48 +00:00
John "Elwin" Edwards
1d8ea533bd Make sure the score list appears in all situations. 2010-12-07 16:46:07 +00:00
John "Elwin" Edwards
00669593bd rogue5: remove some NULLs. 2010-06-15 20:49:22 +00:00