diff --git a/ack_lib/ACKSND.C b/ack_lib/ACKSND.C deleted file mode 100644 index 3c19b28..0000000 --- a/ack_lib/ACKSND.C +++ /dev/null @@ -1,348 +0,0 @@ -/******************* ( Animation Construction Kit 3D ) ***********************/ -/* Sound Routines: play CMF, VOC files in background on SB, Adlib or speaker */ -/* CopyRight (c) 1993 Authors: Lary Myers & Frank Sachse */ -/*****************************************************************************/ - -//***************************** WARNING ************************************** -// NOTE: The Worx sound functions have NOT been converted to flat model. -// **** DO NOT USE THESE FUNCTIONS!!!! **** -//***************************** WARNING ************************************** - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ack3d.h" -#include "ackeng.h" -#include "ackext.h" - -#include "acksnd.h" -#include "worx.h" - -static short SoundDevice; - -void AckPlayNoSound(short index); -void AckPlayPCSpeaker(short index); -void AckPlayAdlib(short index); -void AckPlaySoundBlaster(short index); -short AckPlayMusic(char *MusicFile); - -short IRQ; /* SB */ - char *Cmf; - char *VocTable[SOUND_MAX_INDEX+1]; - - -/**************************************************************************** -** Call into here by the application before using any of the sound routines** -** The default sound device can be used as an overide, such as when the ** -** application or user doesn't want any sound. ** -****************************************************************************/ -short AckSoundInitialize(short DefaultSoundDevice) -{ - -if (DefaultSoundDevice == DEV_NOSOUND) - { - SoundDevice = DefaultSoundDevice; - return(0); - } - -/* Checks for sound board & sets SoundDevice to DEV_ define in ACKSND.H */ - -/* for use only with WORX lib, not WORXlite... -StartWorx(); -*/ - -StartWorx(); - -if (DefaultSoundDevice == DEV_PCSPEAKER) - { - SoundDevice = DefaultSoundDevice; - return(0); - } - -if (AdlibDetect()) - { - SoundDevice = DEV_ADLIB; - SetFMVolume(0xf,0xf); - } -else - SoundDevice = DEV_PCSPEAKER; - -if (DefaultSoundDevice == DEV_ADLIB) - { - SoundDevice = DEV_ADLIB; - return(0); - } - -IRQ = DSPReset(); -if (IRQ > 0) - { - SoundDevice = DEV_SOUNDBLASTER; - SetMasterVolume(0xf,0xf); - SetVOCVolume(0xf,0xf); - } - -#if 0 -/* for use only with WORX lib, not WORXlite... -IRQ = DSPReset() - if > 0, then SB present -if (WorxPresent()) /* use only with WORXlite */ - { - SoundDevice = DEV_SOUNDBLASTER; - SetMasterVolume(0xf,0xf); - SetVOCVolume(0xf,0xf); - } -*/ -#endif - -return(0); -} - -/**************************************************************************** -** Here the application can call in and load the VOC files that it needs ** -** ** -****************************************************************************/ -short AckLoadSound(short VocIndex,char *VocFile) -{ - char buf[81]; - -if (SoundDevice == DEV_NOSOUND) - return(0); - -if (VocIndex < 0 || VocIndex > SOUND_MAX_INDEX) - return(-1); /* index out of range */ - -strcpy(buf,VocFile); -strtok(buf,"."); - -switch (SoundDevice) - { - case DEV_SOUNDBLASTER: - strcat(buf,".VOC"); /* force extension */ - break; - - case DEV_ADLIB: /* adlib can't play voc's -> put thru pc spkr */ - case DEV_PCSPEAKER: - #if 0 - strcat(buf,".PWM"); /* force extension */ - #endif - strcat(buf,".VOC"); /* force extension */ - break; - - default: - return(-2); /* Error if unknown device */ - } - -VocTable[VocIndex] = LoadOneShot(buf); /* load voc/pwm into mem */ - -if (VocTable[VocIndex] == NULL) - return(-2); /* file not found */ - -return(0); -} - -/**************************************************************************** -** ** -****************************************************************************/ -void AckStopBackground(void) -{ - -switch (SoundDevice) - { - - case DEV_NOSOUND: - break; - - case DEV_PCSPEAKER: - break; - - case DEV_SOUNDBLASTER: - if (SequencePlaying()) - StopSequence(); - break; - - case DEV_ADLIB: - if (SequencePlaying()) - StopSequence(); - break; - - default: - break; - } - -} - - -/**************************************************************************** -** The Application would call this routine to begin playing background ** -** music. ** -** ** -****************************************************************************/ -short AckPlayBackground(char *MusicFile) -{ - short result = 0; - -switch (SoundDevice) - { - - case DEV_NOSOUND: - break; - - case DEV_PCSPEAKER: - break; - - case DEV_SOUNDBLASTER: - result = AckPlayMusic(MusicFile); - break; - - case DEV_ADLIB: - result = AckPlayMusic(MusicFile); - break; - - default: - break; - } - -return(result); -} - - -/**************************************************************************** -** Start the music file playing in this routine. ** -** ** -****************************************************************************/ -short AckPlayMusic(char *MusicFile) -{ - char *BufPtr; - char buf[81]; - -strcpy(buf,MusicFile); -strtok(buf,"."); /* force CMF extention */ -strcat(buf,".CMF"); - -Cmf = GetSequence(buf); /* load cmf into mem */ - -if(Cmf==NULL) - return(1); - -SetLoopMode(1); /* set for continuous play */ -PlayCMFBlock(Cmf); /* play background cmf */ - -return(0); -} - - -/**************************************************************************** -** Call into here to play a particular sound. The indexes available are ** -** listed in ACKSND.H which will be included by the application. ** -** ** -****************************************************************************/ -void AckPlaySound(short SoundIndex) -{ - -switch (SoundDevice) - { - - case DEV_NOSOUND: - break; - - case DEV_PCSPEAKER: - AckPlayPCSpeaker(SoundIndex); - break; - - case DEV_SOUNDBLASTER: - AckPlaySoundBlaster(SoundIndex); - break; - - case DEV_ADLIB: /* can't play VOC's on Adlib -> play thru speaker */ - AckPlayPCSpeaker(SoundIndex); - break; - - default: - break; - } - -} - - -/**************************************************************************** -** This routine is used for simple speaker sounds. The ones here are for ** -** testing at this point. Better ones would be need to be in the final ** -** version. ** -****************************************************************************/ -/* I will adjust this later to play VOC's thru speaker x*/ -void AckPlayPCSpeaker(short index) -{ - -if (VocTable[index] == NULL || index < 0 || index > SOUND_MAX_INDEX) - return; - -PlayPWMBlock(VocTable[index]); - -} - - -/**************************************************************************** -** Sound Blaster routines go here. ** -** ** -** ** -****************************************************************************/ -void AckPlaySoundBlaster(short index) -{ - -if (VocTable[index] == NULL || index < 0 || index > SOUND_MAX_INDEX) - return; - -PlayVOCBlock(VocTable[index],255); - -} - - -/**************************************************************************** -** Call into here by the application before exiting. ** -****************************************************************************/ -void AckSoundShutdown(void) -{ - -switch (SoundDevice) - { - - case DEV_NOSOUND: - break; - - case DEV_PCSPEAKER: - CloseWorx(); - break; - - case DEV_SOUNDBLASTER: - if (SequencePlaying()) - StopSequence(); /* stop background CMF, if playing */ - DSPClose(); /* free Sound Blaster DSP */ - /* for use only with WORX lib, not WORXlite... - CloseWorx(); - */ - CloseWorx(); - break; - - case DEV_ADLIB: - if (SequencePlaying()) - StopSequence(); - /* for use only with WORX lib, not WORXlite... - CloseWorx(); - */ - break; - - default: - break; - } - -} - - \ No newline at end of file diff --git a/ack_lib/ACKSND.H b/ack_lib/ACKSND.H deleted file mode 100644 index f3e0bb1..0000000 --- a/ack_lib/ACKSND.H +++ /dev/null @@ -1,35 +0,0 @@ -/* Header file to accompany ACKSND.C */ - -#define DEV_NOSOUND 0 -#define DEV_PCSPEAKER 1 -#define DEV_SOUNDBLASTER 2 -#define DEV_ADLIB 3 - -#define SOUND_WALKING 0 -#define SOUND_HITWALL 1 -#define SOUND_HITOBJECT 2 -#define SOUND_HITBADOBJECT 3 -#define SOUND_DOOROPENING 4 -#define SOUND_SECRETDOOROPENING 5 -#define SOUND_FIRING 6 -#define SOUND_DOORCLOSING 7 -#define SOUND_LOST 8 -#define SOUND_WON 9 -#define SOUND_INTRO 10 -#define SOUND_EXPLODE 11 -#define SOUND_USER1 12 -#define SOUND_USER2 13 -#define SOUND_USER3 14 -#define SOUND_USER4 15 - -#define SOUND_MAX_INDEX 15 - - -short AckSoundInitialize(short DefaultSoundDevice); -short AckPlayBackground(char *MusicFile); -void AckPlaySound(short SoundIndex); -void AckSoundShutdown(void); -void AckStopBackground(void); -short AckLoadSound(short VocIndex,char *VocFileName); - - \ No newline at end of file diff --git a/ack_lib/WING.H b/ack_lib/WING.H deleted file mode 100644 index 84038ce..0000000 --- a/ack_lib/WING.H +++ /dev/null @@ -1,78 +0,0 @@ -/*****************************************************************************\ -* -* wing.h - WinG functions, types, and definitions -* -* Copyright (c) 1994 Microsoft Corp. All rights reserved. -* -\*****************************************************************************/ - -#ifndef _INC_WING -#define _INC_WING - -#ifndef _INC_WINDOWS -#include /* Include windows.h if not already included */ -#endif - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif - -#if defined(WIN32) || defined(_WIN32) -#define WINGAPI WINAPI -#else -#define WINGAPI WINAPI _loadds -#endif - - -/***** WingDC and WinGBitmap *************************************************/ - -HDC WINGAPI WinGCreateDC( void ); - -BOOL WINGAPI WinGRecommendDIBFormat( BITMAPINFO FAR *pFormat ); - -HBITMAP WINGAPI WinGCreateBitmap( HDC WinGDC, BITMAPINFO const FAR *pHeader, - void FAR *FAR *ppBits ); - -void FAR *WINGAPI WinGGetDIBPointer( HBITMAP WinGBitmap, - BITMAPINFO FAR *pHeader ); - -UINT WINGAPI WinGGetDIBColorTable( HDC WinGDC, UINT StartIndex, - UINT NumberOfEntries, RGBQUAD FAR *pColors ); - -UINT WINGAPI WinGSetDIBColorTable( HDC WinGDC, UINT StartIndex, - UINT NumberOfEntries, RGBQUAD const FAR *pColors ); - - -/***** Halftoning ************************************************************/ - -HPALETTE WINGAPI WinGCreateHalftonePalette( void ); - -typedef enum WING_DITHER_TYPE -{ - WING_DISPERSED_4x4, - WING_DISPERSED_8x8, - - WING_CLUSTERED_4x4 - -} WING_DITHER_TYPE; - -HBRUSH WINGAPI WinGCreateHalftoneBrush( HDC Context, COLORREF crColor, - WING_DITHER_TYPE DitherType ); - - -/***** Blts ******************************************************************/ - -BOOL WINGAPI WinGBitBlt( HDC hdcDest, int nXOriginDest, - int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, - int nXOriginSrc, int nYOriginSrc ); - -BOOL WINGAPI WinGStretchBlt( HDC hdcDest, int nXOriginDest, - int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, - int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc ); - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif - -#endif // _INC_WING - diff --git a/ack_lib/WINGDLL.H b/ack_lib/WINGDLL.H deleted file mode 100644 index 685f1fa..0000000 --- a/ack_lib/WINGDLL.H +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// WINGDLL.H -// -// Interface class for WinG. -///////////////////////////////////////////////////////////////////////////// - -#ifndef _INC_WINGDLL -#define _INC_WINGDLL - -typedef HDC (WINAPI *wingCreateDC)( void ); -typedef BOOL (WINAPI *wingRecommendDIBFormat)( BITMAPINFO FAR *pFormat ); -typedef HBITMAP (WINAPI *wingCreateBitmap)( HDC WinGDC, BITMAPINFO const *pHeader, - void *ppBits ); -typedef void FAR *(WINAPI *wingGetDIBPointer)( HBITMAP WinGBitmap, - BITMAPINFO FAR *pHeader ); -typedef UINT (WINAPI *wingGetDIBColorTable)( HDC WinGDC, UINT StartIndex, - UINT NumberOfEntries, RGBQUAD FAR *pColors ); -typedef UINT (WINAPI *wingSetDIBColorTable)( HDC WinGDC, UINT StartIndex, - UINT NumberOfEntries, RGBQUAD const FAR *pColors ); -typedef HPALETTE (WINAPI *wingCreateHalftonePalette)( void ); -typedef HBRUSH (WINAPI *wingCreateHalftoneBrush)( HDC, COLORREF, - WING_DITHER_TYPE); -typedef BOOL (WINAPI *wingBitBlt)( HDC hdcDest, int nXOriginDest, - int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, - int nXOriginSrc, int nYOriginSrc ); -typedef BOOL (WINAPI *wingStretchBlt)( HDC hdcDest, int nXOriginDest, - int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, - int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc ); - - -class WinGdll { - -public: - WinGdll(); - ~WinGdll(); - - BOOL Load(); - BOOL Free(); - - HINSTANCE m_hLib; - BOOL m_bLoaded; - - //I would have used m_ prefix, but too laborious to type when using - //the class. Would have inlined the function pointers, - //without typedef's, but the compiler didn't like it. - //Anyway, this method makes casting GetProcAddress() - //easier. - wingCreateDC pCreateDC; - wingRecommendDIBFormat pRecommendDIBFormat; - wingCreateBitmap pCreateBitmap; - wingGetDIBPointer pGetDIBPointer; - wingGetDIBColorTable pGetDIBColorTable; - wingSetDIBColorTable pSetDIBColorTable; - wingCreateHalftonePalette pCreateHalftonePalette; - wingCreateHalftoneBrush pCreateHalftoneBrush; - wingBitBlt pBitBlt; - wingStretchBlt pStretchBlt; -} ; - -#endif // _INC_WINGDLL