Commit Graph

247 Commits

Author SHA1 Message Date
Randy Heit a5b118cf7c - The reorganized DirectInput game controller code finally compiles. (Ugh! It
took far too long to reach this point.) Manual axis configuration is
  currently disabled, since I need to rewrite that, too. The eventual point of
  this is that the code will be modular enough that I can just plop in
  routines for XInput controllers and driver-less PlayStation 2 adapters
  without much fuss, since the old joystick code was very much DirectInput-
  centric.


SVN r1672 (trunk)
2009-06-20 03:16:08 +00:00
Randy Heit 8d83d3791d - Added tagRAWINPUT declaration to i_input.h for support of older Windows SDKs.
SVN r1666 (trunk)
2009-06-11 22:17:50 +00:00
Randy Heit deff9cfb12 - Moved Raw Input processing into a seperate method of FInputDevice so that
all the devices can share the same setup code.


SVN r1664 (trunk)
2009-06-11 03:41:24 +00:00
Christoph Oelckers 4fcd64d2c1 - Fixed: I_ShutdownInput must NULL all pointers because it can be called twice
if an ENDOOM screen is displayed.



SVN r1660 (trunk)
2009-06-09 07:57:21 +00:00
Randy Heit 9493b5acdd SVN r1653 (trunk) 2009-06-08 22:55:03 +00:00
Randy Heit bdd3188897 - Added support for horizontal mouse wheels, and set invprev/invnext as
default bindings for it. (Only works with Raw Input on XP. Vista has
  support through Win32 mouse, as well. DirectInput does not support it at
  all, because the DirectInput mouse device does not expose this control.)


