Add some sound fixes and documentation
This commit is contained in:
parent
85ccda7829
commit
788e5ea2d8
1 changed files with 27 additions and 4 deletions
|
@ -86,6 +86,13 @@ void EndDirectSound(void)
|
||||||
lpDS = NULL;
|
lpDS = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Below are two completely unused functions for loading .wav files as sound effects.
|
||||||
|
// Some say that sounds heard in CS Beta footage don't sound like PixTone...
|
||||||
|
|
||||||
|
// There's a bit of a problem with this code: it hardcodes the offsets of various bits
|
||||||
|
// of data in the WAV header - this makes the code only compatible with very specific
|
||||||
|
// .wav files. You can check the prototype OrgView EXEs for examples of those.
|
||||||
|
|
||||||
// サウンドの設定 (Sound settings)
|
// サウンドの設定 (Sound settings)
|
||||||
BOOL InitSoundObject(LPCSTR resname, int no)
|
BOOL InitSoundObject(LPCSTR resname, int no)
|
||||||
{
|
{
|
||||||
|
@ -131,8 +138,6 @@ BOOL InitSoundObject(LPCSTR resname, int no)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Completely unused function for loading a .wav file as a sound effect.
|
|
||||||
// Some say that sounds heard in CS Beta footage don't sound like PixTone...
|
|
||||||
BOOL LoadSoundObject(LPCSTR file_name, int no)
|
BOOL LoadSoundObject(LPCSTR file_name, int no)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
@ -158,8 +163,16 @@ BOOL LoadSoundObject(LPCSTR file_name, int no)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (i = 0; i < 58; i++)
|
for (i = 0; i < 58; i++)
|
||||||
fread(&check_box[i], sizeof(char), 1, fp);
|
fread(&check_box[i], sizeof(char), 1, fp); // Holy hell, this is inefficient
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
// The original code forgets to close 'fp'
|
||||||
|
if (check_box[0] != 'R' || check_box[1] != 'I' || check_box[2] != 'F' || check_box[3] != 'F')
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (check_box[0] != 'R')
|
if (check_box[0] != 'R')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (check_box[1] != 'I')
|
if (check_box[1] != 'I')
|
||||||
|
@ -168,13 +181,23 @@ BOOL LoadSoundObject(LPCSTR file_name, int no)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (check_box[3] != 'F')
|
if (check_box[3] != 'F')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
DWORD *wp;
|
DWORD *wp;
|
||||||
wp = (DWORD*)malloc(file_size); // ファイルのワークスペースを作る (Create a file workspace)
|
wp = (DWORD*)malloc(file_size); // ファイルのワークスペースを作る (Create a file workspace)
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (wp == NULL)
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
for (i = 0; i < file_size; i++)
|
for (i = 0; i < file_size; i++)
|
||||||
fread((BYTE*)wp+i, sizeof(BYTE), 1, fp);
|
fread((BYTE*)wp+i, sizeof(BYTE), 1, fp); // Pixel, stahp
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue