summaryrefslogtreecommitdiff
path: root/src/hexen
AgeCommit message (Collapse)Author
2015-05-08warnings: fix "iteration XY invokes undefined behavior" warningsFabian Greffrath
These were caused by loops which caused overflow of variables of type angle_t (= unsigned) by multiplication with iterators of typed int in angle calculations. Changing the type of the iterator variables to "unsigned int" prevents the undefined behavior.
2015-05-05hexen: Don't show v1.0 message for demo version.Simon Howard
The Hexen demo IWAD is "detected" as v1.0 because it's missing the same lumps that the commercial v1.0 IWAD is missing, but we don't want to show the warning message if we're playing the demo; it is supported.
2015-05-05hexen: Show a startup warning if using v1.0 IWAD.Simon Howard
The Hexen v1.0 IWAD file differs too much from the v1.1 IWAD file and can't be reasonably supported by us. Show a warning message on startup if the user appears to be trying to play using the v1.0 IWAD file. This fixes #537.
2015-05-05warnings: fix "address of array .. will always evaluate to 'true'"Fabian Greffrath
Remove a redundant check from an ORer condition. Unlike in Doom, in Hexen the player->message element is not a pointer, but a char[80] array. Its address will never be NULL and thus will never get interpreted as "false". Hence, the check for "!player->message" will never be "true" and a check for "|| false)" is a no-op. Thanks to @edward-san for finding this with clang-3.6!
2015-05-05warnings: fix "value computed is not used" warningsFabian Greffrath
This fixes warnings that are caused by calling GET_LONG without using its return value, e.g.: sv_save.c: In function ‘StreamIn_player_t’: ../../src/i_swap.h:34:20: warning: value computed is not used [-Wunused-value] #define LONG(x) ((signed int) SDL_SwapLE32(x)) ^ sv_save.c:33:18: note: in expansion of macro ‘LONG’ #define GET_LONG LONG(*SavePtr.l++) ^ sv_save.c:349:5: note: in expansion of macro ‘GET_LONG’ GET_LONG; ^ Introducing a "long dummy" variable and calling "dummy = GET_LONG" does not help, because this provokes another warning, rightfully so: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:346:10: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable] long dummy; Assigning the return value directly to the struct field results in: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:349:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion] str->mo = GET_LONG; Adding the cast to "(void *)" results in: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:349:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] str->mo = (void *) GET_LONG; Adding the intermediate cast to "(intptr_t)" finally silences the compiler. Phew!
2015-05-01Perform case-insensitive check for .lmp extension.Simon Howard
When using the -playdemo parameter, we support a convenience feature where the .lmp extension is not appended if it is already part of the filename. This makes tab completion much nicer. But if the .lmp file has a filename that is in all-caps (.LMP) we were still appending the extension because the check was case sensitive. Change the check to be case insensitive. This fixes #501 (thanks Ioan Chera).
2015-04-26Don't read currentthinker->next after Z_Free().Simon Howard
Save the next pointer in the P_RunThinkers() loop when iterating through thinkers, so that if the current thinker is freed we can still advance to the next thinker without dereferencing freed memory.
2015-04-26hexen: Remove m_misc.c.Simon Howard
This file is empty and contains no code, as it was factored out into the common m_misc.c during raven-branch development. The Heretic version got removed once it was empty but the Hexen one wasn't, for some reason.
2015-04-13Fix assigning structs not compiling on Visual StudioFabian Greffrath
2015-03-30Merge pull request #523 from chocolate-doom/hexndemoFabian Greffrath
Add support for the Hexen 4 Level Demo Version
2015-03-30The 4-Level Demo Version also has 3 Info pagesFabian Greffrath
2015-03-30Turn maxplayers into a global variableFabian Greffrath
... and decrease its value from MAXPLAYERS (i.e. 8) to 4 if (gamemode == shareware). It seems that it was hard-coded to this value until some time between the releases of the Demo and the Full version. Arrays are still declared with their full width of 8, though, they are just not iterated over the whole range anymore. This fixes playback of the IWAD demos.
2015-03-27Remove old DOS source files.Simon Howard
These are leftover files that were kept around for posterity in the heretic/ and hexen/ directories, that contained system-specific DOS code used in the DOS versions of the games. There's no real reason to keep these files around any more and it's confusing having them around: some people who have tried to compile the code have mistakenly tried to include these files in compilation.
2015-03-26Merge branch 'master' of https://github.com/chocolate-doom/chocolate-doom ↵Fabian Greffrath
into hexndemo
2015-03-23play sound when trying to enter a forbidden map in the demo versionFabian Greffrath
2015-03-23maintain an explicit switch list for the demo versionFabian Greffrath
instead of interating through the list for the full version and letting missing texture lumps slip through.
2015-02-23Switch pick-up messages for Chaos Device and Disc of RepulsionFabian Greffrath
For bug compatibility with the original 4-level Demo. Confirmed on map04 with the Demo version with the following md5sums: 458d3ff08d32fc50abb55a5b68660b6b HEXEN.EXE 876a5a44c7b68f04b3bb9bc7a5bd69d6 HEXEN.WAD
2015-02-20Refactor config file API.Simon Howard
The config file API previously relied on binding config variables using M_BindVariable() which took a void pointer. It occurred to me that if used on a boolean variable, this would be erroneous, but the void pointer would make it impossible to tell. Split this into separate M_Bind{Foo}Variable() functions based on type, which allows for proper type checking on the pointers that are passed. Vaguely related to #509.
2015-02-20Fix game code that makes false boolean assumptions.Simon Howard
Various bits of code assume that booleans are represented as 32-bit ints and that they can be assigned to from 32-bit values. This isn't true on all systems; fix code that does this to convert to boolean values properly. This is more progress towards fixing #509.
2015-02-19Apparently, the Hexen font only has upper-case chcractersFabian Greffrath
2015-02-13Identify the "shareware" version early on.Fabian Greffrath
Following the concept of Chocolate Doom, D_IdentifyVersion and D_SetGameDescription are introduced and called right after loading the IWAD. The first one checks for the characteristics of the "shareware" IWAD and sets gamemode accordingly, whereas the latter sets the gamedescription string according to gamemode. This string is then used in I_PrintStartupBanner() and I_SetWindowTitle(). So, the "shareware" version identifies itself properly now. I consider support for the 4 Level Hexen Demo pretty complete by now.
2015-02-02currently, no separate startup banner for the demo version :(Fabian Greffrath
2015-02-02adapt cheat codes for the demo versionFabian Greffrath
2015-02-02set the max_players limit in network games to 4 in shareware modeFabian Greffrath
2015-01-20Merge branch 'master' of https://github.com/chocolate-doom/chocolate-doom ↵Fabian Greffrath
into hexndemo
2015-01-20First shot at support for the Hexen 4-level DemoFabian Greffrath
With these changes it is possible to run the game using the HEXEN.WAD IWAD from the 4-level Demo and start a new game as one of the three player classes. Known missing bits: - The game does not yet identify itself as the demo version - The cheat codes are still unchanged - Bug compatibility, see e.g. http://dengine.net/dew/index.php?title=Libhexen
2015-01-19Add extra checks to weapon cycling loops.Simon Howard
Ensure that the loops to find the next weapon always terminate - even if there are somehow no weapons equipped. Also, only ever do weapon cycling when in the GS_LEVEL gamestate. This fixes #503 - thanks to Fabian and raithe on Doomworld.
2014-12-26allow building in subdirectory or outside source directoryDave Murphy
2014-12-18fix some more endianess issues with the width fields in patch_t structsFabian Greffrath
as pointed out necessary by Ronald Lasmanowicz for his Wii ports
2014-12-18fix a bug that causes monsters to become partly invisibleFabian Greffrath
when walking inside liquids like water -- on big-endian systems Originally reported by Ronald Lasmanowicz and fixed in his wii-hexen port: https://code.google.com/p/wii-hexen/source/detail?r=17
2014-11-27hexen: audit calls to P_StartACS().Simon Howard
Scripts can have a maximum of three arguments when started (see ACS_Execute / #80 linedef special type). This means that the array of arguments passed must be at least three elements in length. When loading scripts, check the argument count never exceeds 3, and print a warning message if it does. Don't pass pointers to structure members implicitly treating them as elements of an array (as this relies on compiler-dependent behavior as to how structure members are laid out). Instead, copy values into a temporary array to make the intended behavior explicit. This fixes #477. Thanks to Quasar for reporting it.
2014-11-27hexen: Store minotaur start time as little endian.Simon Howard
The minotaur uses the first four bytes of the mobj_t args[] array to store its spawn time; after a certain amount of time has passed the minotaur self-destructs. But the level time was being copied from the leveltime variable without any endian conversion taking place. For compatibility with Vanilla Hexen savegames we need to store the start time in little endian format. This fixes the first issue noted in #477 (thanks Quasar).
2014-11-26hexen: Fix incorrect size on M_StringCopy().Simon Howard
The size parameter for the destination buffer used for this string copy was one character too short, the result being that patch lump names using the maximum length (8 characters) were having the last character cropped off. This in turn caused problems with custom WADs that added new textures with names like these: the game would exit on startup with a message like: R_InitTextures: Missing patch in texture SKY3GOLD Amazingly this bug was not noticed because most of the patches in the Hexen IWAD file have short names of 7 characters or less. The only exception I noticed was SKYWALL2 which maps to SKYWALL, another patch, hiding the bug. Thanks to ETTiNGRiNDER for reporting this bug to me and for providing me with a private copy of his in-development PWAD that I could use to find the problem.
2014-10-01hexen: Add workaround for Mac Hexen IWAD.Simon Howard
The Mac version of hexen.wad is slightly different from the normal DOS one: it contains a bunch of extra lumps but more importantly, the GENMIDI and DMXGUS lumps are missing. This means that Chocolate Hexen would crash on startup with the default settings (as OPL is the default music output). To work around this problem and allow the game to start up properly, detect if the required lump is missing and adjust the music settings, printing a helpful message to stdout to inform the user.
2014-05-10hexen: Fix desync of demo1 on some platforms/compilersalexey.lysiuk
Official release of Hexen's source code relies on unspecified behavior the in order of function's argument evaluation, see ISO-IEC 9899-1999, [6.5.2.2.10] P_Random() are called in different parameters of P_SpawnMobj() within A_LeafSpawn()
2014-05-05Clean up file headers.Simon Howard
This change rewrites and simplifies the copyright headers at the top of all source files: * Remove "Emacs style mode select" line; this line was included in the headers for the originally released source files and appears to be to set the file type for old versions of Emacs. I'm not sure entirely why it was required but I don't think it is any more. * Remove "You should have received a copy of..." text from copyright header. This refers to the old 59 Temple Place address where the FSF headquarters used to be located and is no longer correct. Rather than change to the new address, just remove the paragraph as it is superfluous anyway. This fixes #311. * Remove ---- separator lines so that the file headers are barer and more simplified.
2014-04-29hexen: Fix joystick strafe left/right buttons.Simon Howard
Hexen was missing the code to handle the strafe left/right buttons.
2014-04-27music: Add loop point Ogg/Flac metadata support.Simon Howard
ZDoom has defined a format for Vorbis metadata comments named LOOP_START and LOOP_END that allow the start and end points to be defined in .ogg and .flac files for looping music. Add support for these (they are used in Brandon Blume's SC-55 recordings).
2014-04-19Exit with error on startup if using the wrong IWAD.Simon Howard
Having multiple binaries can cause some confusion - some users try to run chocolate-doom with hexen.wad, thinking it is supported. Add a startup check that makes sure the user is not trying to start the game using the wrong IWAD file for the binary being run. This fixes #382.
2014-04-19joystick: Add joystick button to toggle menu.Simon Howard
When using a joystick or gamepad it's nice to be able to bring up the menu without having to reach for the keyboard. This makes modern gamepads more useful/usable.
2014-04-19joystick: Add an axis to allow strafing.Simon Howard
Modern gamepads typically have 2-3 D-pads and joysticks. This means that it's desirable to be able to use one joystick for turning and another for strafing. Add another axis in addition to the current X and y axes that performs strafe movement.
2014-04-01Replace all snprintf() calls with M_snprintf().Simon Howard
The Windows API has an _snprintf function that is not the same as Unix's snprintf(): if the string is truncated then no trailing NUL character is appended. This makes the function unsafe. Define a replacement/wrapper called M_snprintf that works the same but always appends a trailing NUL, for safety on Windows and other OSes that behave like this. Do the same thing for vsnprintf(), and update HACKING to list snprintf/vsnprintf as forbidden functions. This fixes #375; thanks to Quasar for pointing out the different behavior of these functions.
2014-03-30hexen: Eliminate use of sprintf().Simon Howard
Use snprintf() in place of sprintf(). This is part of fixing #371.
2014-03-30hexen: Make -playdemo cope with paths.Simon Howard
Vanilla Hexen makes you specify the demo name to play by giving the plain lump name, eg. heretic -playdemo mydemo to load mydemo.lmp. It doesn't work if you specify the extension or the full file path. As a convenience and to match the behavior of Chocolate Doom, allow paths and extensions. Also rework the code for other games so that they're slightly more consistent. This fixes #301.
2014-03-29misc: Make arguments to string functions const.Simon Howard
Where a pointer is to a buffer that does not need to be mutable for the operation of the function, use const char * instead. This avoids some type errors where constant string are passed.
2014-03-29heretic: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-27hexen: Allow abort on startup by pressing escape.Simon Howard
Vanilla Hexen allows the game startup to be aborted by pressing the escape key. This can also be used to abort netgame startup. Add back this functionality by polling the SDL event loop; this feature only works if the graphical startup is enabled, but that's good enough.
2014-03-24Fix various Clang compiler warnings.Simon Howard
2014-03-23Rearrange order of SDL sound startup.Simon Howard
Initialize low-level sound startup (calls to I_InitSound) separately from the high-level sound startup (S_Init). In particular, make sure that SDL sound is initialized before the textscreen multiplayer waiting screen is shown. This is an attempt to fix a bug with sound in multiplayer games on Windows; calling SDL_QuitSubSystem(SDL_INIT_VIDEO) (on closedown of the textscreen library) causes subsequent attempts to initialize audio to fail. Big thanks go to Alexandre-Xavier (AXDOOMER) for working out a fix for this bug and James Haley (Quasar) for giving some technical background about the lack of separation between SDL subsystems. This (hopefully) fixes #270.
2014-03-23Set default for key_menu_screenshot to 0.Simon Howard
In #364 I recommended -1 as the default to avoid taking screenshots in some situations where a key event is posted for key 0. It turns out that wasn't such a great idea, as -1 is not parsed properly by the config parser, and is shown as ??-1 in the setup tool. Default to zero instead, and add guards to prevent screenshots being taken by mistake. Thanks to Alexandre-Xavier for pointing this out.