SVN r1640 (trunk)
2009-06-06 02:55:58 +00:00
Randy Heit 7df2d40e8f - Added a label for the F16 key and mapped the kp= key on a Mac keyboard to
the PC98 equivalent so it would be recognized as kp=. (Interestingly, F13-
  F16 and kp= only generate events when using Raw Input, not when using
  DirectInput.


SVN r1639 (trunk)
2009-06-06 02:06:38 +00:00
Randy Heit a8de4fc2da - Fixed compilation of i_keyboard.cpp with MinGW, because w32api still doesn't have
everything that was new for XP.
- Swapped snes_spc out for the full Game Music Emu library.

SVN r1631 (trunk)
2009-06-03 03:05:02 +00:00
Randy Heit 092512c44a - Fixed: The mouse wheel generated no events in GUI mode if you weren't
fullscreen. (e.g. You could no longer scroll the console with the mouse
  buffer.)
- Fixed: Wheeling down was seen as wheeling up with the Win32 mouse.


SVN r1618 (trunk)
2009-05-27 22:57:21 +00:00
Randy Heit 12959a1bd1 - EV_GUI_Key(Down|Up|Repeat) events no longer provide shifted key codes
in data2. This was just unnecessary overhead that wasn't really needed
  anywhere.
- Moved GUI-mode input into a separate function to make the code easier to
  read.


SVN r1617 (trunk)
2009-05-27 22:17:11 +00:00
Randy Heit a925f7eab6 - Removed HaveFocus variable in preference of using GetForegroundWindow().
SVN r1616 (trunk)
2009-05-27 21:11:06 +00:00
Randy Heit 3f3d677526 - Removed spurious WM_INPUT from the main WndProc.
SVN r1615 (trunk)
2009-05-27 21:05:19 +00:00
Randy Heit a11073341c - Added Raw Input keyboard handling.
SVN r1614 (trunk)
2009-05-27 20:44:54 +00:00
Randy Heit 7fea07dff7 - Split DirectInput keyboard handling into a separate file and class. I also
switched it to buffered input, and the pause key seems to be properly
  cooked, so I don't need to look for it with WM_KEYDOWN/UP. Tab doesn't
  need to be special-cased either, because buffered input never passes on
  the Tab key when you press Alt+Tab. I have no idea why I special-cased
  Num Lock, but it seems to be working fine. By setting the exclusive mode
  to background, I can also avoid special code for releasing all keys when
  the window loses focus, because I'll still receive those events while the
  window is in the background.


SVN r1613 (trunk)
2009-05-27 03:16:46 +00:00
Randy Heit 0a310b9832 - Fixed compilation on MinGW.
SVN r1612 (trunk)
2009-05-26 22:33:02 +00:00
Randy Heit 5245e8d4dd - I_CheckNativeMouse() now checks the foreground window to determine if the
mouse should be grabbed. This fixes the case where you start the game in
  the background and it grabs the mouse anyway.
- Changed raw mouse grabbing to call ShowCursor() directly instead of through
  SetCursorState(), since changing the pointer isn't working with it
  (probably due to the lack of legacy mouse messages), and the others work
  fine by setting an invisible cursor.
- Fixed: Raw mouse input passes wheel movements in an unsigned field, but the
  value is signed, so it requires a cast to use it.
- Reverted accidental changes to src/sdl/i_input.cpp.

SVN r1605 (trunk)
2009-05-26 00:30:51 +00:00
Christoph Oelckers dbddb6403f - added #define _WIN32_WINNT 0x0501 to i_mouse.cpp so that the file compiles with the Windows 2003 Server SDK.
SVN r1603 (trunk)
2009-05-24 08:57:58 +00:00
Randy Heit 0c4c90ac89 - SetCursorState() now calls ShowCursor() again, because capturing the mouse
with RIDEV_NOLEGACY apparently prevents SetCursor() from doing anything.
- Split mouse code off from i_input.cpp into i_mouse.cpp and added raw mouse
  handling. (WM_INPUT obsoleted most of DirectInput for XP.)
- Fixed: Similar to the Win32 mouse, using the DirectInput mouse in windowed
  mode, if you alt-tabbed away and then clicked on the window's title bar,
  mouse input would be frozen until the mouse was ungrabbed again.


SVN r1601 (trunk)
2009-05-24 03:15:04 +00:00
Randy Heit 466b6e4535 - Moved SetSoundPaused() out of i_input.cpp and into s_sound.cpp.
SVN r1598 (trunk)
2009-05-23 03:09:50 +00:00
Randy Heit 86023c23ca - Fixed: When using Win32 mouse, windowed mode, alt-tabbing away and then
clicking on the window's title bar moved it practically off the screen.
- Beginnings of i_input.cpp rewrite: Win32 and DirectInput mouse handling has
  been moved into classes.


SVN r1597 (trunk)
2009-05-23 02:22:30 +00:00
Randy Heit 749de6c156 - Fixed: SetSoundPaused() still needs to call S_PauseSound() to pause music
that isn't piped through the digital sound system. (Was removed in r1004.)


SVN r1595 (trunk)
2009-05-20 02:52:07 +00:00
Christoph Oelckers a732687548 - Changed APlayerPawn::DamageFade to a PalEntry from 3 floats.
- Removed #pragma warnings from cmdlib.h and fixed the places where they were 
  still triggered.
  These #pragmas were responsible for >90% of the GCC warnings that were not
  listed in VC++.
- Fixed one bug in the process: DSeqNode::m_Atten was never adjusted when the
  parameter handling of the sound functions for attenuation was changed.
  Changed m_Atten to a float and fixed the SNDSEQ parser to set proper values. 
  Also added the option to specify attenuation with direct values in addition 
  to the predefined names.

SVN r1583 (trunk)
2009-05-15 10:39:40 +00:00
Christoph Oelckers a908834a11 - added some default definitions for constants that may miss in some headers.
- replaced __va_copy with va_copy per Chris's suggestion.
- replaced #include <malloc.h> with #include <stdlib.h> where possible.


SVN r1524 (trunk)
2009-04-07 07:06:07 +00:00
Randy Heit 7371c4a516 - Changed random seed initialization so that it uses the system's
cryptographically secure random number generator, if available, instead
  of the current time.
- Changed the random number generator from Lee Killough's algorithm to the
  SFMT607 variant of the Mersenne Twister.

SVN r1507 (trunk)
2009-03-27 04:49:17 +00:00
Randy Heit cfbf55acab - -norun works without -stdout now.
SVN r1487 (trunk)
2009-03-19 02:12:24 +00:00
Randy Heit c2aab5dd46 - Added the -norun parameter to quit the game just before video
initialization. To be used to check for errors in scripts without actually
  running the game.
- Added the -stdout parameter to the Windows version to send all output to
  a console, like the Linux version has done all along.


SVN r1486 (trunk)
2009-03-18 05:02:32 +00:00
Randy Heit 75b7db858f - Added support for zip/pk3 files with LZMA and bzip2 compression to ZDoom.
- Added more output to zipdir and a -q option to turn it off.
- Added -u option to zipdir to only recompress those files in a zip that have
  changed. 
- Added -d and -f options to zipdir. -d forces deflate compression, and -f
  forces a write of the zip, even if it's newer than all the files it contains.
- Added support for bzip2 and LZMA compression to zipdir.


SVN r1468 (trunk)
2009-03-10 23:07:37 +00:00
Randy Heit 5eeaa130fd - Went back to using RDTSC for timing on Win32. Ironically,
QueryPerformanceCounter() is obviously using the TSC for its timing on my
  machine, yet the overhead it has to do to keep the timer sane is apparently
  noticeable on a few maps. I suppose I should at some time check
  clock_gettime() and see if it has similar issues on Linux.


SVN r1460 (trunk)
2009-03-04 06:06:31 +00:00
Randy Heit 491abe3a2c - Fixed: DirectInput8Create() used the wrong calling convention.
SVN r1426 (trunk)
2009-02-19 23:12:48 +00:00
Christoph Oelckers 666e40c8bb - Added MF5_CANTSEEK flag to prevent seeker missiles from homing in on
certain actors and added an option to APowerInvisibility to set this
  flag when active.
- Added map specific automap backgrounds.
- Fixed: Voodoo dolls did not play a sound when dying.
- Added colorized error messages to DECORATE and made a few more error
  conditions that do not block further parsing not immediately abort.
- Made all errors in CreateNewActor not immediately fatal so that the
  rest of the DECORATE lump can be parsed normally to look for more errors.
- Fixed: Defining classes with the same name as their immediate base class
  was legal. It should not be allowed that a class has another one with the
  same name in its ancestry.
- Fixed: Formatting of the intermission screen on Heretic, Hexen and Strife
  was broken. Changed it to use WI_Drawpercent which does it properly and
  also allows showing percentage in these games now.
- Fixed: The MAPINFO parser ignored missing terminating braces of the last
  block in the file.

SVN r1425 (trunk)
2009-02-19 14:36:37 +00:00
Randy Heit 0acc6a4ee3 - Moved the V_InitFontColors() call earlier in the startup sequence so that
colored error messages appear colored in the startup window. Also lightened
  up the "Flat" red to contrast better with the startup background.


SVN r1424 (trunk)
2009-02-11 00:16:05 +00:00
Randy Heit 085be22a30 - Changed I_InitInput() to acquire the IDirectInput8A interface by using
DirectInput8Create() instead of CoCreateInstance(). This allows the Steam
  GameOverlayRenderer.dll to properly hook it.


SVN r1422 (trunk)
2009-02-10 03:12:41 +00:00
Randy Heit 035edb32ad - Stopped sending double the number of wheel events as appropriate to the
console under Linux.
- Added middle mouse button selection pasting for X systems.



SVN r1420 (trunk)
2009-02-10 02:16:41 +00:00
Randy Heit 05a8a49ea5 - Added GUICapture mouse events for Win32.
SVN r1415 (trunk)
2009-02-08 03:45:41 +00:00
Randy Heit 025e36ee41 - Changed I_GetFromClipboard() to return an FString.
SVN r1414 (trunk)
2009-02-08 03:32:27 +00:00
Randy Heit d0e7e574e1 - Added a fflush() call after the logfile write in I_FatalError so that the
error text is visible in the file while the error dialog is displayed.


SVN r1396 (trunk)
2009-02-04 01:23:47 +00:00
Christoph Oelckers 4bcd3faef8 - moved all code related to global ACS variables to p_acs.cpp where it belongs.
- fixed: The nextmap and nextsecret CCMDs need to call G_DeferedInitNew instead of G_InitNew.
- merged MAPINFO branch back into trunk.

SVN r1393 (trunk)
2009-02-03 19:11:43 +00:00
Randy Heit b680840073 - Fixed clipping in D3DFB::DrawTextureV() for good by using a scissor test.
SVN r1386 (trunk)
2009-02-01 03:39:00 +00:00
Randy Heit c09d9f0e20 - Fixed: D3DFB::DrawTextureV() did not properly adjust the texture coordinate
for lclip and rclip.


SVN r1384 (trunk)
2009-01-31 03:46:30 +00:00
Randy Heit 30ef6a0c2d - Game time is now frozen during screen wipes. This obsoletes the DEM_WIPEON
and DEM_WIPEOFF commands. Fixes multimap demos desyncing when played back
  or recorded with wipes enabled, and prevents multiplayer games from
  starting until all players' wipes have finished.


SVN r1272 (trunk)
2008-10-21 02:27:21 +00:00
Randy Heit 738e8ca7ad - GCC warning removal.
* This may or may not be a problem, but GCC warned that FStateDefinitions::
    AddStateDefines() does not initialize def.FStateDefine::DefineFlags, so
    I fixed that.


SVN r1262 (trunk)
2008-10-14 03:21:53 +00:00
Christoph Oelckers 760f70d3f1 - Changed compilation for g_doom, g_heretic, g_hexen and g_strife folders
so that all files are included by a central one instead of compiling 
  each one separately. This speeds up the compilation process by 25%
  when doing a complete rebuild in Visual C.
- Cleaned up more header dependencies.

SVN r1226 (trunk)
2008-09-15 14:11:05 +00:00
Christoph Oelckers b07542ddd6 More header cleanup.
SVN r1225 (trunk)
2008-09-15 00:47:31 +00:00
Christoph Oelckers db5723997c - Cleaned up some include dependencies.
SVN r1224 (trunk)
2008-09-14 23:54:38 +00:00
Randy Heit f08e2949dc - Antialiasing of lines is now controlled solely by the vid_hwaalines cvar,
ignoring what the driver reports, since ATI is apparently just as bad as
  NVidia.


SVN r1212 (trunk)
2008-09-12 00:04:15 +00:00
Randy Heit d22f3ebfa6 - Added a check for D3DLINECAPS_ANTIALIAS, but this is complicated by the
fact that NVidia's don't report it, even though they support it. If there
  are any cards that no longer have antialised lines on the automap, please
  let me know.
- Added vid_hwaalines cvar to force antialiased lines off for the
  Direct3D renderer, in case it doesn't really support them.


SVN r1210 (trunk)
2008-09-10 03:33:02 +00:00
Randy Heit fae19e87b7 - Implemented some more controllers for the OPL player:
* RPN select (controllers 100 and 101)
  *  RPN 0 (pitch bend sensitivity)
  * NPRN select (controllers 98 and 99)
  * Data entry (controllers 6 and 38)
  * All notes off (controller 123)
  * All sounds off (controller 120)
  * Reset controllers (controller 121)


SVN r1195 (trunk)
2008-09-05 02:04:50 +00:00
Christoph Oelckers dbcc246cf3 - Added Blzut3's patch for a real Chex Quest game mode.
SVN r1188 (trunk)
2008-08-30 19:44:19 +00:00
Randy Heit 4d56889483 - Added Win64 support to the crash report generator.
SVN r1184 (trunk)
2008-08-24 04:51:15 +00:00
Christoph Oelckers 5ea4b37373 - Added an Active and Inactive state for monsters.
- Made the speed a parameter to A_RaiseMobj and A_SinkMobj and deleted
  GetRaiseSpeed and GetSinkSpeed.
- Added some remaining DECORATE conversions for Hexen by Karate Chris.


SVN r1144 (trunk)
2008-08-10 11:29:19 +00:00
Randy Heit 9ad93639c5 - Changed Windows to use the performance counter instead of rdtsc.
SVN r1143 (trunk)
2008-08-10 03:56:53 +00:00
Randy Heit ad96225213 - Changed Linux to use clock_gettime for profiling instead of rdtsc. This
avoids potential erroneous results on multicore and variable speed
  processors. Windows will need to be updated accordingly.



SVN r1142 (trunk)
2008-08-10 03:25:08 +00:00
Christoph Oelckers fd2c0b82ef REverted anti-x86.cpp changes.
SVN r1141 (trunk)
2008-08-09 22:46:25 +00:00
Christoph Oelckers ae54e13428 IMPORTANT NOTE: I uncommented some code depending on the missing x86.cpp file to allow this to compile, These changes must be reverted as soon as this file is added (see v_palette.cpp and win32/i_system.cpp.)
- Removed AT_GAME_SET because it's no longer used anywhere.
- Converted the last remaining global classes to DECORATE.
- Fixed: Inventory.PickupFlash requires an class name as parameter not an
  integer. Some Hexen definitions got it wrong.
- Converted Hexen's Pig to DECORATE.
- Replaced the ActorInfo definitions of all internal inventory classes with 
  DECORATE definitions.
- Added option to specify a powerup's duration in second by using a negative
  number.


SVN r1137 (trunk)
2008-08-09 11:35:42 +00:00
Randy Heit dda5ddd3c2 - Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
  modifying code for maximum performance. The additional registers do allow
  for further optimization over the x86 version by allowing all four pixels
  to be in flight at the same time. The end result is that AMD64 ASM is about
  2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
  (For further comparison, AMD64 C and x86 C are practically the same for
  this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
  most likely candidate, but it's not used enough at this point to bother.
  Also, this may or may not work with Linux at the moment, since it doesn't
  have the eh_handler metadata. Win64 is easier, since I just need to
  structure the function prologue and epilogue properly and use some
  assembler directives/macros to automatically generate the metadata. And
  that brings up another point: You need YASM to assemble the AMD64 code,
  because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
  VC++ still throws around unneccessary register moves. GCC seems to be
  pretty close to optimal, requiring only about 2 cycles/color. They're
  both faster than my hand-written MMX routine, so I don't need to feel
  bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
  instructions, and unrolled it once, shaving off about 80 cycles from the
  time required to blend 256 palette entries. Why? Because I tried writing
  a C version of the routine using compiler intrinsics and was appalled by
  all the extra movq's VC++ added to the code. GCC was better, but still
  generated extra instructions. I only wanted a C version because I can't
  use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
  of a pain. (It's a pain because Linux and Windows have different calling
  conventions, and you need to maintain extra metadata for functions.) So,
  the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
  were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
  only for AMD processors, so we must not use it on other architectures, or
  we end up overwriting the L1 cache line size with 0 or some other number
  we don't actually understand.


SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
Randy Heit fb50df2c63 About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.

- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
  FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
  This is so that I can use a series of mysnprintf() calls and advance the
  pointer for each one. Once the pointer goes beyond the end of the buffer,
  the count will go negative, but since it's an unsigned type it will be
  seen as excessively huge instead. This should not be a problem, as there's
  no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
  buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
  FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
  name when given a Hexen map number. This was fine with the old scanner
  code, but only a happy coincidence prevents it from crashing with the new
  code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
  binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
  is probably broken until I get around to booting into Linux again. Niceties
  provided over the existing Makefiles they're replacing:
  * All command-line builds can use the same build system, rather than having
    a separate one for MinGW and another for Linux.
  * Microsoft's NMake tool is supported as a target.
  * Progress meters.
  * Parallel makes work from a fresh checkout without needing to be primed
    first with a single-threaded make.
  * Porting to other architectures should be simplified, whenever that day
    comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
  itself instead of generating an external makefile to do it, since I couldn't
  figure out how to generate a makefile with an external tool and include it
  with a CMake-generated makefile. Where makewad used a master list of files
  to generate the package file, zipdir just zips the entire contents of one or
  more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
  formatting can be entirely independant of the CRT.

SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
Christoph Oelckers d2f1515aa6 - Fixed: When a weapon is destroyed, its sister weapon must also be destroyed.
- Added a check for PUFFGETSOWNER to A_BFGSpray.
- Moved the PUFFGETSOWNER check into P_SpawnPuff and removed the limitation
  to players only.
- Fixed: P_SpawnMapThing still checked FMapThing::flags for the class bits 
  instead of FMapThing::ClassFilter.
- Fixed: A_CustomMissile must not let P_SpawnMissile call P_CheckMissileSpawn.
  It must do this itself after setting the proper owner.
- Fixed: CCMD(give) increased the total item count.
- Fixed: A_Stop didn't set the player specific variables to 0.


SVN r1066 (trunk)
2008-07-05 10:17:10 +00:00
Randy Heit 78890d57bc - Fixed: Screenwipes now pause sounds, since there can be sounds playing
during it.
- UI sounds are now omitted from savegames.
- Fixed: Menu sounds had been restricted to one at a time again.
- Moved the P_SerializeSounds() call to the end of G_SerializeLevel() so that
  it will occur after the players are loaded.
- Added fixes from FreeBSD for 0-length and very large string buffers
  passed to myvsnprintf.


SVN r1063 (trunk)
2008-07-05 03:32:44 +00:00
Randy Heit 0632a35b18 - Rewrote myvsnprintf to use the StringFormat routines directly so that no
additional memory needs to be allocated from the heap.


SVN r1062 (trunk)
2008-07-02 18:08:06 +00:00
Randy Heit 601a6ad04c - Adjusted the noise debug table so that fractional volume levels do not
run into the adjacent columns.
- Added a NullSoundRenderer so that most of the checks against a NULL GSnd
  can be removed.
- Fixed: Looping sounds must always successfully allocate a channel, even if
  it's only a pre-evicted channel.


SVN r1058 (trunk)
2008-07-01 01:28:22 +00:00
Christoph Oelckers 2afac5c716 - Changed: I_Error and I_FatalError now use ZDoom's internal string formatting
code to process their messages. This was necessary to handle the %zu format
  option used in some memory allocation failure messages.
- Fixed: The flat texture scaling action specials were completely broken.


SVN r1056 (trunk)
2008-06-29 08:42:07 +00:00
Randy Heit d0b2c41270 - The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
  have been started until they are explicitly stopped. If they are evicted
  from their channels, the sound code will restart them as soon as possible.
  This means that instead of this:
	if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
	{
		S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
	}
  The following is now just as effective:
	S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
  There are also a couple of other ramifications presented by this change:
    * The full state of the sound system (sans music) is now stored in save
      games. Any sounds that were playing when you saved will still be
      playing when you load. (Try saving while Korax is making a speech in
      Hexen to hear it.)
    * Using snd_reset will also preserve any playing sounds.
    * Movie playback is disabled, probably forever. I did not want to 
      update the MovieDisable/ResumeSound stuff for the new eviction
      tracking code. A properly updated movie player will use the VMR,
      which doesn't need these functions, since it would pipe the sound
      straight through the sound system like everything else, so I decided
      to dump them now, which leaves the movie player in a totally unworkable
      state.

June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
  internal S_StartSound() uses. Now ambient sounds can use the public
  S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
  from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
  interior of the sector making them and not from the entire vertical height
  of the map.


SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
Randy Heit 2e28b0c9ce - Repositioned the declaration of the file string in D_DoomMain() so that it
won't be left on the stack at exit.
- Fixed: PSymbol needs a virtual destructor so that PSymbolActionFunction can
  free its Arguments.
- Symbols for native classes are now freed on exit.


SVN r1022 (trunk)
2008-06-06 02:17:28 +00:00
Christoph Oelckers 29380f70b3 - Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
  same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
  object's position.


SVN r1014 (trunk)
2008-06-02 16:56:53 +00:00
Randy Heit d657e31a8c - Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.


SVN r1005 (trunk)
2008-05-31 02:18:09 +00:00
Randy Heit 5b8055bfc7 - Since KDIZD is the only mapset I know of that used reverb, and it didn't
define any new ones of its own, I'm pre-emptively renaming the SNDEAX lump
  to REVERBS to remove any possible misunderstanding that this is something
  that requires EAX hardware support. (Ideally, it would have been REVERBDEF,
  but that's 10 characters long.) The eaxedit console command has also been
  renamed to reverbedit for the same reason.
- Fixed: The Palette part of FRemapTable was not initialized with alpha values
  other than 0. I'm not sure if it would be better to fix this in the game
  palette that it copies from or not, but right now, they get set
  unconditionally to 255.

SVN r983 (trunk)
2008-05-20 04:02:49 +00:00
Randy Heit 5a066788b5 - Revised underwater effect now uses a lowpass filter in combination with an
optional freeverb unit.
- Removed ResetEnvironment hack, since with software reverb, losing the
  existing reverb when focus is lost isn't a problem.
- Commented out the TiMidity FIXME messages.


SVN r973 (trunk)
2008-05-15 04:51:57 +00:00
Randy Heit 8040cdd4ff - Fixed a copy-and-paste error in win32/i_main.cpp for 64-bit mode.
- Tweaked OPL centering a little.


SVN r950 (trunk)
2008-04-30 00:44:45 +00:00
Randy Heit bc5f49dd49 - Various fixes for compiling working 64-bit binaries with Visual C++. The
number of changes was pleasantly small, and a cursory check seems to show
  everything working alright.


SVN r948 (trunk)
2008-04-29 02:43:42 +00:00
Christoph Oelckers b129ed3948 - Fixed: wbstartstruct's lump name fields were only 8 characters long
and not properly zero-terminated when all 8 characters were used.
- Fixed: Local sound sequence definitions caused a crash because a proper
  NULL check was missing. 

SVN r933 (trunk)
2008-04-23 23:04:00 +00:00
Christoph Oelckers 4667bfe46f - Added translucent blending modes to FMultipatchTexture (not tested yet!)
- Also changed all true color texture creation functions to use proper alpha
  values instead of inverted ones.
- Changed FRemapTable so that all palette entries must contain proper alpha
  values. 
- Fixed: The F1 screen check in m_menu.cpp was missing a NULL pointer check.
- Changed: The boss brain's explosions play weapons/rocklx which is an 
  unlimited sound. This can become extremely loud. Replaced with a new
  sound which is just an alias to weapons/rocklx but has a limit of 4.


SVN r932 (trunk)
2008-04-22 18:48:30 +00:00
Randy Heit b340f9c762 - Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
  failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
  pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.


SVN r904 (trunk)
2008-04-12 05:33:20 +00:00
Randy Heit 10c0d67b78 - Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
  event which only has a 1 in 127 chance of being for a note that's playing
  on that channel. Then I decided it would probably be a good idea to reset
  all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
  (copied from the OPL player) improved its sound dramatically, so apparently
  Timidity has issues with short stream buffers. It's now at 1/2 sec in
  length. However, there seems to be something weird going on with
  corazonazul_ff6boss.mid near the beginning where it stops and immediately
  restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
  oscilloscopes and spectrums.
- Internal TiMidity now plays music.
- Changed the progdir global variable into an FString.

SVN r900 (trunk)
2008-04-11 04:59:23 +00:00
Randy Heit 6535283ff1 - Added the FCriticalSection class in critsec.h to make it easier to
use critical sections in other places besides the OPL player.


SVN r896 (trunk)
2008-04-09 04:17:13 +00:00
Christoph Oelckers 298e465e22 - NULLed screen in CreateFrameBuffer if it's the same as 'old' and gets deleted.
SVN r871 (trunk)
2008-03-30 09:30:34 +00:00
Christoph Oelckers 5e6f709dbf - Changed: When the screen is being deleted the 'screen' variable should be
set to NULL before performing the delete. Otherwise, in some abnormal
  situations, it could happen that the destroyed screen object is still
  being accessed.
- Fixed: V_Shutdown didn't set OF_YesReallyDelete before deleting screen.


SVN r870 (trunk)
2008-03-30 08:58:36 +00:00
Randy Heit 776d89428d - Changed D3DFB to explicitly request double buffering instead of assuming
that the drivers will treat a BackBufferCount of 0 as a request for
  double buffering.
- Fixed: Unsetting a cvar did not remove it from the list of tab
  completions.
- Added "" as a synonym for "nullimage" in SBARINFO.
- Fixed: MAKESAVESIG's stringifier in version.h did not work as expected.
  It stringified the passed macro name, not the value of the macro.
- Moved DCajunMaster off the DObject hierarchy.
- Changed DCajunMaster::getspawned into a TArray of FStrings. It was
  mysteriously being left pointing to uninitialized memory during the
  final GC at exit and crashing.
- Fixed: The code that removed hexdd.wad from the list of IWADs when
  hexen.wad was not present did not work.


SVN r861 (trunk)
2008-03-28 00:38:17 +00:00
Christoph Oelckers 643fc792bd - forgot to save i_main.cpp before comitting.
SVN r860 (trunk)
2008-03-27 23:00:44 +00:00
Randy Heit 8d0c48bf81 - The garbage collector is now run one last time just before exiting the game.
- Removed movie volume from the sound menu and renamed some of the other
  options to give the MIDI device name more room to display itself.
- Moved the midi device selection into the main sound menu.
- Added FMOD as MIDI device -1, to replace the MIDI mapper. This is still the
  default device. By default, it uses exactly the same DLS instruments as the
  Microsoft GS Wavetable Synth. If you have another set DLS level 1 patch set
  you want to use, set the snd_midipatchfile cvar to specify where it should
  load the instruments from.
- Changed the ProduceMIDI function to store its output into a TArray<BYTE>.
  An overloaded version wraps around it to continue to supply file-writing
  support for external Timidity++ usage.
- Added an FMOD credits banner to comply with their non-commercial license.
- Reimplemented the snd_buffersize cvar for the FMOD Ex sound system. Rather
  than a time in ms, this is now the length in samples of the DSP buffer.
  Also added the snd_buffercount cvar to offer complete control over the
  call to FMOD::System::setDSPBufferSize(). Note that with any snd_samplerate
  below about 44kHz, you will need to set snd_buffersize to avoid long
  latencies.
- Reimplemented the snd_output cvar for the FMOD Ex sound system.
- Changed snd_samplerate default to 0. This now means to use the default
  sample rate.
- Made snd_output, snd_output_format, snd_speakermode, snd_resampler, and
  snd_hrtf available through the menu.
- Split the HRTF effect selection into its own cvar: snd_hrtf.
- Removed 96000 Hz option from the menu. It's still available through the
  cvar, if desired.
- Fixed: If Windows sound init failed, retry with DirectSound. (Apparently,
  WASAPI doesn't work with more than two speakers and PCM-Float output at the
  same time.)
- Fixed: Area sounds only played from the front speakers once you got within
  the 2D panning area.


SVN r854 (trunk)
2008-03-26 04:27:07 +00:00
Christoph Oelckers 7e900c1016 - Reverted changes of r715 in v_collection.cpp because they broke loading
of status bar face graphics belonging to skins.
SBARINFO update #15
- Fixed: Monospacing fonts wasn't quite correct.
- Fixed: The new mug shot code forgot to use the first arg of drawmugshot (the
  one that picks the default sprite prefix).
- Added: lowerHealthCap variable to SBarInfo, which is set to true by default.
- Added: ininventory event to SBarInfo to detect if one or two items are in (or
  not in) the player's inventory.
- Added: The ability to print global vars using drawnumber.  I need someone to
  test it though.
- Added: aspectratio command to detect what the user's aspect ratio is.
- Added: missing spacing argument to drawstring.
- Changed the sbarinfo display routine for drawnumber to not use cmd.value to
  store what it is about to display.  Now it uses a new variable.
- More conversions from DrawImage to screen->DrawTexture.  I think only the
  inventory bar drawing functions have to be changed now.



SVN r846 (trunk)
2008-03-24 17:48:55 +00:00
Randy Heit 3720f7fa7d - Fixed: The botinfo field of DCajunMaster was improperly listed as an object
pointer.


SVN r809 (trunk)
2008-03-18 03:01:21 +00:00
Randy Heit f2660dc336 - Merged the GC branch back into the trunk, so now it can receive more
testing from the people who download SVN trunk builds.

SVN r795 (trunk)
2008-03-12 02:56:11 +00:00
Randy Heit 68a8ea2189 - Moved the identical code between the MUS and MIDI streamers into a new base
class so they all the low-level details of MIDI streaming are kept in
  one place.
- Converted the SMF MIDI playback to use the same MIDI streams as MUS
  playback.
- Moved MUS playback back into its own thread so that it can continue
  uninterrupted if the main thread is too busy to service it in a timely
  manner.
- Fixed: The MEVT_* values are not defined shifted into their spot for a
  MIDIEVENT, so I need to do it myself.
- Fixed: Pausing a MUS and the changing snd_midivolume caused the paused
  notes to become audible.


SVN r784 (trunk)
2008-03-05 03:10:31 +00:00
Randy Heit 69cebb7e57 - Changed MUS playback to use MIDI streams, like it did during the early days
of ZDoom, except now the entire song isn't prebuffered in large chunks, so
  I can insert MIDI events into the playback with fairly low latency. This
  should offer more precise timing than the combination of low-level MIDI and
  WaitForSingleObject timeouts.


SVN r783 (trunk)
2008-03-04 06:36:23 +00:00
Randy Heit 0dccb97819 - Fixed: PO_Busy() did not check for a NULL return from GetPolyobj().
- Fixed two problems with printfs from the net controller stuff: one of them
  is totally valid, and the other is GCC not being as nice as VC++.
- Fixed: The case for defining SAVESIG when SVN_REVISION_NUMBER == 0 did not
  work for GCC (and presumably VC++, though I never ran into that case with
  it) because it tried to stringify something that wasn't a macro argument.


SVN r762 (trunk)
2008-02-22 00:20:11 +00:00
Randy Heit f2c9227243 - Added vid_refreshrate cvar to override Windows' automatic refresh rate
selection.


SVN r754 (trunk)
2008-02-19 02:48:56 +00:00
Randy Heit 133350fb9c - Fixed AInventory::PickupFlash setting with GCC.
- Fixed: The MusicVolumes list was allocated with M_Malloc but freed with
  delete.
- Fixed: demobuffer was inconsistantly handled with new[]/delete[] and
  malloc/free.
- Added used memory tracking to M_Malloc() and M_Realloc(). This
  necessitated the addition of an M_Free() call to track frees.
- Removed M_Calloc since it was only used in one place, and can just as well
  be done with an M_Malloc/memset pair.
- Bumped DEMOGAMEVERSION for the new net controller codes.


SVN r751 (trunk)
2008-02-17 02:40:03 +00:00
Randy Heit 0acbbb3a8e - Version bump to 2.2.0.
- Disabled console alpha when the console is fullscreen.
- Re-enabled maybedrawnow for the software renderer. This should be replaced
  with a different progress bar implementation at some point that can work
  with hardware graphics.


SVN r747 (trunk)
2008-02-14 22:58:56 +00:00
Christoph Oelckers b53834a72f - Added Karate Chris's patch for 0-tid == activator in action specials
Thing_SetSpecial and Thing_SetTranslation.
- -moved BUGS_FORUM_URL to version.h


SVN r745 (trunk)
2008-02-14 15:40:46 +00:00
Randy Heit a9e2d96483 - Removed most checks on vid_hw2d/test2d. This now gets checked only once per
frame to avoid the remote possibility that it could change during the middle
  of drawing the frame and cause strange things to happen.
- Renamed test2d to vid_hw2d.


SVN r744 (trunk)
2008-02-14 04:58:45 +00:00
Randy Heit 59801d2b00 - Added pixel-doubled and -quadrupled screen modes to D3DFB so that users with
recent NVidia drivers can still use resolutions below 640x480, since NVidia
  saw fit to remove all support for them.


SVN r724 (trunk)
2008-01-29 18:20:05 +00:00
Randy Heit 4c9d633a94 - Fixed: P_RailAttack() crashed if you didn't specify a puff for a rail.
- Decided that allowing arbitrary alpha values for color remaps isn't so hot.
  Changed it back the way it was.


SVN r716 (trunk)
2008-01-27 04:53:55 +00:00
Randy Heit e5572a1c4e - Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
  loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
  support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
  with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
  on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
  scope than before. The skipped entry is assumed to always be at 248, and
  it is assumed that all Shader Model 1.4 cards suffer from this. That's
  because all SM1.4 cards are based on variants of the ATI R200 core, and the
  RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
  other flavors of the R200 are any different. (Interesting note: With the
  Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
  debug Direct3D 9 runtime, but it works perfectly fine with the retail
  Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
  math inside pixel shaders. That would explain perfectly why I can't use
  constants greater than 1 with PS1.4 and why it can't do an exact mapping to
  every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
  "color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
  completely setup, meaning that Shader Model 1.4 cards could not change
  resolution.
- I have decided to let remap palettes specify variable alpha values for
  their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
  reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
  when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
  (Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
  gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
  unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
  being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
  accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
  multiple script scanner states can be stored without being forced to do so
  recursively. I think I might be taking advantage of that in the near
  future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
  * Fixed: When using even length values in drawnumber it would cap to a 98
    value instead of a 99 as intended.
  * The SBarInfo parser can now accept negatives for coordinates. This
    doesn't allow much right now, but later I plan to add better fullscreen
    hud support in which the negatives will be more useful. This also cleans
    up the source a bit since all calls for (x, y) coordinates are with the
    function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
  software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
  space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
  STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
  gets blended with the background, since that seems like a good idea for
  reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
  Since the ERenderStyle enumeration was getting rather unwieldy, I converted
  it into a new FRenderStyle structure that lets each parameter of the
  blending equation be set separately. This simplified the set up for the
  blend quite a bit, and it means a number of new combinations are available
  by setting the parameters properly.


SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
Randy Heit 685de5ce30 - Applied Blzut3's SBARINFO update #8:
* Fixed: Drawbar had a few memory leaks.
- Added another temporary cvar called pc to play with the multipiler used by D3DFB::SetPaletteTexture().

SVN r704 (trunk)
2008-01-13 05:10:33 +00:00
Randy Heit cb47b3a1f7 - Completely removed code for the PNG filter heuristic from the compiled code when it's been disabled.
- Added a temporary cvar called pal to play with the offset used by D3DFB::SetPaletteTexture().

SVN r701 (trunk)
2008-01-12 17:06:38 +00:00
Randy Heit 9902d73a24 - Added support for 24-bit screenshots, so now accelerated 2D screenshots
can work.
- Tweaked the box splitting algorithm for packed textures to hopefully
  produce less wasted space.


SVN r696 (trunk)
2008-01-12 06:27:13 +00:00
Randy Heit 88549aebcd - For compatibility with the software renderer, D3DFB::DrawTextureV needs to
truncate the coordinates to integers before sending them to the hardware.
  Otherwise, there can be one pixel gaps compared to the software renderer,
  because the hardware is rounding to nearest but the software renderer is
  simply truncating the fractional part of the coordinate. This is the real
  cause of the gap above the status bar at 1152x864 (and another gap to the
  left of the status bar at 800x500).
- Fixed: When D3DFB::DrawTextureV had to clip a tile, it adjusted the 
  texture coordinates erroneously, still using the old calculations from
  before texture packing was implemented.


SVN r695 (trunk)
2008-01-12 02:12:09 +00:00
Christoph Oelckers e06c645310 - Moved the code that renders the view from D_Display into a virtual function
of the frame buffer so I can get rid of the last remaining renderer check
  outside the display code in GZDoom.
- made V_SetResolution a virtual function in IVideo. It's probably not a perfect
  solution but at least it allows overriding it (which I need in GZDoom.)
  Note: There's a lot of redundancy between hardware.cpp/h in the SDL and Win32
  folders so some cleaning up might be a good idea.


SVN r692 (trunk)
2008-01-11 21:04:22 +00:00
Randy Heit ca0b61d066 - Added texture packing to D3DFB so that textures that are temporally related
can share the same hardware texture. This greatly reduces the number of
  DrawPrimitive calls that need to be made when drawing text (or any 2D
  graphics in general), so now hardware text is much faster than software text
  all around. (As an example, one scenario went from 315 fps to over 1635 fps
  for hardware, compared to 540 fps for software.)


SVN r687 (trunk)
2008-01-10 04:11:38 +00:00
Randy Heit 9839cbfc82 - Fixed: The mouse was being grabbed in windowed mode again.
- Modified M_DrawFrame() and R_DrawTopBorder() so that they call FlatFill() to
  draw the edges of the frames. This at least seems a bit faster for hardware
  2D.
- Implemented FlatFill() for D3DFB. It seems to be exactly as fast as the
  default implementation that just calls DrawTexture() to tile the pieces onto
  the screen, so I'm not sure it was worth the bother.


SVN r686 (trunk)
2008-01-09 23:04:49 +00:00