Commit Graph

58 Commits (fcca92459c2454e4f5d47cc3e4e43c470706e76f)

Author SHA1 Message Date
Giel van Schijndel 64910221e7 Fix several warnings that occur on NDEBUG builds:
* Missing returns from function
 * Functions that are defined in both DEBUG and NDEBUG builds but only used in DEBUG builds

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6179 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-16 14:22:29 +00:00
Giel van Schijndel 71ddbdc5e4 Cleanup:
* Mark several parameters that aren't being used (but shouldn't be removed) with WZ_DECL_UNUSED
 * Use "(unsigned )?int" instead of "[SU](D?WORD|BYTE)" where the size guarantee is not required
 * Instead of "(X - Y) >= 0" use the logically equivalent and more readable "X >= Y"
 * Remove redundant function prototypes
 * Move variables into a more local scope where possible
 * Assign the result of an expression to a variable once so that the expression doesn't have to be duplicated several times
 * Move constant UNALLOCATED_OBJECT out of the header and into the only source file where it's ever used

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6160 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-14 21:03:23 +00:00
Buginator 21fdab0117 Modify debug output to specify the 'real' directory that physfs is using for the file in question.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5958 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-07 20:00:54 +00:00
Giel van Schijndel a293a90e76 * Rename audio_Get3DPlayerPos to audio_GetPlayerPos and change it to return a Vector3f instead
* Rename audio_Get3DPlayerRotAboutVerticalAxis to audio_GetPlayerOrientation and change it to return two Vector3f's with a forward and upward pointing vector in it (which can be directly used by OpenAL)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5763 4a71c877-e1ca-e34f-864e-861f7616d084
2008-08-03 17:51:43 +00:00
Per Inge Mathisen 1f831ebd3d Add beginnings of self-test to openal and general audio subsystems.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5456 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 19:07:42 +00:00
Dennis Schridde 10f2ccfd56 TRUE->true, FALSE->false (except in scripts)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4311 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-24 16:51:17 +00:00
Dennis Schridde 2537bfc61c Cleanup #includes a bit
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4107 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-16 12:39:08 +00:00
Dennis Schridde da462b4511 More float specialisation and generic cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3937 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-07 12:42:42 +00:00
Giel van Schijndel 6de5602631 * Make sound_PlayStream and audio_PlayStream return a AUDIO_STREAM* pointer instead of a bool
This pointer can later on be used to stop, pause & resume playing of the given stream


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3577 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 21:28:35 +00:00
Giel van Schijndel 3d245df0f9 * Provide an implementation of sound_PlayStream
* Modify audio_PlayStream's prototype to match sound_PlayStream's implementation & prototype
 * In cdspan_PlayInGameAudio use sasprintf instead of a statically sized array and snprintf
 * Add some Doxygen comments

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3276 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 15:16:59 +00:00
Giel van Schijndel db3d933791 * Add a new cheat/debug-command "showsamples"
* This command will cause the amount of samples in the sound library's queues & lists to be constantly displayed (until turned off) on screen

