Commit Graph

46 Commits (b1a42e88ee8004de082a5644cab6bd5cedf665d6)

Author SHA1 Message Date
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 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 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
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
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
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 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
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
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
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 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 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
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
Dennis Schridde b1c7773299 Patches by Charon, slightly modified:
- *WarzoneKeyNumeric definition changed to SDWORD
- Report wrong tracknumbers to LOG_SOUND and don't crash in sound_Play*DTrack
- Correct --help text
- Make console backlog key configurable


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@810 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-04 21:05:31 +00:00
Dennis Schridde d3cd44148d Patch by Gerard Krol: Replace STRING with char (STRING was confusingly defined to char)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@804 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-03 21:35:50 +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 728b9a9913 - Commit patches "code cleanup: void" and "code cleanup: const" by Stefan Huehner
- Replace every occurence of VOID with void (and LPVOID with void*)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@703 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-13 09:09:05 +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
Dennis Schridde 62ae49b0ce Replaced all occurences of DBMB, DBPRINTF and DBERROR with their former define.
( DBPRINTF(("Message")); becomes debug( LOG_NEVER, "Message" ); )



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@608 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-22 14:28:49 +00:00
Per Inge Mathisen 2149739999 Almost all strings and buffers are now of type char. This fixes
more than half the warnings on gcc4, and makes sure we do not
get signedness problems between platforms where char is defined
with different signedness. Also set line-ending properites for
some bison/flex files that did not have it set.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@563 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-12 16:52:37 +00:00
Dennis Schridde 5175535d9d Full pathname includes
Same as in r431, but now for lib/
- converted the sources in lib/ to use full path includes instead of just the filename.
- marked places where lib/ivis_*implementation* (eg opengl) is needed, because of incomplete lib/ivis_common.

Should improve the understanding of interfaces and code organization.

(Also fixed a double slash (//) include in src/multimenu.c)



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@432 4a71c877-e1ca-e34f-864e-861f7616d084
2006-06-02 19:34:58 +00:00
Dennis Schridde 628a06067b lib/ivis_opengl/screen.c:
- G++ fix( PHYSFS_file ).

other:
 - Simplify sound code.
 - Make Warzone run with busy audio device (Linux).

All patches by cybersphinx.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@412 4a71c877-e1ca-e34f-864e-861f7616d084
2006-04-01 17:50:19 +00:00
Per Inge Mathisen 398ca55ba0 Add extra sanity checks to soundtrack code. Patch by Scott Balneaves
with slight changes by me. See bug report #5168 for details.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@394 4a71c877-e1ca-e34f-864e-861f7616d084
2006-02-03 22:00:43 +00:00
Rodolphe Suescun 6fedcb3d4d Fixed crash in sound lib.
Fixed shadow-related problem.
Fixed polygon flags (face culling and colour key related).
Added new tileset from Grim.
New warzone logo.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@365 4a71c877-e1ca-e34f-864e-861f7616d084
2005-11-29 16:20:35 +00:00
No Author 5ba7ddac6b Create final repository structure.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@362 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-28 17:47:08 +00:00