]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Add a pretty and desactivable damage bar.
[lugaru.git] / Source / GameTick.cpp
index 691fa5622542a1c583692461d5e56f4a5c5e06fa..ae0366d8f76d1d5a9fb1d9ac0d79b3c5c1bb6c64 100644 (file)
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <ctime>
 #include "Game.h"
+#include "openal_wrapper.h"
 
 using namespace std;
 
@@ -37,7 +38,7 @@ extern XYZ viewer;
 extern int environment;
 extern float texscale;
 extern Terrain terrain;
-extern FSOUND_SAMPLE   *samp[100];
+extern OPENAL_SAMPLE   *samp[100];
 extern int channels[100];
 extern Sprites sprites;
 extern int kTextureSize;
@@ -75,8 +76,6 @@ extern bool mousejump;
 extern float viewdistance;
 extern bool freeze;
 extern bool autoslomo;
-extern int newnetmessages;
-extern char netmessages[256];
 extern bool keyboardfrozen;
 extern int netdatanew;
 extern bool loadingstuff;
@@ -101,6 +100,7 @@ extern bool foliage;
 extern bool trilinear;
 extern bool damageeffects;
 extern bool showpoints;
+extern bool showdamagebar; // (des)activate the damage bar
 extern bool texttoggle;
 extern bool alwaysblur;
 extern float gamespeed;
@@ -223,10 +223,35 @@ extern float accountcampaigntime[10];
 
 extern int accountcampaignchoicesmade[10];
 extern int accountcampaignchoices[10][5000];
+
+static const char *rabbitskin[] = {
+":Data:Textures:Fur3.jpg",
+":Data:Textures:Fur.jpg",
+":Data:Textures:Fur2.jpg",
+":Data:Textures:Lynx.jpg",
+":Data:Textures:Otter.jpg",
+":Data:Textures:Opal.jpg",
+":Data:Textures:Sable.jpg",
+":Data:Textures:Chocolate.jpg",
+":Data:Textures:BW2.jpg",
+":Data:Textures:WB2.jpg"
+};
+
+static const char *wolfskin[] = {
+":Data:Textures:Wolf.jpg",
+":Data:Textures:Darkwolf.jpg",
+":Data:Textures:Snowwolf.jpg"
+};
+
+#define STATIC_ASSERT(x) extern int s_a_dummy[2 * (!!(x)) - 1];
+STATIC_ASSERT (rabbittype == 0 && wolftype == 1)
+
+static const char **creatureskin[] = {rabbitskin, wolfskin};
+
 /********************> Tick() <*****/
-extern FSOUND_STREAM * strm[20];
-extern "C"     void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
-extern "C" void PlayStreamEx(int chan, FSOUND_STREAM *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
+extern OPENAL_STREAM * strm[20];
+extern "C"     void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
+extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
 
 extern void ScreenShot(const char * fname);
 void Screenshot        (void)
@@ -236,7 +261,12 @@ void Screenshot    (void)
        struct  tm *tme = localtime(&t);
        sprintf(temp, "Screenshots\\Screenshot_%04d_%02d_%02d--%02d_%02d_%02d.png", tme->tm_year + 1900, tme->tm_mon + 1, tme->tm_mday, tme->tm_hour, tme->tm_min, tme->tm_sec);
 
+       #if defined(_WIN32)
+       mkdir("Screenshots");
+       #else
        mkdir("Screenshots", S_IRWXU);
+       #endif
+
        ScreenShot(temp/*"Screenshots\\Screenshot.png"*/);
 
        /*FSSpec                                MAC_file;
@@ -620,17 +650,17 @@ void      Game::Setenvironment(int which)
        float temptexdetail;
        environment=which;
 /*
-       FSOUND_SetPaused(channels[music1snow], true);
-       FSOUND_SetPaused(channels[music1grass], true);
-       FSOUND_SetPaused(channels[music1desert], true);
-       FSOUND_SetPaused(channels[wind], true);
-       FSOUND_SetPaused(channels[desertambient], true);
+       OPENAL_SetPaused(channels[music1snow], true);
+       OPENAL_SetPaused(channels[music1grass], true);
+       OPENAL_SetPaused(channels[music1desert], true);
+       OPENAL_SetPaused(channels[wind], true);
+       OPENAL_SetPaused(channels[desertambient], true);
 */
-       FSOUND_SetPaused(channels[stream_music1snow], true);
-       FSOUND_SetPaused(channels[stream_music1grass], true);
-       FSOUND_SetPaused(channels[stream_music1desert], true);
-       FSOUND_SetPaused(channels[stream_wind], true);
-       FSOUND_SetPaused(channels[stream_desertambient], true);
+       OPENAL_SetPaused(channels[stream_music1snow], true);
+       OPENAL_SetPaused(channels[stream_music1grass], true);
+       OPENAL_SetPaused(channels[stream_music1desert], true);
+       OPENAL_SetPaused(channels[stream_wind], true);
+       OPENAL_SetPaused(channels[stream_desertambient], true);
 
 
        if(environment==snowyenvironment){
@@ -639,8 +669,8 @@ void        Game::Setenvironment(int which)
                if(ambientsound){
                        //PlaySoundEx( wind, samp[wind], NULL, true);
                        PlayStreamEx(stream_wind, strm[stream_wind], 0, true);
-                       FSOUND_SetPaused(channels[stream_wind], false);
-                       FSOUND_SetVolume(channels[stream_wind], 256);
+                       OPENAL_SetPaused(channels[stream_wind], false);
+                       OPENAL_SetVolume(channels[stream_wind], 256);
                }
 
                LoadTexture(":Data:Textures:snowtree.png",&objects.treetextureptr,0,1);
@@ -648,18 +678,18 @@ void      Game::Setenvironment(int which)
                LoadTexture(":Data:Textures:bouldersnow.jpg",&objects.rocktextureptr,1,0);
                LoadTexture(":Data:Textures:snowbox.jpg",&objects.boxtextureptr,1,0);
 
-               FSOUND_Sample_Free(samp[footstepsound]);
-               FSOUND_Sample_Free(samp[footstepsound2]);
-               FSOUND_Sample_Free(samp[footstepsound3]);
-               FSOUND_Sample_Free(samp[footstepsound4]);
-               samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0, 0);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+               OPENAL_Sample_Free(samp[footstepsound]);
+               OPENAL_Sample_Free(samp[footstepsound2]);
+               OPENAL_Sample_Free(samp[footstepsound3]);
+               OPENAL_Sample_Free(samp[footstepsound4]);
+               samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
 
                LoadTexture(":Data:Textures:snow.jpg",&terraintexture,1,0);
 
@@ -698,22 +728,22 @@ void      Game::Setenvironment(int which)
                if(ambientsound){
                        //PlaySoundEx( desertambient, samp[desertambient], NULL, true);
                        PlayStreamEx( stream_desertambient, strm[stream_desertambient], NULL, true);
-                       FSOUND_SetPaused(channels[stream_desertambient], false);
-                       FSOUND_SetVolume(channels[stream_desertambient], 256);
+                       OPENAL_SetPaused(channels[stream_desertambient], false);
+                       OPENAL_SetVolume(channels[stream_desertambient], 256);
                }
 
-               FSOUND_Sample_Free(samp[footstepsound]);
-               FSOUND_Sample_Free(samp[footstepsound2]);
-               FSOUND_Sample_Free(samp[footstepsound3]);
-               FSOUND_Sample_Free(samp[footstepsound4]);
-               samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+               OPENAL_Sample_Free(samp[footstepsound]);
+               OPENAL_Sample_Free(samp[footstepsound2]);
+               OPENAL_Sample_Free(samp[footstepsound3]);
+               OPENAL_Sample_Free(samp[footstepsound4]);
+               samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
 
                LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0);
 
@@ -749,22 +779,22 @@ void      Game::Setenvironment(int which)
 
                if(ambientsound){
                        PlayStreamEx( stream_wind, strm[stream_wind], NULL, true);
-                       FSOUND_SetPaused(channels[stream_wind], false);
-                       FSOUND_SetVolume(channels[stream_wind], 100);
+                       OPENAL_SetPaused(channels[stream_wind], false);
+                       OPENAL_SetVolume(channels[stream_wind], 100);
                }
 
-               FSOUND_Sample_Free(samp[footstepsound]);
-               FSOUND_Sample_Free(samp[footstepsound2]);
-               FSOUND_Sample_Free(samp[footstepsound3]);
-               FSOUND_Sample_Free(samp[footstepsound4]);
-               samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepgrass1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepgrass2.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0, 0);
-               samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0, 0);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
-               FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
+               OPENAL_Sample_Free(samp[footstepsound]);
+               OPENAL_Sample_Free(samp[footstepsound2]);
+               OPENAL_Sample_Free(samp[footstepsound3]);
+               OPENAL_Sample_Free(samp[footstepsound4]);
+               samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass2.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0);
+               samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
+               OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
 
                LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0);
 
