Commit Graph

193 Commits (ac65ebfdfcbc998fc7a674652f1596ee48b2e288)

Author SHA1 Message Date
Giel van Schijndel 533e7e92bf * Use spaces for line-out purposes (rather than tabs)
* Tune down the volume of the oil-pumps, power-spikes and power hums a bit, to make them less dominant (and annoying) (from patch #822 by Buginator)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2681 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-02 22:37:20 +00:00
Giel van Schijndel a316f10a0e * Don't save the volume with user volume preferences applied (instead save the track-volume so recomputing will be possible)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2680 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-02 22:19:06 +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 e06c186bd6 * Replace a _lot_ of strcpy(), strcat() and sprintf() calls with the safer strncpy(), strncat() and snprintf() respectively
* Refactor NETlogEntry() to use the array of strings (packetname[]) instead of a large switch-statement with a lot of copy & pasted code


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2617 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-24 21:11:29 +00:00
Giel van Schijndel ebe882625f * Fix doxygen comment
* Fix indentation

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2468 4a71c877-e1ca-e34f-864e-861f7616d084
2007-09-23 21:43:57 +00:00
Dennis Schridde 6627ecbc6a Fix "incompatible declarations" found by batched compiling.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2460 4a71c877-e1ca-e34f-864e-861f7616d084
2007-09-16 14:05:01 +00:00
Giel van Schijndel 0d901ea836 * Merge fixes for bug #9694 and bug #9704 which where fixed in r2349 and r2355 respectively from the 2.0 branch into trunk
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2356 4a71c877-e1ca-e34f-864e-861f7616d084
2007-08-08 11:23:21 +00:00
Giel van Schijndel 6b912bc40d * Remove duplicated function sound_TrackAudibleRadius (was an unused duplicate of sound_GetTrackAudibleRadius)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2103 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-14 19:56:10 +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 27bbae281b * Add a workaround for a crash in OpenAL triggered when shooting the first scavengers in the campaign
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2100 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-14 18:42:39 +00:00
Giel van Schijndel 2bb8afe647 * Check whether g_apTrack == NULL since that is a valid state when audio is disabled
* Add some additional info about which track is being asked about into the assert

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2095 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-14 14:19:14 +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 9de99e7d33 * Don't use (void) as parameter list for the function implementation (this is only required for function declarations, not implementations)
* in sound_GetAvailableID start looking for available IDs starting from ID_SOUND_NEXT, not zero (0) as that might cause ID collisions when used in conjunction with the hardcoded IDs in audio_id.*
 * Make ID_SOUND_MAX be equal to the highest ID number (of the ID set defined in audio_id.*) rather than one more (since this is what "max" suggests: the highest number, not one more than the highest number)
 * ID_SOUND_NEXT is now one higher than the highest ID number and can be/is used where one higher is required

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2082 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 23:25:29 +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 b10e316999 * Make all (I hope I didn't miss any) references to audio filenames lowercase (as all audio files themselves have a fully lowercase name)
* Fix two typos of wrong filenames (these two are not case mismatches) in audio_id.c (one used a ',' instead of '.' and used wav as extension, the other missed a '-')
 * Don't use case insensitive matching of filenames in audio_GetIDFromStr anymore as our filesystems aren't guaranteed to be case insensitive (this should cause no problems together with the above fixes)
 * Use calloc instead of malloc and a for-loop to allocate an array of NULL pointers in sound_Init

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2076 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-13 22:11:04 +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 18dcb24b3c * Rename functions
mixer_GetCDVolume    to sound_GetMusicVolume
   mixer_SetCDVolume    to sound_SetMusicVolume
   mixer_GetWavVolume   to sound_GetUIVolume
   mixer_SetWavVolume   to sound_SetUIVolume
   mixer_Get3dWavVolume to sound_GetEffectsVolume
   mixer_Set3dWavVolume to sound_SetEffectsVolume
 * Make the above functions use floats instead of SDWORD (int32_t) and use a range of 0.0 - 1.0 instead of 0 - 100
 * Remove global var g_iGlobalVol which was only used by one function and wasn't reused in multiple calls, now use a local function var instead: float originalVolume

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1972 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-25 18:09:38 +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 dd337e40eb Some more 64bit safety:
* Use "%zu" as format specifier to print out size_t types


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1833 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-06 18:49:57 +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
Giel van Schijndel d1336810a9 * Fix wrongly triggered error messages about OpenAL audio contexts
(The error state simply wasn't cleared before calling a function that could produce an error)

Patch by vs2k5

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1803 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 10:01:52 +00:00
Dennis Schridde 58e8bda3a9 _ISOC99_SOURCE is a libc macro, we now use WZ_C99 instead (which gets defined via __STDC_VERSION__)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1749 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-29 14:55:24 +00:00
Dennis Schridde fde0d68082 - (__STDC_VERSION__ >= 199901L) -> defined(_ISOC99_SOURCE)
- Tune lighting and enable by default (This doesn't seem to affect the terrain)
- Declaration updates (Trolltech says that attributes need to go after the "static inline", the GCC manual is a bit unspecific about this)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1744 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-29 14:09:10 +00:00
Giel van Schijndel 7241d5f1e8 * soundDataBuffer.bufferSize now indicates the size of soundDataBuffer.data (as it should)
* previously this indicated the size of soundDataBuffer + soundDataBuffer.data instead (which was wrong)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1743 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-29 11:36:16 +00:00
Giel van Schijndel 73cf341da5 * Add failsafe to OggVorbis PhysicsFS seek callback to deal with invalid "whence" values
* Use tabulated code indentation for oggvorbis.[ch]
 * Move curPos and fileSize into a more localized scope

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1741 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-29 10:32:15 +00:00
Dennis Schridde 9d4a007121 More inlining and const
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1703 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-25 17:58:23 +00:00
Giel van Schijndel de4b91e2c3 * Use a forward declaration of `struct OggVorbisDecoderState` instead of a dual typedef (one typedef as void for external functions, one as the struct for the implementation file), only to allow us to take pointers to it
* Drop now unnecessary extern "C" declaration, since C++'s function overloading shouldn't cause problems now
 * Add "struct" keyword in front of all declarations of `struct OggVorbisDecoderState` or pointers to it

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1698 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-25 14:56:18 +00:00
Giel van Schijndel 12078733b8 * Fix usage of `new` which is both a) a keyword in C++, and b) an undescriptive variable name
* Make sure function overloading by a C++ compiler doesn't cause linker errors by declaring affected functions extern "C"

Patch by Christian Ohm (in message <20070523201048.GF3778@localdomain>);
 * applied changes to lib/ivis_common/imdload.c
 * brought linker errors to light caused by function overloading

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1695 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-23 20:57:11 +00:00
Dennis Schridde 01fea434fb Turn some sqrt() into sqrtf() where double precision is not needed.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1667 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-20 14:47:32 +00:00
Stefan Huehner d30dcb1520 2 small fixes in function declarations : () -> (void)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1663 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-20 13:51:53 +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 e252c12161 remove an unnecessary debug-statement
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1575 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-01 08:45:44 +00:00
Giel van Schijndel 9c0a67102d * Utilize OggVorbis decoding function from oggvorbis.[ch] instead of own implementation
* char* -> const char*

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1574 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-01 01:08:48 +00:00
Giel van Schijndel c4d97027ba * Fix a memory leak (didn't free the buffer we received, after using it)
* Remove the ability to decode into a specified buffer from sound_DecodeOggVorbis altogether, we now only use a buffer we malloc'ed ourselves
  * this might be slightly slower for streaming (depending on the malloc implementation), but can be easily optimized away by just increasing the buffer size (which IMO is a better optimization, because it's _a_lot_ simpler)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1573 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-01 00:30:37 +00:00
Giel van Schijndel 8a5c7d9f6d * remove ability to resize external buffer (realloc) because this made the code overly complex while providing only little gain
* instead we now just calculate the precise amount of memory needed ahead of time and just malloc for decoding of each track (decoding only occurs while loading so these extra malloc calls shouldn't go at the expense of performance)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1572 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-01 00:04:37 +00:00
Giel van Schijndel bfad55739b * modularize OggVorbis decoding code:
* remove OpenAL dependency of oggvorbis.[ch]
  * move sound_DecodeOggVorbisTrack to openal_track.c

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1571 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-30 23:52:51 +00:00
Giel van Schijndel c4ad4d1ca8 * remove a possible memory leak in sound streaming code
* some minor code cleanup

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1568 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-30 19:24:46 +00:00
Giel van Schijndel bdb506f697 * move OggVorbis decoding functionality to oggvorbis.[ch]
* did _not_ add copyright statement for "Eidos" to new files since Eidos never wrote anything about this OpenAL/OggVorbis code (if anyone thinks I'm wrong in doing this, please say so on the mailinglist)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1566 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-30 17:58:27 +00:00
Giel van Schijndel 1643e335e4 * remove unneeded header include directives
* use plain data types where appropriate
 * move the decision for streaming to a parameter of the decoder function (less tight coupling of client to internal decoder callbacks)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1565 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-30 16:55:53 +00:00
Giel van Schijndel d86f1dd046 * remove assert in sound code (iSample != SAMPLE_NOT_ALLOCATED), this assertion is triggered much too oftenly, probably because we request OpenAl sources but never release them anymore, which is the result from depending too much on client code to be nice and tell the soundlib to release it
* remove a senseless forward declaration

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1541 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-26 17:51:17 +00:00
Dennis Schridde f6da22d739 _MACOSX_ -> WZ_OS_MAC
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1496 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-18 12:40:50 +00:00
Ari Johnson 91535c6596 Converted MacOS port to use Xcode to produce a universal binary. Warzone
will henceforth require MacOS 10.4 "Tiger" to run.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1492 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-18 03:10:53 +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 51347f365c * remove MP3 decoding support
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1472 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-16 13:44:41 +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
Dennis Schridde 25aa853f29 - Remove lots of inclusions of windows.h (and move inclusion of frame.h up)
- Remove "-%token <sval> TEXT" from audp_parser.y since it clashed with declarations in MinGW's Windows headers. It does still compile and run, but this may have harmed something anyway. Please check!
- Hack around DATADIR being defined by objbase.h in MinGW by undefining it before the inclusion of shlobj.h (incl. in main.c) This only works since the case that DATADIR is actually used on Windows is extremely rare.



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1437 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-11 14:21:45 +00:00
Giel van Schijndel 80c250fd27 * merge 1364:1404 from trunk into branches/sound
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1404 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 14:35:02 +00:00
Giel van Schijndel 092afb2a01 * remove sound_CheckSample: only contained asserts, makes debugging difficult if you don't know where the assert really came from
* moved asserts to only two callees of sound_CheckSample

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1403 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 12:50:48 +00:00
Giel van Schijndel 3c874190c7 * remove the (unused) ability to decode tracks from memory buffers
* move construction (allocation and initialization) of struct TRACK to openal_track.c where it is also decoded

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1401 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 12:16:31 +00:00
Gerard Krol 28fe84976e Removed unused "cluster" functions from the sound code. I suppose
clusters are groups of close units.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1399 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 10:56:26 +00:00
Giel van Schijndel e95423ac68 * set filename from GetLastResourceFilename() in sound_ConstructTrack (this filename can at some point be read back into scripts, so it does matter how this filename is formatted, since loading from buffer originally used that function, we now use it for both file loading and buffer loading)
* change audp_parser/lexer to be able to read directly from a file (through PHYSFS)
 * change data.c's mapping for "AUDIOCFG" to use the parsing directly from file
 * rename dataAudioLoadFile to dataAudioLoad
 * add a second list with load function mappings to audio.c for load from file mappings
 * add a second piece of iteration code for the file mapping list

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1398 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-08 23:25:48 +00:00
Giel van Schijndel 99153c743c * remove some dead code (resource preload callback stuff)
* turn a one-statement function into an inline (resDoResLoadCallback)
 * revive resource loading from file (the function pointer for this was removed in r1394, to actually use this pointer new code had to be written)
 * modify resDataInit to handle memory allocation as well as data initialization
 * modify struct RES_DATA to not have a fixed size char array to contain the filename (is now dynamically allocated together with the rest of the struct, see resDataInit)
 * modify some argument lists to take `const char*` instead of `char*`
 * change resLoadFile to use RES_TYPE.fileLoad if available, also remove an unused if statement (well actually the condition could never be false)
 * resource type "WAV" (see data.c) now directly loads from a file (rather than copying the file entirely into memory and then to operate on that)
 * fix sound_ConstructTrack (track.c) where I used the wrong source to copy the filename from
 * fix sound_LoadTrackFromBuffer (track.c) to *not* add the track to the tracklist because this breaks other code
 * modify sound_ReleaseTrack (track.c) to gracefully deal with NULL pointers
 * remove dataAudioRelease (data.c) and instead just use sound_ReleaseTrack

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1397 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-08 21:39:24 +00:00
Giel van Schijndel 61975a7936 * Fix a missing semi-colon r1395
* Change some calls to FREE(TRACK*) to free(TRACK*), because TRACK is always allocated using malloc
 * Change only one instance of MALLOC and only other instance of FREE in lib/sound/track.c to malloc and free respectively

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1396 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-08 19:01:19 +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
Gerard Krol 6671fa934e 1. Removed the terrible memory leaks from the resource system. 2. Fixed the memory leaks for the terrain tiles. 3. Fixed a lot of uninitialised
variables. 4. Commented out some unused sound code.
I just love Valgrind :)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1390 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-07 13:23:14 +00:00
Giel van Schijndel a3ac39aa7d * fix a compile error caused by a curly brace to many
* (probably caused because I was editing this file when r1377 was committed which probably was merged wrongly with my changes)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1379 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-05 20:25:21 +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
Per Inge Mathisen 640e7be2a9 Sound code: Some code cleanup and removal of unused code. Also fix an assert
that was broken in several ways.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1377 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-05 19:42:00 +00:00
Giel van Schijndel a72ecb62fd * remove some else branches to inrease code readability (code itself should function exactly the same)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1374 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-05 18:43:42 +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 26f2672bfd * remove macro PTRVALID
* replace all instances of PTRVALID(ptr,size) by (ptr != NULL)
 * remove asserts of style ASSERT( x == NULL || x != NULL ) because they would evaluate to true always anyhow and as such wouldn't ever trigger
 * remove macros iV_HeapAlloc and iV_HeapFree and replaced them with MALLOC and FREE respectively (that's what they expanded to anyway)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1348 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-03 13:20:41 +00:00
Giel van Schijndel 13c85370b9 * enable libvorbisfile to seek into a file opened with PhysicsFS
* also allow this to be disabled on a per file basis (this code is basically taken from the sound branch: lib/sound/decoding.cpp)
 * some minor code cleanups (using a temporary to cast into, rather than casting directly into a function call's parameters, optimizer will optimize this away anyhow)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1345 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-03 11:15:41 +00:00
Dennis Schridde 3b09a756df - Remove unneeded gettext files and instead create them via autopoint
- Remove unneeded checks from autogen.sh (all of them are also checked in configure.ac)
- Move AM_CPPFLAGS=-$(top_srcdir), which was included in nearly every Makefile, to configure.ac
- Remove -g from CFLAGS for usual builds. This should be set by the buildscripts instead
- Remove CFLAGS_OVERRIDE, which was rendered obsolete by the above change


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1332 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-02 17:21:05 +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
Per Inge Mathisen cfea4b4b3e Remove strange usage of hash names in soundtrack code. I am not sure
why it worked, or, perhaps, why it still works. Take care ;-)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1251 4a71c877-e1ca-e34f-864e-861f7616d084
2007-03-16 19:03:53 +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
Dennis Schridde b6fe2eb42b Patch by Jessica: Fix compilation without MP3 support
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1209 4a71c877-e1ca-e34f-864e-861f7616d084
2007-03-06 20:35:15 +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
Giel van Schijndel c07332714b * removed some redundant code from src/data.c:
- the function dataAudioLoad first checked whether the audio system is disabled and if it is sets return buffer (*ppData) to NULL, even though this functionality is already performed by the function it calls (audio_LoadTrackFromBuffer)
  - this is similar for dataAudioRelease, additionally I moved the (low-level) call FREE(psTrack) to lib/sound/track.c which is also the file in which it gets malloc'ed
 * while at it I directly changed sound_ReleaseTrack from returning BOOL to void since its return value was meaningless anyway (would always be TRUE no matter what), not to mention it was completely ignored by its only caller (dataAudioRelease)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1150 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-19 21:52:27 +00:00
Per Inge Mathisen 79b3875fc4 This commit fixes all warnings (on my system). -Werror added for
debug builds. Hopefully this will not cause too much pain, but
rather increase code quality for the future.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1144 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-19 14:10:44 +00:00
Giel van Schijndel 3880422cbe copied some code from branches/sound/lib/sound/decoding.cpp
This allows files to be decoded by OggVorbis directly through PHYSFS. Previously PHYSFS was used to read the entire file into memory and then to decode it from that memory buffer.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1138 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-18 22:16:55 +00:00
Giel van Schijndel b73646d04b * improve code readability (e.g. only keeping the `if (malloc(...) == NULL) handleError;` part, so as not to wrap all the rest of the code in a big (recursive) else block
* remove function `static void sound_SaveTrackData` because the operation it performs doesn't justify a whole function (and its calling overhead)
 * some cleanup in functions sound_ReadTrackFromBuffer and sound_ReadTrackFromFile
  * commented operation of both functions 
  * moved the content of function sound_SaveTrackData (only one statement) to sound_ReadTrackFromBuffer
  * modified sound_ReadTrackFromFile to not allocate double the size of the needed memory for a buffer

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1137 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-18 21:30:51 +00:00
Dennis Schridde 8a70df4064 Use some more advanced Automake techniques like noinst_HEADERS. Changes partly autogenerated by KDevelop, so this should be compatible with Automake 1.6.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1118 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-16 14:36:03 +00:00
Per Inge Mathisen 3d6771a521 Unify the several different definitions of pi in the codebase. Now we use the
C macro M_PI (if available, or we will define it on our own in fractions.h).


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1033 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-24 19:42:20 +00:00
Giel van Schijndel 731c145b75 removed alGetError() error-check because an al* error couldn't be legally generated at this stage since no al* calls are made yet
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1018 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-17 22:18:59 +00:00
Giel van Schijndel 5bcc7819ac git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1017 4a71c877-e1ca-e34f-864e-861f7616d084 2007-01-17 21:39:38 +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
Per Inge Mathisen 85767a6ae8 Remove the unused (unconfigurable) CD soundtrack code, since we now
anyway prepare to add our own, new music tracks to the game.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@997 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-10 23:00:04 +00:00
Per Inge Mathisen a0c67a74c1 While I am at it, remove some more dead code and set correct log flag.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@996 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-10 22:50:09 +00:00
Per Inge Mathisen 6856fab9de Fix autoconf build system that was broken in commit 994.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@995 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-10 22:38:55 +00:00
Giel van Schijndel c3276dcf59 last commit only emptied lib/sound/mixer_stub.c
fix that by deleting it now

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@994 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-10 21:56:50 +00:00
Giel van Schijndel 1591402b4c removed lib/sound/mixer_stub.c and all function calls to it (or more precisely the calls to its empty functions)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@993 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-10 21:55:39 +00:00
Giel van Schijndel 340710edf8 workaround for bug #8198
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@975 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-08 22:35:43 +00:00
Dennis Schridde f1ad4d83c9 - Expand DISP_HEIGTH/DISP_WIDTH
- Remove an unused function


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@964 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-07 19:29:26 +00:00
Giel van Schijndel 241f40f5fc soundsystem fixes/improvements
* remove file-global var `ALfloat listenerPos[3]` and replaced with function calls to alListener{Get}{n}{fi}{v}( AL_POSITION, ... )
 * modified sound_SetObjectPosition() to be better human-readable (removed some unnecessary temporary vars)
 * modified sound_SetPlayerOrientation() to a more verbose writing (+Doxygen comment)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@962 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-07 16:28:54 +00:00
Dennis Schridde a7aac74fae - Removed some commented parts
- Removed unneeded check for psTarget == NULL from the establishTarget* functions, would have crashed before anyway
- Patch by Watermelon: Projectile Fix 7: 1.Fixed a crash with VTOL bomber with NULL weapon pIMD.
- Fix include of lib/framework/frame.h


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@942 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-30 22:01:34 +00:00
Per Inge Mathisen 9c22bf56ba Fix possible source of redefined macro warnings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@941 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-30 19:22:08 +00:00
Dennis Schridde 4e28453441 src/* and lib/ivis_common/piemode.h by me: Cleanup unused functions.
Rest: Patch by Giel van Schijndel: codecleaning patch: lets delete stuff


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@939 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-29 19:56:06 +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 13528b9d71 Patch by Christian Ohm: 045 - Fix playlist code
- Move two global variables only used in PlayList_Read into that
   function.
 - Remove a useless comparison (unsigned int can never be < 0)
 - Check for '\r' as well as '\n'. This should make playlists with DOS
   line endings work.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@860 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-26 10:54:22 +00:00
Dennis Schridde 7d3ad56fd5 Compilation fixes, macro removal, PHYSFS_fileLength by Gerard Krol.
Some more initialization in interp.c by me.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@824 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-06 21:58:13 +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