Patch #887 by Buginator


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3107 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-19 20:17:54 +00:00
Giel van Schijndel ff44e8c84c * Fix a bug introduced in r3047 (segfault due to failing to check for a NULL pointer)
* Apply patch #879 by Buginator (refactored by me to use less handcrafted code, and more functions instead)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3048 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-13 23:47:46 +00:00
Giel van Schijndel 51c32760b4 * Fix a bug where would free the wrong pointer (thanks to Buginator for spotting it)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3026 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-09 23:35:56 +00:00
Giel van Schijndel cc12f08b1a * Apply patch #879 by Buginator with some heavy modifications by me
* Upon removing BASE_OBJECTs loop through the lists of outstanding AUDIO_SAMPLEs to delete all of those that refer to this BASE_OBJECT


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3023 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-09 22:36:06 +00:00
Giel van Schijndel da2f84009b * In addition to the changes of r2853, make passing a NULL pointer safe as well
* In the error messages being output, distinguish between a NULL pointer and an empty string

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2890 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-26 15:57:56 +00:00
Per Inge Mathisen eeefdc0af0 Do not crash if filename to sound is not set. Modified version of patch #855 by Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2853 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-22 18:35:03 +00:00
Giel van Schijndel c76b591954 * In audio_StopAll() __always__ set psSample->psObj to NULL; this should fix bug #9233 (and bug #9927, which most likely is a duplicate, as well)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2684 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-03 02:07:25 +00:00
Giel van Schijndel e3b3379a83 * Replace malloc() calls immediately followed by memset(0) calls by calloc() calls instead
* Refactor a linked list iteration to for-loop
 * In audio_StopAll() check whether psSample->psObj is marked for deletion (i.e. audio_ObjectDead(psSample->psObj) returns true); if it is, set the pointer to NULL


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2683 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-03 01:55:11 +00:00
Per Inge Mathisen ec232d7e0f Actually use audio.cfg configuration of sound volume. Patch by Buginator in patch #822
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2677 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-02 18:47:22 +00:00
Giel van Schijndel ebff194ba7 * Remove some unused macros
* Remove a dual check of psTrack == NULL in sound_Play2DTrack (is already tested by invoked function sound_CheckTrack)
 * sound_GetTrackID now won't loop through a list of 600 pointers to find a match anymore if the given pointer is NULL

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2102 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-14 19:12:46 +00:00
Giel van Schijndel 83ef0a6e3c * Make audio_SetTrackVals return the track ID number rather than write it into a pointer given as parameter (failure is now indicated by a zero value instead; non-zero indicates success)
* Move a large portion of code from audio_SetTrackVals into sound_SetTrackVals (audio_SetTrackVals only checks whether sound is enabled now, the rest of the job is entirely delegated to sound_SetTrackVals)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2084 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 23:39:40 +00:00
Giel van Schijndel bc40797884 * Remove global var `static SDWORD g_iMaxSameSamples` from track.c which was only ever written to (not read from)
* Remove parameter `SDWORD iMaxSameSamples` from sound_Init who's value was only used to set g_iMaxSameSamples

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2081 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 23:15:24 +00:00
Giel van Schijndel 84a07b03a5 * Remove unused (and sometimes empty) functions sound_SetSamplePan, sound_SetSampleVolAll, sound_GetMaxVolume, audio_GetMixVol, audio_Get3DVolume
* Remove global var g_i3DVolume and audio_Set3DVolume which would set its value since g_i3DVolume was never ever read (well audio_Get3DVolume read it, but this function never got called)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1976 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-25 19:04:33 +00:00
Giel van Schijndel e3d9c70e94 * remove unused function audio_Get2DPlayerRotAboutVerticalAxis
* remove global var g_bStopAll which seems to function as some kind of crude (and non-functional) mutex lock (while Warzone doesn't even uses threads!)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1961 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-24 21:11:43 +00:00
Giel van Schijndel 46434a1e5d * Remove global var BOOL display3D which is always true anyway
* Adapt all code that depends on display3D by either removing if (!display3D){} code or removing the conditional around if(display3D){}
 * remove now useless function audio_Display3D (returned display3D) and now unused function audio_Get2DPlayerPos

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1958 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-24 19:38:36 +00:00
Giel van Schijndel 2658fa36aa * Change kf_MoveToLastMessagePos() to be more readable (i.e. simply return on error, don't wrap the actual working, non-error, code in a conditional), also use map_coord instead of `>> TILE_SHIFT`
* Remove unused (and probably useless) function audio_PlayPreviousQueueTrack
 * Remove unused functions audio_ReleaseTrack, audio_GetAvailableID, audio_GetSampleMixVol
 * Remove useless assignment in audio_GetPreviousTrackPos and make check for invalid coordinates more easily readable


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1911 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-21 13:39:05 +00:00
Giel van Schijndel 37be498275 Cleanup:
* Change the array iteration code such that it is a bit easier to read
 * remove audio_CheckAllUnloaded() which only forwarded to sound_CheckAllUnloaded()
 * Add some comments

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1910 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-21 13:03:52 +00:00
Giel van Schijndel 98e6c05da1 * Allow compilation without sound; when used this eliminates the compile & link time requirement of libvorbisfile, libvorbis, libogg and libopenal
* This conditional compilation is controlled by WZ_NOSOUND (which replaces WZ_NOOGG)
 * Remove an unneed inclusion from oggvorbis.h (track.h)

NOTE: This is currently integrated in none of the build systems

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1832 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-06 17:09:23 +00:00
Giel van Schijndel ed73e62898 Leave the memory management up to the memory management functions!
That is:
 * Don't use a custom memory heap implementation anymore
 * Remove all usages of HEAP code and replace it with malloc/free

NOTE: MacOSX projectfile probably requires an update

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1820 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-05 11:46:00 +00:00
Per Inge Mathisen b7e9c15c93 Some residual cleanup, including fixing an erronous static
assignment in the sound code.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1595 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-06 20:20:45 +00:00
Giel van Schijndel 3c407e0972 * some const correctness (char* -> const char*)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1475 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-16 14:53:09 +00:00
Giel van Schijndel 1d160dbfe0 * remove now unused functions for working with hashnames on audio tracks
* `make -C po update-po`

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1471 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-15 22:46:57 +00:00
Giel van Schijndel c028586ee4 Cleanup:
* AUDIO_SAMPLE
  * remove unused variable iLoops from the struct
  * rename bRemove to the more descriptive title of bFinishedPlaying
 * change sound_SetupChannel to return a BOOL rather than be return void and throw its output value in a pointer
 * make audio_Update() return void (instead of BOOL) since its output value was TRUE always anyway, plus all its callees ignored the output value
 * increase readability of lots of functions in audio.c
 * remove unused (and nothing doing) functions: audio_StopTrack, audio_SetTrackPan, audio_SetTrackVol and audio_SetTrackFreq

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1444 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-12 17:42:15 +00:00
Giel van Schijndel 6671750da0 * move some pieces of gettext.h into the conditional `#if ENABLE_NLS` and provide dummies for them if NLS is disabled (the #else part of the definition), without this compiling with NLS disabled is impossible
* remove ptrlist.c from lib/gamelib/Makefile.raw
 * some modifications of char* -> const char*
 * modify typedef of audio callback function to take a parameter of `void *psObj` rather than `AUDIO_SAMPLE *psSample` to minimize exposure (psSample->psObj was the only thing used by all callback functions anyway)
 * modify all callback functions to match the new typedef's signature
 * modify all functions calling callbacks to match the new signature (I think I've got them all, but since passing a pointer to a void* parameter doesn't generate any compiler errors/warnings I might have missed one, which would lead to undefined behaviour)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1442 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-12 10:31:11 +00:00
Giel van Schijndel dfa8d64f27 * modify construction functions of TRACK to return pointers instead of BOOLs (and if we return a NULL pointer we first free the original memory, previous code would leak if errors would occur during construction)
* remove wrapping function audio_LoadTrackFromFile from lib/sound/audio.c
 * move similar code in sound_LoadTrackFromBuffer and sound_LoadTrackFromFile to a static inline: sound_ConstructTrack (lib/sound/track.c)
  * this code also allocates memory for a TRACK and a string using one malloc call, this to make one free call sufficient for cleaning those up (they should _always_ be free'd together anyway, which previously was *not* always the case: memleaks)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1395 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-08 18:51:15 +00:00
Giel van Schijndel de5510938e * get rid of unused priority queue implementation (lib/gamelib/queue.[ch])
* remove an unused variable from lib/ivis_opengl/piemode.c
 * some code refactoring to increase readability, change if branches that handle error conditions to the folowing style:
    if (error)
    {
        deal with the error;
        return something (usually false or 0);
    }
    
    continue with normal execution path;

 * previously was something like: if(not error) {normal execution path;} else {deal with error;}; the above way groups error detection and handling which is more easily readable/understandable
 * wrap some if branches from r1374 with curly braces according to Per's advice on the dev mailinglist
 * completely get rid of iPriority from struct TRACK (also stripped it out of functions' argumentlists) since the only code that seemed to use it is the removed priority queue implementation

PS someone might want to look at lib/gamelib/audp_parser.y to finalize the modification to audio_SetTrackVals there, I'm not sure whether it will break any code/script if I would simply remove values from the parameter list, so I'm leaving it as is for this moment

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1378 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-05 20:19:58 +00:00
Giel van Schijndel c80d5dba3c * document audio_SetTrackVals (doxygen)
* remove some unnecessary else branches in audio_SetTrackVals (the if respective if branches really only where error handlers which caused the function to return anyway)
 * rename some things in audio_id.c to a more explaining name (i.e. the struct and its members)
 * fix some serious abuse of tabs ('\t') in audio_id.c, while the file looks partially good with a tabsize of 4, it looks awful with a tabsize of 8

PS audio_id.c's sole duty seems to be to map sound events to audio files, for the sake of moddability I think we ought to move this out of sources and into scripts.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1372 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-05 18:14:18 +00:00
Giel van Schijndel d659136496 * move audio_id.[ch] to lib/sound (because the soundlib depends on it, and libraries shouldn't depend on the main source, i.e. src/)
* further remove audio_GetIDFromStr from src/aud.c and rename audioID_GetIDFromStr (from audio_id.c) to audio_GetIDFromStr
  * also changed calling method of audio_GetIDFromStr, now it returns its retrieved value (ID index number) rather than writing it in a pointer given as parameter

PS MSVC project might be broken, I don't have it so can't check nor fix it

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1288 4a71c877-e1ca-e34f-864e-861f7616d084
2007-03-27 18:59:03 +00:00
Dennis Schridde ca3b5909c8 Fix indention and some minor cleanup...
Fixing type-punned pointers is difficult, especially with that HEAP_ALLOC function...


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1252 4a71c877-e1ca-e34f-864e-861f7616d084
2007-03-16 19:31:15 +00:00
Dennis Schridde 2a74242eb3 - Replaced various vectors with Vector3i and Vector3f (idea by Watermelon)
- Vector3i from lib/ivis also used in lib/audio, maybe want to move it to some more generic place?
- Replace iPoint with Vector2i
- Remove additional integer type declarations from pietypes.h
- Rename all iSprite to iTexture
- Various warning fixes: Unsigned/signed comparisons, uninitialized variables, declared but not defined symbols
- Replace DEBUG_BLOCK with DEBUG_MALLOC (it was virtually the same)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1245 4a71c877-e1ca-e34f-864e-861f7616d084
2007-03-16 16:20:16 +00:00
Per Inge Mathisen d434901a21 Fix audio for those who have none. Patch by Gerard Krol, who said
r1150 "made it return FALSE when sound is disabled. The attached
patch corrects this, and also removes the redundant function
audio_LoadTrackFromBuffer which was only a very thin wrapper for
sound_LoadTrackFromBuffer. The check if sound is enabled is again in
dataAudioLoad."


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1157 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-21 20:21:30 +00:00
Dennis Schridde 49ceba7503 Add GPL notices to all sourcecode files.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1014 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-15 20:09:25 +00:00
Dennis Schridde a432f5628f Patches by Christian Ohm:
010 - Remove unused sound compression code
011 - Remove unused audio parameter VagID


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@863 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-26 11:45:04 +00:00
Dennis Schridde f25a9aa3ac Not yet changed parts from patches of Christian Ohm:
003 - Remove all references to hWnd
004 - Remove DirectDraw flag
005 - Remove DDrawDriverName and D3DDriverName
006 - Remove all references to hInstance
007 - Remove some unused Windows types
008 - Remove VidMem parameter
009 - Remove bitdepth variables


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@862 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-26 11:39:54 +00:00
Dennis Schridde fb74a1f8dc Patch by Thomas Rast: Include string.h against warnings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@821 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-06 14:40:07 +00:00
Stefan Huehner 30f6dc392e mark some Strings an read-only by adding const.
On the way replace STRING with char



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@756 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-24 19:11:34 +00:00
Stefan Huehner b3e3d17b82 Include frameresource.h directly in its users. Fixup after
the big cleanup in 748:749.




git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@750 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-23 18:38:12 +00:00
Stefan Huehner 1395a7c69c Make some more functions static which aren't used outside their
declaring source files and which have no prototype.



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@731 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-19 18:45:48 +00:00
Dennis Schridde d889ce9da7 Patch by Christian Ohm: "g++ fixes"
Mainly explicit casts, some type changes, a few fixes.

We need to have a look if this line creates any problems:
lib/script/interp.c @@ -329,7 +329,7 @@
- if(!RetStackRemember(CurEvent, (ip + 2)))       //Remember where to jump back later
+ if(!RetStackRemember(CurEvent, *(ip + 2)))      //Remember where to jump back later


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@719 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-17 20:39:25 +00:00
Dennis Schridde 0e288f45e7 - Replace all ASSERT(( )) with ASSERT( )
- Simplify definition of ASSERT(). Now is the same for GCC and MSVC.
  This may not work on versions older than MSVC 2005. If you experience this, please report it!

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@613 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-23 12:58:48 +00:00