@@ -876,15 +906,18 @@ void      Game::Loadlevel(char *name){
        if(!firstload){
                oldlevel=50;
        }
-       FSOUND_SetPaused(channels[whooshsound], true);
-       FSOUND_SetPaused(channels[stream_firesound], true);
+       OPENAL_SetPaused(channels[whooshsound], true);
+       OPENAL_SetPaused(channels[stream_firesound], true);
+
+       // Change the map filename into something that is os specific
+       char *FixedFN = ConvertFileName(name);
 
        int mapvers;
        FILE                    *tfile;
-       tfile=fopen( name, "rb" );
+       tfile=fopen( FixedFN, "rb" );
        if(tfile)
        {
-               FSOUND_SetPaused(channels[stream_firesound], true);
+               OPENAL_SetPaused(channels[stream_firesound], true);
 
 
                scoreadded=0;
@@ -956,8 +989,8 @@ void        Game::Loadlevel(char *name){
                if(console)
                {
                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                       OPENAL_SetPaused(channels[consolesuccesssound], false);
                        freeze=0;
                        console=0;
                }
@@ -1379,52 +1412,7 @@ void     Game::Loadlevel(char *name){
                        //if(!player[i].loaded)player[i].skeleton.skinText = new GLubyte[texsize];
                        //player[i].skeleton.skinText.resize(texsize);
 
-                       if(player[i].creature==rabbittype)
-                       {
-                               if(player[i].whichskin==0){
-                                       LoadTextureSave(":Data:Textures:Fur3.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==1){
-                                       LoadTextureSave(":Data:Textures:Fur.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==2){
-                                       LoadTextureSave(":Data:Textures:Fur2.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==3){
-                                       LoadTextureSave(":Data:Textures:Lynx.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==4){
-                                       LoadTextureSave(":Data:Textures:Otter.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==5){
-                                       LoadTextureSave(":Data:Textures:Opal.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==6){
-                                       LoadTextureSave(":Data:Textures:Sable.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==7){
-                                       LoadTextureSave(":Data:Textures:Chocolate.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==8){
-                                       LoadTextureSave(":Data:Textures:BW2.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==9){
-                                       LoadTextureSave(":Data:Textures:WB2.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                       }
-                       if(player[i].creature==wolftype)
-                       {
-                               //k=abs(Random()%3);
-                               if(player[i].whichskin==0){
-                                       LoadTextureSave(":Data:Textures:Wolf.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==1){
-                                       LoadTextureSave(":Data:Textures:Darkwolf.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                               else if(player[i].whichskin==2){
-                                       LoadTextureSave(":Data:Textures:Snowwolf.jpg",&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
-                               }
-                       }
+                       LoadTextureSave(creatureskin[player[i].creature][player[i].whichskin],&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
 
                        if(player[i].numclothes)
                        {
@@ -1602,19 +1590,19 @@ void    Game::Loadlevel(char *name){
 
 /*             for(i=0;i<32;i++){
                        //if(i<16||i>20)
-                       FSOUND_StopSound(i);
+                       OPENAL_StopSound(i);
                }
 */
                LOG("Starting background music...");
 
-               FSOUND_StopSound(FSOUND_ALL);
+               OPENAL_StopSound(OPENAL_ALL);
                if(environment==snowyenvironment)
                {
                        if(ambientsound)
                        {
                                PlayStreamEx(stream_wind, strm[stream_wind], NULL, true);
-                               FSOUND_SetPaused(channels[stream_wind], false);
-                               FSOUND_SetVolume(channels[stream_wind], 256);
+                               OPENAL_SetPaused(channels[stream_wind], false);
+                               OPENAL_SetVolume(channels[stream_wind], 256);
                        }
                }
                else if(environment==desertenvironment)
@@ -1625,8 +1613,8 @@ void      Game::Loadlevel(char *name){
                                //      samp[desertambient], NULL, true);
                                PlayStreamEx(stream_desertambient,
                                        strm[stream_desertambient], NULL, true);
-                               FSOUND_SetPaused(channels[stream_desertambient], false);
-                               FSOUND_SetVolume(channels[stream_desertambient], 256);
+                               OPENAL_SetPaused(channels[stream_desertambient], false);
+                               OPENAL_SetVolume(channels[stream_desertambient], 256);
                        }
                }
                else if(environment==grassyenvironment)
@@ -1635,8 +1623,8 @@ void      Game::Loadlevel(char *name){
                        {
                                //PlaySoundEx(wind, samp[wind], NULL, true);
                                PlayStreamEx(stream_wind, strm[stream_wind], NULL, true);
-                               FSOUND_SetPaused(channels[stream_wind], false);
-                               FSOUND_SetVolume(channels[stream_wind], 100);
+                               OPENAL_SetPaused(channels[stream_wind], false);
+                               OPENAL_SetVolume(channels[stream_wind], 100);
                        }
                }
                oldmusicvolume[0]=0;
@@ -1685,36 +1673,6 @@ void     Game::Tick()
 
        float headprop,bodyprop,armprop,legprop;
 
-       if(newnetmessages){
-               newnetmessages=0;
-               PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-               FSOUND_SetVolume(channels[consolesuccesssound], 256);
-               FSOUND_SetPaused(channels[consolesuccesssound], false);
-
-               for(k=14;k>=2;k--){
-                       for(j=0;j<255;j++){
-                               consoletext[k][j]=consoletext[k-1][j];
-                       }
-                       consolechars[k]=consolechars[k-1];
-               }
-               for(k=14;k>=2;k--){
-                       for(j=0;j<255;j++){
-                               displaytext[k][j]=displaytext[k-1][j];
-                       }
-                       displaychars[k]=displaychars[k-1];
-                       displaytime[k]=displaytime[k-1];
-               }
-               for(j=0;j<255;j++){
-                       consoletext[1][j]=' ';
-                       displaytext[1][j]=' ';
-               }
-               sprintf (consoletext[1], netmessages);
-               sprintf (displaytext[1], netmessages);
-               consolechars[1]=255;
-               displaychars[1]=255;
-               displaytime[1]=0;
-       }
-
        for(i=0;i<15;i++){
                displaytime[i]+=multiplier;
        }
@@ -1737,7 +1695,7 @@ void      Game::Tick()
                        entername=0;
                        mainmenutogglekeydown=1;
                }
-               if((IsKeyDown(theKeyMap, MAC_ESCAPE_KEY)||(mainmenu==0&&((IsKeyDown(theKeyMap, jumpkey)||IsKeyDown(theKeyMap, MAC_SPACE_KEY)||(campaign)))&&!oldjumpkeydown&&campaign&&winfreeze))&&!mainmenutogglekeydown&&(!mainmenu||gameon||mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||(mainmenu==7&&!entername)||mainmenu==9||mainmenu==11||(mainmenu==12&&!tryquit)||mainmenu==13||mainmenu==14||mainmenu==15||mainmenu==16||mainmenu==17||mainmenu==10)){
+               if((IsKeyDown(theKeyMap, MAC_ESCAPE_KEY)||(mainmenu==0&&((IsKeyDown(theKeyMap, jumpkey)||IsKeyDown(theKeyMap, MAC_SPACE_KEY)||(campaign)))&&!oldjumpkeydown&&campaign&&winfreeze))&&!mainmenutogglekeydown&&(!mainmenu||gameon||mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||(mainmenu==7&&!entername)||mainmenu==9||mainmenu==11||mainmenu==13||mainmenu==17||mainmenu==10)){
                        selected=-1;
                        if(mainmenu==1||mainmenu==2||mainmenu==0){
                                if(mainmenu==0&&!winfreeze)mainmenu=2;
@@ -1750,12 +1708,12 @@ void    Game::Tick()
                                        if(!stealthloading){
                                        float gLoc[3]={0,0,0};
                                        float vel[3]={0,0,0};
-                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                        PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                       FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                       FSOUND_SetVolume(channels[firestartsound], 256);
-                                       FSOUND_SetPaused(channels[firestartsound], false);
-                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                       OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                       OPENAL_SetVolume(channels[firestartsound], 256);
+                                       OPENAL_SetPaused(channels[firestartsound], false);
+                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                        flashr=1;
                                        flashg=0;
@@ -1828,34 +1786,34 @@ void    Game::Tick()
                                        campaign=1;
                                        mainmenu=0;
                                        gameon=1;
-                                       FSOUND_SetPaused(channels[music3], true);
+                                       OPENAL_SetPaused(channels[music3], true);
 
                                        stealthloading=0;*/
                                }
                                else if(mainmenu==1||mainmenu==2)mainmenu=0;
                                if(mainmenu&&musictoggle){
                                        if(mainmenu==1||mainmenu==2||mainmenu==100){
-                                               FSOUND_SetFrequency(FSOUND_ALL, 0.001);
+                                               OPENAL_SetFrequency(OPENAL_ALL, 0.001);
                                                PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                                               FSOUND_SetPaused(channels[stream_music3], false);
-                                               FSOUND_SetVolume(channels[stream_music3], 256);
-                                               FSOUND_SetPaused(channels[music1], true);
+                                               OPENAL_SetPaused(channels[stream_music3], false);
+                                               OPENAL_SetVolume(channels[stream_music3], 256);
+                                               OPENAL_SetPaused(channels[music1], true);
                                        }
                                }
                                if(!mainmenu){
-                                       FSOUND_SetPaused(channels[stream_music3], true);
-                                       FSOUND_SetPaused(channels[music1], false);
+                                       OPENAL_SetPaused(channels[stream_music3], true);
+                                       OPENAL_SetPaused(channels[music1], false);
                                }
                        }
                        if(mainmenu==3){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -1865,10 +1823,6 @@ void     Game::Tick()
 
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -1946,17 +1900,19 @@ void    Game::Tick()
                                opstream << KeyToChar(attackkey);
                                opstream << "\nChat key:\n";
                                opstream << KeyToChar(chatkey);
+                               opstream << "\nDamage bar:\n";
+                               opstream << showdamagebar;
                                opstream.close();
                        }
-                       if(mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==9||mainmenu==12||mainmenu==13||mainmenu==14||mainmenu==10||mainmenu==11||mainmenu==100){
+                       if(mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==9||mainmenu==13||mainmenu==10||mainmenu==11||mainmenu==100){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -1973,9 +1929,7 @@ void      Game::Tick()
                        if(mainmenu==7)mainmenu=1;
                        if(mainmenu==9)mainmenu=5;
                        if(mainmenu==11)mainmenu=5;
-                       if(mainmenu==12)mainmenu=5;
                        if(mainmenu==13)mainmenu=12;
-                       if(mainmenu==14)mainmenu=13;
                        if(mainmenu==10)mainmenu=5;
                        if(mainmenu==100){
                                mainmenu=5;
@@ -2004,8 +1958,8 @@ void      Game::Tick()
                if(tutorialstage!=51)
                        tutorialstagetime=tutorialmaxtime;
                PlaySoundEx( consolefailsound, samp[consolefailsound], NULL, true);
-               FSOUND_SetVolume(channels[consolefailsound], 128);
-               FSOUND_SetPaused(channels[consolefailsound], false);
+               OPENAL_SetVolume(channels[consolefailsound], 128);
+               OPENAL_SetPaused(channels[consolefailsound], false);
                minimaptogglekeydown=1;
        }
        if(!IsKeyDown(theKeyMap, MAC_TAB_KEY)){
@@ -2019,12 +1973,12 @@ void    Game::Tick()
                                if(!gameon){
                                        float gLoc[3]={0,0,0};
                                        float vel[3]={0,0,0};
-                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                        PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                       FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                       FSOUND_SetVolume(channels[firestartsound], 256);
-                                       FSOUND_SetPaused(channels[firestartsound], false);
-                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                       OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                       OPENAL_SetVolume(channels[firestartsound], 256);
+                                       OPENAL_SetPaused(channels[firestartsound], false);
+                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                        flashr=1;
                                        flashg=0;
@@ -2047,26 +2001,26 @@ void    Game::Tick()
                                        }
                                        mainmenu=0;
                                        gameon=1;
-                                       FSOUND_SetPaused(channels[music3], true);       */
+                                       OPENAL_SetPaused(channels[music3], true);       */
                                }
                                else
                                {
                                        //resume
                                        mainmenu=0;
-                                       FSOUND_SetPaused(channels[stream_music3], true);
-                                       FSOUND_SetPaused(channels[music1], false);
+                                       OPENAL_SetPaused(channels[stream_music3], true);
+                                       OPENAL_SetPaused(channels[music1], false);
                                }
                        }
 
                        if(Button()&&!oldbutton&&selected==2){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2089,12 +2043,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==3){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2105,7 +2059,7 @@ void      Game::Tick()
                                if(!gameon){
                                        //quit
                                        tryquit=1;
-                                       if(registered)FSOUND_SetPaused(channels[stream_music3], true);
+                                       OPENAL_SetPaused(channels[stream_music3], true);
                                }
                                else{
                                        //end game
@@ -2121,15 +2075,15 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected!=-1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                        }
                        if(Button()&&!oldbutton&&selected==0){
-                               #if USE_SDL
+                       
                                extern SDL_Rect **resolutions;
                                bool isCustomResolution = true;
                                bool found = false;
@@ -2174,56 +2128,7 @@ void     Game::Tick()
                                        newscreenheight = (int) resolutions[0]->h;
                                }
 
-                               #else
-                               int whichres;
-                               whichres=-1;
-                               if(newscreenwidth==640&&newscreenheight==480)whichres=0;
-                               if(newscreenwidth==800&&newscreenheight==600)whichres=1;
-                               if(newscreenwidth==1024&&newscreenheight==768)whichres=2;
-                               if(newscreenwidth==1280&&newscreenheight==1024)whichres=3;
-                               if(newscreenwidth==1600&&newscreenheight==1200)whichres=4;
-                               if(newscreenwidth==840&&newscreenheight==524)whichres=5;
-                               if(newscreenwidth==1024&&newscreenheight==640)whichres=6;
-                               if(newscreenwidth==1344&&newscreenheight==840)whichres=7;
-                               if(newscreenwidth==1920&&newscreenheight==1200)whichres=8;
-
-                               if(whichres==-1||whichres==8){
-                                       newscreenwidth=640;
-                                       newscreenheight=480;
-                               }
-                               if(whichres==0){
-                                       newscreenwidth=800;
-                                       newscreenheight=600;
-                               }
-                               if(whichres==1){
-                                       newscreenwidth=1024;
-                                       newscreenheight=768;
-                               }
-                               if(whichres==2){
-                                       newscreenwidth=1280;
-                                       newscreenheight=1024;
-                               }
-                               if(whichres==3){
-                                       newscreenwidth=1600;
-                                       newscreenheight=1200;
-                               }
-                               if(whichres==4){
-                                       newscreenwidth=840;
-                                       newscreenheight=524;
-                               }
-                               if(whichres==5){
-                                       newscreenwidth=1024;
-                                       newscreenheight=640;
-                               }
-                               if(whichres==6){
-                                       newscreenwidth=1344;
-                                       newscreenheight=840;
-                               }
-                               if(whichres==7){
-                                       newscreenwidth=1920;
-                                       newscreenheight=1200;
-                               }
-                               #endif
+                               
                        }
                        if(Button()&&!oldbutton&&selected==1){
                                newdetail++;
@@ -2247,9 +2152,9 @@ void      Game::Tick()
                                musictoggle=1-musictoggle;
 
                                if(!musictoggle){
-                                       FSOUND_SetPaused(channels[music1], true);
-                                       FSOUND_SetPaused(channels[stream_music2], true);
-                                       FSOUND_SetPaused(channels[stream_music3], true);
+                                       OPENAL_SetPaused(channels[music1], true);
+                                       OPENAL_SetPaused(channels[stream_music2], true);
+                                       OPENAL_SetPaused(channels[stream_music3], true);
 
                                        for(i=0;i<4;i++){
                                                oldmusicvolume[i]=0;
@@ -2259,8 +2164,8 @@ void      Game::Tick()
 
                                if(musictoggle){
                                        PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                                       FSOUND_SetPaused(channels[stream_music3], false);
-                                       FSOUND_SetVolume(channels[stream_music3], 256);
+                                       OPENAL_SetPaused(channels[stream_music3], false);
+                                       OPENAL_SetVolume(channels[stream_music3], 256);
                                }
                        }
                        if(Button()&&!oldbutton&&selected==9){
@@ -2273,17 +2178,17 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==11){
                                volume+=.1f;
                                if(volume>1.0001f)volume=0;
-                               FSOUND_SetSFXMasterVolume((int)(volume*255));
+                               OPENAL_SetSFXMasterVolume((int)(volume*255));
                        }
                        if(Button()&&!oldbutton&&selected==7){
                                /*float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                                */
                                flashr=1;
                                flashg=0;
@@ -2299,12 +2204,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==8){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2314,10 +2219,6 @@ void     Game::Tick()
 
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -2396,6 +2297,8 @@ void      Game::Tick()
                                opstream << KeyToChar(attackkey);
                                opstream << "\nChat key:\n";
                                opstream << KeyToChar(chatkey);
+                               opstream << "\nDamage bar:\n";
+                               opstream << showdamagebar;
                                opstream.close();
 
                                if(mainmenu==3&&gameon)mainmenu=2;
@@ -2408,12 +2311,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected!=-1&&keyselect==-1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                        }
                        if(Button()&&!oldbutton&&selected<9&&keyselect==-1){
                                keyselect=selected;
@@ -2429,12 +2332,12 @@ void    Game::Tick()
                                                if(i!=MAC_ESCAPE_KEY&&(strcmp(KeyToChar(i),"unknown")||(buttons[0]&&!oldbuttons[0]&&!oldbutton)||(buttons[1]&&!oldbuttons[1]&&!oldbutton))){
                                                        float gLoc[3]={0,0,0};
                                                        float vel[3]={0,0,0};
-                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                                                       OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                       FSOUND_SetPaused(channels[fireendsound], false);
-                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                                                       OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                       OPENAL_SetPaused(channels[fireendsound], false);
+                                                       OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                                        int keynum;
                                                        keynum=i;
@@ -2459,12 +2362,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==9){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2484,33 +2387,6 @@ void     Game::Tick()
                }
 
                if(mainmenu==5){
-                       if(accountcampaignchoicesmade[accountactive]>8&&!registered){
-                               FSOUND_SetFrequency(FSOUND_ALL, 0.001);
-                               PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                               FSOUND_SetPaused(channels[stream_music3], false);
-                               FSOUND_SetVolume(channels[stream_music3], 256);
-
-                               gameon=0;
-                               mainmenu=12;
-                               accountcampaignchoicesmade[accountactive]=0;
-                               accountcampaignscore[accountactive]=0;
-                               accountcampaigntime[accountactive]=0;
-
-                               float gLoc[3]={0,0,0};
-                               float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                               PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                               flashr=1;
-                               flashg=0;
-                               flashb=0;
-                               flashamount=1;
-                               flashdelay=1;
-                       }
 
                        if(endgame==2){
                                accountcampaignchoicesmade[accountactive]=0;
@@ -2522,12 +2398,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2548,17 +2424,17 @@ void    Game::Tick()
 
                                mainmenu=0;
                                gameon=1;
-                               FSOUND_SetPaused(channels[stream_music3], true);
+                               OPENAL_SetPaused(channels[stream_music3], true);
                        }
                        if(Button()&&!oldbutton&&selected-7>=accountcampaignchoicesmade[accountactive]){//selected>=7&&(selected-7<=campaignnumchoices)){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2598,17 +2474,17 @@ void    Game::Tick()
                                campaign=1;
                                mainmenu=0;
                                gameon=1;
-                               FSOUND_SetPaused(channels[stream_music3], true);
+                               OPENAL_SetPaused(channels[stream_music3], true);
                        }
                        if(Button()&&!oldbutton&&selected==4){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2622,12 +2498,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==5){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2640,12 +2516,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==3){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2658,12 +2534,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==2){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2680,12 +2556,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected<numchallengelevels&&selected>=0&&selected<=accountprogress[accountactive]){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2707,17 +2583,17 @@ void    Game::Tick()
 
                                mainmenu=0;
                                gameon=1;
-                               FSOUND_SetPaused(channels[stream_music3], true);
+                               OPENAL_SetPaused(channels[stream_music3], true);
                        }
                        if(Button()&&!oldbutton&&selected==numchallengelevels){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2734,12 +2610,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected<numchallengelevels&&selected>=0&&selected<=accountprogress[accountactive]){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2761,17 +2637,17 @@ void    Game::Tick()
 
                                mainmenu=0;
                                gameon=1;
-                               FSOUND_SetPaused(channels[stream_music3], true);
+                               OPENAL_SetPaused(channels[stream_music3], true);
                        }
                        if(Button()&&!oldbutton&&selected==numchallengelevels){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2789,12 +2665,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==3){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2808,114 +2684,26 @@ void   Game::Tick()
                        else oldbutton=0;
                }
 
-               if(mainmenu==15||mainmenu==16){
-                       if(Button()&&!oldbutton&&selected==1){
-                               float gLoc[3]={0,0,0};
-                               float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                               PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                               flashr=1;
-                               flashg=0;
-                               flashb=0;
-                               flashamount=1;
-                               flashdelay=1;
-
-                               if(mainmenu==15)mainmenu=5;
-                               else mainmenu=12;
-                       }
-                       if(Button())oldbutton=1;
-                       else oldbutton=0;
-               }
-
-               if(mainmenu==12){
-                       endgame=2;
-                       if(Button()&&!oldbutton&&selected==3){
-                               if(tryquit)quit=1;
-                               float gLoc[3]={0,0,0};
-                               float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                               PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                               flashr=1;
-                               flashg=0;
-                               flashb=0;
-                               flashamount=1;
-                               flashdelay=1;
-
-                               mainmenu=5;
-                       }
-
-                       if(Button()&&!oldbutton&&selected==4){
-                               registernow=1;
-                               quit=1;
-                               float gLoc[3]={0,0,0};
-                               float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                               PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                               flashr=1;
-                               flashg=0;
-                               flashb=0;
-                               flashamount=1;
-                               flashdelay=1;
-                       }
-
-
-                       if(Button()&&!oldbutton&&selected==5){
-                               tryquit=0;
-                               float gLoc[3]={0,0,0};
-                               float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                               PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                               flashr=1;
-                               flashg=0;
-                               flashb=0;
-                               flashamount=1;
-                               flashdelay=1;
-
-                               mainmenu=13;
-                       }
-                       if(Button())oldbutton=1;
-                       else oldbutton=0;
-               }
                if(mainmenu==6){
                        if(Button()&&!oldbutton&&selected!=-1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                        }
                        if(Button()&&!oldbutton&&selected==1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2956,12 +2744,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==2){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -2978,12 +2766,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected!=-1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
                        }
                        if(Button()&&!oldbutton&&selected==0&&numaccounts<8){
                                entername=1;
@@ -3000,12 +2788,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected==numaccounts+1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[fireendsound], 256);
-                               FSOUND_SetPaused(channels[fireendsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[fireendsound], 256);
+                               OPENAL_SetPaused(channels[fireendsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                flashr=1;
                                flashg=0;
@@ -3029,12 +2817,12 @@ void    Game::Tick()
                        if(Button()&&!oldbutton&&selected!=-1){
                                float gLoc[3]={0,0,0};
                                float vel[3]={0,0,0};
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                               FSOUND_SetVolume(channels[firestartsound], 256);
-                               FSOUND_SetPaused(channels[firestartsound], false);
-                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                               OPENAL_SetVolume(channels[firestartsound], 256);
+                               OPENAL_SetPaused(channels[firestartsound], false);
+                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                if(selected==0)accountdifficulty[accountactive]=0;
                                if(selected==1)accountdifficulty[accountactive]=1;
@@ -3062,10 +2850,6 @@ void     Game::Tick()
                        if(mainmenu==3){
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -3143,6 +2927,8 @@ void      Game::Tick()
                                opstream << KeyToChar(attackkey);
                                opstream << "\nChat key:\n";
                                opstream << KeyToChar(chatkey);
+                               opstream << "\nDamage bar:\n";
+                               opstream << showdamagebar;
                                opstream.close();
                        }
                }
@@ -3156,9 +2942,9 @@ void      Game::Tick()
                                loaddistrib=0;
                        }
                }
-               FSOUND_SetFrequency(channels[stream_music3], 22050);
+               OPENAL_SetFrequency(channels[stream_music3], 22050);
 
-               if(entername||mainmenu==13||mainmenu==14){
+               if(entername){
                        for(i=0;i<140;i++){
                                if(IsKeyDown(theKeyMap, i)){
                                        togglekeydelay[i]+=multiplier;
@@ -3228,12 +3014,12 @@ void    Game::Tick()
 
                                                                float gLoc[3]={0,0,0};
                                                                float vel[3]={0,0,0};
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[firestartsound], 256);
-                                                               FSOUND_SetPaused(channels[firestartsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[firestartsound], 256);
+                                                               OPENAL_SetPaused(channels[firestartsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                                                for(j=0;j<255;j++){
                                                                        displaytext[0][j]=' ';
@@ -3244,114 +3030,13 @@ void   Game::Tick()
                                                                displayselected=0;
                                                        }}
 
-                                               if(i==MAC_RETURN_KEY&&mainmenu==14){
-                                                       if(displaychars[0]){
-                                                               char serialstring[256];
-                                                               char tempstring[256];
-                                                               #if defined(__APPLE__)
-                                                               sprintf (tempstring, "%s", registrationname);
-                                                               #elif defined(_MSC_VER) || defined(__linux__)
-                                                               sprintf (tempstring, "%s-windows", registrationname);
-                                                               #else
-                                                               #error Please make sure you have the right registration key stuff here!
-                                                               #endif
-                                                               long num1;
-                                                               long num2;
-                                                               long num3;
-                                                               long num4;
-                                                               long long longnum;
-                                                               longnum = MD5_string ( tempstring);
-                                                               //longnum = 1111111111111111;
-                                                               num1 = longnum/100000000;
-                                                               num2 = longnum%100000000;
-                                                               sprintf (tempstring, "%d-%d-%d-%d\0\0\0\0\0", num1/10000, num1%10000, num2/10000, num2%10000);
-
-                                                               int goodcode=3;
-                                                               int numchars=3;
-                                                               if(num1/10000>999)numchars+=4;
-                                                               else if(num1/10000>99)numchars+=3;
-                                                               else if(num1/10000>9)numchars+=2;
-                                                               else numchars+=1;
-                                                               if(num1%10000>999)numchars+=4;
-                                                               else if(num1%10000>99)numchars+=3;
-                                                               else if(num1%10000>9)numchars+=2;
-                                                               else numchars+=1;
-                                                               if(num2/10000>999)numchars+=4;
-                                                               else if(num2/10000>99)numchars+=3;
-                                                               else if(num2/10000>9)numchars+=2;
-                                                               else numchars+=1;
-                                                               if(num2%10000>999)numchars+=4;
-                                                               else if(num2%10000>99)numchars+=3;
-                                                               else if(num2%10000>9)numchars+=2;
-                                                               else numchars+=1;
-
-                                                               //numchars=12;
-
-                                                               for(j=0;j<numchars;j++){
-                                                                       if(displaytext[0][j]!=tempstring[j]&&tempstring[j]!=' '&&tempstring[j]!='\0')goodcode--;
-                                                               }
-
-                                                               if(longnum==LONGLONGCONST(5077041556214789))goodcode=-1;
-
-                                                               if(goodcode<0)goodcode=0;
-
-                                                               if(goodcode){
-                                                                       registered=1;
-                                                                       mainmenu=15;
-
-                                                                       FILE                    *tfile;
-                                                                       tfile=fopen( ":Data:Sounds:flame.ogg", "wb" );
-                                                                       if (tfile)
-                                                                       {
-                                                                               int numchars;
-                                                                               numchars=strlen(registrationname);
-                                                                               fpackf(tfile, "Bb", registered);
-                                                                               fpackf(tfile, "Bi", numchars);
-                                                                               if(numchars>0)
-                                                                               {
-                                                                                       for(j=0;j<numchars;j++)
-                                                                                       {
-                                                                                               fpackf(tfile, "Bb",  registrationname[j]);
-                                                                                       }
-                                                                               }
-                                                                               fpackf(tfile, "Bi", num1);
-                                                                               fpackf(tfile, "Bi", num2);
-                                                                               fclose(tfile);
-                                                                       }
-                                                               }
-                                                               else
-                                                               {
-                                                                       mainmenu=16;
-                                                               }
-                                                               flashr=1;
-                                                               flashg=0;
-                                                               flashb=0;
-                                                               flashamount=1;
-                                                               flashdelay=1;
-
-                                                               float gLoc[3]={0,0,0};
-                                                               float vel[3]={0,0,0};
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
-                                                               PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[firestartsound], 256);
-                                                               FSOUND_SetPaused(channels[firestartsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
-
-                                                               for(j=0;j<255;j++){
-                                                                       displaytext[0][j]=' ';
-                                                               }
-                                                               displaychars[0]=0;
-                                                               displayselected=0;
-                                                       }}
-
                                                if(i==MAC_RETURN_KEY&&mainmenu==13){
                                                        if(displaychars[0]){
                                                                sprintf (registrationname, "%s", displaytext[0]);
                                                                if(displaychars[0]<254)registrationname[displaychars[0]]='\0';
 
-                                                               mainmenu=14;
-
+                                                               mainmenu=5;
+                        
                                                                flashr=1;
                                                                flashg=0;
                                                                flashb=0;
@@ -3360,32 +3045,18 @@ void    Game::Tick()
 
                                                                float gLoc[3]={0,0,0};
                                                                float vel[3]={0,0,0};
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[firestartsound], 256);
-                                                               FSOUND_SetPaused(channels[firestartsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[firestartsound], 256);
+                                                               OPENAL_SetPaused(channels[firestartsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                                                for(j=0;j<255;j++){
                                                                        displaytext[0][j]=' ';
                                                                }
                                                                displaychars[0]=0;
-
-                                                               /*char tempstring[50];
-                                                               sprintf (tempstring, registrationname);
-                                                               long num1;
-                                                               long num2;
-                                                               long num3;
-                                                               long num4;
-                                                               long long longnum;
-                                                               longnum = MD5_string ( tempstring);
-                                                               num1 = longnum/100000000;
-                                                               num2 = longnum%100000000;
-                                                               sprintf (displaytext[0], "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
-
-                                                               displaychars[0]=strlen(displaytext[0]);
-                                                               */
+                        
                                                                displayselected=0;
                                                        }}
                                        }
@@ -3497,7 +3168,7 @@ void      Game::Tick()
                if(IsKeyDown(theKeyMap, MAC_V_KEY)&&!freezetogglekeydown&&debugmode){
                        freeze=1-freeze;
                        if(freeze){
-                               FSOUND_SetFrequency(FSOUND_ALL, 0.001);
+                               OPENAL_SetFrequency(OPENAL_ALL, 0.001);
                        }
                        freezetogglekeydown=1;
                }
@@ -3510,7 +3181,7 @@ void      Game::Tick()
                        console=1-console;
                        if(!console)freeze=0;
                        if(console){
-                               FSOUND_SetFrequency(FSOUND_ALL, 0.001);
+                               OPENAL_SetFrequency(OPENAL_ALL, 0.001);
                        }
                        consoletogglekeydown=1;
                }
@@ -3582,8 +3253,8 @@ void      Game::Tick()
                                                        donesomething=0;
                                                        if(Compare(consoletext[0],"quit ",0,4)||Compare(consoletext[0],"exit ",0,4)){
                                                                PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                               FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                               FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                               OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                               OPENAL_SetPaused(channels[consolesuccesssound], false);
                                                                donesomething=1;
                                                                tryquit=1;
                                                        }
@@ -3671,8 +3342,8 @@ void      Game::Tick()
                                                        {
                                                        donesomething=1;
                                                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                       OPENAL_SetPaused(channels[consolesuccesssound], false);
 
                                                        if(consolechars[0]>0){
                                                        for(k=14;k>=1;k--){
@@ -3730,8 +3401,8 @@ void      Game::Tick()
                                                        {
                                                        donesomething=1;
                                                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                       OPENAL_SetPaused(channels[consolesuccesssound], false);
 
                                                        if(consolechars[0]>0){
                                                        for(k=14;k>=1;k--){
@@ -3769,15 +3440,15 @@ void    Game::Tick()
                                                                mapname[consolechars[0]-5+11]='\0';
 
                                                                PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                               FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                               FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                               OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                               OPENAL_SetPaused(channels[consolesuccesssound], false);
 
                                                                int mapvers;
                                                                mapvers=12;
 
 
                                                                FILE                    *tfile;
-                                                               tfile=fopen( mapname, "wb" );
+                                                               tfile=fopen( ConvertFileName(mapname), "wb" );
                                                                fpackf(tfile, "Bi", mapvers);
                                                                //fpackf(tfile, "Bi", indemo);
                                                                fpackf(tfile, "Bi", maptype);
@@ -4093,8 +3764,8 @@ void      Game::Tick()
                                                        mapname[consolechars[0]-5+11]='\0';
 
                                                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                       OPENAL_SetPaused(channels[consolesuccesssound], false);
 
                                                        FILE                    *tfile;
                                                        tfile=fopen( mapname, "wb" );
@@ -4836,9 +4507,9 @@ void      Game::Tick()
                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
                                                                        PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[whichsoundplay], 256);
-                                                                       FSOUND_SetPaused(channels[whichsoundplay], false);
+                                                                       OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[whichsoundplay], 256);
+                                                                       OPENAL_SetPaused(channels[whichsoundplay], false);
                                                                        //}
                                                                }
                                                        }
@@ -4958,36 +4629,8 @@ void     Game::Tick()
                                                                }
 
                                                                player[0].numclothes=0;
-                                                               if(player[0].whichskin==0){
-                                                                       LoadTextureSave(":Data:Textures:Fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==1){
-                                                                       LoadTextureSave(":Data:Textures:Fur.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==2){
-                                                                       LoadTextureSave(":Data:Textures:Fur2.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==3){
-                                                                       LoadTextureSave(":Data:Textures:Lynx.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==4){
-                                                                       LoadTextureSave(":Data:Textures:Otter.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==5){
-                                                                       LoadTextureSave(":Data:Textures:Opal.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==6){
-                                                                       LoadTextureSave(":Data:Textures:Sable.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==7){
-                                                                       LoadTextureSave(":Data:Textures:Chocolate.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==8){
-                                                                       LoadTextureSave(":Data:Textures:BW2.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
-                                                               else if(player[0].whichskin==9){
-                                                                       LoadTextureSave(":Data:Textures:WB2.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
-                                                               }
+                                                               LoadTextureSave(creatureskin[player[0].creature][player[0].whichskin],
+                                                                               &player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
 
                                                                editoractive=typeactive;
                                                                player[0].immobile=0;
@@ -5401,36 +5044,8 @@ void     Game::Tick()
                                                                                }
                                                                        }
                                                                        player[closest].numclothes=0;
-                                                                       if(player[closest].whichskin==0){
-                                                                               LoadTextureSave(":Data:Textures:Fur3.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==1){
-                                                                               LoadTextureSave(":Data:Textures:Fur.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==2){
-                                                                               LoadTextureSave(":Data:Textures:Fur2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==3){
-                                                                               LoadTextureSave(":Data:Textures:Lynx.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==4){
-                                                                               LoadTextureSave(":Data:Textures:Otter.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==5){
-                                                                               LoadTextureSave(":Data:Textures:Opal.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==6){
-                                                                               LoadTextureSave(":Data:Textures:Sable.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==7){
-                                                                               LoadTextureSave(":Data:Textures:Chocolate.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==8){
-                                                                               LoadTextureSave(":Data:Textures:BW2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
-                                                                       else if(player[closest].whichskin==9){
-                                                                               LoadTextureSave(":Data:Textures:WB2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                       }
+                                                                       LoadTextureSave(creatureskin[player[closest].creature][player[closest].whichskin],
+                                                                                       &player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
 
                                                                        donesomething=1;
                                                        }
@@ -5439,37 +5054,8 @@ void     Game::Tick()
                                                                int closest=0;
 
                                                                player[closest].numclothes=0;
-                                                               if(player[closest].whichskin==0){
-                                                                       LoadTextureSave(":Data:Textures:Fur3.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==1){
-                                                                       LoadTextureSave(":Data:Textures:Fur.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==2){
-                                                                       LoadTextureSave(":Data:Textures:Fur2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==3){
-                                                                       LoadTextureSave(":Data:Textures:Lynx.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==4){
-                                                                       LoadTextureSave(":Data:Textures:Otter.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==5){
-                                                                       LoadTextureSave(":Data:Textures:Opal.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==6){
-                                                                       LoadTextureSave(":Data:Textures:Sable.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==7){
-                                                                       LoadTextureSave(":Data:Textures:Chocolate.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==8){
-                                                                       LoadTextureSave(":Data:Textures:BW2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-                                                               else if(player[closest].whichskin==9){
-                                                                       LoadTextureSave(":Data:Textures:WB2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                               }
-
+                                                               LoadTextureSave(creatureskin[player[closest].creature][player[closest].whichskin],
+                                                                               &player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
                                                                donesomething=1;
                                                        }
 
@@ -5682,8 +5268,8 @@ void      Game::Tick()
 
                                                                if(!donesomething){
                                                                        PlaySoundEx( consolefailsound, samp[consolefailsound], NULL, true);
-                                                                       FSOUND_SetVolume(channels[consolefailsound], 256);
-                                                                       FSOUND_SetPaused(channels[consolefailsound], false);
+                                                                       OPENAL_SetVolume(channels[consolefailsound], 256);
+                                                                       OPENAL_SetPaused(channels[consolefailsound], false);
                                                                }
                                                        }
                                                }
@@ -5708,10 +5294,6 @@ void     Game::Tick()
                        if(mainmenu==3){
                                if(newdetail>2)newdetail=detail;
                                if(newdetail<0)newdetail=detail;
-#if !USE_SDL  // we'll take anything that works.
-                               if(newscreenwidth>3000)newscreenwidth=screenwidth;
-                               if(newscreenheight>3000)newscreenheight=screenheight;
-#endif
                                if(newscreenwidth<0)newscreenwidth=screenwidth;
                                if(newscreenheight<0)newscreenheight=screenheight;
 
@@ -5789,16 +5371,18 @@ void    Game::Tick()
                                opstream << KeyToChar(attackkey);
                                opstream << "\nChat key:\n";
                                opstream << KeyToChar(chatkey);
+                               opstream << "\nDamage bar:\n";
+                               opstream << showdamagebar;
                                opstream.close();
                        }
                }
 
                static int oldwinfreeze;
                if(winfreeze&&!oldwinfreeze){
-                       FSOUND_SetFrequency(FSOUND_ALL, 0.001);
+                       OPENAL_SetFrequency(OPENAL_ALL, 0.001);
                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                       OPENAL_SetPaused(channels[consolesuccesssound], false);
                }
                if(winfreeze==0)oldwinfreeze=winfreeze;
                else oldwinfreeze++;
@@ -5905,9 +5489,9 @@ void      Game::Tick()
                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
                                                                        PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[whichsoundplay], 256);
-                                                                       FSOUND_SetPaused(channels[whichsoundplay], false);
+                                                                       OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[whichsoundplay], 256);
+                                                                       OPENAL_SetPaused(channels[whichsoundplay], false);
                                                                }
                                                                if(IsKeyDown(theKeyMap, attackkey))oldbuttondialogue=1;
                                                        }
@@ -6016,9 +5600,9 @@ void      Game::Tick()
                                                        vel[1]=0;
                                                        vel[2]=0;
                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                       FSOUND_SetPaused(channels[fireendsound], false);
+                                                       OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                       OPENAL_SetPaused(channels[fireendsound], false);
 
                                                        for(i=0;i<player[1].skeleton.num_joints;i++){
                                                                if(Random()%2==0){
@@ -6305,9 +5889,9 @@ void      Game::Tick()
                                                        vel[1]=0;
                                                        vel[2]=0;
                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                       FSOUND_SetPaused(channels[fireendsound], false);
+                                                       OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                       OPENAL_SetPaused(channels[fireendsound], false);
 
                                                        for(i=0;i<player[1].skeleton.num_joints;i++){
                                                                if(Random()%2==0){
@@ -6453,8 +6037,8 @@ void      Game::Tick()
 
                                                if(tutorialstagetime==tutorialmaxtime-3){
                                                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                       OPENAL_SetPaused(channels[consolesuccesssound], false);
                                                }
 
                                                if(tutorialsuccess>=1){
@@ -6473,15 +6057,15 @@ void    Game::Tick()
                                        if(tutoriallevel!=1){
                                                if(bonustime==0&&bonus!=solidhit&&bonus!=spinecrusher&&bonus!=tracheotomy&&bonus!=backstab&&bonusvalue>10){
                                                        PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
-                                                       FSOUND_SetVolume(channels[consolesuccesssound], 256);
-                                                       FSOUND_SetPaused(channels[consolesuccesssound], false);
+                                                       OPENAL_SetVolume(channels[consolesuccesssound], 256);
+                                                       OPENAL_SetPaused(channels[consolesuccesssound], false);
                                                }
                                        }
                                        else
                                                if(bonustime==0){
                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                       FSOUND_SetPaused(channels[fireendsound], false);
+                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                       OPENAL_SetPaused(channels[fireendsound], false);
                                                }
                                                if(bonustime==0){
                                                        if(bonus!=solidhit&&bonus!=twoxcombo&&bonus!=threexcombo&&bonus!=fourxcombo&&bonus!=megacombo)bonusnum[bonus]++;
@@ -6596,10 +6180,10 @@ void    Game::Tick()
                                                                                                                        vel[1]=0;
                                                                                                                        vel[2]=0;
                                                                                                                        PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
-                                                                                                                       FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
-                                                                                                                       FSOUND_SetVolume(channels[movewhooshsound], 256);
-                                                                                                                       FSOUND_SetPaused(channels[movewhooshsound], false);
-                                                                                                                       if(k==0)FSOUND_SetPaused(channels[whooshsound], true);
+                                                                                                                       OPENAL_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
+                                                                                                                       OPENAL_SetVolume(channels[movewhooshsound], 256);
+                                                                                                                       OPENAL_SetPaused(channels[movewhooshsound], false);
+                                                                                                                       if(k==0)OPENAL_SetPaused(channels[whooshsound], true);
 
                                                                                                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
                                                                                                                        player[k].rotation=-asin(0-lowpointtarget.x);
@@ -6627,10 +6211,10 @@ void    Game::Tick()
                                                                                                                                vel[1]=0;
                                                                                                                                vel[2]=0;
                                                                                                                                PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
-                                                                                                                               FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
-                                                                                                                               FSOUND_SetVolume(channels[movewhooshsound], 256);
-                                                                                                                               FSOUND_SetPaused(channels[movewhooshsound], false);
-                                                                                                                               if(k==0)FSOUND_SetPaused(channels[whooshsound], true);
+                                                                                                                               OPENAL_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
+                                                                                                                               OPENAL_SetVolume(channels[movewhooshsound], 256);
+                                                                                                                               OPENAL_SetPaused(channels[movewhooshsound], false);
+                                                                                                                               if(k==0)OPENAL_SetPaused(channels[whooshsound], true);
 
                                                                                                                                lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
                                                                                                                                player[k].rotation=-asin(0-lowpointtarget.x);
@@ -6658,10 +6242,10 @@ void    Game::Tick()
                                                                                                                                        vel[1]=0;
                                                                                                                                        vel[2]=0;
                                                                                                                                        PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
-                                                                                                                                       FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
-                                                                                                                                       FSOUND_SetVolume(channels[movewhooshsound], 256);
-                                                                                                                                       FSOUND_SetPaused(channels[movewhooshsound], false);
-                                                                                                                                       if(k==0)FSOUND_SetPaused(channels[whooshsound], true);
+                                                                                                                                       OPENAL_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
+                                                                                                                                       OPENAL_SetVolume(channels[movewhooshsound], 256);
+                                                                                                                                       OPENAL_SetPaused(channels[movewhooshsound], false);
+                                                                                                                                       if(k==0)OPENAL_SetPaused(channels[whooshsound], true);
 
                                                                                                                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
                                                                                                                                        player[k].rotation=-asin(0-lowpointtarget.x);
@@ -6689,10 +6273,10 @@ void    Game::Tick()
                                                                                                                                                vel[1]=0;
                                                                                                                                                vel[2]=0;
                                                                                                                                                PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
-                                                                                                                                               FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
-                                                                                                                                               FSOUND_SetVolume(channels[movewhooshsound], 256);
-                                                                                                                                               FSOUND_SetPaused(channels[movewhooshsound], false);
-                                                                                                                                               if(k==0)FSOUND_SetPaused(channels[whooshsound], true);
+                                                                                                                                               OPENAL_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
+                                                                                                                                               OPENAL_SetVolume(channels[movewhooshsound], 256);
+                                                                                                                                               OPENAL_SetPaused(channels[movewhooshsound], false);
+                                                                                                                                               if(k==0)OPENAL_SetPaused(channels[whooshsound], true);
 
                                                                                                                                                lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
                                                                                                                                                player[k].rotation=-asin(0-lowpointtarget.x);
@@ -6727,8 +6311,8 @@ void      Game::Tick()
                                                                                                                player[k].onterrain=1;
 
                                                                                                                if(player[k].id==0){
-                                                                                                                       FSOUND_SetPaused(channels[whooshsound], true);
-                                                                                                                       FSOUND_SetVolume(channels[whooshsound], 0);
+                                                                                                                       OPENAL_SetPaused(channels[whooshsound], true);
+                                                                                                                       OPENAL_SetVolume(channels[whooshsound], 0);
                                                                                                                }
 
                                                                                                                if((player[k].targetanimation==jumpdownanim||player[k].isFlip())&&!player[k].wasLanding()){
@@ -6743,9 +6327,9 @@ void      Game::Tick()
                                                                                                                        vel[1]=player[k].velocity.y;
                                                                                                                        vel[2]=player[k].velocity.z;
                                                                                                                        PlaySoundEx( landsound, samp[landsound], NULL, true);
-                                                                                                                       FSOUND_3D_SetAttributes(channels[landsound], gLoc, vel);
-                                                                                                                       FSOUND_SetVolume(channels[landsound], 128);
-                                                                                                                       FSOUND_SetPaused(channels[landsound], false);
+                                                                                                                       OPENAL_3D_SetAttributes(channels[landsound], gLoc, vel);
+                                                                                                                       OPENAL_SetVolume(channels[landsound], 128);
+                                                                                                                       OPENAL_SetPaused(channels[landsound], false);
                                                                                                                        if(k==0){
                                                                                                                                envsound[numenvsounds]=player[k].coords;
                                                                                                                                envsoundvol[numenvsounds]=16;
@@ -6843,7 +6427,7 @@ void      Game::Tick()
 
                                                                                                                                                                                                        if(j>10||!player[k].isRun()){
                                                                                                                                                                                                                if(player[k].targetanimation==jumpdownanim||player[k].targetanimation==jumpupanim){
-                                                                                                                                                                                                                       if(k==0)FSOUND_SetPaused(channels[whooshsound], true);
+                                                                                                                                                                                                                       if(k==0)OPENAL_SetPaused(channels[whooshsound], true);
                                                                                                                                                                                                                }
                                                                                                                                                                                                                float gLoc[3];
                                                                                                                                                                                                                float vel[3];
@@ -6854,9 +6438,9 @@ void      Game::Tick()
                                                                                                                                                                                                                vel[1]=player[k].velocity.y;
                                                                                                                                                                                                                vel[2]=player[k].velocity.z;
                                                                                                                                                                                                                PlaySoundEx( jumpsound, samp[jumpsound], NULL, true);
-                                                                                                                                                                                                               FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel);
-                                                                                                                                                                                                               FSOUND_SetVolume(channels[jumpsound], 128);
-                                                                                                                                                                                                               FSOUND_SetPaused(channels[jumpsound], false);
+                                                                                                                                                                                                               OPENAL_3D_SetAttributes(channels[jumpsound], gLoc, vel);
+                                                                                                                                                                                                               OPENAL_SetVolume(channels[jumpsound], 128);
+                                                                                                                                                                                                               OPENAL_SetPaused(channels[jumpsound], false);
 
                                                                                                                                                                                                                lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
                                                                                                                                                                                                                player[k].rotation=-asin(0-lowpointtarget.x);
@@ -6916,9 +6500,9 @@ void      Game::Tick()
                                                                                                                vel[2]=player[k].velocity.z;
                                                                                                                if(k==0){
                                                                                                                        PlaySoundEx( whooshsound, samp[whooshsound], NULL, true);
-                                                                                                                       FSOUND_3D_SetAttributes(channels[whooshsound], gLoc, vel);
-                                                                                                                       FSOUND_SetVolume(channels[whooshsound], 128);
-                                                                                                                       FSOUND_SetPaused(channels[whooshsound], false);
+                                                                                                                       OPENAL_3D_SetAttributes(channels[whooshsound], gLoc, vel);
+                                                                                                                       OPENAL_SetVolume(channels[whooshsound], 128);
+                                                                                                                       OPENAL_SetPaused(channels[whooshsound], false);
                                                                                                                }
                                                                                                        }
                                                                                                        player[k].velocity.y+=gravity;
@@ -7046,9 +6630,9 @@ void      Game::Tick()
                                                                                                if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
                                                                                                if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
                                                                                                PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
-                                                                                               FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
-                                                                                               FSOUND_SetVolume(channels[whichsoundplay], 256);
-                                                                                               FSOUND_SetPaused(channels[whichsoundplay], false);
+                                                                                               OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
+                                                                                               OPENAL_SetVolume(channels[whichsoundplay], 256);
+                                                                                               OPENAL_SetPaused(channels[whichsoundplay], false);
                                                                                        }
                                                                                }
 
@@ -7086,7 +6670,7 @@ void      Game::Tick()
                                                                                        }
                                                        }
                                                        if(!directing){
-                                                               FSOUND_SetPaused(channels[whooshsound], true);
+                                                               OPENAL_SetPaused(channels[whooshsound], true);
                                                                viewer=dialoguecamera[whichdialogue][indialogue];
                                                                if(viewer.y<terrain.getHeight(viewer.x,viewer.z)+.1){
                                                                        viewer.y=terrain.getHeight(viewer.x,viewer.z)+.1;
@@ -7138,9 +6722,9 @@ void      Game::Tick()
                                                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-6)whichsoundplay=alarmsound;
                                                                                                        if(dialogueboxsound[whichdialogue][indialogue]!=-5){
                                                                                                                PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
-                                                                                                               FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
-                                                                                                               FSOUND_SetVolume(channels[whichsoundplay], 256);
-                                                                                                               FSOUND_SetPaused(channels[whichsoundplay], false);
+                                                                                                               OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
+                                                                                                               OPENAL_SetVolume(channels[whichsoundplay], 256);
+                                                                                                               OPENAL_SetPaused(channels[whichsoundplay], false);
                                                                                                        }
                                                                                                        if(dialogueboxsound[whichdialogue][indialogue]==-5){
                                                                                                                hotspot[numhotspots]=player[0].coords;
@@ -7325,9 +6909,9 @@ void      Game::Tick()
                                                        vel[1]=0;
                                                        vel[2]=0;
                                                        PlaySoundEx( hawksound, samp[hawksound], NULL, true);
-                                                       FSOUND_3D_SetAttributes(channels[hawksound], gLoc, vel);
-                                                       FSOUND_SetVolume(channels[hawksound], 128);
-                                                       FSOUND_SetPaused(channels[hawksound], false);
+                                                       OPENAL_3D_SetAttributes(channels[hawksound], gLoc, vel);
+                                                       OPENAL_SetVolume(channels[hawksound], 128);
+                                                       OPENAL_SetPaused(channels[hawksound], false);
 
                                                        hawkcalldelay=16+abs(Random()%8);
                                                }
@@ -7498,50 +7082,8 @@ void     Game::Tick()
                                                                        if(player[closest].whichskin>9)player[closest].whichskin=0;
                                                                        if(player[closest].whichskin>2&&player[closest].creature==wolftype)player[closest].whichskin=0;
 
-                                                                       if(player[closest].creature==rabbittype){
-                                                                               if(player[closest].whichskin==0){
-                                                                                       LoadTextureSave(":Data:Textures:Fur3.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==1){
-                                                                                       LoadTextureSave(":Data:Textures:Fur.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==2){
-                                                                                       LoadTextureSave(":Data:Textures:Fur2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==3){
-                                                                                       LoadTextureSave(":Data:Textures:Lynx.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==4){
-                                                                                       LoadTextureSave(":Data:Textures:Otter.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==5){
-                                                                                       LoadTextureSave(":Data:Textures:Opal.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==6){
-                                                                                       LoadTextureSave(":Data:Textures:Sable.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==7){
-                                                                                       LoadTextureSave(":Data:Textures:Chocolate.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==8){
-                                                                                       LoadTextureSave(":Data:Textures:BW2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==9){
-                                                                                       LoadTextureSave(":Data:Textures:WB2.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                       }
-                                                                       if(player[closest].creature==wolftype){
-                                                                               k=abs(Random()%3);
-                                                                               if(player[closest].whichskin==0){
-                                                                                       LoadTextureSave(":Data:Textures:Wolf.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==1){
-                                                                                       LoadTextureSave(":Data:Textures:Darkwolf.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                               else if(player[closest].whichskin==2){
-                                                                                       LoadTextureSave(":Data:Textures:Snowwolf.jpg",&player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
-                                                                               }
-                                                                       }
+                                                                       LoadTextureSave(creatureskin[player[closest].creature][player[closest].whichskin],
+                                                                                       &player[closest].skeleton.drawmodel.textureptr,1,&player[closest].skeleton.skinText[0],&player[closest].skeleton.skinsize);
                                                                }
 
                                                                if(player[closest].numclothes){
@@ -7694,14 +7236,14 @@ void    Game::Tick()
                                                                        vel[1]=0;
                                                                        vel[2]=0;
                                                                        PlaySoundEx( splattersound, samp[splattersound], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[splattersound], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[splattersound], 256);
-                                                                       FSOUND_SetPaused(channels[splattersound], false);
+                                                                       OPENAL_3D_SetAttributes(channels[splattersound], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[splattersound], 256);
+                                                                       OPENAL_SetPaused(channels[splattersound], false);
 
                                                                        PlaySoundEx( breaksound2, samp[breaksound2], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[breaksound2], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[breaksound2], 100);
-                                                                       FSOUND_SetPaused(channels[breaksound2], false);
+                                                                       OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[breaksound2], 100);
+                                                                       OPENAL_SetPaused(channels[breaksound2], false);
 
                                                                        if(player[closest].skeleton.free==2)player[closest].skeleton.free=0;
                                                                        player[closest].RagDoll(0);
@@ -7743,14 +7285,14 @@ void    Game::Tick()
                                                                        vel[2]=0;
 
                                                                        PlaySoundEx( splattersound, samp[splattersound], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[splattersound], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[splattersound], 256);
-                                                                       FSOUND_SetPaused(channels[splattersound], false);
+                                                                       OPENAL_3D_SetAttributes(channels[splattersound], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[splattersound], 256);
+                                                                       OPENAL_SetPaused(channels[splattersound], false);
 
                                                                        PlaySoundEx( breaksound2, samp[breaksound2], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[breaksound2], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[breaksound2], 600);
-                                                                       FSOUND_SetPaused(channels[breaksound2], false);
+                                                                       OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[breaksound2], 600);
+                                                                       OPENAL_SetPaused(channels[breaksound2], false);
 
                                                                        for(i=0;i<player[closest].skeleton.num_joints; i++){
                                                                                if(!player[closest].skeleton.free)flatvelocity2=player[closest].velocity;
@@ -7912,10 +7454,10 @@ void    Game::Tick()
                                                                vel[1]=0;
                                                                vel[2]=0;
                                                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[fireendsound], 256);
-                                                               FSOUND_SetPaused(channels[fireendsound], false);
-                                                               FSOUND_SetPaused(channels[stream_firesound], true);
+                                                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[fireendsound], 256);
+                                                               OPENAL_SetPaused(channels[fireendsound], false);
+                                                               OPENAL_SetPaused(channels[stream_firesound], true);
                                                        }
                                                        slomotogglekeydown=1;
                                                }
@@ -8336,10 +7878,10 @@ void    Game::Tick()
                                                        vel[1]=player[0].velocity.y;
                                                        vel[2]=player[0].velocity.z;
                                                        PlaySoundEx( whooshsound, samp[whooshsound], NULL, true);
-                                                       FSOUND_3D_SetAttributes(channels[whooshsound], gLoc, vel);
-                                                       FSOUND_SetVolume(channels[whooshsound], 128);
-                                                       FSOUND_SetPaused(channels[whooshsound], false);
-                                                       //FSOUND_SetPaused(channels[whooshsound], true);
+                                                       OPENAL_3D_SetAttributes(channels[whooshsound], gLoc, vel);
+                                                       OPENAL_SetVolume(channels[whooshsound], 128);
+                                                       OPENAL_SetPaused(channels[whooshsound], false);
+                                                       //OPENAL_SetPaused(channels[whooshsound], true);
 
                                                        texturesizetogglekeydown=1;
                                                }
@@ -8760,9 +8302,9 @@ void      Game::Tick()
                                                                                                                                                                                                                                vel[2]=player[i].velocity.z;
                                                                                                                                                                                                                                if(tutoriallevel!=1){
                                                                                                                                                                                                                                        PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
-                                                                                                                                                                                                                                       FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
-                                                                                                                                                                                                                                       FSOUND_SetVolume(channels[heavyimpactsound], 256);
-                                                                                                                                                                                                                                       FSOUND_SetPaused(channels[heavyimpactsound], false);
+                                                                                                                                                                                                                                       OPENAL_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
+                                                                                                                                                                                                                                       OPENAL_SetVolume(channels[heavyimpactsound], 256);
+                                                                                                                                                                                                                                       OPENAL_SetPaused(channels[heavyimpactsound], false);
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                //player[i].velocity=player[k].velocity;
                                                                                                                                                                                                                                //player[k].velocity=player[i].velocity;
@@ -9060,7 +8602,7 @@ void      Game::Tick()
                                                        /*
                                                        if(IsKeyDown(theKeyMap, MAC_Z_KEY)){
                                                        //Respawn
-                                                       FSOUND_SetPaused(channels[whooshsound], true);
+                                                       OPENAL_SetPaused(channels[whooshsound], true);
                                                        changedelay=0;
                                                        for(k=0;k<numplayers;k++){
                                                        player[k].dead=0;
@@ -10134,9 +9676,9 @@ void     Game::Tick()
                                                                                                                                                        vel[2]=player[i].velocity.z;
                                                                                                                                                        if(weapons.type[j]!=staff){
                                                                                                                                                                PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
-                                                                                                                                                               FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
-                                                                                                                                                               FSOUND_SetVolume(channels[knifedrawsound], 128);
-                                                                                                                                                               FSOUND_SetPaused(channels[knifedrawsound], false);
+                                                                                                                                                               OPENAL_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
+                                                                                                                                                               OPENAL_SetVolume(channels[knifedrawsound], 128);
+                                                                                                                                                               OPENAL_SetPaused(channels[knifedrawsound], false);
                                                                                                                                                        }
 
                                                                                                                                                        player[i].weaponactive=0;
@@ -10181,9 +9723,9 @@ void     Game::Tick()
                                                                                                                                                                vel[2]=player[i].velocity.z;
                                                                                                                                                                if(weapons.type[k]!=staff){
                                                                                                                                                                        PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
-                                                                                                                                                                       FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
-                                                                                                                                                                       FSOUND_SetVolume(channels[knifedrawsound], 128);
-                                                                                                                                                                       FSOUND_SetPaused(channels[knifedrawsound], false);
+                                                                                                                                                                       OPENAL_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
+                                                                                                                                                                       OPENAL_SetVolume(channels[knifedrawsound], 128);
+                                                                                                                                                                       OPENAL_SetPaused(channels[knifedrawsound], false);
                                                                                                                                                                }
 
                                                                                                                                                                player[i].weaponactive=0;
@@ -10242,16 +9784,16 @@ void   Game::Tick()
                                                                                                                                                        if(!fleshstuck){
                                                                                                                                                                if(weapons.type[k]!=staff){
                                                                                                                                                                        PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
-                                                                                                                                                                       FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
-                                                                                                                                                                       FSOUND_SetVolume(channels[knifedrawsound], 128);
-                                                                                                                                                                       FSOUND_SetPaused(channels[knifedrawsound], false);
+                                                                                                                                                                       OPENAL_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
+                                                                                                                                                                       OPENAL_SetVolume(channels[knifedrawsound], 128);
+                                                                                                                                                                       OPENAL_SetPaused(channels[knifedrawsound], false);
                                                                                                                                                                }
                                                                                                                                                        }
                                                                                                                                                        if(fleshstuck){
                                                                                                                                                                PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true);
-                                                                                                                                                               FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
-                                                                                                                                                               FSOUND_SetVolume(channels[fleshstabremovesound], 128);
-                                                                                                                                                               FSOUND_SetPaused(channels[fleshstabremovesound], false);
+                                                                                                                                                               OPENAL_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
+                                                                                                                                                               OPENAL_SetVolume(channels[fleshstabremovesound], 128);
+                                                                                                                                                               OPENAL_SetPaused(channels[fleshstabremovesound], false);
                                                                                                                                                        }
 
                                                                                                                                                        player[i].weaponactive=0;
@@ -10677,15 +10219,15 @@ void  Game::Tick()
 
                                                                                                                if(i==0){
                                                                                                                        PlaySoundEx( whooshsound, samp[whooshsound], NULL, true);
-                                                                                                                       FSOUND_3D_SetAttributes(channels[whooshsound], gLoc, vel);
-                                                                                                                       FSOUND_SetVolume(channels[whooshsound], 128);
-                                                                                                                       FSOUND_SetPaused(channels[whooshsound], false);
+                                                                                                                       OPENAL_3D_SetAttributes(channels[whooshsound], gLoc, vel);
+                                                                                                                       OPENAL_SetVolume(channels[whooshsound], 128);
+                                                                                                                       OPENAL_SetPaused(channels[whooshsound], false);
                                                                                                                }
 
                                                                                                                PlaySoundEx( jumpsound, samp[jumpsound], NULL, true);
-                                                                                                               FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel);
-                                                                                                               FSOUND_SetVolume(channels[jumpsound], 128);
-                                                                                                               FSOUND_SetPaused(channels[jumpsound], false);
+                                                                                                               OPENAL_3D_SetAttributes(channels[jumpsound], gLoc, vel);
+                                                                                                               OPENAL_SetVolume(channels[jumpsound], 128);
+                                                                                                               OPENAL_SetPaused(channels[jumpsound], false);
                                                                                                }
                                                                                                if((player[i].isIdle())&&player[i].jumppower>1){
                                                                                                        player[i].targetanimation=player[i].getLanding();
@@ -10827,8 +10369,8 @@ void    Game::Tick()
                                                                                envsound[j]=envsound[numenvsounds];
                                                                        }
                                                                }
-                                                               if(!slomo)FSOUND_SetFrequency(FSOUND_ALL, 22050);
-                                                               if(slomo)FSOUND_SetFrequency(FSOUND_ALL, slomofreq);
+                                                               if(!slomo)OPENAL_SetFrequency(OPENAL_ALL, 22050);
+                                                               if(slomo)OPENAL_SetFrequency(OPENAL_ALL, slomofreq);
 
                                                                if(tutoriallevel==1){
                                                                        XYZ temp;
@@ -10849,24 +10391,24 @@ void  Game::Tick()
                                                                        oldtemp2=temp2;
                                                                        if(tutorialstage>=51)
                                                                                if(findDistancefast(&temp,&player[0].coords)>=findDistancefast(&temp,&temp2)-1||findDistancefast(&temp3,&player[0].coords)<4){
-                                                   FSOUND_StopSound(FSOUND_ALL);  // hack...OpenAL renderer isn't stopping music after tutorial goes to level menu...
-                                                                                       FSOUND_SetFrequency(FSOUND_ALL, 0.001);
+                                                   OPENAL_StopSound(OPENAL_ALL);  // hack...OpenAL renderer isn't stopping music after tutorial goes to level menu...
+                                                                                       OPENAL_SetFrequency(OPENAL_ALL, 0.001);
 
                                                                                        PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                                                                                       FSOUND_SetPaused(channels[stream_music3], false);
-                                                                                       FSOUND_SetVolume(channels[stream_music3], 256);
+                                                                                       OPENAL_SetPaused(channels[stream_music3], false);
+                                                                                       OPENAL_SetVolume(channels[stream_music3], 256);
 
                                                                                        gameon=0;
                                                                                        mainmenu=5;
 
                                                                                        float gLoc[3]={0,0,0};
                                                                                        float vel[3]={0,0,0};
-                                                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                                                                                       OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                                                       FSOUND_SetPaused(channels[fireendsound], false);
-                                                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                                                                                       OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                                                       OPENAL_SetPaused(channels[fireendsound], false);
+                                                                                       OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                                                                        flashr=1;
                                                                                        flashg=0;
@@ -10885,9 +10427,9 @@ void    Game::Tick()
                                                                                                vel[1]=0;
                                                                                                vel[2]=0;
                                                                                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                                                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                                                               FSOUND_SetVolume(channels[fireendsound], 256);
-                                                                                               FSOUND_SetPaused(channels[fireendsound], false);
+                                                                                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                                                               OPENAL_SetVolume(channels[fireendsound], 256);
+                                                                                               OPENAL_SetPaused(channels[fireendsound], false);
 
                                                                                                player[0].coords=(oldtemp+oldtemp2)/2;
 
@@ -10908,9 +10450,9 @@ void    Game::Tick()
                                                                                                        vel[1]=0;
                                                                                                        vel[2]=0;
                                                                                                        PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                                                                       FSOUND_SetPaused(channels[fireendsound], false);
+                                                                                                       OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                                                                       OPENAL_SetVolume(channels[fireendsound], 256);
+                                                                                                       OPENAL_SetPaused(channels[fireendsound], false);
 
                                                                                                        for(int i=0;i<player[1].skeleton.num_joints;i++){
                                                                                                                if(Random()%2==0){
@@ -10970,8 +10512,8 @@ void    Game::Tick()
                                                                ori[4] = upvector.y;
                                                                ori[5] = -upvector.z;
 
-                                                               FSOUND_3D_Listener_SetAttributes(&gLoc[0], &vel[0], ori[0], ori[1], ori[2], ori[3], ori[4], ori[5]);
-                                                               FSOUND_Update();
+                                                               OPENAL_3D_Listener_SetAttributes(&gLoc[0], &vel[0], ori[0], ori[1], ori[2], ori[3], ori[4], ori[5]);
+                                                               OPENAL_Update();
 
                                                                oldviewer=viewer;
                }
@@ -10994,55 +10536,7 @@ void   Game::TickOnce(){
                        if(rotation2<-70)rotation2=-70;
                }
                if(mainmenu)rotation+=multiplier*5;
-               if(!mainmenu&&!indemo&&!registered){
-                       FSOUND_SetFrequency(FSOUND_ALL, 0.001);
-                       PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                       FSOUND_SetPaused(channels[stream_music3], false);
-                       FSOUND_SetVolume(channels[stream_music3], 256);
-
-                       gameon=0;
-                       mainmenu=12;
-
-                       float gLoc[3]={0,0,0};
-                       float vel[3]={0,0,0};
-                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                       PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                       FSOUND_SetVolume(channels[fireendsound], 256);
-                       FSOUND_SetPaused(channels[fireendsound], false);
-                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                       flashr=1;
-                       flashg=0;
-                       flashb=0;
-                       flashamount=1;
-                       flashdelay=1;
-               }
-
-               if(tryquit==1&&!registered&&mainmenu!=12){
-                       FSOUND_SetFrequency(FSOUND_ALL, 0.001);
-                       PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                       FSOUND_SetPaused(channels[stream_music3], false);
-                       FSOUND_SetVolume(channels[stream_music3], 256);
-
-                       gameon=0;
-                       mainmenu=12;
-
-                       float gLoc[3]={0,0,0};
-                       float vel[3]={0,0,0};
-                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                       PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                       FSOUND_SetVolume(channels[fireendsound], 256);
-                       FSOUND_SetPaused(channels[fireendsound], false);
-                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                       flashr=1;
-                       flashg=0;
-                       flashb=0;
-                       flashamount=1;
-                       flashdelay=1;
-               }
+      
                //}
 }
 
@@ -11108,8 +10602,8 @@ void    Game::TickOnceAfter(){
                                vel[1]=0;
                                vel[2]=0;
                                PlaySoundEx( alarmsound, samp[alarmsound], NULL, true);
-                               FSOUND_SetVolume(channels[alarmsound], 512);
-                               FSOUND_SetPaused(channels[alarmsound], false);
+                               OPENAL_SetVolume(channels[alarmsound], 512);
+                               OPENAL_SetPaused(channels[alarmsound], false);
 
                        }
                }
@@ -11140,22 +10634,22 @@ void  Game::TickOnceAfter(){
                if(musictoggle){
                        if(musicvolume[0]>0&&oldmusicvolume[0]<=0){
                                PlayStreamEx( music1, strm[music1], NULL, true);
-                               FSOUND_SetPaused(channels[music1], false);
+                               OPENAL_SetPaused(channels[music1], false);
                        }
                        if(musicvolume[1]>0&&oldmusicvolume[1]<=0){
                                PlayStreamEx( stream_music2, strm[stream_music2], NULL, true);
-                               FSOUND_SetPaused(channels[stream_music2], false);
+                               OPENAL_SetPaused(channels[stream_music2], false);
                        }
                        if(musicvolume[2]>0&&oldmusicvolume[2]<=0){
                                PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                               FSOUND_SetPaused(channels[stream_music3], false);
+                               OPENAL_SetPaused(channels[stream_music3], false);
                        }
                }
 
                if(!musictoggle){
-                       FSOUND_SetPaused(channels[music1], true);
-                       FSOUND_SetPaused(channels[stream_music2], true);
-                       FSOUND_SetPaused(channels[stream_music3], true);
+                       OPENAL_SetPaused(channels[music1], true);
+                       OPENAL_SetPaused(channels[stream_music2], true);
+                       OPENAL_SetPaused(channels[stream_music3], true);
 
                        for(i=0;i<4;i++){
                                oldmusicvolume[i]=0;
@@ -11165,23 +10659,23 @@ void  Game::TickOnceAfter(){
 
                if(musictoggle){
                        if(musicvolume[0]<=0&&oldmusicvolume[0]>0){
-                               FSOUND_SetPaused(channels[music1], true);
+                               OPENAL_SetPaused(channels[music1], true);
                        }
                        if(musicvolume[1]<=0&&oldmusicvolume[1]>0){
-                               FSOUND_SetPaused(channels[stream_music2], true);
+                               OPENAL_SetPaused(channels[stream_music2], true);
                        }
                        if(musicvolume[2]<=0&&oldmusicvolume[2]>0){
-                               FSOUND_SetPaused(channels[stream_music3], true);
+                               OPENAL_SetPaused(channels[stream_music3], true);
                        }
 
                        if(musicvolume[0]!=oldmusicvolume[0]){
-                               FSOUND_SetVolume(channels[music1], musicvolume[0]);
+                               OPENAL_SetVolume(channels[music1], musicvolume[0]);
                        }
                        if(musicvolume[1]!=oldmusicvolume[1]){
-                               FSOUND_SetVolume(channels[stream_music2], musicvolume[1]);
+                               OPENAL_SetVolume(channels[stream_music2], musicvolume[1]);
                        }
                        if(musicvolume[2]!=oldmusicvolume[2]){
-                               FSOUND_SetVolume(channels[stream_music3], musicvolume[2]);
+                               OPENAL_SetVolume(channels[stream_music3], musicvolume[2]);
                        }
 
                        for(i=0;i<3;i++){
@@ -11298,12 +10792,12 @@ void  Game::TickOnceAfter(){
 
                                                                float gLoc[3]={0,0,0};
                                                                float vel[3]={0,0,0};
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[firestartsound], 256);
-                                                               FSOUND_SetPaused(channels[firestartsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[firestartsound], 256);
+                                                               OPENAL_SetPaused(channels[firestartsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                                                if(!player[0].dead&&targetlevel!=whichlevel){
                                                                        startbonustotal=bonustotal;
@@ -11311,12 +10805,12 @@ void  Game::TickOnceAfter(){
                                                                if(!player[0].dead)Loadlevel(targetlevel);
                                                                if(player[0].dead)Loadlevel(whichlevel);
 
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[fireendsound], 256);
-                                                               FSOUND_SetPaused(channels[fireendsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[fireendsound], 256);
+                                                               OPENAL_SetPaused(channels[fireendsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                                                loading=3;
                                                        }
@@ -11330,12 +10824,12 @@ void  Game::TickOnceAfter(){
 
                                                                float gLoc[3]={0,0,0};
                                                                float vel[3]={0,0,0};
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[firestartsound], 256);
-                                                               FSOUND_SetPaused(channels[firestartsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[firestartsound], 256);
+                                                               OPENAL_SetPaused(channels[firestartsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                                                for(i=0;i<255;i++){
                                                                        mapname[i]='\0';
@@ -11354,43 +10848,18 @@ void  Game::TickOnceAfter(){
                                                                strcat(mapname,campaignmapname[levelorder[accountcampaignchoicesmade[accountactive]]]);//[campaignchoicewhich[whichchoice]]);
                                                                Loadlevel(mapname);
 
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
                                                                PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                               FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                               FSOUND_SetVolume(channels[fireendsound], 256);
-                                                               FSOUND_SetPaused(channels[fireendsound], false);
-                                                               FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
+                                                               OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
+                                                               OPENAL_SetVolume(channels[fireendsound], 256);
+                                                               OPENAL_SetPaused(channels[fireendsound], false);
+                                                               OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
 
                                                                loading=3;
                                                        }
                                                        if(changedelay<=-999&&whichlevel!=-2&&!loading&&(player[0].dead||(alldead&&maptype==mapkilleveryone)||(winhotspot)||(killhotspot))&&!winfreeze)loading=1;
                                                        if((player[0].dead||(alldead&&maptype==mapkilleveryone)||(winhotspot)||(windialogue)||(killhotspot))&&changedelay<=0){
-                                                               if(accountprogress[accountactive]>3&&!registered){
-                                                                       FSOUND_SetFrequency(FSOUND_ALL, 0.001);
-                                                                       PlayStreamEx( stream_music3, strm[stream_music3], NULL, true);
-                                                                       FSOUND_SetPaused(channels[stream_music3], false);
-                                                                       FSOUND_SetVolume(channels[stream_music3], 256);
-
-                                                                       gameon=0;
-                                                                       mainmenu=12;
-                                                                       accountprogress[accountactive]=3;
-
-                                                                       float gLoc[3]={0,0,0};
-                                                                       float vel[3]={0,0,0};
-                                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
-                                                                       PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[fireendsound], 256);
-                                                                       FSOUND_SetPaused(channels[fireendsound], false);
-                                                                       FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
-
-                                                                       flashr=1;
-                                                                       flashg=0;
-                                                                       flashb=0;
-                                                                       flashamount=1;
-                                                                       flashdelay=1;
-                                                               }
-                                                               else{
+                        {
                                                                        if(whichlevel!=-2&&!loading&&!player[0].dead){
                                                                                winfreeze=1;
                                                                                changedelay=-999;
@@ -11414,12 +10883,12 @@ void  Game::TickOnceAfter(){
                                                                if(!stealthloading){
                                                                        float gLoc[3]={0,0,0};
                                                                        float vel[3]={0,0,0};
-                                                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
+                                                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
                                                                        PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
-                                                                       FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
-                                                                       FSOUND_SetVolume(channels[firestartsound], 256);
-                                                                       FSOUND_SetPaused(channels[firestartsound], false);
-                                                                       FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
+                                                                       OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel);
+                                                                       OPENAL_SetVolume(channels[firestartsound], 256);
+                                                                       OPENAL_SetPaused(channels[firestartsound], false);
+                                                                       OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
 
                                                                        flashr=1;
                                                                        flashg=0;
@@ -11530,7 +10999,7 @@ void    Game::TickOnceAfter(){
                                                                        campaign=1;
                                                                        mainmenu=0;
                                                                        gameon=1;
-                                                                       FSOUND_SetPaused(channels[stream_music3], true);
+                                                                       OPENAL_SetPaused(channels[stream_music3], true);
 
                                                                        stealthloading=0;
                                                        }