Even more FindArg cleanups
This commit is contained in:
parent
a9b6e1b5ff
commit
faa6122a4a
|
@ -5,6 +5,7 @@ D2X-Rebirth Changelog
|
|||
include/args.h, include/error.h, main/newmenu.c, main/network.c, main/inferno.c, main/menu.c, main/gamerend.c, main/automap.c, main/game.c, main/game.h, main/gamecntl.c, misc/args.c: Code cleanup and small fixes
|
||||
main/collide.c, main/newmenu.c, main/object.c, main/physics.c, main/weapon.c, main/weapon.h, main/gameseq.c, main/laser.c, main/kconfig.c, main/gamecntl.c: Removed old Tactile-code since ForceFeedback is currently out of question
|
||||
main/multi.h, main/state.c: Deactivated Multisave feature as default (multi.h define) - broken, not sure if it's worth to fix
|
||||
arch/linux/hmiplay.c, arch/ogl/sdlgl.c, include/args.h, include/digi.h, main/digiobj.c, main/inferno.c, main/ipserver.cpp, main/network.c, main/piggy.c, main/polyobj.c, main/slew.c, misc/args.c: Even more FindArg cleanups
|
||||
|
||||
20070718
|
||||
--------
|
||||
|
|
|
@ -816,7 +816,7 @@ void play_hmi (void * arg)
|
|||
|
||||
void digi_play_midi_song(char *filename, char *melodic_bank, char *drum_bank, int loop)
|
||||
{
|
||||
if (FindArg("-nomusic"))
|
||||
if (GameArg.SndNoMusic)
|
||||
return;
|
||||
|
||||
if (!filename)
|
||||
|
@ -831,7 +831,7 @@ void digi_play_midi_song(char *filename, char *melodic_bank, char *drum_bank, in
|
|||
|
||||
void digi_set_midi_volume( int mvolume ) {
|
||||
char buf[128];
|
||||
if(FindArg("-nomusic"))
|
||||
if (GameArg.SndNoMusic)
|
||||
return;
|
||||
|
||||
sprintf(buf,"v%i",mvolume);
|
||||
|
|
|
@ -54,14 +54,12 @@ void ogl_swap_buffers_internal(void)
|
|||
|
||||
int ogl_check_mode(int x, int y)
|
||||
{
|
||||
return !SDL_VideoModeOK(x, y, 16, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0)); // ZICO - use bpp instead of 16
|
||||
return !SDL_VideoModeOK(x, y, GameArg.GlBpp, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0));
|
||||
}
|
||||
|
||||
|
||||
int ogl_init_window(int x, int y)
|
||||
{
|
||||
int bpp = FindArg("-gl_16bpp") ? 16 : 32;
|
||||
|
||||
if (gl_initialized){
|
||||
if (x==curx && y==cury && curfull==ogl_fullscreen)
|
||||
return 0;
|
||||
|
@ -79,7 +77,7 @@ int ogl_init_window(int x, int y)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!SDL_SetVideoMode(x, y, bpp, SDL_OPENGL | (ogl_fullscreen ? SDL_FULLSCREEN : 0)))
|
||||
if (!SDL_SetVideoMode(x, y, GameArg.GlBpp, SDL_OPENGL | (ogl_fullscreen ? SDL_FULLSCREEN : 0)))
|
||||
{
|
||||
Error("Could not set %dx%dx%d opengl video mode\n", x, y, bpp);
|
||||
}
|
||||
|
@ -102,18 +100,6 @@ void ogl_destroy_window(void){
|
|||
}
|
||||
|
||||
void ogl_init(void){
|
||||
int t;
|
||||
if ((t=FindArg("-gl_red")))
|
||||
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, atoi(Args[t+1]) );
|
||||
if ((t=FindArg("-gl_green")))
|
||||
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, atoi(Args[t+1]) );
|
||||
if ((t=FindArg("-gl_blue")))
|
||||
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, atoi(Args[t+1]) );
|
||||
if ((t=FindArg("-gl_alpha")))
|
||||
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, atoi(Args[t+1]) );
|
||||
if ((t=FindArg("-gl_buffer")))
|
||||
SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, atoi(Args[t+1]) );
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,0);
|
||||
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,0);
|
||||
|
|
|
@ -1,529 +0,0 @@
|
|||
/* $Id: digi.c,v 1.1.1.1 2006/03/17 19:54:04 zicodxx Exp $ */
|
||||
#define DIGI_SOUND
|
||||
#define MIDI_SOUND
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <dsound.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "mono.h"
|
||||
#include "fix.h"
|
||||
#include "vecmat.h"
|
||||
#include "gr.h" // needed for piggy.h
|
||||
#include "piggy.h"
|
||||
#include "digi.h"
|
||||
#include "sounds.h"
|
||||
#include "wall.h"
|
||||
#include "newdemo.h"
|
||||
#include "kconfig.h"
|
||||
#include "hmpfile.h"
|
||||
|
||||
#include "altsound.h"
|
||||
|
||||
hmp_file *hmp = NULL;
|
||||
|
||||
#ifdef DIGI_SOUND
|
||||
#define MAX_SOUND_SLOTS 32
|
||||
#define MIN_VOLUME 10
|
||||
|
||||
|
||||
//added/changed on 980905 by adb to make sfx volume work
|
||||
#define SOUND_MAX_VOLUME F1_0
|
||||
int digi_volume = SOUND_MAX_VOLUME;
|
||||
//end edit by adb
|
||||
|
||||
LPDIRECTSOUND lpds;
|
||||
WAVEFORMATEX waveformat;
|
||||
DSBUFFERDESC dsbd;
|
||||
|
||||
extern HWND g_hWnd;
|
||||
|
||||
struct sound_slot {
|
||||
int soundno;
|
||||
int playing; // Is there a sample playing on this channel?
|
||||
int looped; // Play this sample looped?
|
||||
fix pan; // 0 = far left, 1 = far right
|
||||
fix volume; // 0 = nothing, 1 = fully on
|
||||
//changed on 980905 by adb from char * to unsigned char *
|
||||
unsigned char *samples;
|
||||
//end changes by adb
|
||||
unsigned int length; // Length of the sample
|
||||
unsigned int position; // Position we are at at the moment.
|
||||
LPDIRECTSOUNDBUFFER lpsb;
|
||||
} SoundSlots[MAX_SOUND_SLOTS];
|
||||
|
||||
|
||||
int midi_volume = 255;
|
||||
int digi_midi_song_playing = 0;
|
||||
int digi_last_midi_song = 0;
|
||||
int digi_last_midi_song_loop = 0;
|
||||
|
||||
static int digi_initialised = 0;
|
||||
static int digi_atexit_initialised=0;
|
||||
|
||||
//added on 980905 by adb to add rotating/volume based sound kill system
|
||||
static int digi_max_channels = 16;
|
||||
static int next_handle = 0;
|
||||
int SampleHandles[32];
|
||||
void reset_sounds_on_channel(int channel);
|
||||
//end edit by adb
|
||||
|
||||
void digi_reset_digi_sounds(void);
|
||||
|
||||
void digi_reset() { }
|
||||
|
||||
void digi_close(void)
|
||||
{
|
||||
if(digi_initialised)
|
||||
{
|
||||
digi_reset_digi_sounds();
|
||||
IDirectSound_Release(lpds);
|
||||
}
|
||||
digi_initialised = 0;
|
||||
}
|
||||
|
||||
/* Initialise audio devices. */
|
||||
int digi_init()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (!digi_initialised && g_hWnd){
|
||||
|
||||
memset(&waveformat, 0, sizeof(waveformat));
|
||||
waveformat.wFormatTag=WAVE_FORMAT_PCM;
|
||||
waveformat.wBitsPerSample=8;
|
||||
waveformat.nChannels = 1;
|
||||
waveformat.nSamplesPerSec = digi_sample_rate; //11025;
|
||||
waveformat.nBlockAlign = waveformat.nChannels * (waveformat.wBitsPerSample / 8);
|
||||
waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign;
|
||||
|
||||
if ((hr = DirectSoundCreate(NULL, &lpds, NULL)) != DS_OK)
|
||||
return -1;
|
||||
|
||||
if ((hr = IDirectSound_SetCooperativeLevel(lpds, g_hWnd, DSSCL_PRIORITY)) //hWndMain
|
||||
!= DS_OK)
|
||||
{
|
||||
IDirectSound_Release(lpds);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_CTRLDEFAULT | DSBCAPS_GETCURRENTPOSITION2;
|
||||
dsbd.dwBufferBytes = 8192;
|
||||
dsbd.dwReserved=0;
|
||||
dsbd.lpwfxFormat = &waveformat;
|
||||
|
||||
digi_initialised = 1;
|
||||
}
|
||||
|
||||
if (!digi_atexit_initialised){
|
||||
atexit(digi_close);
|
||||
digi_atexit_initialised=1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// added 2000/01/15 Matt Mueller -- remove some duplication (and fix a big memory leak, in the kill=0 one case)
|
||||
static int DS_release_slot(int slot, int kill)
|
||||
{
|
||||
if (SoundSlots[slot].lpsb)
|
||||
{
|
||||
DWORD s;
|
||||
|
||||
IDirectSoundBuffer_GetStatus(SoundSlots[slot].lpsb, &s);
|
||||
if (s & DSBSTATUS_PLAYING)
|
||||
{
|
||||
if (kill)
|
||||
IDirectSoundBuffer_Stop(SoundSlots[slot].lpsb);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
IDirectSoundBuffer_Release(SoundSlots[slot].lpsb);
|
||||
SoundSlots[slot].lpsb = NULL;
|
||||
}
|
||||
SoundSlots[slot].playing = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void digi_stop_all_channels()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_SOUND_SLOTS; i++)
|
||||
digi_stop_sound(i);
|
||||
}
|
||||
|
||||
|
||||
static int get_free_slot()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_SOUND_SLOTS; i++)
|
||||
{
|
||||
if (DS_release_slot(i, 0))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int D1vol2DSvol(fix d1v){
|
||||
//multiplying by 1.5 doesn't help. DirectSound uses dB for volume, rather than a linear scale like d1 wants.
|
||||
//I had to pull out a math book, but here is the code to fix it :) -Matt Mueller
|
||||
//log x=y <==> x=a^y
|
||||
// a
|
||||
if (d1v<=0)
|
||||
return -10000;
|
||||
else
|
||||
// return log2(f2fl(d1v))*1000;//no log2? hm.
|
||||
return log(f2fl(d1v))/log(2)*1000.0;
|
||||
}
|
||||
|
||||
// Volume 0-F1_0
|
||||
int digi_start_sound(short soundnum, fix volume, int pan, int looping, int loop_start, int loop_end, int soundobj)
|
||||
{
|
||||
int ntries;
|
||||
int slot;
|
||||
HRESULT hr;
|
||||
|
||||
if (!digi_initialised)
|
||||
return -1;
|
||||
|
||||
// added on 980905 by adb from original source to add sound kill system
|
||||
// play at most digi_max_channel samples, if possible kill sample with low volume
|
||||
ntries = 0;
|
||||
|
||||
TryNextChannel:
|
||||
if ((SampleHandles[next_handle] >= 0) && (SoundSlots[SampleHandles[next_handle]].playing))
|
||||
{
|
||||
if ((SoundSlots[SampleHandles[next_handle]].volume > digi_volume) && (ntries < digi_max_channels))
|
||||
{
|
||||
//mprintf((0, "Not stopping loud sound %d.\n", next_handle));
|
||||
next_handle++;
|
||||
if (next_handle >= digi_max_channels)
|
||||
next_handle = 0;
|
||||
ntries++;
|
||||
goto TryNextChannel;
|
||||
}
|
||||
//mprintf((0, "[SS:%d]", next_handle));
|
||||
SampleHandles[next_handle] = -1;
|
||||
}
|
||||
// end edit by adb
|
||||
|
||||
slot = get_free_slot();
|
||||
if (slot < 0)
|
||||
return -1;
|
||||
|
||||
SoundSlots[slot].soundno = soundnum;
|
||||
SoundSlots[slot].samples = Sounddat(soundnum)->data;
|
||||
SoundSlots[slot].length = Sounddat(soundnum)->length;
|
||||
SoundSlots[slot].volume = fixmul(digi_volume, volume);
|
||||
SoundSlots[slot].pan = pan;
|
||||
SoundSlots[slot].position = 0;
|
||||
SoundSlots[slot].looped = 0;
|
||||
SoundSlots[slot].playing = 1;
|
||||
|
||||
memset(&waveformat, 0, sizeof(waveformat));
|
||||
waveformat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
waveformat.wBitsPerSample = Sounddat(soundnum)->bits;
|
||||
waveformat.nChannels = 1;
|
||||
waveformat.nSamplesPerSec = Sounddat(soundnum)->freq; //digi_sample_rate;
|
||||
waveformat.nBlockAlign = waveformat.nChannels * (waveformat.wBitsPerSample / 8);
|
||||
waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign;
|
||||
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_CTRLDEFAULT | DSBCAPS_GETCURRENTPOSITION2;
|
||||
dsbd.dwReserved=0;
|
||||
dsbd.dwBufferBytes = SoundSlots[slot].length;
|
||||
dsbd.lpwfxFormat = &waveformat;
|
||||
|
||||
hr = IDirectSound_CreateSoundBuffer(lpds, &dsbd, &SoundSlots[slot].lpsb, NULL);
|
||||
if (hr != DS_OK)
|
||||
{
|
||||
printf("Createsoundbuffer failed! hr=0x%X\n", (int)hr);
|
||||
abort();
|
||||
}
|
||||
|
||||
{
|
||||
void *ptr1, *ptr2;
|
||||
DWORD len1, len2;
|
||||
|
||||
IDirectSoundBuffer_Lock(SoundSlots[slot].lpsb, 0, Sounddat(soundnum)->length,
|
||||
&ptr1, &len1, &ptr2, &len2, 0);
|
||||
memcpy(ptr1, Sounddat(soundnum)->data, MIN(len1, Sounddat(soundnum)->length));
|
||||
IDirectSoundBuffer_Unlock(SoundSlots[slot].lpsb, ptr1, len1, ptr2, len2);
|
||||
}
|
||||
|
||||
IDirectSoundBuffer_SetPan(SoundSlots[slot].lpsb, ((int)(f2fl(pan) * 20000.0)) - 10000);
|
||||
IDirectSoundBuffer_SetVolume(SoundSlots[slot].lpsb, D1vol2DSvol(SoundSlots[slot].volume));
|
||||
IDirectSoundBuffer_Play(SoundSlots[slot].lpsb, 0, 0, 0);
|
||||
|
||||
// added on 980905 by adb to add sound kill system from original sos digi.c
|
||||
reset_sounds_on_channel(slot);
|
||||
SampleHandles[next_handle] = slot;
|
||||
next_handle++;
|
||||
if (next_handle >= digi_max_channels)
|
||||
next_handle = 0;
|
||||
// end edit by adb
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
// Returns the channel a sound number is playing on, or
|
||||
// -1 if none.
|
||||
int digi_find_channel(int soundno)
|
||||
{
|
||||
if (!digi_initialised)
|
||||
return -1;
|
||||
|
||||
if (soundno < 0 )
|
||||
return -1;
|
||||
|
||||
if (GameSounds[soundno].data == NULL)
|
||||
{
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
|
||||
//FIXME: not implemented
|
||||
return -1;
|
||||
}
|
||||
|
||||
//added on 980905 by adb to add sound kill system from original sos digi.c
|
||||
void reset_sounds_on_channel( int channel )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<digi_max_channels; i++)
|
||||
if (SampleHandles[i] == channel)
|
||||
SampleHandles[i] = -1;
|
||||
}
|
||||
//end edit by adb
|
||||
|
||||
//added on 980905 by adb from original source to make sfx volume work
|
||||
void digi_set_digi_volume( int dvolume )
|
||||
{
|
||||
dvolume = fixmuldiv( dvolume, SOUND_MAX_VOLUME, 0x7fff);
|
||||
if ( dvolume > SOUND_MAX_VOLUME )
|
||||
digi_volume = SOUND_MAX_VOLUME;
|
||||
else if ( dvolume < 0 )
|
||||
digi_volume = 0;
|
||||
else
|
||||
digi_volume = dvolume;
|
||||
|
||||
if ( !digi_initialised ) return;
|
||||
|
||||
digi_sync_sounds();
|
||||
}
|
||||
//end edit by adb
|
||||
|
||||
void digi_set_volume( int dvolume, int mvolume )
|
||||
{
|
||||
digi_set_digi_volume(dvolume);
|
||||
digi_set_midi_volume(mvolume);
|
||||
}
|
||||
|
||||
int digi_is_sound_playing(int soundno)
|
||||
{
|
||||
int i;
|
||||
|
||||
soundno = digi_xlat_sound(soundno);
|
||||
|
||||
for (i = 0; i < MAX_SOUND_SLOTS; i++)
|
||||
//changed on 980905 by adb: added SoundSlots[i].playing &&
|
||||
if (SoundSlots[i].playing && SoundSlots[i].soundno == soundno)
|
||||
//end changes by adb
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//added on 980905 by adb to make sound channel setting work
|
||||
void digi_set_max_channels(int n) {
|
||||
digi_max_channels = n;
|
||||
|
||||
if ( digi_max_channels < 1 )
|
||||
digi_max_channels = 1;
|
||||
if (digi_max_channels > MAX_SOUND_SLOTS)
|
||||
digi_max_channels = MAX_SOUND_SLOTS;
|
||||
|
||||
if ( !digi_initialised ) return;
|
||||
|
||||
digi_reset_digi_sounds();
|
||||
}
|
||||
|
||||
int digi_get_max_channels() {
|
||||
return digi_max_channels;
|
||||
}
|
||||
// end edit by adb
|
||||
|
||||
void digi_reset_digi_sounds() {
|
||||
int i;
|
||||
|
||||
for (i=0; i< MAX_SOUND_SLOTS; i++) {
|
||||
DS_release_slot(i, 1);
|
||||
}
|
||||
|
||||
//added on 980905 by adb to reset sound kill system
|
||||
memset(SampleHandles, 255, sizeof(SampleHandles));
|
||||
next_handle = 0;
|
||||
//end edit by adb
|
||||
}
|
||||
|
||||
int digi_is_channel_playing(int channel)
|
||||
{
|
||||
if (!digi_initialised)
|
||||
return 0;
|
||||
|
||||
return SoundSlots[channel].playing;
|
||||
}
|
||||
|
||||
void digi_set_channel_volume(int channel, int volume)
|
||||
{
|
||||
if (!digi_initialised)
|
||||
return;
|
||||
|
||||
if (!SoundSlots[channel].playing)
|
||||
return;
|
||||
|
||||
SoundSlots[channel].volume = fixmuldiv(volume, digi_volume, F1_0);
|
||||
}
|
||||
|
||||
void digi_set_channel_pan(int channel, int pan)
|
||||
{
|
||||
if (!digi_initialised)
|
||||
return;
|
||||
|
||||
if (!SoundSlots[channel].playing)
|
||||
return;
|
||||
|
||||
SoundSlots[channel].pan = pan;
|
||||
}
|
||||
|
||||
void digi_stop_sound(int channel)
|
||||
{
|
||||
SoundSlots[channel].playing=0;
|
||||
SoundSlots[channel].soundobj = -1;
|
||||
SoundSlots[channel].persistent = 0;
|
||||
}
|
||||
|
||||
void digi_end_sound(int channel)
|
||||
{
|
||||
if (!digi_initialised)
|
||||
return;
|
||||
|
||||
if (!SoundSlots[channel].playing)
|
||||
return;
|
||||
|
||||
SoundSlots[channel].soundobj = -1;
|
||||
SoundSlots[channel].persistent = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
int digi_midi_song_playing = 0;
|
||||
static int digi_initialised = 0;
|
||||
int midi_volume = 255;
|
||||
|
||||
int digi_get_settings() { return 0; }
|
||||
int digi_init() { digi_initialised = 1; return 0; }
|
||||
void digi_reset() {}
|
||||
void digi_close() {}
|
||||
|
||||
void digi_set_digi_volume( int dvolume ) {}
|
||||
void digi_set_volume( int dvolume, int mvolume ) {}
|
||||
|
||||
int digi_is_sound_playing(int soundno) { return 0; }
|
||||
|
||||
void digi_set_max_channels(int n) {}
|
||||
int digi_get_max_channels() { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_SOUND
|
||||
// MIDI stuff follows.
|
||||
|
||||
void digi_stop_current_song()
|
||||
{
|
||||
if ( digi_midi_song_playing ) {
|
||||
hmp_close(hmp);
|
||||
hmp = NULL;
|
||||
digi_midi_song_playing = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void digi_set_midi_volume( int n )
|
||||
{
|
||||
int mm_volume;
|
||||
|
||||
if (n < 0)
|
||||
midi_volume = 0;
|
||||
else if (n > 127)
|
||||
midi_volume = 127;
|
||||
else
|
||||
midi_volume = n;
|
||||
|
||||
// scale up from 0-127 to 0-0xffff
|
||||
mm_volume = (midi_volume << 1) | (midi_volume & 1);
|
||||
mm_volume |= (mm_volume << 8);
|
||||
|
||||
if (hmp)
|
||||
midiOutSetVolume((HMIDIOUT)hmp->hmidi, mm_volume | mm_volume << 16);
|
||||
}
|
||||
|
||||
void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop )
|
||||
{
|
||||
if (!digi_initialised) return;
|
||||
|
||||
digi_stop_current_song();
|
||||
|
||||
//added on 5/20/99 by Victor Rachels to fix crash/etc
|
||||
if(filename == NULL) return;
|
||||
if(midi_volume < 1) return;
|
||||
//end this section addition - VR
|
||||
|
||||
if ((hmp = hmp_open(filename))) {
|
||||
hmp_play(hmp,play);
|
||||
digi_midi_song_playing = 1;
|
||||
digi_set_midi_volume(midi_volume);
|
||||
}
|
||||
else
|
||||
printf("hmp_open failed\n");
|
||||
}
|
||||
void digi_pause_midi() {}
|
||||
void digi_resume_midi() {}
|
||||
|
||||
#else
|
||||
void digi_stop_current_song() {}
|
||||
void digi_set_midi_volume( int n ) {}
|
||||
void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop ) {}
|
||||
void digi_pause_midi() {}
|
||||
void digi_resume_midi() {}
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
void digi_debug()
|
||||
{
|
||||
int i;
|
||||
int n_voices = 0;
|
||||
|
||||
if (!digi_initialised)
|
||||
return;
|
||||
|
||||
for (i = 0; i < digi_max_channels; i++)
|
||||
{
|
||||
if (digi_is_channel_playing(i))
|
||||
n_voices++;
|
||||
}
|
||||
|
||||
mprintf_at((0, 2, 0, "DIGI: Active Sound Channels: %d/%d (HMI says %d/32) ", n_voices, digi_max_channels, -1));
|
||||
//mprintf_at((0, 3, 0, "DIGI: Number locked sounds: %d ", digi_total_locks ));
|
||||
}
|
||||
#endif
|
|
@ -85,11 +85,9 @@ typedef struct Arg
|
|||
int MplIpNoGetMyAddr;
|
||||
char *MplIpMyAddr;
|
||||
int MplIpBasePort;
|
||||
#ifdef EDITOR
|
||||
char *EdiAutoLoad;
|
||||
int EdiMacData;
|
||||
int EdiSaveHoardData;
|
||||
#endif
|
||||
int EdiMacData; // also used for some read routines in non-editor build
|
||||
int DbgVerbose;
|
||||
int DbgNoRun;
|
||||
int DbgRenderStats;
|
||||
|
@ -97,9 +95,11 @@ typedef struct Arg
|
|||
char *DbgTexMap;
|
||||
int DbgShowMemInfo;
|
||||
int DbgUseDoubleBuffer;
|
||||
int DbgBigPig;
|
||||
int DbgNoMovies;
|
||||
#ifdef OGL
|
||||
int DbgAltTexMerge;
|
||||
int DbgBpp
|
||||
#endif
|
||||
} __attribute__ ((packed)) Arg;
|
||||
|
||||
|
|
|
@ -96,8 +96,6 @@ extern void digi_stop_all();
|
|||
extern void digi_set_max_channels(int n);
|
||||
extern int digi_get_max_channels();
|
||||
|
||||
extern int digi_lomem;
|
||||
|
||||
extern int digi_xlat_sound(int soundno);
|
||||
|
||||
extern void digi_stop_sound( int channel );
|
||||
|
|
|
@ -96,15 +96,13 @@ int N_active_sound_objects=0;
|
|||
|
||||
int digi_sounds_initialized=0;
|
||||
|
||||
int digi_lomem = 0;
|
||||
|
||||
/* Find the sound which actually equates to a sound number */
|
||||
int digi_xlat_sound(int soundno)
|
||||
{
|
||||
if (soundno < 0)
|
||||
return -1;
|
||||
|
||||
if (digi_lomem)
|
||||
if (GameArg.SysLowMem)
|
||||
{
|
||||
soundno = AltSounds[soundno];
|
||||
if (soundno == 255)
|
||||
|
@ -119,7 +117,7 @@ int digi_xlat_sound(int soundno)
|
|||
int digi_unxlat_sound(int soundno)
|
||||
{
|
||||
int i;
|
||||
ubyte *table = (digi_lomem?AltSounds:Sounds);
|
||||
ubyte *table = (GameArg.SysLowMem?AltSounds:Sounds);
|
||||
|
||||
if ( soundno < 0 ) return -1;
|
||||
|
||||
|
|
|
@ -238,27 +238,15 @@ void print_commandline_help()
|
|||
printf( " -tmap <s> %s\n", "Select texmapper to use (c,fp,quad,i386,pent,ppro)");
|
||||
printf( " -showmeminfo %s\n", "Show memory statistics");
|
||||
printf( " -nodoublebuffer %s\n", "Disable Doublebuffering");
|
||||
printf( " -bigpig %s\n", "Use uncompressed RLE bitmaps");
|
||||
printf( " -nomovies %s\n", "Don't play movies");
|
||||
#ifdef OGL
|
||||
printf( " -gl_oldtexmerge %s\n", "Use old texmerge, uses more ram, but _might_ be a bit faster");
|
||||
printf( " -gl_16bpp %s\n", "Use 16Bpp Color Depth");
|
||||
#endif
|
||||
|
||||
/* KEPT FOR FURTHER REFERENCE
|
||||
printf( "\n Unused / Obsolete:\n\n");
|
||||
printf( " -bigpig %s\n", "FIXME: Undocumented");
|
||||
printf( " -bspgen %s\n", "FIXME: Undocumented");
|
||||
printf( " -checktime %s\n", "FIXME: Undocumented");
|
||||
printf( " -jasen %s\n", "FIXME: Undocumented");
|
||||
printf( " -memdbg %s\n", "FIXME: Undocumented");
|
||||
printf( " -monodebug %s\n", "FIXME: Undocumented");
|
||||
printf( " -nocyberman %s\n", "FIXME: Undocumented");
|
||||
printf( " -nomatrixcheat %s\n", "FIXME: Undocumented");
|
||||
printf( " -showaddress %s\n", "FIXME: Undocumented");
|
||||
printf( " -socket %s\n", "FIXME: Undocumented");
|
||||
printf( " -nomodex %s\n", "FIXME: Undocumented");
|
||||
printf( " -specialdevice %s\n", "FIXME: Undocumented");
|
||||
printf( " -stickmag %s\n", "FIXME: Undocumented");
|
||||
printf( " -stopwatch %s\n", "FIXME: Undocumented");
|
||||
printf( " -sysram %s\n", "FIXME: Undocumented");
|
||||
printf( " -tsengdebug1 %s\n", "FIXME: Undocumented");
|
||||
printf( " -tsengdebug2 %s\n", "FIXME: Undocumented");
|
||||
|
|
|
@ -60,10 +60,7 @@ int main(int argc,char **argv){
|
|||
error_init(NULL);
|
||||
signal(SIGINT,int_handler);//make ctrl-c do cleanup stuff.
|
||||
InitArgs(argc,argv);
|
||||
#ifndef NDEBUG
|
||||
if ( FindArg( "-showmeminfo" ) )
|
||||
show_mem_info = 1; // Make memory statistics show
|
||||
#endif
|
||||
|
||||
myport=UDP_SERV_BASEPORT;
|
||||
if(arch_ip_open_socket(myport))
|
||||
return 1;
|
||||
|
|
|
@ -865,15 +865,6 @@ void network_welcome_player(sequence_packet *their)
|
|||
|
||||
WaitForRefuseAnswer=0;
|
||||
|
||||
if (FindArg("-NoMatrixCheat"))
|
||||
{
|
||||
if ((their->player.version_minor & 0x0F) < 3)
|
||||
{
|
||||
network_dump_player(their->player.network.ipx.server, their->player.network.ipx.node, DUMP_DORK);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (HoardEquipped())
|
||||
{
|
||||
// If hoard game, and this guy isn't D2 Christmas (v1.2), dump him
|
||||
|
@ -3046,7 +3037,7 @@ int network_get_game_params( char * game_name, int *mode, int *game_flags, int *
|
|||
if (!select_mission(1, TXT_MULTI_MISSION))
|
||||
return -1;
|
||||
|
||||
if (!(FindArg ("-packets") && Netgame.ShortPackets))
|
||||
if (!Netgame.ShortPackets)
|
||||
if (!network_choose_connect ())
|
||||
return -1;
|
||||
|
||||
|
|
24
main/piggy.c
24
main/piggy.c
|
@ -126,7 +126,6 @@ ubyte * Piggy_bitmap_cache_data = NULL;
|
|||
static int GameBitmapOffset[MAX_BITMAP_FILES];
|
||||
static ubyte GameBitmapFlags[MAX_BITMAP_FILES];
|
||||
ushort GameBitmapXlat[MAX_BITMAP_FILES];
|
||||
int macdata = 0;
|
||||
|
||||
#define PIGGY_BUFFER_SIZE (2400*1024)
|
||||
|
||||
|
@ -217,8 +216,6 @@ void DiskBitmapHeader_d1_read(DiskBitmapHeader *dbh, CFILE *fp)
|
|||
dbh->offset = cfile_read_int(fp);
|
||||
}
|
||||
|
||||
ubyte BigPig = 0;
|
||||
|
||||
#ifdef MACINTOSH
|
||||
extern short cd_VRefNum;
|
||||
extern void ConcatPStr(StringPtr dst, StringPtr src);
|
||||
|
@ -268,7 +265,7 @@ bitmap_index piggy_register_bitmap( grs_bitmap * bmp, char * name, int in_file )
|
|||
if ( GameArg.EdiMacData )
|
||||
swap_0_255( bmp );
|
||||
#endif
|
||||
if ( !BigPig ) gr_bitmap_rle_compress( bmp );
|
||||
if ( !GameArg.DbgBigPig ) gr_bitmap_rle_compress( bmp );
|
||||
Num_bitmap_files_new++;
|
||||
}
|
||||
|
||||
|
@ -860,10 +857,10 @@ void piggy_new_pigfile(char *pigname)
|
|||
bm[fnum]->avg_color = compute_average_pixel(bm[fnum]);
|
||||
|
||||
#ifdef EDITOR
|
||||
if ( macdata )
|
||||
if ( GameArg.EdiMacData )
|
||||
swap_0_255( bm[fnum] );
|
||||
#endif
|
||||
if ( !BigPig ) gr_bitmap_rle_compress( bm[fnum] );
|
||||
if ( !GameArg.DbgBigPig ) gr_bitmap_rle_compress( bm[fnum] );
|
||||
|
||||
if (bm[fnum]->bm_flags & BM_FLAG_RLE)
|
||||
size = *((int *) bm[fnum]->bm_data);
|
||||
|
@ -913,10 +910,10 @@ void piggy_new_pigfile(char *pigname)
|
|||
new->avg_color = compute_average_pixel(new);
|
||||
|
||||
#ifdef EDITOR
|
||||
if ( macdata )
|
||||
if ( GameArg.EdiMacData )
|
||||
swap_0_255( new );
|
||||
#endif
|
||||
if ( !BigPig ) gr_bitmap_rle_compress( new );
|
||||
if ( !GameArg.DbgBigPig ) gr_bitmap_rle_compress( new );
|
||||
|
||||
if (new->bm_flags & BM_FLAG_RLE)
|
||||
size = *((int *) new->bm_data);
|
||||
|
@ -1168,12 +1165,7 @@ int piggy_init(void)
|
|||
GameBitmapOffset[0] = 0;
|
||||
}
|
||||
|
||||
if ( FindArg( "-bigpig" ))
|
||||
BigPig = 1;
|
||||
|
||||
if (GameArg.SysLowMem)
|
||||
digi_lomem = 1;
|
||||
|
||||
gr_set_curfont( SMALL_FONT );
|
||||
gr_set_fontcolor(gr_find_closest_color_current( 20, 20, 20 ),-1 );
|
||||
gr_printf( 0x8000, grd_curcanv->cv_h-20, "%s...", TXT_LOADING_DATA );
|
||||
|
@ -1197,7 +1189,7 @@ int piggy_is_needed(int soundnum)
|
|||
{
|
||||
int i;
|
||||
|
||||
if ( !digi_lomem ) return 1;
|
||||
if ( !GameArg.SysLowMem ) return 1;
|
||||
|
||||
for (i=0; i<MAX_SOUNDS; i++ ) {
|
||||
if ( (AltSounds[i] < 255) && (Sounds[AltSounds[i]] == soundnum) )
|
||||
|
@ -1338,7 +1330,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
|
|||
#ifndef MACDATA
|
||||
switch (pigsize) {
|
||||
default:
|
||||
if (!macdata)
|
||||
if (!GameArg.EdiMacData)
|
||||
break;
|
||||
// otherwise, fall through...
|
||||
case MAC_ALIEN1_PIGSIZE:
|
||||
|
@ -1380,7 +1372,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
|
|||
#ifndef MACDATA
|
||||
switch (pigsize) {
|
||||
default:
|
||||
if (!macdata)
|
||||
if (!GameArg.EdiMacData)
|
||||
break;
|
||||
// otherwise, fall through...
|
||||
case MAC_ALIEN1_PIGSIZE:
|
||||
|
|
|
@ -315,9 +315,6 @@ polymodel *read_model_file(polymodel *pm,char *filename,robot_info *r)
|
|||
if (version < PM_COMPATIBLE_VERSION || version > PM_OBJFILE_VERSION)
|
||||
Error("Bad version (%d) in model file <%s>",version,filename);
|
||||
|
||||
if ( FindArg( "-bspgen" ))
|
||||
printf( "bspgen -c1" );
|
||||
|
||||
while (new_pof_read_int(id,model_buf) == 1) {
|
||||
id = INTEL_INT(id);
|
||||
//id = pof_read_int(model_buf);
|
||||
|
@ -339,18 +336,6 @@ polymodel *read_model_file(polymodel *pm,char *filename,robot_info *r)
|
|||
pof_read_vecs(&pmmin,1,model_buf);
|
||||
pof_read_vecs(&pmmax,1,model_buf);
|
||||
|
||||
if ( FindArg( "-bspgen" )) {
|
||||
vms_vector v;
|
||||
fix l;
|
||||
|
||||
vm_vec_sub(&v, &pmmax, &pmmin );
|
||||
l = v.x;
|
||||
if ( v.y > l ) l = v.y;
|
||||
if ( v.z > l ) l = v.z;
|
||||
|
||||
printf( " -l%.3f", f2fl(l) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -482,20 +467,6 @@ polymodel *read_model_file(polymodel *pm,char *filename,robot_info *r)
|
|||
pof_cfseek(model_buf,next_chunk,SEEK_SET);
|
||||
}
|
||||
|
||||
// for (i=0;i<pm->n_models;i++)
|
||||
// pm->submodel_ptrs[i] += (int) pm->model_data;
|
||||
|
||||
if ( FindArg( "-bspgen" )) {
|
||||
char *p = strchr( filename, '.' );
|
||||
*p = 0;
|
||||
|
||||
if ( anim_flag > 1 )
|
||||
printf( " -a" );
|
||||
|
||||
printf( " %s.3ds\n", filename );
|
||||
*p = '.';
|
||||
}
|
||||
|
||||
d_free(model_buf);
|
||||
|
||||
#ifdef WORDS_NEED_ALIGNMENT
|
||||
|
|
10
main/slew.c
10
main/slew.c
|
@ -100,18 +100,12 @@ int do_slew_movement(object *obj, int check_keys, int check_joy )
|
|||
|
||||
if (check_keys) {
|
||||
if (Function_mode == FMODE_EDITOR) {
|
||||
if (FindArg("-jasen"))
|
||||
obj->mtype.phys_info.velocity.x += VEL_SPEED * (key_down_time(KEY_PAD3) - key_down_time(KEY_PAD1));
|
||||
else
|
||||
obj->mtype.phys_info.velocity.x += VEL_SPEED * (key_down_time(KEY_PAD9) - key_down_time(KEY_PAD7));
|
||||
obj->mtype.phys_info.velocity.x += VEL_SPEED * (key_down_time(KEY_PAD9) - key_down_time(KEY_PAD7));
|
||||
obj->mtype.phys_info.velocity.y += VEL_SPEED * (key_down_time(KEY_PADMINUS) - key_down_time(KEY_PADPLUS));
|
||||
obj->mtype.phys_info.velocity.z += VEL_SPEED * (key_down_time(KEY_PAD8) - key_down_time(KEY_PAD2));
|
||||
|
||||
rotang.p = (key_down_time(KEY_LBRACKET) - key_down_time(KEY_RBRACKET))/ROT_SPEED ;
|
||||
if (FindArg("-jasen"))
|
||||
rotang.b = (key_down_time(KEY_PAD7) - key_down_time(KEY_PAD9))/ROT_SPEED;
|
||||
else
|
||||
rotang.b = (key_down_time(KEY_PAD1) - key_down_time(KEY_PAD3))/ROT_SPEED;
|
||||
rotang.b = (key_down_time(KEY_PAD1) - key_down_time(KEY_PAD3))/ROT_SPEED;
|
||||
rotang.h = (key_down_time(KEY_PAD6) - key_down_time(KEY_PAD4))/ROT_SPEED;
|
||||
}
|
||||
else {
|
||||
|
|
20
misc/args.c
20
misc/args.c
|
@ -413,21 +413,31 @@ void ReadCmdArgs(void)
|
|||
else
|
||||
GameArg.DbgShowMemInfo = 0;
|
||||
|
||||
if (FindArg("-nomovies"))
|
||||
GameArg.DbgNoMovies = 1;
|
||||
else
|
||||
GameArg.DbgNoMovies = 0;
|
||||
|
||||
if (FindArg("-nodoublebuffer"))
|
||||
GameArg.DbgUseDoubleBuffer = 0;
|
||||
else
|
||||
GameArg.DbgUseDoubleBuffer = 1;
|
||||
|
||||
if (FindArg("-bigpig"))
|
||||
GameArg.DbgBigPig = 0;
|
||||
else
|
||||
GameArg.DbgBigPig = 1;
|
||||
|
||||
if (FindArg("-nomovies"))
|
||||
GameArg.DbgNoMovies = 1;
|
||||
else
|
||||
GameArg.DbgNoMovies = 0;
|
||||
|
||||
#ifdef OGL
|
||||
if (FindArg("-gl_oldtexmerge"))
|
||||
GameArg.DbgAltTexMerge = 0;
|
||||
else
|
||||
GameArg.DbgAltTexMerge = 1;
|
||||
|
||||
if (FindArg("-gl_16bpp"))
|
||||
GameArg.GlBpp = 16;
|
||||
else
|
||||
GameArg.GlBpp = 32;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue